mirror of
https://github.com/LiBwrt-op/openwrt-6.x.git
synced 2025-12-17 17:28:16 +00:00
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>
110 lines
3.1 KiB
Diff
110 lines
3.1 KiB
Diff
From 0e8d3f3623a45f69b6641ff9921ecd0c5afaa4ca Mon Sep 17 00:00:00 2001
|
|
From: Linus Walleij <linus.walleij@linaro.org>
|
|
Date: Wed, 13 Aug 2025 23:43:05 +0200
|
|
Subject: [PATCH 3/4] net: dsa: ks8995: Delete sysfs register access
|
|
|
|
There is some sysfs file to read and write registers randomly
|
|
in the ks8995 driver.
|
|
|
|
The contemporary way to achieve the same thing is to implement
|
|
regmap abstractions, if needed. Delete this and implement
|
|
regmap later if we want to be able to inspect individual registers.
|
|
|
|
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-3-75c359ede3a5@linaro.org
|
|
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
|
|
---
|
|
drivers/net/dsa/ks8995.c | 48 ----------------------------------------
|
|
1 file changed, 48 deletions(-)
|
|
|
|
--- a/drivers/net/dsa/ks8995.c
|
|
+++ b/drivers/net/dsa/ks8995.c
|
|
@@ -140,7 +140,6 @@ struct ks8995_switch {
|
|
struct spi_device *spi;
|
|
struct mutex lock;
|
|
struct gpio_desc *reset_gpio;
|
|
- struct bin_attribute regs_attr;
|
|
const struct ks8995_chip_params *chip;
|
|
int revision_id;
|
|
};
|
|
@@ -288,30 +287,6 @@ static int ks8995_reset(struct ks8995_sw
|
|
return ks8995_start(ks);
|
|
}
|
|
|
|
-static ssize_t ks8995_registers_read(struct file *filp, struct kobject *kobj,
|
|
- struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
|
|
-{
|
|
- struct device *dev;
|
|
- struct ks8995_switch *ks8995;
|
|
-
|
|
- dev = kobj_to_dev(kobj);
|
|
- ks8995 = dev_get_drvdata(dev);
|
|
-
|
|
- return ks8995_read(ks8995, buf, off, count);
|
|
-}
|
|
-
|
|
-static ssize_t ks8995_registers_write(struct file *filp, struct kobject *kobj,
|
|
- struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
|
|
-{
|
|
- struct device *dev;
|
|
- struct ks8995_switch *ks8995;
|
|
-
|
|
- dev = kobj_to_dev(kobj);
|
|
- ks8995 = dev_get_drvdata(dev);
|
|
-
|
|
- return ks8995_write(ks8995, buf, off, count);
|
|
-}
|
|
-
|
|
/* ks8995_get_revision - get chip revision
|
|
* @ks: pointer to switch instance
|
|
*
|
|
@@ -395,16 +370,6 @@ err_out:
|
|
return err;
|
|
}
|
|
|
|
-static const struct bin_attribute ks8995_registers_attr = {
|
|
- .attr = {
|
|
- .name = "registers",
|
|
- .mode = 0600,
|
|
- },
|
|
- .size = KS8995_REGS_SIZE,
|
|
- .read = ks8995_registers_read,
|
|
- .write = ks8995_registers_write,
|
|
-};
|
|
-
|
|
/* ------------------------------------------------------------------------ */
|
|
static int ks8995_probe(struct spi_device *spi)
|
|
{
|
|
@@ -462,21 +427,10 @@ static int ks8995_probe(struct spi_devic
|
|
if (err)
|
|
return err;
|
|
|
|
- memcpy(&ks->regs_attr, &ks8995_registers_attr, sizeof(ks->regs_attr));
|
|
- ks->regs_attr.size = ks->chip->regs_size;
|
|
-
|
|
err = ks8995_reset(ks);
|
|
if (err)
|
|
return err;
|
|
|
|
- sysfs_attr_init(&ks->regs_attr.attr);
|
|
- err = sysfs_create_bin_file(&spi->dev.kobj, &ks->regs_attr);
|
|
- if (err) {
|
|
- dev_err(&spi->dev, "unable to create sysfs file, err=%d\n",
|
|
- err);
|
|
- return err;
|
|
- }
|
|
-
|
|
dev_info(&spi->dev, "%s device found, Chip ID:%x, Revision:%x\n",
|
|
ks->chip->name, ks->chip->chip_id, ks->revision_id);
|
|
|
|
@@ -487,8 +441,6 @@ static void ks8995_remove(struct spi_dev
|
|
{
|
|
struct ks8995_switch *ks = spi_get_drvdata(spi);
|
|
|
|
- sysfs_remove_bin_file(&spi->dev.kobj, &ks->regs_attr);
|
|
-
|
|
/* assert reset */
|
|
gpiod_set_value_cansleep(ks->reset_gpio, 1);
|
|
}
|