ramips: gpio: always use dynamic GPIO numberspace base
authorShiji Yang <yangshiji66@qq.com>
Fri, 28 Jun 2024 07:36:13 +0000 (15:36 +0800)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 4 Jul 2024 20:20:47 +0000 (22:20 +0200)
The new numberspace base starts from 512 instead of 0. The number
base seems come from the kernel symbol CONFIG_GPIOLIB_FASTPATH_LIMIT.

Suppress warning:

gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
target/linux/ramips/dts/mt7620a.dtsi
target/linux/ramips/dts/mt7620n.dtsi
target/linux/ramips/dts/rt2880.dtsi
target/linux/ramips/dts/rt3050.dtsi
target/linux/ramips/dts/rt3352.dtsi
target/linux/ramips/dts/rt3883.dtsi
target/linux/ramips/dts/rt5350.dtsi
target/linux/ramips/mt7620/base-files/etc/board.d/03_gpio_switches
target/linux/ramips/patches-6.6/801-DT-Add-documentation-for-gpio-ralink.patch
target/linux/ramips/patches-6.6/802-GPIO-MIPS-ralink-add-gpio-driver-for-ralink-SoC.patch
target/linux/ramips/patches-6.6/803-gpio-ralink-Add-support-for-GPIO-as-interrupt-contro.patch

index 4ba4b48bef25ac30b3e8ae5b152a8e331d6be256..a0429ade454136fe31c8f499cb9aff4fc8b7dfac 100644 (file)
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <16>;
-                       ralink,gpio-base = <24>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <32>;
-                       ralink,gpio-base = <40>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <1>;
-                       ralink,gpio-base = <72>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index a844198f668f92d6c8e173b6e39b22c390344093..eafa7c16bb17bbc79d8fec227546ab62561f7e23 100644 (file)
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <16>;
-                       ralink,gpio-base = <24>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <32>;
-                       ralink,gpio-base = <40>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <1>;
-                       ralink,gpio-base = <72>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index 5ac2d2e3b87ede944a774fa4d9818cdf001e73bd..15f5eac625a2afc6a9c0b2198a35e7bbd15a9ab5 100644 (file)
@@ -88,7 +88,6 @@
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <16>;
-                       ralink,gpio-base = <24>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <32>;
-                       ralink,gpio-base = <40>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index 80d0f1585b837a33bcc62530458494f43650e493..886f6b7de13125e7fbed2b01c0920e432cfa9374 100644 (file)
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <16>;
-                       ralink,gpio-base = <24>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <12>;
-                       ralink,gpio-base = <40>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index 0690589e5d34072588837f99496c92972f9e2b88..ceef29259c5f4463b9b47cfaadde5fdd25c7cbba 100644 (file)
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <16>;
-                       ralink,gpio-base = <24>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <6>;
-                       ralink,gpio-base = <40>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index d2557d4559f3d5c678abbde17391033fcad6c184..de8964540602aa1559959663330b24855703d6a3 100644 (file)
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <16>;
-                       ralink,gpio-base = <24>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <32>;
-                       ralink,gpio-base = <40>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
                        #gpio-cells = <2>;
 
                        ngpios = <24>;
-                       ralink,gpio-base = <72>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index 6b5429180043f835ecbef664b86afd8f3db22fcb..cb6f3ff232eb0400e78ee224effa30435c966856 100644 (file)
                        #gpio-cells = <2>;
 
                        ngpios = <22>;
-                       ralink,gpio-base = <0>;
                        ralink,register-map = [ 00 04 08 0c
                                                20 24 28 2c
                                                30 34 ];
                        #gpio-cells = <2>;
 
                        ngpios = <6>;
-                       ralink,gpio-base = <22>;
                        ralink,register-map = [ 00 04 08 0c
                                                10 14 18 1c
                                                20 24 ];
index 55881135488e335c239b3b6156fde83f56a9ee93..6d3cc61aca5c778b72aaa92f4cb5d0b2fccfba51 100644 (file)
@@ -7,30 +7,30 @@ board=$(board_name)
 
 case "$board" in
 bolt,bl100)
-       ucidef_add_gpio_switch "modem_enable" "Enable LTE Modem" "28" "1"
+       ucidef_add_gpio_switch "modem_enable" "Enable LTE Modem" "540" "1"
        ;;
 dlink,dir-510l)
-       ucidef_add_gpio_switch "usb_enable1" "USB 1A enable" "12" "0"
-       ucidef_add_gpio_switch "usb_enable05" "USB 0.5A enable" "13" "1"
+       ucidef_add_gpio_switch "usb_enable1" "USB 1A enable" "524" "0"
+       ucidef_add_gpio_switch "usb_enable05" "USB 0.5A enable" "525" "1"
        ;;
 dlink,dwr-960|\
 dlink,dwr-961-a1)
-       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "0" "1"
+       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "512" "1"
        ;;
 head-weblink,hdrm200)
-       ucidef_add_gpio_switch "sim_switch" "SIM slot switch" "0"
-       ucidef_add_gpio_switch "io1" "I/O 1" "1"
-       ucidef_add_gpio_switch "io2" "I/O 2" "2"
-       ucidef_add_gpio_switch "io3" "I/O 3" "11"
-       ucidef_add_gpio_switch "io4" "I/O 4" "14"
-       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "21" "1"
+       ucidef_add_gpio_switch "sim_switch" "SIM slot switch" "512"
+       ucidef_add_gpio_switch "io1" "I/O 1" "513"
+       ucidef_add_gpio_switch "io2" "I/O 2" "514"
+       ucidef_add_gpio_switch "io3" "I/O 3" "523"
+       ucidef_add_gpio_switch "io4" "I/O 4" "526"
+       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "533" "1"
        ;;
 lb-link,bl-w1200)
-       ucidef_add_gpio_switch "eth_leds_enable" "ETH LEDs enable" "10" "1"
+       ucidef_add_gpio_switch "eth_leds_enable" "ETH LEDs enable" "522" "1"
        ;;
 zbtlink,zbt-we826-e)
-       ucidef_add_gpio_switch "sim_switch" "SIM slot switch" "13"
-       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "14" "1"
+       ucidef_add_gpio_switch "sim_switch" "SIM slot switch" "525"
+       ucidef_add_gpio_switch "power_mpcie" "mPCIe power" "526" "1"
        ;;
 esac
 
index 976029c18ceb4dae38f260b38f9becdc52c2a053..fdb07f84f719c533110e1eb1aca69b68e4773aad 100644 (file)
@@ -1,22 +1,18 @@
-From d410e5478c622c01fcf31427533df5f433df9146 Mon Sep 17 00:00:00 2001
 From: John Crispin <blogic@openwrt.org>
 Date: Sun, 28 Jul 2013 19:45:30 +0200
-Subject: [PATCH 26/53] DT: Add documentation for gpio-ralink
+Subject: [PATCH 1/3] DT: Add documentation for gpio-ralink
 
 Describe gpio-ralink binding.
 
 Signed-off-by: John Crispin <blogic@openwrt.org>
-Cc: linux-mips@linux-mips.org
-Cc: devicetree@vger.kernel.org
-Cc: linux-gpio@vger.kernel.org
 ---
- .../devicetree/bindings/gpio/gpio-ralink.txt       |   40 ++++++++++++++++++++
- 1 file changed, 40 insertions(+)
+ .../devicetree/bindings/gpio/gpio-ralink.txt  | 36 +++++++++++++++++++
+ 1 file changed, 36 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-ralink.txt
 
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
-@@ -0,0 +1,40 @@
+@@ -0,0 +1,36 @@
 +Ralink SoC GPIO controller bindings
 +
 +Required properties:
@@ -34,9 +30,6 @@ Cc: linux-gpio@vger.kernel.org
 +              SoC type. Register offsets need to be in this order.
 +              [ INT, EDGE, RENA, FENA, DATA, DIR, POL, SET, RESET, TOGGLE ]
 +
-+Optional properties:
-+- ralink,gpio-base : Specify the GPIO chips base number
-+
 +Example:
 +
 +      gpio0: gpio@600 {
@@ -51,7 +44,6 @@ Cc: linux-gpio@vger.kernel.org
 +              interrupts = <6>;
 +
 +              ngpios = <24>;
-+              ralink,gpio-base = <0>;
 +              ralink,register-map = [ 00 04 08 0c
 +                              20 24 28 2c
 +                              30 34 ];
index 75a7374054ae6f9b2fc930d6676a13fd65bccaa4..53c28acaf0e200642c08bc57913539e8ceeed0ab 100644 (file)
@@ -1,20 +1,17 @@
-From 69fdd2c4f937796b934e89c33acde9d082e27bfd Mon Sep 17 00:00:00 2001
 From: John Crispin <blogic@openwrt.org>
 Date: Mon, 4 Aug 2014 20:36:29 +0200
-Subject: [PATCH 27/53] GPIO: MIPS: ralink: add gpio driver for ralink SoC
+Subject: [PATCH 2/3] GPIO: MIPS: ralink: add gpio driver for ralink SoC
 
 Add gpio driver for Ralink SoC. This driver makes the gpio core on
 RT2880, RT305x, rt3352, rt3662, rt3883, rt5350 and mt7620 work.
 
 Signed-off-by: John Crispin <blogic@openwrt.org>
-Cc: linux-mips@linux-mips.org
-Cc: linux-gpio@vger.kernel.org
 ---
- arch/mips/include/asm/mach-ralink/gpio.h |   24 ++
- drivers/gpio/Kconfig                     |    6 +
- drivers/gpio/Makefile                    |    1 +
- drivers/gpio/gpio-ralink.c               |  355 ++++++++++++++++++++++++++++++
- 4 files changed, 386 insertions(+)
+ arch/mips/include/asm/mach-ralink/gpio.h |  24 ++
+ drivers/gpio/Kconfig                     |   6 +
+ drivers/gpio/Makefile                    |   1 +
+ drivers/gpio/gpio-ralink.c               | 336 +++++++++++++++++++++++
+ 4 files changed, 367 insertions(+)
  create mode 100644 arch/mips/include/asm/mach-ralink/gpio.h
  create mode 100644 drivers/gpio/gpio-ralink.c
 
@@ -72,7 +69,7 @@ Cc: linux-gpio@vger.kernel.org
  obj-$(CONFIG_GPIO_RCAR)                       += gpio-rcar.o
 --- /dev/null
 +++ b/drivers/gpio/gpio-ralink.c
-@@ -0,0 +1,341 @@
+@@ -0,0 +1,336 @@
 +/*
 + * This program is free software; you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License version 2 as published
@@ -333,7 +330,7 @@ Cc: linux-gpio@vger.kernel.org
 +      struct device_node *np = pdev->dev.of_node;
 +      struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 +      struct ralink_gpio_chip *rg;
-+      const __be32 *ngpio, *gpiobase;
++      const __be32 *ngpio;
 +
 +      if (!res) {
 +              dev_err(&pdev->dev, "failed to find resource\n");
@@ -363,14 +360,9 @@ Cc: linux-gpio@vger.kernel.org
 +              return -EINVAL;
 +      }
 +
-+      gpiobase = of_get_property(np, "ralink,gpio-base", NULL);
-+      if (gpiobase)
-+              rg->chip.base = be32_to_cpu(*gpiobase);
-+      else
-+              rg->chip.base = -1;
-+
 +      spin_lock_init(&rg->lock);
 +
++      rg->chip.base = -1;
 +      rg->chip.parent = &pdev->dev;
 +      rg->chip.label = dev_name(&pdev->dev);
 +      rg->chip.fwnode = of_node_to_fwnode(np);
index 8520ce32ff7b2f99ef1a92be8947cbc18a9e91ad..bd6b553937a4ab52d12d8004cca578ccf9864d95 100644 (file)
@@ -1,7 +1,6 @@
-From 57fa7f2f4ef6f78ce1d30509c0d111aa3791b524 Mon Sep 17 00:00:00 2001
 From: Daniel Santos <daniel.santos@pobox.com>
 Date: Sun, 4 Nov 2018 20:24:32 -0600
-Subject: gpio-ralink: Add support for GPIO as interrupt-controller
+Subject: [PATCH 3/3] gpio-ralink: Add support for GPIO as interrupt-controller
 
 Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
 ---
@@ -11,17 +10,17 @@ Signed-off-by: Daniel Santos <daniel.santos@pobox.com>
 
 --- a/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
 +++ b/Documentation/devicetree/bindings/gpio/gpio-ralink.txt
-@@ -17,6 +17,9 @@ Required properties:
- Optional properties:
- - ralink,gpio-base : Specify the GPIO chips base number
+@@ -14,6 +14,9 @@ Required properties:
+ - ralink,register-map : The register layout depends on the GPIO bank and actual
+               SoC type. Register offsets need to be in this order.
+               [ INT, EDGE, RENA, FENA, DATA, DIR, POL, SET, RESET, TOGGLE ]
 +- interrupt-controller : marks this as an interrupt controller
 +- #interrupt-cells : a standard two-cell interrupt flag, see
 +  interrupt-controller/interrupts.txt
  
  Example:
  
-@@ -28,6 +31,9 @@ Example:
+@@ -25,6 +28,9 @@ Example:
  
                reg = <0x600 0x34>;