From: Birger Koblitz <git@birger-koblitz.de>
Date: Wed, 29 Dec 2021 20:54:21 +0000 (+0100)
Subject: realtek: Create 4 different Realtek Platforms
X-Git-Tag: v22.03.0-rc1~476
X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=fce11f68491b46b93df69de0630cd9edb90bc772;p=openwrt%2Fopenwrt.git

realtek: Create 4 different Realtek Platforms

Creates RTL83XX as a basic kernel config parameter for the
RTL838X, RTL839x, RTL930X and RTL931X platforms with respective
configurations for the SoCs, which are introduced in addition.

Signed-off-by: Birger Koblitz <git@birger-koblitz.de>
---

diff --git a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/Kconfig b/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/Kconfig
index b423d2c3ea..281f08054f 100644
--- a/target/linux/realtek/files-5.10/drivers/net/dsa/rtl83xx/Kconfig
+++ b/target/linux/realtek/files-5.10/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 RTL838X
+	depends on RTL83XX
 	select NET_DSA_TAG_TRAILER
 	help
 	  This driver adds support for Realtek RTL83xx series switching.
diff --git a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch
index 291636ce7b..8292c82ef1 100644
--- a/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch
+++ b/target/linux/realtek/patches-5.10/300-mips-add-rtl838x-platform.patch
@@ -4,25 +4,24 @@
  platform-$(CONFIG_MACH_PISTACHIO)	+= pistachio/
  platform-$(CONFIG_RALINK)		+= ralink/
  platform-$(CONFIG_MIKROTIK_RB532)	+= rb532/
-+platform-$(CONFIG_RTL838X)		+= rtl838x/
++platform-$(CONFIG_RTL83XX)		+= 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
-@@ -632,6 +632,26 @@ config RALINK
- 	select ARCH_HAS_RESET_CONTROLLER
- 	select RESET_CONTROLLER
+@@ -1037,8 +1037,58 @@ config NLM_XLP_BOARD
+ 	  This board is based on Netlogic XLP Processor.
+ 	  Say Y here if you have a XLP based board.
  
-+config RTL838X
++config RTL83XX
 +	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_HIGHMEM
 +	select SYS_SUPPORTS_32BIT_KERNEL
 +	select SYS_SUPPORTS_MIPS16
 +	select SYS_HAS_EARLY_PRINTK
@@ -34,6 +33,49 @@
 +	select RESET_CONTROLLER
 +	select USE_OF
 +
- config SGI_IP22
- 	bool "SGI IP22 (Indy/Indigo2)"
- 	select ARC_MEMORY
+ endchoice
+ 
++config RTL838X
++	bool "Realtek RTL838X based platforms"
++	depends on RTL83XX
++	select CSRC_R4K
++	select CEVT_R4K
++
++config RTL839X
++	bool "Realtek RTL839X based platforms"
++	depends on RTL83XX
++	select CSRC_R4K
++	select CEVT_R4K
++	select SYS_SUPPORTS_MULTITHREADING
++
++config RTL930X
++	bool "Realtek RTL839X based platforms"
++	depends on RTL83XX
++	select MIPS_CPU_SCACHE
++	select CSRC_R4K
++	select CEVT_RTL9300
++	select SYS_SUPPORTS_MULTITHREADING
++
++config RTL931X
++	bool "Realtek RTL931X based platforms"
++	depends on RTL930X
++	select MIPS_GIC
++	select COMMON_CLK
++	select CLKSRC_MIPS_GIC
++	select SYS_SUPPORTS_VPE_LOADER
++	select SYS_SUPPORTS_SMP
++	select SYS_SUPPORTS_MIPS_CPS
++
+ source "arch/mips/alchemy/Kconfig"
+ source "arch/mips/ath25/Kconfig"
+ source "arch/mips/ath79/Kconfig"
+@@ -1097,6 +1147,9 @@ config CEVT_GT641XX
+ config CEVT_R4K
+ 	bool
+ 
++config CEVT_RTL9300
++	bool
++
+ config CEVT_SB1250
+ 	bool
+ 
diff --git a/target/linux/realtek/patches-5.10/301-gpio-add-rtl8231-driver.patch b/target/linux/realtek/patches-5.10/301-gpio-add-rtl8231-driver.patch
index 496d3f4162..cdecb2a112 100644
--- a/target/linux/realtek/patches-5.10/301-gpio-add-rtl8231-driver.patch
+++ b/target/linux/realtek/patches-5.10/301-gpio-add-rtl8231-driver.patch
@@ -6,7 +6,7 @@
  
 +config GPIO_RTL8231
 +	tristate "RTL8231 GPIO"
-+	depends on RTL838X
++	depends on RTL83XX
 +	help
 +	  Say yes here to support Realtek RTL8231 GPIO expansion chips.
 +
diff --git a/target/linux/realtek/patches-5.10/303-gpio-update-dependencies-for-gpio-realtek-otto.patch b/target/linux/realtek/patches-5.10/303-gpio-update-dependencies-for-gpio-realtek-otto.patch
index 4ff98e44e8..b6678e71fe 100644
--- a/target/linux/realtek/patches-5.10/303-gpio-update-dependencies-for-gpio-realtek-otto.patch
+++ b/target/linux/realtek/patches-5.10/303-gpio-update-dependencies-for-gpio-realtek-otto.patch
@@ -6,7 +6,7 @@
  	tristate "Realtek Otto GPIO support"
 -	depends on MACH_REALTEK_RTL
 -	default MACH_REALTEK_RTL
-+	depends on RTL838X
++	depends on RTL83XX
 +	default RTL838X
  	select GPIO_GENERIC
  	select GPIOLIB_IRQCHIP
diff --git a/target/linux/realtek/patches-5.10/304-spi-update-dependency-for-spi-realtek-rtl.patch b/target/linux/realtek/patches-5.10/304-spi-update-dependency-for-spi-realtek-rtl.patch
index 6975bfd228..2d8cf9e7cb 100644
--- a/target/linux/realtek/patches-5.10/304-spi-update-dependency-for-spi-realtek-rtl.patch
+++ b/target/linux/realtek/patches-5.10/304-spi-update-dependency-for-spi-realtek-rtl.patch
@@ -5,7 +5,7 @@
  obj-$(CONFIG_SPI_ROCKCHIP)		+= spi-rockchip.o
  obj-$(CONFIG_SPI_RB4XX)			+= spi-rb4xx.o
 -obj-$(CONFIG_MACH_REALTEK_RTL)		+= spi-realtek-rtl.o
-+obj-$(CONFIG_RTL838X)			+= 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_S3C24XX)		+= spi-s3c24xx-hw.o
diff --git a/target/linux/realtek/patches-5.10/305-irqchip-update-dependency-for-irq-realtek-rtl.patch b/target/linux/realtek/patches-5.10/305-irqchip-update-dependency-for-irq-realtek-rtl.patch
index 96321f0bba..ebab9792fc 100644
--- a/target/linux/realtek/patches-5.10/305-irqchip-update-dependency-for-irq-realtek-rtl.patch
+++ b/target/linux/realtek/patches-5.10/305-irqchip-update-dependency-for-irq-realtek-rtl.patch
@@ -5,4 +5,4 @@
  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_RTL838X)			+= irq-realtek-rtl.o
++obj-$(CONFIG_RTL83XX)			+= irq-realtek-rtl.o
diff --git a/target/linux/realtek/patches-5.10/307-wdt-update-dependency-for-realtek-otto-wdt.patch b/target/linux/realtek/patches-5.10/307-wdt-update-dependency-for-realtek-otto-wdt.patch
index f4496ed294..0b8699c130 100644
--- a/target/linux/realtek/patches-5.10/307-wdt-update-dependency-for-realtek-otto-wdt.patch
+++ b/target/linux/realtek/patches-5.10/307-wdt-update-dependency-for-realtek-otto-wdt.patch
@@ -5,11 +5,11 @@
  config REALTEK_OTTO_WDT
  	tristate "Realtek Otto MIPS watchdog support"
 -	depends on MACH_REALTEK_RTL || COMPILE_TEST
-+	depends on RTL838X
++	depends on RTL83XX
  	depends on COMMON_CLK
  	select WATCHDOG_CORE
 -	default MACH_REALTEK_RTL
-+	default RTL838X
++	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-5.10/702-net-ethernet-add-support-for-rtl838x-ethernet.patch b/target/linux/realtek/patches-5.10/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
index 4c5f397e10..f76f8e39a9 100644
--- a/target/linux/realtek/patches-5.10/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
+++ b/target/linux/realtek/patches-5.10/702-net-ethernet-add-support-for-rtl838x-ethernet.patch
@@ -7,7 +7,7 @@
 +
 +config NET_RTL838X
 +	tristate "Realtek rtl838x Ethernet MAC support"
-+	depends on RTL838X
++	depends on RTL83XX
 +	help
 +	  Say Y here if you want to use the Realtek rtl838x Gbps Ethernet MAC.
 +
diff --git a/target/linux/realtek/patches-5.10/705-add-rtl-phy.patch b/target/linux/realtek/patches-5.10/705-add-rtl-phy.patch
index 2dc4cb0077..4f907e1d4b 100644
--- a/target/linux/realtek/patches-5.10/705-add-rtl-phy.patch
+++ b/target/linux/realtek/patches-5.10/705-add-rtl-phy.patch
@@ -6,7 +6,7 @@
  
 +config REALTEK_SOC_PHY
 +	tristate "Realtek SoC PHYs"
-+	depends on RTL838X
++	depends on RTL83XX
 +	help
 +	  Supports the PHYs found in combination with Realtek Switch SoCs
 +
diff --git a/target/linux/realtek/rtl838x/config-5.10 b/target/linux/realtek/rtl838x/config-5.10
index 07907d52b2..e3e69900af 100644
--- a/target/linux/realtek/rtl838x/config-5.10
+++ b/target/linux/realtek/rtl838x/config-5.10
@@ -168,7 +168,11 @@ CONFIG_REALTEK_SOC_PHY=y
 CONFIG_REGMAP=y
 CONFIG_REGMAP_MMIO=y
 CONFIG_RESET_CONTROLLER=y
+CONFIG_RTL83XX=y
 CONFIG_RTL838X=y
+# CONFIG_RTL839X is not set
+# CONFIG_RTL930X is not set
+# CONFIG_RTL931X is not set
 CONFIG_RTL9300_TIMER=y
 CONFIG_SERIAL_MCTRL_GPIO=y
 CONFIG_SERIAL_OF_PLATFORM=y