diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2016-01-06 13:55:22 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2016-01-07 10:25:09 -0500 |
commit | ce5a7e81390b9ae28f8dc82505afa96c1787d312 (patch) | |
tree | 8c18c00d5eb62a37ccc474d4c8eb72ada410ad54 | |
parent | 780c43dd61a09ce7d9cdb1e7c33d3341ec471ff0 (diff) |
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>
-rw-r--r-- | drivers/gpio/gpio-brcmstb.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c index dc3f0395693b..d7644251e869 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) | |||
409 | int num_banks = 0; | 409 | int num_banks = 0; |
410 | int err; | 410 | int err; |
411 | static int gpio_base; | 411 | static int gpio_base; |
412 | unsigned long flags = 0; | ||
412 | 413 | ||
413 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | 414 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); |
414 | if (!priv) | 415 | if (!priv) |
@@ -438,6 +439,18 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) | |||
438 | if (brcmstb_gpio_sanity_check_banks(dev, np, res)) | 439 | if (brcmstb_gpio_sanity_check_banks(dev, np, res)) |
439 | return -EINVAL; | 440 | return -EINVAL; |
440 | 441 | ||
442 | /* | ||
443 | * MIPS endianness is configured by boot strap, which also reverses all | ||
444 | * bus endianness (i.e., big-endian CPU + big endian bus ==> native | ||
445 | * endian I/O). | ||
446 | * | ||
447 | * Other architectures (e.g., ARM) either do not support big endian, or | ||
448 | * else leave I/O in little endian mode. | ||
449 | */ | ||
450 | #if defined(CONFIG_MIPS) && defined(__BIG_ENDIAN) | ||
451 | flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; | ||
452 | #endif | ||
453 | |||
441 | of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p, | 454 | of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p, |
442 | bank_width) { | 455 | bank_width) { |
443 | struct brcmstb_gpio_bank *bank; | 456 | struct brcmstb_gpio_bank *bank; |
@@ -466,7 +479,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) | |||
466 | err = bgpio_init(gc, dev, 4, | 479 | err = bgpio_init(gc, dev, 4, |
467 | reg_base + GIO_DATA(bank->id), | 480 | reg_base + GIO_DATA(bank->id), |
468 | NULL, NULL, NULL, | 481 | NULL, NULL, NULL, |
469 | reg_base + GIO_IODIR(bank->id), 0); | 482 | reg_base + GIO_IODIR(bank->id), flags); |
470 | if (err) { | 483 | if (err) { |
471 | dev_err(dev, "bgpio_init() failed\n"); | 484 | dev_err(dev, "bgpio_init() failed\n"); |
472 | goto fail; | 485 | goto fail; |