Skip to content

Commit

Permalink
spmi: pmic-arb: Don't byte swap when reading/writing FIFO
Browse files Browse the repository at this point in the history
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 <agross@codeaurora.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Stephen Boyd authored and Greg Kroah-Hartman committed Oct 4, 2015
1 parent 48e3d66 commit d514479
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions drivers/spmi/spmi-pmic-arb.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,6 @@ struct pmic_arb_ver_ops {
u32 (*irq_clear)(u8 n);
};

static inline u32 pmic_arb_base_read(struct spmi_pmic_arb_dev *dev, u32 offset)
{
return readl_relaxed(dev->rd_base + offset);
}

static inline void pmic_arb_base_write(struct spmi_pmic_arb_dev *dev,
u32 offset, u32 val)
{
Expand All @@ -193,7 +188,7 @@ static inline void pmic_arb_set_rd_cmd(struct spmi_pmic_arb_dev *dev,
*/
static void pa_read_data(struct spmi_pmic_arb_dev *dev, u8 *buf, u32 reg, u8 bc)
{
u32 data = pmic_arb_base_read(dev, reg);
u32 data = __raw_readl(dev->rd_base + reg);
memcpy(buf, &data, (bc & 3) + 1);
}

Expand All @@ -208,7 +203,7 @@ pa_write_data(struct spmi_pmic_arb_dev *dev, const u8 *buf, u32 reg, u8 bc)
{
u32 data = 0;
memcpy(&data, buf, (bc & 3) + 1);
pmic_arb_base_write(dev, reg, data);
__raw_writel(data, dev->wr_base + reg);
}

static int pmic_arb_wait_for_done(struct spmi_controller *ctrl,
Expand Down

0 comments on commit d514479

Please sign in to comment.