mirror of
https://github.com/torvalds/linux
synced 2024-09-20 11:07:02 +00:00
gpio: brcmstb: Set endian flags for big-endian MIPS
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> Acked-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
780c43dd61
commit
ce5a7e8139
|
@ -409,6 +409,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
|
||||||
int num_banks = 0;
|
int num_banks = 0;
|
||||||
int err;
|
int err;
|
||||||
static int gpio_base;
|
static int gpio_base;
|
||||||
|
unsigned long flags = 0;
|
||||||
|
|
||||||
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
|
||||||
if (!priv)
|
if (!priv)
|
||||||
|
@ -438,6 +439,18 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
|
||||||
if (brcmstb_gpio_sanity_check_banks(dev, np, res))
|
if (brcmstb_gpio_sanity_check_banks(dev, np, res))
|
||||||
return -EINVAL;
|
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,
|
of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p,
|
||||||
bank_width) {
|
bank_width) {
|
||||||
struct brcmstb_gpio_bank *bank;
|
struct brcmstb_gpio_bank *bank;
|
||||||
|
@ -466,7 +479,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
|
||||||
err = bgpio_init(gc, dev, 4,
|
err = bgpio_init(gc, dev, 4,
|
||||||
reg_base + GIO_DATA(bank->id),
|
reg_base + GIO_DATA(bank->id),
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
reg_base + GIO_IODIR(bank->id), 0);
|
reg_base + GIO_IODIR(bank->id), flags);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(dev, "bgpio_init() failed\n");
|
dev_err(dev, "bgpio_init() failed\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
Loading…
Reference in a new issue