net: dsa: add support for MT7988
Subsystems (6)
Daniel Golle
maintainerv2 cover net: dsa: add support for MT7988
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver.
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference board
Changes since v1:
* use 'internal' PHY mode where appropriate
* use regmap_update_bits in mt7530_rmw
* improve dt-bindings
Changes since RFC v3:
* WARN_ON_ONCE if register read fails
* move probing of the reset GPIO and reset controller link out of common probe function, as they are not actually common
Changes since RFC v2:
* split into many small commits to ease review
* introduce helper functions to reduce code duplication
* use helpers for locking to make lock-skipping easier and less ugly to implement.
* add dt-bindings for mediatek,mt7988-switch
Changes since initial RFC:
* use regmap for register access and move register access to bus- specific driver
* move initialization of MT7531 SGMII PCS to MDIO driver
Daniel Golle (14):
net: dsa: mt7530: make some noise if register read fails
net: dsa: mt7530: refactor SGMII PCS creation
net: dsa: mt7530: use unlocked regmap accessors
net: dsa: mt7530: use regmap to access switch register space
net: dsa: mt7530: move SGMII PCS creation to mt7530_probe function
net: dsa: mt7530: introduce mutex helpers
net: dsa: mt7530: move p5_intf_modes() function to mt7530.c
net: dsa: mt7530: introduce mt7530_probe_common helper function
net: dsa: mt7530: introduce mt7530_remove_common helper function
net: dsa: mt7530: split-off common parts from mt7531_setup
net: dsa: mt7530: introduce separate MDIO driver
net: dsa: mt7530: skip locking if MDIO bus isn't present
net: dsa: mt7530: introduce driver for MT7988 built-in switch
dt-bindings: net: dsa: mediatek,mt7530: add mediatek,mt7988-switch
.../bindings/net/dsa/mediatek,mt7530.yaml | 26 +- MAINTAINERS | 3 + drivers/net/dsa/Kconfig | 27 +- drivers/net/dsa/Makefile | 2 + drivers/net/dsa/mt7530-mdio.c | 271 +++++++++ drivers/net/dsa/mt7530-mmio.c | 101 ++++ drivers/net/dsa/mt7530.c | 565 +++++++++--------- drivers/net/dsa/mt7530.h | 38 +- 8 files changed, 713 insertions(+), 320 deletions(-) create mode 100644 drivers/net/dsa/mt7530-mdio.c create mode 100644 drivers/net/dsa/mt7530-mmio.c
base-commit: 51aaa68222d6c34f0373cf95223ce2f230329e8f
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 1/14 net: dsa: mt7530: make some noise if register read fails
Simply returning the negative error value instead of the read value doesn't seem like a good idea. Return 0 instead and add WARN_ON_ONCE(1) so this kind of error will not go unnoticed.
--- drivers/net/dsa/mt7530.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/dsa/mt7530.c +2 -1
@@ -224,9 +224,10 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg)/* MT7530 uses 31 as the pseudo port */ ret = bus->write (bus,0x1f ,0x1f , page);if (ret <0 ) { +WARN_ON_ONCE (1 );dev_err (&bus->dev,"failed to read mt7530 register\n" ); -return ret; +return 0 ; } lo = bus->read (bus,0x1f , r);
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 2/14 net: dsa: mt7530: refactor SGMII PCS creation
In reply to Daniel GolleInstead of macro templates use a dedidated function and allocated regmap_config when creating the regmaps for the pcs-mtk-lynxi instances.
This is in preparation to switching to use unlocked regmap accessors and have regmap's locking API handle locking for us.
--- drivers/net/dsa/mt7530.c | 74 +++++++++++++++++++++++++++------------- 1 file changed, 50 insertions(+), 24 deletions(-)
drivers/net/dsa/mt7530.c +50 -24
@@ -2927,26 +2927,56 @@ static const struct regmap_bus mt7531_regmap_bus = { .reg_update_bits = mt7530_regmap_update_bits, }; -#define MT7531_PCS_REGMAP_CONFIG (_name, _reg_base) \ - { \ - .name = _name, \ - .reg_bits = 16, \ - .val_bits = 32, \ - .reg_stride = 4, \ - .reg_base = _reg_base, \ - .max_register = 0x17c, \ - } - -static const struct regmap_config mt7531_pcs_config[] = { -MT7531_PCS_REGMAP_CONFIG ("port5" ,MT7531_SGMII_REG_BASE (5 )), -MT7531_PCS_REGMAP_CONFIG ("port6" ,MT7531_SGMII_REG_BASE (6 )), -}; +static int +mt7531_create_sgmii (struct mt7530_priv *priv) +{ +struct regmap_config *mt7531_pcs_config[2 ]; +struct phylink_pcs *pcs; +struct regmap *regmap; +int i, ret =0 ; + +for (i =0 ; i <2 ; i++) { + mt7531_pcs_config[i] =devm_kzalloc (priv->dev, +sizeof (struct regmap_config ), +GFP_KERNEL ); +if (!mt7531_pcs_config[i]) { + ret = -ENOMEM ; +break ; + } + + mt7531_pcs_config[i]->name = i ?"port6" :"port5" ; + mt7531_pcs_config[i]->reg_bits =16 ; + mt7531_pcs_config[i]->val_bits =32 ; + mt7531_pcs_config[i]->reg_stride =4 ; + mt7531_pcs_config[i]->reg_base =MT7531_SGMII_REG_BASE (5 + i); + mt7531_pcs_config[i]->max_register =0x17c ; + + regmap =devm_regmap_init (priv->dev, + &mt7531_regmap_bus, priv, + mt7531_pcs_config[i]); +if (IS_ERR (regmap)) { + ret =PTR_ERR (regmap); +break ; + } + pcs =mtk_pcs_lynxi_create (priv->dev, regmap, +MT7531_PHYA_CTRL_SIGNAL3 ,0 ); +if (!pcs) { + ret = -ENXIO ; +break ; + } + priv->ports[5 + i].sgmii_pcs = pcs; + } + +if (ret && i) +mtk_pcs_lynxi_destroy (priv->ports[5 ].sgmii_pcs); + +return ret; +}static int mt753x_setup (struct dsa_switch *ds) {struct mt7530_priv *priv = ds->priv; -struct regmap *regmap;int i, ret;/* Initialise the PCS devices */
@@ -2968,15 +2998,11 @@ mt753x_setup(struct dsa_switch *ds)if (ret && priv->irq)mt7530_free_irq_common (priv); -if (priv->id ==ID_MT7531 ) -for (i =0 ; i <2 ; i++) { - regmap =devm_regmap_init (ds->dev, - &mt7531_regmap_bus, priv, - &mt7531_pcs_config[i]); - priv->ports[5 + i].sgmii_pcs = -mtk_pcs_lynxi_create (ds->dev, regmap, -MT7531_PHYA_CTRL_SIGNAL3 ,0 ); - } +if (priv->id ==ID_MT7531 ) { + ret =mt7531_create_sgmii (priv); +if (ret && priv->irq) +mt7530_free_irq_common (priv); + }return ret; }
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 3/14 net: dsa: mt7530: use unlocked regmap accessors
In reply to Daniel GolleInstead of wrapping the locked register accessor functions, use the unlocked variants and add locking wrapper functions to let regmap handle the locking.
This is a preparation towards being able to always use regmap to access switch registers instead of open-coded accessor functions.
--- drivers/net/dsa/mt7530.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
drivers/net/dsa/mt7530.c +14 -9
@@ -2900,7 +2900,7 @@ static int mt7530_regmap_read(void *context, unsigned int reg, unsigned int *val {struct mt7530_priv *priv = context; - *val =mt7530_read (priv, reg); + *val =mt7530_mii_read (priv, reg);return 0 ; };
@@ -2908,23 +2908,25 @@ static int mt7530_regmap_write(void *context, unsigned int reg, unsigned int val {struct mt7530_priv *priv = context; -mt7530_write (priv, reg, val); +mt7530_mii_write (priv, reg, val);return 0 ; }; -static int mt7530_regmap_update_bits (void *context,unsigned int reg, -unsigned int mask,unsigned int val) +static void +mt7530_mdio_regmap_lock (void *mdio_lock) { -struct mt7530_priv *priv = context; +mutex_lock_nested (mdio_lock,MDIO_MUTEX_NESTED ); +} -mt7530_rmw (priv, reg, mask, val); -return 0 ; -}; +static void +mt7530_mdio_regmap_unlock (void *mdio_lock) +{ +mutex_unlock (mdio_lock); +}static const struct regmap_bus mt7531_regmap_bus = { .reg_write = mt7530_regmap_write, .reg_read = mt7530_regmap_read, - .reg_update_bits = mt7530_regmap_update_bits, }; static int
@@ -2950,6 +2952,9 @@ mt7531_create_sgmii(struct mt7530_priv *priv) mt7531_pcs_config[i]->reg_stride =4 ; mt7531_pcs_config[i]->reg_base =MT7531_SGMII_REG_BASE (5 + i); mt7531_pcs_config[i]->max_register =0x17c ; + mt7531_pcs_config[i]->lock = mt7530_mdio_regmap_lock; + mt7531_pcs_config[i]->unlock = mt7530_mdio_regmap_unlock; + mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; regmap = devm_regmap_init(priv->dev, &mt7531_regmap_bus, priv,
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 4/14 net: dsa: mt7530: use regmap to access switch register space
In reply to Daniel GolleUse regmap API to access the switch register space.
--- drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++++---------------- drivers/net/dsa/mt7530.h | 2 + 2 files changed, 62 insertions(+), 39 deletions(-)
drivers/net/dsa/mt7530.c +60 -39
@@ -183,9 +183,9 @@ core_clear(struct mt7530_priv *priv, u32 reg, u32 val) }static int -mt7530_mii_write (struct mt7530_priv *priv,u32 reg,u32 val) +mt7530_regmap_write (void *context,unsigned int reg,unsigned int val) { -struct mii_bus *bus = priv->bus; +struct mii_bus *bus = context;u16 page, r, lo, hi;int ret;
@@ -197,24 +197,34 @@ mt7530_mii_write(struct mt7530_priv *priv, u32 reg, u32 val)/* MT7530 uses 31 as the pseudo port */ ret = bus->write (bus,0x1f ,0x1f , page);if (ret <0 ) - goto err; +return ret; ret = bus->write (bus,0x1f , r, lo);if (ret <0 ) - goto err; +return ret; ret = bus->write (bus,0x1f ,0x10 , hi); -err: +return ret; +} + +static int +mt7530_mii_write (struct mt7530_priv *priv,u32 reg,u32 val) +{ +int ret; + + ret =regmap_write (priv->regmap, reg, val); +if (ret <0 ) -dev_err (&bus->dev, +dev_err (priv->dev,"failed to write mt7530 register\n" ); +return ret; } -static u32 -mt7530_mii_read (struct mt7530_priv *priv,u32 reg) +static int +mt7530_regmap_read (void *context,unsigned int reg,unsigned int *val) { -struct mii_bus *bus = priv->bus; +struct mii_bus *bus = context;u16 page, r, lo, hi;int ret;
@@ -223,17 +233,32 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg)/* MT7530 uses 31 as the pseudo port */ ret = bus->write (bus,0x1f ,0x1f , page); -if (ret <0 ) { +if (ret <0 ) +return ret; + + lo = bus->read (bus,0x1f , r); + hi = bus->read (bus,0x1f ,0x10 ); + + *val = (hi <<16 ) | (lo &0xffff ); + +return 0 ; +} + +static u32 +mt7530_mii_read (struct mt7530_priv *priv,u32 reg) +{ +int ret; +u32 val; + + ret =regmap_read (priv->regmap, reg, &val); +if (ret) {WARN_ON_ONCE (1 ); -dev_err (&bus->dev, +dev_err (priv->dev,"failed to read mt7530 register\n" );return 0 ; } - lo = bus->read (bus,0x1f , r); - hi = bus->read (bus,0x1f ,0x10 ); - -return (hi <<16 ) | (lo &0xffff ); +return val; } static void
@@ -283,14 +308,10 @@ mt7530_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set) {struct mii_bus *bus = priv->bus; -u32 val;mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); - val =mt7530_mii_read (priv, reg); - val &= ~mask; - val |= set; -mt7530_mii_write (priv, reg, val); +regmap_update_bits (priv->regmap, reg, mask, set);mutex_unlock (&bus->mdio_lock); }
@@ -298,7 +319,7 @@ mt7530_rmw(struct mt7530_priv *priv, u32 reg,static void mt7530_set (struct mt7530_priv *priv,u32 reg,u32 val) { -mt7530_rmw (priv, reg,0 , val); +mt7530_rmw (priv, reg, val, val); } static void
@@ -2896,22 +2917,6 @@ static const struct phylink_pcs_ops mt7530_pcs_ops = { .pcs_an_restart = mt7530_pcs_an_restart, }; -static int mt7530_regmap_read (void *context,unsigned int reg,unsigned int *val) -{ -struct mt7530_priv *priv = context; - - *val =mt7530_mii_read (priv, reg); -return 0 ; -}; - -static int mt7530_regmap_write (void *context,unsigned int reg,unsigned int val) -{ -struct mt7530_priv *priv = context; - -mt7530_mii_write (priv, reg, val); -return 0 ; -}; -static void mt7530_mdio_regmap_lock (void *mdio_lock) {
@@ -2924,7 +2929,7 @@ mt7530_mdio_regmap_unlock(void *mdio_lock)mutex_unlock (mdio_lock); } -static const struct regmap_bus mt7531_regmap_bus = { +static const struct regmap_bus mt7530_regmap_bus = { .reg_write = mt7530_regmap_write, .reg_read = mt7530_regmap_read, };
@@ -2957,7 +2962,7 @@ mt7531_create_sgmii(struct mt7530_priv *priv) mt7531_pcs_config[i]->lock_arg = &priv->bus->mdio_lock; regmap =devm_regmap_init (priv->dev, - &mt7531_regmap_bus, priv, + &mt7530_regmap_bus, priv->bus, mt7531_pcs_config[i]);if (IS_ERR (regmap)) { ret =PTR_ERR (regmap);
@@ -3128,6 +3133,7 @@ MODULE_DEVICE_TABLE(of, mt7530_of_match);static int mt7530_probe (struct mdio_device *mdiodev) { +static struct regmap_config *regmap_config;struct mt7530_priv *priv;struct device_node *dn;
@@ -3207,6 +3213,21 @@ mt7530_probe(struct mdio_device *mdiodev)mutex_init (&priv->reg_mutex);dev_set_drvdata (&mdiodev->dev, priv); + regmap_config =devm_kzalloc (&mdiodev->dev,sizeof (*regmap_config), +GFP_KERNEL ); +if (!regmap_config) +return -ENOMEM ; + + regmap_config->reg_bits =16 ; + regmap_config->val_bits =32 ; + regmap_config->reg_stride =4 ; + regmap_config->max_register =MT7530_CREV ; + regmap_config->disable_locking = true; + priv->regmap =devm_regmap_init (priv->dev, &mt7530_regmap_bus, + priv->bus, regmap_config); +if (IS_ERR (priv->regmap)) +return PTR_ERR (priv->regmap); +return dsa_register_switch (priv->ds); }
drivers/net/dsa/mt7530.h +2 -0
@@ -754,6 +754,7 @@ struct mt753x_info {* @dev: The device pointer * @ds: The pointer to the dsa core structure * @bus: The bus used for the device and built-in PHY +* @regmap: The regmap instance representing all switch registers * @rstc: The pointer to reset control used by MCM * @core_pwr: The power supplied into the core * @io_pwr: The power supplied into the I/O
@@ -774,6 +775,7 @@ struct mt7530_priv {struct device *dev;struct dsa_switch *ds;struct mii_bus *bus; +struct regmap *regmap;struct reset_control *rstc;struct regulator *core_pwr;struct regulator *io_pwr;
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 5/14 net: dsa: mt7530: move SGMII PCS creation to mt7530_probe function
In reply to Daniel GolleMove creating the SGMII PCS from mt753x_setup() to the more appropriate mt7530_probe() function.
This is done also in preparation of moving all functions related to MDIO-connected MT753x switches to a separate module.
--- drivers/net/dsa/mt7530.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/dsa/mt7530.c +7 -6
@@ -3008,12 +3008,6 @@ mt753x_setup(struct dsa_switch *ds)if (ret && priv->irq)mt7530_free_irq_common (priv); -if (priv->id ==ID_MT7531 ) { - ret =mt7531_create_sgmii (priv); -if (ret && priv->irq) -mt7530_free_irq_common (priv); - } -return ret; }
@@ -3136,6 +3130,7 @@ mt7530_probe(struct mdio_device *mdiodev)static struct regmap_config *regmap_config;struct mt7530_priv *priv;struct device_node *dn; +int ret; dn = mdiodev->dev.of_node;
@@ -3228,6 +3223,12 @@ mt7530_probe(struct mdio_device *mdiodev)if (IS_ERR (priv->regmap))return PTR_ERR (priv->regmap); +if (priv->id ==ID_MT7531 ) { + ret =mt7531_create_sgmii (priv); +if (ret) +return ret; + } +return dsa_register_switch (priv->ds); }
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 6/14 net: dsa: mt7530: introduce mutex helpers
In reply to Daniel GolleAs the MDIO bus lock only needs to be involved if actually operating on an MDIO-connected switch we will need to skip locking for built-in switches which are accessed via MMIO.
Create helper functions which simplify that upcoming change.
--- drivers/net/dsa/mt7530.c | 73 ++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 37 deletions(-)
drivers/net/dsa/mt7530.c +36 -37
@@ -143,31 +143,40 @@ core_write_mmd_indirect(struct mt7530_priv *priv, int prtad, }static void -core_write (struct mt7530_priv *priv,u32 reg,u32 val) +mt7530_mutex_lock (struct mt7530_priv *priv) { -struct mii_bus *bus = priv->bus; +mutex_lock_nested (&priv->bus->mdio_lock,MDIO_MUTEX_NESTED ); +} -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +static void +mt7530_mutex_unlock (struct mt7530_priv *priv) +{ +mutex_unlock (&priv->bus->mdio_lock); +} + +static void +core_write (struct mt7530_priv *priv,u32 reg,u32 val) +{ +mt7530_mutex_lock (priv);core_write_mmd_indirect (priv, reg,MDIO_MMD_VEND2 , val); -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv); }static void core_rmw (struct mt7530_priv *priv,u32 reg,u32 mask,u32 set) { -struct mii_bus *bus = priv->bus;u32 val; -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); val =core_read_mmd_indirect (priv, reg,MDIO_MMD_VEND2 ); val &= ~mask; val |= set;core_write_mmd_indirect (priv, reg,MDIO_MMD_VEND2 , val); -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv); } static void
@@ -264,13 +273,11 @@ mt7530_mii_read(struct mt7530_priv *priv, u32 reg)static void mt7530_write (struct mt7530_priv *priv,u32 reg,u32 val) { -struct mii_bus *bus = priv->bus; - -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv);mt7530_mii_write (priv, reg, val); -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv); } static u32
@@ -282,14 +289,13 @@ _mt7530_unlocked_read(struct mt7530_dummy_poll *p)static u32 _mt7530_read (struct mt7530_dummy_poll *p) { -struct mii_bus *bus = p->priv->bus;u32 val; -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (p->priv); val =mt7530_mii_read (p->priv, p->reg); -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (p->priv);return val; }
@@ -307,13 +313,11 @@ static void mt7530_rmw(struct mt7530_priv *priv, u32 reg, u32 mask, u32 set) { - struct mii_bus *bus = priv->bus; - -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv);regmap_update_bits (priv->regmap, reg, mask, set); -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv); } static void
@@ -657,14 +661,13 @@ static int mt7531_ind_c45_phy_read(struct mt7530_priv *priv, int port, int devad, int regnum) { - struct mii_bus *bus = priv->bus; struct mt7530_dummy_poll p;u32 reg, val;int ret;INIT_MT7530_DUMMY_POLL (&p, priv,MT7531_PHY_IAC ); -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); ret =readx_poll_timeout (_mt7530_unlocked_read, &p, val, !(val &MT7531_PHY_ACS_ST ),20 ,100000 );
@@ -697,7 +700,7 @@ mt7531_ind_c45_phy_read(struct mt7530_priv *priv, int port, int devad, ret = val &MT7531_MDIO_RW_DATA_MASK ; out: -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv);return ret; }
@@ -706,14 +709,13 @@ static int mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad, int regnum, u16 data) { - struct mii_bus *bus = priv->bus; struct mt7530_dummy_poll p;u32 val, reg;int ret;INIT_MT7530_DUMMY_POLL (&p, priv,MT7531_PHY_IAC ); -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); ret =readx_poll_timeout (_mt7530_unlocked_read, &p, val, !(val &MT7531_PHY_ACS_ST ),20 ,100000 );
@@ -745,7 +747,7 @@ mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad, } out: -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv);return ret; }
@@ -753,14 +755,13 @@ mt7531_ind_c45_phy_write(struct mt7530_priv *priv, int port, int devad,static int mt7531_ind_c22_phy_read (struct mt7530_priv *priv,int port,int regnum) { -struct mii_bus *bus = priv->bus;struct mt7530_dummy_poll p;int ret;u32 val;INIT_MT7530_DUMMY_POLL (&p, priv,MT7531_PHY_IAC ); -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); ret =readx_poll_timeout (_mt7530_unlocked_read, &p, val, !(val &MT7531_PHY_ACS_ST ),20 ,100000 );
@@ -783,7 +784,7 @@ mt7531_ind_c22_phy_read(struct mt7530_priv *priv, int port, int regnum) ret = val &MT7531_MDIO_RW_DATA_MASK ; out: -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv);return ret; }
@@ -792,14 +793,13 @@ static int mt7531_ind_c22_phy_write(struct mt7530_priv *priv, int port, int regnum, u16 data) { - struct mii_bus *bus = priv->bus; struct mt7530_dummy_poll p;int ret;u32 reg;INIT_MT7530_DUMMY_POLL (&p, priv,MT7531_PHY_IAC ); -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); ret =readx_poll_timeout (_mt7530_unlocked_read, &p, reg, !(reg &MT7531_PHY_ACS_ST ),20 ,100000 );
@@ -821,7 +821,7 @@ mt7531_ind_c22_phy_write(struct mt7530_priv *priv, int port, int regnum, } out: -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv);return ret; }
@@ -1102,7 +1102,6 @@ static int mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct mt7530_priv *priv = ds->priv; -struct mii_bus *bus = priv->bus;int length;u32 val;
@@ -1113,7 +1112,7 @@ mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)if (!dsa_is_cpu_port (ds, port))return 0 ; -mutex_lock_nested (&bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); val =mt7530_mii_read (priv,MT7530_GMACCR ); val &= ~MAX_RX_PKT_LEN_MASK ;
@@ -1134,7 +1133,7 @@ mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)mt7530_mii_write (priv,MT7530_GMACCR , val); -mutex_unlock (&bus->mdio_lock); +mt7530_mutex_unlock (priv);return 0 ; }
@@ -1935,10 +1934,10 @@ mt7530_irq_thread_fn(int irq, void *dev_id)u32 val;int p; -mutex_lock_nested (&priv->bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); val =mt7530_mii_read (priv,MT7530_SYS_INT_STS );mt7530_mii_write (priv,MT7530_SYS_INT_STS , val); -mutex_unlock (&priv->bus->mdio_lock); +mt7530_mutex_unlock (priv);for (p =0 ; p <MT7530_NUM_PHYS ; p++) {if (BIT (p) & val) {
@@ -1974,7 +1973,7 @@ mt7530_irq_bus_lock(struct irq_data *d) {struct mt7530_priv *priv =irq_data_get_irq_chip_data (d); -mutex_lock_nested (&priv->bus->mdio_lock,MDIO_MUTEX_NESTED ); +mt7530_mutex_lock (priv); } static void
@@ -1983,7 +1982,7 @@ mt7530_irq_bus_sync_unlock(struct irq_data *d)struct mt7530_priv *priv =irq_data_get_irq_chip_data (d);mt7530_mii_write (priv,MT7530_SYS_INT_EN , priv->irq_enable); -mutex_unlock (&priv->bus->mdio_lock); +mt7530_mutex_unlock (priv); }static struct irq_chip mt7530_irq_chip = {
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 7/14 net: dsa: mt7530: move p5_intf_modes() function to mt7530.c
In reply to Daniel GolleIn preparation of splitting mt7530.c into a driver for MDIO-connected as well as MDIO-accessed built-in switches on one hand and MMIO-accessed built-in switches move the p5_inft_modes() function from mt7530.h to mt7530.c. The function is only needed there and will trigger a compiler warning about a defined but unused function otherwise when including mt7530.h in the to-be-introduced bus-specific drivers.
--- drivers/net/dsa/mt7530.c | 18 ++++++++++++++++++ drivers/net/dsa/mt7530.h | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/net/dsa/mt7530.c +18 -0
@@ -943,6 +943,24 @@ mt7530_set_ageing_time(struct dsa_switch *ds, unsigned int msecs)return 0 ; } +static const char *p5_intf_modes (unsigned int p5_interface) +{ +switch (p5_interface) { +case P5_DISABLED : +return "DISABLED" ; +case P5_INTF_SEL_PHY_P0 : +return "PHY P0" ; +case P5_INTF_SEL_PHY_P4 : +return "PHY P4" ; +case P5_INTF_SEL_GMAC5 : +return "GMAC5" ; +case P5_INTF_SEL_GMAC5_SGMII : +return "GMAC5_SGMII" ; +default : +return "unknown" ; + } +} +static void mt7530_setup_port5 (struct dsa_switch *ds,phy_interface_t interface) {struct mt7530_priv *priv = ds->priv;
drivers/net/dsa/mt7530.h +0 -18
@@ -682,24 +682,6 @@ enum p5_interface_select { P5_INTF_SEL_GMAC5_SGMII, }; -static const char *p5_intf_modes (unsigned int p5_interface) -{ -switch (p5_interface) { -case P5_DISABLED : -return "DISABLED" ; -case P5_INTF_SEL_PHY_P0 : -return "PHY P0" ; -case P5_INTF_SEL_PHY_P4 : -return "PHY P4" ; -case P5_INTF_SEL_GMAC5 : -return "GMAC5" ; -case P5_INTF_SEL_GMAC5_SGMII : -return "GMAC5_SGMII" ; -default : -return "unknown" ; - } -} -struct mt7530_priv ;struct mt753x_pcs {
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 8/14 net: dsa: mt7530: introduce mt7530_probe_common helper function
In reply to Daniel GolleMove commonly used parts from mt7530_probe into new mt7530_probe_common helper function which will be used by both, mt7530_probe and the to-be-introduced mt7988_probe.
--- drivers/net/dsa/mt7530.c | 98 ++++++++++++++++++++++------------------ 1 file changed, 54 insertions(+), 44 deletions(-)
drivers/net/dsa/mt7530.c +54 -44
@@ -3142,44 +3142,21 @@ static const struct of_device_id mt7530_of_match[] = {MODULE_DEVICE_TABLE (of, mt7530_of_match);static int -mt7530_probe (struct mdio_device *mdiodev) +mt7530_probe_common (struct mt7530_priv *priv) { -static struct regmap_config *regmap_config; -struct mt7530_priv *priv; -struct device_node *dn; -int ret; - - dn = mdiodev->dev.of_node; - - priv =devm_kzalloc (&mdiodev->dev,sizeof (*priv),GFP_KERNEL ); -if (!priv) -return -ENOMEM ; +struct device *dev = priv->dev; - priv->ds =devm_kzalloc (&mdiodev->dev,sizeof (*priv->ds),GFP_KERNEL ); + priv->ds =devm_kzalloc (dev,sizeof (*priv->ds),GFP_KERNEL );if (!priv->ds)return -ENOMEM ; - priv->ds->dev = &mdiodev->dev; + priv->ds->dev = dev; priv->ds->num_ports =MT7530_NUM_PORTS ; -/* Use medatek,mcm property to distinguish hardware type that would -* casues a little bit differences on power-on sequence. -*/ - priv->mcm =of_property_read_bool (dn,"mediatek,mcm" ); -if (priv->mcm) { -dev_info (&mdiodev->dev,"MT7530 adapts as multi-chip module\n" ); - - priv->rstc =devm_reset_control_get (&mdiodev->dev,"mcm" ); -if (IS_ERR (priv->rstc)) { -dev_err (&mdiodev->dev,"Couldn't get our reset line\n" ); -return PTR_ERR (priv->rstc); - } - } -/* Get the hardware identifier from the devicetree node. * We will need it for some of the clock and regulator setup. */ - priv->info =of_device_get_match_data (&mdiodev->dev); + priv->info =of_device_get_match_data (dev);if (!priv->info)return -EINVAL ;
@@ -3193,23 +3170,53 @@ mt7530_probe(struct mdio_device *mdiodev)return -EINVAL ; priv->id = priv->info->id; + priv->dev = dev; + priv->ds->priv = priv; + priv->ds->ops = &mt7530_switch_ops; +mutex_init (&priv->reg_mutex); +dev_set_drvdata (dev, priv); -if (priv->id ==ID_MT7530 ) { - priv->core_pwr =devm_regulator_get (&mdiodev->dev,"core" ); -if (IS_ERR (priv->core_pwr)) -return PTR_ERR (priv->core_pwr); +return 0 ; +} - priv->io_pwr =devm_regulator_get (&mdiodev->dev,"io" ); -if (IS_ERR (priv->io_pwr)) -return PTR_ERR (priv->io_pwr); - } +static int +mt7530_probe (struct mdio_device *mdiodev) +{ +static struct regmap_config *regmap_config; +struct mt7530_priv *priv; +struct device_node *dn; +int ret; + + dn = mdiodev->dev.of_node; -/* Not MCM that indicates switch works as the remote standalone + priv =devm_kzalloc (&mdiodev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->bus = mdiodev->bus; + priv->dev = &mdiodev->dev; + + ret =mt7530_probe_common (priv); +if (ret) +return ret; + +/* Use medatek,mcm property to distinguish hardware type that would +* cause a little bit differences on power-on sequence. +* Not MCM that indicates switch works as the remote standalone * integrated circuit so the GPIO pin would be used to complete * the reset, otherwise memory-mapped register accessing used * through syscon provides in the case of MCM. */ -if (!priv->mcm) { + priv->mcm =of_property_read_bool (dn,"mediatek,mcm" ); +if (priv->mcm) { +dev_info (&mdiodev->dev,"MT7530 adapts as multi-chip module\n" ); + + priv->rstc =devm_reset_control_get (&mdiodev->dev,"mcm" ); +if (IS_ERR (priv->rstc)) { +dev_err (&mdiodev->dev,"Couldn't get our reset line\n" ); +return PTR_ERR (priv->rstc); + } + }else { priv->reset =devm_gpiod_get_optional (&mdiodev->dev,"reset" ,GPIOD_OUT_LOW );if (IS_ERR (priv->reset)) {
@@ -3218,12 +3225,15 @@ mt7530_probe(struct mdio_device *mdiodev) } } - priv->bus = mdiodev->bus; - priv->dev = &mdiodev->dev; - priv->ds->priv = priv; - priv->ds->ops = &mt7530_switch_ops; -mutex_init (&priv->reg_mutex); -dev_set_drvdata (&mdiodev->dev, priv); +if (priv->id ==ID_MT7530 ) { + priv->core_pwr =devm_regulator_get (&mdiodev->dev,"core" ); +if (IS_ERR (priv->core_pwr)) +return PTR_ERR (priv->core_pwr); + + priv->io_pwr =devm_regulator_get (&mdiodev->dev,"io" ); +if (IS_ERR (priv->io_pwr)) +return PTR_ERR (priv->io_pwr); + } regmap_config =devm_kzalloc (&mdiodev->dev,sizeof (*regmap_config),GFP_KERNEL );
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 9/14 net: dsa: mt7530: introduce mt7530_remove_common helper function
In reply to Daniel GolleMove commonly used parts from mt7530_remove into new mt7530_remove_common helper function which will be used by both, mt7530_remove and the to-be-introduced mt7988_remove.
--- drivers/net/dsa/mt7530.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
drivers/net/dsa/mt7530.c +12 -6
@@ -3259,6 +3259,17 @@ mt7530_probe(struct mdio_device *mdiodev)return dsa_register_switch (priv->ds); } +static void +mt7530_remove_common (struct mt7530_priv *priv) +{ +if (priv->irq) +mt7530_free_irq (priv); + +dsa_unregister_switch (priv->ds); + +mutex_destroy (&priv->reg_mutex); +} +static void mt7530_remove (struct mdio_device *mdiodev) {
@@ -3278,15 +3289,10 @@ mt7530_remove(struct mdio_device *mdiodev)dev_err (priv->dev,"Failed to disable io pwr: %d\n" , ret); -if (priv->irq) -mt7530_free_irq (priv); - -dsa_unregister_switch (priv->ds); +mt7530_remove_common (priv);for (i =0 ; i <2 ; ++i)mtk_pcs_lynxi_destroy (priv->ports[5 + i].sgmii_pcs); - -mutex_destroy (&priv->reg_mutex); }static void mt7530_shutdown (struct mdio_device *mdiodev)
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 10/14 net: dsa: mt7530: split-off common parts from mt7531_setup
In reply to Daniel GolleMT7988 shares a significant part of the setup function with MT7531. Split-off those parts into a shared function which is going to be used also by mt7988_setup.
--- drivers/net/dsa/mt7530.c | 99 ++++++++++++++++++++++------------------ 1 file changed, 55 insertions(+), 44 deletions(-)
drivers/net/dsa/mt7530.c +55 -44
@@ -2347,12 +2347,65 @@ mt7530_setup(struct dsa_switch *ds)return 0 ; } +static int +mt7531_setup_common (struct dsa_switch *ds) +{ +struct mt7530_priv *priv = ds->priv; +struct dsa_port *cpu_dp; +int ret, i; + +/* BPDU to CPU port */ +dsa_switch_for_each_cpu_port (cpu_dp, ds) { +mt7530_rmw (priv,MT7531_CFC ,MT7531_CPU_PMAP_MASK , +BIT (cpu_dp->index)); +break ; + } +mt7530_rmw (priv,MT753X_BPC ,MT753X_BPDU_PORT_FW_MASK , +MT753X_BPDU_CPU_ONLY ); + +/* Enable and reset MIB counters */ +mt7530_mib_reset (ds); + +for (i =0 ; i <MT7530_NUM_PORTS ; i++) { +/* Disable forwarding by default on all ports */ +mt7530_rmw (priv,MT7530_PCR_P (i),PCR_MATRIX_MASK , +PCR_MATRIX_CLR ); + +/* Disable learning by default on all ports */ +mt7530_set (priv,MT7530_PSC_P (i),SA_DIS ); + +mt7530_set (priv,MT7531_DBG_CNT (i),MT7531_DIS_CLR ); + +if (dsa_is_cpu_port (ds, i)) { + ret =mt753x_cpu_port_enable (ds, i); +if (ret) +return ret; + }else { +mt7530_port_disable (ds, i); + +/* Set default PVID to 0 on all user ports */ +mt7530_rmw (priv,MT7530_PPBV1_P (i),G0_PORT_VID_MASK , +G0_PORT_VID_DEF ); + } + +/* Enable consistent egress tag */ +mt7530_rmw (priv,MT7530_PVC_P (i),PVC_EG_TAG_MASK , +PVC_EG_TAG (MT7530_VLAN_EG_CONSISTENT )); + } + +/* Flush the FDB table */ + ret =mt7530_fdb_cmd (priv,MT7530_FDB_FLUSH ,NULL ); +if (ret <0 ) +return ret; + +return 0 ; +} +static int mt7531_setup (struct dsa_switch *ds) {struct mt7530_priv *priv = ds->priv;struct mt7530_dummy_poll p; -struct dsa_port *cpu_dp;u32 val, id;int ret, i;
@@ -2430,44 +2483,7 @@ mt7531_setup(struct dsa_switch *ds)mt7531_ind_c45_phy_write (priv,MT753X_CTRL_PHY_ADDR ,MDIO_MMD_VEND2 ,CORE_PLL_GROUP4 , val); -/* BPDU to CPU port */ -dsa_switch_for_each_cpu_port (cpu_dp, ds) { -mt7530_rmw (priv,MT7531_CFC ,MT7531_CPU_PMAP_MASK , -BIT (cpu_dp->index)); -break ; - } -mt7530_rmw (priv,MT753X_BPC ,MT753X_BPDU_PORT_FW_MASK , -MT753X_BPDU_CPU_ONLY ); - -/* Enable and reset MIB counters */ -mt7530_mib_reset (ds); - -for (i =0 ; i <MT7530_NUM_PORTS ; i++) { -/* Disable forwarding by default on all ports */ -mt7530_rmw (priv,MT7530_PCR_P (i),PCR_MATRIX_MASK , -PCR_MATRIX_CLR ); - -/* Disable learning by default on all ports */ -mt7530_set (priv,MT7530_PSC_P (i),SA_DIS ); - -mt7530_set (priv,MT7531_DBG_CNT (i),MT7531_DIS_CLR ); - -if (dsa_is_cpu_port (ds, i)) { - ret =mt753x_cpu_port_enable (ds, i); -if (ret) -return ret; - }else { -mt7530_port_disable (ds, i); - -/* Set default PVID to 0 on all user ports */ -mt7530_rmw (priv,MT7530_PPBV1_P (i),G0_PORT_VID_MASK , -G0_PORT_VID_DEF ); - } - -/* Enable consistent egress tag */ -mt7530_rmw (priv,MT7530_PVC_P (i),PVC_EG_TAG_MASK , -PVC_EG_TAG (MT7530_VLAN_EG_CONSISTENT )); - } +mt7531_setup_common (ds);/* Setup VLAN ID 0 for VLAN-unaware bridges */ ret =mt7530_setup_vlan0 (priv);
@@ -2477,11 +2493,6 @@ mt7531_setup(struct dsa_switch *ds) ds->assisted_learning_on_cpu_port = true; ds->mtu_enforcement_ingress = true; -/* Flush the FDB table */ - ret =mt7530_fdb_cmd (priv,MT7530_FDB_FLUSH ,NULL ); -if (ret <0 ) -return ret; -return 0 ; }
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 11/14 net: dsa: mt7530: introduce separate MDIO driver
In reply to Daniel GolleSplit MT7530 switch driver into a common part and a part specific for MDIO connected switches and multi-chip modules.
Move MDIO-specific functions to newly introduced mt7530-mdio.c while keeping the common parts in mt7530.c.
Introduce new Kconfig symbol CONFIG_NET_DSA_MT7530_MDIO which is implied by CONFIG_NET_DSA_MT7530.
--- MAINTAINERS | 1 + drivers/net/dsa/Kconfig | 15 +- drivers/net/dsa/Makefile | 1 + drivers/net/dsa/mt7530-mdio.c | 271 ++++++++++++++++++++++++++++++++++ drivers/net/dsa/mt7530.c | 264 +-------------------------------- drivers/net/dsa/mt7530.h | 6 + 6 files changed, 300 insertions(+), 258 deletions(-) create mode 100644 drivers/net/dsa/mt7530-mdio.c
MAINTAINERS +1 -0
@@ -13177,6 +13177,7 @@ M: Landen Chao <[email protected]> M: DENG Qingfang <[email protected]> L: [email protected] S: Maintained +F: drivers/net/dsa/mt7530-mdio.c F: drivers/net/dsa/mt7530.* F: net/dsa/tag_mtk.c
drivers/net/dsa/Kconfig +13 -2
@@ -38,11 +38,22 @@ config NET_DSA_MT7530 tristate "MediaTek MT7530 and MT7531 Ethernet switch support" select NET_DSA_TAG_MTK select MEDIATEK_GE_PHY - select PCS_MTK_LYNXI + imply NET_DSA_MT7530_MDIO help This enables support for the MediaTek MT7530 and MT7531 Ethernet switch chips. Multi-chip module MT7530 in MT7621AT, MT7621DAT, - MT7621ST and MT7623AI SoCs is supported. + MT7621ST and MT7623AI SoCs, and built-in switch in MT7988 SoC are + supported as well. + +config NET_DSA_MT7530_MDIO + tristate "MediaTek MT7530 MDIO interface driver" + depends on NET_DSA_MT7530 + select PCS_MTK_LYNXI + help + This enables support for the MediaTek MT7530 and MT7531 switch + chips which are connected via MDIO, as well as multi-chip + module MT7530 which can be found in the MT7621AT, MT7621DAT, + MT7621ST and MT7623AI SoCs. config NET_DSA_MV88E6060 tristate "Marvell 88E6060 ethernet switch chip support"
drivers/net/dsa/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o endif obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o +obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o obj-$(CONFIG_NET_DSA_RZN1_A5PSW) += rzn1_a5psw.o obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
drivers/net/dsa/mt7530-mdio.c new file +271 -0
271 lines not on this page · raw message
drivers/net/dsa/mt7530.c +8 -256
321 lines not on this page · raw message
drivers/net/dsa/mt7530.h +6 -0
@@ -814,4 +814,10 @@ static inline void INIT_MT7530_DUMMY_POLL(struct mt7530_dummy_poll *p, p->reg = reg; } +int mt7530_probe_common (struct mt7530_priv *priv); +void mt7530_remove_common (struct mt7530_priv *priv); + +extern const struct dsa_switch_ops mt7530_switch_ops; +extern const struct mt753x_info mt753x_table[]; +#endif /* __MT7530_H */
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 12/14 net: dsa: mt7530: skip locking if MDIO bus isn't present
In reply to Daniel GolleAs MT7530 and MT7531 internally use 32-bit wide registers, each access to any register of the switch requires several operations on the MDIO bus. Hence if there is congruent access, e.g. due to PCS or PHY polling, this can mess up and interfere with another ongoing register access sequence.
However, the MDIO bus mutex is only relevant for MDIO-connected switches. Prepare switches which have there registers directly mapped into the SoCs register space via MMIO which do not require such locking. There we can simply use regmap's default locking mechanism.
Hence guard mutex operations to only be performed in case of MDIO connected switches.
--- drivers/net/dsa/mt7530.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/dsa/mt7530.c +4 -2
@@ -144,13 +144,15 @@ core_write_mmd_indirect(struct mt7530_priv *priv, int prtad,static void mt7530_mutex_lock (struct mt7530_priv *priv) { -mutex_lock_nested (&priv->bus->mdio_lock,MDIO_MUTEX_NESTED ); +if (priv->bus) +mutex_lock_nested (&priv->bus->mdio_lock,MDIO_MUTEX_NESTED ); }static void mt7530_mutex_unlock (struct mt7530_priv *priv) { -mutex_unlock (&priv->bus->mdio_lock); +if (priv->bus) +mutex_unlock (&priv->bus->mdio_lock); } static void
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 13/14 net: dsa: mt7530: introduce driver for MT7988 built-in switch
In reply to Daniel GolleAdd driver for the built-in Gigabit Ethernet switch which can be found in the MediaTek MT7988 SoC.
The switch shares most of its design with MT7530 and MT7531, but has it's registers mapped into the SoCs register space rather than being connected externally or internally via MDIO.
Introduce a new platform driver to support that.
--- MAINTAINERS | 2 + drivers/net/dsa/Kconfig | 12 +++ drivers/net/dsa/Makefile | 1 + drivers/net/dsa/mt7530-mmio.c | 101 +++++++++++++++++++++++++ drivers/net/dsa/mt7530.c | 137 +++++++++++++++++++++++++++++++++- drivers/net/dsa/mt7530.h | 12 +-- 6 files changed, 255 insertions(+), 10 deletions(-) create mode 100644 drivers/net/dsa/mt7530-mmio.c
MAINTAINERS +2 -0
@@ -13175,9 +13175,11 @@ MEDIATEK SWITCH DRIVER M: Sean Wang <[email protected]> M: Landen Chao <[email protected]> M: DENG Qingfang <[email protected]> +M: Daniel Golle <[email protected]> L: [email protected] S: Maintained F: drivers/net/dsa/mt7530-mdio.c +F: drivers/net/dsa/mt7530-mmio.c F: drivers/net/dsa/mt7530.* F: net/dsa/tag_mtk.c
drivers/net/dsa/Kconfig +12 -0
@@ -39,6 +39,7 @@ config NET_DSA_MT7530 select NET_DSA_TAG_MTK select MEDIATEK_GE_PHY imply NET_DSA_MT7530_MDIO + imply NET_DSA_MT7530_MMIO help This enables support for the MediaTek MT7530 and MT7531 Ethernet switch chips. Multi-chip module MT7530 in MT7621AT, MT7621DAT,
@@ -55,6 +56,17 @@ config NET_DSA_MT7530_MDIO module MT7530 which can be found in the MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs. +config NET_DSA_MT7530_MMIO + tristate "MediaTek MT7530 MMIO interface driver" + depends on NET_DSA_MT7530 + depends on HAS_IOMEM + help + This enables support for the built-in Ethernet switch found + in the MediaTek MT7988 SoC. + The switch is a similar design as MT7531, but the switch registers + are directly mapped into the SoCs register space rather than being + accessible via MDIO. + config NET_DSA_MV88E6060 tristate "Marvell 88E6060 ethernet switch chip support" select NET_DSA_TAG_TRAILER
drivers/net/dsa/Makefile +1 -0
@@ -8,6 +8,7 @@ endif obj-$(CONFIG_NET_DSA_LANTIQ_GSWIP) += lantiq_gswip.o obj-$(CONFIG_NET_DSA_MT7530) += mt7530.o obj-$(CONFIG_NET_DSA_MT7530_MDIO) += mt7530-mdio.o +obj-$(CONFIG_NET_DSA_MT7530_MMIO) += mt7530-mmio.o obj-$(CONFIG_NET_DSA_MV88E6060) += mv88e6060.o obj-$(CONFIG_NET_DSA_RZN1_A5PSW) += rzn1_a5psw.o obj-$(CONFIG_NET_DSA_SMSC_LAN9303) += lan9303-core.o
drivers/net/dsa/mt7530-mmio.c new file +101 -0
101 lines not on this page · raw message
drivers/net/dsa/mt7530.c +133 -4
191 lines not on this page · raw message
drivers/net/dsa/mt7530.h +6 -6
@@ -18,6 +18,7 @@ enum mt753x_id {ID_MT7530 =0 ,ID_MT7621 =1 ,ID_MT7531 =2 , + ID_MT7988 = 3, };#define NUM_TRGMII_CTRL 5
@@ -54,11 +55,11 @@ enum mt753x_id {#define MT7531_MIRROR_PORT_SET (x) (((x) & MIRROR_MASK) << 16)#define MT7531_CPU_PMAP_MASK GENMASK(7, 0) -#define MT753X_MIRROR_REG (id) (((id) == ID_MT7531) ? \ +#define MT753X_MIRROR_REG (id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ MT7531_CFC : MT7530_MFC) -#define MT753X_MIRROR_EN (id) (((id) == ID_MT7531) ? \ +#define MT753X_MIRROR_EN (id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ MT7531_MIRROR_EN : MIRROR_EN) -#define MT753X_MIRROR_MASK (id) (((id) == ID_MT7531) ? \ +#define MT753X_MIRROR_MASK (id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ MT7531_MIRROR_MASK : MIRROR_MASK)/* Registers for BPDU and PAE frame control*/
@@ -295,9 +296,8 @@ enum mt7530_vlan_port_acc_frm { MT7531_FORCE_DPX | \ MT7531_FORCE_RX_FC | \ MT7531_FORCE_TX_FC) -#define PMCR_FORCE_MODE_ID (id) (((id) == ID_MT7531) ? \ - MT7531_FORCE_MODE : \ - PMCR_FORCE_MODE) +#define PMCR_FORCE_MODE_ID (id) ((((id) == ID_MT7531) || ((id) == ID_MT7988)) ? \ + MT7531_FORCE_MODE : PMCR_FORCE_MODE)#define PMCR_LINK_SETTINGS_MASK (PMCR_TX_EN | PMCR_FORCE_SPEED_1000 | \ PMCR_RX_EN | PMCR_FORCE_SPEED_100 | \ PMCR_TX_FC_EN | PMCR_RX_FC_EN | \
Signature · 1 line
2.40.0
Daniel Golle
maintainerPATCH v2 14/14 dt-bindings: net: dsa: mediatek,mt7530: add mediatek,mt7988-switch
In reply to Daniel GolleAdd documentation for the built-in switch which can be found in the MediaTek MT7988 SoC.
--- .../bindings/net/dsa/mediatek,mt7530.yaml | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +24 -2
@@ -11,16 +11,23 @@ maintainers: - Landen Chao <[email protected]> - DENG Qingfang <[email protected]> - Sean Wang <[email protected]> + - Daniel Golle <[email protected]> description: | - There are two versions of MT7530, standalone and in a multi-chip module. + There are three versions of MT7530, standalone, in a multi-chip module and + built-into a SoC. MT7530 is a part of the multi-chip module in MT7620AN, MT7620DA, MT7620DAN, MT7620NN, MT7621AT, MT7621DAT, MT7621ST and MT7623AI SoCs. + The MT7988 SoC comes with a built-in switch similar to MT7531 as well as four + Gigabit Ethernet PHYs. The switch registers are directly mapped into the SoC's + memory map rather than using MDIO. The switch got an internally connected 10G + CPU port and 4 user ports connected to the built-in Gigabit Ethernet PHYs. + MT7530 in MT7620AN, MT7620DA, MT7620DAN and MT7620NN SoCs has got 10/100 PHYs and the switch registers are directly mapped into SoC's memory map rather than - using MDIO. The DSA driver currently doesn't support this. + using MDIO. The DSA driver currently doesn't support MT7620 variants. There is only the standalone version of MT7531.
@@ -81,6 +88,10 @@ properties: Multi-chip module MT7530 in MT7621AT, MT7621DAT and MT7621ST SoCs const: mediatek,mt7621 + - description: + Built-in switch of the MT7988 SoC + const: mediatek,mt7988-switch + reg: maxItems: 1
@@ -268,6 +279,17 @@ allOf: required: - mediatek,mcm + - if: + properties: + compatible: + const: mediatek,mt7988-switch + then: + $ref: "#/$defs/mt7530-dsa-port" + properties: + gpio-controller: false + mediatek,mcm: false + reset-names: false + unevaluatedProperties: false examples:
Signature · 1 line
2.40.0
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (main) by David S. Miller <[email protected]>:
Quoted 11 lines · On Mon, 3 Apr 2023 02:16:40 +0100 you wrote:
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
[...]
Here is the summary with links:
- [net-next,v2,01/14] net: dsa: mt7530: make some noise if register read fails
https://git.kernel.org/netdev/net-next/c/b6f56cddb5f5 - [net-next,v2,02/14] net: dsa: mt7530: refactor SGMII PCS creation https://git.kernel.org/netdev/net-next/c/9ecc00164dc2 - [net-next,v2,03/14] net: dsa: mt7530: use unlocked regmap accessors https://git.kernel.org/netdev/net-next/c/1bd099c49f65 - [net-next,v2,04/14] net: dsa: mt7530: use regmap to access switch register space https://git.kernel.org/netdev/net-next/c/a08c045580e0 - [net-next,v2,05/14] net: dsa: mt7530: move SGMII PCS creation to mt7530_probe function https://git.kernel.org/netdev/net-next/c/6de285229773 - [net-next,v2,06/14] net: dsa: mt7530: introduce mutex helpers https://git.kernel.org/netdev/net-next/c/1557c679f71c - [net-next,v2,07/14] net: dsa: mt7530: move p5_intf_modes() function to mt7530.c https://git.kernel.org/netdev/net-next/c/25d15dee34a1 - [net-next,v2,08/14] net: dsa: mt7530: introduce mt7530_probe_common helper function https://git.kernel.org/netdev/net-next/c/37c9c0d8d0b2 - [net-next,v2,09/14] net: dsa: mt7530: introduce mt7530_remove_common helper function https://git.kernel.org/netdev/net-next/c/720d73635176 - [net-next,v2,10/14] net: dsa: mt7530: split-off common parts from mt7531_setup https://git.kernel.org/netdev/net-next/c/7f54cc9772ce - [net-next,v2,11/14] net: dsa: mt7530: introduce separate MDIO driver https://git.kernel.org/netdev/net-next/c/cb675afcddbb - [net-next,v2,12/14] net: dsa: mt7530: skip locking if MDIO bus isn't present https://git.kernel.org/netdev/net-next/c/54d4147a121c - [net-next,v2,13/14] net: dsa: mt7530: introduce driver for MT7988 built-in switch https://git.kernel.org/netdev/net-next/c/110c18bfed41 - [net-next,v2,14/14] dt-bindings: net: dsa: mediatek,mt7530: add mediatek,mt7988-switch https://git.kernel.org/netdev/net-next/c/386f5fc9061b
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
Quoted 10 lines · Daniel Golle
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
Quoted 7 lines
Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver.
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference board
You did not address the incorrect information I pointed out here. Now that the patch series is applied, people reading this on the merge branch commit will be misled by the misinformation.
Quoted 5 lines
Changes since v1:
* use 'internal' PHY mode where appropriate
* useregmap_update_bitsinmt7530_rmw
* improve dt-bindings
As a maintainer of the said dt-bindings, I pointed out almost 7 things for you to change. Of those 7 points, you only did one, a trivial grammar change. The patch series is applied now so one of us maintainers (you are one too now) need to fix it with additional patches.
Arınç
Daniel Golle
maintainerHi Arınç,
Quoted 14 lines · Arınç ÜNAL
Quoted 13 lines · Daniel Golle
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver.
Quoted 6 lines
Quoted 4 lines
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference boardYou did not address the incorrect information I pointed out here. Now that
I'm sorry, that was certainly not intentional and I may have missed your comments. Actually it doesn't look like they have made it to the netdev list archive or patchwork either.
Quoted 2 lines
the patch series is applied, people reading this on the merge branch commit will be misled by the misinformation.
I've changed Kconfig stuff according to your recommendation and also addressed possible misleading USXGMII and 10GBase-KR support by introducing MT7988-specific functions and using 'internal' PHY mode. So which of your comments have not been addressed?
Quoted 11 lines
Quoted 6 lines
Changes since v1:
* use 'internal' PHY mode where appropriate
* useregmap_update_bitsinmt7530_rmw
* improve dt-bindingsAs a maintainer of the said dt-bindings, I pointed out almost 7 things for you to change. Of those 7 points, you only did one, a trivial grammar change. The patch series is applied now so one of us maintainers (you are one too now) need to fix it with additional patches.
I was also surprised the series made it to net-next so quickly, but it wasn't me applying it, I merly posted v2 with all comments I received addressed.
Me and supposedly also netdevbpf maintainers use patchwork to track patches and whether comments have been addressed. Can you point me to emails with the comments which haven't been addressed there? Looking in patchwork for the dt-bindings patch [1] I don't see any comments there.
Thank you for reviewing!
Daniel
[1]: See patchwork tracking for RFCv3, v1 and v2. Prior to RFCv3 the series didn't have the dt-bindings addition, I introduced it with RFCv3 when splitting the series into many small changes:
https://patchwork.kernel.org/project/netdevbpf/patch/9b504e3e88807bfb62022c0877451933d30abeb5.1680105013.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/fef2cb2fe3d2b70fa46e93107a0c862f53bb3bfa.1680180959.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/dffacdb59aea462c9f7d4242cf9563a04cf79807.1680483896.git.daniel@makrotopia.org/
Quoted 28 lines · Daniel Golle
Hi Arınç,
Quoted 14 lines · Arınç ÜNAL
Quoted 13 lines · Daniel Golle
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver.
Quoted 6 lines
Quoted 4 lines
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference boardYou did not address the incorrect information I pointed out here. Now that
I'm sorry, that was certainly not intentional and I may have missed your comments. Actually it doesn't look like they have made it to the netdev list archive or patchwork either.
Quoted 7 lines
Quoted 2 lines
the patch series is applied, people reading this on the merge branch commit will be misled by the misinformation.
I've changed
Kconfigstuff according to your recommendation and also addressed possible misleading USXGMII and 10GBase-KR support by introducing MT7988-specific functions and using 'internal' PHY mode. So which of your comments have not been addressed?
https://lore.kernel.org/netdev/[email protected]/
Quoted 13 lines
Quoted 8 lines
Quoted 7 lines
Changes since v1:
* use 'internal' PHY mode where appropriate
* useregmap_update_bitsinmt7530_rmw
* improve dt-bindingsQuoted 4 lines
As a maintainer of the said dt-bindings, I pointed out almost 7 things for you to change. Of those 7 points, you only did one, a trivial grammar change. The patch series is applied now so one of us maintainers (you are one too now) need to fix it with additional patches.
Quoted 8 lines
I was also surprised the series made it to net-next so quickly, but it wasn't me applying it, I merly posted v2 with all comments I received addressed.
Me and supposedly also netdevbpf maintainers use patchwork to track patches and whether comments have been addressed. Can you point me to emails with the comments which haven't been addressed there? Looking in patchwork for the dt-bindings patch [1] I don't see any comments there.
https://lore.kernel.org/netdev/[email protected]/
Quoted 8 lines
Thank you for reviewing!
Daniel
Quoted 6 lines
[1]: See patchwork tracking for RFCv3, v1 and v2. Prior to RFCv3 the series didn't have the dt-bindings addition, I introduced it with RFCv3 when splitting the series into many small changes:
https://patchwork.kernel.org/project/netdevbpf/patch/9b504e3e88807bfb62022c0877451933d30abeb5.1680105013.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/fef2cb2fe3d2b70fa46e93107a0c862f53bb3bfa.1680180959.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/dffacdb59aea462c9f7d4242cf9563a04cf79807.1680483896.git.daniel@makrotopia.org/
Although I've been a maintainer for the dt-bindings schema for quite some time, I was somehow missed as a recipient on RFC v3.
Arınç
Daniel Golle
maintainerQuoted 32 lines · Arınç ÜNAL
Quoted 31 lines · Daniel Golle
Hi Arınç,
Quoted 14 lines · Arınç ÜNAL
Quoted 13 lines · Daniel Golle
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver.
Quoted 6 lines
Quoted 4 lines
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference boardYou did not address the incorrect information I pointed out here. Now that
I'm sorry, that was certainly not intentional and I may have missed your comments. Actually it doesn't look like they have made it to the netdev list archive or patchwork either.
Quoted 2 lines
the patch series is applied, people reading this on the merge branch commit will be misled by the misinformation.
Quoted 6 lines
Quoted 4 lines
I've changed
Kconfigstuff according to your recommendation and also addressed possible misleading USXGMII and 10GBase-KR support by introducing MT7988-specific functions and using 'internal' PHY mode. So which of your comments have not been addressed?
Strange that both emails didn't make it into patchwork.
Quoted 40 lines
Quoted 14 lines
Quoted 9 lines
Quoted 8 lines
Changes since v1:
* use 'internal' PHY mode where appropriate
* useregmap_update_bitsinmt7530_rmw
* improve dt-bindingsQuoted 4 lines
As a maintainer of the said dt-bindings, I pointed out almost 7 things for you to change. Of those 7 points, you only did one, a trivial grammar change. The patch series is applied now so one of us maintainers (you are one too now) need to fix it with additional patches.
Quoted 8 lines
I was also surprised the series made it to net-next so quickly, but it wasn't me applying it, I merly posted v2 with all comments I received addressed.
Me and supposedly also netdevbpf maintainers use patchwork to track patches and whether comments have been addressed. Can you point me to emails with the comments which haven't been addressed there? Looking in patchwork for the dt-bindings patch [1] I don't see any comments there.
https://lore.kernel.org/netdev/[email protected]/
Quoted 8 lines
Thank you for reviewing!
Daniel
Quoted 6 lines
[1]: See patchwork tracking for RFCv3, v1 and v2. Prior to RFCv3 the series didn't have the dt-bindings addition, I introduced it with RFCv3 when splitting the series into many small changes:
https://patchwork.kernel.org/project/netdevbpf/patch/9b504e3e88807bfb62022c0877451933d30abeb5.1680105013.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/fef2cb2fe3d2b70fa46e93107a0c862f53bb3bfa.1680180959.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/dffacdb59aea462c9f7d4242cf9563a04cf79807.1680483896.git.daniel@makrotopia.org/
Quoted 2 lines
Although I've been a maintainer for the dt-bindings schema for quite some time, I was somehow missed as a recipient on RFC v3.
Yeah, that was my mistake. get_maintainers.pl comes up with unreadable unicode garbage, probably something is wrong in my local Perl setup. So I always manually replace your name with readable UTF-8, but I missed that for RFC v3.
Quoted 33 lines · Daniel Golle
Quoted 32 lines · Arınç ÜNAL
Quoted 31 lines · Daniel Golle
Hi Arınç,
Quoted 14 lines · Arınç ÜNAL
Quoted 13 lines · Daniel Golle
The MediaTek MT7988 SoC comes with a built-in switch very similar to previous MT7530 and MT7531. However, the switch address space is mapped into the SoCs memory space rather than being connected via MDIO. Using MMIO simplifies register access and also removes the need for a bus lock, and for that reason also makes interrupt handling more light-weight.
Note that this is different from previous SoCs like MT7621 and MT7623N which also came with an integrated MT7530-like switch which yet had to be accessed via MDIO.
Split-off the part of the driver registering an MDIO driver, then add another module acting as MMIO/platform driver.
Quoted 6 lines
Quoted 4 lines
The whole series has been tested on various MediaTek boards:
* MT7623A + MT7530 (BPi-R2)
* MT7986A + MT7531 (BPi-R3)
* MT7988A reference boardYou did not address the incorrect information I pointed out here. Now that
I'm sorry, that was certainly not intentional and I may have missed your comments. Actually it doesn't look like they have made it to the netdev list archive or patchwork either.
Quoted 2 lines
the patch series is applied, people reading this on the merge branch commit will be misled by the misinformation.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
I've changed
Kconfigstuff according to your recommendation and also addressed possible misleading USXGMII and 10GBase-KR support by introducing MT7988-specific functions and using 'internal' PHY mode. So which of your comments have not been addressed?Strange that both emails didn't make it into patchwork.
I don't understand how how patchwork handles the conversation on the cover letter. I was never able to see them on patchwork but lore.kernel.org.
My review for patch 15 was received on patchworks as it should. It was missing "net-next" on the subject so perhaps that's why you missed it.
Why don't you just check your inbox? We're emailing each other in the end.
Quoted 41 lines
Quoted 41 lines
Quoted 15 lines
Quoted 10 lines
Quoted 9 lines
Changes since v1:
* use 'internal' PHY mode where appropriate
* useregmap_update_bitsinmt7530_rmw
* improve dt-bindingsQuoted 4 lines
As a maintainer of the said dt-bindings, I pointed out almost 7 things for you to change. Of those 7 points, you only did one, a trivial grammar change. The patch series is applied now so one of us maintainers (you are one too now) need to fix it with additional patches.
Quoted 8 lines
I was also surprised the series made it to net-next so quickly, but it wasn't me applying it, I merly posted v2 with all comments I received addressed.
Me and supposedly also netdevbpf maintainers use patchwork to track patches and whether comments have been addressed. Can you point me to emails with the comments which haven't been addressed there? Looking in patchwork for the dt-bindings patch [1] I don't see any comments there.
https://lore.kernel.org/netdev/[email protected]/
Quoted 14 lines
Thank you for reviewing!
Daniel
[1]: See patchwork tracking for RFCv3, v1 and v2. Prior to RFCv3 the series didn't have the dt-bindings addition, I introduced it with RFCv3 when splitting the series into many small changes:
https://patchwork.kernel.org/project/netdevbpf/patch/9b504e3e88807bfb62022c0877451933d30abeb5.1680105013.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/fef2cb2fe3d2b70fa46e93107a0c862f53bb3bfa.1680180959.git.daniel@makrotopia.org/
https://patchwork.kernel.org/project/netdevbpf/patch/dffacdb59aea462c9f7d4242cf9563a04cf79807.1680483896.git.daniel@makrotopia.org/
Quoted 7 lines
Quoted 2 lines
Although I've been a maintainer for the dt-bindings schema for quite some time, I was somehow missed as a recipient on RFC v3.
Yeah, that was my mistake. get_maintainers.pl comes up with unreadable unicode garbage, probably something is wrong in my local Perl setup. So I always manually replace your name with readable UTF-8, but I missed that for RFC v3.
Did you try writing the output of get_maintainers.pl to a file, then feed the file directly to git send-email as recipients?
That may bypass that issue. It's also currently how I send my patches.
https://arinc9.notion.site/get_maintainers-and-git-send-email-e8edd99d962041eca874966021acefe6
Arınç
Re: [PATCH net-next v2 13/14] net: dsa: mt7530: introduce driver for MT7988 built-in switch
In reply to Daniel GolleHi Daniel,
Quoted 16 lines · Daniel Golle
Add driver for the built-in Gigabit Ethernet switch which can be found in the MediaTek MT7988 SoC.
The switch shares most of its design with MT7530 and MT7531, but has it's registers mapped into the SoCs register space rather than being connected externally or internally via MDIO.
Introduce a new platform driver to support that.
Signed-off-by Daniel Golle <[email protected]>Reviewed-by Andrew Lunn <[email protected]>--- MAINTAINERS | 2 + drivers/net/dsa/Kconfig | 12 +++ drivers/net/dsa/Makefile | 1 + drivers/net/dsa/mt7530-mmio.c | 101 +++++++++++++++++++++++++
[...]
Quoted 6 lines
drivers/net/dsa/mt7530-mmio.c new file +0
-0@@ -0,0 +1,101 @@
[...]
drivers/net/dsa/mt7530-mmio.c line 37
Quoted 1 line
drivers/net/dsa/mt7530-mmio.c new file +1
-0+ priv->rstc =devm_reset_control_get (&pdev->dev,NULL );
Please use devm_reset_control_get_exclusive() directly.
drivers/net/dsa/mt7530-mmio.c line 40
Quoted 3 lines
drivers/net/dsa/mt7530-mmio.c new file +3
-0+if (IS_ERR (priv->rstc)) { +dev_err (&pdev->dev,"Couldn't get our reset line\n" ); +return PTR_ERR (priv->rstc);
Not sure if this can actually happen, but there is no need to warn on -EPROBE_DEFER. You could use return dev_err_probe(...) here.
regards
Philipp
Daniel Golle
maintainerRe: [PATCH net-next v2 13/14] net: dsa: mt7530: introduce driver for MT7988 built-in switch
Quoted 31 lines · Philipp Zabel
Hi Daniel,
Quoted 16 lines · Daniel Golle
Add driver for the built-in Gigabit Ethernet switch which can be found in the MediaTek MT7988 SoC.
The switch shares most of its design with MT7530 and MT7531, but has it's registers mapped into the SoCs register space rather than being connected externally or internally via MDIO.
Introduce a new platform driver to support that.
Signed-off-by Daniel Golle <[email protected]>Reviewed-by Andrew Lunn <[email protected]>--- MAINTAINERS | 2 + drivers/net/dsa/Kconfig | 12 +++ drivers/net/dsa/Makefile | 1 + drivers/net/dsa/mt7530-mmio.c | 101 +++++++++++++++++++++++++[...]
Quoted 6 lines
drivers/net/dsa/mt7530-mmio.c new file +0
-0@@ -0,0 +1,101 @@[...]
drivers/net/dsa/mt7530-mmio.c line 37
Quoted 1 line
drivers/net/dsa/mt7530-mmio.c new file +1
-0+ priv->rstc =devm_reset_control_get (&pdev->dev,NULL );Please use
devm_reset_control_get_exclusive()directly.
Quoted 6 lines
drivers/net/dsa/mt7530-mmio.c line 40
Quoted 3 lines
drivers/net/dsa/mt7530-mmio.c new file +3
-0+if (IS_ERR (priv->rstc)) { +dev_err (&pdev->dev,"Couldn't get our reset line\n" ); +return PTR_ERR (priv->rstc);Not sure if this can actually happen, but there is no need to warn on -EPROBE_DEFER. You could use return
dev_err_probe(...)here.
Thank you for your comments. The series has already been picked to net-next. Unless you want to send the suggested changes yourself, I will prepare another series with your suggestions, and also apply them to mt7530-mdio.c.
Re: [PATCH net-next v2 13/14] net: dsa: mt7530: introduce driver for MT7988 built-in switch
Hi Daniel,
Quoted 1 line · Daniel Golle
On Tue, Apr 25, 2023 at 05:51:37PM +0200, Philipp Zabel wrote:
[...]
Quoted 9 lines
Quoted 8 lines
Please use
devm_reset_control_get_exclusive()directly.drivers/net/dsa/mt7530-mmio.c line 40
Quoted 3 lines
drivers/net/dsa/mt7530-mmio.c new file +3
-0+if (IS_ERR (priv->rstc)) { +dev_err (&pdev->dev,"Couldn't get our reset line\n" ); +return PTR_ERR (priv->rstc);Not sure if this can actually happen, but there is no need to warn on -EPROBE_DEFER. You could use return
dev_err_probe(...)here.
Quoted 4 lines
Thank you for your comments. The series has already been picked to net-next. Unless you want to send the suggested changes yourself, I will prepare another series with your suggestions, and also apply them to
mt7530-mdio.c.
That would be great, thank you.
regards
Philipp