]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
mediatek: fix Arioha AN8855 DSA driver for Linux 6.18
authorDaniel Golle <daniel@makrotopia.org>
Fri, 10 Apr 2026 19:58:57 +0000 (20:58 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Fri, 17 Apr 2026 13:37:52 +0000 (14:37 +0100)
Upstream changes to phylink require to make some small changes to our
downstream Airoha AN8855 DSA driver, so it build with Linux 6.18.
The efuse driver is upstream by now and can be dropped.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
target/linux/mediatek/files-6.18/drivers/net/dsa/an8855.c
target/linux/mediatek/files-6.18/drivers/nvmem/an8855-efuse.c [deleted file]

index 47a7d9b625b1f546edf11ce468215f45afaeb2c4..0a39368d6dd28e4b7f0237007e2e3f1cfbac6527 100644 (file)
@@ -1623,7 +1623,7 @@ static unsigned int an8855_pcs_inband_caps(struct phylink_pcs *pcs,
        return  LINK_INBAND_DISABLE;
 }
 
-static void an8855_pcs_get_state(struct phylink_pcs *pcs,
+static void an8855_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
                                 struct phylink_link_state *state)
 {
        struct an8855_priv *priv = container_of(pcs, struct an8855_priv, pcs);
@@ -2261,15 +2261,17 @@ static int an8855_switch_probe(struct platform_device *pdev)
        if (!priv->ds)
                return -ENOMEM;
 
+       ret = devm_mutex_init(priv->dev, &priv->reg_mutex);
+       if (ret)
+               return ret;
+
        priv->ds->dev = priv->dev;
        priv->ds->num_ports = AN8855_NUM_PORTS;
        priv->ds->priv = priv;
        priv->ds->ops = &an8855_switch_ops;
-       devm_mutex_init(priv->dev, &priv->reg_mutex);
        priv->ds->phylink_mac_ops = &an8855_phylink_mac_ops;
 
        priv->pcs.ops = &an8855_pcs_ops;
-       priv->pcs.neg_mode = true;
        priv->pcs.poll = true;
 
        dev_set_drvdata(priv->dev, priv);
@@ -2293,7 +2295,7 @@ MODULE_DEVICE_TABLE(of, an8855_switch_of_match);
 
 static struct platform_driver an8855_switch_driver = {
        .probe = an8855_switch_probe,
-       .remove_new = an8855_switch_remove,
+       .remove = an8855_switch_remove,
        .driver = {
                .name = "an8855-switch",
                .of_match_table = an8855_switch_of_match,
diff --git a/target/linux/mediatek/files-6.18/drivers/nvmem/an8855-efuse.c b/target/linux/mediatek/files-6.18/drivers/nvmem/an8855-efuse.c
deleted file mode 100644 (file)
index 7940453..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-/*
- *  Airoha AN8855 Switch EFUSE Driver
- */
-
-#include <linux/mod_devicetable.h>
-#include <linux/module.h>
-#include <linux/nvmem-provider.h>
-#include <linux/platform_device.h>
-#include <linux/regmap.h>
-
-#define AN8855_EFUSE_CELL              50
-
-#define AN8855_EFUSE_DATA0             0x1000a500
-#define   AN8855_EFUSE_R50O            GENMASK(30, 24)
-
-static int an8855_efuse_read(void *context, unsigned int offset,
-                            void *val, size_t bytes)
-{
-       struct regmap *regmap = context;
-
-       return regmap_bulk_read(regmap, AN8855_EFUSE_DATA0 + offset,
-                               val, bytes / sizeof(u32));
-}
-
-static int an8855_efuse_probe(struct platform_device *pdev)
-{
-       struct nvmem_config an8855_nvmem_config = {
-               .name = "an8855-efuse",
-               .size = AN8855_EFUSE_CELL * sizeof(u32),
-               .stride = sizeof(u32),
-               .word_size = sizeof(u32),
-               .reg_read = an8855_efuse_read,
-       };
-       struct device *dev = &pdev->dev;
-       struct nvmem_device *nvmem;
-
-       /* Assign NVMEM priv to MFD regmap */
-       an8855_nvmem_config.priv = dev_get_regmap(dev->parent, NULL);
-       an8855_nvmem_config.dev = dev;
-       nvmem = devm_nvmem_register(dev, &an8855_nvmem_config);
-
-       return PTR_ERR_OR_ZERO(nvmem);
-}
-
-static const struct of_device_id an8855_efuse_of_match[] = {
-       { .compatible = "airoha,an8855-efuse", },
-       { /* sentinel */ }
-};
-MODULE_DEVICE_TABLE(of, an8855_efuse_of_match);
-
-static struct platform_driver an8855_efuse_driver = {
-       .probe = an8855_efuse_probe,
-       .driver = {
-               .name = "an8855-efuse",
-               .of_match_table = an8855_efuse_of_match,
-       },
-};
-module_platform_driver(an8855_efuse_driver);
-
-MODULE_AUTHOR("Christian Marangi <ansuelsmth@gmail.com>");
-MODULE_DESCRIPTION("Driver for AN8855 Switch EFUSE");
-MODULE_LICENSE("GPL");