Initial commit
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
Some checks failed
Build Kernel / Build all affected Kernels (push) Has been cancelled
Build all core packages / Build all core packages for selected target (push) Has been cancelled
Build and Push prebuilt tools container / Build and Push all prebuilt containers (push) Has been cancelled
Build Toolchains / Build Toolchains for each target (push) Has been cancelled
Build host tools / Build host tools for linux and macos based systems (push) Has been cancelled
Coverity scan build / Coverity x86/64 build (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
From fce11f68491b46b93df69de0630cd9edb90bc772 Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Wed, 29 Dec 2021 21:54:21 +0100
|
||||
Subject: [PATCH] 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.
|
||||
|
||||
Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
---
|
||||
--- 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_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
|
||||
@@ -620,21 +620,23 @@ config RALINK
|
||||
|
||||
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_SUPPORTS_HIGHMEM
|
||||
+ select SYS_HAS_EARLY_PRINTK
|
||||
+ select SYS_HAS_EARLY_PRINTK_8250
|
||||
+ select USE_GENERIC_EARLY_PRINTK_8250
|
||||
+ select ARCH_HAS_RESET_CONTROLLER
|
||||
+ select RESET_CONTROLLER
|
||||
|
||||
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 MACH_REALTEK_RTL
|
||||
+ select CPU_SUPPORTS_CPUFREQ
|
||||
+ select MIPS_EXTERNAL_TIMER
|
||||
+
|
||||
+config RTL839X
|
||||
+ bool "Realtek RTL839X based platforms"
|
||||
+ 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 MACH_REALTEK_RTL
|
||||
+ select MIPS_CPU_SCACHE
|
||||
+ select MIPS_EXTERNAL_TIMER
|
||||
+ 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"
|
||||
@@ -0,0 +1,50 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: [PATCH] realtek: update the tree to the latest refactored version
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
drivers/gpio/Kconfig | 6 ++++++
|
||||
drivers/gpio/Makefile | 1 +
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/gpio/Kconfig
|
||||
+++ b/drivers/gpio/Kconfig
|
||||
@@ -553,6 +553,12 @@ config GPIO_ROCKCHIP
|
||||
help
|
||||
Say yes here to support GPIO on Rockchip SoCs.
|
||||
|
||||
+config GPIO_RTL8231
|
||||
+ tristate "RTL8231 GPIO"
|
||||
+ depends on MACH_REALTEK_RTL
|
||||
+ help
|
||||
+ Say yes here to support Realtek RTL8231 GPIO expansion chips.
|
||||
+
|
||||
config GPIO_SAMA5D2_PIOBU
|
||||
tristate "SAMA5D2 PIOBU GPIO support"
|
||||
depends on MFD_SYSCON
|
||||
--- a/drivers/gpio/Makefile
|
||||
+++ b/drivers/gpio/Makefile
|
||||
@@ -138,6 +138,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
|
||||
obj-$(CONFIG_GPIO_SCH311X) += gpio-sch311x.o
|
||||
@@ -0,0 +1,93 @@
|
||||
From 3cc8011171186d906c547bc6f0c1f8e350edc7cf Mon Sep 17 00:00:00 2001
|
||||
From: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
Date: Mon, 3 Oct 2022 14:45:21 +0200
|
||||
Subject: [PATCH] realtek: resurrect timer driver
|
||||
|
||||
Now that we provide a clock driver for the Reltek SOCs the CPU frequency might
|
||||
change on demand. This has direct visible effects during operation
|
||||
|
||||
- the CEVT 4K timer is no longer a stable clocksource
|
||||
- after CPU frequencies changes time calculation works wrong
|
||||
- sched_clock falls back to kernel default interval (100 Hz)
|
||||
- timestamps in dmesg have only 2 digits left
|
||||
|
||||
[ 0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps ...
|
||||
[ 0.060000] pid_max: default: 32768 minimum: 301
|
||||
[ 0.070000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
|
||||
[ 0.070000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
|
||||
[ 0.080000] dyndbg: Ignore empty _ddebug table in a CONFIG_DYNAMIC_DEBUG_CORE build
|
||||
[ 0.090000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, ...
|
||||
|
||||
Looking around where we can start the CEVT timer for RTL930X is a good basis.
|
||||
Initially it was developed as a clocksource driver for the broken timer in that
|
||||
specific SOC series. Afterwards it was shifted around to the CEVT location,
|
||||
got SMP enablement and lost its clocksource feature. So we at least have
|
||||
something to copy from. As the timers on these devices are well understood
|
||||
the implementation follows this way:
|
||||
|
||||
- leave the RTL930X implementation as is
|
||||
- provide a new driver for RTL83XX devices only
|
||||
- swap RTL930X driver at a later time
|
||||
|
||||
Like the clock driver this patch contains a self contained module that is SOC
|
||||
independet and already provides full support for the RTL838X, RTL839X and
|
||||
RTL930X devices. Some of the new (or reestablished) features are:
|
||||
|
||||
- simplified initialization routines
|
||||
- SMP setup with CPU hotplug framework
|
||||
- derived from LXB clock speed
|
||||
- supplied clocksource
|
||||
- dedicated register functions for better readability
|
||||
- documentation about some caveats
|
||||
|
||||
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
[remove unused header includes, remove old CONFIG_MIPS dependency, add
|
||||
REALTEK_ prefix to driver symbol]
|
||||
Signed-off-by: Sander Vanheule <sander@svanheule.net>
|
||||
|
||||
---
|
||||
drivers/clocksource/Kconfig | 12 +++
|
||||
drivers/clocksource/Makefile | 1 +
|
||||
include/linux/cpuhotplug.h | 1 +
|
||||
3 files changed, 14 insertions(+)
|
||||
|
||||
--- a/drivers/clocksource/Kconfig
|
||||
+++ b/drivers/clocksource/Kconfig
|
||||
@@ -134,6 +134,17 @@ config RDA_TIMER
|
||||
help
|
||||
Enables the support for the RDA Micro timer driver.
|
||||
|
||||
+config REALTEK_OTTO_TIMER
|
||||
+ bool "Clocksource/timer for the Realtek Otto platform"
|
||||
+ select COMMON_CLK
|
||||
+ select TIMER_OF
|
||||
+ help
|
||||
+ This driver adds support for the timers found in the Realtek RTL83xx
|
||||
+ and RTL93xx SoCs series. This includes chips such as RTL8380, RTL8381
|
||||
+ and RTL832, as well as chips from the RTL839x series, such as RTL8390
|
||||
+ RT8391, RTL8392, RTL8393 and RTL8396 and chips of the RTL930x series
|
||||
+ such as RTL9301, RTL9302 or RTL9303.
|
||||
+
|
||||
config SUN4I_TIMER
|
||||
bool "Sun4i timer driver" if COMPILE_TEST
|
||||
depends on HAS_IOMEM
|
||||
--- a/drivers/clocksource/Makefile
|
||||
+++ b/drivers/clocksource/Makefile
|
||||
@@ -59,6 +59,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
|
||||
+obj-$(CONFIG_REALTEK_OTTO_TIMER) += timer-rtl-otto.o
|
||||
|
||||
obj-$(CONFIG_ARC_TIMERS) += arc_timer.o
|
||||
obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o
|
||||
--- a/include/linux/cpuhotplug.h
|
||||
+++ b/include/linux/cpuhotplug.h
|
||||
@@ -181,6 +181,7 @@ enum cpuhp_state {
|
||||
CPUHP_AP_MARCO_TIMER_STARTING,
|
||||
CPUHP_AP_MIPS_GIC_TIMER_STARTING,
|
||||
CPUHP_AP_ARC_TIMER_STARTING,
|
||||
+ CPUHP_AP_REALTEK_TIMER_STARTING,
|
||||
CPUHP_AP_RISCV_TIMER_STARTING,
|
||||
CPUHP_AP_CLINT_TIMER_STARTING,
|
||||
CPUHP_AP_CSKY_TIMER_STARTING,
|
||||
@@ -0,0 +1,46 @@
|
||||
From 63a0a4d85bc900464c5b046b13808a582345f8c8 Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Sat, 11 Dec 2021 20:14:47 +0100
|
||||
Subject: [PATCH] realtek: Add support for RTL9300/RTL9310 I2C controller
|
||||
|
||||
This adds support for the RTL9300 and RTL9310 I2C controller.
|
||||
The controller implements the SMBus protocol for SMBus transfers
|
||||
over an I2C bus. The driver supports selecting one of the 2 possible
|
||||
SCL pins and any of the 8 possible SDA pins. Bus speeds of
|
||||
100kHz (standard speed) and 400kHz (high speed I2C) are supported.
|
||||
|
||||
Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
---
|
||||
drivers/i2c/busses/Kconfig | 10 +++++++++
|
||||
drivers/i2c/busses/Makefile | 1 +
|
||||
2 files changed, 11 insertions(+)
|
||||
|
||||
--- a/drivers/i2c/busses/Kconfig
|
||||
+++ b/drivers/i2c/busses/Kconfig
|
||||
@@ -1021,6 +1021,16 @@ config I2C_RK3X
|
||||
This driver can also be built as a module. If so, the module will
|
||||
be called i2c-rk3x.
|
||||
|
||||
+config I2C_RTL9300
|
||||
+ tristate "Realtek RTL9300 I2C adapter"
|
||||
+ depends on OF
|
||||
+ help
|
||||
+ Say Y here to include support for the I2C adapter in Realtek RTL9300
|
||||
+ and RTL9310 SoCs.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module will
|
||||
+ be called i2c-rtl9300.
|
||||
+
|
||||
config I2C_RZV2M
|
||||
tristate "Renesas RZ/V2M adapter"
|
||||
depends on ARCH_RENESAS || COMPILE_TEST
|
||||
--- a/drivers/i2c/busses/Makefile
|
||||
+++ b/drivers/i2c/busses/Makefile
|
||||
@@ -101,6 +101,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
|
||||
+obj-$(CONFIG_I2C_RTL9300) += i2c-rtl9300.o
|
||||
obj-$(CONFIG_I2C_RZV2M) += i2c-rzv2m.o
|
||||
obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
|
||||
obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
|
||||
@@ -0,0 +1,46 @@
|
||||
From f4bdb7fdccdfe3fa382abe77f72a16c2f2e6add0 Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Sat, 11 Dec 2021 20:25:37 +0100
|
||||
Subject: [PATCH] realtek: Add support for RTL9300/RTL9310 I2C multiplexing
|
||||
|
||||
The RTL9300/RTL9310 I2C controllers have support for 2 independent I2C
|
||||
masters, each with a fixed SCL pin, that cannot be changed. Each of these
|
||||
masters can use 8 (RTL9300) or 16 (RTL9310) different pins for SDA.
|
||||
This multiplexer directly controls the two masters and their shared
|
||||
IO configuration registers to allow multiplexing between any of these
|
||||
busses. The two masters cannot be used in parallel as the multiplex
|
||||
is protected by a standard multiplex lock.
|
||||
|
||||
Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
---
|
||||
drivers/i2c/muxes/Kconfig | 9 +++++++
|
||||
drivers/i2c/muxes/Makefile | 1 +
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
--- a/drivers/i2c/muxes/Kconfig
|
||||
+++ b/drivers/i2c/muxes/Kconfig
|
||||
@@ -99,6 +99,15 @@ config I2C_MUX_REG
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called i2c-mux-reg.
|
||||
|
||||
+config I2C_MUX_RTL9300
|
||||
+ tristate "RTL9300 based I2C multiplexer"
|
||||
+ help
|
||||
+ If you say yes to this option, support will be included for a
|
||||
+ RTL9300 based I2C multiplexer.
|
||||
+
|
||||
+ This driver can also be built as a module. If so, the module
|
||||
+ will be called i2c-mux-reg.
|
||||
+
|
||||
config I2C_DEMUX_PINCTRL
|
||||
tristate "pinctrl-based I2C demultiplexer"
|
||||
depends on PINCTRL && OF
|
||||
--- a/drivers/i2c/muxes/Makefile
|
||||
+++ b/drivers/i2c/muxes/Makefile
|
||||
@@ -14,5 +14,6 @@ obj-$(CONFIG_I2C_MUX_PCA9541) += i2c-mux
|
||||
obj-$(CONFIG_I2C_MUX_PCA954x) += i2c-mux-pca954x.o
|
||||
obj-$(CONFIG_I2C_MUX_PINCTRL) += i2c-mux-pinctrl.o
|
||||
obj-$(CONFIG_I2C_MUX_REG) += i2c-mux-reg.o
|
||||
+obj-$(CONFIG_I2C_MUX_RTL9300) += i2c-mux-rtl9300.o
|
||||
|
||||
ccflags-$(CONFIG_I2C_DEBUG_BUS) := -DDEBUG
|
||||
@@ -0,0 +1,427 @@
|
||||
From 6c18e9c491959ac0674ebe36b09f9ddc3f2c9bce Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Fri, 31 Dec 2021 11:56:49 +0100
|
||||
Subject: [PATCH] realtek: Add VPE support for the IRQ driver
|
||||
|
||||
In order to support VSMP, enable support for both VPEs of the RTL839X
|
||||
and RTL930X SoCs in the irq-realtek-rtl driver. Add support for IRQ
|
||||
affinity setting.
|
||||
|
||||
Up to kernel 5.15 this patch was divided into two parts
|
||||
|
||||
315-irqchip-irq-realtek-rtl-add-VPE-support.patch
|
||||
319-irqchip-irq-realtek-rtl-fix-VPE-affinity.patch
|
||||
|
||||
As both parts will only work in combination they have been merged into
|
||||
one patch.
|
||||
|
||||
Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
Submitted-by: INAGAKI Hiroshi <musashino.open@gmail.com>
|
||||
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
---
|
||||
drivers/irqchip/irq-realtek-rtl.c | 296 +++++++++++++++++++++++++-----
|
||||
1 file changed, 249 insertions(+), 47 deletions(-)
|
||||
|
||||
--- a/drivers/irqchip/irq-realtek-rtl.c
|
||||
+++ b/drivers/irqchip/irq-realtek-rtl.c
|
||||
@@ -22,22 +22,58 @@
|
||||
#define RTL_ICTL_IRR3 0x14
|
||||
|
||||
#define RTL_ICTL_NUM_INPUTS 32
|
||||
-
|
||||
-#define REG(x) (realtek_ictl_base + x)
|
||||
+#define RTL_ICTL_NUM_OUTPUTS 15
|
||||
|
||||
static DEFINE_RAW_SPINLOCK(irq_lock);
|
||||
-static void __iomem *realtek_ictl_base;
|
||||
+
|
||||
+#define REG(offset, cpu) (realtek_ictl_base[cpu] + offset)
|
||||
+
|
||||
+static u32 realtek_ictl_unmask[NR_CPUS];
|
||||
+static void __iomem *realtek_ictl_base[NR_CPUS];
|
||||
+static cpumask_t realtek_ictl_cpu_configurable;
|
||||
+
|
||||
+struct realtek_ictl_output {
|
||||
+ /* IRQ controller data */
|
||||
+ struct fwnode_handle *fwnode;
|
||||
+ /* Output specific data */
|
||||
+ unsigned int output_index;
|
||||
+ struct irq_domain *domain;
|
||||
+ u32 child_mask;
|
||||
+};
|
||||
|
||||
/*
|
||||
- * IRR0-IRR3 store 4 bits per interrupt, but Realtek uses inverted numbering,
|
||||
- * placing IRQ 31 in the first four bits. A routing value of '0' means the
|
||||
- * interrupt is left disconnected. Routing values {1..15} connect to output
|
||||
- * lines {0..14}.
|
||||
+ * Per CPU we have a set of 5 registers that determine interrupt handling for
|
||||
+ * 32 external interrupts. GIMR (enable/disable interrupt) plus IRR0-IRR3 that
|
||||
+ * contain "routing" or "priority" values. GIMR uses one bit for each interrupt
|
||||
+ * and IRRx store 4 bits per interrupt. Realtek uses inverted numbering,
|
||||
+ * placing IRQ 31 in the first four bits. The register combinations give the
|
||||
+ * following results for a single interrupt in the wild:
|
||||
+ *
|
||||
+ * a) GIMR = 0 / IRRx > 0 -> no interrupts
|
||||
+ * b) GIMR = 0 / IRRx = 0 -> no interrupts
|
||||
+ * c) GIMR = 1 / IRRx > 0 -> interrupts
|
||||
+ * d) GIMR = 1 / IRRx = 0 -> rare interrupts in SMP environment
|
||||
+ *
|
||||
+ * Combination d) seems to trigger interrupts only on a VPE if the other VPE
|
||||
+ * has GIMR = 0 and IRRx > 0. E.g. busy without interrupts allowed. To provide
|
||||
+ * IRQ balancing features in SMP this driver will handle the registers as
|
||||
+ * follows:
|
||||
+ *
|
||||
+ * 1) set IRRx > 0 for VPE where the interrupt is desired
|
||||
+ * 2) set IRRx = 0 for VPE where the interrupt is not desired
|
||||
+ * 3) set both GIMR = 0 to mask (disabled) interrupt
|
||||
+ * 4) set GIMR = 1 to unmask (enable) interrupt but only for VPE where IRRx > 0
|
||||
*/
|
||||
+
|
||||
#define IRR_OFFSET(idx) (4 * (3 - (idx * 4) / 32))
|
||||
#define IRR_SHIFT(idx) ((idx * 4) % 32)
|
||||
|
||||
-static void write_irr(void __iomem *irr0, int idx, u32 value)
|
||||
+static inline u32 read_irr(void __iomem *irr0, int idx)
|
||||
+{
|
||||
+ return (readl(irr0 + IRR_OFFSET(idx)) >> IRR_SHIFT(idx)) & 0xf;
|
||||
+}
|
||||
+
|
||||
+static inline void write_irr(void __iomem *irr0, int idx, u32 value)
|
||||
{
|
||||
unsigned int offset = IRR_OFFSET(idx);
|
||||
unsigned int shift = IRR_SHIFT(idx);
|
||||
@@ -48,16 +84,33 @@ static void write_irr(void __iomem *irr0
|
||||
writel(irr, irr0 + offset);
|
||||
}
|
||||
|
||||
+static inline void enable_gimr(int hwirq, int cpu)
|
||||
+{
|
||||
+ u32 value;
|
||||
+
|
||||
+ value = readl(REG(RTL_ICTL_GIMR, cpu));
|
||||
+ value |= (BIT(hwirq) & realtek_ictl_unmask[cpu]);
|
||||
+ writel(value, REG(RTL_ICTL_GIMR, cpu));
|
||||
+}
|
||||
+
|
||||
+static inline void disable_gimr(int hwirq, int cpu)
|
||||
+{
|
||||
+ u32 value;
|
||||
+
|
||||
+ value = readl(REG(RTL_ICTL_GIMR, cpu));
|
||||
+ value &= ~BIT(hwirq);
|
||||
+ writel(value, REG(RTL_ICTL_GIMR, cpu));
|
||||
+}
|
||||
+
|
||||
static void realtek_ictl_unmask_irq(struct irq_data *i)
|
||||
{
|
||||
unsigned long flags;
|
||||
- u32 value;
|
||||
+ int cpu;
|
||||
|
||||
raw_spin_lock_irqsave(&irq_lock, flags);
|
||||
|
||||
- value = readl(REG(RTL_ICTL_GIMR));
|
||||
- value |= BIT(i->hwirq);
|
||||
- writel(value, REG(RTL_ICTL_GIMR));
|
||||
+ for_each_cpu(cpu, &realtek_ictl_cpu_configurable)
|
||||
+ enable_gimr(i->hwirq, cpu);
|
||||
|
||||
raw_spin_unlock_irqrestore(&irq_lock, flags);
|
||||
}
|
||||
@@ -65,110 +118,259 @@ static void realtek_ictl_unmask_irq(stru
|
||||
static void realtek_ictl_mask_irq(struct irq_data *i)
|
||||
{
|
||||
unsigned long flags;
|
||||
- u32 value;
|
||||
+ int cpu;
|
||||
|
||||
raw_spin_lock_irqsave(&irq_lock, flags);
|
||||
|
||||
- value = readl(REG(RTL_ICTL_GIMR));
|
||||
- value &= ~BIT(i->hwirq);
|
||||
- writel(value, REG(RTL_ICTL_GIMR));
|
||||
+ for_each_cpu(cpu, &realtek_ictl_cpu_configurable)
|
||||
+ disable_gimr(i->hwirq, cpu);
|
||||
|
||||
raw_spin_unlock_irqrestore(&irq_lock, flags);
|
||||
}
|
||||
|
||||
+static int __maybe_unused realtek_ictl_irq_affinity(struct irq_data *i,
|
||||
+ const struct cpumask *dest, bool force)
|
||||
+{
|
||||
+ struct realtek_ictl_output *output = i->domain->host_data;
|
||||
+ cpumask_t cpu_configure;
|
||||
+ cpumask_t cpu_disable;
|
||||
+ cpumask_t cpu_enable;
|
||||
+ unsigned long flags;
|
||||
+ int cpu;
|
||||
+
|
||||
+ raw_spin_lock_irqsave(&irq_lock, flags);
|
||||
+
|
||||
+ cpumask_and(&cpu_configure, cpu_present_mask, &realtek_ictl_cpu_configurable);
|
||||
+
|
||||
+ cpumask_and(&cpu_enable, &cpu_configure, dest);
|
||||
+ cpumask_andnot(&cpu_disable, &cpu_configure, dest);
|
||||
+
|
||||
+ for_each_cpu(cpu, &cpu_disable) {
|
||||
+ write_irr(REG(RTL_ICTL_IRR0, cpu), i->hwirq, 0);
|
||||
+ realtek_ictl_unmask[cpu] &= ~BIT(i->hwirq);
|
||||
+ disable_gimr(i->hwirq, cpu);
|
||||
+ }
|
||||
+
|
||||
+ for_each_cpu(cpu, &cpu_enable) {
|
||||
+ write_irr(REG(RTL_ICTL_IRR0, cpu), i->hwirq, output->output_index + 1);
|
||||
+ realtek_ictl_unmask[cpu] |= BIT(i->hwirq);
|
||||
+ enable_gimr(i->hwirq, cpu);
|
||||
+ }
|
||||
+
|
||||
+ irq_data_update_effective_affinity(i, &cpu_enable);
|
||||
+
|
||||
+ raw_spin_unlock_irqrestore(&irq_lock, flags);
|
||||
+
|
||||
+ return IRQ_SET_MASK_OK;
|
||||
+}
|
||||
+
|
||||
static struct irq_chip realtek_ictl_irq = {
|
||||
.name = "realtek-rtl-intc",
|
||||
.irq_mask = realtek_ictl_mask_irq,
|
||||
.irq_unmask = realtek_ictl_unmask_irq,
|
||||
+#ifdef CONFIG_SMP
|
||||
+ .irq_set_affinity = realtek_ictl_irq_affinity,
|
||||
+#endif
|
||||
};
|
||||
|
||||
static int intc_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t hw)
|
||||
{
|
||||
+ struct realtek_ictl_output *output = d->host_data;
|
||||
unsigned long flags;
|
||||
|
||||
irq_set_chip_and_handler(irq, &realtek_ictl_irq, handle_level_irq);
|
||||
|
||||
raw_spin_lock_irqsave(&irq_lock, flags);
|
||||
- write_irr(REG(RTL_ICTL_IRR0), hw, 1);
|
||||
+
|
||||
+ output->child_mask |= BIT(hw);
|
||||
+ write_irr(REG(RTL_ICTL_IRR0, 0), hw, output->output_index + 1);
|
||||
+ realtek_ictl_unmask[0] |= BIT(hw);
|
||||
+
|
||||
raw_spin_unlock_irqrestore(&irq_lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int intc_select(struct irq_domain *d, struct irq_fwspec *fwspec,
|
||||
+ enum irq_domain_bus_token bus_token)
|
||||
+{
|
||||
+ struct realtek_ictl_output *output = d->host_data;
|
||||
+ bool routed_elsewhere;
|
||||
+ unsigned long flags;
|
||||
+ u32 routing_old;
|
||||
+ int cpu;
|
||||
+
|
||||
+ if (fwspec->fwnode != output->fwnode)
|
||||
+ return false;
|
||||
+
|
||||
+ /* Original specifiers had only one parameter */
|
||||
+ if (fwspec->param_count < 2)
|
||||
+ return true;
|
||||
+
|
||||
+ raw_spin_lock_irqsave(&irq_lock, flags);
|
||||
+
|
||||
+ /*
|
||||
+ * Inputs can only be routed to one output, so they shouldn't be
|
||||
+ * allowed to end up in multiple domains.
|
||||
+ */
|
||||
+ for_each_cpu(cpu, &realtek_ictl_cpu_configurable) {
|
||||
+ routing_old = read_irr(REG(RTL_ICTL_IRR0, cpu), fwspec->param[0]);
|
||||
+ routed_elsewhere = routing_old && fwspec->param[1] != routing_old - 1;
|
||||
+ if (routed_elsewhere) {
|
||||
+ pr_warn("soc int %d already routed to output %d\n",
|
||||
+ fwspec->param[0], routing_old - 1);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ raw_spin_unlock_irqrestore(&irq_lock, flags);
|
||||
+
|
||||
+ return !routed_elsewhere && fwspec->param[1] == output->output_index;
|
||||
+}
|
||||
+
|
||||
static const struct irq_domain_ops irq_domain_ops = {
|
||||
.map = intc_map,
|
||||
+ .select = intc_select,
|
||||
.xlate = irq_domain_xlate_onecell,
|
||||
};
|
||||
|
||||
static void realtek_irq_dispatch(struct irq_desc *desc)
|
||||
{
|
||||
+ struct realtek_ictl_output *output = irq_desc_get_handler_data(desc);
|
||||
struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
- struct irq_domain *domain;
|
||||
+ int cpu = smp_processor_id();
|
||||
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);
|
||||
- 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_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. A routing value of '0' means the interrupt is left
|
||||
+ * disconnected. Routing values {1..15} connect to output lines {0..14}.
|
||||
+ */
|
||||
+static int __init setup_parent_interrupts(struct device_node *node, int *parents,
|
||||
+ unsigned int num_parents)
|
||||
+{
|
||||
+ struct realtek_ictl_output *outputs;
|
||||
+ struct realtek_ictl_output *output;
|
||||
+ struct irq_domain *domain;
|
||||
+ unsigned int p;
|
||||
+
|
||||
+ outputs = kcalloc(num_parents, sizeof(*outputs), GFP_KERNEL);
|
||||
+ if (!outputs)
|
||||
+ return -ENOMEM;
|
||||
+
|
||||
+ for (p = 0; p < num_parents; p++) {
|
||||
+ output = outputs + p;
|
||||
+
|
||||
+ domain = irq_domain_add_linear(node, RTL_ICTL_NUM_INPUTS, &irq_domain_ops, output);
|
||||
+ if (!domain)
|
||||
+ goto domain_err;
|
||||
+
|
||||
+ output->fwnode = of_node_to_fwnode(node);
|
||||
+ output->output_index = p;
|
||||
+ output->domain = domain;
|
||||
+
|
||||
+ irq_set_chained_handler_and_data(parents[p], realtek_irq_dispatch, output);
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+
|
||||
+domain_err:
|
||||
+ while (p--) {
|
||||
+ irq_set_chained_handler_and_data(parents[p], NULL, NULL);
|
||||
+ irq_domain_remove(outputs[p].domain);
|
||||
+ }
|
||||
+
|
||||
+ kfree(outputs);
|
||||
+
|
||||
+ return -ENOMEM;
|
||||
+}
|
||||
+
|
||||
static int __init realtek_rtl_of_init(struct device_node *node, struct device_node *parent)
|
||||
{
|
||||
+ int parent_irqs[RTL_ICTL_NUM_OUTPUTS];
|
||||
struct of_phandle_args oirq;
|
||||
- struct irq_domain *domain;
|
||||
+ unsigned int num_parents;
|
||||
unsigned int soc_irq;
|
||||
- int parent_irq;
|
||||
+ unsigned int p;
|
||||
+ int cpu;
|
||||
+
|
||||
+ cpumask_clear(&realtek_ictl_cpu_configurable);
|
||||
|
||||
- realtek_ictl_base = of_iomap(node, 0);
|
||||
- if (!realtek_ictl_base)
|
||||
+ for (cpu = 0; cpu < NR_CPUS; cpu++) {
|
||||
+ realtek_ictl_base[cpu] = of_iomap(node, cpu);
|
||||
+ if (realtek_ictl_base[cpu]) {
|
||||
+ cpumask_set_cpu(cpu, &realtek_ictl_cpu_configurable);
|
||||
+
|
||||
+ /* Disable all cascaded interrupts and clear routing */
|
||||
+ for (soc_irq = 0; soc_irq < RTL_ICTL_NUM_INPUTS; soc_irq++) {
|
||||
+ write_irr(REG(RTL_ICTL_IRR0, cpu), soc_irq, 0);
|
||||
+ realtek_ictl_unmask[cpu] &= ~BIT(soc_irq);
|
||||
+ disable_gimr(soc_irq, cpu);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (cpumask_empty(&realtek_ictl_cpu_configurable))
|
||||
return -ENXIO;
|
||||
|
||||
- /* Disable all cascaded interrupts and clear routing */
|
||||
- writel(0, REG(RTL_ICTL_GIMR));
|
||||
- for (soc_irq = 0; soc_irq < RTL_ICTL_NUM_INPUTS; soc_irq++)
|
||||
- write_irr(REG(RTL_ICTL_IRR0), soc_irq, 0);
|
||||
+ num_parents = of_irq_count(node);
|
||||
+ if (num_parents > RTL_ICTL_NUM_OUTPUTS) {
|
||||
+ pr_err("too many parent interrupts\n");
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
- if (WARN_ON(!of_irq_count(node))) {
|
||||
+ for (p = 0; p < num_parents; p++)
|
||||
+ parent_irqs[p] = of_irq_get(node, p);
|
||||
+
|
||||
+ if (WARN_ON(!num_parents)) {
|
||||
/*
|
||||
* If DT contains no parent interrupts, assume MIPS CPU IRQ 2
|
||||
* (HW0) is connected to the first output. This is the case for
|
||||
* all known hardware anyway. "interrupt-map" is deprecated, so
|
||||
* don't bother trying to parse that.
|
||||
+ * Since this is to account for old devicetrees with one-cell
|
||||
+ * interrupt specifiers, only one output domain is needed.
|
||||
*/
|
||||
oirq.np = of_find_compatible_node(NULL, NULL, "mti,cpu-interrupt-controller");
|
||||
- oirq.args_count = 1;
|
||||
- oirq.args[0] = 2;
|
||||
-
|
||||
- parent_irq = irq_create_of_mapping(&oirq);
|
||||
+ if (oirq.np) {
|
||||
+ oirq.args_count = 1;
|
||||
+ oirq.args[0] = 2;
|
||||
+
|
||||
+ parent_irqs[0] = irq_create_of_mapping(&oirq);
|
||||
+ num_parents = 1;
|
||||
+ }
|
||||
|
||||
of_node_put(oirq.np);
|
||||
- } else {
|
||||
- parent_irq = of_irq_get(node, 0);
|
||||
}
|
||||
|
||||
- if (parent_irq < 0)
|
||||
- return parent_irq;
|
||||
- else if (!parent_irq)
|
||||
- return -ENODEV;
|
||||
-
|
||||
- domain = irq_domain_add_linear(node, RTL_ICTL_NUM_INPUTS, &irq_domain_ops, NULL);
|
||||
- if (!domain)
|
||||
- return -ENOMEM;
|
||||
-
|
||||
- irq_set_chained_handler_and_data(parent_irq, realtek_irq_dispatch, domain);
|
||||
+ /* Ensure we haven't collected any errors before proceeding */
|
||||
+ for (p = 0; p < num_parents; p++) {
|
||||
+ if (parent_irqs[p] < 0)
|
||||
+ return parent_irqs[p];
|
||||
+ if (!parent_irqs[p])
|
||||
+ return -ENODEV;
|
||||
+ }
|
||||
|
||||
- return 0;
|
||||
+ return setup_parent_interrupts(node, &parent_irqs[0], num_parents);
|
||||
}
|
||||
|
||||
IRQCHIP_DECLARE(realtek_rtl_intc, "realtek,rtl-intc", realtek_rtl_of_init);
|
||||
@@ -0,0 +1,33 @@
|
||||
From 800d5fb3c6a16661932c932bacd660e38d06b727 Mon Sep 17 00:00:00 2001
|
||||
From: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
Date: Thu, 25 Aug 2022 08:22:36 +0200
|
||||
Subject: [PATCH] realtek: add patch to enable new clock driver in kernel
|
||||
|
||||
Allow building the clock driver with kernel config options.
|
||||
|
||||
Submitted-by: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
---
|
||||
drivers/clk/Kconfig | 1 +
|
||||
drivers/clk/Makefile | 1 +
|
||||
2 files changed, 2 insertions(+)
|
||||
|
||||
--- a/drivers/clk/Kconfig
|
||||
+++ b/drivers/clk/Kconfig
|
||||
@@ -484,6 +484,7 @@ source "drivers/clk/mvebu/Kconfig"
|
||||
source "drivers/clk/nuvoton/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"
|
||||
--- a/drivers/clk/Makefile
|
||||
+++ b/drivers/clk/Makefile
|
||||
@@ -112,6 +112,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/
|
||||
obj-$(CONFIG_COMMON_CLK_SAMSUNG) += samsung/
|
||||
@@ -0,0 +1,38 @@
|
||||
From e813f48461b8011244b3e7dfe118cf94fd595f0d Mon Sep 17 00:00:00 2001
|
||||
From: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
Date: Sun, 25 Aug 2024 13:09:48 -0400
|
||||
Subject: [PATCH] realtek: harden fw_init_cmdline()
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Some devices (e.g. HP JG924A) hand over other than expected kernel boot
|
||||
arguments. Looking at these one can see:
|
||||
|
||||
fw_init_cmdline: fw_arg0=00020000
|
||||
fw_init_cmdline: fw_arg1=00060000
|
||||
fw_init_cmdline: fw_arg2=fffdffff
|
||||
fw_init_cmdline: fw_arg3=0000416c
|
||||
|
||||
Especially fw_arg2 should be the pointer to the environment and it looks
|
||||
very suspicous. It is not aligned and the address is outside KSEG0 and
|
||||
KSEG1. Booting the device will result in a hang. Do better at verifying
|
||||
the address.
|
||||
|
||||
Signed-off-by: Bjørn Mork <bjorn@mork.no>
|
||||
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
|
||||
---
|
||||
arch/mips/fw/lib/cmdline.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/arch/mips/fw/lib/cmdline.c
|
||||
+++ b/arch/mips/fw/lib/cmdline.c
|
||||
@@ -31,7 +31,7 @@ void __init fw_init_cmdline(void)
|
||||
}
|
||||
|
||||
/* Validate environment pointer. */
|
||||
- if (fw_arg2 < CKSEG0)
|
||||
+ if (fw_arg2 < CKSEG0 || fw_arg2 >= CKSEG2)
|
||||
_fw_envp = NULL;
|
||||
else
|
||||
_fw_envp = (int *)fw_arg2;
|
||||
@@ -0,0 +1,32 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: net: dsa: Increase max ports for rtl838x
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/linux/platform_data/dsa.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/include/linux/platform_data/dsa.h
|
||||
+++ b/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 {
|
||||
@@ -0,0 +1,79 @@
|
||||
From 9d9bf16aa8d966834ac1280f96c37d22552c33d1 Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <git@birger-koblitz.de>
|
||||
Date: Wed, 8 Sep 2021 16:13:18 +0200
|
||||
Subject: realtek phy: Add PHY hsgmii mode
|
||||
|
||||
This adds RTL93xx-specific MAC configuration routines that allow also configuration
|
||||
of 10GBit links for phylink. There is support for the Realtek-specific HSGMII
|
||||
protocol.
|
||||
|
||||
Submitted-by: Birger Koblitz <git@birger-koblitz.de>
|
||||
---
|
||||
drivers/net/phy/phy-core.c | 1 +
|
||||
drivers/net/phy/phylink.c | 4 ++++
|
||||
include/linux/phy.h | 3 +++
|
||||
3 files changed, 8 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/phy-core.c
|
||||
+++ b/drivers/net/phy/phy-core.c
|
||||
@@ -126,6 +126,7 @@ int phy_interface_num_ports(phy_interfac
|
||||
case PHY_INTERFACE_MODE_MOCA:
|
||||
case PHY_INTERFACE_MODE_TRGMII:
|
||||
case PHY_INTERFACE_MODE_USXGMII:
|
||||
+ case PHY_INTERFACE_MODE_HSGMII:
|
||||
case PHY_INTERFACE_MODE_SGMII:
|
||||
case PHY_INTERFACE_MODE_SMII:
|
||||
case PHY_INTERFACE_MODE_1000BASEX:
|
||||
--- a/drivers/net/phy/phylink.c
|
||||
+++ b/drivers/net/phy/phylink.c
|
||||
@@ -124,6 +124,7 @@ do { \
|
||||
static const phy_interface_t phylink_sfp_interface_preference[] = {
|
||||
PHY_INTERFACE_MODE_25GBASER,
|
||||
PHY_INTERFACE_MODE_USXGMII,
|
||||
+ PHY_INTERFACE_MODE_HSGMII,
|
||||
PHY_INTERFACE_MODE_10GBASER,
|
||||
PHY_INTERFACE_MODE_5GBASER,
|
||||
PHY_INTERFACE_MODE_2500BASEX,
|
||||
@@ -238,6 +239,7 @@ static int phylink_interface_max_speed(p
|
||||
|
||||
case PHY_INTERFACE_MODE_XGMII:
|
||||
case PHY_INTERFACE_MODE_RXAUI:
|
||||
+ case PHY_INTERFACE_MODE_HSGMII:
|
||||
case PHY_INTERFACE_MODE_XAUI:
|
||||
case PHY_INTERFACE_MODE_10GBASER:
|
||||
case PHY_INTERFACE_MODE_10GKR:
|
||||
@@ -547,6 +549,7 @@ unsigned long phylink_get_capabilities(p
|
||||
break;
|
||||
|
||||
case PHY_INTERFACE_MODE_XGMII:
|
||||
+ case PHY_INTERFACE_MODE_HSGMII:
|
||||
case PHY_INTERFACE_MODE_RXAUI:
|
||||
case PHY_INTERFACE_MODE_XAUI:
|
||||
case PHY_INTERFACE_MODE_10GBASER:
|
||||
@@ -957,6 +960,7 @@ static int phylink_parse_mode(struct phy
|
||||
fallthrough;
|
||||
case PHY_INTERFACE_MODE_USXGMII:
|
||||
case PHY_INTERFACE_MODE_10GKR:
|
||||
+ case PHY_INTERFACE_MODE_HSGMII:
|
||||
case PHY_INTERFACE_MODE_10GBASER:
|
||||
phylink_set(pl->supported, 10baseT_Half);
|
||||
phylink_set(pl->supported, 10baseT_Full);
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -148,6 +148,7 @@ typedef enum {
|
||||
PHY_INTERFACE_MODE_XGMII,
|
||||
PHY_INTERFACE_MODE_XLGMII,
|
||||
PHY_INTERFACE_MODE_MOCA,
|
||||
+ PHY_INTERFACE_MODE_HSGMII,
|
||||
PHY_INTERFACE_MODE_PSGMII,
|
||||
PHY_INTERFACE_MODE_QSGMII,
|
||||
PHY_INTERFACE_MODE_TRGMII,
|
||||
@@ -256,6 +257,8 @@ static inline const char *phy_modes(phy_
|
||||
return "xlgmii";
|
||||
case PHY_INTERFACE_MODE_MOCA:
|
||||
return "moca";
|
||||
+ case PHY_INTERFACE_MODE_HSGMII:
|
||||
+ return "hsgmii";
|
||||
case PHY_INTERFACE_MODE_PSGMII:
|
||||
return "psgmii";
|
||||
case PHY_INTERFACE_MODE_QSGMII:
|
||||
@@ -0,0 +1,32 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: PHY: Increase max PHY adddress number
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/linux/phy.h | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -297,7 +297,7 @@ static inline const char *phy_modes(phy_
|
||||
#define PHY_INIT_TIMEOUT 100000
|
||||
#define PHY_FORCE_TIMEOUT 10
|
||||
|
||||
-#define PHY_MAX_ADDR 32
|
||||
+#define PHY_MAX_ADDR 64
|
||||
|
||||
/* Used when trying to connect to a specific phy (mii bus id:phy device id) */
|
||||
#define PHY_ID_FMT "%s:%02x"
|
||||
@@ -0,0 +1,34 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: phy: Add PHY ops for rtl838x EEE
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
include/linux/phy.h | 4 ++++
|
||||
1 file changed, 4 insertions(+)
|
||||
|
||||
--- a/include/linux/phy.h
|
||||
+++ b/include/linux/phy.h
|
||||
@@ -1181,6 +1181,10 @@ struct phy_driver {
|
||||
*/
|
||||
int (*led_polarity_set)(struct phy_device *dev, int index,
|
||||
unsigned long modes);
|
||||
+ 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)
|
||||
@@ -0,0 +1,61 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: net: phy: EEE support for rtl838x
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
drivers/net/phy/phylink. | 14 +++++++++++--
|
||||
1 file changed, 12 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/phylink.c
|
||||
+++ b/drivers/net/phy/phylink.c
|
||||
@@ -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.
|
||||
*/
|
||||
+ 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);
|
||||
+ }
|
||||
+ }
|
||||
return phy_ethtool_ksettings_set(pl->phydev, &phy_kset);
|
||||
}
|
||||
|
||||
@@ -2805,8 +2810,11 @@ int phylink_ethtool_get_eee(struct phyli
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -2823,8 +2831,11 @@ int phylink_ethtool_set_eee(struct phyli
|
||||
|
||||
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;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
From a381ac0aa281fdb0b41a39d8a2bc08fd88f6db92 Mon Sep 17 00:00:00 2001
|
||||
From: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
Date: Tue, 25 Feb 2020 16:32:37 +0100
|
||||
Subject: [PATCH 1/3] net: phy: sfp: re-probe modules on DEV_UP event
|
||||
|
||||
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
---
|
||||
drivers/net/phy/sfp.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/sfp.c
|
||||
+++ b/drivers/net/phy/sfp.c
|
||||
@@ -2416,6 +2416,13 @@ static void sfp_sm_module(struct sfp *sf
|
||||
return;
|
||||
}
|
||||
|
||||
+ /* Re-probe the SFP modules when an interface is brought up, as the MAC
|
||||
+ * do not report its link status (This means Phylink wouldn't be
|
||||
+ * triggered if the PHY had a link before a MAC is brought up).
|
||||
+ */
|
||||
+ if (event == SFP_E_DEV_UP && sfp->sm_mod_state == SFP_MOD_PRESENT)
|
||||
+ sfp_sm_mod_next(sfp, SFP_MOD_PROBE, T_SERIAL);
|
||||
+
|
||||
switch (sfp->sm_mod_state) {
|
||||
default:
|
||||
if (event == SFP_E_INSERT) {
|
||||
@@ -0,0 +1,148 @@
|
||||
From d585c55b9f70cf9e8c66820d7efe7130c683f19e Mon Sep 17 00:00:00 2001
|
||||
From: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
Date: Fri, 21 Feb 2020 11:51:27 +0100
|
||||
Subject: [PATCH 2/3] net: phy: add an MDIO SMBus library
|
||||
|
||||
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
---
|
||||
drivers/net/mdio/Kconfig | 11 +++++++
|
||||
drivers/net/mdio/Makefile | 1 +
|
||||
drivers/net/mdio/mdio-smbus.c | 62 +++++++++++++++++++++++++++++++++++
|
||||
drivers/net/phy/Kconfig | 1 +
|
||||
include/linux/mdio/mdio-i2c.h | 16 +++++++++
|
||||
5 files changed, 91 insertions(+)
|
||||
create mode 100644 drivers/net/mdio/mdio-smbus.c
|
||||
|
||||
--- a/drivers/net/mdio/Kconfig
|
||||
+++ b/drivers/net/mdio/Kconfig
|
||||
@@ -54,6 +54,17 @@ config MDIO_SUN4I
|
||||
interface units of the Allwinner SoC that have an EMAC (A10,
|
||||
A12, A10s, etc.)
|
||||
|
||||
+config MDIO_SMBUS
|
||||
+ tristate
|
||||
+ depends on I2C_SMBUS
|
||||
+ help
|
||||
+ Support SMBus based PHYs. This provides a MDIO bus bridged
|
||||
+ to SMBus to allow PHYs connected in SMBus mode to be accessed
|
||||
+ using the existing infrastructure.
|
||||
+
|
||||
+ This is library mode.
|
||||
+
|
||||
+
|
||||
config MDIO_XGENE
|
||||
tristate "APM X-Gene SoC MDIO bus controller"
|
||||
depends on ARCH_XGENE || COMPILE_TEST
|
||||
--- a/drivers/net/mdio/Makefile
|
||||
+++ b/drivers/net/mdio/Makefile
|
||||
@@ -20,6 +20,7 @@ obj-$(CONFIG_MDIO_MSCC_MIIM) += mdio-ms
|
||||
obj-$(CONFIG_MDIO_MVUSB) += mdio-mvusb.o
|
||||
obj-$(CONFIG_MDIO_OCTEON) += mdio-octeon.o
|
||||
obj-$(CONFIG_MDIO_REGMAP) += mdio-regmap.o
|
||||
+obj-$(CONFIG_MDIO_SMBUS) += mdio-smbus.o
|
||||
obj-$(CONFIG_MDIO_SUN4I) += mdio-sun4i.o
|
||||
obj-$(CONFIG_MDIO_THUNDER) += mdio-thunder.o
|
||||
obj-$(CONFIG_MDIO_XGENE) += mdio-xgene.o
|
||||
--- /dev/null
|
||||
+++ b/drivers/net/mdio/mdio-smbus.c
|
||||
@@ -0,0 +1,62 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
+/*
|
||||
+ * MDIO SMBus bridge
|
||||
+ *
|
||||
+ * Copyright (C) 2020 Antoine Tenart
|
||||
+ *
|
||||
+ * Network PHYs can appear on SMBus when they are part of SFP modules.
|
||||
+ */
|
||||
+#include <linux/i2c.h>
|
||||
+#include <linux/phy.h>
|
||||
+#include <linux/mdio/mdio-i2c.h>
|
||||
+
|
||||
+static int smbus_mii_read(struct mii_bus *mii, int phy_id, int reg)
|
||||
+{
|
||||
+ struct i2c_adapter *i2c = mii->priv;
|
||||
+ union i2c_smbus_data data;
|
||||
+ int ret;
|
||||
+
|
||||
+ ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0, I2C_SMBUS_READ,
|
||||
+ reg, I2C_SMBUS_BYTE_DATA, &data);
|
||||
+ if (ret < 0)
|
||||
+ return 0xff;
|
||||
+
|
||||
+ return data.byte;
|
||||
+}
|
||||
+
|
||||
+static int smbus_mii_write(struct mii_bus *mii, int phy_id, int reg, u16 val)
|
||||
+{
|
||||
+ struct i2c_adapter *i2c = mii->priv;
|
||||
+ union i2c_smbus_data data;
|
||||
+ int ret;
|
||||
+
|
||||
+ data.byte = val;
|
||||
+
|
||||
+ ret = i2c_smbus_xfer(i2c, i2c_mii_phy_addr(phy_id), 0, I2C_SMBUS_WRITE,
|
||||
+ reg, I2C_SMBUS_BYTE_DATA, &data);
|
||||
+ return ret < 0 ? ret : 0;
|
||||
+}
|
||||
+
|
||||
+struct mii_bus *mdio_smbus_alloc(struct device *parent, struct i2c_adapter *i2c)
|
||||
+{
|
||||
+ struct mii_bus *mii;
|
||||
+
|
||||
+ if (!i2c_check_functionality(i2c, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||
+ return ERR_PTR(-EINVAL);
|
||||
+
|
||||
+ mii = mdiobus_alloc();
|
||||
+ if (!mii)
|
||||
+ return ERR_PTR(-ENOMEM);
|
||||
+
|
||||
+ snprintf(mii->id, MII_BUS_ID_SIZE, "smbus:%s", dev_name(parent));
|
||||
+ mii->parent = parent;
|
||||
+ mii->read = smbus_mii_read;
|
||||
+ mii->write = smbus_mii_write;
|
||||
+ mii->priv = i2c;
|
||||
+
|
||||
+ return mii;
|
||||
+}
|
||||
+
|
||||
+MODULE_AUTHOR("Antoine Tenart");
|
||||
+MODULE_DESCRIPTION("MDIO SMBus bridge library");
|
||||
+MODULE_LICENSE("GPL");
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -65,6 +65,7 @@ config SFP
|
||||
depends on I2C && PHYLINK
|
||||
depends on HWMON || HWMON=n
|
||||
select MDIO_I2C
|
||||
+ select MDIO_SMBUS
|
||||
|
||||
comment "Switch configuration API + drivers"
|
||||
|
||||
--- a/include/linux/mdio/mdio-i2c.h
|
||||
+++ b/include/linux/mdio/mdio-i2c.h
|
||||
@@ -20,5 +20,8 @@ enum mdio_i2c_proto {
|
||||
|
||||
struct mii_bus *mdio_i2c_alloc(struct device *parent, struct i2c_adapter *i2c,
|
||||
enum mdio_i2c_proto protocol);
|
||||
+struct mii_bus *mdio_smbus_alloc(struct device *parent, struct i2c_adapter *i2c);
|
||||
+bool i2c_mii_valid_phy_id(int phy_id);
|
||||
+unsigned int i2c_mii_phy_addr(int phy_id);
|
||||
|
||||
#endif
|
||||
--- a/drivers/net/mdio/mdio-i2c.c
|
||||
+++ b/drivers/net/mdio/mdio-i2c.c
|
||||
@@ -20,12 +20,12 @@
|
||||
* specified to be present in SFP modules. These correspond with PHY
|
||||
* addresses 16 and 17. Disallow access to these "phy" addresses.
|
||||
*/
|
||||
-static bool i2c_mii_valid_phy_id(int phy_id)
|
||||
+bool i2c_mii_valid_phy_id(int phy_id)
|
||||
{
|
||||
return phy_id != 0x10 && phy_id != 0x11;
|
||||
}
|
||||
|
||||
-static unsigned int i2c_mii_phy_addr(int phy_id)
|
||||
+unsigned int i2c_mii_phy_addr(int phy_id)
|
||||
{
|
||||
return phy_id + 0x40;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
From 3cb0bde365d913c484d20224367a54a0eac780a7 Mon Sep 17 00:00:00 2001
|
||||
From: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
Date: Fri, 21 Feb 2020 11:55:29 +0100
|
||||
Subject: [PATCH 3/3] net: phy: sfp: add support for SMBus
|
||||
|
||||
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
|
||||
---
|
||||
drivers/net/phy/sfp.c | 92 +++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 88 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/drivers/net/phy/sfp.c
|
||||
+++ b/drivers/net/phy/sfp.c
|
||||
@@ -663,10 +663,64 @@ static int sfp_i2c_write(struct sfp *sfp
|
||||
return ret == ARRAY_SIZE(msgs) ? len : 0;
|
||||
}
|
||||
|
||||
+static int sfp_smbus_read(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
|
||||
+ size_t len)
|
||||
+{
|
||||
+ u8 bus_addr = a2 ? 0x51 : 0x50, *val = buf;
|
||||
+ union i2c_smbus_data data;
|
||||
+ int ret;
|
||||
+
|
||||
+ bus_addr -= 0x40;
|
||||
+
|
||||
+ while (len > 0) {
|
||||
+ ret = i2c_smbus_xfer(sfp->i2c, i2c_mii_phy_addr(bus_addr), 0,
|
||||
+ I2C_SMBUS_READ, dev_addr,
|
||||
+ I2C_SMBUS_BYTE_DATA, &data);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ *val++ = data.byte;
|
||||
+ dev_addr++;
|
||||
+ len--;
|
||||
+ }
|
||||
+
|
||||
+ return val - (u8 *)buf;
|
||||
+}
|
||||
+
|
||||
+static int sfp_smbus_write(struct sfp *sfp, bool a2, u8 dev_addr, void *buf,
|
||||
+ size_t len)
|
||||
+{
|
||||
+ u8 bus_addr = a2 ? 0x51 : 0x50, *val = buf;
|
||||
+ union i2c_smbus_data data;
|
||||
+ int ret;
|
||||
+
|
||||
+ bus_addr -= 0x40;
|
||||
+
|
||||
+ while (len > 0) {
|
||||
+ data.byte = *val++;
|
||||
+ ret = i2c_smbus_xfer(sfp->i2c, i2c_mii_phy_addr(bus_addr), 0,
|
||||
+ I2C_SMBUS_WRITE, dev_addr,
|
||||
+ I2C_SMBUS_BYTE_DATA, &data);
|
||||
+ if (ret)
|
||||
+ return ret;
|
||||
+ dev_addr++;
|
||||
+ len--;
|
||||
+ }
|
||||
+
|
||||
+ return val - (u8 *)buf;
|
||||
+}
|
||||
+
|
||||
static int sfp_i2c_configure(struct sfp *sfp, struct i2c_adapter *i2c)
|
||||
{
|
||||
- if (!i2c_check_functionality(i2c, I2C_FUNC_I2C))
|
||||
- return -EINVAL;
|
||||
+ if (!i2c_check_functionality(i2c, I2C_FUNC_I2C)) {
|
||||
+ if (i2c_check_functionality(i2c, I2C_FUNC_SMBUS_BYTE_DATA)) {
|
||||
+ sfp->i2c = i2c;
|
||||
+ sfp->read = sfp_smbus_read;
|
||||
+ sfp->write = sfp_smbus_write;
|
||||
+
|
||||
+ return 0;
|
||||
+ } else
|
||||
+ return -EINVAL;
|
||||
+ }
|
||||
|
||||
sfp->i2c = i2c;
|
||||
sfp->read = sfp_i2c_read;
|
||||
@@ -698,6 +752,29 @@ static int sfp_i2c_mdiobus_create(struct
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int sfp_sm_mdiobus_create(struct sfp *sfp)
|
||||
+{
|
||||
+ struct mii_bus *sm_mii;
|
||||
+ int ret;
|
||||
+
|
||||
+ sm_mii = mdio_smbus_alloc(sfp->dev, sfp->i2c);
|
||||
+ if (IS_ERR(sm_mii))
|
||||
+ return PTR_ERR(sm_mii);
|
||||
+
|
||||
+ sm_mii->name = "SFP SMBus";
|
||||
+ sm_mii->phy_mask = ~0;
|
||||
+
|
||||
+ ret = mdiobus_register(sm_mii);
|
||||
+ if (ret < 0) {
|
||||
+ mdiobus_free(sm_mii);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ sfp->i2c_mii = sm_mii;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
static void sfp_i2c_mdiobus_destroy(struct sfp *sfp)
|
||||
{
|
||||
mdiobus_unregister(sfp->i2c_mii);
|
||||
@@ -1871,8 +1948,15 @@ static void sfp_sm_fault(struct sfp *sfp
|
||||
|
||||
static int sfp_sm_add_mdio_bus(struct sfp *sfp)
|
||||
{
|
||||
- if (sfp->mdio_protocol != MDIO_I2C_NONE)
|
||||
- return sfp_i2c_mdiobus_create(sfp);
|
||||
+ if (i2c_check_functionality(sfp->i2c, I2C_FUNC_I2C)) {
|
||||
+ if (sfp->mdio_protocol != MDIO_I2C_NONE)
|
||||
+ return sfp_i2c_mdiobus_create(sfp);
|
||||
+
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (i2c_check_functionality(sfp->i2c, I2C_FUNC_SMBUS_BYTE_DATA))
|
||||
+ return sfp_sm_mdiobus_create(sfp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: net: ethernet: Add support for RTL838x ethernet
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
drivers/net/ethernet/Kconfig | 7 +-
|
||||
drivers/net/ethernet/Makefile | 1 +
|
||||
2 files changed, 8 insertions(+)
|
||||
|
||||
--- a/drivers/net/ethernet/Kconfig
|
||||
+++ b/drivers/net/ethernet/Kconfig
|
||||
@@ -170,6 +170,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 MACH_REALTEK_RTL
|
||||
+ 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/sgi/Kconfig"
|
||||
--- a/drivers/net/ethernet/Makefile
|
||||
+++ b/drivers/net/ethernet/Makefile
|
||||
@@ -81,6 +81,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/
|
||||
@@ -0,0 +1,42 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: net: dsa: Add support for rtl838x switch
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
drivers/net/dsa/rtl83xx/Kconfig | 2 ++
|
||||
drivers/net/dsa/rtl83xx/Makefile | 1 +
|
||||
2 files changed, 3 insertions(+)
|
||||
|
||||
--- a/drivers/net/dsa/Kconfig
|
||||
+++ b/drivers/net/dsa/Kconfig
|
||||
@@ -89,6 +89,8 @@ source "drivers/net/dsa/xrs700x/Kconfig"
|
||||
|
||||
source "drivers/net/dsa/realtek/Kconfig"
|
||||
|
||||
+source "drivers/net/dsa/rtl83xx/Kconfig"
|
||||
+
|
||||
config NET_DSA_RZN1_A5PSW
|
||||
tristate "Renesas RZ/N1 A5PSW Ethernet switch support"
|
||||
depends on OF && ARCH_RZN1
|
||||
--- a/drivers/net/dsa/Makefile
|
||||
+++ b/drivers/net/dsa/Makefile
|
||||
@@ -24,5 +24,6 @@ obj-y += mv88e6xxx/
|
||||
obj-y += ocelot/
|
||||
obj-y += qca/
|
||||
obj-y += realtek/
|
||||
+obj-y += rtl83xx/
|
||||
obj-y += sja1105/
|
||||
obj-y += xrs700x/
|
||||
39
target/linux/realtek/patches-6.6/720-add-rtl-phy.patch
Normal file
39
target/linux/realtek/patches-6.6/720-add-rtl-phy.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
From 89f71ebb355c624320c2b0ace8ae9488ff53cbeb Mon Sep 17 00:00:00 2001
|
||||
From: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Date: Tue, 5 Jan 2021 20:40:52 +0100
|
||||
Subject: PHY: Add realtek PHY
|
||||
|
||||
This fixes the build problems for the REALTEK target by adding a proper
|
||||
configuration option for the phy module.
|
||||
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
---
|
||||
drivers/net/phy/Kconfig | 6 ++++++
|
||||
drivers/net/phy/Makefile | 1 +
|
||||
2 files changed, 7 insertions(+)
|
||||
|
||||
--- a/drivers/net/phy/Kconfig
|
||||
+++ b/drivers/net/phy/Kconfig
|
||||
@@ -410,6 +410,12 @@ config REALTEK_PHY
|
||||
help
|
||||
Supports the Realtek 821x PHY.
|
||||
|
||||
+config REALTEK_SOC_PHY
|
||||
+ tristate "Realtek SoC PHYs"
|
||||
+ depends on MACH_REALTEK_RTL
|
||||
+ help
|
||||
+ Supports the PHYs found in combination with Realtek Switch SoCs
|
||||
+
|
||||
config RENESAS_PHY
|
||||
tristate "Renesas PHYs"
|
||||
help
|
||||
--- a/drivers/net/phy/Makefile
|
||||
+++ b/drivers/net/phy/Makefile
|
||||
@@ -100,6 +100,7 @@ obj-$(CONFIG_NXP_TJA11XX_PHY) += nxp-tja
|
||||
obj-y += qcom/
|
||||
obj-$(CONFIG_QSEMI_PHY) += qsemi.o
|
||||
obj-$(CONFIG_REALTEK_PHY) += realtek.o
|
||||
+obj-$(CONFIG_REALTEK_SOC_PHY) += rtl83xx-phy.o
|
||||
obj-$(CONFIG_RENESAS_PHY) += uPD60620.o
|
||||
obj-$(CONFIG_ROCKCHIP_PHY) += rockchip.o
|
||||
obj-$(CONFIG_SMSC_PHY) += smsc.o
|
||||
@@ -0,0 +1,61 @@
|
||||
From 2b88563ee5aafd9571d965b7f2093a0f58d98a31 Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Thu, 26 Nov 2020 12:02:21 +0100
|
||||
Subject: net: dsa: Add rtl838x support for tag trailer
|
||||
|
||||
* rename the target to realtek
|
||||
* add refactored DSA driver
|
||||
* add latest gpio driver
|
||||
* lots of arch cleanups
|
||||
* new irq driver
|
||||
* additional boards
|
||||
|
||||
Submitted-by: Bert Vermeulen <bert@biot.com>
|
||||
Submitted-by: Birger Koblitz <mail@birger-koblitz.de>
|
||||
Submitted-by: Sander Vanheule <sander@svanheule.net>
|
||||
Submitted-by: Bjørn Mork <bjorn@mork.no>
|
||||
Submitted-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
net/dsa/tag_trailer.c | 16 +++++++++++++-
|
||||
1 file changed, 17 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/net/dsa/tag_trailer.c
|
||||
+++ b/net/dsa/tag_trailer.c
|
||||
@@ -19,7 +19,12 @@ static struct sk_buff *trailer_xmit(stru
|
||||
|
||||
trailer = skb_put(skb, 4);
|
||||
trailer[0] = 0x80;
|
||||
+
|
||||
+#ifdef CONFIG_NET_DSA_RTL83XX
|
||||
+ trailer[1] = dp->index;
|
||||
+#else
|
||||
trailer[1] = 1 << dp->index;
|
||||
+#endif /* CONFIG_NET_DSA_RTL838X */
|
||||
trailer[2] = 0x10;
|
||||
trailer[3] = 0x00;
|
||||
|
||||
@@ -35,12 +40,23 @@ static struct sk_buff *trailer_rcv(struc
|
||||
return NULL;
|
||||
|
||||
trailer = skb_tail_pointer(skb) - 4;
|
||||
+
|
||||
+#ifdef CONFIG_NET_DSA_RTL83XX
|
||||
+ if (trailer[0] != 0x80 || (trailer[1] & 0x80) != 0x00 ||
|
||||
+ (trailer[2] & 0xef) != 0x00 || trailer[3] != 0x00)
|
||||
+ return NULL;
|
||||
+
|
||||
+ if (trailer[1] & 0x40)
|
||||
+ skb->offload_fwd_mark = 1;
|
||||
+
|
||||
+ source_port = trailer[1] & 0x3f;
|
||||
+#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;
|
||||
Reference in New Issue
Block a user