aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/rtl838x/patches-5.4
diff options
context:
space:
mode:
authorBirger Koblitz <git@birger-koblitz.de>2020-09-13 09:06:13 +0200
committerJohn Crispin <john@phrozen.org>2020-09-14 07:54:30 +0200
commitdf8e6be59a1fbce3f8c6878fe7440a129b1245d6 (patch)
treef7dc2da525ff9ef48b5609e96484c759a5b38e6f /target/linux/rtl838x/patches-5.4
parent7bb1bd469e98ba4bfd0cf774a82c35039c9b721a (diff)
downloadupstream-df8e6be59a1fbce3f8c6878fe7440a129b1245d6.tar.gz
upstream-df8e6be59a1fbce3f8c6878fe7440a129b1245d6.tar.bz2
upstream-df8e6be59a1fbce3f8c6878fe7440a129b1245d6.zip
rtl838x: add new architecture
This adds support for the RTL838x Architecture. SoCs of this type are used in managed and un-managed Switches and Routers with 8-28 ports. Drivers are provided for SoC initialization, GPIOs, Flash, Ethernet including a DSA switch driver and internal and external PHYs used with these switches. Supported SoCs: RTL8380M RTL8381M RTL8382M The kernel will also boot on the following RTL839x SoCs, however driver support apart from spi-nor is missing: RTL8390 RTL8391 RTL8393 The following PHYs are supported: RTL8214FC (Quad QSGMII multiplexing GMAC and SFP port) RTL8218B internal: internal PHY of the RTL838x chips RTL8318b external (QSGMII 8-port GMAC phy) RTL8382M SerDes for 2 SFP ports Initialization sequences for the PHYs are provided in the form of firmware files. Flash driver supports 3 / 4 byte access DSA switch driver supports VLANs, port isolation, STP and port mirroring. The ALLNET ALL-SG8208M is supported as Proof of Concept: RTL8382M SoC 1 MIPS 4KEc core @ 500MHz 8 Internal PHYs (RTL8218B) 128MB DRAM (Nanya NT5TU128MB) 16MB NOR Flash (MXIC 25L128) 8 GBEthernet ports with one green status LED each (SoC controlled) 1 Power LED (not configurable) 1 SYS LED (configurable) 1 On-Off switch (not configurable) 1 Reset button at the right behind right air-vent (not configurable) 1 Reset button on front panel (configurable) 12V 1A barrel connector 1 serial header with populated standard pin connector and with markings GND TX RX Vcc(3.3V), connection properties: 115200 8N1 To install, upload the sysupgrade image to the OEM webpage. Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
Diffstat (limited to 'target/linux/rtl838x/patches-5.4')
-rw-r--r--target/linux/rtl838x/patches-5.4/300-mips-add-rtl838x-platform.patch42
-rw-r--r--target/linux/rtl838x/patches-5.4/301-gpio-add-rtl838x-driver.patch25
-rw-r--r--target/linux/rtl838x/patches-5.4/400-mtd-add-rtl838x-spi-flash-driver.patch23
-rw-r--r--target/linux/rtl838x/patches-5.4/700-net-dsa-add-support-for-rtl838x-switch.patch26
-rw-r--r--target/linux/rtl838x/patches-5.4/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch37
-rw-r--r--target/linux/rtl838x/patches-5.4/702-net-dsa-increase-dsa-max-ports-for-rtl838x.patch13
-rw-r--r--target/linux/rtl838x/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch26
-rw-r--r--target/linux/rtl838x/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch13
-rw-r--r--target/linux/rtl838x/patches-5.4/704-drivers-net-phy-eee-support-for-rtl838x.patch41
9 files changed, 246 insertions, 0 deletions
diff --git a/target/linux/rtl838x/patches-5.4/300-mips-add-rtl838x-platform.patch b/target/linux/rtl838x/patches-5.4/300-mips-add-rtl838x-platform.patch
new file mode 100644
index 0000000000..34fb959a50
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/300-mips-add-rtl838x-platform.patch
@@ -0,0 +1,42 @@
+--- a/arch/mips/Kbuild.platforms
++++ b/arch/mips/Kbuild.platforms
+@@ -27,6 +27,7 @@ platforms += pistachio
+ platforms += pmcs-msp71xx
+ platforms += pnx833x
+ platforms += ralink
++platforms += rtl838x
+ platforms += rb532
+ platforms += sgi-ip22
+ platforms += sgi-ip27
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -629,6 +629,29 @@ config RALINK
+ select ARCH_HAS_RESET_CONTROLLER
+ select RESET_CONTROLLER
+
++config RTL838X
++ bool "Realtek based platforms"
++ 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 SYS_HAS_EARLY_PRINTK
++ select SWAP_IO_SPACE
++ select BOOT_RAW
++ select CLKDEV_LOOKUP
++ select PINCTRL
++ select ARCH_HAS_RESET_CONTROLLER
++ select RESET_CONTROLLER
++ select RTL8380_SERIES
++ select USE_OF
++
+ config SGI_IP22
+ bool "SGI IP22 (Indy/Indigo2)"
+ select FW_ARC
diff --git a/target/linux/rtl838x/patches-5.4/301-gpio-add-rtl838x-driver.patch b/target/linux/rtl838x/patches-5.4/301-gpio-add-rtl838x-driver.patch
new file mode 100644
index 0000000000..5eb8521ccb
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/301-gpio-add-rtl838x-driver.patch
@@ -0,0 +1,25 @@
+--- a/drivers/gpio/Kconfig
++++ b/drivers/gpio/Kconfig
+@@ -441,6 +441,12 @@
+ A 32-bit single register GPIO fixed in/out implementation. This
+ can be used to represent any register as a set of GPIO signals.
+
++config GPIO_RTL838X
++ tristate "RTL838X GPIO"
++ depends on RTL838X
++ help
++ Say yes here to support RTL838X GPIO devices.
++
+ config GPIO_SAMA5D2_PIOBU
+ tristate "SAMA5D2 PIOBU GPIO support"
+ depends on MFD_SYSCON
+--- a/drivers/gpio/Makefile
++++ b/drivers/gpio/Makefile
+@@ -117,6 +117,7 @@
+ obj-$(CONFIG_GPIO_RCAR) += gpio-rcar.o
+ obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
+ obj-$(CONFIG_GPIO_REG) += gpio-reg.o
++obj-$(CONFIG_GPIO_RTL838X) += gpio-rtl838x.o
+ obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
+ obj-$(CONFIG_GPIO_SAMA5D2_PIOBU) += gpio-sama5d2-piobu.o
+ obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o
diff --git a/target/linux/rtl838x/patches-5.4/400-mtd-add-rtl838x-spi-flash-driver.patch b/target/linux/rtl838x/patches-5.4/400-mtd-add-rtl838x-spi-flash-driver.patch
new file mode 100644
index 0000000000..16cff75308
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/400-mtd-add-rtl838x-spi-flash-driver.patch
@@ -0,0 +1,23 @@
+--- a/drivers/mtd/spi-nor/Kconfig
++++ b/drivers/mtd/spi-nor/Kconfig
+@@ -118,4 +118,13 @@ config SPI_INTEL_SPI_PLATFORM
+ To compile this driver as a module, choose M here: the module
+ will be called intel-spi-platform.
+
++config SPI_RTL838X
++ tristate "Realtek RTl838X SPI flash platform driver"
++ depends on RTL838X
++ help
++ This driver provides support for accessing SPI flash
++ in the RTL838X SoC.
++
++ Say N here unless you know what you are doing.
++
+ endif # MTD_SPI_NOR
+--- a/drivers/mtd/spi-nor/Makefile
++++ b/drivers/mtd/spi-nor/Makefile
+@@ -8,3 +8,4 @@ obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi
+ obj-$(CONFIG_SPI_INTEL_SPI) += intel-spi.o
+ obj-$(CONFIG_SPI_INTEL_SPI_PCI) += intel-spi-pci.o
+ obj-$(CONFIG_SPI_INTEL_SPI_PLATFORM) += intel-spi-platform.o
++obj-$(CONFIG_SPI_RTL838X) += rtl838x-nor.o
diff --git a/target/linux/rtl838x/patches-5.4/700-net-dsa-add-support-for-rtl838x-switch.patch b/target/linux/rtl838x/patches-5.4/700-net-dsa-add-support-for-rtl838x-switch.patch
new file mode 100644
index 0000000000..0082176d83
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/700-net-dsa-add-support-for-rtl838x-switch.patch
@@ -0,0 +1,26 @@
+--- a/drivers/net/dsa/Kconfig
++++ b/drivers/net/dsa/Kconfig
+@@ -74,6 +74,13 @@ config NET_DSA_REALTEK_SMI
+ This enables support for the Realtek SMI-based switch
+ chips, currently only RTL8366RB.
+
++config NET_DSA_RTL838X
++ tristate "Realtek rtl838x switch support"
++ depends on RTL838X
++ select NET_DSA_TAG_TRAILER
++ ---help---
++ Say Y here if you want to use the Realtek rtl838x switch.
++
+ config NET_DSA_SMSC_LAN9303
+ tristate
+ select NET_DSA_TAG_LAN9303
+--- a/drivers/net/dsa/Makefile
++++ b/drivers/net/dsa/Makefile
+@@ -11,6 +11,7 @@ obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e
+ obj-$(CONFIG_NET_DSA_QCA8K) += qca8k.o
+ obj-$(CONFIG_NET_DSA_REALTEK_SMI) += realtek-smi.o
+ realtek-smi-objs := realtek-smi-core.o rtl8366.o rtl8366rb.o
++obj-$(CONFIG_NET_DSA_RTL838X) += rtl838x_sw.o rtl838x_phy.o
+ obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
+ obj-$(CONFIG_NET_DSA_SMSC_LAN9303_I2C) += lan9303_i2c.o
+ obj-$(CONFIG_NET_DSA_SMSC_LAN9303_MDIO) += lan9303_mdio.o
diff --git a/target/linux/rtl838x/patches-5.4/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch b/target/linux/rtl838x/patches-5.4/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch
new file mode 100644
index 0000000000..d45c547803
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/701-net-dsa-add-rtl838x-support-for-tag-trailer.patch
@@ -0,0 +1,37 @@
+--- a/net/dsa/tag_trailer.c
++++ b/net/dsa/tag_trailer.c
+@@ -44,7 +44,12 @@ static struct sk_buff *trailer_xmit(stru
+
+ trailer = skb_put(nskb, 4);
+ trailer[0] = 0x80;
++
++#ifdef CONFIG_NET_DSA_RTL838X
++ trailer[1] = dp->index;
++#else
+ trailer[1] = 1 << dp->index;
++#endif /* CONFIG_NET_DSA_RTL838X */
+ trailer[2] = 0x10;
+ trailer[3] = 0x00;
+
+@@ -61,12 +66,20 @@ static struct sk_buff *trailer_rcv(struc
+ return NULL;
+
+ trailer = skb_tail_pointer(skb) - 4;
++
++#ifdef CONFIG_NET_DSA_RTL838X
++ if (trailer[0] != 0x80 || (trailer[1] & 0xe0) != 0x00 ||
++ (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
++ return NULL;
++
++ source_port = trailer[1] & 0x1f;
++#else
+ if (trailer[0] != 0x80 || (trailer[1] & 0xf8) != 0x00 ||
+ (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
+ return NULL;
+
+ source_port = trailer[1] & 7;
+-
++#endif
+ skb->dev = dsa_master_find_slave(dev, 0, source_port);
+ if (!skb->dev)
+ return NULL;
diff --git a/target/linux/rtl838x/patches-5.4/702-net-dsa-increase-dsa-max-ports-for-rtl838x.patch b/target/linux/rtl838x/patches-5.4/702-net-dsa-increase-dsa-max-ports-for-rtl838x.patch
new file mode 100644
index 0000000000..5329dcad59
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/702-net-dsa-increase-dsa-max-ports-for-rtl838x.patch
@@ -0,0 +1,13 @@
+Index: linux-5.4.24/include/linux/platform_data/dsa.h
+===================================================================
+--- linux-5.4.24.orig/include/linux/platform_data/dsa.h
++++ linux-5.4.24/include/linux/platform_data/dsa.h
+@@ -6,7 +6,7 @@ struct device;
+ struct net_device;
+
+ #define DSA_MAX_SWITCHES 4
+-#define DSA_MAX_PORTS 12
++#define DSA_MAX_PORTS 54
+ #define DSA_RTABLE_NONE -1
+
+ struct dsa_chip_data {
diff --git a/target/linux/rtl838x/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/rtl838x/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
new file mode 100644
index 0000000000..11e62450d5
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
@@ -0,0 +1,26 @@
+--- a/drivers/net/ethernet/Kconfig
++++ b/drivers/net/ethernet/Kconfig
+@@ -163,6 +163,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"
++
++config NET_RTL838X
++ tristate "Realtek rtl838x Ethernet MAC support"
++ depends on RTL838X
++ ---help---
++ Say Y here if you want to use the Realtek rtl838x Gbps Ethernet MAC.
++
+ source "drivers/net/ethernet/samsung/Kconfig"
+ source "drivers/net/ethernet/seeq/Kconfig"
+ source "drivers/net/ethernet/sfc/Kconfig"
+--- a/drivers/net/ethernet/Makefile
++++ b/drivers/net/ethernet/Makefile
+@@ -76,6 +76,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/
++obj-$(CONFIG_NET_RTL838X) += rtl838x_eth.o
+ obj-$(CONFIG_NET_VENDOR_SAMSUNG) += samsung/
+ obj-$(CONFIG_NET_VENDOR_SEEQ) += seeq/
+ obj-$(CONFIG_NET_VENDOR_SILAN) += silan/
diff --git a/target/linux/rtl838x/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch b/target/linux/rtl838x/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch
new file mode 100644
index 0000000000..db8b0403f7
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/703-include-linux-add-phy-ops-for-rtl838x.patch
@@ -0,0 +1,13 @@
+--- a/include/linux/phy.h
++++ b/include/linux/phy.h
+@@ -628,6 +628,10 @@
+ struct ethtool_tunable *tuna,
+ const void *data);
+ int (*set_loopback)(struct phy_device *dev, bool enable);
++ int (*get_port)(struct phy_device *dev);
++ int (*set_port)(struct phy_device *dev, int port);
++ int (*get_eee)(struct phy_device *dev, struct ethtool_eee *e);
++ int (*set_eee)(struct phy_device *dev, struct ethtool_eee *e);
+ };
+ #define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
+ struct phy_driver, mdiodrv)
diff --git a/target/linux/rtl838x/patches-5.4/704-drivers-net-phy-eee-support-for-rtl838x.patch b/target/linux/rtl838x/patches-5.4/704-drivers-net-phy-eee-support-for-rtl838x.patch
new file mode 100644
index 0000000000..5262be53c6
--- /dev/null
+++ b/target/linux/rtl838x/patches-5.4/704-drivers-net-phy-eee-support-for-rtl838x.patch
@@ -0,0 +1,41 @@
+--- a/drivers/net/phy/phylink.c
++++ b/drivers/net/phy/phylink.c
+@@ -1244,6 +1244,11 @@
+
+ /* If we have a PHY, configure the phy */
+ if (pl->phydev) {
++ if (pl->phydev->drv->get_port && pl->phydev->drv->set_port) {
++ if(pl->phydev->drv->get_port(pl->phydev) != kset->base.port) {
++ pl->phydev->drv->set_port(pl->phydev, kset->base.port);
++ }
++ }
+ ret = phy_ethtool_ksettings_set(pl->phydev, &our_kset);
+ if (ret)
+ return ret;
+@@ -1422,8 +1427,11 @@
+
+ ASSERT_RTNL();
+
+- if (pl->phydev)
++ if (pl->phydev) {
++ if (pl->phydev->drv->get_eee)
++ return pl->phydev->drv->get_eee(pl->phydev, eee);
+ ret = phy_ethtool_get_eee(pl->phydev, eee);
++ }
+
+ return ret;
+ }
+@@ -1440,9 +1448,11 @@
+
+ ASSERT_RTNL();
+
+- if (pl->phydev)
++ if (pl->phydev) {
++ if (pl->phydev->drv->set_eee)
++ return pl->phydev->drv->set_eee(pl->phydev, eee);
+ ret = phy_ethtool_set_eee(pl->phydev, eee);
+-
++ }
+ return ret;
+ }
+ EXPORT_SYMBOL_GPL(phylink_ethtool_set_eee);