immortalwrt-VIKINGYFY/target/linux/generic/backport-6.12/783-02-v6.18-net-dsa-ks8995-Add-proper-RESET-delay.patch
Linus Walleij 73504d0b27 kernel: kmod-dsa-ks8995: Backport DSA patches
Converts the KS8995 "phy" driver to a proper DSA switch.
Currently the upstream only supports the "none" tag
but this is a good improvement already.

Make the old module depend on kernel 6.6 and the new
one depend on !6.6.

The Realtek RTL8261n patch needs to be refreshed
because of textual dependencies.

Realtek RTL838x DSA and phy patches also have textual
dependencies and need to be refreshed.

The Mediatek in-flight DSA patch and related patches
also need to be rebased and refreshed.

Link: https://github.com/openwrt/openwrt/pull/19970
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2025-09-15 08:34:55 +02:00

41 lines
1.3 KiB
Diff

From 7367bfc8b34d7ad5b0c06e19fe24533db22ed8ea Mon Sep 17 00:00:00 2001
From: Linus Walleij <linus.walleij@linaro.org>
Date: Wed, 13 Aug 2025 23:43:04 +0200
Subject: [PATCH 2/4] net: dsa: ks8995: Add proper RESET delay
According to the datasheet we need to wait 100us before accessing
any registers in the KS8995 after a reset de-assertion.
Add this delay, if and only if we obtained a GPIO descriptor,
otherwise it is just a pointless delay.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250813-ks8995-to-dsa-v1-2-75c359ede3a5@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/dsa/ks8995.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
--- a/drivers/net/dsa/ks8995.c
+++ b/drivers/net/dsa/ks8995.c
@@ -438,9 +438,15 @@ static int ks8995_probe(struct spi_devic
if (err)
return err;
- /* de-assert switch reset */
- /* FIXME: this likely requires a delay */
- gpiod_set_value_cansleep(ks->reset_gpio, 0);
+ if (ks->reset_gpio) {
+ /*
+ * If a reset line was obtained, wait for 100us after
+ * de-asserting RESET before accessing any registers, see
+ * the KS8995MA datasheet, page 44.
+ */
+ gpiod_set_value_cansleep(ks->reset_gpio, 0);
+ udelay(100);
+ }
spi_set_drvdata(spi, ks);