brcm63xx: fix platform gpio lookups for gpios < 32
[openwrt/openwrt.git] / target / linux / brcm63xx / patches-4.1 / 377-MIPS-BCM63XX-register-lookup-for-ephy-reset-gpio.patch
index 30f6ba50983eb264aca52c1f03659a10884b349b..15a714bfd577a4cc460eff63788e0fb44b48f196 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 
 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
-@@ -59,7 +59,7 @@ static struct board_info __initdata boar
+@@ -54,7 +54,7 @@ static struct board_info __initdata boar
        },
  
        .ephy_reset_gpio                = 36,
@@ -26,9 +26,9 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  
 --- a/arch/mips/bcm63xx/boards/board_common.c
 +++ b/arch/mips/bcm63xx/boards/board_common.c
-@@ -278,9 +278,10 @@ int __init board_register_devices(void)
-               platform_device_register(&bcm63xx_gpio_leds);
-       }
+@@ -257,9 +257,10 @@ int __init board_register_devices(void)
+       platform_device_register(&bcm63xx_gpio_leds);
  
 -      if (board.ephy_reset_gpio && board.ephy_reset_gpio_flags)
 -              gpio_request_one(board.ephy_reset_gpio,
@@ -38,11 +38,11 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
 +                                      board.ephy_reset_gpio_flags);
 +      }
  
-       /* count number of BUTTONs defined by this device */
-       while (button_count < ARRAY_SIZE(board.buttons) && board.buttons[button_count].desc)
+       return 0;
+ }
 --- a/arch/mips/bcm63xx/gpio.c
 +++ b/arch/mips/bcm63xx/gpio.c
-@@ -8,15 +8,24 @@
+@@ -8,15 +8,23 @@
   * Copyright (C) Jonas Gorski <jogo@openwrt.org>
   */
  
@@ -58,24 +58,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  #include <bcm63xx_gpio.h>
  #include <bcm63xx_regs.h>
  
-+/* for registering lookups; make them large enough to hold OF names */
-+static char *gpio_chip_labels[] = {
-+      "xxxxxxxx.gpio-controller",
-+      "xxxxxxxx.gpio-controller",
++static const char * const gpio_chip_labels[] = {
++      "bcm63xx-gpio.0",
++      "bcm63xx-gpio.1",
 +};
 +
  static void __init bcm63xx_gpio_init_one(int id, int dir, int data, int ngpio)
  {
        struct resource res[2];
-@@ -40,6 +49,7 @@ static void __init bcm63xx_gpio_init_one
-       pdata.base = id * 32;
-       pdata.ngpio = ngpio;
-+      sprintf(gpio_chip_labels[id], "bcm63xx-gpio.%d", id);
-       platform_device_register_resndata(NULL, "bcm63xx-gpio", id, res, 2,
-                                         &pdata, sizeof(pdata));
- }
-@@ -64,3 +74,25 @@ int __init bcm63xx_gpio_init(void)
+@@ -64,3 +72,25 @@ int __init bcm63xx_gpio_init(void)
        return 0;
  
  }
@@ -117,15 +108,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  {
 --- a/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
 +++ b/arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
-@@ -4,6 +4,7 @@
+@@ -3,6 +3,7 @@
  #include <linux/types.h>
  #include <linux/gpio.h>
- #include <linux/gpio_keys.h>
 +#include <linux/gpio/machine.h>
  #include <linux/leds.h>
  #include <bcm63xx_dev_enet.h>
  #include <bcm63xx_dev_usb_usbd.h>
-@@ -58,8 +59,8 @@ struct board_info {
+@@ -54,8 +55,8 @@ struct board_info {
        /* External PHY reset GPIO */
        unsigned int ephy_reset_gpio;