diff options
Diffstat (limited to 'target/linux/realtek')
28 files changed, 480 insertions, 312 deletions
diff --git a/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts b/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts new file mode 100644 index 0000000000..08ef740399 --- /dev/null +++ b/target/linux/realtek/dts/rtl8380_linksys_lgs310c.dts @@ -0,0 +1,212 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> +#include <dt-bindings/gpio/gpio.h> + +#include "rtl838x.dtsi" + +/ { + compatible = "linksys,lgs310c", "realtek,rtl838x-soc"; + model = "Linksys LGS310C"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_fault; + led-running = &led_power; + led-upgrade = &led_power; + }; + + memory@0 { + device_type = "memory"; + reg = <0x0 0x10000000>; + }; + + leds: leds { + pinctrl-names = "default"; + pinctrl-0 = <&pinmux_disable_sys_led>; + compatible = "gpio-leds"; + + led_power: led-0 { + function = LED_FUNCTION_POWER; + color = <LED_COLOR_ID_GREEN>; + gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; + }; + + led_fault: led-1 { + function = LED_FUNCTION_FAULT; + color = <LED_COLOR_ID_AMBER>; + gpios = <&gpio1 2 GPIO_ACTIVE_LOW>; + }; + + }; + + /* i2c of the left SFP cage: port 9 */ + i2c0: i2c-gpio-0 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp0: sfp-p9 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + los-gpio = <&gpio1 11 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 12 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>; + }; + + /* i2c of the right SFP cage: port 10 */ + i2c1: i2c-gpio-1 { + compatible = "i2c-gpio"; + sda-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; +/* + * ports 9 & 10 use a shared SCL, and are currently not usable in parallel + * So for now disable the SCL on the second port. + * + * scl-gpios = <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; + */ + i2c-gpio,scl-open-drain; + i2c-gpio,delay-us = <2>; + #address-cells = <1>; + #size-cells = <0>; + }; + + sfp1: sfp-p10 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + los-gpio = <&gpio1 14 GPIO_ACTIVE_HIGH>; + mod-def0-gpio = <&gpio1 21 GPIO_ACTIVE_LOW>; + tx-disable-gpio = <&gpio1 13 GPIO_ACTIVE_HIGH>; + }; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio0 11 GPIO_ACTIVE_LOW>; + linux,code = <KEY_RESTART>; + }; + }; + + gpio1: rtl8231-gpio { + compatible = "realtek,rtl8231-gpio"; + #gpio-cells = <2>; + gpio-controller; + indirect-access-bus-id = <0>; + }; +}; + +&spi0 { + status = "okay"; + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x00000000 0x80000>; + read-only; + }; + partition@80000 { + label = "u-boot-env"; + reg = <0x00080000 0x10000>; + }; + partition@90000 { + label = "u-boot-env2"; + reg = <0x00090000 0x10000>; + }; + partition@a0000 { + label = "jffs2"; + reg = <0x000a0000 0x500000>; + }; + partition@5a0000 { + label = "firmware"; + compatible = "openwrt,uimage"; + reg = <0x005a0000 0xd30000>; + }; + partition@2d0000 { + label = "kernel2"; + reg = <0x012d0000 0xd30000>; + }; + }; + }; +}; + +&uart1 { + status = "okay"; +}; + +ðernet0 { + mdio: mdio-bus { + compatible = "realtek,rtl838x-mdio"; + regmap = <ðernet0>; + #address-cells = <1>; + #size-cells = <0>; + + INTERNAL_PHY(8) + INTERNAL_PHY(9) + INTERNAL_PHY(10) + INTERNAL_PHY(11) + INTERNAL_PHY(12) + INTERNAL_PHY(13) + INTERNAL_PHY(14) + INTERNAL_PHY(15) + INTERNAL_PHY(24) + INTERNAL_PHY(26) + }; +}; + +&switch0 { + ports { + #address-cells = <1>; + #size-cells = <0>; + + SWITCH_PORT(8, 1, internal) + SWITCH_PORT(9, 2, internal) + SWITCH_PORT(10, 3, internal) + SWITCH_PORT(11, 4, internal) + SWITCH_PORT(12, 5, internal) + SWITCH_PORT(13, 6, internal) + SWITCH_PORT(14, 7, internal) + SWITCH_PORT(15, 8, internal) + + port@24 { + reg = <24>; + label = "lan9"; + phy-handle = <&phy24>; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp0>; + }; + + port@26 { + reg = <26>; + label = "lan10"; + phy-handle = <&phy26>; + phy-mode = "1000base-x"; + managed = "in-band-status"; + sfp = <&sfp1>; + }; + + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; diff --git a/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts b/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts index 0c35d7b004..d7252c9984 100644 --- a/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts +++ b/target/linux/realtek/dts/rtl9302_zyxel_xgs1250-12.dts @@ -310,7 +310,6 @@ compatible = "ethernet-phy-ieee802.3-c22"; phy-is-integrated; reg = <27>; - rtl9300,smi-address = <4 0>; sds = < 9 >; }; diff --git a/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform b/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform index 98f18cac1b..e824dee7b7 100644 --- a/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform +++ b/target/linux/realtek/files-6.6/arch/mips/rtl838x/Platform @@ -1,5 +1,5 @@ # # Realtek RTL838x SoCs # -cflags-$(CONFIG_RTL83XX) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ -load-$(CONFIG_RTL83XX) += 0xffffffff80100000 +cflags-$(CONFIG_MACH_REALTEK_RTL) += -I$(srctree)/arch/mips/include/asm/mach-rtl838x/ +load-$(CONFIG_MACH_REALTEK_RTL) += 0xffffffff80100000 diff --git a/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig b/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig index 4cf3cd9633..62b704077a 100644 --- a/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig +++ b/target/linux/realtek/files-6.6/drivers/clk/realtek/Kconfig @@ -2,13 +2,13 @@ menuconfig COMMON_CLK_REALTEK bool "Support for Realtek's clock controllers" - depends on RTL83XX + depends on MACH_REALTEK_RTL if COMMON_CLK_REALTEK config COMMON_CLK_RTL83XX bool "Clock driver for Realtek RTL83XX" - depends on RTL83XX + depends on MACH_REALTEK_RTL select SRAM help This driver adds support for the Realtek RTL83xx series basic clocks. diff --git a/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c b/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c index 54d916d17a..51b19978a0 100644 --- a/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c +++ b/target/linux/realtek/files-6.6/drivers/i2c/busses/i2c-rtl9300.c @@ -336,7 +336,6 @@ struct i2c_adapter_quirks rtl9300_i2c_quirks = { static int rtl9300_i2c_probe(struct platform_device *pdev) { - struct resource *res; struct rtl9300_i2c *i2c; struct i2c_adapter *adap; struct i2c_drv_data *drv_data; @@ -351,15 +350,13 @@ static int rtl9300_i2c_probe(struct platform_device *pdev) return -EINVAL; } - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - drv_data = (struct i2c_drv_data *) device_get_match_data(&pdev->dev); i2c = devm_kzalloc(&pdev->dev, sizeof(struct rtl9300_i2c), GFP_KERNEL); if (!i2c) return -ENOMEM; - i2c->base = devm_ioremap_resource(&pdev->dev, res); + i2c->base = devm_platform_ioremap_resource(pdev, 0); i2c->mst2_offset = drv_data->mst2_offset; if (IS_ERR(i2c->base)) return PTR_ERR(i2c->base); diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig index 3124ee8d20..0af4abcfb9 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/Kconfig @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only config NET_DSA_RTL83XX tristate "Realtek RTL838x/RTL839x switch support" - depends on RTL83XX + depends on MACH_REALTEK_RTL select NET_DSA_TAG_TRAILER help This driver adds support for Realtek RTL83xx series switching. diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c index b17d9ae5d5..fe0980a1be 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/common.c @@ -374,7 +374,7 @@ static int __init rtl83xx_mdio_probe(struct rtl838x_switch_priv *priv) /* Check for the integrated SerDes of the RTL8380M first */ if (of_property_read_bool(phy_node, "phy-is-integrated") && priv->id == 0x8380 && pn >= 24) { - pr_debug("----> FĂ“UND A SERDES\n"); + pr_debug("----> FOUND A SERDES\n"); priv->ports[pn].phy = PHY_RTL838X_SDS; continue; } @@ -1492,7 +1492,9 @@ static int __init rtl83xx_sw_probe(struct platform_device *pdev) priv->ds->needs_standalone_vlan_filtering = true; priv->dev = dev; - mutex_init(&priv->reg_mutex); + err = devm_mutex_init(dev, &priv->reg_mutex); + if (err) + return err; priv->family_id = soc_info.family; priv->id = soc_info.id; diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c index d61122e330..f9d37fb3bd 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/dsa.c @@ -684,6 +684,7 @@ static void rtl83xx_phylink_get_caps(struct dsa_switch *ds, int port, __set_bit(PHY_INTERFACE_MODE_QSGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_SGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_XGMII, config->supported_interfaces); + __set_bit(PHY_INTERFACE_MODE_USXGMII, config->supported_interfaces); __set_bit(PHY_INTERFACE_MODE_1000BASEX, config->supported_interfaces); } diff --git a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c index 5889cea6d6..ecf291f866 100644 --- a/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c +++ b/target/linux/realtek/files-6.6/drivers/net/dsa/rtl83xx/rtl839x.c @@ -662,7 +662,7 @@ int rtl839x_read_phy(u32 port, u32 page, u32 reg, u32 *val) u32 v; int err = 0; - if (port > 63 || page > 4095 || reg > 31) + if (port > 63 || page > 8191 || reg > 31) return -ENOTSUPP; /* Take bug on RTL839x Rev <= C into account */ @@ -698,7 +698,7 @@ int rtl839x_write_phy(u32 port, u32 page, u32 reg, u32 val) int err = 0; val &= 0xffff; - if (port > 63 || page > 4095 || reg > 31) + if (port > 63 || page > 8191 || reg > 31) return -ENOTSUPP; /* Take bug on RTL839x Rev <= C into account */ diff --git a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c index 07664f9f38..4b79090696 100644 --- a/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c +++ b/target/linux/realtek/files-6.6/drivers/net/ethernet/rtl838x_eth.c @@ -195,7 +195,7 @@ struct rtl838x_eth_priv { u32 lastEvent; u16 rxrings; u16 rxringlen; - u8 smi_bus[MAX_PORTS]; + int smi_bus[MAX_PORTS]; u8 smi_addr[MAX_PORTS]; u32 sds_id[MAX_PORTS]; bool smi_bus_isc45[MAX_SMI_BUSSES]; @@ -2008,8 +2008,9 @@ static int rtmdio_930x_reset(struct mii_bus *bus) for (int i = 0; i < RTL930X_CPU_PORT; i++) { int pos; - if (priv->smi_bus[i] > 3) + if (priv->smi_bus[i] < 0) continue; + pos = (i % 6) * 5; sw_w32_mask(0x1f << pos, priv->smi_addr[i] << pos, RTL930X_SMI_PORT0_5_ADDR + (i / 6) * 4); @@ -2114,9 +2115,12 @@ static int rtmdio_931x_reset(struct mii_bus *bus) mdc_on[0] = mdc_on[1] = mdc_on[2] = mdc_on[3] = false; /* Mapping of port to phy-addresses on an SMI bus */ poll_sel[0] = poll_sel[1] = poll_sel[2] = poll_sel[3] = 0; - for (int i = 0; i < 56; i++) { + for (int i = 0; i < RTL931X_CPU_PORT; i++) { u32 pos; + if (priv->smi_bus[i] < 0) + continue; + pos = (i % 6) * 5; sw_w32_mask(0x1f << pos, priv->smi_addr[i] << pos, RTL931X_SMI_PORT_ADDR + (i / 6) * 4); pos = (i * 2) % 32; @@ -2282,30 +2286,35 @@ static int rtl838x_mdio_init(struct rtl838x_eth_priv *priv) if (of_property_read_u32(dn, "reg", &pn)) continue; - if (of_property_read_u32_array(dn, "rtl9300,smi-address", &smi_addr[0], 2)) { - smi_addr[0] = 0; - smi_addr[1] = pn; + if (pn >= MAX_PORTS) { + pr_err("%s: illegal port number %d\n", __func__, pn); + return -ENODEV; } if (of_property_read_u32(dn, "sds", &priv->sds_id[pn])) priv->sds_id[pn] = -1; - else { + else pr_info("set sds port %d to %d\n", pn, priv->sds_id[pn]); - } - if (pn < MAX_PORTS) { + if (of_property_read_u32_array(dn, "rtl9300,smi-address", &smi_addr[0], 2)) { + priv->smi_bus[pn] = 0; + priv->smi_addr[pn] = pn; + } else { priv->smi_bus[pn] = smi_addr[0]; priv->smi_addr[pn] = smi_addr[1]; - } else { - pr_err("%s: illegal port number %d\n", __func__, pn); } - if (of_device_is_compatible(dn, "ethernet-phy-ieee802.3-c45")) - priv->smi_bus_isc45[smi_addr[0]] = true; - - if (of_property_read_bool(dn, "phy-is-integrated")) { - priv->phy_is_internal[pn] = true; + if (priv->smi_bus[pn] >= MAX_SMI_BUSSES) { + pr_err("%s: illegal SMI bus number %d\n", __func__, priv->smi_bus[pn]); + return -ENODEV; } + + priv->phy_is_internal[pn] = of_property_read_bool(dn, "phy-is-integrated"); + + if (priv->phy_is_internal[pn] && priv->sds_id[pn] >= 0) + priv->smi_bus[pn]= -1; + else if (of_device_is_compatible(dn, "ethernet-phy-ieee802.3-c45")) + priv->smi_bus_isc45[priv->smi_bus[pn]] = true; } dn = of_find_compatible_node(NULL, NULL, "realtek,rtl83xx-switch"); @@ -2326,7 +2335,7 @@ static int rtl838x_mdio_init(struct rtl838x_eth_priv *priv) } snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%pOFn", mii_np); - ret = of_mdiobus_register(priv->mii_bus, mii_np); + ret = devm_of_mdiobus_register(&priv->pdev->dev, priv->mii_bus, mii_np); err_put_node: of_node_put(mii_np); @@ -2334,18 +2343,6 @@ err_put_node: return ret; } -static int rtl838x_mdio_remove(struct rtl838x_eth_priv *priv) -{ - pr_debug("%s called\n", __func__); - if (!priv->mii_bus) - return 0; - - mdiobus_unregister(priv->mii_bus); - mdiobus_free(priv->mii_bus); - - return 0; -} - static netdev_features_t rtl838x_fix_features(struct net_device *dev, netdev_features_t features) { @@ -2489,11 +2486,9 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) rxringlen = MAX_ENTRIES / rxrings; rxringlen = rxringlen > MAX_RXLEN ? MAX_RXLEN : rxringlen; - dev = alloc_etherdev_mqs(sizeof(struct rtl838x_eth_priv), TXRINGS, rxrings); - if (!dev) { - err = -ENOMEM; - goto err_free; - } + dev = devm_alloc_etherdev_mqs(&pdev->dev, sizeof(struct rtl838x_eth_priv), TXRINGS, rxrings); + if (!dev) + return -ENOMEM; SET_NETDEV_DEV(dev, &pdev->dev); priv = netdev_priv(dev); @@ -2504,16 +2499,14 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) resource_size(res), res->name); if (!mem) { dev_err(&pdev->dev, "cannot request memory space\n"); - err = -ENXIO; - goto err_free; + return -ENXIO; } dev->mem_start = mem->start; dev->mem_end = mem->end; } else { dev_err(&pdev->dev, "cannot request IO resource\n"); - err = -ENXIO; - goto err_free; + return -ENXIO; } /* Allocate buffer memory */ @@ -2522,8 +2515,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) (void *)&dev->mem_start, GFP_KERNEL); if (!priv->membase) { dev_err(&pdev->dev, "cannot allocate DMA buffer\n"); - err = -ENOMEM; - goto err_free; + return -ENOMEM; } /* Allocate ring-buffer space at the end of the allocated memory */ @@ -2581,7 +2573,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) dev->irq = platform_get_irq(pdev, 0); if (dev->irq < 0) { dev_err(&pdev->dev, "cannot obtain network-device IRQ\n"); - goto err_free; + return err; } err = devm_request_irq(&pdev->dev, dev->irq, priv->r->net_irq, @@ -2589,7 +2581,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) if (err) { dev_err(&pdev->dev, "%s: could not acquire interrupt: %d\n", __func__, err); - goto err_free; + return err; } rtl8380_init_mac(priv); @@ -2628,11 +2620,11 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) err = rtl838x_mdio_init(priv); if (err) - goto err_free; + return err; - err = register_netdev(dev); + err = devm_register_netdev(&pdev->dev, dev); if (err) - goto err_free; + return err; for (int i = 0; i < priv->rxrings; i++) { priv->rx_qs[i].id = i; @@ -2646,8 +2638,7 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) err = of_get_phy_mode(dn, &phy_mode); if (err < 0) { dev_err(&pdev->dev, "incorrect phy-mode\n"); - err = -EINVAL; - goto err_free; + return -EINVAL; } priv->pcs.ops = &rtl838x_pcs_ops; @@ -2658,19 +2649,11 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev) phylink = phylink_create(&priv->phylink_config, pdev->dev.fwnode, phy_mode, &rtl838x_phylink_ops); - if (IS_ERR(phylink)) { - err = PTR_ERR(phylink); - goto err_free; - } + if (IS_ERR(phylink)) + return PTR_ERR(phylink); priv->phylink = phylink; return 0; - -err_free: - pr_err("Error setting up netdev, freeing it again.\n"); - free_netdev(dev); - - return err; } static int rtl838x_eth_remove(struct platform_device *pdev) @@ -2680,16 +2663,12 @@ static int rtl838x_eth_remove(struct platform_device *pdev) if (dev) { pr_info("Removing platform driver for rtl838x-eth\n"); - rtl838x_mdio_remove(priv); rtl838x_hw_stop(priv); netif_tx_stop_all_queues(dev); for (int i = 0; i < priv->rxrings; i++) netif_napi_del(&priv->rx_qs[i].napi); - - unregister_netdev(dev); - free_netdev(dev); } return 0; diff --git a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c index df5e2e4440..09c6ca3b2c 100644 --- a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c +++ b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.c @@ -45,7 +45,8 @@ extern int phy_port_read_paged(struct phy_device *phydev, int port, int page, u3 * RealTek SoCs allows to access the PHY in RAW mode, ie. bypassing * the cache and paging engine of the MDIO controller. */ -#define RTL83XX_PAGE_RAW 0x0fff +#define RTL838X_PAGE_RAW 0x0fff +#define RTL839X_PAGE_RAW 0x1fff /* internal RTL821X PHY uses register 0x1d to select media page */ #define RTL821XINT_MEDIA_PAGE_SELECT 0x1d @@ -146,6 +147,79 @@ static int resume_polling(u64 saved_state) return 0; } +int rtl821x_match_phy_device(struct phy_device *phydev) +{ + u64 poll_state; + int rawpage, port = phydev->mdio.addr & ~3; + int oldpage, chip_mode, chip_cfg_mode; + + if (phydev->phy_id == PHY_ID_RTL8218B_E) + return PHY_IS_RTL8218B_E; + + if (phydev->phy_id != PHY_ID_RTL8214_OR_8218) + return PHY_IS_NOT_RTL821X; + + if (soc_info.family == RTL8380_FAMILY_ID) + rawpage = RTL838X_PAGE_RAW; + else if (soc_info.family == RTL8390_FAMILY_ID) + rawpage = RTL839X_PAGE_RAW; + else + return PHY_IS_NOT_RTL821X; + + poll_state = disable_polling(port); + /* + * At this stage the write_page()/read_page() PHY functions are not yet + * registered and normal paged access is not possible. The following + * detection routine works because our MDIO bus has all the Realtek + * PHY page handling (register 31) integrated into the port functions. + */ + oldpage = phy_port_read_paged(phydev, port, rawpage, 31); + phy_port_write_paged(phydev, port, rawpage, 31, 0xa42); + phy_port_write_paged(phydev, port, rawpage, 29, 0x008); + phy_port_write_paged(phydev, port, rawpage, 31, 0x278); + phy_port_write_paged(phydev, port, rawpage, 18, 0x455); + phy_port_write_paged(phydev, port, rawpage, 31, 0x260); + chip_mode = phy_port_read_paged(phydev, port, rawpage, 18); + phy_port_write_paged(phydev, port, rawpage, 31, 0xa42); + phy_port_write_paged(phydev, port, rawpage, 29, 0x000); + phy_port_write_paged(phydev, port, rawpage, 31, oldpage); + + resume_polling(poll_state); + + pr_debug("%s(%d): got chip mode %x\n", __func__, phydev->mdio.addr, chip_mode); + + /* we checked the 4th port of a RTL8218B and got no config values */ + if (!chip_mode) + return PHY_IS_RTL8218B_E; + + chip_cfg_mode = (chip_mode >> 4) & 0xf; + chip_mode &= 0xf; + + if (chip_mode == 0xd || chip_mode == 0xf) + return PHY_IS_RTL8218B_E; + + if (chip_mode == 0x4 || chip_mode == 0x6) + return PHY_IS_RTL8214FC; + + if (chip_mode != 0xc && chip_mode != 0xe) + return PHY_IS_NOT_RTL821X; + + if (chip_cfg_mode == 0x4 || chip_cfg_mode == 0x6) + return PHY_IS_RTL8214FC; + + return PHY_IS_RTL8214FB; +} + +static int rtl8218b_ext_match_phy_device(struct phy_device *phydev) +{ + return rtl821x_match_phy_device(phydev) == PHY_IS_RTL8218B_E; +} + +static int rtl8214fc_match_phy_device(struct phy_device *phydev) +{ + return rtl821x_match_phy_device(phydev) == PHY_IS_RTL8214FC; +} + static void rtl8380_int_phy_on_off(struct phy_device *phydev, bool on) { phy_modify(phydev, 0, BMCR_PDOWN, on ? 0 : BMCR_PDOWN); @@ -154,11 +228,11 @@ static void rtl8380_int_phy_on_off(struct phy_device *phydev, bool on) static void rtl8380_rtl8214fc_on_off(struct phy_device *phydev, bool on) { /* fiber ports */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); phy_modify(phydev, 0x10, BMCR_PDOWN, on ? 0 : BMCR_PDOWN); /* copper ports */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); phy_modify_paged(phydev, RTL821X_PAGE_POWER, 0x10, BMCR_PDOWN, on ? 0 : BMCR_PDOWN); } @@ -693,17 +767,17 @@ static void rtl821x_phy_setup_package_broadcast(struct phy_device *phydev, bool int mac = phydev->mdio.addr; /* select main page 0 */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); /* write to 0x8 to register 0x1d on main page 0 */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); /* select page 0x266 */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PORT); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PORT); /* set phy id and target broadcast bitmap in register 0x16 on page 0x266 */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, 0x16, (enable?0xff00:0x00) | mac); + phy_write_paged(phydev, RTL838X_PAGE_RAW, 0x16, (enable?0xff00:0x00) | mac); /* return to main page 0 */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); /* write to 0x0 to register 0x1d on main page 0 */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); mdelay(1); } @@ -779,8 +853,8 @@ static int rtl8380_configure_int_rtl8218b(struct phy_device *phydev) /* Ready PHY for patch */ for (int p = 0; p < 8; p++) { - phy_package_port_write_paged(phydev, p, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PATCH); - phy_package_port_write_paged(phydev, p, RTL83XX_PAGE_RAW, 0x10, 0x0010); + phy_package_port_write_paged(phydev, p, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PATCH); + phy_package_port_write_paged(phydev, p, RTL838X_PAGE_RAW, 0x10, 0x0010); } msleep(500); for (int p = 0; p < 8; p++) { @@ -803,14 +877,14 @@ static int rtl8380_configure_int_rtl8218b(struct phy_device *phydev) i = 0; while (rtl838x_6275B_intPhy_perport[i * 2]) { - phy_package_port_write_paged(phydev, p, RTL83XX_PAGE_RAW, + phy_package_port_write_paged(phydev, p, RTL838X_PAGE_RAW, rtl838x_6275B_intPhy_perport[i * 2], rtl838x_6275B_intPhy_perport[i * 2 + 1]); i++; } i = 0; while (rtl8218b_6276B_hwEsd_perport[i * 2]) { - phy_package_port_write_paged(phydev, p, RTL83XX_PAGE_RAW, + phy_package_port_write_paged(phydev, p, RTL838X_PAGE_RAW, rtl8218b_6276B_hwEsd_perport[i * 2], rtl8218b_6276B_hwEsd_perport[i * 2 + 1]); i++; @@ -870,30 +944,30 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev) msleep(100); /* Get Chip revision */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); - phy_write_paged(phydev, RTL83XX_PAGE_RAW, 0x1b, 0x4); - val = phy_read_paged(phydev, RTL83XX_PAGE_RAW, 0x1c); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_write_paged(phydev, RTL838X_PAGE_RAW, 0x1b, 0x4); + val = phy_read_paged(phydev, RTL838X_PAGE_RAW, 0x1c); phydev_info(phydev, "Detected chip revision %04x\n", val); for (int i = 0; rtl8380_rtl8218b_perchip[i * 3] && rtl8380_rtl8218b_perchip[i * 3 + 1]; i++) { phy_package_port_write_paged(phydev, rtl8380_rtl8218b_perchip[i * 3], - RTL83XX_PAGE_RAW, rtl8380_rtl8218b_perchip[i * 3 + 1], + RTL838X_PAGE_RAW, rtl8380_rtl8218b_perchip[i * 3 + 1], rtl8380_rtl8218b_perchip[i * 3 + 2]); } /* Enable PHY */ for (int i = 0; i < 8; i++) { - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, 0x00, 0x1140); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, 0x00, 0x1140); } mdelay(100); /* Request patch */ for (int i = 0; i < 8; i++) { - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PATCH); - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, 0x10, 0x0010); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PATCH); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, 0x10, 0x0010); } mdelay(300); @@ -916,7 +990,7 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev) /* Use Broadcast ID method for patching */ rtl821x_phy_setup_package_broadcast(phydev, true); - phy_write_paged(phydev, RTL83XX_PAGE_RAW, 30, 8); + phy_write_paged(phydev, RTL838X_PAGE_RAW, 30, 8); phy_write_paged(phydev, 0x26e, 17, 0xb); phy_write_paged(phydev, 0x26e, 16, 0x2); mdelay(1); @@ -925,7 +999,7 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev) ipd = (ipd >> 4) & 0xf; /* unused ? */ for (int i = 0; rtl8218B_6276B_rtl8380_perport[i * 2]; i++) { - phy_write_paged(phydev, RTL83XX_PAGE_RAW, rtl8218B_6276B_rtl8380_perport[i * 2], + phy_write_paged(phydev, RTL838X_PAGE_RAW, rtl8218B_6276B_rtl8380_perport[i * 2], rtl8218B_6276B_rtl8380_perport[i * 2 + 1]); } @@ -935,21 +1009,6 @@ static int rtl8380_configure_ext_rtl8218b(struct phy_device *phydev) return 0; } -static int rtl8218b_ext_match_phy_device(struct phy_device *phydev) -{ - int addr = phydev->mdio.addr; - - /* Both the RTL8214FC and the external RTL8218B have the same - * PHY ID. On the RTL838x, the RTL8218B can only be attached_dev - * at PHY IDs 0-7, while the RTL8214FC must be attached via - * the pair of SGMII/1000Base-X with higher PHY-IDs - */ - if (soc_info.family == RTL8380_FAMILY_ID) - return phydev->phy_id == PHY_ID_RTL8218B_E && addr < 8; - else - return phydev->phy_id == PHY_ID_RTL8218B_E; -} - static bool rtl8214fc_media_is_fibre(struct phy_device *phydev) { int mac = phydev->mdio.addr; @@ -957,9 +1016,9 @@ static bool rtl8214fc_media_is_fibre(struct phy_device *phydev) static int reg[] = {16, 19, 20, 21}; u32 val; - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); + phy_package_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); val = phy_package_read_paged(phydev, RTL821X_PAGE_PORT, reg[mac % 4]); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); + phy_package_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); if (val & BMCR_PDOWN) return false; @@ -973,10 +1032,10 @@ static void rtl8214fc_power_set(struct phy_device *phydev, int port, bool on) if (port == PORT_FIBRE) { pr_info("%s: Powering %s FIBRE (port %d)\n", __func__, state, phydev->mdio.addr); - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_FIBRE); } else { pr_info("%s: Powering %s COPPER (port %d)\n", __func__, state, phydev->mdio.addr); - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); } if (on) { @@ -985,7 +1044,7 @@ static void rtl8214fc_power_set(struct phy_device *phydev, int port, bool on) phy_modify_paged(phydev, RTL821X_PAGE_POWER, 0x10, 0, BMCR_PDOWN); } - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); } static int rtl8214fc_suspend(struct phy_device *phydev) @@ -1017,7 +1076,7 @@ static void rtl8214fc_media_set(struct phy_device *phydev, bool set_fibre) int val; pr_info("%s: port %d, set_fibre: %d\n", __func__, mac, set_fibre); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); + phy_package_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); val = phy_package_read_paged(phydev, RTL821X_PAGE_PORT, reg[mac % 4]); val |= BIT(10); @@ -1027,9 +1086,9 @@ static void rtl8214fc_media_set(struct phy_device *phydev, bool set_fibre) val |= BMCR_PDOWN; } - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); + phy_package_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_INTERNAL); phy_package_write_paged(phydev, RTL821X_PAGE_PORT, reg[mac % 4], val); - phy_package_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); + phy_package_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XINT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); if (!phydev->suspended) { if (set_fibre) { @@ -1296,11 +1355,6 @@ static int rtl8218d_set_eee(struct phy_device *phydev, struct ethtool_eee *e) return 0; } -static int rtl8214c_match_phy_device(struct phy_device *phydev) -{ - return phydev->phy_id == PHY_ID_RTL8214C; -} - static int rtl8380_configure_rtl8214c(struct phy_device *phydev) { u32 phy_id, val; @@ -1359,8 +1413,8 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) rtl8380_rtl8214fc_perport = (void *)h + sizeof(struct fw_header) + h->parts[1].start; /* detect phy version */ - phy_write_paged(phydev, RTL83XX_PAGE_RAW, 27, 0x0004); - val = phy_read_paged(phydev, RTL83XX_PAGE_RAW, 28); + phy_write_paged(phydev, RTL838X_PAGE_RAW, 27, 0x0004); + val = phy_read_paged(phydev, RTL838X_PAGE_RAW, 28); val = phy_read(phydev, 16); if (val & BMCR_PDOWN) @@ -1380,10 +1434,10 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) if (rtl8380_rtl8214fc_perchip[i * 3 + 1] == 0x13 && page == 0x260) { val = phy_read_paged(phydev, 0x260, 13); val = (val & 0x1f00) | (rtl8380_rtl8214fc_perchip[i * 3 + 2] & 0xe0ff); - phy_write_paged(phydev, RTL83XX_PAGE_RAW, + phy_write_paged(phydev, RTL838X_PAGE_RAW, rtl8380_rtl8214fc_perchip[i * 3 + 1], val); } else { - phy_write_paged(phydev, RTL83XX_PAGE_RAW, + phy_write_paged(phydev, RTL838X_PAGE_RAW, rtl8380_rtl8214fc_perchip[i * 3 + 1], rtl8380_rtl8214fc_perchip[i * 3 + 2]); } @@ -1391,14 +1445,14 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) /* Force copper medium */ for (int i = 0; i < 4; i++) { - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_COPPER); } /* Enable PHY */ for (int i = 0; i < 4; i++) { - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, 0x00, 0x1140); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, 0x00, 0x1140); } mdelay(100); @@ -1419,8 +1473,8 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) /* Request patch */ for (int i = 0; i < 4; i++) { - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PATCH); - phy_package_port_write_paged(phydev, i, RTL83XX_PAGE_RAW, 0x10, 0x0010); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL821X_PAGE_PATCH); + phy_package_port_write_paged(phydev, i, RTL838X_PAGE_RAW, 0x10, 0x0010); } mdelay(300); @@ -1442,7 +1496,7 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) rtl821x_phy_setup_package_broadcast(phydev, true); for (int i = 0; rtl8380_rtl8214fc_perport[i * 2]; i++) { - phy_write_paged(phydev, RTL83XX_PAGE_RAW, rtl8380_rtl8214fc_perport[i * 2], + phy_write_paged(phydev, RTL838X_PAGE_RAW, rtl8380_rtl8214fc_perport[i * 2], rtl8380_rtl8214fc_perport[i * 2 + 1]); } @@ -1451,20 +1505,13 @@ static int rtl8380_configure_rtl8214fc(struct phy_device *phydev) /* Auto medium selection */ for (int i = 0; i < 4; i++) { - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); - phy_write_paged(phydev, RTL83XX_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL8XXX_PAGE_SELECT, RTL8XXX_PAGE_MAIN); + phy_write_paged(phydev, RTL838X_PAGE_RAW, RTL821XEXT_MEDIA_PAGE_SELECT, RTL821X_MEDIA_PAGE_AUTO); } return 0; } -static int rtl8214fc_match_phy_device(struct phy_device *phydev) -{ - int addr = phydev->mdio.addr; - - return phydev->phy_id == PHY_ID_RTL8214FC && addr >= 24; -} - static int rtl8380_configure_serdes(struct phy_device *phydev) { u32 v; @@ -3843,10 +3890,9 @@ static int rtl9300_serdes_probe(struct phy_device *phydev) static struct phy_driver rtl83xx_phy_driver[] = { { - PHY_ID_MATCH_MODEL(PHY_ID_RTL8214C), + PHY_ID_MATCH_EXACT(PHY_ID_RTL8214C), .name = "Realtek RTL8214C", .features = PHY_GBIT_FEATURES, - .match_phy_device = rtl8214c_match_phy_device, .probe = rtl8214c_phy_probe, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, @@ -3855,10 +3901,9 @@ static struct phy_driver rtl83xx_phy_driver[] = { .set_loopback = genphy_loopback, }, { - PHY_ID_MATCH_MODEL(PHY_ID_RTL8214FC), + .match_phy_device = rtl8214fc_match_phy_device, .name = "Realtek RTL8214FC", .features = PHY_GBIT_FIBRE_FEATURES, - .match_phy_device = rtl8214fc_match_phy_device, .probe = rtl8214fc_phy_probe, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, @@ -3871,10 +3916,9 @@ static struct phy_driver rtl83xx_phy_driver[] = { .get_eee = rtl8214fc_get_eee, }, { - PHY_ID_MATCH_MODEL(PHY_ID_RTL8218B_E), + .match_phy_device = rtl8218b_ext_match_phy_device, .name = "Realtek RTL8218B (external)", .features = PHY_GBIT_FEATURES, - .match_phy_device = rtl8218b_ext_match_phy_device, .probe = rtl8218b_ext_phy_probe, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, @@ -3885,7 +3929,7 @@ static struct phy_driver rtl83xx_phy_driver[] = { .get_eee = rtl8218b_get_eee, }, { - PHY_ID_MATCH_MODEL(PHY_ID_RTL8218D), + PHY_ID_MATCH_EXACT(PHY_ID_RTL8218D), .name = "REALTEK RTL8218D", .features = PHY_GBIT_FEATURES, .probe = rtl8218d_phy_probe, @@ -3990,7 +4034,7 @@ static struct phy_driver rtl83xx_phy_driver[] = { module_phy_driver(rtl83xx_phy_driver); static struct mdio_device_id __maybe_unused rtl83xx_tbl[] = { - { PHY_ID_MATCH_MODEL(PHY_ID_RTL8214FC) }, + { PHY_ID_MATCH_MODEL(PHY_ID_RTL8214_OR_8218) }, { } }; diff --git a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.h b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.h index fb79560e6b..781ecb3c7c 100644 --- a/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.h +++ b/target/linux/realtek/files-6.6/drivers/net/phy/rtl83xx-phy.h @@ -19,21 +19,26 @@ struct __attribute__ ((__packed__)) fw_header { }; /* TODO: fixed path? */ -#define FIRMWARE_838X_8380_1 "rtl838x_phy/rtl838x_8380.fw" -#define FIRMWARE_838X_8214FC_1 "rtl838x_phy/rtl838x_8214fc.fw" -#define FIRMWARE_838X_8218b_1 "rtl838x_phy/rtl838x_8218b.fw" +#define FIRMWARE_838X_8380_1 "rtl838x_phy/rtl838x_8380.fw" +#define FIRMWARE_838X_8214FC_1 "rtl838x_phy/rtl838x_8214fc.fw" +#define FIRMWARE_838X_8218b_1 "rtl838x_phy/rtl838x_8218b.fw" -/* External RTL8218B and RTL8214FC IDs are identical */ -#define PHY_ID_RTL8214C 0x001cc942 -#define PHY_ID_RTL8214FC 0x001cc981 -#define PHY_ID_RTL8218B_E 0x001cc981 -#define PHY_ID_RTL8218D 0x001cc983 -#define PHY_ID_RTL8218B_I 0x001cca40 -#define PHY_ID_RTL8221B 0x001cc849 -#define PHY_ID_RTL8226 0x001cc838 -#define PHY_ID_RTL8390_GENERIC 0x001ccab0 -#define PHY_ID_RTL8393_I 0x001c8393 -#define PHY_ID_RTL9300_I 0x70d03106 +#define PHY_ID_RTL8214C 0x001cc942 +#define PHY_ID_RTL8218B_E 0x001cc980 +#define PHY_ID_RTL8214_OR_8218 0x001cc981 +#define PHY_ID_RTL8218D 0x001cc983 +#define PHY_ID_RTL8218B_I 0x001cca40 +#define PHY_ID_RTL8221B 0x001cc849 +#define PHY_ID_RTL8226 0x001cc838 +#define PHY_ID_RTL8390_GENERIC 0x001ccab0 +#define PHY_ID_RTL8393_I 0x001c8393 +#define PHY_ID_RTL9300_I 0x70d03106 + +/* These PHYs share the same id (0x001cc981) */ +#define PHY_IS_NOT_RTL821X 0 +#define PHY_IS_RTL8214FC 1 +#define PHY_IS_RTL8214FB 2 +#define PHY_IS_RTL8218B_E 3 /* Registers of the internal Serdes of the 8380 */ #define RTL838X_SDS_MODE_SEL (0x0028) diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile index 9eed710480..19fab03dba 100644 --- a/target/linux/realtek/image/Makefile +++ b/target/linux/realtek/image/Makefile @@ -6,6 +6,8 @@ include $(INCLUDE_DIR)/image.mk KERNEL_LOADADDR = 0x80100000 DEVICE_VARS += \ + BELKIN_HEADER \ + BELKIN_MODEL \ CAMEO_BOARD_MODEL \ CAMEO_BOARD_VERSION \ CAMEO_CUSTOMER_SIGNATURE \ @@ -14,6 +16,7 @@ DEVICE_VARS += \ CAMEO_ROOTFS_PART \ H3C_DEVICE_ID \ H3C_PRODUCT_ID \ + LINKSYS_HEADER \ ZYXEL_VERS define Build/zyxel-vers @@ -71,6 +74,16 @@ define Build/h3c-vfs mv $@.new $@ endef +define Build/belkin-header + $(SCRIPT_DIR)/belkin-header.py $(@) $(@).new $(BELKIN_HEADER) ${BELKIN_MODEL} + mv $@.new $@ +endef + +define Build/linksys-image + $(SCRIPT_DIR)/linksys-image.sh $(@) $(@).new $(LINKSYS_MODEL) + mv $@.new $@ +endef + define Device/Default PROFILES = Default KERNEL := \ diff --git a/target/linux/realtek/image/rtl838x.mk b/target/linux/realtek/image/rtl838x.mk index c8e1c481ec..01397af931 100644 --- a/target/linux/realtek/image/rtl838x.mk +++ b/target/linux/realtek/image/rtl838x.mk @@ -162,6 +162,27 @@ define Device/iodata_bsh-g24mb endef TARGET_DEVICES += iodata_bsh-g24mb +define Device/linksys_lgs310c + SOC := rtl8380 + IMAGE_SIZE := 13504k + DEVICE_VENDOR := Linksys + DEVICE_MODEL := LGS310C + BELKIN_MODEL := BKS-RTL83xx + BELKIN_HEADER := 0x07800001 + LINKSYS_MODEL := 60402060 + IMAGES += factory.imag + IMAGE/factory.imag := \ + append-kernel | \ + pad-to 64k | \ + append-rootfs | \ + pad-rootfs | \ + check-size | \ + append-metadata | \ + linksys-image | \ + belkin-header +endef +TARGET_DEVICES += linksys_lgs310c + # "NGE" refers to the uImage magic define Device/netgear_nge KERNEL := \ diff --git a/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch index 7adbbbc517..bb89a7864f 100644 --- a/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch +++ b/target/linux/realtek/patches-6.6/300-mips-add-rtl838x-platform.patch @@ -9,64 +9,67 @@ configurations for the SoCs, which are introduced in addition. Submitted-by: Birger Koblitz <git@birger-koblitz.de> --- - arch/mips/Kbuild.platforms | 1 + - arch/mips/Kconfig | 57 ++++++++++++++ - 2 files changed, 58 insertions(+) - --- a/arch/mips/Kbuild.platforms +++ b/arch/mips/Kbuild.platforms @@ -22,6 +22,7 @@ platform-$(CONFIG_MACH_NINTENDO64) += n6 platform-$(CONFIG_PIC32MZDA) += pic32/ platform-$(CONFIG_RALINK) += ralink/ platform-$(CONFIG_MIKROTIK_RB532) += rb532/ -+platform-$(CONFIG_RTL83XX) += rtl838x/ ++platform-$(CONFIG_MACH_REALTEK_RTL) += rtl838x/ platform-$(CONFIG_SGI_IP22) += sgi-ip22/ platform-$(CONFIG_SGI_IP27) += sgi-ip27/ platform-$(CONFIG_SGI_IP28) += sgi-ip22/ --- a/arch/mips/Kconfig +++ b/arch/mips/Kconfig -@@ -968,8 +968,58 @@ config CAVIUM_OCTEON_SOC - Hikari - Say Y here for most Octeon reference boards. +@@ -620,21 +620,23 @@ config RALINK -+config RTL83XX -+ bool "Realtek based platforms" -+ select DMA_NONCOHERENT -+ select IRQ_MIPS_CPU + config MACH_REALTEK_RTL + bool "Realtek RTL838x/RTL839x based machines" +- select MIPS_GENERIC + select DMA_NONCOHERENT + select IRQ_MIPS_CPU +- select CSRC_R4K +- select CEVT_R4K + select SYS_HAS_CPU_MIPS32_R1 + select SYS_HAS_CPU_MIPS32_R2 + select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_32BIT_KERNEL + select SYS_SUPPORTS_MIPS16 +- select SYS_SUPPORTS_MULTITHREADING +- select SYS_SUPPORTS_VPE_LOADER + select BOOT_RAW + select PINCTRL + select USE_OF + select NO_EXCEPT_FILL -+ select SYS_HAS_CPU_MIPS32_R1 -+ select SYS_HAS_CPU_MIPS32_R2 -+ select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_HIGHMEM -+ select SYS_SUPPORTS_32BIT_KERNEL -+ select SYS_SUPPORTS_MIPS16 + select SYS_HAS_EARLY_PRINTK + select SYS_HAS_EARLY_PRINTK_8250 + select USE_GENERIC_EARLY_PRINTK_8250 -+ select BOOT_RAW -+ select PINCTRL + select ARCH_HAS_RESET_CONTROLLER + select RESET_CONTROLLER -+ select USE_OF -+ + + config SGI_IP22 + bool "SGI IP22 (Indy/Indigo2)" +@@ -970,6 +972,36 @@ config CAVIUM_OCTEON_SOC + endchoice +config RTL838X + bool "Realtek RTL838X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select CPU_SUPPORTS_CPUFREQ + select MIPS_EXTERNAL_TIMER + +config RTL839X + bool "Realtek RTL839X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select CPU_SUPPORTS_CPUFREQ + select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING + +config RTL930X + bool "Realtek RTL930X based platforms" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + select MIPS_CPU_SCACHE + select MIPS_EXTERNAL_TIMER + select SYS_SUPPORTS_MULTITHREADING diff --git a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch index a177876420..f64e2cf94e 100644 --- a/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch +++ b/target/linux/realtek/patches-6.6/301-gpio-add-rtl8231-driver.patch @@ -31,7 +31,7 @@ Submitted-by: John Crispin <john@phrozen.org> +config GPIO_RTL8231 + tristate "RTL8231 GPIO" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Say yes here to support Realtek RTL8231 GPIO expansion chips. + diff --git a/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch b/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch deleted file mode 100644 index 2b466340e6..0000000000 --- a/target/linux/realtek/patches-6.6/303-gpio-update-dependencies-for-gpio-realtek-otto.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 9bac1c20b8f39f2e0e342b087add5093b94feaed Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi <musashino.open@gmail.com> -Date: Wed, 5 May 2021 22:05:39 +0900 -Subject: realtek: backport gpio-realtek-otto driver from 5.13 to 5.10 - -This patch backports "gpio-realtek-otto" driver to Kernel 5.10. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi <musashino.open@gmail.com> ---- - drivers/gpio/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) ---- a/drivers/gpio/Kconfig -+++ b/drivers/gpio/Kconfig -@@ -527,8 +527,8 @@ config GPIO_RDA - - config GPIO_REALTEK_OTTO - tristate "Realtek Otto GPIO support" -- depends on MACH_REALTEK_RTL -- default MACH_REALTEK_RTL -+ depends on RTL83XX -+ default RTL838X - select GPIO_GENERIC - select GPIOLIB_IRQCHIP - help diff --git a/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch b/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch deleted file mode 100644 index 01530257b8..0000000000 --- a/target/linux/realtek/patches-6.6/304-spi-update-dependency-for-spi-realtek-rtl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0b000cbfe0aa0323bffa855ef8449c0687a4c071 Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi <musashino.open@gmail.com> -Date: Thu, 6 May 2021 19:30:58 +0900 -Subject: realtek: backport spi-realtek-rtl driver from 5.12 to 5.10 - -This patch backports "spi-realtek-rtl" driver to Kernel 5.10 from 5.12. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi <musashino.open@gmail.com> ---- - drivers/spi/Makefile | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/spi/Makefile -+++ b/drivers/spi/Makefile -@@ -114,7 +114,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 - obj-$(CONFIG_SPI_RPCIF) += spi-rpc-if.o - obj-$(CONFIG_SPI_RSPI) += spi-rspi.o - obj-$(CONFIG_SPI_RZV2M_CSI) += spi-rzv2m-csi.o diff --git a/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch b/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch deleted file mode 100644 index 0ecc33376e..0000000000 --- a/target/linux/realtek/patches-6.6/305-irqchip-update-dependency-for-irq-realtek-rtl.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 2cd00b51470a30198b048a5fca48a04db77e29cc Mon Sep 17 00:00:00 2001 -From: INAGAKI Hiroshi <musashino.open@gmail.com> -Date: Fri, 21 May 2021 23:16:37 +0900 -Subject: [PATCH] realtek: backport irq-realtek-rtl driver from 5.12 to 5.10 - -This patch backports "irq-realtek-rtl" driver to Kernel 5.10 from 5.12. -"MACH_REALTEK_RTL" is used as a platform name in upstream, but "RTL838X" -is used in OpenWrt, so update the dependency by the additional patch. - -Submitted-by: INAGAKI Hiroshi <musashino.open@gmail.com> ---- - drivers/irqchip/Makefile | 2 +- - 1 files changed, 1 insertion(+), 1 deletion(-) - ---- a/drivers/irqchip/Makefile -+++ b/drivers/irqchip/Makefile -@@ -114,7 +114,7 @@ obj-$(CONFIG_LOONGSON_PCH_MSI) += irq-l - obj-$(CONFIG_LOONGSON_PCH_LPC) += irq-loongson-pch-lpc.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-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch b/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch deleted file mode 100644 index c9dab65b72..0000000000 --- a/target/linux/realtek/patches-6.6/307-wdt-update-dependency-for-realtek-otto-wdt.patch +++ /dev/null @@ -1,32 +0,0 @@ -From b8fc5eecdc5d33cf261986436597b5482ab856da Mon Sep 17 00:00:00 2001 -From: Sander Vanheule <sander@svanheule.net> -Date: Sun, 14 Nov 2021 19:45:32 +0100 -Subject: [PATCH] realtek: Backport Realtek Otto WDT driver - -Add patch submitted upstream to linux-watchdog and replace the MIPS -architecture symbols. Requires one extra patch for the DIV_ROUND_* -macros, which have moved to a different header since 5.10. - -Submitted-by: Sander Vanheule <sander@svanheule.net> -Tested-by: Stijn Segers <foss@volatilesystems.org> -Tested-by: Paul Fertser <fercerpav@gmail.com> -Tested-by: Stijn Tintel <stijn@linux-ipv6.be> ---- - drivers/watchdog/Kconfig | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - ---- a/drivers/watchdog/Kconfig -+++ b/drivers/watchdog/Kconfig -@@ -977,10 +977,10 @@ config RTD119X_WATCHDOG - - config REALTEK_OTTO_WDT - tristate "Realtek Otto MIPS watchdog support" -- depends on MACH_REALTEK_RTL || COMPILE_TEST -+ depends on RTL83XX - depends on COMMON_CLK - select WATCHDOG_CORE -- default MACH_REALTEK_RTL -+ default RTL83XX - help - Say Y here to include support for the watchdog timer on Realtek - RTL838x, RTL839x, RTL930x SoCs. This watchdog has pretimeout diff --git a/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch index 2a799551d6..09255c5721 100644 --- a/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch +++ b/target/linux/realtek/patches-6.6/706-include-linux-add-phy-ops-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin <john@phrozen.org> --- a/include/linux/phy.h +++ b/include/linux/phy.h -@@ -1180,6 +1180,10 @@ struct phy_driver { +@@ -1181,6 +1181,10 @@ struct phy_driver { */ int (*led_polarity_set)(struct phy_device *dev, int index, unsigned long modes); diff --git a/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch index 305981c3ee..a92045ba8a 100644 --- a/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch +++ b/target/linux/realtek/patches-6.6/708-drivers-net-phy-eee-support-for-rtl838x.patch @@ -21,7 +21,7 @@ Submitted-by: John Crispin <john@phrozen.org> --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c -@@ -2484,6 +2484,11 @@ int phylink_ethtool_ksettings_set(struct +@@ -2503,6 +2503,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 <john@phrozen.org> return phy_ethtool_ksettings_set(pl->phydev, &phy_kset); } -@@ -2786,8 +2791,11 @@ int phylink_ethtool_get_eee(struct phyli +@@ -2805,8 +2810,11 @@ int phylink_ethtool_get_eee(struct phyli ASSERT_RTNL(); @@ -46,7 +46,7 @@ Submitted-by: John Crispin <john@phrozen.org> return ret; } -@@ -2804,8 +2812,11 @@ int phylink_ethtool_set_eee(struct phyli +@@ -2823,8 +2831,11 @@ int phylink_ethtool_set_eee(struct phyli ASSERT_RTNL(); diff --git a/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch index 9d79ea565d..e0c10bca63 100644 --- a/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch +++ b/target/linux/realtek/patches-6.6/716-net-ethernet-add-support-for-rtl838x-ethernet.patch @@ -29,7 +29,7 @@ Submitted-by: John Crispin <john@phrozen.org> + +config NET_RTL838X + tristate "Realtek rtl838x Ethernet MAC support" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Say Y here if you want to use the Realtek rtl838x Gbps Ethernet MAC. + diff --git a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch index 78a57f0a3e..43d4a7d4fc 100644 --- a/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch +++ b/target/linux/realtek/patches-6.6/720-add-rtl-phy.patch @@ -20,7 +20,7 @@ Submitted-by: Birger Koblitz <mail@birger-koblitz.de> +config REALTEK_SOC_PHY + tristate "Realtek SoC PHYs" -+ depends on RTL83XX ++ depends on MACH_REALTEK_RTL + help + Supports the PHYs found in combination with Realtek Switch SoCs + diff --git a/target/linux/realtek/rtl838x/config-6.6 b/target/linux/realtek/rtl838x/config-6.6 index ad2c1b43cc..44c1d7e064 100644 --- a/target/linux/realtek/rtl838x/config-6.6 +++ b/target/linux/realtek/rtl838x/config-6.6 @@ -116,6 +116,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -192,7 +193,6 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y CONFIG_RTL838X=y # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y # CONFIG_RTL930X is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y diff --git a/target/linux/realtek/rtl839x/config-6.6 b/target/linux/realtek/rtl839x/config-6.6 index c8d841c01e..630027bf81 100644 --- a/target/linux/realtek/rtl839x/config-6.6 +++ b/target/linux/realtek/rtl839x/config-6.6 @@ -102,8 +102,8 @@ CONFIG_I2C=y CONFIG_I2C_ALGOBIT=y CONFIG_I2C_BOARDINFO=y CONFIG_I2C_GPIO=y -# CONFIG_I2C_RTL9300 is not set # CONFIG_I2C_MUX_RTL9300 is not set +# CONFIG_I2C_RTL9300 is not set CONFIG_INITRAMFS_SOURCE="" CONFIG_IRQCHIP=y CONFIG_IRQ_DOMAIN=y @@ -115,6 +115,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -204,7 +205,6 @@ CONFIG_RFS_ACCEL=y CONFIG_RPS=y # CONFIG_RTL838X is not set CONFIG_RTL839X=y -CONFIG_RTL83XX=y # CONFIG_RTL930X is not set CONFIG_SERIAL_MCTRL_GPIO=y CONFIG_SERIAL_OF_PLATFORM=y diff --git a/target/linux/realtek/rtl930x/config-6.6 b/target/linux/realtek/rtl930x/config-6.6 index af5f2ca7a3..5a29bdc3c1 100644 --- a/target/linux/realtek/rtl930x/config-6.6 +++ b/target/linux/realtek/rtl930x/config-6.6 @@ -97,6 +97,7 @@ CONFIG_JFFS2_ZLIB=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -172,7 +173,6 @@ CONFIG_REGMAP_MMIO=y CONFIG_RESET_CONTROLLER=y # CONFIG_RTL838X is not set # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y CONFIG_RTL930X=y # CONFIG_RTL931X is not set CONFIG_SERIAL_MCTRL_GPIO=y diff --git a/target/linux/realtek/rtl931x/config-6.6 b/target/linux/realtek/rtl931x/config-6.6 index 736f472029..df235defe8 100644 --- a/target/linux/realtek/rtl931x/config-6.6 +++ b/target/linux/realtek/rtl931x/config-6.6 @@ -106,6 +106,7 @@ CONFIG_KMAP_LOCAL=y CONFIG_LEDS_GPIO=y CONFIG_LIBFDT=y CONFIG_LOCK_DEBUGGING_SUPPORT=y +CONFIG_MACH_REALTEK_RTL=y CONFIG_MARVELL_PHY=y CONFIG_MDIO_BUS=y CONFIG_MDIO_DEVICE=y @@ -195,7 +196,6 @@ CONFIG_RFS_ACCEL=y CONFIG_RPS=y # CONFIG_RTL838X is not set # CONFIG_RTL839X is not set -CONFIG_RTL83XX=y CONFIG_RTL930X=y CONFIG_RTL931X=y CONFIG_SENSORS_GPIO_FAN=y |