net-next: dsa: mt7530: add support for MT7531
Subsystems (6)
v2 cover net-next: dsa: mt7530: add support for MT7531
This patch series adds support for MT7531.
MT7531 is the next generation of MT7530 which could be found on Mediatek router platforms such as MT7622 or MT7629.
It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW SKU. Due to support for SGMII interface, pll, and pad setting are different from MT7530.
MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability
which is compatible with PHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-bnad negotiation
which is compatible with 10B/8B encoding of PHY_INTERFACE_MODE_1000BASEX with fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiation which is compatible with 10B/8B encoding of PHY_INTERFACE_MODE_2500BASEX with fixed full-duplex and fixed pause.
changes between v1 & v2
- change phylink_validate callback function to support full-duplex gigabit only to match hardware capability.
- add description of SGMII interface.
- configure mt7531 cpu port in fastest speed by default.
- parse SGMII control word for in-band negotiation mode.
- configure RGMII delay based on phy.rst.
- Rename the definition in the header file to avoid potential conflicts.
- Add wrapper function for mdio read/write to support both C22 and C45.
- correct fixed-link speed of 2500base-x in dts.
- add MT7531 port mirror setting.
Landen Chao (7):
net: dsa: mt7530: Refine message in Kconfig
net: dsa: mt7530: support full-duplex gigabit only
net: dsa: mt7530: Extend device data ready for adding a new hardware
dt-bindings: net: dsa: add new MT7531 binding to support MT7531
net: dsa: mt7530: Add the support of MT7531 switch
arm64: dts: mt7622: add mt7531 dsa to mt7622-rfb1 board
arm64: dts: mt7622: add mt7531 dsa to bananapi-bpi-r64 board
.../devicetree/bindings/net/dsa/mt7530.txt | 71 +- .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 44 + arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 57 +- drivers/net/dsa/Kconfig | 6 +- drivers/net/dsa/mt7530.c | 1184 +++++++++++++++-- drivers/net/dsa/mt7530.h | 259 +++- 6 files changed, 1514 insertions(+), 107 deletions(-)
Signature · 1 line
2.17.1
PATCH v2 1/7 net: dsa: mt7530: Refine message in Kconfig
Refine message in Kconfig with fixing typo and an explicit MT7621 support.
--- drivers/net/dsa/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/dsa/Kconfig +3 -3
@@ -33,12 +33,12 @@ config NET_DSA_LANTIQ_GSWIP the xrx200 / VR9 SoC. config NET_DSA_MT7530 - tristate "Mediatek MT7530 Ethernet switch support" + tristate "MediaTek MT7530 and MT7621 Ethernet switch support" depends on NET_DSA select NET_DSA_TAG_MTK help - This enables support for the Mediatek MT7530 Ethernet switch - chip. + This enables support for the MediaTek MT7530 and MT7621 Ethernet + switch chip. config NET_DSA_MV88E6060 tristate "Marvell 88E6060 ethernet switch chip support"
Signature · 1 line
2.17.1
PATCH v2 2/7 net: dsa: mt7530: support full-duplex gigabit only
In reply to Landen ChaoRemove 1000baseT_Half to advertise correct hardware capability in phylink_validate() callback function.
--- drivers/net/dsa/mt7530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mt7530.c +1 -1
@@ -1501,7 +1501,7 @@ static void mt7530_phylink_validate(struct dsa_switch *ds, int port, phylink_set(mask, 100baseT_Full);if (state->interface !=PHY_INTERFACE_MODE_MII ) { - phylink_set(mask, 1000baseT_Half); +/* MT7530 and MT7531 only support 1G full-duplex. */ phylink_set(mask, 1000baseT_Full);if (port ==5 ) phylink_set(mask, 1000baseX_Full);
Signature · 1 line
2.17.1
Andrew Lunn
maintainerRe: [PATCH net-next v2 2/7] net: dsa: mt7530: support full-duplex gigabit only
Quoted 2 lines · Landen Chao
Remove 1000baseT_Half to advertise correct hardware capability in
phylink_validate()callback function.
Hi Landem
This seems like a fix? Please submit it against the net tree, and add a Fixes: tag.
Thanks
Andrew
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v2 3/7 net: dsa: mt7530: Extend device data ready for adding a new hardware
In reply to Landen ChaoAdd a structure holding required operations for each device such as device initialization, PHY port read or write, a checker whether PHY interface is supported on a certain port, MAC port setup for either bus pad or a specific PHY interface.
The patch is done for ready adding a new hardware MT7531.
--- drivers/net/dsa/mt7530.c | 272 +++++++++++++++++++++++++++++---------- drivers/net/dsa/mt7530.h | 37 +++++- 2 files changed, 240 insertions(+), 69 deletions(-)
drivers/net/dsa/mt7530.c +204 -68
@@ -372,8 +372,9 @@ mt7530_fdb_write(struct mt7530_priv *priv, u16 vid,mt7530_write (priv,MT7530_ATA1 + (i *4 ), reg[i]); } +/* Setup TX circuit incluing relevant PAD and driving */ static int -mt7530_pad_clk_setup (struct dsa_switch *ds,int mode) +mt7530_pad_clk_setup (struct dsa_switch *ds,phy_interface_t interface) {struct mt7530_priv *priv = ds->priv;u32 ncpo1, ssc_delta, trgint, i, xtal;
@@ -387,7 +388,7 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode)return -EINVAL ; } -switch (mode) { +switch (interface) {case PHY_INTERFACE_MODE_RGMII : trgint =0 ;/* PLL frequency: 125MHz */
@@ -409,7 +410,8 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) }break ;default : -dev_err (priv->dev,"xMII mode %d not supported\n" , mode); +dev_err (priv->dev,"xMII interface %d not supported\n" , + interface);return -EINVAL ; }
@@ -1349,12 +1351,11 @@ mt7530_setup(struct dsa_switch *ds)return 0 ; } -static void mt7530_phylink_mac_config (struct dsa_switch *ds,int port, -unsigned int mode, -const struct phylink_link_state *state) +static bool +mt7530_phy_mode_supported (struct dsa_switch *ds,int port, +const struct phylink_link_state *state) {struct mt7530_priv *priv = ds->priv; -u32 mcr_cur, mcr_new;switch (port) {case 0 :/* Internal phy */
@@ -1363,33 +1364,114 @@ static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port,case 3 :case 4 :if (state->interface !=PHY_INTERFACE_MODE_GMII ) -return ; + goto unsupported;break ;case 5 :/* 2nd cpu port with phy of port 0 or 4 / external phy */ -if (priv->p5_interface == state->interface) -break ;if (!phy_interface_mode_is_rgmii (state->interface) && state->interface !=PHY_INTERFACE_MODE_MII && state->interface !=PHY_INTERFACE_MODE_GMII ) -return ; + goto unsupported; +break ; +case 6 :/* 1st cpu port */ +if (state->interface !=PHY_INTERFACE_MODE_RGMII && + state->interface !=PHY_INTERFACE_MODE_TRGMII ) + goto unsupported; +break ; +default : +dev_err (priv->dev,"%s: unsupported port: %i\n" , __func__, + port); + goto unsupported; + } + +return true; + +unsupported: +return false; +} + +static bool +mt753x_phy_mode_supported (struct dsa_switch *ds,int port, +const struct phylink_link_state *state) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->phy_mode_supported (ds, port, state); +} + +static int +mt753x_pad_setup (struct dsa_switch *ds,const struct phylink_link_state *state) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->pad_setup (ds, state->interface); +} + +static int +mt7530_mac_config (struct dsa_switch *ds,int port,unsigned int mode, +phy_interface_t interface) +{ +struct mt7530_priv *priv = ds->priv; + +/* Only need to setup port5. */ +if (port !=5 ) +return 0 ; + +mt7530_setup_port5 (priv->ds, interface); + +return 0 ; +} + +static int +mt753x_mac_config (struct dsa_switch *ds,int port,unsigned int mode, +const struct phylink_link_state *state) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->mac_port_config (ds, port, mode, state->interface); +} + +static void +mt753x_phylink_mac_config (struct dsa_switch *ds,int port,unsigned int mode, +const struct phylink_link_state *state) +{ +struct mt7530_priv *priv = ds->priv; +u32 mcr_cur, mcr_new; + +if (!mt753x_phy_mode_supported (ds, port, state)) + goto unsupported; + +switch (port) { +case 0 :/* Internal phy */ +case 1 : +case 2 : +case 3 : +case 4 : +if (state->interface !=PHY_INTERFACE_MODE_GMII ) + goto unsupported; +break ; +case 5 :/* 2nd cpu port with phy of port 0 or 4 / external phy */ +if (priv->p5_interface == state->interface) +break ; + +if (mt753x_mac_config (ds, port, mode, state) <0 ) + goto unsupported; -mt7530_setup_port5 (ds, state->interface);break ;case 6 :/* 1st cpu port */ if (priv->p6_interface == state->interface)break ; -if (state->interface !=PHY_INTERFACE_MODE_RGMII && - state->interface !=PHY_INTERFACE_MODE_TRGMII ) -return ; +mt753x_pad_setup (ds, state); -/* Setup TX circuit incluing relevant PAD and driving */ -mt7530_pad_clk_setup (ds, state->interface); +if (mt753x_mac_config (ds, port, mode, state) <0 ) + goto unsupported; priv->p6_interface = state->interface;break ;default : -dev_err (ds->dev,"%s: unsupported port: %i\n" , __func__, port); +unsupported: +dev_err (ds->dev,"%s: unsupported %s port: %i\n" , + __func__,phy_modes (state->interface), port);return ; }
@@ -1453,61 +1535,44 @@ static void mt7530_phylink_mac_link_up(struct dsa_switch *ds, int port,mt7530_set (priv,MT7530_PMCR_P (port), mcr); } -static void mt7530_phylink_validate (struct dsa_switch *ds,int port, -unsigned long *supported, -struct phylink_link_state *state) +static void +mt7530_mac_port_validate (struct dsa_switch *ds,int port, +unsigned long *supported) { +if (port ==5 ) + phylink_set(supported, 1000baseX_Full); +} + +static void +mt753x_phylink_validate (struct dsa_switch *ds,int port, +unsigned long *supported, +struct phylink_link_state *state) +{ +struct mt7530_priv *priv = ds->priv;__ETHTOOL_DECLARE_LINK_MODE_MASK (mask) = {0 , }; -switch (port) { -case 0 :/* Internal phy */ -case 1 : -case 2 : -case 3 : -case 4 : -if (state->interface !=PHY_INTERFACE_MODE_NA && - state->interface !=PHY_INTERFACE_MODE_GMII ) - goto unsupported; -break ; -case 5 :/* 2nd cpu port with phy of port 0 or 4 / external phy */ -if (state->interface !=PHY_INTERFACE_MODE_NA && - !phy_interface_mode_is_rgmii (state->interface) && - state->interface !=PHY_INTERFACE_MODE_MII && - state->interface !=PHY_INTERFACE_MODE_GMII ) - goto unsupported; -break ; -case 6 :/* 1st cpu port */ -if (state->interface !=PHY_INTERFACE_MODE_NA && - state->interface !=PHY_INTERFACE_MODE_RGMII && - state->interface !=PHY_INTERFACE_MODE_TRGMII ) - goto unsupported; -break ; -default : -dev_err (ds->dev,"%s: unsupported port: %i\n" , __func__, port); -unsupported: +if (state->interface !=PHY_INTERFACE_MODE_NA && + !mt753x_phy_mode_supported (ds, port, state)) {linkmode_zero (supported);return ; }phylink_set_port_modes (mask); -phylink_set (mask, Autoneg); -if (state->interface ==PHY_INTERFACE_MODE_TRGMII ) { - phylink_set(mask, 1000baseT_Full); - }else { +if (state->interface !=PHY_INTERFACE_MODE_TRGMII ) { phylink_set(mask, 10baseT_Half); phylink_set(mask, 10baseT_Full); phylink_set(mask, 100baseT_Half); phylink_set(mask, 100baseT_Full); - -if (state->interface !=PHY_INTERFACE_MODE_MII ) { -/* MT7530 and MT7531 only support 1G full-duplex. */ - phylink_set(mask, 1000baseT_Full); -if (port ==5 ) - phylink_set(mask, 1000baseX_Full); - } +phylink_set (mask, Autoneg); } +/* MT7530 and MT7531 only support 1G full-duplex. */ +if (state->interface !=PHY_INTERFACE_MODE_MII ) + phylink_set(mask, 1000baseT_Full); + + priv->info->mac_port_validate (ds, port, mask); +phylink_set (mask, Pause);phylink_set (mask, Asym_Pause);
@@ -1555,12 +1620,45 @@ mt7530_phylink_mac_link_state(struct dsa_switch *ds, int port,return 1 ; } +static int +mt753x_phylink_mac_link_state (struct dsa_switch *ds,int port, +struct phylink_link_state *state) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->mac_port_get_state (ds, port, state); +} + +static int +mt753x_setup (struct dsa_switch *ds) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->sw_setup (ds); +} + +static int +mt753x_phy_read (struct dsa_switch *ds,int port,int regnum) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->phy_read (ds, port, regnum); +} + +static int +mt753x_phy_write (struct dsa_switch *ds,int port,int regnum,u16 val) +{ +struct mt7530_priv *priv = ds->priv; + +return priv->info->phy_write (ds, port, regnum, val); +} +static const struct dsa_switch_ops mt7530_switch_ops = { .get_tag_protocol = mtk_get_tag_protocol, - .setup = mt7530_setup, + .setup = mt753x_setup, .get_strings = mt7530_get_strings, - .phy_read = mt7530_phy_read, - .phy_write = mt7530_phy_write, + .phy_read = mt753x_phy_read, + .phy_write = mt753x_phy_write, .get_ethtool_stats = mt7530_get_ethtool_stats, .get_sset_count = mt7530_get_sset_count, .port_enable = mt7530_port_enable,
@@ -1577,16 +1675,41 @@ static const struct dsa_switch_ops mt7530_switch_ops = { .port_vlan_del = mt7530_port_vlan_del, .port_mirror_add = mt7530_port_mirror_add, .port_mirror_del = mt7530_port_mirror_del, - .phylink_validate = mt7530_phylink_validate, - .phylink_mac_link_state = mt7530_phylink_mac_link_state, - .phylink_mac_config = mt7530_phylink_mac_config, + .phylink_validate = mt753x_phylink_validate, + .phylink_mac_link_state = mt753x_phylink_mac_link_state, + .phylink_mac_config = mt753x_phylink_mac_config, .phylink_mac_link_down = mt7530_phylink_mac_link_down, .phylink_mac_link_up = mt7530_phylink_mac_link_up, }; +static const struct mt753x_info mt753x_table[] = { + [ID_MT7621 ] = { + .id =ID_MT7621 , + .sw_setup = mt7530_setup, + .phy_read = mt7530_phy_read, + .phy_write = mt7530_phy_write, + .pad_setup = mt7530_pad_clk_setup, + .phy_mode_supported = mt7530_phy_mode_supported, + .mac_port_validate = mt7530_mac_port_validate, + .mac_port_get_state = mt7530_phylink_mac_link_state, + .mac_port_config = mt7530_mac_config, + }, + [ID_MT7530 ] = { + .id =ID_MT7530 , + .sw_setup = mt7530_setup, + .phy_read = mt7530_phy_read, + .phy_write = mt7530_phy_write, + .pad_setup = mt7530_pad_clk_setup, + .phy_mode_supported = mt7530_phy_mode_supported, + .mac_port_validate = mt7530_mac_port_validate, + .mac_port_get_state = mt7530_phylink_mac_link_state, + .mac_port_config = mt7530_mac_config, + }, +}; +static const struct of_device_id mt7530_of_match[] = { - { .compatible ="mediatek,mt7621" , .data = (void *)ID_MT7621 , }, - { .compatible ="mediatek,mt7530" , .data = (void *)ID_MT7530 , }, + { .compatible ="mediatek,mt7621" , .data = &mt753x_table[ID_MT7621 ], }, + { .compatible ="mediatek,mt7530" , .data = &mt753x_table[ID_MT7530 ], }, {/* sentinel */ }, };MODULE_DEVICE_TABLE (of, mt7530_of_match);
@@ -1627,8 +1750,21 @@ mt7530_probe(struct mdio_device *mdiodev)/* Get the hardware identifier from the devicetree node. * We will need it for some of the clock and regulator setup. */ - priv->id = (unsigned int )(unsigned long ) -of_device_get_match_data (&mdiodev->dev); + priv->info =of_device_get_match_data (&mdiodev->dev); +if (!priv->info) +return -EINVAL ; + +/* Sanity check if these required device operations are filled +* properly. +*/ +if (!priv->info->sw_setup || !priv->info->pad_setup || + !priv->info->phy_read || !priv->info->phy_write || + !priv->info->phy_mode_supported || + !priv->info->mac_port_validate || + !priv->info->mac_port_get_state || !priv->info->mac_port_config) +return -EINVAL ; + + priv->id = priv->info->id;if (priv->id ==ID_MT7530 ) { priv->core_pwr =devm_regulator_get (&mdiodev->dev,"core" );
drivers/net/dsa/mt7530.h +36 -1
@@ -11,7 +11,7 @@#define MT7530_NUM_FDB_RECORDS 2048#define MT7530_ALL_MEMBERS 0xff -enum { +enum mt753x_id {ID_MT7530 =0 ,ID_MT7621 =1 , };
@@ -443,6 +443,40 @@ static const char *p5_intf_modes(unsigned int p5_interface) } } +/* struct mt753x_info - This is the main data structure for holding the specific +* part for each supported device +* @sw_setup: Holding the handler to a device initialization +* @phy_read: Holding the way reading PHY port +* @phy_write: Holding the way writing PHY port +* @pad_setup: Holding the way setting up the bus pad for a certain +* MAC port +* @phy_mode_supported: Check if the PHY type is being supported on a certain +* port +* @mac_port_validate: Holding the way to set addition validate type for a +* certan MAC port +* @mac_port_get_state: Holding the way getting the MAC/PCS state for a certain +* MAC port +* @mac_port_config: Holding the way setting up the PHY attribute to a +* certain MAC port +*/ +struct mt753x_info { +enum mt753x_id id; + +int (*sw_setup)(struct dsa_switch *ds); +int (*phy_read)(struct dsa_switch *ds,int port,int regnum); +int (*phy_write)(struct dsa_switch *ds,int port,int regnum,u16 val); +int (*pad_setup)(struct dsa_switch *ds,phy_interface_t interface); +bool (*phy_mode_supported)(struct dsa_switch *ds,int port, +const struct phylink_link_state *state); +void (*mac_port_validate)(struct dsa_switch *ds,int port, +unsigned long *supported); +int (*mac_port_get_state)(struct dsa_switch *ds,int port, +struct phylink_link_state *state); +int (*mac_port_config)(struct dsa_switch *ds,int port, +unsigned int mode, +phy_interface_t interface); +}; +/* struct mt7530_priv - This is the main data structure for holding the state * of the driver * @dev: The device pointer
@@ -468,6 +502,7 @@ struct mt7530_priv {struct regulator *core_pwr;struct regulator *io_pwr;struct gpio_desc *reset; +const struct mt753x_info *info;unsigned int id;bool mcm;phy_interface_t p6_interface;
Signature · 1 line
2.17.1
Andrew Lunn
maintainerRe: [PATCH net-next v2 3/7] net: dsa: mt7530: Extend device data ready for adding a new hardware
Quoted 30 lines · Landen Chao
Add a structure holding required operations for each device such as device initialization, PHY port read or write, a checker whether PHY interface is supported on a certain port, MAC port setup for either bus pad or a specific PHY interface.
The patch is done for ready adding a new hardware MT7531.
Signed-off-by Landen Chao <[email protected]>Signed-off-by Sean Wang <[email protected]>--- drivers/net/dsa/mt7530.c | 272 +++++++++++++++++++++++++++++---------- drivers/net/dsa/mt7530.h | 37 +++++- 2 files changed, 240 insertions(+), 69 deletions(-)drivers/net/dsa/mt7530.c +2
-1@@ -372,8 +372,9 @@ mt7530_fdb_write(struct mt7530_priv *priv, u16 vid,mt7530_write (priv,MT7530_ATA1 + (i *4 ), reg[i]); } +/* Setup TX circuit incluing relevant PAD and driving */ static int -mt7530_pad_clk_setup (struct dsa_switch *ds,int mode) +mt7530_pad_clk_setup (struct dsa_switch *ds,phy_interface_t interface) {struct mt7530_priv *priv = ds->priv;u32 ncpo1, ssc_delta, trgint, i, xtal;
drivers/net/dsa/mt7530.c mt7530_pad_clk_setup(struct dsa_switch *ds, int mode) · line 394
Quoted 8 lines
drivers/net/dsa/mt7530.c +1
-1@@ -387,7 +388,7 @@ mt7530_pad_clk_setup(struct dsa_switch *ds, int mode)return -EINVAL ; } -switch (mode) { +switch (interface) {case PHY_INTERFACE_MODE_RGMII : trgint =0 ;/* PLL frequency: 125MHz */
Do you actually need to support all 4 RGMII modes?
...
+ goto unsupported;
drivers/net/dsa/mt7530.c static void mt7530_phylink_mac_config(struct dsa_switch *ds, int port, · line 1377
Quoted 4 lines
drivers/net/dsa/mt7530.c +4
-0+break ; +case 6 :/* 1st cpu port */ +if (state->interface !=PHY_INTERFACE_MODE_RGMII && + state->interface !=PHY_INTERFACE_MODE_TRGMII )
phy_interface_mode_is_rgmii()?
Andrew
Re: [PATCH net-next v2 3/7] net: dsa: mt7530: Extend device data ready for adding a new hardware
In reply to Landen ChaoJust a little typo you've inherited from existing code
Quoted 1 line
+/* Setup TX circuit incluing relevant PAD and driving */
including
regards Frank
PATCH v2 4/7 dt-bindings: net: dsa: add new MT7531 binding to support MT7531
In reply to Landen ChaoAdd devicetree binding to support the compatible mt7531 switch as used in the MediaTek MT7531 switch.
--- .../devicetree/bindings/net/dsa/mt7530.txt | 71 ++++++++++++++++++- 1 file changed, 68 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/net/dsa/mt7530.txt +68 -3
@@ -5,6 +5,7 @@ Required properties: - compatible: may be compatible = "mediatek,mt7530" or compatible = "mediatek,mt7621" + or compatible = "mediatek,mt7531" - #address-cells: Must be 1. - #size-cells: Must be 0. - mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part
@@ -32,10 +33,13 @@ Required properties for the child nodes within ports container: - reg: Port address described must be 6 for CPU port and from 0 to 5 for user ports. -- phy-mode: String, must be either "trgmii" or "rgmii" for port labeled - "cpu". +- phy-mode: String, the follow value would be acceptable for port labeled "cpu" + If compatible mediatek,mt7530 or mediatek,mt7621 is set, + must be either "trgmii" or "rgmii" + If compatible mediatek,mt7531 is set, + must be either "sgmii", "1000base-x" or "2500base-x" -Port 5 of the switch is muxed between: +Port 5 of mt7530 and mt7621 switch is muxed between: 1. GMAC5: GMAC5 can interface with another external MAC or PHY. 2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC of the SOC. Used in many setups where port 0/4 becomes the WAN port.
@@ -308,3 +312,64 @@ Example 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY. }; }; }; + +Example 4: MT7531BE port6 -- up-clocked 2.5Gbps SGMII -- MT7622 CPU 1st GMAC + +ð { + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + &mdio0 { + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + port@0 { + reg = <0>; + label = "lan0"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + }; + }; + }; + };
Signature · 1 line
2.17.1
Rob Herring
maintainerRe: [PATCH net-next v2 4/7] dt-bindings: net: dsa: add new MT7531 binding to support MT7531
Quoted 39 lines · Landen Chao
Add devicetree binding to support the compatible mt7531 switch as used in the MediaTek MT7531 switch.
Signed-off-by Sean Wang <[email protected]>Signed-off-by Landen Chao <[email protected]>--- .../devicetree/bindings/net/dsa/mt7530.txt | 71 ++++++++++++++++++- 1 file changed, 68 insertions(+), 3 deletions(-)Documentation/devicetree/bindings/net/dsa/mt7530.txt +7
-3@@ -5,6 +5,7 @@ Required properties: - compatible: may be compatible = "mediatek,mt7530" or compatible = "mediatek,mt7621" + or compatible = "mediatek,mt7531" - #address-cells: Must be 1. - #size-cells: Must be 0. - mediatek,mcm: Boolean; if defined, indicates that either MT7530 is the part@@ -32,10 +33,13 @@ Required properties for the child nodes within ports container: - reg: Port address described must be 6 for CPU port and from 0 to 5 for user ports. -- phy-mode: String, must be either "trgmii" or "rgmii" for port labeled - "cpu". +- phy-mode: String, the follow value would be acceptable for port labeled "cpu" + If compatible mediatek,mt7530 or mediatek,mt7621 is set, + must be either "trgmii" or "rgmii" + If compatible mediatek,mt7531 is set, + must be either "sgmii", "1000base-x" or "2500base-x" -Port 5 of the switch is muxed between: +Port 5 of mt7530 and mt7621 switch is muxed between: 1. GMAC5: GMAC5 can interface with another external MAC or PHY. 2. PHY of port 0 or port 4: PHY interfaces with an external MAC like 2nd GMAC of the SOC. Used in many setups where port 0/4 becomes the WAN port.
Documentation/devicetree/bindings/net/dsa/mt7530.txt Example 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY. · line 316
Quoted 5 lines
Documentation/devicetree/bindings/net/dsa/mt7530.txt +2
-0@@ -308,3 +312,64 @@ Example 3: MT7621: Port 5 is connected to external PHY: Port 5 -> external PHY. }; }; }; + +Example 4: MT7531BE port6 -- up-clocked 2.5Gbps SGMII -- MT7622 CPU 1st GMAC
Does this really need another example?
Quoted 61 lines
Documentation/devicetree/bindings/net/dsa/mt7530.txt +59
-0+ +ð { + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + &mdio0 { + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + reg = <0>; + + port@0 { + reg = <0>; + label = "lan0"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + }; + }; + }; + };Signature · 1 line
2.17.1
PATCH v2 5/7 net: dsa: mt7530: Add the support of MT7531 switch
In reply to Landen ChaoAdd new support for MT7531:
MT7531 is the next generation of MT7530. It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW sku. Due to SGMII interface support, pll, and pad setting are different from MT7530. This patch adds different initial setting, and SGMII phylink handlers of MT7531.
MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability
which is compatible with PHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-bnad negotiation
which is compatible with 10B/8B encoding of PHY_INTERFACE_MODE_1000BASEX with fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiation which is compatible with 10B/8B encoding of PHY_INTERFACE_MODE_2500BASEX with fixed full-duplex and fixed pause.
--- drivers/net/dsa/Kconfig | 6 +- drivers/net/dsa/mt7530.c | 908 +++++++++++++++++++++++++++++++++++++-- drivers/net/dsa/mt7530.h | 222 ++++++++++ 3 files changed, 1109 insertions(+), 27 deletions(-)
drivers/net/dsa/Kconfig +3 -3
@@ -33,12 +33,12 @@ config NET_DSA_LANTIQ_GSWIP the xrx200 / VR9 SoC. config NET_DSA_MT7530 - tristate "MediaTek MT7530 and MT7621 Ethernet switch support" + tristate "MediaTek MT753x and MT7621 Ethernet switch support" depends on NET_DSA select NET_DSA_TAG_MTK help - This enables support for the MediaTek MT7530 and MT7621 Ethernet - switch chip. + This enables support for the MediaTek MT7530, MT7531, and MT7621 + Ethernet switch chips. config NET_DSA_MV88E6060 tristate "Marvell 88E6060 ethernet switch chip support"
drivers/net/dsa/mt7530.c +884 -24
1,083 lines not on this page · raw message
drivers/net/dsa/mt7530.h +222 -0
328 lines not on this page · raw message
Signature · 1 line
2.17.1
Jakub Kicinski
maintainerRe: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
Quoted 19 lines · On Tue, 18 Aug 2020 15:14:10 +0800 Landen Chao wrote:
Add new support for MT7531:
MT7531 is the next generation of MT7530. It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW sku. Due to SGMII interface support, pll, and pad setting are different from MT7530. This patch adds different initial setting, and SGMII phylink handlers of MT7531.
MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability
which is compatible withPHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-bnad negotiation
which is compatible with 10B/8B encoding ofPHY_INTERFACE_MODE_1000BASEXwith fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiation which is compatible with 10B/8B encoding ofPHY_INTERFACE_MODE_2500BASEXwith fixed full-duplex and fixed pause.
Quoted 2 lines
Signed-off-by Landen Chao <[email protected]>Signed-off-by Sean Wang <[email protected]>
Please fix these W=1 warnings:
../drivers/net/dsa/mt7530.c:1976:1: warning: no previous prototype for ‘mt7531_sgmii_link_up_force’ [-Wmissing-prototypes]
1976 | mt7531_sgmii_link_up_force(struct dsa_switch *ds, int port,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/dsa/mt7530.c:2081:6: warning: no previous prototype for ‘mt7531_sgmii_restart_an’ [-Wmissing-prototypes]
2081 | void mt7531_sgmii_restart_an(struct dsa_switch *ds, int port)
| ^~~~~~~~~~~~~~~~~~~~~~~../drivers/net/dsa/mt7530.c:1976:1: warning: symbol 'mt7531_sgmii_link_up_force' was not declared. Should it be static? ../drivers/net/dsa/mt7530.c:2081:6: warning: symbol 'mt7531_sgmii_restart_an' was not declared. Should it be static?
Re: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
Hi Jakub,
These 2 function are used in the same file only. I'll fix warnings by making 2 functions 'static' in v3.
Landen
On Tue, 2020-08-18 at 23:23 +0800, Jakub Kicinski wrote:
[snip]
Quoted 10 lines
Please fix these W=1 warnings:
../drivers/net/dsa/mt7530.c:1976:1: warning: no previous prototype for ‘mt7531_sgmii_link_up_force’ [-Wmissing-prototypes]
1976 | mt7531_sgmii_link_up_force(structdsa_switch*ds, int port,| ^~~~~~~~~~~~~~~~~~~~~~~~~~ ../drivers/net/dsa/mt7530.c:2081:6: warning: no previous prototype for ‘mt7531_sgmii_restart_an’ [-Wmissing-prototypes] 2081 | void mt7531_sgmii_restart_an(struct dsa_switch *ds, int port) | ^~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/dsa/mt7530.c:1976:1: warning: symbol 'mt7531_sgmii_link_up_force' was not declared. Should it be static?../drivers/net/dsa/mt7530.c:2081:6: warning: symbol 'mt7531_sgmii_restart_an' was not declared. Should it be static?
Andrew Lunn
maintainerRe: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
In reply to Landen ChaoQuoted 9 lines · Landen Chao
Add new support for MT7531:
MT7531 is the next generation of MT7530. It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW sku. Due to SGMII interface support, pll, and pad setting are different from MT7530. This patch adds different initial setting, and SGMII phylink handlers of MT7531.
Quoted 4 lines
MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability which is compatible withPHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-bnad negotiation
band
Quoted 3 lines
which is compatible with 10B/8B encoding of
PHY_INTERFACE_MODE_1000BASEXwith fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiation
band
Quoted 22 lines
drivers/net/dsa/mt7530.c +22
-0+static int mt7531_rgmii_setup (struct mt7530_priv *priv,u32 port, +phy_interface_t interface) +{ +u32 val; + +if (!mt7531_is_rgmii_port (priv, port)) { +dev_err (priv->dev,"RGMII mode is not available for port %d\n" , + port); +return -EINVAL ; + } + + val =mt7530_read (priv,MT7531_CLKGEN_CTRL ); + val |=GP_CLK_EN ; + val &= ~GP_MODE_MASK ; + val |=GP_MODE (MT7531_GP_MODE_RGMII ); + val &= ~(TXCLK_NO_REVERSE |RXCLK_NO_DELAY ); +switch (interface) { +case PHY_INTERFACE_MODE_RGMII : + val |=TXCLK_NO_REVERSE ; + val |=RXCLK_NO_DELAY ; +break ; +case PHY_INTERFACE_MODE_RGMII_RXID :
drivers/net/dsa/mt7530.c mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, · line 1947
Quoted 10 lines
drivers/net/dsa/mt7530.c +10
-0+ val |=TXCLK_NO_REVERSE ; +break ; +case PHY_INTERFACE_MODE_RGMII_TXID : + val |=RXCLK_NO_DELAY ; +break ; +case PHY_INTERFACE_MODE_RGMII_ID : +break ; +default : +return -EINVAL ; + }
You need to be careful here. If the MAC is doing the RGMII delays, you need to ensure the PHY is not. What interface mode is passed to the PHY?
Andrew
Re: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
Quoted 10 lines · Andrew Lunn
Quoted 9 lines · Landen Chao
Add new support for MT7531:
MT7531 is the next generation of MT7530. It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW sku. Due to SGMII interface support, pll, and pad setting are different from MT7530. This patch adds different initial setting, and SGMII phylink handlers of MT7531.
Quoted 6 lines
Quoted 4 lines
MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability which is compatible withPHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-bnad negotiationband
Sorry, I'll fix it.
Quoted 6 lines
Quoted 4 lines
which is compatible with 10B/8B encoding of
PHY_INTERFACE_MODE_1000BASEXwith fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiationband
Sorry, I'll fix it.
Quoted 29 lines
Quoted 29 lines
drivers/net/dsa/mt7530.c +28
-0+static int mt7531_rgmii_setup (struct mt7530_priv *priv,u32 port, +phy_interface_t interface) +{ +u32 val; + +if (!mt7531_is_rgmii_port (priv, port)) { +dev_err (priv->dev,"RGMII mode is not available for port %d\n" , + port); +return -EINVAL ; + } + + val =mt7530_read (priv,MT7531_CLKGEN_CTRL ); + val |=GP_CLK_EN ; + val &= ~GP_MODE_MASK ; + val |=GP_MODE (MT7531_GP_MODE_RGMII ); + val &= ~(TXCLK_NO_REVERSE |RXCLK_NO_DELAY ); +switch (interface) { +case PHY_INTERFACE_MODE_RGMII : + val |=TXCLK_NO_REVERSE ; + val |=RXCLK_NO_DELAY ; +break ; +case PHY_INTERFACE_MODE_RGMII_RXID : + val |=TXCLK_NO_REVERSE ; +break ; +case PHY_INTERFACE_MODE_RGMII_TXID : + val |=RXCLK_NO_DELAY ; +break ; +case PHY_INTERFACE_MODE_RGMII_ID :
Quoted 8 lines
drivers/net/dsa/mt7530.c mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, · line 1947
Quoted 4 lines
drivers/net/dsa/mt7530.c +4
-0+break ; +default : +return -EINVAL ; + }You need to be careful here. If the MAC is doing the RGMII delays, you need to ensure the PHY is not. What interface mode is passed to the PHY?
Hi Andrew,
mt7531 RGMII port is a MAC-only port, it can be connected to CPU MAC or external phy. In bpi-r64 board, mt7531 RGMII is connected to CPU MAC, so I tend to implement RGMII logic for use case of bpi-r64.
In general, according to phy.rst, RGMII delay should be done by phy, but some MoCA product need RGMII delay in MAC. These two requirements conflict. Is there any suggestion to solve the conflict?
If mt7531 RGMII implementation needs to satisfy either phy.rst or special MoCA product, I would like to satisfy phy.rst and remove MAC RGMII delay in v3. For special product needs MAC RGMII delay, this patch can be used in its local codebase.
Landen
Quoted 2 lines
Andrew
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Andrew Lunn
maintainerRe: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
Quoted 3 lines
In general, according to
phy.rst, RGMII delay should be done by phy, but some MoCA product need RGMII delay in MAC. These two requirements conflict. Is there any suggestion to solve the conflict?
Implementing the delay in the PHY is just a recommendation, not a requirement. However, as i said, you need to be careful what is pass to phylib. If the MAC is implementing "rgmii-id", whatever makes it way down to phy_attach_direct() needs to be "rgmii". If the MAC implements "rgmii-rxid", the phy should be implementing "rgmii-txid", etc. If this is wrong, you get both the MAC and the PHY implementing delays, and bad things happen.
Andrew
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
In reply to Landen ChaoQuoting Landen Chao <[email protected]>:
Quoted 68 lines · Andrew Lunn
Quoted 10 lines · Landen Chao
Quoted 9 lines
Add new support for MT7531:
MT7531 is the next generation of MT7530. It is also a 7-ports switch with 5 giga embedded phys, 2 cpu ports, and the same MAC logic of MT7530. Cpu port 6 only supports SGMII interface. Cpu port 5 supports either RGMII or SGMII in different HW sku. Due to SGMII interface support, pll, and pad setting are different from MT7530. This patch adds different initial setting, and SGMII phylink handlers of MT7531.
Quoted 6 lines
Quoted 4 lines
MT7531 SGMII interface can be configured in following mode:
- 'SGMII AN mode' with in-band negotiation capability which is compatible withPHY_INTERFACE_MODE_SGMII.
- 'SGMII force mode' without in-bnad negotiationband
Sorry, I'll fix it.
Quoted 6 lines
Quoted 4 lines
which is compatible with 10B/8B encoding of
PHY_INTERFACE_MODE_1000BASEXwith fixed full-duplex and fixed pause.
- 2.5 times faster clocked 'SGMII force mode' without in-bnad negotiationband
Sorry, I'll fix it.
Quoted 29 lines
Quoted 29 lines
drivers/net/dsa/mt7530.c +28
-0+static int mt7531_rgmii_setup (struct mt7530_priv *priv,u32 port, +phy_interface_t interface) +{ +u32 val; + +if (!mt7531_is_rgmii_port (priv, port)) { +dev_err (priv->dev,"RGMII mode is not available for port %d\n" , + port); +return -EINVAL ; + } + + val =mt7530_read (priv,MT7531_CLKGEN_CTRL ); + val |=GP_CLK_EN ; + val &= ~GP_MODE_MASK ; + val |=GP_MODE (MT7531_GP_MODE_RGMII ); + val &= ~(TXCLK_NO_REVERSE |RXCLK_NO_DELAY ); +switch (interface) { +case PHY_INTERFACE_MODE_RGMII : + val |=TXCLK_NO_REVERSE ; + val |=RXCLK_NO_DELAY ; +break ; +case PHY_INTERFACE_MODE_RGMII_RXID : + val |=TXCLK_NO_REVERSE ; +break ; +case PHY_INTERFACE_MODE_RGMII_TXID : + val |=RXCLK_NO_DELAY ; +break ; +case PHY_INTERFACE_MODE_RGMII_ID :Quoted 8 lines
drivers/net/dsa/mt7530.c mt7530_mac_config(struct dsa_switch *ds, int port, unsigned int mode, · line 1947
Quoted 4 lines
drivers/net/dsa/mt7530.c +4
-0+break ; +default : +return -EINVAL ; + }You need to be careful here. If the MAC is doing the RGMII delays, you need to ensure the PHY is not. What interface mode is passed to the PHY?
Hi Andrew,
mt7531 RGMII port is a MAC-only port, it can be connected to CPU MAC or external phy. In bpi-r64 board, mt7531 RGMII is connected to CPU MAC, so I tend to implement RGMII logic for use case of bpi-r64.
Quoted 8 lines
In general, according to
phy.rst, RGMII delay should be done by phy, but some MoCA product need RGMII delay in MAC. These two requirements conflict. Is there any suggestion to solve the conflict?If mt7531 RGMII implementation needs to satisfy either
phy.rstor special MoCA product, I would like to satisfyphy.rstand remove MAC RGMII delay in v3. For special product needs MAC RGMII delay, this patch can be used in its local codebase.
Hi Landen,
With the current mainline code [1], the dsa code tries to detect how the MAC5 is used. All the three modes are supported. MAC5 -> PHY0, MAC5 -> PHY4, MAC5 -> EXTERNAL PHY and MAC5 to external MAC.
When MAC5 is a DSA port it skips settings the delay settings. See [2].
Maybe you can use a similar concept.
Greats,
René
[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/dsa/mt7530.c#n1303
[2] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/tree/drivers/net/dsa/mt7530.c#n598
Quoted 4 lines
Landen
Quoted 2 lines
Andrew
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH net-next v2 5/7] net: dsa: mt7530: Add the support of MT7531 switch
Hi!
Quoted 9 lines · René van Dorst
With the current mainline code [1], the dsa code tries to detect how the MAC5 is used. All the three modes are supported. MAC5 -> PHY0, MAC5 -> PHY4, MAC5 ->
EXTERNAL PHY and MAC5 to external MAC.When MAC5 is a DSA port it skips settings the delay settings. See [2].
Maybe you can use a similar concept.
Current detection relies on an incorrect assumption that mt753x switch is always used with mtk_eth_soc. It's a really hacky solution to use dt properties that don't belong to this switch at all and I think this approach should not be followed further by future code.
The usage of mac5 should be explicitly defined as a dt property under mt753x node.
Signature · 2 lines
Regards, Chuanhong Guo
PATCH v2 6/7 arm64: dts: mt7622: add mt7531 dsa to mt7622-rfb1 board
In reply to Landen ChaoAdd mt7531 dsa to mt7622-rfb1 board for 5 giga Ethernet ports support. mt7622 only supports 1 sgmii interface, so either gmac0 or gmac1 can be configured as sgmii interface. In this patch, change to connet mt7622 gmac0 and mt7531 port6 through sgmii interface.
--- arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts | 57 +++++++++++++++++--- 1 file changed, 51 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts +51 -6
@@ -105,20 +105,65 @@ pinctrl-0 = <ð_pins>; status = "okay"; - gmac1: mac@1 { + gmac0: mac@0 { compatible = "mediatek,eth-mac"; - reg = <1>; - phy-handle = <&phy5>; + reg = <0>; + phy-mode = "2500base-x"; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; }; mdio-bus { #address-cells = <1>; #size-cells = <0>; - phy5: ethernet-phy@5 { - reg = <5>; - phy-mode = "sgmii"; + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan0"; + }; + + port@1 { + reg = <1>; + label = "lan1"; + }; + + port@2 { + reg = <2>; + label = "lan2"; + }; + + port@3 { + reg = <3>; + label = "lan3"; + }; + + port@4 { + reg = <4>; + label = "wan"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + }; + }; }; + }; };
Signature · 1 line
2.17.1
Andrew Lunn
maintainerRe: [PATCH net-next v2 6/7] arm64: dts: mt7622: add mt7531 dsa to mt7622-rfb1 board
Quoted 3 lines · Landen Chao
Add mt7531 dsa to mt7622-rfb1 board for 5 giga Ethernet ports support. mt7622 only supports 1 sgmii interface, so either gmac0 or gmac1 can be configured as sgmii interface. In this patch, change to connet mt7622
connect
Andrew
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
PATCH v2 7/7 arm64: dts: mt7622: add mt7531 dsa to bananapi-bpi-r64 board
In reply to Landen ChaoAdd mt7531 dsa to bananapi-bpi-r64 board for 5 giga Ethernet ports support.
--- .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +44 -0
@@ -143,6 +143,50 @@ mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan0"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@3 { + reg = <3>; + label = "lan2"; + }; + + port@4 { + reg = <4>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + }; + }; + }; + }; };
Signature · 1 line
2.17.1
Vladimir Oltean
maintainerRe: [PATCH net-next v2 7/7] arm64: dts: mt7622: add mt7531 dsa to bananapi-bpi-r64 board
Quoted 46 lines · Landen Chao
Add mt7531 dsa to bananapi-bpi-r64 board for 5 giga Ethernet ports support.
Signed-off-by Landen Chao <[email protected]>--- .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +31
-0@@ -143,6 +143,50 @@ mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; + reg = <0>; + reset-gpios = <&pio 54 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "wan"; + }; + + port@1 { + reg = <1>; + label = "lan0"; + }; + + port@2 { + reg = <2>; + label = "lan1"; + }; + + port@3 { + reg = <3>; + label = "lan2"; + }; + + port@4 {
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts line 186
Quoted 10 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +10
-0+ reg = <4>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + };
Is there any reason why you're not specifying a fixed-link node here?
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +3
-0+ }; + }; + }; };Signature · 1 line
2.17.1
Thanks,
-Vladimir
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Re: [PATCH net-next v2 7/7] arm64: dts: mt7622: add mt7531 dsa to bananapi-bpi-r64 board
Quoted 20 lines · Vladimir Oltean
Quoted 19 lines · Landen Chao
Add mt7531 dsa to bananapi-bpi-r64 board for 5 giga Ethernet ports support.
Signed-off-by Landen Chao <[email protected]>--- .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +4
-0@@ -143,6 +143,50 @@ mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; +
[snip]
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts line 186
Quoted 6 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +6
-0+ port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + };Is there any reason why you're not specifying a fixed-link node here?
I got the below feedback in v1, so I follow the DSA common design in v2. v2 can work with fixed-link node or without fixed-link node in CPU port node.
"This fixed-link should not be needed. The DSA driver is supposed to
configure the CPU port to its fastest speed by default. 2500 is the fastest speed a 2500Base-X link can do..."
Quoted 11 lines
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +3
-0+ }; + }; + }; };Signature · 2 lines
-- 2.17.1Thanks,
-Vladimir
Vladimir Oltean
maintainerRe: [PATCH net-next v2 7/7] arm64: dts: mt7622: add mt7531 dsa to bananapi-bpi-r64 board
Quoted 30 lines · Landen Chao
Quoted 20 lines · Vladimir Oltean
Quoted 19 lines · Landen Chao
Add mt7531 dsa to bananapi-bpi-r64 board for 5 giga Ethernet ports support.
Signed-off-by Landen Chao <[email protected]>--- .../dts/mediatek/mt7622-bananapi-bpi-r64.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+)arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +4
-0@@ -143,6 +143,50 @@ mdio: mdio-bus { #address-cells = <1>; #size-cells = <0>; + + switch@0 { + compatible = "mediatek,mt7531"; +[snip]
Quoted 8 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts line 186
Quoted 6 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +6
-0+ port@6 { + reg = <6>; + label = "cpu"; + ethernet = <&gmac0>; + phy-mode = "2500base-x"; + };Is there any reason why you're not specifying a fixed-link node here?
Quoted 7 lines
I got the below feedback in v1, so I follow the DSA common design in v2. v2 can work with fixed-link node or without fixed-link node in CPU port node.
"This fixed-link should not be needed. The DSA driver is supposed to
configure the CPU port to its fastest speed by default. 2500 is the fastest speed a 2500Base-X link can do..."
See this discussion and the replies to it:
https://www.spinics.net/lists/netdev/msg630102.html
I think if mt7530 is using phylink for non-netdev ports (and it is), it would be good to have standard bindings that phylink can parse. For example, in lack of a "pause" specifier, will the CPU port use flow control or won't it? Why? I think there's simply no good reason why you'd omit 3 more lines now.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +3
-0+ }; + }; + }; };
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Signature · 1 line
2.17.1Thanks,
-Vladimir
-Vladimir
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Tested full series on Bananapi-R2+R64 with5.9-rc1 (iperf3 no retransmitts, Throughput >900Mbit/s)
maybe you can include the port_change_mtu callback you've send me? or do you want to send it separately
regards Frank
Hi,
Is port mirroring working? Port mirroring registers on MT7531 have moved, according to bpi's MT7531 reference manual. Please fix that as well.
Hi
Is vlan also different?
Am 19. August 2020 05:49:20 MESZ schrieb DENG Qingfang <[email protected]>:
Quoted 10 lines
Hi,
Is port mirroring working? Port mirroring registers on MT7531 have moved, according to bpi's MT7531 reference manual. Please fix that as well.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
regards Frank
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek
Hi DENG,
MT7531 mirror port has been fixed by new definition of register base in header file. The logic of mirror port setting in 7530.c is reused.
@@ -41,6 +42,33 @@ enum mt753x_id {
#define MIRROR_PORT(x) ((x) & 0x7)
#define MIRROR_MASK 0x7
+/* Registers for CPU forward control */
+#define MT7531_CFC 0x4
+#define MT7531_MIRROR_EN BIT(19) +#define MT7531_MIRROR_MASK (MIRROR_MASK << 16) +#define MT7531_MIRROR_PORT_GET(x) (((x) >> 16) & MIRROR_MASK) +#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) ? \
+ MT7531_CFC : MT7530_MFC)
+#define MT753X_MIRROR_EN(id) (((id) == ID_MT7531) ? \
+ MT7531_MIRROR_EN : MIRROR_EN)
+#define MT753X_MIRROR_MASK(id) (((id) == ID_MT7531) ? \
+ MT7531_MIRROR_MASK : MIRROR_MASK)
Quoted 5 lines · DENG Qingfang
Hi,
Is port mirroring working? Port mirroring registers on MT7531 have moved, according to bpi's MT7531 reference manual. Please fix that as well.
_______________________________________________
Linux-mediatek mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-mediatek