Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-27 Thread Sean Wang
Hi Andrew On Fri, 2017-03-24 at 15:19 +0100, Andrew Lunn wrote: > On Tue, Mar 21, 2017 at 05:35:10PM +0800, sean.w...@mediatek.com wrote: > > Hi Sean > > > + /* Lower Tx Driving */ > > + for (i = 0 ; i < 6 ; i++) > > Could MT7530_CPU_PORT be used here? > I should create meaningful defi

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-27 Thread Sean Wang
Hi Andrew, Add comment as below inline On Fri, 2017-03-24 at 15:02 +0100, Andrew Lunn wrote: > Hi Sean > > > + regmap = devm_regmap_init(ds->dev, NULL, priv, > > + &mt7530_regmap_config); > > + if (IS_ERR(regmap)) > > + dev_warn(priv->dev, "phy regmap

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-27 Thread Sean Wang
Hi Florian, Thank for taking your time on reviewing. Add comment as inline. On Wed, 2017-03-22 at 11:39 -0700, Florian Fainelli wrote: > On 03/21/2017 02:35 AM, sean.w...@mediatek.com wrote: > > From: Sean Wang > > > > MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on > > Media

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-24 Thread Andrew Lunn
On Tue, Mar 21, 2017 at 05:35:10PM +0800, sean.w...@mediatek.com wrote: Hi Sean > + /* Lower Tx Driving */ > + for (i = 0 ; i < 6 ; i++) Could MT7530_CPU_PORT be used here? > + mt7530_write(priv, MT7530_TRGMII_TD_ODT(i), > + TD_DM_DRVP(8) | TD_DM_DR

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-24 Thread Andrew Lunn
Hi Sean > + regmap = devm_regmap_init(ds->dev, NULL, priv, > + &mt7530_regmap_config); > + if (IS_ERR(regmap)) > + dev_warn(priv->dev, "phy regmap initialization failed"); > + Shouldn't this be a fatal error? If you keep going when there is an err

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-24 Thread Andrew Lunn
On Thu, Mar 23, 2017 at 04:06:56PM +0800, Sean Wang wrote: > Hi Andrew, > > The purpose for the regmap table registered is to > > provide a way which helps us to look up a specific > > register on the switch through regmap-debugfs. > > > And not all ranges of register is defined > > so I on

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-23 Thread Felix Fietkau
On 2017-03-23 15:25, John Crispin wrote: > > > On 23/03/17 15:09, Felix Fietkau wrote: >> On 2017-03-23 09:06, Sean Wang wrote: >>> Hi Andrew, >>> >>> The purpose for the regmap table registered is to >>> >>> provide a way which helps us to look up a specific >>> >>> register on the switch throug

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-23 Thread John Crispin
On 23/03/17 15:09, Felix Fietkau wrote: On 2017-03-23 09:06, Sean Wang wrote: Hi Andrew, The purpose for the regmap table registered is to provide a way which helps us to look up a specific register on the switch through regmap-debugfs. And not all ranges of register is defined so I only

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-23 Thread Felix Fietkau
On 2017-03-23 09:06, Sean Wang wrote: > Hi Andrew, > > The purpose for the regmap table registered is to > > provide a way which helps us to look up a specific > > register on the switch through regmap-debugfs. > > > And not all ranges of register is defined > > so I only include the meanin

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-23 Thread Sean Wang
Hi Andrew, The purpose for the regmap table registered is to provide a way which helps us to look up a specific register on the switch through regmap-debugfs. And not all ranges of register is defined so I only include the meaningful ones in a sparse way for the table. Sean On

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-23 Thread Andrew Lunn
> +static int > +mt7623_trgmii_write(struct mt7530_priv *priv, u32 reg, u32 val) > +{ > + int ret; > + > + ret = regmap_write(priv->ethernet, TRGMII_BASE(reg), val); > + if (ret < 0) > + dev_err(priv->dev, > + "failed to priv write register\n"); > +

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-22 Thread Florian Fainelli
On 03/21/2017 02:35 AM, sean.w...@mediatek.com wrote: > From: Sean Wang > > MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on > Mediatek router platforms such as MT7623A or MT7623N platform which > includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. > Among thes

Re: [PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-22 Thread Andrew Lunn
> +static int > +core_read_mmd_indirect(struct mt7530_priv *priv, int prtad, int devad) > +{ > + struct mii_bus *bus = priv->bus; > + int value, ret; > + > + /* Write the desired MMD Devad */ > + ret = bus->write(bus, 0, MII_MMD_CTRL, devad); > + if (ret < 0) > + got

[PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-21 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N platform which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the user ports connecting with t