* [PATCH] spmi: pmic-arb: Don't byte swap when reading/writing FIFO
@ 2015-08-28 19:21 Stephen Boyd
2015-08-28 20:01 ` Bjorn Andersson
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Boyd @ 2015-08-28 19:21 UTC (permalink / raw)
To: linux-arm-kernel
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>
Cc: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
drivers/spmi/spmi-pmic-arb.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index bdfb3c84c3cb..5e834bd23c09 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -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)
{
@@ -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);
}
@@ -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,
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] spmi: pmic-arb: Don't byte swap when reading/writing FIFO
2015-08-28 19:21 [PATCH] spmi: pmic-arb: Don't byte swap when reading/writing FIFO Stephen Boyd
@ 2015-08-28 20:01 ` Bjorn Andersson
0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Andersson @ 2015-08-28 20:01 UTC (permalink / raw)
To: linux-arm-kernel
On Fri 28 Aug 12:21 PDT 2015, Stephen Boyd wrote:
> 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>
Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Regards,
Bjorn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-28 20:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-28 19:21 [PATCH] spmi: pmic-arb: Don't byte swap when reading/writing FIFO Stephen Boyd
2015-08-28 20:01 ` Bjorn Andersson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).