ath79: suppress GPIO static base allocation warning

Silence ath79 GPIO driver warning by setting GPIO numberspace base
dynamically. This patch also reorganize and fix the GPIO numbers on
6.6 kernel. The new gpio chip base number algorithm:

gpiochip    ath79-SOC    ath9k-0       ath9k-1
base           512      512+ngpios   512+ngpios+10

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/15784
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Shiji Yang 2024-07-04 18:35:50 +08:00 committed by Robert Marko
parent 8895c51d69
commit ee01666cd3
3 changed files with 79 additions and 47 deletions

View File

@ -11,62 +11,62 @@ board=$(board_name)
case "$board" in
adtran,bsap1800-v2|\
adtran,bsap1840)
ucidef_add_gpio_switch "wifi1_ext_a" "5GHz External Antenna A" "492" "1"
ucidef_add_gpio_switch "wifi1_int_a" "5GHz Internal Antenna A" "493"
ucidef_add_gpio_switch "wifi1_ext_b" "5GHz External Antenna B" "494" "1"
ucidef_add_gpio_switch "wifi1_int_b" "5GHz Internal Antenna B" "495"
ucidef_add_gpio_switch "wifi1_ext_c" "5GHz External Antenna C" "496" "1"
ucidef_add_gpio_switch "wifi1_int_c" "5GHz Internal Antenna C" "497"
ucidef_add_gpio_switch "wifi0_ext_a" "2.4GHz External Antenna A" "505" "1"
ucidef_add_gpio_switch "wifi0_int_a" "2.4GHz Internal Antenna A" "506"
ucidef_add_gpio_switch "wifi0_ext_b" "2.4GHz External Antenna B" "507" "1"
ucidef_add_gpio_switch "wifi0_int_b" "2.4GHz Internal Antenna B" "508"
ucidef_add_gpio_switch "wifi0_ext_c" "2.4GHz External Antenna C" "509" "1"
ucidef_add_gpio_switch "wifi0_int_c" "2.4GHz Internal Antenna C" "510"
ucidef_add_gpio_switch "wifi1_ext_a" "5GHz External Antenna A" "534" "1"
ucidef_add_gpio_switch "wifi1_int_a" "5GHz Internal Antenna A" "535"
ucidef_add_gpio_switch "wifi1_ext_b" "5GHz External Antenna B" "536" "1"
ucidef_add_gpio_switch "wifi1_int_b" "5GHz Internal Antenna B" "537"
ucidef_add_gpio_switch "wifi1_ext_c" "5GHz External Antenna C" "538" "1"
ucidef_add_gpio_switch "wifi1_int_c" "5GHz Internal Antenna C" "539"
ucidef_add_gpio_switch "wifi0_ext_a" "2.4GHz External Antenna A" "527" "1"
ucidef_add_gpio_switch "wifi0_int_a" "2.4GHz Internal Antenna A" "528"
ucidef_add_gpio_switch "wifi0_ext_b" "2.4GHz External Antenna B" "529" "1"
ucidef_add_gpio_switch "wifi0_int_b" "2.4GHz Internal Antenna B" "530"
ucidef_add_gpio_switch "wifi0_ext_c" "2.4GHz External Antenna C" "531" "1"
ucidef_add_gpio_switch "wifi0_int_c" "2.4GHz Internal Antenna C" "532"
;;
asus,pl-ac56)
ucidef_add_gpio_switch "plc_enable" "PLC enable" "14" "1"
ucidef_add_gpio_switch "plc_enable" "PLC enable" "526" "1"
;;
comfast,cf-e5|\
telco,t1)
ucidef_add_gpio_switch "lte_power" "LTE Power" "14" "1"
ucidef_add_gpio_switch "lte_wakeup" "LTE Wakeup" "11" "1"
ucidef_add_gpio_switch "lte_poweroff" "LTE Poweroff" "1" "1"
ucidef_add_gpio_switch "lte_reset" "LTE Reset" "12" "1"
ucidef_add_gpio_switch "lte_power" "LTE Power" "526" "1"
ucidef_add_gpio_switch "lte_wakeup" "LTE Wakeup" "523" "1"
ucidef_add_gpio_switch "lte_poweroff" "LTE Poweroff" "513" "1"
ucidef_add_gpio_switch "lte_reset" "LTE Reset" "524" "1"
;;
devolo,dlan-pro-1200plus-ac)
ucidef_add_gpio_switch "plc_enable" "PLC enable" "13" "0"
ucidef_add_gpio_switch "plc_enable" "PLC enable" "525" "0"
;;
devolo,magic-2-wifi)
ucidef_add_gpio_switch "plc_pairing" "PLC pairing" "11" "1"
ucidef_add_gpio_switch "plc_enable" "PLC enable" "13" "1"
ucidef_add_gpio_switch "plc_pairing" "PLC pairing" "523" "1"
ucidef_add_gpio_switch "plc_enable" "PLC enable" "525" "1"
;;
dlink,dir-825-c1|\
dlink,dir-835-a1)
ucidef_add_gpio_switch "wan_led_auto" "WAN LED Auto" "20" "0"
ucidef_add_gpio_switch "wan_led_auto" "WAN LED Auto" "532" "0"
;;
librerouter,librerouter-v1)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "1" "0"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "513" "0"
;;
teltonika,rut955)
ucidef_add_gpio_switch "sim_sel" "SIM select" "503" "1"
ucidef_add_gpio_switch "DOUT1" "DOUT1 (OC)" "504" "0"
ucidef_add_gpio_switch "DOUT2" "DOUT2 (Relay)" "505" "0"
ucidef_add_gpio_switch "modem_vbus" "Modem enable" "506" "1"
ucidef_add_gpio_switch "modem_rst" "Modem reset" "507" "0"
ucidef_add_gpio_switch "DOUT3" "DOUT3" "508" "0"
ucidef_add_gpio_switch "sim_sel" "SIM select" "542" "1"
ucidef_add_gpio_switch "DOUT1" "DOUT1 (OC)" "543" "0"
ucidef_add_gpio_switch "DOUT2" "DOUT2 (Relay)" "544" "0"
ucidef_add_gpio_switch "modem_vbus" "Modem enable" "545" "1"
ucidef_add_gpio_switch "modem_rst" "Modem reset" "546" "0"
ucidef_add_gpio_switch "DOUT3" "DOUT3" "547" "0"
;;
teltonika,rut955-h7v3c0)
ucidef_add_gpio_switch "sim_sel" "SIM select" "503" "1"
ucidef_add_gpio_switch "DOUT1" "DOUT1 (OC)" "504" "0"
ucidef_add_gpio_switch "DOUT2" "DOUT2 (Relay)" "505" "0"
ucidef_add_gpio_switch "modem_vbus" "Modem enable" "508" "1"
ucidef_add_gpio_switch "modem_rst" "Modem reset" "509" "0"
ucidef_add_gpio_switch "sim_sel" "SIM select" "542" "1"
ucidef_add_gpio_switch "DOUT1" "DOUT1 (OC)" "543" "0"
ucidef_add_gpio_switch "DOUT2" "DOUT2 (Relay)" "544" "0"
ucidef_add_gpio_switch "modem_vbus" "Modem enable" "547" "1"
ucidef_add_gpio_switch "modem_rst" "Modem reset" "548" "0"
;;
tplink,archer-c25-v1)
ucidef_add_gpio_switch "led_control" "LED control" "21" "0"
ucidef_add_gpio_switch "led_reset" "LED reset" "19" "1"
ucidef_add_gpio_switch "led_control" "LED control" "533" "0"
ucidef_add_gpio_switch "led_reset" "LED reset" "531" "1"
;;
tplink,cpe210-v1|\
tplink,cpe220-v2|\
@ -76,31 +76,31 @@ tplink,wbs210-v1|\
tplink,wbs210-v2|\
tplink,wbs510-v1|\
tplink,wbs510-v2)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "20"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "532"
;;
ubnt,aircube-ac|\
ubnt,nanobeam-ac-gen2|\
ubnt,nanostation-ac)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "3"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "515"
;;
ubnt,aircube-isp)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "11"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "523"
;;
ubnt,nanostation-m)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "8"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "520"
;;
ubnt,nanostation-m-xw)
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "2"
ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "514"
;;
ubnt,uk-ultra)
ucidef_add_gpio_switch "ant0_internal" "ANT0 Internal" "5" "1"
ucidef_add_gpio_switch "ant1_internal" "ANT1 Internal" "6" "1"
ucidef_add_gpio_switch "ant0_internal" "ANT0 Internal" "517" "1"
ucidef_add_gpio_switch "ant1_internal" "ANT1 Internal" "518" "1"
;;
zbtlink,zbt-wd323)
ucidef_add_gpio_switch "io0" "IO#0" "0"
ucidef_add_gpio_switch "io1" "IO#1" "1"
ucidef_add_gpio_switch "io2" "IO#2" "2"
ucidef_add_gpio_switch "io14" "IO#14" "14"
ucidef_add_gpio_switch "io0" "IO#0" "512"
ucidef_add_gpio_switch "io1" "IO#1" "513"
ucidef_add_gpio_switch "io2" "IO#2" "514"
ucidef_add_gpio_switch "io14" "IO#14" "526"
;;
esac

View File

@ -11,7 +11,7 @@ board=$(board_name)
case "$board" in
zte,mf286a|\
zte,mf286r)
ucidef_add_gpio_switch "power_btn_block" "Power button blocker" "20" "0"
ucidef_add_gpio_switch "power_btn_block" "Power button blocker" "532" "0"
;;
esac

View File

@ -0,0 +1,32 @@
From 9a473c2a093e0d1c466bf86073230e2c8b658977 Mon Sep 17 00:00:00 2001
From: Shiji Yang <yangshiji66@outlook.com>
Date: Wed, 26 Jun 2024 08:33:18 +0800
Subject: gpio: ath79: convert to dynamic GPIO base allocation
ath79 target has already been converted to device tree based platform.
Use dynamic GPIO numberspace base to suppress the warning:
gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
Tested on Atheros AR7241 and AR9344.
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Suggested-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://lore.kernel.org/r/TYCP286MB089598EA71E964BD8AB9EFD3BCD62@TYCP286MB0895.JPNP286.PROD.OUTLOOK.COM
[Bartosz: tweaked the commit message]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/gpio/gpio-ath79.c | 2 --
1 file changed, 2 deletions(-)
--- a/drivers/gpio/gpio-ath79.c
+++ b/drivers/gpio/gpio-ath79.c
@@ -273,8 +273,6 @@ static int ath79_gpio_probe(struct platf
dev_err(dev, "bgpio_init failed\n");
return err;
}
- /* Use base 0 to stay compatible with legacy platforms */
- ctrl->gc.base = 0;
/* Optional interrupt setup */
if (!np || of_property_read_bool(np, "interrupt-controller")) {