From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-gpio@vger.kernel.org
Cc: linux-mips@linux-mips.org, gregory.0xf0@gmail.com,
jaedon.shin@gmail.com, linus.walleij@linaro.org,
gnurou@gmail.com, bcm-kernel-feedback-list@broadcom.com,
Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH 2/3] gpio: brcmstb: Set endian flags for big-endian MIPS
Date: Wed, 6 Jan 2016 10:55:22 -0800 [thread overview]
Message-ID: <1452106523-11556-3-git-send-email-f.fainelli@gmail.com> (raw)
In-Reply-To: <1452106523-11556-1-git-send-email-f.fainelli@gmail.com>
Broadcom MIPS-based STB chips endianness is configured by boot strap,
which also reverses all bus endianness (i.e., big-endian CPU + big
endian bus ==> native endian I/O).
Other architectures (e.g., ARM) either do not support big endian, or
else leave I/O in little endian mode.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/gpio/gpio-brcmstb.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
index 3618b9fd0cba..8e8ddc76a56f 100644
--- a/drivers/gpio/gpio-brcmstb.c
+++ b/drivers/gpio/gpio-brcmstb.c
@@ -409,6 +409,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
int num_banks = 0;
int err;
static int gpio_base;
+ unsigned long flags = 0;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -438,6 +439,18 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
if (brcmstb_gpio_sanity_check_banks(dev, np, res))
return -EINVAL;
+ /*
+ * MIPS endianness is configured by boot strap, which also reverses all
+ * bus endianness (i.e., big-endian CPU + big endian bus ==> native
+ * endian I/O).
+ *
+ * Other architectures (e.g., ARM) either do not support big endian, or
+ * else leave I/O in little endian mode.
+ */
+#if defined(CONFIG_MIPS) && defined(__BIG_ENDIAN)
+ flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER;
+#endif
+
of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p,
bank_width) {
struct brcmstb_gpio_bank *bank;
@@ -466,7 +479,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
err = bgpio_init(gc, dev, 4,
reg_base + GIO_DATA(bank->id),
NULL, NULL, NULL,
- reg_base + GIO_IODIR(bank->id), 0);
+ reg_base + GIO_IODIR(bank->id), flags);
if (err) {
dev_err(dev, "bgpio_init() failed\n");
goto fail;
--
2.1.0
next prev parent reply other threads:[~2016-01-06 18:56 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 18:55 [PATCH 0/3] gpio: brcmstb: Misc changes Florian Fainelli
2016-01-06 18:55 ` [PATCH 1/3] gpio: brcmstb: have driver register during subsys_initcall() Florian Fainelli
2016-01-07 6:05 ` Gregory Fong
2016-01-07 18:12 ` Florian Fainelli
2016-01-19 21:18 ` Jim Quinlan
2016-01-20 9:40 ` Gregory Fong
2016-01-20 15:30 ` Jim Quinlan
2016-01-07 15:28 ` Linus Walleij
2016-01-06 18:55 ` Florian Fainelli [this message]
2016-01-07 8:08 ` [PATCH 2/3] gpio: brcmstb: Set endian flags for big-endian MIPS Gregory Fong
2016-01-07 15:26 ` Linus Walleij
2016-01-06 18:55 ` [PATCH 3/3] gpio: brcmstb: Allow building driver for BMIPS_GENERIC Florian Fainelli
2016-01-07 8:12 ` Gregory Fong
2016-01-07 15:27 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1452106523-11556-3-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=gnurou@gmail.com \
--cc=gregory.0xf0@gmail.com \
--cc=jaedon.shin@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).