From 4357f32d41eb4364841cab831bcaf7848695b5d7 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 11:01:48 +0100 Subject: [PATCH 01/21] realtek: debounce reset key for Zyxel GS1900 When the reset button is next to the SFP cages, I2C operations on the modules might cause interference on the button's GPIO line. Add a debounce-interval of 5 times the poll-interval to ensure the line is actually stable for some time and not just glitching. Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 1 + target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 1 + 2 files changed, 2 insertions(+) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index b985c4bc8e..59b44ad161 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -20,6 +20,7 @@ keys { compatible = "gpio-keys-polled"; + debounce-interval = <100>; poll-interval = <20>; reset { diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index 9844dc2180..ad3245fc27 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -41,6 +41,7 @@ keys { compatible = "gpio-keys-polled"; + debounce-interval = <100>; poll-interval = <20>; mode { From 04601004befe75a430696139e50595a54140e750 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:30 +0100 Subject: [PATCH 02/21] Revert "mac80211: ath9k: clean up gpiochip" This reverts commit 2af552372d4e0feda947d44eba3775b335d242db. Signed-off-by: Robert Marko --- .../ath9k/548-ath9k_enable_gpio_chip.patch | 109 +++++++++++------- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 22 ++-- 2 files changed, 76 insertions(+), 55 deletions(-) diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index b2aee815a6..0efe23b9dc 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -10,32 +10,47 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -25,6 +25,8 @@ +@@ -25,6 +25,7 @@ #include #include #include +#include -+#include #include "common.h" #include "debug.h" -@@ -1046,6 +1048,10 @@ struct ath_softc { +@@ -991,6 +992,14 @@ struct ath_led { + struct led_classdev cdev; + }; + ++#ifdef CONFIG_GPIOLIB ++struct ath9k_gpio_chip { ++ struct ath_softc *sc; ++ char label[32]; ++ struct gpio_chip gchip; ++}; ++#endif ++ + struct ath_softc { + struct ieee80211_hw *hw; + struct device *dev; +@@ -1046,6 +1055,9 @@ struct ath_softc { #ifdef CPTCFG_MAC80211_LEDS const char *led_default_trigger; struct list_head leds; +#ifdef CONFIG_GPIOLIB -+ struct gpio_chip *gpiochip; -+ struct gpio_desc *gpiodesc; ++ struct ath9k_gpio_chip *gpiochip; +#endif #endif #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -16,12 +16,123 @@ +@@ -15,13 +15,131 @@ + */ #include "ath9k.h" - ++#include ++ +#ifdef CPTCFG_MAC80211_LEDS + +#ifdef CONFIG_GPIOLIB @@ -47,9 +62,10 @@ Signed-off-by: Felix Fietkau +/* gpio_chip handler : set GPIO to input */ +static int ath9k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ ath9k_hw_gpio_request_in(sc->sc_ah, offset, "ath9k-gpio"); ++ ath9k_hw_gpio_request_in(gc->sc->sc_ah, offset, "ath9k-gpio"); + + return 0; +} @@ -58,11 +74,12 @@ Signed-off-by: Felix Fietkau +static int ath9k_gpio_pin_cfg_output(struct gpio_chip *chip, unsigned offset, + int value) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ ath9k_hw_gpio_request_out(sc->sc_ah, offset, "ath9k-gpio", ++ ath9k_hw_gpio_request_out(gc->sc->sc_ah, offset, "ath9k-gpio", + AR_GPIO_OUTPUT_MUX_AS_OUTPUT); -+ ath9k_hw_set_gpio(sc->sc_ah, offset, value); ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); + + return 0; +} @@ -70,8 +87,9 @@ Signed-off-by: Felix Fietkau +/* gpio_chip handler : query GPIO direction (0=out, 1=in) */ +static int ath9k_gpio_pin_get_dir(struct gpio_chip *chip, unsigned offset) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); ++ struct ath_hw *ah = gc->sc->sc_ah; + + return !((REG_READ(ah, AR_GPIO_OE_OUT(ah)) >> (offset * 2)) & 3); +} @@ -79,62 +97,65 @@ Signed-off-by: Felix Fietkau +/* gpio_chip handler : get GPIO pin value */ +static int ath9k_gpio_pin_get(struct gpio_chip *chip, unsigned offset) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ return ath9k_hw_gpio_get(sc->sc_ah, offset); ++ return ath9k_hw_gpio_get(gc->sc->sc_ah, offset); +} + +/* gpio_chip handler : set GPIO pin to value */ +static void ath9k_gpio_pin_set(struct gpio_chip *chip, unsigned offset, + int value) +{ -+ struct ath_softc *sc = gpiochip_get_data(chip); ++ struct ath9k_gpio_chip *gc = container_of(chip, struct ath9k_gpio_chip, ++ gchip); + -+ ath9k_hw_set_gpio(sc->sc_ah, offset, value); ++ ath9k_hw_set_gpio(gc->sc->sc_ah, offset, value); +} + +/* register GPIO chip */ +static void ath9k_register_gpio_chip(struct ath_softc *sc) +{ -+ struct gpio_chip *gc = sc->gpiochip; ++ struct ath9k_gpio_chip *gc; + struct ath_hw *ah = sc->sc_ah; + -+ gc = kzalloc(sizeof(struct gpio_chip), GFP_KERNEL); ++ gc = kzalloc(sizeof(struct ath9k_gpio_chip), GFP_KERNEL); + if (!gc) + return; + -+ gc->label = kasprintf(GFP_KERNEL, "ath9k-%s", -+ wiphy_name(sc->hw->wiphy)); -+ if (!gc->label) -+ return; ++ gc->sc = sc; ++ snprintf(gc->label, sizeof(gc->label), "ath9k-%s", ++ wiphy_name(sc->hw->wiphy)); ++ gc->gchip.parent = sc->dev; ++ gc->gchip.label = gc->label; ++ gc->gchip.base = -1; /* determine base automatically */ ++ gc->gchip.ngpio = ah->caps.num_gpio_pins; ++ gc->gchip.direction_input = ath9k_gpio_pin_cfg_input; ++ gc->gchip.direction_output = ath9k_gpio_pin_cfg_output; ++ gc->gchip.get_direction = ath9k_gpio_pin_get_dir; ++ gc->gchip.get = ath9k_gpio_pin_get; ++ gc->gchip.set = ath9k_gpio_pin_set; + -+ gc->parent = sc->dev; -+ gc->base = -1; /* determine base automatically */ -+ gc->ngpio = ah->caps.num_gpio_pins; -+ gc->direction_input = ath9k_gpio_pin_cfg_input; -+ gc->direction_output = ath9k_gpio_pin_cfg_output; -+ gc->get_direction = ath9k_gpio_pin_get_dir; -+ gc->get = ath9k_gpio_pin_get; -+ gc->set = ath9k_gpio_pin_set; -+ -+ if (gpiochip_add_data(gc, sc)) { -+ kfree(gc->label); ++ if (gpiochip_add(&gc->gchip)) { + kfree(gc); + return; + } ++ ++ gc->gchip.owner = NULL; ++ sc->gpiochip = gc; +} + +/* remove GPIO chip */ +static void ath9k_unregister_gpio_chip(struct ath_softc *sc) +{ -+ struct gpio_chip *gc = sc->gpiochip; ++ struct ath9k_gpio_chip *gc = sc->gpiochip; + + if (!gc) + return; + -+ gpiochip_remove(gc); -+ kfree(gc->label); ++ gpiochip_remove(&gc->gchip); + kfree(gc); ++ sc->gpiochip = NULL; +} + +#else /* CONFIG_GPIOLIB */ @@ -148,7 +169,7 @@ Signed-off-by: Felix Fietkau +} + +#endif /* CONFIG_GPIOLIB */ -+ + /********************************/ /* LED functions */ /********************************/ @@ -158,27 +179,27 @@ Signed-off-by: Felix Fietkau static void ath_fill_led_pin(struct ath_softc *sc) { struct ath_hw *ah = sc->sc_ah; -@@ -79,6 +190,12 @@ static int ath_add_led(struct ath_softc +@@ -79,6 +197,12 @@ static int ath_add_led(struct ath_softc else ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); +#ifdef CONFIG_GPIOLIB + /* If there is GPIO chip configured, reserve LED pin */ + if (sc->gpiochip) -+ sc->gpiodesc = gpiod_get(sc->dev, gpio->name, GPIOD_ASIS); ++ gpio_request(sc->gpiochip->gchip.base + gpio->gpio, gpio->name); +#endif + return 0; } -@@ -117,17 +234,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -117,17 +241,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); +#ifdef CONFIG_GPIOLIB + /* If there is GPIO chip configured, free LED pin */ + if (sc->gpiochip) -+ gpiod_put(sc->gpiodesc); ++ gpio_free(sc->gpiochip->gchip.base + led->gpio->gpio); +#endif list_del(&led->list); ath_led_brightness(&led->cdev, LED_OFF); @@ -196,7 +217,7 @@ Signed-off-by: Felix Fietkau char led_name[32]; const char *trigger; -@@ -136,6 +260,12 @@ void ath_init_leds(struct ath_softc *sc) +@@ -136,6 +267,12 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 728b6663a2..78700222a9 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -10,27 +10,27 @@ Signed-off-by: Felix Fietkau --- --- a/drivers/net/wireless/ath/ath9k/ath9k.h +++ b/drivers/net/wireless/ath/ath9k/ath9k.h -@@ -1051,6 +1051,7 @@ struct ath_softc { +@@ -1057,6 +1057,7 @@ struct ath_softc { + struct list_head leds; #ifdef CONFIG_GPIOLIB - struct gpio_chip *gpiochip; - struct gpio_desc *gpiodesc; + struct ath9k_gpio_chip *gpiochip; + struct platform_device *btnpdev; /* gpio-keys-polled */ #endif #endif --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -15,6 +15,8 @@ - */ +@@ -16,6 +16,8 @@ #include "ath9k.h" + #include +#include +#include #ifdef CPTCFG_MAC80211_LEDS -@@ -117,6 +119,67 @@ static void ath9k_unregister_gpio_chip(s - kfree(gc); +@@ -124,6 +126,67 @@ static void ath9k_unregister_gpio_chip(s + sc->gpiochip = NULL; } +/******************/ @@ -64,7 +64,7 @@ Signed-off-by: Felix Fietkau + + ath9k_hw_gpio_request_in(sc->sc_ah, ah->btns[i].gpio, + "ath9k-gpio"); -+ bt[i].gpio = sc->gpiochip->base + ah->btns[i].gpio; ++ bt[i].gpio = sc->gpiochip->gchip.base + ah->btns[i].gpio; + } + + memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); @@ -97,7 +97,7 @@ Signed-off-by: Felix Fietkau #else /* CONFIG_GPIOLIB */ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) -@@ -127,6 +190,14 @@ static inline void ath9k_unregister_gpio +@@ -134,6 +197,14 @@ static inline void ath9k_unregister_gpio { } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -232,6 +303,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -239,6 +310,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,7 +120,7 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -267,6 +339,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -274,6 +346,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); From caee153f8db57d9994c7d57a9f39fb1767a440f1 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:37 +0100 Subject: [PATCH 03/21] Revert "mac80211: ath9k: remove platform leds" This reverts commit ad2e55e02b67701b6af61c9348234987b1217a59. Signed-off-by: Robert Marko --- .../mac80211/patches/ath9k/100-gpio-of.patch | 5 +- .../patches/ath9k/530-ath9k_extra_leds.patch | 24 ++++---- .../ath9k/531-ath9k_extra_platform_leds.patch | 56 +++++++++++++++++++ .../ath9k/542-ath9k_debugfs_diag.patch | 2 +- .../ath9k/548-ath9k_enable_gpio_chip.patch | 16 ++++-- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 8 +-- 6 files changed, 87 insertions(+), 24 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch diff --git a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch b/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch index 28dcc6cf85..2cddb59fc5 100644 --- a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch +++ b/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch @@ -1,9 +1,12 @@ --- a/drivers/net/wireless/ath/ath9k/hw.h +++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -976,6 +976,10 @@ struct ath_hw { +@@ -976,6 +976,13 @@ struct ath_hw { bool disable_2ghz; bool disable_5ghz; ++ int num_leds; ++ const struct gpio_led *leds; ++ + unsigned num_btns; + const struct gpio_keys_button *btns; + unsigned btn_poll_interval; diff --git a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch index 0377c3f0b6..4bb27d558c 100644 --- a/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/530-ath9k_extra_leds.patch @@ -38,7 +38,7 @@ #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -39,61 +39,115 @@ static void ath_fill_led_pin(struct ath_ +@@ -39,61 +39,111 @@ static void ath_fill_led_pin(struct ath_ else ah->led_pin = ATH_LED_PIN_DEF; } @@ -125,11 +125,11 @@ { - if (!sc->led_registered) - return; -- -- ath_led_brightness(&sc->led_cdev, LED_OFF); -- led_classdev_unregister(&sc->led_cdev); + struct ath_led *led; +- ath_led_brightness(&sc->led_cdev, LED_OFF); +- led_classdev_unregister(&sc->led_cdev); +- - ath9k_hw_gpio_free(sc->sc_ah, sc->sc_ah->led_pin); + while (!list_empty(&sc->leds)) { + led = list_first_entry(&sc->leds, struct ath_led, list); @@ -144,7 +144,6 @@ void ath_init_leds(struct ath_softc *sc) { - int ret; -+ struct ath_hw *ah = sc->sc_ah; + char led_name[32]; + const char *trigger; + @@ -163,21 +162,18 @@ - "ath9k-%s", wiphy_name(sc->hw->wiphy)); - sc->led_cdev.name = sc->led_name; - sc->led_cdev.brightness_set = ath_led_brightness; -- -- ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); -- if (ret < 0) -+ if (ah->led_pin < 0) - return; - -- sc->led_registered = true; + snprintf(led_name, sizeof(led_name), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); -+ + +- ret = led_classdev_register(wiphy_dev(sc->hw->wiphy), &sc->led_cdev); +- if (ret < 0) +- return; + if (ath9k_led_blink) + trigger = sc->led_default_trigger; + else + trigger = ieee80211_get_radio_led_name(sc->hw); -+ + +- sc->led_registered = true; + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, + !sc->sc_ah->config.led_active_high); } diff --git a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch new file mode 100644 index 0000000000..4f41cd9139 --- /dev/null +++ b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch @@ -0,0 +1,56 @@ +--- a/drivers/net/wireless/ath/ath9k/gpio.c ++++ b/drivers/net/wireless/ath/ath9k/gpio.c +@@ -108,6 +108,24 @@ int ath_create_gpio_led(struct ath_softc + return ret; + } + ++static int ath_create_platform_led(struct ath_softc *sc, ++ const struct gpio_led *gpio) ++{ ++ struct ath_led *led; ++ int ret; ++ ++ led = kzalloc(sizeof(*led), GFP_KERNEL); ++ if (!led) ++ return -ENOMEM; ++ ++ led->gpio = gpio; ++ ret = ath_add_led(sc, led); ++ if (ret < 0) ++ kfree(led); ++ ++ return ret; ++} ++ + void ath_deinit_leds(struct ath_softc *sc) + { + struct ath_led *led; +@@ -124,8 +142,10 @@ void ath_deinit_leds(struct ath_softc *s + + void ath_init_leds(struct ath_softc *sc) + { ++ struct ath_hw *ah = sc->sc_ah; + char led_name[32]; + const char *trigger; ++ int i; + + INIT_LIST_HEAD(&sc->leds); + +@@ -134,6 +154,17 @@ void ath_init_leds(struct ath_softc *sc) + + ath_fill_led_pin(sc); + ++ if (ah->leds && ah->num_leds) ++ for (i = 0; i < ah->num_leds; i++) { ++ if (ah->leds[i].gpio == ah->led_pin) ++ ah->led_pin = -1; ++ ++ ath_create_platform_led(sc, &ah->leds[i]); ++ } ++ ++ if (ah->led_pin < 0) ++ return; ++ + snprintf(led_name, sizeof(led_name), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); + diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 90a8e4b0fb..9821716c6a 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1083,6 +1091,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1086,6 +1094,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 0efe23b9dc..1c071c4621 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -192,7 +192,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -117,17 +241,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -135,17 +259,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); @@ -216,8 +216,8 @@ Signed-off-by: Felix Fietkau + struct device_node *np = sc->dev->of_node; char led_name[32]; const char *trigger; - -@@ -136,6 +267,12 @@ void ath_init_leds(struct ath_softc *sc) + int i; +@@ -155,6 +286,12 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; @@ -229,4 +229,12 @@ Signed-off-by: Felix Fietkau + ath_fill_led_pin(sc); - if (ah->led_pin < 0) + if (ah->leds && ah->num_leds) +@@ -179,6 +316,7 @@ void ath_init_leds(struct ath_softc *sc) + ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, + !sc->sc_ah->config.led_active_high); + } ++ + #endif + + /*******************/ diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 78700222a9..92f110b95c 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -239,6 +310,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -257,6 +328,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,11 +120,11 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -274,6 +346,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -293,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); + ath9k_init_buttons(sc); - if (ah->led_pin < 0) - return; + if (ah->leds && ah->num_leds) + for (i = 0; i < ah->num_leds; i++) { From be3bc3df907b02c5a18b538265d02d8eea860063 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:39 +0100 Subject: [PATCH 04/21] Revert "kernel: remove custom ath9k_platform.h" This reverts commit da0016b274008a4792102e72b3d66a84c7db4569. Signed-off-by: Robert Marko --- .../files/include/linux/ath9k_platform.h | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 target/linux/generic/files/include/linux/ath9k_platform.h diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h new file mode 100644 index 0000000000..e210108568 --- /dev/null +++ b/target/linux/generic/files/include/linux/ath9k_platform.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2008 Atheros Communications Inc. + * Copyright (c) 2009 Gabor Juhos + * Copyright (c) 2009 Imre Kaloz + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _LINUX_ATH9K_PLATFORM_H +#define _LINUX_ATH9K_PLATFORM_H + +#define ATH9K_PLAT_EEP_MAX_WORDS 2048 + +struct ath9k_platform_data { + const char *eeprom_name; + + u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS]; + u8 *macaddr; + + int led_pin; + u32 gpio_mask; + u32 gpio_val; + + u32 bt_active_pin; + u32 bt_priority_pin; + u32 wlan_active_pin; + + bool endian_check; + bool is_clk_25mhz; + bool tx_gain_buffalo; + bool disable_2ghz; + bool disable_5ghz; + bool led_active_high; + + int (*get_mac_revision)(void); + int (*external_reset)(void); + + bool use_eeprom; + + int num_leds; + const struct gpio_led *leds; + + unsigned num_btns; + const struct gpio_keys_button *btns; + unsigned btn_poll_interval; +}; + +#endif /* _LINUX_ATH9K_PLATFORM_H */ From 72b59359565a1e58e62074faebe4111c0ea08140 Mon Sep 17 00:00:00 2001 From: Robert Marko Date: Wed, 1 Jan 2025 11:22:40 +0100 Subject: [PATCH 05/21] Revert "mac80211: remove ath9k_platform_data" This reverts commit fdc2c6ab9901ad3e64ec1f93d5ccdc38990243b4. Signed-off-by: Robert Marko --- package/kernel/mac80211/Makefile | 2 +- .../mac80211/patches/ath9k/100-gpio-of.patch | 16 --- .../ath9k/531-ath9k_extra_platform_leds.patch | 28 +++-- .../ath9k/542-ath9k_debugfs_diag.patch | 2 +- .../ath9k/547-ath9k_led_defstate_fix.patch | 2 +- .../ath9k/548-ath9k_enable_gpio_chip.patch | 23 ++-- .../ath9k/549-ath9k_enable_gpio_buttons.patch | 36 +++--- .../patches/ath9k/552-ath9k-ahb_of.patch | 106 +++++++++++++----- 8 files changed, 130 insertions(+), 85 deletions(-) delete mode 100644 package/kernel/mac80211/patches/ath9k/100-gpio-of.patch diff --git a/package/kernel/mac80211/Makefile b/package/kernel/mac80211/Makefile index c3ffb8dc06..b0de3950b9 100644 --- a/package/kernel/mac80211/Makefile +++ b/package/kernel/mac80211/Makefile @@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=mac80211 PKG_VERSION:=6.12.6 -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING diff --git a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch b/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch deleted file mode 100644 index 2cddb59fc5..0000000000 --- a/package/kernel/mac80211/patches/ath9k/100-gpio-of.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- a/drivers/net/wireless/ath/ath9k/hw.h -+++ b/drivers/net/wireless/ath/ath9k/hw.h -@@ -976,6 +976,13 @@ struct ath_hw { - bool disable_2ghz; - bool disable_5ghz; - -+ int num_leds; -+ const struct gpio_led *leds; -+ -+ unsigned num_btns; -+ const struct gpio_keys_button *btns; -+ unsigned btn_poll_interval; -+ - const struct firmware *eeprom_blob; - u16 *nvmem_blob; /* devres managed */ - size_t nvmem_blob_len; diff --git a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch index 4f41cd9139..1055bd335c 100644 --- a/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch +++ b/package/kernel/mac80211/patches/ath9k/531-ath9k_extra_platform_leds.patch @@ -1,6 +1,14 @@ --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -108,6 +108,24 @@ int ath_create_gpio_led(struct ath_softc +@@ -15,6 +15,7 @@ + */ + + #include "ath9k.h" ++#include + + /********************************/ + /* LED functions */ +@@ -108,6 +109,24 @@ int ath_create_gpio_led(struct ath_softc return ret; } @@ -25,30 +33,30 @@ void ath_deinit_leds(struct ath_softc *sc) { struct ath_led *led; -@@ -124,8 +142,10 @@ void ath_deinit_leds(struct ath_softc *s +@@ -124,8 +143,10 @@ void ath_deinit_leds(struct ath_softc *s void ath_init_leds(struct ath_softc *sc) { -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; char led_name[32]; const char *trigger; + int i; INIT_LIST_HEAD(&sc->leds); -@@ -134,6 +154,17 @@ void ath_init_leds(struct ath_softc *sc) +@@ -134,6 +155,17 @@ void ath_init_leds(struct ath_softc *sc) ath_fill_led_pin(sc); -+ if (ah->leds && ah->num_leds) -+ for (i = 0; i < ah->num_leds; i++) { -+ if (ah->leds[i].gpio == ah->led_pin) -+ ah->led_pin = -1; ++ if (pdata && pdata->leds && pdata->num_leds) ++ for (i = 0; i < pdata->num_leds; i++) { ++ if (pdata->leds[i].gpio == sc->sc_ah->led_pin) ++ sc->sc_ah->led_pin = -1; + -+ ath_create_platform_led(sc, &ah->leds[i]); ++ ath_create_platform_led(sc, &pdata->leds[i]); + } + -+ if (ah->led_pin < 0) ++ if (sc->sc_ah->led_pin < 0) + return; + snprintf(led_name, sizeof(led_name), "ath9k-%s", diff --git a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch index 9821716c6a..f08301c7f4 100644 --- a/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch +++ b/package/kernel/mac80211/patches/ath9k/542-ath9k_debugfs_diag.patch @@ -84,7 +84,7 @@ bool reset_power_on; bool htc_reset_init; -@@ -1086,6 +1094,7 @@ void ath9k_hw_check_nav(struct ath_hw *a +@@ -1079,6 +1087,7 @@ void ath9k_hw_check_nav(struct ath_hw *a bool ath9k_hw_check_alive(struct ath_hw *ah); bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode); diff --git a/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch b/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch index d633c051b0..5d84cf0c42 100644 --- a/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch +++ b/package/kernel/mac80211/patches/ath9k/547-ath9k_led_defstate_fix.patch @@ -13,7 +13,7 @@ Signed-off-by: Michal Cieslakiewicz --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -73,8 +73,11 @@ static int ath_add_led(struct ath_softc +@@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name, AR_GPIO_OUTPUT_MUX_AS_OUTPUT); diff --git a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch index 1c071c4621..9fb549cc19 100644 --- a/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch +++ b/package/kernel/mac80211/patches/ath9k/548-ath9k_enable_gpio_chip.patch @@ -45,10 +45,10 @@ Signed-off-by: Felix Fietkau #ifdef CPTCFG_ATH9K_DEBUGFS --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -15,13 +15,131 @@ - */ +@@ -16,13 +16,135 @@ #include "ath9k.h" + #include +#include + +#ifdef CPTCFG_MAC80211_LEDS @@ -126,7 +126,9 @@ Signed-off-by: Felix Fietkau + gc->sc = sc; + snprintf(gc->label, sizeof(gc->label), "ath9k-%s", + wiphy_name(sc->hw->wiphy)); ++#ifdef CONFIG_OF + gc->gchip.parent = sc->dev; ++#endif + gc->gchip.label = gc->label; + gc->gchip.base = -1; /* determine base automatically */ + gc->gchip.ngpio = ah->caps.num_gpio_pins; @@ -141,7 +143,9 @@ Signed-off-by: Felix Fietkau + return; + } + ++#ifdef CONFIG_OF + gc->gchip.owner = NULL; ++#endif + sc->gpiochip = gc; +} + @@ -179,7 +183,7 @@ Signed-off-by: Felix Fietkau static void ath_fill_led_pin(struct ath_softc *sc) { struct ath_hw *ah = sc->sc_ah; -@@ -79,6 +197,12 @@ static int ath_add_led(struct ath_softc +@@ -80,6 +202,12 @@ static int ath_add_led(struct ath_softc else ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low); @@ -192,7 +196,7 @@ Signed-off-by: Felix Fietkau return 0; } -@@ -135,17 +259,24 @@ void ath_deinit_leds(struct ath_softc *s +@@ -136,17 +264,24 @@ void ath_deinit_leds(struct ath_softc *s while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); @@ -212,15 +216,18 @@ Signed-off-by: Felix Fietkau void ath_init_leds(struct ath_softc *sc) { - struct ath_hw *ah = sc->sc_ah; + struct ath9k_platform_data *pdata = sc->dev->platform_data; + struct device_node *np = sc->dev->of_node; char led_name[32]; const char *trigger; int i; -@@ -155,6 +286,12 @@ void ath_init_leds(struct ath_softc *sc) +@@ -156,6 +291,15 @@ void ath_init_leds(struct ath_softc *sc) if (AR_SREV_9100(sc->sc_ah)) return; ++ if (!np) ++ ath9k_register_gpio_chip(sc); ++ + /* setup gpio controller only if requested and skip the led_pin setup */ + if (of_property_read_bool(np, "gpio-controller")) { + ath9k_register_gpio_chip(sc); @@ -229,8 +236,8 @@ Signed-off-by: Felix Fietkau + ath_fill_led_pin(sc); - if (ah->leds && ah->num_leds) -@@ -179,6 +316,7 @@ void ath_init_leds(struct ath_softc *sc) + if (pdata && pdata->leds && pdata->num_leds) +@@ -180,6 +324,7 @@ void ath_init_leds(struct ath_softc *sc) ath_create_gpio_led(sc, sc->sc_ah->led_pin, led_name, trigger, !sc->sc_ah->config.led_active_high); } diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch index 92f110b95c..d164d89031 100644 --- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch +++ b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch @@ -20,16 +20,16 @@ Signed-off-by: Felix Fietkau --- a/drivers/net/wireless/ath/ath9k/gpio.c +++ b/drivers/net/wireless/ath/ath9k/gpio.c -@@ -16,6 +16,8 @@ - +@@ -17,6 +17,8 @@ #include "ath9k.h" + #include #include +#include +#include #ifdef CPTCFG_MAC80211_LEDS -@@ -124,6 +126,67 @@ static void ath9k_unregister_gpio_chip(s +@@ -129,6 +131,67 @@ static void ath9k_unregister_gpio_chip(s sc->gpiochip = NULL; } @@ -40,7 +40,7 @@ Signed-off-by: Felix Fietkau +/* add GPIO buttons */ +static void ath9k_init_buttons(struct ath_softc *sc) +{ -+ struct ath_hw *ah = sc->sc_ah; ++ struct ath9k_platform_data *pdata = sc->dev->platform_data; + struct platform_device *pdev; + struct gpio_keys_platform_data gkpdata; + struct gpio_keys_button *bt; @@ -49,28 +49,28 @@ Signed-off-by: Felix Fietkau + if (!sc->gpiochip) + return; + -+ if (!ah->btns || !ah->num_btns) ++ if (!pdata || !pdata->btns || !pdata->num_btns) + return; + -+ bt = devm_kmemdup(sc->dev, ah->btns, -+ ah->num_btns * sizeof(struct gpio_keys_button), ++ bt = devm_kmemdup(sc->dev, pdata->btns, ++ pdata->num_btns * sizeof(struct gpio_keys_button), + GFP_KERNEL); + if (!bt) + return; + -+ for (i = 0; i < ah->num_btns; i++) { -+ if (ah->btns[i].gpio == sc->sc_ah->led_pin) ++ for (i = 0; i < pdata->num_btns; i++) { ++ if (pdata->btns[i].gpio == sc->sc_ah->led_pin) + sc->sc_ah->led_pin = -1; + -+ ath9k_hw_gpio_request_in(sc->sc_ah, ah->btns[i].gpio, ++ ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio, + "ath9k-gpio"); -+ bt[i].gpio = sc->gpiochip->gchip.base + ah->btns[i].gpio; ++ bt[i].gpio = sc->gpiochip->gchip.base + pdata->btns[i].gpio; + } + + memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data)); + gkpdata.buttons = bt; -+ gkpdata.nbuttons = ah->num_btns; -+ gkpdata.poll_interval = ah->btn_poll_interval; ++ gkpdata.nbuttons = pdata->num_btns; ++ gkpdata.poll_interval = pdata->btn_poll_interval; + + pdev = platform_device_register_data(sc->dev, "gpio-keys-polled", + PLATFORM_DEVID_AUTO, &gkpdata, @@ -97,7 +97,7 @@ Signed-off-by: Felix Fietkau #else /* CONFIG_GPIOLIB */ static inline void ath9k_register_gpio_chip(struct ath_softc *sc) -@@ -134,6 +197,14 @@ static inline void ath9k_unregister_gpio +@@ -139,6 +202,14 @@ static inline void ath9k_unregister_gpio { } @@ -112,7 +112,7 @@ Signed-off-by: Felix Fietkau #endif /* CONFIG_GPIOLIB */ /********************************/ -@@ -257,6 +328,7 @@ void ath_deinit_leds(struct ath_softc *s +@@ -262,6 +333,7 @@ void ath_deinit_leds(struct ath_softc *s { struct ath_led *led; @@ -120,11 +120,11 @@ Signed-off-by: Felix Fietkau while (!list_empty(&sc->leds)) { led = list_first_entry(&sc->leds, struct ath_led, list); #ifdef CONFIG_GPIOLIB -@@ -293,6 +365,7 @@ void ath_init_leds(struct ath_softc *sc) +@@ -301,6 +373,7 @@ void ath_init_leds(struct ath_softc *sc) } ath_fill_led_pin(sc); + ath9k_init_buttons(sc); - if (ah->leds && ah->num_leds) - for (i = 0; i < ah->num_leds; i++) { + if (pdata && pdata->leds && pdata->num_leds) + for (i = 0; i < pdata->num_leds; i++) { diff --git a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch index a5ad2bcffb..3adc8bb8d6 100644 --- a/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch +++ b/package/kernel/mac80211/patches/ath9k/552-ath9k-ahb_of.patch @@ -1,22 +1,27 @@ --- a/drivers/net/wireless/ath/ath9k/ahb.c +++ b/drivers/net/wireless/ath/ath9k/ahb.c -@@ -20,8 +20,12 @@ +@@ -20,7 +20,15 @@ #include #include #include +#include #include "ath9k.h" - ++#include ++ ++#ifdef CONFIG_OF +#include +#include -+ ++#include ++#endif + static const struct platform_device_id ath9k_platform_id_table[] = { { - .name = "ath9k", -@@ -69,22 +73,198 @@ static const struct ath_bus_ops ath_ahb_ +@@ -69,6 +77,192 @@ static const struct ath_bus_ops ath_ahb_ .eeprom_read = ath_ahb_eeprom_read, }; ++#ifdef CONFIG_OF ++ +#define QCA955X_DDR_CTL_CONFIG 0x108 +#define QCA955X_DDR_CTL_CONFIG_ACT_WMAC BIT(23) + @@ -157,7 +162,7 @@ + +static int of_ath_ahb_probe(struct platform_device *pdev) +{ -+ struct ath_hw *ah = platform_get_drvdata(pdev); ++ struct ath9k_platform_data *pdata; + const struct of_device_id *match; + const struct of_ath_ahb_data *data; + u8 led_pin; @@ -165,17 +170,19 @@ + match = of_match_device(of_ath_ahb_match, &pdev->dev); + data = (const struct of_ath_ahb_data *)match->data; + ++ pdata = dev_get_platdata(&pdev->dev); ++ + if (!of_property_read_u8(pdev->dev.of_node, "qca,led-pin", &led_pin)) -+ ah->led_pin = led_pin; ++ pdata->led_pin = led_pin; + else -+ ah->led_pin = -1; ++ pdata->led_pin = -1; + + if (of_property_read_bool(pdev->dev.of_node, "qca,tx-gain-buffalo")) -+ ah->config.tx_gain_buffalo = true; ++ pdata->tx_gain_buffalo = true; + + if (data->wmac_reset) { + data->wmac_reset(); -+ ah->external_reset = data->wmac_reset; ++ pdata->external_reset = data->wmac_reset; + } + + if (data->dev_id == AR9300_DEVID_AR953X) { @@ -184,55 +191,94 @@ + * Some vendors have an invalid bootstrap option + * set, which would break the WMAC here. + */ -+ ah->is_clk_25mhz = true; ++ pdata->is_clk_25mhz = true; + } else if (data->bootstrap_reg && data->bootstrap_ref) { + u32 t = ath79_reset_rr(data->bootstrap_reg); + if (t & data->bootstrap_ref) -+ ah->is_clk_25mhz = false; ++ pdata->is_clk_25mhz = false; + else -+ ah->is_clk_25mhz = true; ++ pdata->is_clk_25mhz = true; + } + -+ ah->get_mac_revision = data->soc_revision; ++ pdata->get_mac_revision = data->soc_revision; + + return data->dev_id; +} ++#endif + static int ath_ahb_probe(struct platform_device *pdev) { void __iomem *mem; - struct ath_softc *sc; - struct ieee80211_hw *hw; - struct resource *res; -- const struct platform_device_id *id = platform_get_device_id(pdev); - int irq; +@@ -80,6 +274,17 @@ static int ath_ahb_probe(struct platform int ret = 0; struct ath_hw *ah; char hw_name[64]; -- -- if (!dev_get_platdata(&pdev->dev)) { -- dev_err(&pdev->dev, "no platform data specified\n"); -- return -EINVAL; -- } -+ u32 dev_id; ++ u16 dev_id; ++ ++ if (id) ++ dev_id = id->driver_data; ++ ++#ifdef CONFIG_OF ++ if (pdev->dev.of_node) ++ pdev->dev.platform_data = devm_kzalloc(&pdev->dev, ++ sizeof(struct ath9k_platform_data), ++ GFP_KERNEL); ++#endif - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res == NULL) { -@@ -124,7 +304,8 @@ static int ath_ahb_probe(struct platform + if (!dev_get_platdata(&pdev->dev)) { + dev_err(&pdev->dev, "no platform data specified\n"); +@@ -118,17 +323,23 @@ static int ath_ahb_probe(struct platform + sc->mem = mem; + sc->irq = irq; + ++#ifdef CONFIG_OF ++ dev_id = of_ath_ahb_probe(pdev); ++#endif + ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc); + if (ret) { + dev_err(&pdev->dev, "request_irq failed\n"); goto err_free_hw; } - ret = ath9k_init_device(id->driver_data, sc, &ath_ahb_bus_ops); -+ dev_id = of_ath_ahb_probe(pdev); + ret = ath9k_init_device(dev_id, sc, &ath_ahb_bus_ops); if (ret) { dev_err(&pdev->dev, "failed to initialize device\n"); goto err_irq; -@@ -162,6 +343,7 @@ static struct platform_driver ath_ahb_dr + } ++#ifdef CONFIG_OF ++ pdev->dev.platform_data = NULL; ++#endif + + ah = sc->sc_ah; + ath9k_hw_name(ah, hw_name, sizeof(hw_name)); +@@ -162,6 +373,9 @@ static struct platform_driver ath_ahb_dr .remove_new = ath_ahb_remove, .driver = { .name = "ath9k", ++#ifdef CONFIG_OF + .of_match_table = of_ath_ahb_match, ++#endif }, .id_table = ath9k_platform_id_table, }; +--- a/drivers/net/wireless/ath/ath9k/ath9k.h ++++ b/drivers/net/wireless/ath/ath9k/ath9k.h +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + + #include "common.h" + #include "debug.h" +@@ -1013,6 +1014,9 @@ struct ath_softc { + struct ath_hw *sc_ah; + void __iomem *mem; + int irq; ++#ifdef CONFIG_OF ++ struct reset_control *reset; ++#endif + spinlock_t sc_serial_rw; + spinlock_t sc_pm_lock; + spinlock_t sc_pcu_lock; From 8ad02ca2f8477b1cfdc5ea6124fae60c07687aa1 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 19:07:13 +0800 Subject: [PATCH 06/21] rockchip: backport recent rk3588 clk updates Backport recent rk3588 clk updates from upstream, including one bug fix. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 Signed-off-by: Hauke Mehrtens --- ...chip-Add-new-pll-type-pll_rk3588_ddr.patch | 51 +++++++++++++++ ...clk-rockchip-rk3588-drop-unused-code.patch | 65 +++++++++++++++++++ ...chip-fix-finding-of-maximum-clock-ID.patch | 29 +++++++++ 3 files changed, 145 insertions(+) create mode 100644 target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch create mode 100644 target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch create mode 100644 target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch diff --git a/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch new file mode 100644 index 0000000000..0d68f687fa --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-09-v6.12-clk-rockchip-Add-new-pll-type-pll_rk3588_ddr.patch @@ -0,0 +1,51 @@ +From e781bffc296766b55dbd048890d558655031e8d1 Mon Sep 17 00:00:00 2001 +From: Elaine Zhang +Date: Wed, 28 Aug 2024 15:42:52 +0000 +Subject: [PATCH] clk: rockchip: Add new pll type pll_rk3588_ddr + +That PLL type is similar to the other rk3588 pll types but the actual +rate is twice the configured rate. +Therefore, the returned calculated rate must be multiplied by two. + +Signed-off-by: Elaine Zhang +Signed-off-by: Detlev Casanova +Acked-by: Dragan Simic +Link: https://lore.kernel.org/r/0102019199a76ec4-9d5846d4-d76a-4e69-a241-c88c2983d607-000000@eu-west-1.amazonses.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-pll.c | 6 +++++- + drivers/clk/rockchip/clk.h | 1 + + 2 files changed, 6 insertions(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk-pll.c ++++ b/drivers/clk/rockchip/clk-pll.c +@@ -914,7 +914,10 @@ static unsigned long rockchip_rk3588_pll + } + rate64 = rate64 >> cur.s; + +- return (unsigned long)rate64; ++ if (pll->type == pll_rk3588_ddr) ++ return (unsigned long)rate64 * 2; ++ else ++ return (unsigned long)rate64; + } + + static int rockchip_rk3588_pll_set_params(struct rockchip_clk_pll *pll, +@@ -1167,6 +1170,7 @@ struct clk *rockchip_clk_register_pll(st + break; + case pll_rk3588: + case pll_rk3588_core: ++ case pll_rk3588_ddr: + if (!pll->rate_table) + init.ops = &rockchip_rk3588_pll_clk_norate_ops; + else +--- a/drivers/clk/rockchip/clk.h ++++ b/drivers/clk/rockchip/clk.h +@@ -287,6 +287,7 @@ enum rockchip_pll_type { + pll_rk3399, + pll_rk3588, + pll_rk3588_core, ++ pll_rk3588_ddr, + }; + + #define RK3036_PLL_RATE(_rate, _refdiv, _fbdiv, _postdiv1, \ diff --git a/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch new file mode 100644 index 0000000000..0164bf26e5 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-10-v6.12-clk-rockchip-rk3588-drop-unused-code.patch @@ -0,0 +1,65 @@ +From 2e7b3daa8cb1ebd17e6a7f417ef5e6553203035c Mon Sep 17 00:00:00 2001 +From: Sebastian Reichel +Date: Mon, 25 Mar 2024 20:33:32 +0100 +Subject: [PATCH] clk: rockchip: rk3588: drop unused code + +All clocks are registered early using CLK_OF_DECLARE(), which marks +the DT node as processed. For the processed DT node the probe routine +is never called. Thus this whole code is never executed. This could +be "fixed" by using CLK_OF_DECLARE_DRIVER, which avoids marking the +DT node as processed. But then the probe routine would re-register +all the clocks by calling rk3588_clk_init() again. + +Signed-off-by: Sebastian Reichel +Link: https://lore.kernel.org/r/20240325193609.237182-2-sebastian.reichel@collabora.com +Signed-off-by: Heiko Stuebner +--- + drivers/clk/rockchip/clk-rk3588.c | 40 ------------------------------- + 1 file changed, 40 deletions(-) + +--- a/drivers/clk/rockchip/clk-rk3588.c ++++ b/drivers/clk/rockchip/clk-rk3588.c +@@ -2502,43 +2502,3 @@ static void __init rk3588_clk_init(struc + } + + CLK_OF_DECLARE(rk3588_cru, "rockchip,rk3588-cru", rk3588_clk_init); +- +-struct clk_rk3588_inits { +- void (*inits)(struct device_node *np); +-}; +- +-static const struct clk_rk3588_inits clk_3588_cru_init = { +- .inits = rk3588_clk_init, +-}; +- +-static const struct of_device_id clk_rk3588_match_table[] = { +- { +- .compatible = "rockchip,rk3588-cru", +- .data = &clk_3588_cru_init, +- }, +- { } +-}; +- +-static int __init clk_rk3588_probe(struct platform_device *pdev) +-{ +- const struct clk_rk3588_inits *init_data; +- struct device *dev = &pdev->dev; +- +- init_data = device_get_match_data(dev); +- if (!init_data) +- return -EINVAL; +- +- if (init_data->inits) +- init_data->inits(dev->of_node); +- +- return 0; +-} +- +-static struct platform_driver clk_rk3588_driver = { +- .driver = { +- .name = "clk-rk3588", +- .of_match_table = clk_rk3588_match_table, +- .suppress_bind_attrs = true, +- }, +-}; +-builtin_platform_driver_probe(clk_rk3588_driver, clk_rk3588_probe); diff --git a/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch new file mode 100644 index 0000000000..912c2c7778 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/030-11-v6.13-clk-rockchip-fix-finding-of-maximum-clock-ID.patch @@ -0,0 +1,29 @@ +From ad1081a0da2744141d12e94ff816ac91feb871ca Mon Sep 17 00:00:00 2001 +From: Yao Zi +Date: Thu, 12 Sep 2024 13:32:05 +0000 +Subject: [PATCH] clk: rockchip: fix finding of maximum clock ID + +If an ID of a branch's child is greater than current maximum, we should +set new maximum to the child's ID, instead of its parent's. + +Fixes: 2dc66a5ab2c6 ("clk: rockchip: rk3588: fix CLK_NR_CLKS usage") +Signed-off-by: Yao Zi +Link: https://lore.kernel.org/r/20240912133204.29089-2-ziyao@disroot.org +Reviewed-by: Sebastian Reichel +Reviewed-by: Heiko Stuebner +Signed-off-by: Stephen Boyd +--- + drivers/clk/rockchip/clk.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/clk/rockchip/clk.c ++++ b/drivers/clk/rockchip/clk.c +@@ -439,7 +439,7 @@ unsigned long rockchip_clk_find_max_clk_ + if (list->id > max) + max = list->id; + if (list->child && list->child->id > max) +- max = list->id; ++ max = list->child->id; + } + + return max; From 6881b48dc603e25320a14e11c5e1797321891b76 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Mon, 23 Dec 2024 21:13:24 +0800 Subject: [PATCH 07/21] rockchip: enable USB3 port on NanoPC T6 Enable the USB3 port on FriendlyELEC NanoPC-T6. Signed-off-by: Tianling Shen Link: https://github.com/openwrt/openwrt/pull/17349 Signed-off-by: Hauke Mehrtens --- ...ts-rockchip-enable-USB3-on-NanoPC-T6.patch | 87 +++++++++++++++++++ ...ckchip-lower-mmc-speed-for-nanopc-t6.patch | 2 +- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch diff --git a/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch b/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch new file mode 100644 index 0000000000..d3aa8b9cc3 --- /dev/null +++ b/target/linux/rockchip/patches-6.6/055-16-v6.13-arm64-dts-rockchip-enable-USB3-on-NanoPC-T6.patch @@ -0,0 +1,87 @@ +From a6ae420439dc47a58550a6e61e596e9dd1562caf Mon Sep 17 00:00:00 2001 +From: Rick Wertenbroek +Date: Wed, 6 Nov 2024 14:03:13 +0100 +Subject: [PATCH] arm64: dts: rockchip: enable USB3 on NanoPC-T6 + +Enable the USB3 port on FriendlyELEC NanoPC-T6. + +Signed-off-by: Rick Wertenbroek +Link: https://lore.kernel.org/r/20241106130314.1289055-1-rick.wertenbroek@gmail.com +Signed-off-by: Heiko Stuebner +--- + .../boot/dts/rockchip/rk3588-nanopc-t6.dtsi | 36 +++++++++++++++++++ + 1 file changed, 36 insertions(+) + +--- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi ++++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +@@ -160,6 +160,20 @@ + vin-supply = <&vcc5v0_sys>; + }; + ++ vbus5v0_usb: vbus5v0-usb-regulator { ++ compatible = "regulator-fixed"; ++ enable-active-high; ++ gpio = <&gpio4 RK_PB0 GPIO_ACTIVE_HIGH>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb5v_pwren>; ++ regulator-always-on; ++ regulator-boot-on; ++ regulator-name = "vbus5v0_usb"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ vin-supply = <&vcc5v0_sys>; ++ }; ++ + vcc3v3_pcie2x1l0: vcc3v3-pcie2x1l0-regulator { + compatible = "regulator-fixed"; + enable-active-high; +@@ -577,6 +591,10 @@ + rockchip,pins = <1 RK_PD2 RK_FUNC_GPIO &pcfg_pull_none>; + }; + ++ usb5v_pwren: usb5v_pwren { ++ rockchip,pins = <4 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>; ++ }; ++ + usbc0_int: usbc0-int { + rockchip,pins = <0 RK_PD3 RK_FUNC_GPIO &pcfg_pull_up>; + }; +@@ -976,6 +994,14 @@ + status = "okay"; + }; + ++&u2phy1 { ++ status = "okay"; ++}; ++ ++&u2phy1_otg { ++ status = "okay"; ++}; ++ + &u2phy2_host { + status = "okay"; + }; +@@ -1015,6 +1041,11 @@ + }; + }; + ++&usbdp_phy1 { ++ phy-supply = <&vbus5v0_usb>; ++ status = "okay"; ++}; ++ + &usb_host0_ehci { + status = "okay"; + }; +@@ -1035,6 +1066,11 @@ + }; + }; + ++&usb_host1_xhci { ++ dr_mode = "host"; ++ status = "okay"; ++}; ++ + &usb_host1_ehci { + status = "okay"; + }; diff --git a/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch b/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch index bbcff01790..1b76fac103 100644 --- a/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch +++ b/target/linux/rockchip/patches-6.6/121-arm64-dts-rockchip-lower-mmc-speed-for-nanopc-t6.patch @@ -1,6 +1,6 @@ --- a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dtsi -@@ -616,7 +616,7 @@ +@@ -634,7 +634,7 @@ disable-wp; no-mmc; no-sdio; From 616621120bf2ba460b99d6c814b629a01be8a5d0 Mon Sep 17 00:00:00 2001 From: Roland Reinl Date: Mon, 30 Dec 2024 08:54:56 +0100 Subject: [PATCH 08/21] mediatek: Fix primary MAC of D-Link M60 During port to gluon, I saw that the primary mac is not correct. Updated DTS accordingly. Signed-off-by: Roland Reinl Link: https://github.com/openwrt/openwrt/pull/17429 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts index a95c069156..e805554a13 100644 --- a/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts +++ b/target/linux/mediatek/dts/mt7986a-dlink-aquila-pro-ai-m60-a1.dts @@ -17,6 +17,7 @@ led-failsafe = &led_status_red; led-running = &led_status_white; led-upgrade = &led_status_blue; + label-mac-device = &gmac0; }; chosen { From ae0fd926997e789e7244443dba6cb07f6b43053a Mon Sep 17 00:00:00 2001 From: John Audia Date: Sat, 28 Dec 2024 11:59:51 -0500 Subject: [PATCH 09/21] bcm27xx/bcm2712: add RP1 camera front-end Add kmod for RP1 camera front-end for RPi5B Build system: x86/64 Build-tested: bcm2712/RPi5B Run-tested: bcm2712/RPi5B Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17412 Signed-off-by: Hauke Mehrtens --- target/linux/bcm27xx/modules/video.mk | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/target/linux/bcm27xx/modules/video.mk b/target/linux/bcm27xx/modules/video.mk index 8e2b19bd87..dddf13e0f4 100644 --- a/target/linux/bcm27xx/modules/video.mk +++ b/target/linux/bcm27xx/modules/video.mk @@ -20,6 +20,25 @@ endef $(eval $(call KernelPackage,camera-bcm2835)) +define KernelPackage/rp1-cfe + TITLE:=RP1 Camera Front-End + SUBMENU:=$(VIDEO_MENU) + KCONFIG:= \ + CONFIG_VIDEO_RP1_CFE \ + CONFIG_VIDEO_BCM2835 + FILES:=$(LINUX_DIR)/drivers/media/platform/raspberrypi/rp1_cfe/rp1-cfe.ko + AUTOLOAD:=$(call AutoLoad,67,rp1-cfe) + DEPENDS:=@TARGET_bcm27xx_bcm2712 +kmod-video-core +kmod-video-fwnode +kmod-video-dma-contig +kmod-video-async +endef + +define KernelPackage/rp1-cfe/description + Driver for the Camera Serial Interface (CSI) to capture video + streams from connected cameras. +endef + +$(eval $(call KernelPackage,rp1-cfe)) + + define KernelPackage/codec-bcm2835 TITLE:=BCM2835 Video Codec KCONFIG:= \ From 777c6106ed4e4acdad6f1b094a05a745db8fe396 Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Wed, 1 Jan 2025 20:05:20 +0100 Subject: [PATCH 10/21] realtek: move debounce-interval to correct node The debounce-interval of a gpio-keys node should be placed in the key node itself, not in the main node. Move the properties added earlier and fix the key node name while we're here. Fixes: 4357f32d41eb ("realtek: debounce reset key for Zyxel GS1900") Signed-off-by: Sander Vanheule --- target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi | 2 +- target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi index 59b44ad161..3889fe8859 100644 --- a/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi +++ b/target/linux/realtek/dts/rtl8380_zyxel_gs1900.dtsi @@ -20,13 +20,13 @@ keys { compatible = "gpio-keys-polled"; - debounce-interval = <100>; poll-interval = <20>; reset { label = "reset"; gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; linux,code = ; + debounce-interval = <100>; }; }; diff --git a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts index ad3245fc27..a1e0a6d06d 100644 --- a/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts +++ b/target/linux/realtek/dts/rtl8393_zyxel_gs1900-48.dts @@ -41,13 +41,13 @@ keys { compatible = "gpio-keys-polled"; - debounce-interval = <100>; poll-interval = <20>; - mode { + reset { label = "reset"; gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; linux,code = ; + debounce-interval = <100>; }; }; From f8a8a2c5c7ff1efe289d846a890d3361757c231f Mon Sep 17 00:00:00 2001 From: Jonathan Sturges Date: Thu, 26 Dec 2024 21:47:40 -0500 Subject: [PATCH 11/21] ramips: mt7621: enable lzma-loader for Amped Wireless ALLY Switch to using loader-kernel to accommodate larger image sizes that are problematic for many mt7621 uboots. Signed-off-by: Jonathan Sturges Link: https://github.com/openwrt/openwrt/pull/17389 Signed-off-by: Hauke Mehrtens --- target/linux/ramips/image/mt7621.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 2623d890f6..ed0da90528 100755 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -294,11 +294,11 @@ TARGET_DEVICES += alfa-network_quad-e4g define Device/ampedwireless_ally_common $(Device/nand) + $(Device/uimage-lzma-loader) DEVICE_VENDOR := Amped Wireless DEVICE_PACKAGES := kmod-mt7615-firmware IMAGE_SIZE := 32768k - KERNEL_INITRAMFS := $(KERNEL_DTB) | uImage lzma -n 'flashable-initramfs' |\ - edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 + KERNEL_INITRAMFS := $$(KERNEL) | edimax-header -s CSYS -m RN68 -f 0x001c0000 -S 0x01100000 endef define Device/ampedwireless_ally-r1900k From b948c1e39b9e69e26e8caabf86c2d0bb9ac4efa6 Mon Sep 17 00:00:00 2001 From: James Sweeney Date: Wed, 1 Jan 2025 08:47:28 -0500 Subject: [PATCH 12/21] realtek: add support for HPE 1920-24G PoE-180W (JG925A) Hardware information: (largely copied from 11275be) --------------------- The HPE 1920-24G-PoE+ (180W) (JG925A) is a switch that is part of the 1920 family which has 180W nominal PoE+ support. Common with HPE 1920-24G: - RTL8382 SoC - 24 Gigabit RJ45 ports (built-in RTL8218B, 2 external RTL8218D) - 4 SFP ports (external RTL8214FC) - RJ45 RS232 port on front panel - 32 MiB NOR Flash - 128 MiB DDR3 DRAM - PT7A7514 watchdog HPE 1920-24G-PoE+ (180W): - PoE chip - 2 fans (40mm) Known issues: --------------------- - PoE LEDs are uncontrolled. (Manual taken from f2f09bc) Booting initramfs image: ------------------------ - Prepare a FTP or TFTP server serving the OpenWrt initramfs image and connect the server to a switch port. - Connect to the console port of the device and enter the extended boot menu by typing Ctrl+B when prompted. - Choose the menu option "<3> Enter Ethernet SubMenu". - Set network parameters via the option "<5> Modify Ethernet Parameter". Enter the FTP/TFTP filename as "Load File Name" ("Target File Name" can be left blank, it is not required for booting from RAM). Note that the configuration is saved on flash, so it only needs to be done once. - Select "<1> Download Application Program To SDRAM And Run". Initial installation: --------------------- - Boot an initramfs image as described above, then use sysupgrade to install OpenWrt permanently. After initial installation, the bootloader needs to be configured to load the correct image file - Enter the extended boot menu again and choose "<4> File Control", then select "<2> Set Application File type". - Enter the number of the file "openwrt-kernel.bin" (should be 1), and use the option "<1> +Main" to select it as boot image. - Choose "<0> Exit To Main Menu" and then "<1> Boot System". NOTE: The bootloader on these devices can only boot from the VFS filesystem which normally spans most of the flash. With OpenWrt, only the first part of the firmware partition contains a valid filesystem, the rest is used for rootfs. As the bootloader does not know about this, you must not do any file operations in the bootloader, as this may corrupt the OpenWrt installation (selecting the boot image is an exception, as it only stores a flag in the bootloader data, but doesn't write to the filesystem). Example PoE config file (/etc/config/poe): --------------------- config global option budget '180' config port option enable '1' option id '1' option name 'lan8' option poe_plus '1' option priority '2' config port option enable '1' option id '2' option name 'lan7' option poe_plus '1' option priority '2' config port option enable '1' option id '3' option name 'lan6' option poe_plus '1' option priority '2' config port option enable '1' option id '4' option name 'lan5' option poe_plus '1' option priority '2' config port option enable '1' option id '5' option name 'lan4' option poe_plus '1' option priority '2' config port option enable '1' option id '6' option name 'lan3' option poe_plus '1' option priority '2' config port option enable '1' option id '7' option name 'lan2' option poe_plus '1' option priority '2' config port option enable '1' option id '8' option name 'lan1' option poe_plus '1' option priority '2' config port option enable '1' option id '9' option name 'lan16' option poe_plus '1' option priority '2' config port option enable '1' option id '10' option name 'lan15' option poe_plus '1' option priority '2' config port option enable '1' option id '11' option name 'lan14' option poe_plus '1' option priority '2' config port option enable '1' option id '12' option name 'lan13' option poe_plus '1' option priority '2' config port option enable '1' option id '13' option name 'lan12' option poe_plus '1' option priority '2' config port option enable '1' option id '14' option name 'lan11' option poe_plus '1' option priority '2' config port option enable '1' option id '15' option name 'lan10' option poe_plus '1' option priority '2' config port option enable '1' option id '16' option name 'lan9' option poe_plus '1' option priority '2' config port option enable '1' option id '17' option name 'lan24' option poe_plus '1' option priority '2' config port option enable '1' option id '18' option name 'lan23' option poe_plus '1' option priority '2' config port option enable '1' option id '19' option name 'lan22' option poe_plus '1' option priority '2' config port option enable '1' option id '20' option name 'lan21' option poe_plus '1' option priority '2' config port option enable '1' option id '21' option name 'lan20' option poe_plus '1' option priority '2' config port option enable '1' option id '22' option name 'lan19' option poe_plus '1' option priority '2' config port option enable '1' option id '23' option name 'lan18' option poe_plus '1' option priority '2' config port option enable '1' option id '24' option name 'lan17' option poe_plus '1' option priority '2' Signed-off-by: James Sweeney Link: https://github.com/openwrt/openwrt/pull/17444 Signed-off-by: Sander Vanheule --- .../linux/realtek/base-files/etc/board.d/02_network | 3 +++ .../realtek/base-files/etc/board.d/03_gpio_switches | 1 + .../realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts | 12 ++++++++++++ target/linux/realtek/image/rtl838x.mk | 9 +++++++++ 4 files changed, 25 insertions(+) create mode 100644 target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index 750a200814..a73944107a 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -96,6 +96,9 @@ hpe,1920-8g-poe-65w) hpe,1920-8g-poe-180w) ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")" ;; +hpe,1920-24g-poe-180w) + ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" + ;; hpe,1920-24g-poe-370w) ucidef_set_poe 370 "$(filter_port_list_reverse "$lan_list" "lan25 lan26 lan27 lan28")" ;; diff --git a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches index 684d7f795e..c869153e4c 100644 --- a/target/linux/realtek/base-files/etc/board.d/03_gpio_switches +++ b/target/linux/realtek/base-files/etc/board.d/03_gpio_switches @@ -7,6 +7,7 @@ board=$(board_name) case "$board" in hpe,1920-8g-poe-180w|\ +hpe,1920-24g-poe-180w|\ hpe,1920-24g-poe-370w) ucidef_add_gpio_switch "fan_ctrl" "Fan control" "456" "0" ;; diff --git a/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts new file mode 100644 index 0000000000..4783cec15c --- /dev/null +++ b/target/linux/realtek/dts/rtl8382_hpe_1920-24g-poe-180w.dts @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "rtl8382_hpe_1920-24g.dtsi" + +/ { + compatible = "hpe,1920-24g-poe-180w", "realtek,rtl838x-soc"; + model = "HPE 1920-24G-PoE+ 180W (JG925A)"; +}; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index d694f5b308..866659ad14 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -144,6 +144,15 @@ define Device/hpe_1920-24g endef TARGET_DEVICES += hpe_1920-24g +define Device/hpe_1920-24g-poe-180w + $(Device/hpe_1920) + SOC := rtl8382 + DEVICE_MODEL := 1920-24G-PoE+ 180W (JG925A) + DEVICE_PACKAGES += realtek-poe + H3C_DEVICE_ID := 0x00010028 +endef +TARGET_DEVICES += hpe_1920-24g-poe-180w + define Device/hpe_1920-24g-poe-370w $(Device/hpe_1920) SOC := rtl8382 From 0fda3b14c771c697f98daed39cbba08d69b06b96 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 20 Dec 2024 00:59:50 +0100 Subject: [PATCH 13/21] ixp4xx: Add back support for Netgear WG302 v1 The WG302 v1 has 32MB of RAM so it can easily run OpenWrt, however it lacks much flash: only 8 MB. By just using the flash for rootfs and booting a kernel over TFTP it works just fine. Signed-off-by: Linus Walleij --- .../ixp4xx/base-files/etc/board.d/02_network | 3 +- target/linux/ixp4xx/image/Makefile | 15 +++++ ...7-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch | 40 +++++++++++++ ...ts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch | 59 +++++++++++++++++++ 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch create mode 100644 target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch diff --git a/target/linux/ixp4xx/base-files/etc/board.d/02_network b/target/linux/ixp4xx/base-files/etc/board.d/02_network index 6a361d4f53..c321e3fb27 100644 --- a/target/linux/ixp4xx/base-files/etc/board.d/02_network +++ b/target/linux/ixp4xx/base-files/etc/board.d/02_network @@ -11,7 +11,8 @@ gateworks,gw2358) ;; dlink,dsm-g600-a|\ iom,nas-100d|\ -linksys,nslu2) +linksys,nslu2|\ +netgear,wg302v1) ucidef_set_interface_lan "eth0" "dhcp" ;; usr,usr8200) diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index ace533e50f..f1172ee123 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -124,6 +124,21 @@ define Device/linksys_nslu2 endef TARGET_DEVICES += linksys_nslu2 +define Device/netgear_wg302v1 + DEVICE_VENDOR := Netgear + DEVICE_MODEL := WG302 v1 + DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-phy-amd kmod-ath5k \ + wpad-basic-mbedtls kmod-input-gpio-keys-polled + # Only 32 MB of RAM and small flash so not building by default + DEFAULT := n + DEVICE_DTS := intel-ixp42x-netgear-wg302v1 + KERNEL := kernel-bin | append-dtb + IMAGES := kernel.bin rootfs.bin + IMAGE/kernel.bin := append-kernel + IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k +endef +TARGET_DEVICES += netgear_wg302v1 + define Device/usrobotics_usr8200 DEVICE_VENDOR := USRobotics DEVICE_MODEL := USR8200 diff --git a/target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch b/target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch new file mode 100644 index 0000000000..ca0df18071 --- /dev/null +++ b/target/linux/ixp4xx/patches-6.6/0007-ARM-dts-ixp4xx-Fix-up-PCI-on-WG302.patch @@ -0,0 +1,40 @@ +From ed23e07bf7a1896b6eaa85b773bb43b1fad66d4b Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Sat, 21 Dec 2024 00:07:11 +0100 +Subject: [PATCH] ARM: dts: ixp4xx: Fix up PCI on WG302 + +Looking at the board file for WG302 v2 was not a good idea +because the GPIO IRQ for slot 2 differs, and v1 uses GPIO +10 instead of GPIO 9. Fix it up. + +Signed-off-by: Linus Walleij +--- + .../dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts +@@ -57,7 +57,7 @@ + status = "okay"; + + /* +- * Taken from WG302 v2 PCI boardfile (wg302v2-pci.c) ++ * Taken from WG302 v1 PCI boardfile (wg302v1-pci.c) + * We have slots (IDSEL) 1 and 2 with one assigned IRQ + * each handling all IRQs. + */ +@@ -70,10 +70,10 @@ + <0x0800 0 0 3 &gpio0 8 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 1 is irq 8 */ + <0x0800 0 0 4 &gpio0 8 IRQ_TYPE_LEVEL_LOW>, /* INT D on slot 1 is irq 8 */ + /* IDSEL 2 */ +- <0x1000 0 0 1 &gpio0 9 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 2 is irq 9 */ +- <0x1000 0 0 2 &gpio0 9 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 2 is irq 9 */ +- <0x1000 0 0 3 &gpio0 9 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 2 is irq 9 */ +- <0x1000 0 0 4 &gpio0 9 IRQ_TYPE_LEVEL_LOW>; /* INT D on slot 2 is irq 9 */ ++ <0x1000 0 0 1 &gpio0 10 IRQ_TYPE_LEVEL_LOW>, /* INT A on slot 2 is irq 10 */ ++ <0x1000 0 0 2 &gpio0 10 IRQ_TYPE_LEVEL_LOW>, /* INT B on slot 2 is irq 10 */ ++ <0x1000 0 0 3 &gpio0 10 IRQ_TYPE_LEVEL_LOW>, /* INT C on slot 2 is irq 10 */ ++ <0x1000 0 0 4 &gpio0 10 IRQ_TYPE_LEVEL_LOW>; /* INT D on slot 2 is irq 10 */ + }; + + ethernet@c8009000 { diff --git a/target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch b/target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch new file mode 100644 index 0000000000..ef4f21fa03 --- /dev/null +++ b/target/linux/ixp4xx/patches-6.6/0008-ARM-dts-ixp4xx-Add-Netgear-WG302-v1-GPIOs.patch @@ -0,0 +1,59 @@ +From 1d22f422fca8875f6d2cb297f735d41fd5830000 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Mon, 23 Dec 2024 17:50:52 +0100 +Subject: [PATCH] ARM: dts: ixp4xx: Add Netgear WG302 v1 GPIOs + +This adds GPIO LED indicators, the reset GPIO RESET +button on the Netgear WG302 v1 to the device tree. + +Signed-off-by: Linus Walleij +--- + .../ixp/intel-ixp42x-netgear-wg302v1.dts | 30 +++++++++++++++++++ + 1 file changed, 30 insertions(+) + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts +@@ -8,6 +8,7 @@ + + #include "intel-ixp42x.dtsi" + #include ++#include + + / { + model = "Netgear WG302 v1"; +@@ -32,6 +33,35 @@ + serial0 = &uart1; + }; + ++ leds { ++ compatible = "gpio-leds"; ++ test_led: led-test { ++ color = ; ++ function = "test"; ++ gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ }; ++ wlan_led: led-wlan { ++ color = ; ++ function = LED_FUNCTION_WLAN; ++ gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; ++ default-state = "off"; ++ linux,default-trigger = "phy0tx"; ++ }; ++ }; ++ ++ gpio_keys { ++ /* RESET is on GPIO13 which can't fire interrupts */ ++ compatible = "gpio-keys-polled"; ++ poll-interval = <100>; ++ ++ button-reset { ++ linux,code = ; ++ label = "reset"; ++ gpios = <&gpio0 13 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ + soc { + bus@c4000000 { + flash@0,0 { From 6e2a842d624ae5a6852232dc860a012c22db2bb9 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Fri, 20 Dec 2024 19:50:26 +0100 Subject: [PATCH 14/21] ixp4xx: Support sysupgrade on WG302 v1 The WG302 v1 have a separate rootfs partition that we simply just upgrade with a new rootfs image. The kernel need to be updated on the TFTP server. Signed-off-by: Linus Walleij --- .../ixp4xx/base-files/lib/upgrade/platform.sh | 27 +++++++++++++++++++ target/linux/ixp4xx/image/Makefile | 1 + 2 files changed, 28 insertions(+) create mode 100644 target/linux/ixp4xx/base-files/lib/upgrade/platform.sh diff --git a/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh b/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..869eab3214 --- /dev/null +++ b/target/linux/ixp4xx/base-files/lib/upgrade/platform.sh @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +REQUIRE_IMAGE_METADATA=1 + +platform_check_image() { + local board=$(board_name) + + case "$board" in + netgear,wg302v1) + return 0 + ;; + esac + + echo "Sysupgrade is not yet supported on $board." + return 1 +} + +platform_do_upgrade() { + local board=$(board_name) + + case "$board" in + netgear,wg302v1) + PART_NAME=rootfs + default_do_upgrade "$1" + ;; + esac +} diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index f1172ee123..d4b2e5b962 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -136,6 +136,7 @@ define Device/netgear_wg302v1 IMAGES := kernel.bin rootfs.bin IMAGE/kernel.bin := append-kernel IMAGE/rootfs.bin := append-rootfs | pad-rootfs | pad-to 128k + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | pad-to 128k | append-metadata endef TARGET_DEVICES += netgear_wg302v1 From d15da125eb14858ff68c33c0dcdf5aaeb7d3a004 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sat, 21 Dec 2024 00:59:27 +0100 Subject: [PATCH 15/21] ixp4xx: Support single zcom_npe_esa hw address Some ixp4xx platforms with a proper RedBoot config do not contain the per-ethernet interface npe_eth0_esa, but rather a single entry named zcom_npe_esa. Let's use this if fconfig can't find the primary key. This is needed on the Netgear WG302 v1. Signed-off-by: Linus Walleij --- .../ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx b/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx index 9e7ff46298..c58eb96f2a 100644 --- a/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx +++ b/target/linux/ixp4xx/base-files/lib/preinit/05_set_ether_mac_ixp4xx @@ -5,8 +5,12 @@ set_from_redboot () { for npe in eth0 eth1 eth2 do + mac="$(fconfig -s -r -d /dev/$1 -n npe_"$npe"_esa)" + if [ -z $mac ] ; then + mac="$(fconfig -s -r -d /dev/$1 -n zcom_npe_esa)" + fi if ip link show dev $npe > /dev/null 2>&1; then - ip link set dev $npe address $(fconfig -s -r -d /dev/$1 -n npe_"$npe"_esa) + ip link set dev $npe address $mac fi done From 804bc79ed03edc47fad4e60d42fe66c7070aa514 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 25 Dec 2024 01:11:00 +0100 Subject: [PATCH 16/21] ixp4xx: Add LEDs to supported devices This adds the OpenWrt-only LED aliases to the supported IXP4xx devices. Signed-off-by: Linus Walleij --- ...2-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch | 228 ++++++++++++++++++ 1 file changed, 228 insertions(+) create mode 100644 target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch diff --git a/target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch b/target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch new file mode 100644 index 0000000000..7fd1854a0e --- /dev/null +++ b/target/linux/ixp4xx/patches-6.6/302-ARM-dts-ixp4xx-OpenWrt-LED-aliases.patch @@ -0,0 +1,228 @@ +From d672011e10097e5e61659a5d64ac9cb7b7544b60 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Wed, 25 Dec 2024 01:09:20 +0100 +Subject: [PATCH] ARM: dts: ixp4xx OpenWrt LED aliases + +This outoftree patch adds OpenWrt LED aliases to the DTS files +of supported devices. + +Signed-off-by: Linus Walleij +--- + .../boot/dts/intel/ixp/intel-ixp42x-dlink-dsm-g600.dts | 9 ++++++--- + .../boot/dts/intel/ixp/intel-ixp42x-freecom-fsg-3.dts | 10 +++++++--- + .../dts/intel/ixp/intel-ixp42x-gateworks-gw2348.dts | 6 +++++- + .../boot/dts/intel/ixp/intel-ixp42x-iomega-nas100d.dts | 9 ++++++--- + .../boot/dts/intel/ixp/intel-ixp42x-linksys-nslu2.dts | 9 ++++++--- + .../dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts | 3 +++ + .../dts/intel/ixp/intel-ixp42x-usrobotics-usr8200.dts | 5 ++++- + .../dts/intel/ixp/intel-ixp43x-gateworks-gw2358.dts | 6 +++++- + 8 files changed, 42 insertions(+), 15 deletions(-) + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-dlink-dsm-g600.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-dlink-dsm-g600.dts +@@ -31,16 +31,19 @@ + }; + + aliases { ++ led-boot = &led_power; ++ led-failsafe = &led_power; ++ led-running = &led_power; ++ led-upgrade = &led_power; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-power { ++ led_power: led-power { + label = "dsmg600:green:power"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; + led-wlan { + label = "dsmg600:green:wlan"; +@@ -48,7 +51,7 @@ + gpios = <&gpio0 14 GPIO_ACTIVE_LOW>; + default-state = "on"; + /* We don't have WLAN trigger in the kernel (yet) */ +- linux,default-trigger = "netdev"; ++ linux,default-trigger = "phy0tx"; + }; + }; + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-freecom-fsg-3.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-freecom-fsg-3.dts +@@ -29,6 +29,10 @@ + }; + + aliases { ++ led-boot = &led_ring; ++ led-failsafe = &led_sync; ++ led-running = &led_ring; ++ led-upgrade = &led_sync; + serial0 = &uart0; + }; + +@@ -112,7 +116,7 @@ + reg = <0x00 0x02>; + mask = <0x01>; + label = "fsg:blue:wlan"; +- linux,default-trigger = "wlan"; ++ linux,default-trigger = "phy0tx"; + default-state = "on"; + }; + led@0,1 { +@@ -139,7 +143,7 @@ + linux,default-trigger = ""; + default-state = "on"; + }; +- led@0,4 { ++ led_sync: led@0,4 { + compatible = "register-bit-led"; + reg = <0x00 0x02>; + mask = <0x08>; +@@ -147,7 +151,7 @@ + linux,default-trigger = ""; + default-state = "on"; + }; +- led@0,5 { ++ led_ring: led@0,5 { + compatible = "register-bit-led"; + reg = <0x00 0x02>; + mask = <0x10>; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-gateworks-gw2348.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-gateworks-gw2348.dts +@@ -26,12 +26,16 @@ + }; + + aliases { ++ led-boot = &usr_led; ++ led-failsafe = &usr_led; ++ led-running = &usr_led; ++ led-upgrade = &usr_led; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-user { ++ usr_led: led-user { + label = "gw2348:green:user"; + gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + default-state = "on"; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-iomega-nas100d.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-iomega-nas100d.dts +@@ -26,6 +26,10 @@ + }; + + aliases { ++ led-boot = &pwr_led; ++ led-failsafe = &pwr_led; ++ led-running = &pwr_led; ++ led-upgrade = &pwr_led; + serial0 = &uart0; + }; + +@@ -36,7 +40,7 @@ + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; + /* We don't have WLAN trigger in the kernel (yet) */ +- linux,default-trigger = "netdev"; ++ linux,default-trigger = "phy0tx"; + }; + led-disk { + label = "nas100d:red:disk"; +@@ -44,11 +48,10 @@ + default-state = "on"; + linux,default-trigger = "disk-activity"; + }; +- led-power { ++ pwr_led: led-power { + label = "nas100d:red:power"; + gpios = <&gpio0 15 GPIO_ACTIVE_LOW>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; + }; + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-nslu2.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-linksys-nslu2.dts +@@ -26,18 +26,21 @@ + }; + + aliases { ++ led-boot = &led_status; ++ led-failsafe = &led_status; ++ led-running = &led_ready; ++ led-upgrade = &led_status; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-status { ++ led_status: led-status { + label = "nslu2:red:status"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; +- led-ready { ++ led_ready: led-ready { + label = "nslu2:green:ready"; + gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>; + default-state = "on"; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-netgear-wg302v1.dts +@@ -29,6 +29,9 @@ + }; + + aliases { ++ led-boot = &test_led; ++ led-failsafe = &test_led; ++ led-upgrade = &test_led; + /* These are switched around */ + serial0 = &uart1; + }; +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp42x-usrobotics-usr8200.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp42x-usrobotics-usr8200.dts +@@ -29,6 +29,10 @@ + }; + + aliases { ++ led-boot = &pwr_led; ++ led-failsafe = &pwr_led; ++ led-running = &pwr_led; ++ led-upgrade = &pwr_led; + /* These are switched around */ + serial0 = &uart1; + serial1 = &uart0; +@@ -67,7 +71,6 @@ + label = "usr8200:green:pwr"; + gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>; + default-state = "on"; +- linux,default-trigger = "heartbeat"; + }; + }; + +--- a/arch/arm/boot/dts/intel/ixp/intel-ixp43x-gateworks-gw2358.dts ++++ b/arch/arm/boot/dts/intel/ixp/intel-ixp43x-gateworks-gw2358.dts +@@ -25,12 +25,16 @@ + }; + + aliases { ++ led-boot = &usr_led; ++ led-failsafe = &usr_led; ++ led-running = &usr_led; ++ led-upgrade = &usr_led; + serial0 = &uart0; + }; + + leds { + compatible = "gpio-leds"; +- led-user { ++ usr_led: led-user { + label = "gw2358:green:LED"; + gpios = <&pld1 0 GPIO_ACTIVE_LOW>; + default-state = "on"; From 2456a2fd7f72d6afcee4ac9c2eccb312d0b1d36d Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Sat, 28 Dec 2024 00:13:37 +0100 Subject: [PATCH 17/21] ixp4xx: Break out mv88e6060 DSA switch to package Just one of the devices uses the Marvell MV88E6060 DSA switch so break this out from the generic kernel config and into a package selected only by that single device and probed at boot instead. The big win is from being able to drop the dsa_core (~600KB) kernel module out of the common kernel on devices with no DSA switch. Signed-off-by: Linus Walleij --- package/kernel/linux/modules/netdevices.mk | 17 +++++++++++++++++ target/linux/ixp4xx/config-6.6 | 3 --- target/linux/ixp4xx/image/Makefile | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/package/kernel/linux/modules/netdevices.mk b/package/kernel/linux/modules/netdevices.mk index c72bc0e8e6..097bea7f50 100644 --- a/package/kernel/linux/modules/netdevices.mk +++ b/package/kernel/linux/modules/netdevices.mk @@ -575,6 +575,23 @@ endef $(eval $(call KernelPackage,dsa-b53-mdio)) +define KernelPackage/dsa-mv88e6060 + SUBMENU:=$(NETWORK_DEVICES_MENU) + TITLE:=Marvell MV88E6060 DSA Switch + DEPENDS:=+kmod-dsa +kmod-phy-marvell + KCONFIG:=CONFIG_NET_DSA_TAG_TRAILER \ + CONFIG_NET_DSA_MV88E6060 + FILES:= \ + $(LINUX_DIR)/drivers/net/dsa/mv88e6060.ko \ + $(LINUX_DIR)/net/dsa/tag_trailer.ko + AUTOLOAD:=$(call AutoLoad,41,mv88e6060,1) +endef + +define KernelPackage/dsa-mv88e6060/description + Kernel modules for MV88E6060 DSA switches +endef + +$(eval $(call KernelPackage,dsa-mv88e6060)) define KernelPackage/dsa-tag-dsa SUBMENU:=$(NETWORK_DEVICES_MENU) diff --git a/target/linux/ixp4xx/config-6.6 b/target/linux/ixp4xx/config-6.6 index 84a72c8d5c..c0211c940b 100644 --- a/target/linux/ixp4xx/config-6.6 +++ b/target/linux/ixp4xx/config-6.6 @@ -168,9 +168,6 @@ CONFIG_NEED_DMA_MAP_STATE=y CONFIG_NEED_KUSER_HELPERS=y CONFIG_NEED_PER_CPU_KM=y CONFIG_NET_DEVLINK=y -CONFIG_NET_DSA=y -CONFIG_NET_DSA_MV88E6060=y -CONFIG_NET_DSA_TAG_TRAILER=y CONFIG_NET_EGRESS=y CONFIG_NET_INGRESS=y CONFIG_NET_PTP_CLASSIFY=y diff --git a/target/linux/ixp4xx/image/Makefile b/target/linux/ixp4xx/image/Makefile index d4b2e5b962..32a16fd135 100644 --- a/target/linux/ixp4xx/image/Makefile +++ b/target/linux/ixp4xx/image/Makefile @@ -144,7 +144,7 @@ define Device/usrobotics_usr8200 DEVICE_VENDOR := USRobotics DEVICE_MODEL := USR8200 # USB2 is compiled in and needs no package - DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-rtc-r7301 kmod-firewire kmod-firewire-ohci + DEVICE_PACKAGES := ixp4xx-microcode-ethernet kmod-rtc-r7301 kmod-firewire kmod-firewire-ohci kmod-dsa-mv88e6060 DEVICE_DTS := intel-ixp42x-usrobotics-usr8200 KERNEL := kernel-bin | append-dtb IMAGES := kernel.bin rootfs.bin From a3391d871d3f14f5de2081e23eda08986abc2b9b Mon Sep 17 00:00:00 2001 From: Sander Vanheule Date: Thu, 2 Jan 2025 09:31:44 +0100 Subject: [PATCH 18/21] realtek: drop extraneous ')' in 02_network The extraneous closing parenthesis inside the case matching breaks syntax of the network initialization script 02_network. /bin/board_detect: /etc/board.d/02_network: line 40: syntax error: unexpected newline (expecting ")") Remove this character so board init is functional again. Fixes: c8ea1aa970bf ("realtek: add support for HPE 1920-24G-PoE-370w") Signed-off-by: Sander Vanheule --- target/linux/realtek/base-files/etc/board.d/02_network | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network index a73944107a..12fb33d85e 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -36,7 +36,7 @@ hpe,1920-8g-poe-65w|\ hpe,1920-8g-poe-180w|\ hpe,1920-16g|\ hpe,1920-24g|\ -hpe,1920-24g-poe-370w|\) +hpe,1920-24g-poe-370w|\ hpe,1920-48g|\ hpe,1920-48g-poe) label_mac=$(mtd_get_mac_binary factory 0x68) From f0df6e3a4a4996eca917fa17591b8f1d483dfa30 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 2 Jan 2025 14:08:36 +0100 Subject: [PATCH 19/21] ubus: update to Git HEAD (2025-01-02) d996988ae55b libubus: close file descriptor after sending it from a request afa57cce0aff libubus: add support for using channels Signed-off-by: Felix Fietkau --- package/system/ubus/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index bef5e622d7..9a807852a2 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2024-10-20 -PKG_SOURCE_VERSION:=252a9b0c1774790fb9c25735d5a09c27dba895db -PKG_MIRROR_HASH:=72c21f02710d2314447670f1f1ea1833d2961f65fea3f9f94c060dda7c9d5914 +PKG_SOURCE_DATE:=2025-01-02 +PKG_SOURCE_VERSION:=afa57cce0aff82f4a7a0e509d4387ebc23dd3be7 +PKG_MIRROR_HASH:=a0b3c1961f5f49d31c34a44576ce44538c3ee97bfce97f86f732d7ecc1df9798 PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) CMAKE_INSTALL:=1 From 389dd8dcf6a21b608e6418ec48368f9615afa740 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Thu, 2 Jan 2025 00:47:14 -0800 Subject: [PATCH 20/21] strace: Update to version 6.12 Release Notes: https://github.com/strace/strace/releases/tag/v6.12 Signed-off-by: Tony Ambardar Link: https://github.com/openwrt/openwrt/pull/17457 Signed-off-by: Nick Hainke --- package/devel/strace/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/devel/strace/Makefile b/package/devel/strace/Makefile index f418bea5a7..892c05467e 100644 --- a/package/devel/strace/Makefile +++ b/package/devel/strace/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=strace -PKG_VERSION:=6.11 +PKG_VERSION:=6.12 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://strace.io/files/$(PKG_VERSION) -PKG_HASH:=83262583a3529f02c3501aa8b8ac772b4cbc03dc934e98bab6e4883626e283a5 +PKG_HASH:=c47da93be45b6055f4dc741d7f20efaf50ca10160a5b100c109b294fd9c0bdfe PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=LGPL-2.1-or-later From 89b2356b8c2fd420b49bacaa865fb9bd24173ecc Mon Sep 17 00:00:00 2001 From: John Audia Date: Thu, 2 Jan 2025 06:34:15 -0500 Subject: [PATCH 21/21] kernel: bump 6.6 to 6.6.69 Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.69 All patches automatically rebased. Build system: x86/64 Build-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Run-tested: bcm27xx/bcm2712, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3 Signed-off-by: John Audia Link: https://github.com/openwrt/openwrt/pull/17459 Signed-off-by: Nick Hainke --- include/kernel-6.6 | 4 ++-- ...dwc3-Set-DMA-and-coherent-masks-early.patch | 8 ++++---- ...chdog-mediatek-mt7988-add-wdt-support.patch | 18 +++++++++--------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/kernel-6.6 b/include/kernel-6.6 index c2805b4540..6cee9d1e8c 100644 --- a/include/kernel-6.6 +++ b/include/kernel-6.6 @@ -1,2 +1,2 @@ -LINUX_VERSION-6.6 = .68 -LINUX_KERNEL_HASH-6.6.68 = 283ff410e3f352ceed161ae30c0020301326059db03e86efcb384d46ac5840e2 +LINUX_VERSION-6.6 = .69 +LINUX_KERNEL_HASH-6.6.69 = 9c6305567b75d99514cde6eb9de39973f3d5c857a75bd9dcdfca57041f8d4f34 diff --git a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch index fe77f21211..551bfccc75 100644 --- a/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch +++ b/target/linux/bcm27xx/patches-6.6/950-0519-usb-dwc3-Set-DMA-and-coherent-masks-early.patch @@ -68,7 +68,7 @@ Signed-off-by: Jonathan Bell select SOC_BRCMSTB if ARCH_BRCMSTB --- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c +++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c -@@ -335,6 +335,36 @@ static void usb_init_common_7216(struct +@@ -341,6 +341,36 @@ static void usb_init_common_7216(struct usb_init_common(params); } @@ -105,7 +105,7 @@ Signed-off-by: Jonathan Bell static void usb_init_xhci(struct brcm_usb_init_params *params) { pr_debug("%s\n", __func__); -@@ -380,6 +410,18 @@ static void usb_uninit_common_7211b0(str +@@ -386,6 +416,18 @@ static void usb_uninit_common_7211b0(str } @@ -124,7 +124,7 @@ Signed-off-by: Jonathan Bell static void usb_uninit_xhci(struct brcm_usb_init_params *params) { -@@ -434,6 +476,16 @@ static const struct brcm_usb_init_ops bc +@@ -440,6 +482,16 @@ static const struct brcm_usb_init_ops bc .set_dual_select = usb_set_dual_select, }; @@ -141,7 +141,7 @@ Signed-off-by: Jonathan Bell void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params) { -@@ -451,3 +503,10 @@ void brcm_usb_dvr_init_7211b0(struct brc +@@ -457,3 +509,10 @@ void brcm_usb_dvr_init_7211b0(struct brc params->family_name = "7211"; params->ops = &bcm7211b0_ops; } diff --git a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch index c399b768b0..984034125c 100644 --- a/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch +++ b/target/linux/mediatek/patches-6.6/251-v6.8-watchdog-mediatek-mt7988-add-wdt-support.patch @@ -18,7 +18,7 @@ Signed-off-by: Wim Van Sebroeck --- a/drivers/watchdog/mtk_wdt.c +++ b/drivers/watchdog/mtk_wdt.c -@@ -58,9 +58,13 @@ +@@ -59,9 +59,13 @@ #define WDT_SWSYSRST 0x18U #define WDT_SWSYS_RST_KEY 0x88000000 @@ -32,7 +32,7 @@ Signed-off-by: Wim Van Sebroeck static bool nowayout = WATCHDOG_NOWAYOUT; static unsigned int timeout; -@@ -71,10 +75,12 @@ struct mtk_wdt_dev { +@@ -72,10 +76,12 @@ struct mtk_wdt_dev { struct reset_controller_dev rcdev; bool disable_wdt_extrst; bool reset_by_toprgu; @@ -45,7 +45,7 @@ Signed-off-by: Wim Van Sebroeck }; static const struct mtk_wdt_data mt2712_data = { -@@ -89,6 +95,11 @@ static const struct mtk_wdt_data mt7986_ +@@ -94,6 +100,11 @@ static const struct mtk_wdt_data mt7986_ .toprgu_sw_rst_num = MT7986_TOPRGU_SW_RST_NUM, }; @@ -57,7 +57,7 @@ Signed-off-by: Wim Van Sebroeck static const struct mtk_wdt_data mt8183_data = { .toprgu_sw_rst_num = MT8183_TOPRGU_SW_RST_NUM, }; -@@ -109,6 +120,28 @@ static const struct mtk_wdt_data mt8195_ +@@ -114,6 +125,28 @@ static const struct mtk_wdt_data mt8195_ .toprgu_sw_rst_num = MT8195_TOPRGU_SW_RST_NUM, }; @@ -86,7 +86,7 @@ Signed-off-by: Wim Van Sebroeck static int toprgu_reset_update(struct reset_controller_dev *rcdev, unsigned long id, bool assert) { -@@ -119,6 +152,9 @@ static int toprgu_reset_update(struct re +@@ -124,6 +157,9 @@ static int toprgu_reset_update(struct re spin_lock_irqsave(&data->lock, flags); @@ -96,7 +96,7 @@ Signed-off-by: Wim Van Sebroeck tmp = readl(data->wdt_base + WDT_SWSYSRST); if (assert) tmp |= BIT(id); -@@ -127,6 +163,9 @@ static int toprgu_reset_update(struct re +@@ -132,6 +168,9 @@ static int toprgu_reset_update(struct re tmp |= WDT_SWSYS_RST_KEY; writel(tmp, data->wdt_base + WDT_SWSYSRST); @@ -106,7 +106,7 @@ Signed-off-by: Wim Van Sebroeck spin_unlock_irqrestore(&data->lock, flags); return 0; -@@ -412,6 +451,8 @@ static int mtk_wdt_probe(struct platform +@@ -417,6 +456,8 @@ static int mtk_wdt_probe(struct platform wdt_data->toprgu_sw_rst_num); if (err) return err; @@ -115,8 +115,8 @@ Signed-off-by: Wim Van Sebroeck } mtk_wdt->disable_wdt_extrst = -@@ -450,6 +491,7 @@ static const struct of_device_id mtk_wdt - { .compatible = "mediatek,mt6589-wdt" }, +@@ -456,6 +497,7 @@ static const struct of_device_id mtk_wdt + { .compatible = "mediatek,mt6735-wdt", .data = &mt6735_data }, { .compatible = "mediatek,mt6795-wdt", .data = &mt6795_data }, { .compatible = "mediatek,mt7986-wdt", .data = &mt7986_data }, + { .compatible = "mediatek,mt7988-wdt", .data = &mt7988_data },