Skip to content

Commit d514479

Browse files
bebarinogregkh
authored andcommitted
spmi: pmic-arb: Don't byte swap when reading/writing FIFO
We don't want to swap bytes that we're reading and writing to the FIFOs when we're running on a big-endian CPU. Doing so causes problems like where the qcom-spmi-iadc driver can't detect the type of device because the bytes are all mixed up. Use the raw IO accessors for these API instead, and collapse pmic_arb_base_read() into the byte reading API so that we aren't tempted to read non-FIFO data like commands with that function. Cc: Andy Gross <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Acked-by: Bjorn Andersson <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 48e3d66 commit d514479

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

drivers/spmi/spmi-pmic-arb.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,6 @@ struct pmic_arb_ver_ops {
168168
u32 (*irq_clear)(u8 n);
169169
};
170170

171-
static inline u32 pmic_arb_base_read(struct spmi_pmic_arb_dev *dev, u32 offset)
172-
{
173-
return readl_relaxed(dev->rd_base + offset);
174-
}
175-
176171
static inline void pmic_arb_base_write(struct spmi_pmic_arb_dev *dev,
177172
u32 offset, u32 val)
178173
{
@@ -193,7 +188,7 @@ static inline void pmic_arb_set_rd_cmd(struct spmi_pmic_arb_dev *dev,
193188
*/
194189
static void pa_read_data(struct spmi_pmic_arb_dev *dev, u8 *buf, u32 reg, u8 bc)
195190
{
196-
u32 data = pmic_arb_base_read(dev, reg);
191+
u32 data = __raw_readl(dev->rd_base + reg);
197192
memcpy(buf, &data, (bc & 3) + 1);
198193
}
199194

@@ -208,7 +203,7 @@ pa_write_data(struct spmi_pmic_arb_dev *dev, const u8 *buf, u32 reg, u8 bc)
208203
{
209204
u32 data = 0;
210205
memcpy(&data, buf, (bc & 3) + 1);
211-
pmic_arb_base_write(dev, reg, data);
206+
__raw_writel(data, dev->wr_base + reg);
212207
}
213208

214209
static int pmic_arb_wait_for_done(struct spmi_controller *ctrl,

0 commit comments

Comments
 (0)