From: INAGAKI Hiroshi Date: Fri, 9 Sep 2022 16:15:22 +0000 (+0900) Subject: realtek: refresh patches in 5.15 X-Git-Tag: v23.05.0-rc1~1573 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=aa528eec7317cd43bf6a8b71d38df8494926798f;p=openwrt%2Fopenwrt.git realtek: refresh patches in 5.15 Adjust patches for kernel 5.15. Signed-off-by: INAGAKI Hiroshi --- diff --git a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch index 845441b425..d5737d1736 100644 --- a/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch +++ b/target/linux/realtek/patches-5.15/008-5.17-watchdog-add-realtek-otto-watchdog-timer.patch @@ -32,7 +32,7 @@ Signed-off-by: Guenter Roeck --- a/MAINTAINERS +++ b/MAINTAINERS -@@ -14816,6 +14816,13 @@ S: Maintained +@@ -15887,6 +15887,13 @@ S: Maintained F: include/sound/rt*.h F: sound/soc/codecs/rt* @@ -48,7 +48,7 @@ Signed-off-by: Guenter Roeck S: Maintained --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig -@@ -995,6 +995,19 @@ config RTD119X_WATCHDOG +@@ -954,6 +954,19 @@ config RTD119X_WATCHDOG Say Y here to include support for the watchdog timer in Realtek RTD1295 SoCs. @@ -70,7 +70,7 @@ Signed-off-by: Guenter Roeck depends on ARCH_SPRD || COMPILE_TEST --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile -@@ -174,6 +174,7 @@ obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o +@@ -171,6 +171,7 @@ obj-$(CONFIG_IMGPDC_WDT) += imgpdc_wdt.o obj-$(CONFIG_MT7621_WDT) += mt7621_wdt.o obj-$(CONFIG_PIC32_WDT) += pic32-wdt.o obj-$(CONFIG_PIC32_DMT) += pic32-dmt.o diff --git a/target/linux/realtek/patches-5.15/020-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch b/target/linux/realtek/patches-5.15/020-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch index ef2e225717..da33aaa72f 100644 --- a/target/linux/realtek/patches-5.15/020-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch +++ b/target/linux/realtek/patches-5.15/020-v5.17-net-mdio-add-helpers-to-extract-clause-45-regad-and-.patch @@ -34,7 +34,7 @@ Signed-off-by: David S. Miller #define MII_REGADDR_C45_MASK GENMASK(15, 0) struct gpio_desc; -@@ -342,6 +344,16 @@ static inline u32 mdiobus_c45_addr(int d +@@ -355,6 +357,16 @@ static inline u32 mdiobus_c45_addr(int d return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum; } diff --git a/target/linux/realtek/patches-5.15/021-v5.19-02-gpio-realtek-otto-Support-reversed-port-layouts.patch b/target/linux/realtek/patches-5.15/021-v5.19-02-gpio-realtek-otto-Support-reversed-port-layouts.patch index 8f35351438..437e7862d9 100644 --- a/target/linux/realtek/patches-5.15/021-v5.19-02-gpio-realtek-otto-Support-reversed-port-layouts.patch +++ b/target/linux/realtek/patches-5.15/021-v5.19-02-gpio-realtek-otto-Support-reversed-port-layouts.patch @@ -91,7 +91,7 @@ Signed-off-by: Bartosz Golaszewski } /* Set the rising and falling edge mask bits for a GPIO port pin */ -@@ -253,6 +289,7 @@ MODULE_DEVICE_TABLE(of, realtek_gpio_of_ +@@ -250,6 +286,7 @@ MODULE_DEVICE_TABLE(of, realtek_gpio_of_ static int realtek_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -99,7 +99,7 @@ Signed-off-by: Bartosz Golaszewski unsigned int dev_flags; struct gpio_irq_chip *girq; struct realtek_gpio_ctrl *ctrl; -@@ -280,10 +317,20 @@ static int realtek_gpio_probe(struct pla +@@ -277,10 +314,20 @@ static int realtek_gpio_probe(struct pla raw_spin_lock_init(&ctrl->lock); diff --git a/target/linux/realtek/patches-5.15/021-v5.19-03-gpio-realtek-otto-Support-per-cpu-interrupts.patch b/target/linux/realtek/patches-5.15/021-v5.19-03-gpio-realtek-otto-Support-per-cpu-interrupts.patch index 8f5d571ea2..b632095c36 100644 --- a/target/linux/realtek/patches-5.15/021-v5.19-03-gpio-realtek-otto-Support-per-cpu-interrupts.patch +++ b/target/linux/realtek/patches-5.15/021-v5.19-03-gpio-realtek-otto-Support-per-cpu-interrupts.patch @@ -47,7 +47,7 @@ Signed-off-by: Bartosz Golaszewski }; static struct realtek_gpio_ctrl *irq_data_to_ctrl(struct irq_data *data) -@@ -250,14 +258,61 @@ static void realtek_gpio_irq_handler(str +@@ -247,14 +255,61 @@ static void realtek_gpio_irq_handler(str chained_irq_exit(irq_chip, desc); } @@ -109,7 +109,7 @@ Signed-off-by: Bartosz Golaszewski } return 0; -@@ -269,6 +324,7 @@ static struct irq_chip realtek_gpio_irq_ +@@ -266,6 +321,7 @@ static struct irq_chip realtek_gpio_irq_ .irq_mask = realtek_gpio_irq_mask, .irq_unmask = realtek_gpio_irq_unmask, .irq_set_type = realtek_gpio_irq_set_type, @@ -117,7 +117,7 @@ Signed-off-by: Bartosz Golaszewski }; static const struct of_device_id realtek_gpio_of_match[] = { -@@ -293,8 +349,10 @@ static int realtek_gpio_probe(struct pla +@@ -290,8 +346,10 @@ static int realtek_gpio_probe(struct pla unsigned int dev_flags; struct gpio_irq_chip *girq; struct realtek_gpio_ctrl *ctrl; @@ -129,7 +129,7 @@ Signed-off-by: Bartosz Golaszewski ctrl = devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); if (!ctrl) -@@ -355,6 +413,21 @@ static int realtek_gpio_probe(struct pla +@@ -352,6 +410,21 @@ static int realtek_gpio_probe(struct pla girq->init_hw = realtek_gpio_irq_init; } diff --git a/target/linux/realtek/patches-5.15/021-v5.19-04-gpio-realtek-otto-Add-RTL930x-support.patch b/target/linux/realtek/patches-5.15/021-v5.19-04-gpio-realtek-otto-Add-RTL930x-support.patch index 536c85740a..9b25803138 100644 --- a/target/linux/realtek/patches-5.15/021-v5.19-04-gpio-realtek-otto-Add-RTL930x-support.patch +++ b/target/linux/realtek/patches-5.15/021-v5.19-04-gpio-realtek-otto-Add-RTL930x-support.patch @@ -16,7 +16,7 @@ Signed-off-by: Bartosz Golaszewski --- a/drivers/gpio/gpio-realtek-otto.c +++ b/drivers/gpio/gpio-realtek-otto.c -@@ -338,6 +338,10 @@ static const struct of_device_id realtek +@@ -335,6 +335,10 @@ static const struct of_device_id realtek { .compatible = "realtek,rtl8390-gpio", }, diff --git a/target/linux/realtek/patches-5.15/021-v5.19-06-gpio-realtek-otto-Add-RTL931x-support.patch b/target/linux/realtek/patches-5.15/021-v5.19-06-gpio-realtek-otto-Add-RTL931x-support.patch index 16990ce053..810856eb89 100644 --- a/target/linux/realtek/patches-5.15/021-v5.19-06-gpio-realtek-otto-Add-RTL931x-support.patch +++ b/target/linux/realtek/patches-5.15/021-v5.19-06-gpio-realtek-otto-Add-RTL931x-support.patch @@ -18,7 +18,7 @@ Signed-off-by: Bartosz Golaszewski --- a/drivers/gpio/gpio-realtek-otto.c +++ b/drivers/gpio/gpio-realtek-otto.c -@@ -342,6 +342,9 @@ static const struct of_device_id realtek +@@ -339,6 +339,9 @@ static const struct of_device_id realtek .compatible = "realtek,rtl9300-gpio", .data = (void *)(GPIO_PORTS_REVERSED | GPIO_INTERRUPTS_PER_CPU) }, diff --git a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch index 3834ba7c61..3929096888 100644 --- a/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-5.15/300-mips-add-rtl838x-platform.patch @@ -15,8 +15,8 @@ Submitted-by: Birger Koblitz --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms -@@ -23,6 +23,7 @@ platform-$(CONFIG_PIC32MZDA) += pic32/ - platform-$(CONFIG_MACH_PISTACHIO) += pistachio/ +@@ -23,6 +23,7 @@ platform-$(CONFIG_NLM_COMMON) += netlog + platform-$(CONFIG_PIC32MZDA) += pic32/ platform-$(CONFIG_RALINK) += ralink/ platform-$(CONFIG_MIKROTIK_RB532) += rb532/ +platform-$(CONFIG_RTL83XX) += rtl838x/ @@ -25,7 +25,7 @@ Submitted-by: Birger Koblitz platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -1037,8 +1037,58 @@ config NLM_XLP_BOARD +@@ -1053,8 +1053,58 @@ config NLM_XLP_BOARD This board is based on Netlogic XLP Processor. Say Y here if you have a XLP based board. @@ -84,7 +84,7 @@ Submitted-by: Birger Koblitz source "arch/mips/alchemy/Kconfig" source "arch/mips/ath25/Kconfig" source "arch/mips/ath79/Kconfig" -@@ -1097,6 +1147,9 @@ config CEVT_GT641XX +@@ -1112,6 +1162,9 @@ config CEVT_GT641XX config CEVT_R4K bool diff --git a/target/linux/realtek/patches-5.15/301-gpio-add-rtl8231-driver.patch b/target/linux/realtek/patches-5.15/301-gpio-add-rtl8231-driver.patch index 2725651243..7603a03744 100644 --- a/target/linux/realtek/patches-5.15/301-gpio-add-rtl8231-driver.patch +++ b/target/linux/realtek/patches-5.15/301-gpio-add-rtl8231-driver.patch @@ -25,9 +25,9 @@ Submitted-by: John Crispin --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -508,6 +508,12 @@ config GPIO_REG - A 32-bit single register GPIO fixed in/out implementation. This - can be used to represent any register as a set of GPIO signals. +@@ -529,6 +529,12 @@ config GPIO_ROCKCHIP + help + Say yes here to support GPIO on Rockchip SoCs. +config GPIO_RTL8231 + tristate "RTL8231 GPIO" @@ -40,10 +40,10 @@ Submitted-by: John Crispin depends on MFD_SYSCON --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile -@@ -127,6 +127,7 @@ obj-$(CONFIG_GPIO_RDA) += gpio-rda.o - obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o +@@ -129,6 +129,7 @@ obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc3 obj-$(CONFIG_GPIO_REALTEK_OTTO) += gpio-realtek-otto.o obj-$(CONFIG_GPIO_REG) += gpio-reg.o + obj-$(CONFIG_GPIO_ROCKCHIP) += gpio-rockchip.o +obj-$(CONFIG_GPIO_RTL8231) += gpio-rtl8231.o obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o diff --git a/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch b/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch index 8b17ddaef0..fb1f464356 100644 --- a/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch +++ b/target/linux/realtek/patches-5.15/302-clocksource-add-otto-driver.patch @@ -20,7 +20,7 @@ depends on HAS_IOMEM --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile -@@ -63,6 +63,7 @@ obj-$(CONFIG_MILBEAUT_TIMER) += timer-mi +@@ -58,6 +58,7 @@ obj-$(CONFIG_MILBEAUT_TIMER) += timer-mi obj-$(CONFIG_SPRD_TIMER) += timer-sprd.o obj-$(CONFIG_NPCM7XX_TIMER) += timer-npcm7xx.o obj-$(CONFIG_RDA_TIMER) += timer-rda.o @@ -30,7 +30,7 @@ obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h -@@ -133,6 +133,7 @@ enum cpuhp_state { +@@ -177,6 +177,7 @@ enum cpuhp_state { CPUHP_AP_MARCO_TIMER_STARTING, CPUHP_AP_MIPS_GIC_TIMER_STARTING, CPUHP_AP_ARC_TIMER_STARTING, diff --git a/target/linux/realtek/patches-5.15/303-gpio-update-dependencies-for-gpio-realtek-otto.patch b/target/linux/realtek/patches-5.15/303-gpio-update-dependencies-for-gpio-realtek-otto.patch index 5f0986b905..beaddcb58e 100644 --- a/target/linux/realtek/patches-5.15/303-gpio-update-dependencies-for-gpio-realtek-otto.patch +++ b/target/linux/realtek/patches-5.15/303-gpio-update-dependencies-for-gpio-realtek-otto.patch @@ -13,7 +13,7 @@ Submitted-by: INAGAKI Hiroshi 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig -@@ -491,8 +491,8 @@ config GPIO_RDA +@@ -503,8 +503,8 @@ config GPIO_RDA config GPIO_REALTEK_OTTO tristate "Realtek Otto GPIO support" diff --git a/target/linux/realtek/patches-5.15/304-spi-update-dependency-for-spi-realtek-rtl.patch b/target/linux/realtek/patches-5.15/304-spi-update-dependency-for-spi-realtek-rtl.patch index 23c5448aa2..f2b57bacde 100644 --- a/target/linux/realtek/patches-5.15/304-spi-update-dependency-for-spi-realtek-rtl.patch +++ b/target/linux/realtek/patches-5.15/304-spi-update-dependency-for-spi-realtek-rtl.patch @@ -14,9 +14,9 @@ Submitted-by: INAGAKI Hiroshi --- a/drivers/spi/Makefile +++ b/drivers/spi/Makefile -@@ -94,7 +94,7 @@ obj-$(CONFIG_SPI_QCOM_QSPI) += spi-qcom - obj-$(CONFIG_SPI_QUP) += spi-qup.o +@@ -97,7 +97,7 @@ obj-$(CONFIG_SPI_QUP) += spi-qup.o obj-$(CONFIG_SPI_ROCKCHIP) += spi-rockchip.o + obj-$(CONFIG_SPI_ROCKCHIP_SFC) += spi-rockchip-sfc.o obj-$(CONFIG_SPI_RB4XX) += spi-rb4xx.o -obj-$(CONFIG_MACH_REALTEK_RTL) += spi-realtek-rtl.o +obj-$(CONFIG_RTL83XX) += spi-realtek-rtl.o diff --git a/target/linux/realtek/patches-5.15/305-irqchip-update-dependency-for-irq-realtek-rtl.patch b/target/linux/realtek/patches-5.15/305-irqchip-update-dependency-for-irq-realtek-rtl.patch index 0c1cc4235e..a94a3ff8ac 100644 --- a/target/linux/realtek/patches-5.15/305-irqchip-update-dependency-for-irq-realtek-rtl.patch +++ b/target/linux/realtek/patches-5.15/305-irqchip-update-dependency-for-irq-realtek-rtl.patch @@ -14,9 +14,12 @@ Submitted-by: INAGAKI Hiroshi --- a/drivers/irqchip/Makefile +++ b/drivers/irqchip/Makefile -@@ -114,4 +114,4 @@ obj-$(CONFIG_LOONGSON_PCH_PIC) += irq-l +@@ -112,7 +112,7 @@ obj-$(CONFIG_LOONGSON_PCH_PIC) += irq-l obj-$(CONFIG_LOONGSON_PCH_MSI) += irq-loongson-pch-msi.o obj-$(CONFIG_MST_IRQ) += irq-mst-intc.o obj-$(CONFIG_SL28CPLD_INTC) += irq-sl28cpld.o -obj-$(CONFIG_MACH_REALTEK_RTL) += irq-realtek-rtl.o +obj-$(CONFIG_RTL83XX) += irq-realtek-rtl.o + obj-$(CONFIG_WPCM450_AIC) += irq-wpcm450-aic.o + obj-$(CONFIG_IRQ_IDT3243X) += irq-idt3243x.o + obj-$(CONFIG_APPLE_AIC) += irq-apple-aic.o diff --git a/target/linux/realtek/patches-5.15/307-wdt-update-dependency-for-realtek-otto-wdt.patch b/target/linux/realtek/patches-5.15/307-wdt-update-dependency-for-realtek-otto-wdt.patch index f92981340b..b44aebea12 100644 --- a/target/linux/realtek/patches-5.15/307-wdt-update-dependency-for-realtek-otto-wdt.patch +++ b/target/linux/realtek/patches-5.15/307-wdt-update-dependency-for-realtek-otto-wdt.patch @@ -17,7 +17,7 @@ Tested-by: Stijn Tintel --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig -@@ -997,10 +997,10 @@ config RTD119X_WATCHDOG +@@ -956,10 +956,10 @@ config RTD119X_WATCHDOG config REALTEK_OTTO_WDT tristate "Realtek Otto MIPS watchdog support" diff --git a/target/linux/realtek/patches-5.15/310-add-i2c-rtl9300-support.patch b/target/linux/realtek/patches-5.15/310-add-i2c-rtl9300-support.patch index 4df9bf043b..2125aea77f 100644 --- a/target/linux/realtek/patches-5.15/310-add-i2c-rtl9300-support.patch +++ b/target/linux/realtek/patches-5.15/310-add-i2c-rtl9300-support.patch @@ -17,7 +17,7 @@ Submitted-by: Birger Koblitz --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig -@@ -954,6 +954,16 @@ config I2C_RK3X +@@ -949,6 +949,16 @@ config I2C_RK3X This driver can also be built as a module. If so, the module will be called i2c-rk3x. @@ -36,7 +36,7 @@ Submitted-by: Birger Koblitz help --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile -@@ -95,6 +95,7 @@ obj-$(CONFIG_I2C_QCOM_GENI) += i2c-qcom- +@@ -94,6 +94,7 @@ obj-$(CONFIG_I2C_QCOM_GENI) += i2c-qcom- obj-$(CONFIG_I2C_QUP) += i2c-qup.o obj-$(CONFIG_I2C_RIIC) += i2c-riic.o obj-$(CONFIG_I2C_RK3X) += i2c-rk3x.o diff --git a/target/linux/realtek/patches-5.15/312-rt9313-support.patch b/target/linux/realtek/patches-5.15/312-rt9313-support.patch index 516bca2b6e..67f5580cd6 100644 --- a/target/linux/realtek/patches-5.15/312-rt9313-support.patch +++ b/target/linux/realtek/patches-5.15/312-rt9313-support.patch @@ -16,7 +16,7 @@ Submitted-by: Birger Koblitz --- a/arch/mips/Makefile +++ b/arch/mips/Makefile -@@ -307,14 +307,24 @@ endif +@@ -310,14 +310,24 @@ endif KBUILD_AFLAGS += $(cflags-y) KBUILD_CFLAGS += $(cflags-y) diff --git a/target/linux/realtek/patches-5.15/315-irqchip-irq-realtek-rtl-add-VPE-support.patch b/target/linux/realtek/patches-5.15/315-irqchip-irq-realtek-rtl-add-VPE-support.patch index 26c36302c2..102c9850ce 100644 --- a/target/linux/realtek/patches-5.15/315-irqchip-irq-realtek-rtl-add-VPE-support.patch +++ b/target/linux/realtek/patches-5.15/315-irqchip-irq-realtek-rtl-add-VPE-support.patch @@ -83,7 +83,7 @@ Submitted-by: Birger Koblitz raw_spin_unlock_irqrestore(&irq_lock, flags); } -@@ -44,137 +86,247 @@ static void realtek_ictl_mask_irq(struct +@@ -44,52 +86,137 @@ static void realtek_ictl_mask_irq(struct { unsigned long flags; u32 value; @@ -144,19 +144,18 @@ Submitted-by: Birger Koblitz static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw) { -- irq_set_chip_and_handler(hw, &realtek_ictl_irq, handle_level_irq); + struct realtek_ictl_output *output = d->host_data; + unsigned long flags; + -+ irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq); -+ + irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq); + + raw_spin_lock_irqsave(&irq_lock, flags); + + output->child_mask |= BIT(hw); + write_irr(REG(RTL_ICTL_IRR0, 0), hw, output->output_index + 1); + + raw_spin_unlock_irqrestore(&irq_lock, flags); - ++ return 0; } @@ -208,37 +207,32 @@ Submitted-by: Birger Koblitz + struct realtek_ictl_output *output = irq_desc_get_handler_data(desc); struct irq_chip *chip = irq_desc_get_chip(desc); - struct irq_domain *domain; -- unsigned int pending; + int cpu = smp_processor_id(); -+ unsigned long pending; -+ unsigned int soc_int; + unsigned long pending; + unsigned int soc_int; chained_irq_enter(chip, desc); - pending = readl(REG(RTL_ICTL_GIMR)) & readl(REG(RTL_ICTL_GISR)); + pending = readl(REG(RTL_ICTL_GIMR, cpu)) & readl(REG(RTL_ICTL_GISR, cpu)) + & output->child_mask; -+ + if (unlikely(!pending)) { spurious_interrupt(); goto out; } + - domain = irq_desc_get_handler_data(desc); -- generic_handle_irq(irq_find_mapping(domain, __ffs(pending))); -+ +- for_each_set_bit(soc_int, &pending, 32) +- generic_handle_domain_irq(domain, soc_int); + for_each_set_bit(soc_int, &pending, RTL_ICTL_NUM_INPUTS) -+ generic_handle_irq(irq_find_mapping(output->domain, soc_int)); -+// generic_handle_domain_irq(output->domain, soc_int); ++ generic_handle_domain_irq(output->domain, soc_int); out: chained_irq_exit(chip, desc); - } - --/* -- * SoC interrupts are cascaded to MIPS CPU interrupts according to the -- * interrupt-map in the device tree. Each SoC interrupt gets 4 bits for -- * the CPU interrupt in an Interrupt Routing Register. Max 32 SoC interrupts -- * thus go into 4 IRRs. -- */ +@@ -102,85 +229,110 @@ out: + * thus go into 4 IRRs. A routing value of '0' means the interrupt is left + * disconnected. Routing values {1..15} connect to output lines {0..14}. + */ -static int __init map_interrupts(struct device_node *node, struct irq_domain *domain) +static int __init setup_parent_interrupts(struct device_node *node, int *parents, + unsigned int num_parents) @@ -282,12 +276,12 @@ Submitted-by: Birger Koblitz - if (!cpu_ictl) - return -EINVAL; - ret = of_property_read_u32(cpu_ictl, "#interrupt-cells", &tmp); +- of_node_put(cpu_ictl); - if (ret || tmp != 1) - return -EINVAL; -- of_node_put(cpu_ictl); - - cpu_int = be32_to_cpup(imap + 2); -- if (cpu_int > 7) +- if (cpu_int > 7 || cpu_int < 2) - return -EINVAL; - - if (!(mips_irqs_set & BIT(cpu_int))) { @@ -299,7 +293,8 @@ Submitted-by: Birger Koblitz + if (!domain) + goto domain_err; -- regs[(soc_int * 4) / 32] |= cpu_int << (soc_int * 4) % 32; +- /* Use routing values (1..6) for CPU interrupts (2..7) */ +- regs[(soc_int * 4) / 32] |= (cpu_int - 1) << (soc_int * 4) % 32; - imap += 3; - } + output->fwnode = of_node_to_fwnode(node); diff --git a/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch b/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch index 3980875dd4..a13d70d633 100644 --- a/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch +++ b/target/linux/realtek/patches-5.15/316-otto-gpio-uniprocessor-irq-mask.patch @@ -22,7 +22,7 @@ Submitted-by: Sander Vanheule --- a/drivers/gpio/gpio-realtek-otto.c +++ b/drivers/gpio/gpio-realtek-otto.c -@@ -304,6 +304,7 @@ static int realtek_gpio_irq_set_affinity +@@ -301,6 +301,7 @@ static int realtek_gpio_irq_set_affinity static int realtek_gpio_irq_init(struct gpio_chip *gc) { struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); @@ -30,7 +30,7 @@ Submitted-by: Sander Vanheule unsigned int port; int cpu; -@@ -311,8 +312,16 @@ static int realtek_gpio_irq_init(struct +@@ -308,8 +309,16 @@ static int realtek_gpio_irq_init(struct realtek_gpio_write_imr(ctrl, port, 0, 0); realtek_gpio_clear_isr(ctrl, port, GENMASK(7, 0)); diff --git a/target/linux/realtek/patches-5.15/317-gpio-realtek-otto-switch-to-32-bit-I-O.patch b/target/linux/realtek/patches-5.15/317-gpio-realtek-otto-switch-to-32-bit-I-O.patch index 9c043b7126..9f2c3b50b6 100644 --- a/target/linux/realtek/patches-5.15/317-gpio-realtek-otto-switch-to-32-bit-I-O.patch +++ b/target/linux/realtek/patches-5.15/317-gpio-realtek-otto-switch-to-32-bit-I-O.patch @@ -30,7 +30,6 @@ Signed-off-by: Bartosz Golaszewski Update patch for missing upstream changes: - commit a01a40e33499 ("gpio: realtek-otto: Make the irqchip immutable") - - commit dbd1c54fc820 ("gpio: Bulk conversion to generic_handle_domain_irq()") Signed-off-by: Sander Vanheule --- @@ -241,13 +240,12 @@ Signed-off-by: Sander Vanheule raw_spin_unlock_irqrestore(&ctrl->lock, flags); return 0; -@@ -238,31 +248,24 @@ static void realtek_gpio_irq_handler(str +@@ -238,28 +248,21 @@ static void realtek_gpio_irq_handler(str struct gpio_chip *gc = irq_desc_get_handler_data(desc); struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); struct irq_chip *irq_chip = irq_desc_get_chip(desc); - unsigned int lines_done; - unsigned int port_pin_count; - unsigned int irq; unsigned long status; int offset; @@ -256,15 +254,12 @@ Signed-off-by: Sander Vanheule - for (lines_done = 0; lines_done < gc->ngpio; lines_done += 8) { - status = realtek_gpio_read_isr(ctrl, lines_done / 8); - port_pin_count = min(gc->ngpio - lines_done, 8U); -- for_each_set_bit(offset, &status, port_pin_count) { -- irq = irq_find_mapping(gc->irq.domain, offset + lines_done); -- generic_handle_irq(irq); -- } +- for_each_set_bit(offset, &status, port_pin_count) +- generic_handle_domain_irq(gc->irq.domain, offset + lines_done); +- } + status = realtek_gpio_read_isr(ctrl); -+ for_each_set_bit(offset, &status, gc->ngpio) { -+ irq = irq_find_mapping(gc->irq.domain, offset); -+ generic_handle_irq(irq); - } ++ for_each_set_bit(offset, &status, gc->ngpio) ++ generic_handle_domain_irq(gc->irq.domain, offset); chained_irq_exit(irq_chip, desc); } @@ -279,7 +274,7 @@ Signed-off-by: Sander Vanheule } static int realtek_gpio_irq_set_affinity(struct irq_data *data, -@@ -270,12 +273,10 @@ static int realtek_gpio_irq_set_affinity +@@ -267,12 +270,10 @@ static int realtek_gpio_irq_set_affinity { struct realtek_gpio_ctrl *ctrl = irq_data_to_ctrl(data); unsigned int line = irqd_to_hwirq(data); @@ -293,7 +288,7 @@ Signed-off-by: Sander Vanheule if (!ctrl->cpumask_base) return -ENXIO; -@@ -283,15 +284,15 @@ static int realtek_gpio_irq_set_affinity +@@ -280,15 +281,15 @@ static int realtek_gpio_irq_set_affinity raw_spin_lock_irqsave(&ctrl->lock, flags); for_each_cpu(cpu, &ctrl->cpu_irq_maskable) { @@ -314,7 +309,7 @@ Signed-off-by: Sander Vanheule } raw_spin_unlock_irqrestore(&ctrl->lock, flags); -@@ -305,22 +306,23 @@ static int realtek_gpio_irq_init(struct +@@ -302,22 +303,23 @@ static int realtek_gpio_irq_init(struct { struct realtek_gpio_ctrl *ctrl = gpiochip_get_data(gc); void __iomem *irq_cpu_mask; @@ -352,7 +347,7 @@ Signed-off-by: Sander Vanheule } } -@@ -393,12 +395,14 @@ static int realtek_gpio_probe(struct pla +@@ -390,12 +392,14 @@ static int realtek_gpio_probe(struct pla if (dev_flags & GPIO_PORTS_REVERSED) { bgpio_flags = 0; diff --git a/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch b/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch index 94c4230835..c63c165cd2 100644 --- a/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch +++ b/target/linux/realtek/patches-5.15/318-add-rtl83xx-clk-support.patch @@ -13,20 +13,20 @@ Submitted-by: Markus Stockhausen --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig -@@ -372,6 +372,7 @@ source "drivers/clk/mediatek/Kconfig" - source "drivers/clk/meson/Kconfig" +@@ -405,6 +405,7 @@ source "drivers/clk/mstar/Kconfig" source "drivers/clk/mvebu/Kconfig" + source "drivers/clk/pistachio/Kconfig" source "drivers/clk/qcom/Kconfig" +source "drivers/clk/realtek/Kconfig" + source "drivers/clk/ralink/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/rockchip/Kconfig" - source "drivers/clk/samsung/Kconfig" --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile -@@ -100,6 +100,7 @@ obj-$(CONFIG_COMMON_CLK_NXP) += nxp/ - obj-$(CONFIG_MACH_PISTACHIO) += pistachio/ +@@ -101,6 +101,7 @@ obj-$(CONFIG_COMMON_CLK_PISTACHIO) += pi obj-$(CONFIG_COMMON_CLK_PXA) += pxa/ obj-$(CONFIG_COMMON_CLK_QCOM) += qcom/ + obj-y += ralink/ +obj-$(CONFIG_COMMON_CLK_REALTEK) += realtek/ obj-y += renesas/ obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/ diff --git a/target/linux/realtek/patches-5.15/319-irqchip-irq-realtek-rtl-fix-VPE-affinity.patch b/target/linux/realtek/patches-5.15/319-irqchip-irq-realtek-rtl-fix-VPE-affinity.patch index bb95e7103a..0c29b7739e 100644 --- a/target/linux/realtek/patches-5.15/319-irqchip-irq-realtek-rtl-fix-VPE-affinity.patch +++ b/target/linux/realtek/patches-5.15/319-irqchip-irq-realtek-rtl-fix-VPE-affinity.patch @@ -143,7 +143,7 @@ Submitted-by: INAGAKI Hiroshi raw_spin_unlock_irqrestore(&irq_lock, flags); -@@ -279,9 +315,11 @@ static int __init realtek_rtl_of_init(st +@@ -285,9 +321,11 @@ static int __init realtek_rtl_of_init(st cpumask_set_cpu(cpu, &realtek_ictl_cpu_configurable); /* Disable all cascaded interrupts and clear routing */ diff --git a/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch b/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch index f97ea94d9b..71724034d4 100644 --- a/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch +++ b/target/linux/realtek/patches-5.15/700-net-dsa-add-support-for-rtl838x-switch.patch @@ -22,19 +22,21 @@ Submitted-by: John Crispin --- a/drivers/net/dsa/Kconfig +++ b/drivers/net/dsa/Kconfig -@@ -68,6 +68,8 @@ config NET_DSA_QCA8K - This enables support for the Qualcomm Atheros QCA8K Ethernet - switch chips. +@@ -60,6 +60,8 @@ source "drivers/net/dsa/sja1105/Kconfig" + + source "drivers/net/dsa/xrs700x/Kconfig" +source "drivers/net/dsa/rtl83xx/Kconfig" + config NET_DSA_REALTEK_SMI tristate "Realtek SMI Ethernet switch family support" - depends on NET_DSA + select NET_DSA_TAG_RTL4_A --- a/drivers/net/dsa/Makefile +++ b/drivers/net/dsa/Makefile -@@ -23,3 +23,4 @@ obj-y += mv88e6xxx/ +@@ -22,5 +22,6 @@ obj-y += microchip/ + obj-y += mv88e6xxx/ obj-y += ocelot/ obj-y += qca/ - obj-y += sja1105/ +obj-y += rtl83xx/ + obj-y += sja1105/ + obj-y += xrs700x/ diff --git a/target/linux/realtek/patches-5.15/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch b/target/linux/realtek/patches-5.15/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch index 27299f17de..0cb784fcbf 100644 --- a/target/linux/realtek/patches-5.15/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch +++ b/target/linux/realtek/patches-5.15/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch @@ -34,7 +34,7 @@ Submitted-by: John Crispin trailer[2] = 0x10; trailer[3] = 0x00; -@@ -34,12 +39,23 @@ static struct sk_buff *trailer_rcv(struc +@@ -33,12 +38,23 @@ static struct sk_buff *trailer_rcv(struc return NULL; trailer = skb_tail_pointer(skb) - 4; diff --git a/target/linux/realtek/patches-5.15/702-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/realtek/patches-5.15/702-net-ethernet-add-support-for-rtl838x-ethernet.patch index 9f50e8b564..1c25c42b91 100644 --- a/target/linux/realtek/patches-5.15/702-net-ethernet-add-support-for-rtl838x-ethernet.patch +++ b/target/linux/realtek/patches-5.15/702-net-ethernet-add-support-for-rtl838x-ethernet.patch @@ -22,7 +22,7 @@ Submitted-by: John Crispin --- a/drivers/net/ethernet/Kconfig +++ b/drivers/net/ethernet/Kconfig -@@ -163,6 +163,13 @@ source "drivers/net/ethernet/rdc/Kconfig +@@ -166,6 +166,13 @@ source "drivers/net/ethernet/rdc/Kconfig source "drivers/net/ethernet/realtek/Kconfig" source "drivers/net/ethernet/renesas/Kconfig" source "drivers/net/ethernet/rocker/Kconfig" @@ -35,10 +35,10 @@ Submitted-by: John Crispin + source "drivers/net/ethernet/samsung/Kconfig" source "drivers/net/ethernet/seeq/Kconfig" - source "drivers/net/ethernet/sfc/Kconfig" + source "drivers/net/ethernet/sgi/Kconfig" --- a/drivers/net/ethernet/Makefile +++ b/drivers/net/ethernet/Makefile -@@ -75,6 +75,7 @@ obj-$(CONFIG_NET_VENDOR_REALTEK) += real +@@ -77,6 +77,7 @@ obj-$(CONFIG_NET_VENDOR_REALTEK) += real obj-$(CONFIG_NET_VENDOR_RENESAS) += renesas/ obj-$(CONFIG_NET_VENDOR_RDC) += rdc/ obj-$(CONFIG_NET_VENDOR_ROCKER) += rocker/ diff --git a/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch index 8f68dd4e88..c4594980a9 100644 --- a/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/703-include-linux-add-phy-ops-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -885,6 +885,10 @@ struct phy_driver { +@@ -943,6 +943,10 @@ struct phy_driver { int (*get_sqi)(struct phy_device *dev); /** @get_sqi_max: Get the maximum signal quality indication */ int (*get_sqi_max)(struct phy_device *dev); diff --git a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch index c46be91fe0..d886ba224c 100644 --- a/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch +++ b/target/linux/realtek/patches-5.15/704-drivers-net-phy-eee-support-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -1449,6 +1449,11 @@ int phylink_ethtool_ksettings_set(struct +@@ -1944,6 +1944,11 @@ int phylink_ethtool_ksettings_set(struct * the presence of a PHY, this should not be changed as that * should be determined from the media side advertisement. */ @@ -33,7 +33,7 @@ Submitted-by: John Crispin return phy_ethtool_ksettings_set(pl->phydev, kset); } -@@ -1750,8 +1755,11 @@ int phylink_ethtool_get_eee(struct phyli +@@ -2247,8 +2252,11 @@ int phylink_ethtool_get_eee(struct phyli ASSERT_RTNL(); @@ -46,7 +46,7 @@ Submitted-by: John Crispin return ret; } -@@ -1768,8 +1776,11 @@ int phylink_ethtool_set_eee(struct phyli +@@ -2265,8 +2273,11 @@ int phylink_ethtool_set_eee(struct phyli ASSERT_RTNL(); diff --git a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch index 442bff82fa..8109abd264 100644 --- a/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch +++ b/target/linux/realtek/patches-5.15/704-include-linux-add-phy-hsgmii-mode.patch @@ -14,7 +14,7 @@ Submitted-by: Birger Koblitz --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -134,6 +134,7 @@ typedef enum { +@@ -138,6 +138,7 @@ typedef enum { PHY_INTERFACE_MODE_XGMII, PHY_INTERFACE_MODE_XLGMII, PHY_INTERFACE_MODE_MOCA, @@ -22,7 +22,7 @@ Submitted-by: Birger Koblitz PHY_INTERFACE_MODE_QSGMII, PHY_INTERFACE_MODE_TRGMII, PHY_INTERFACE_MODE_100BASEX, -@@ -201,6 +202,8 @@ static inline const char *phy_modes(phy_ +@@ -243,6 +244,8 @@ static inline const char *phy_modes(phy_ return "xlgmii"; case PHY_INTERFACE_MODE_MOCA: return "moca"; diff --git a/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch b/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch index 47041262fc..cb80a72fe2 100644 --- a/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch +++ b/target/linux/realtek/patches-5.15/705-add-rtl-phy.patch @@ -14,7 +14,7 @@ Submitted-by: Birger Koblitz --- a/drivers/net/phy/Kconfig +++ b/drivers/net/phy/Kconfig -@@ -330,6 +330,12 @@ config REALTEK_PHY +@@ -356,6 +356,12 @@ config REALTEK_PHY help Supports the Realtek 821x PHY. @@ -29,7 +29,7 @@ Submitted-by: Birger Koblitz help --- a/drivers/net/phy/Makefile +++ b/drivers/net/phy/Makefile -@@ -89,6 +89,7 @@ obj-$(CONFIG_NATIONAL_PHY) += national.o +@@ -93,6 +93,7 @@ obj-$(CONFIG_NXP_C45_TJA11XX_PHY) += nxp obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja11xx.o obj-$(CONFIG_QSEMI_PHY) += qsemi.o obj-$(CONFIG_REALTEK_PHY) += realtek.o diff --git a/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch b/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch index bba6fd7182..3c273dca66 100644 --- a/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch +++ b/target/linux/realtek/patches-5.15/705-include-linux-phy-increase-phy-address-number-for-rtl839x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -233,7 +233,7 @@ static inline const char *phy_modes(phy_ +@@ -279,7 +279,7 @@ static inline const char *phy_modes(phy_ #define PHY_INIT_TIMEOUT 100000 #define PHY_FORCE_TIMEOUT 10 diff --git a/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch b/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch index 248abee39b..b269f7e104 100644 --- a/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch +++ b/target/linux/realtek/patches-5.15/710-net-phy-sfp-re-probe-modules-on-DEV_UP-event.patch @@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -1966,6 +1966,13 @@ static void sfp_sm_module(struct sfp *sf +@@ -2147,6 +2147,13 @@ static void sfp_sm_module(struct sfp *sf return; } diff --git a/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch b/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch index 5e1053ca6c..a80482d94a 100644 --- a/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch +++ b/target/linux/realtek/patches-5.15/711-net-phy-add-an-MDIO-SMBus-library.patch @@ -15,7 +15,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/mdio/Kconfig +++ b/drivers/net/mdio/Kconfig -@@ -40,6 +40,17 @@ config MDIO_SUN4I +@@ -54,6 +54,17 @@ config MDIO_SUN4I interface units of the Allwinner SoC that have an EMAC (A10, A12, A10s, etc.) @@ -35,7 +35,7 @@ Signed-off-by: Antoine Tenart depends on ARCH_XGENE || COMPILE_TEST --- a/drivers/net/mdio/Makefile +++ b/drivers/net/mdio/Makefile -@@ -17,6 +17,7 @@ obj-$(CONFIG_MDIO_MOXART) += mdio-moxar +@@ -19,6 +19,7 @@ obj-$(CONFIG_MDIO_MOXART) += mdio-moxar obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-mscc-miim.o obj-$(CONFIG_MDIO_MVUSB) += mdio-mvusb.o obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o diff --git a/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch b/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch index c4bacc0ea9..1f0b74a17c 100644 --- a/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch +++ b/target/linux/realtek/patches-5.15/712-net-phy-sfp-add-support-for-SMBus.patch @@ -10,7 +10,7 @@ Signed-off-by: Antoine Tenart --- a/drivers/net/phy/sfp.c +++ b/drivers/net/phy/sfp.c -@@ -413,32 +413,72 @@ static int sfp_i2c_write(struct sfp *sfp +@@ -539,32 +539,72 @@ static int sfp_i2c_write(struct sfp *sfp return ret == ARRAY_SIZE(msgs) ? len : 0; } diff --git a/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch b/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch index eeb26fa199..4867488642 100644 --- a/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch +++ b/target/linux/realtek/patches-5.15/800-net-mdio-support-hardware-assisted-indirect-access.patch @@ -32,7 +32,7 @@ Signed-off-by: Daniel Golle --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c -@@ -734,6 +734,32 @@ out: +@@ -737,6 +737,32 @@ out: } /** @@ -65,9 +65,9 @@ Signed-off-by: Daniel Golle * __mdiobus_read - Unlocked version of the mdiobus_read function * @bus: the mii_bus struct * @addr: the phy address -@@ -749,7 +775,10 @@ int __mdiobus_read(struct mii_bus *bus, +@@ -752,7 +778,10 @@ int __mdiobus_read(struct mii_bus *bus, - WARN_ON_ONCE(!mutex_is_locked(&bus->mdio_lock)); + lockdep_assert_held_once(&bus->mdio_lock); - retval = bus->read(bus, addr, regnum); + if (bus->read_paged) @@ -77,7 +77,7 @@ Signed-off-by: Daniel Golle trace_mdio_access(bus, 1, addr, regnum, retval, retval); mdiobus_stats_acct(&bus->stats[addr], true, retval); -@@ -759,6 +788,40 @@ int __mdiobus_read(struct mii_bus *bus, +@@ -762,6 +791,40 @@ int __mdiobus_read(struct mii_bus *bus, EXPORT_SYMBOL(__mdiobus_read); /** @@ -118,9 +118,9 @@ Signed-off-by: Daniel Golle * __mdiobus_write - Unlocked version of the mdiobus_write function * @bus: the mii_bus struct * @addr: the phy address -@@ -775,7 +838,10 @@ int __mdiobus_write(struct mii_bus *bus, +@@ -778,7 +841,10 @@ int __mdiobus_write(struct mii_bus *bus, - WARN_ON_ONCE(!mutex_is_locked(&bus->mdio_lock)); + lockdep_assert_held_once(&bus->mdio_lock); - err = bus->write(bus, addr, regnum, val); + if (bus->write_paged) @@ -130,7 +130,7 @@ Signed-off-by: Daniel Golle trace_mdio_access(bus, 0, addr, regnum, val, err); mdiobus_stats_acct(&bus->stats[addr], false, err); -@@ -785,6 +851,39 @@ int __mdiobus_write(struct mii_bus *bus, +@@ -788,6 +854,39 @@ int __mdiobus_write(struct mii_bus *bus, EXPORT_SYMBOL(__mdiobus_write); /** @@ -170,7 +170,7 @@ Signed-off-by: Daniel Golle * __mdiobus_modify_changed - Unlocked version of the mdiobus_modify function * @bus: the mii_bus struct * @addr: the phy address -@@ -817,6 +916,43 @@ int __mdiobus_modify_changed(struct mii_ +@@ -820,6 +919,43 @@ int __mdiobus_modify_changed(struct mii_ EXPORT_SYMBOL_GPL(__mdiobus_modify_changed); /** @@ -214,7 +214,7 @@ Signed-off-by: Daniel Golle * mdiobus_read_nested - Nested version of the mdiobus_read function * @bus: the mii_bus struct * @addr: the phy address -@@ -842,6 +978,79 @@ int mdiobus_read_nested(struct mii_bus * +@@ -845,6 +981,79 @@ int mdiobus_read_nested(struct mii_bus * EXPORT_SYMBOL(mdiobus_read_nested); /** @@ -294,7 +294,7 @@ Signed-off-by: Daniel Golle * mdiobus_read - Convenience function for reading a given MII mgmt register * @bus: the mii_bus struct * @addr: the phy address -@@ -864,6 +1073,29 @@ int mdiobus_read(struct mii_bus *bus, in +@@ -867,6 +1076,29 @@ int mdiobus_read(struct mii_bus *bus, in EXPORT_SYMBOL(mdiobus_read); /** @@ -324,7 +324,7 @@ Signed-off-by: Daniel Golle * mdiobus_write_nested - Nested version of the mdiobus_write function * @bus: the mii_bus struct * @addr: the phy address -@@ -890,6 +1122,33 @@ int mdiobus_write_nested(struct mii_bus +@@ -893,6 +1125,33 @@ int mdiobus_write_nested(struct mii_bus EXPORT_SYMBOL(mdiobus_write_nested); /** @@ -358,7 +358,7 @@ Signed-off-by: Daniel Golle * mdiobus_write - Convenience function for writing a given MII mgmt register * @bus: the mii_bus struct * @addr: the phy address -@@ -913,6 +1172,30 @@ int mdiobus_write(struct mii_bus *bus, i +@@ -916,6 +1175,30 @@ int mdiobus_write(struct mii_bus *bus, i EXPORT_SYMBOL(mdiobus_write); /** @@ -389,7 +389,7 @@ Signed-off-by: Daniel Golle * mdiobus_modify - Convenience function for modifying a given mdio device * register * @bus: the mii_bus struct -@@ -934,6 +1217,51 @@ int mdiobus_modify(struct mii_bus *bus, +@@ -937,6 +1220,51 @@ int mdiobus_modify(struct mii_bus *bus, EXPORT_SYMBOL_GPL(mdiobus_modify); /** @@ -443,7 +443,7 @@ Signed-off-by: Daniel Golle * @dev: target MDIO device --- a/drivers/net/phy/phy-core.c +++ b/drivers/net/phy/phy-core.c -@@ -481,10 +481,16 @@ int __phy_read_mmd(struct phy_device *ph +@@ -482,10 +482,16 @@ int __phy_read_mmd(struct phy_device *ph struct mii_bus *bus = phydev->mdio.bus; int phy_addr = phydev->mdio.addr; @@ -464,7 +464,7 @@ Signed-off-by: Daniel Golle } return val; } -@@ -537,12 +543,18 @@ int __phy_write_mmd(struct phy_device *p +@@ -538,12 +544,18 @@ int __phy_write_mmd(struct phy_device *p struct mii_bus *bus = phydev->mdio.bus; int phy_addr = phydev->mdio.addr; @@ -487,7 +487,7 @@ Signed-off-by: Daniel Golle } return ret; } -@@ -748,6 +760,13 @@ EXPORT_SYMBOL_GPL(phy_modify_mmd); +@@ -749,6 +761,13 @@ EXPORT_SYMBOL_GPL(phy_modify_mmd); static int __phy_read_page(struct phy_device *phydev) { @@ -501,7 +501,7 @@ Signed-off-by: Daniel Golle if (WARN_ONCE(!phydev->drv->read_page, "read_page callback not available, PHY driver not loaded?\n")) return -EOPNOTSUPP; -@@ -756,6 +775,13 @@ static int __phy_read_page(struct phy_de +@@ -757,6 +776,13 @@ static int __phy_read_page(struct phy_de static int __phy_write_page(struct phy_device *phydev, int page) { @@ -515,7 +515,7 @@ Signed-off-by: Daniel Golle if (WARN_ONCE(!phydev->drv->write_page, "write_page callback not available, PHY driver not loaded?\n")) return -EOPNOTSUPP; -@@ -857,6 +883,18 @@ int phy_read_paged(struct phy_device *ph +@@ -858,6 +884,18 @@ int phy_read_paged(struct phy_device *ph { int ret = 0, oldpage; @@ -534,7 +534,7 @@ Signed-off-by: Daniel Golle oldpage = phy_select_page(phydev, page); if (oldpage >= 0) ret = __phy_read(phydev, regnum); -@@ -878,6 +916,18 @@ int phy_write_paged(struct phy_device *p +@@ -879,6 +917,18 @@ int phy_write_paged(struct phy_device *p { int ret = 0, oldpage; @@ -563,7 +563,7 @@ Signed-off-by: Daniel Golle #define MII_DEVADDR_C45_SHIFT 16 #define MII_DEVADDR_C45_MASK GENMASK(20, 16) #define MII_REGADDR_C45_MASK GENMASK(15, 0) -@@ -327,11 +328,19 @@ static inline void mii_10gbt_stat_mod_li +@@ -340,11 +341,19 @@ static inline void mii_10gbt_stat_mod_li advertising, lpa & MDIO_AN_10GBT_STAT_LP10G); } @@ -583,7 +583,7 @@ Signed-off-by: Daniel Golle int mdiobus_read(struct mii_bus *bus, int addr, u32 regnum); int mdiobus_read_nested(struct mii_bus *bus, int addr, u32 regnum); int mdiobus_write(struct mii_bus *bus, int addr, u32 regnum, u16 val); -@@ -339,11 +348,51 @@ int mdiobus_write_nested(struct mii_bus +@@ -352,11 +361,51 @@ int mdiobus_write_nested(struct mii_bus int mdiobus_modify(struct mii_bus *bus, int addr, u32 regnum, u16 mask, u16 set); @@ -635,7 +635,7 @@ Signed-off-by: Daniel Golle static inline u16 mdiobus_c45_regad(u32 regnum) { return FIELD_GET(MII_REGADDR_C45_MASK, regnum); -@@ -367,6 +416,19 @@ static inline int __mdiobus_c45_write(st +@@ -380,6 +429,19 @@ static inline int __mdiobus_c45_write(st val); } @@ -665,7 +665,7 @@ Signed-off-by: Daniel Golle #define MDIO_DEVICE_IS_PHY 0x80000000 /** -@@ -374,6 +375,22 @@ struct mii_bus { +@@ -420,6 +421,22 @@ struct mii_bus { /** @shared: shared state across different PHYs */ struct phy_package_shared *shared[PHY_MAX_ADDR]; @@ -688,7 +688,7 @@ Signed-off-by: Daniel Golle }; #define to_mii_bus(d) container_of(d, struct mii_bus, dev) -@@ -1651,6 +1668,66 @@ static inline int __phy_package_read(str +@@ -1754,6 +1771,66 @@ static inline int __phy_package_read(str return __mdiobus_read(phydev->mdio.bus, shared->addr, regnum); } @@ -755,7 +755,7 @@ Signed-off-by: Daniel Golle static inline int phy_package_write(struct phy_device *phydev, u32 regnum, u16 val) { -@@ -1673,6 +1750,72 @@ static inline int __phy_package_write(st +@@ -1776,6 +1853,72 @@ static inline int __phy_package_write(st return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val); }