mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00

Uses upstream DSA switch modules (rtl8365mb, rtl8366), similar to RTL8367C and rtl8366rb swconfig drivers. The package dependencies exclude targets built without kernel CONFIG_OF. It also fixes the rtl8366rb LED support. Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com> Signed-off-by: Robert Marko <robimarko@gmail.com>
92 lines
2.9 KiB
Diff
92 lines
2.9 KiB
Diff
From 4667a1db2f550d23e01ba655fce331196ead6e92 Mon Sep 17 00:00:00 2001
|
|
From: Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
|
Date: Fri, 9 Feb 2024 02:03:40 -0300
|
|
Subject: net: dsa: realtek: keep variant reference in
|
|
realtek_priv
|
|
|
|
Instead of copying values from the variant, we can keep a reference in
|
|
realtek_priv.
|
|
|
|
This is a preliminary change for sharing code betwen interfaces. It will
|
|
allow to move most of the probe into a common module while still allow
|
|
code specific to each interface to read variant fields.
|
|
|
|
Signed-off-by: Luiz Angelo Daros de Luca <luizluca@gmail.com>
|
|
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
|
|
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
|
|
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
---
|
|
drivers/net/dsa/realtek/realtek-mdio.c | 4 +---
|
|
drivers/net/dsa/realtek/realtek-smi.c | 10 ++++------
|
|
drivers/net/dsa/realtek/realtek.h | 5 ++---
|
|
3 files changed, 7 insertions(+), 12 deletions(-)
|
|
|
|
--- a/drivers/net/dsa/realtek/realtek-mdio.c
|
|
+++ b/drivers/net/dsa/realtek/realtek-mdio.c
|
|
@@ -196,9 +196,7 @@ int realtek_mdio_probe(struct mdio_devic
|
|
priv->dev = &mdiodev->dev;
|
|
priv->chip_data = (void *)priv + sizeof(*priv);
|
|
|
|
- priv->clk_delay = var->clk_delay;
|
|
- priv->cmd_read = var->cmd_read;
|
|
- priv->cmd_write = var->cmd_write;
|
|
+ priv->variant = var;
|
|
priv->ops = var->ops;
|
|
|
|
priv->write_reg_noack = realtek_mdio_write;
|
|
--- a/drivers/net/dsa/realtek/realtek-smi.c
|
|
+++ b/drivers/net/dsa/realtek/realtek-smi.c
|
|
@@ -46,7 +46,7 @@
|
|
|
|
static inline void realtek_smi_clk_delay(struct realtek_priv *priv)
|
|
{
|
|
- ndelay(priv->clk_delay);
|
|
+ ndelay(priv->variant->clk_delay);
|
|
}
|
|
|
|
static void realtek_smi_start(struct realtek_priv *priv)
|
|
@@ -209,7 +209,7 @@ static int realtek_smi_read_reg(struct r
|
|
realtek_smi_start(priv);
|
|
|
|
/* Send READ command */
|
|
- ret = realtek_smi_write_byte(priv, priv->cmd_read);
|
|
+ ret = realtek_smi_write_byte(priv, priv->variant->cmd_read);
|
|
if (ret)
|
|
goto out;
|
|
|
|
@@ -250,7 +250,7 @@ static int realtek_smi_write_reg(struct
|
|
realtek_smi_start(priv);
|
|
|
|
/* Send WRITE command */
|
|
- ret = realtek_smi_write_byte(priv, priv->cmd_write);
|
|
+ ret = realtek_smi_write_byte(priv, priv->variant->cmd_write);
|
|
if (ret)
|
|
goto out;
|
|
|
|
@@ -459,9 +459,7 @@ int realtek_smi_probe(struct platform_de
|
|
|
|
/* Link forward and backward */
|
|
priv->dev = dev;
|
|
- priv->clk_delay = var->clk_delay;
|
|
- priv->cmd_read = var->cmd_read;
|
|
- priv->cmd_write = var->cmd_write;
|
|
+ priv->variant = var;
|
|
priv->ops = var->ops;
|
|
|
|
priv->setup_interface = realtek_smi_setup_mdio;
|
|
--- a/drivers/net/dsa/realtek/realtek.h
|
|
+++ b/drivers/net/dsa/realtek/realtek.h
|
|
@@ -58,9 +58,8 @@ struct realtek_priv {
|
|
struct mii_bus *bus;
|
|
int mdio_addr;
|
|
|
|
- unsigned int clk_delay;
|
|
- u8 cmd_read;
|
|
- u8 cmd_write;
|
|
+ const struct realtek_variant *variant;
|
|
+
|
|
spinlock_t lock; /* Locks around command writes */
|
|
struct dsa_switch *ds;
|
|
struct irq_domain *irqdomain;
|