diff mbox series

[v2,1/6] net: ocelot: add support to get port mac from device-tree

Message ID 20211103091943.3878621-2-clement.leger@bootlin.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series Add FDMA support on ocelot switch driver | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/module_param success Was 0 now: 0
netdev/signed warning No signature found. Please sign patches: https://github.com/mricon/patatt
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 11 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply, async

Commit Message

Clément Léger Nov. 3, 2021, 9:19 a.m. UTC
Add support to get mac from device-tree using of_get_mac_address.

Signed-off-by: Clément Léger <clement.leger@bootlin.com>
---
 drivers/net/ethernet/mscc/ocelot_net.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Vladimir Oltean Nov. 3, 2021, 10:26 a.m. UTC | #1
On Wed, Nov 03, 2021 at 10:19:38AM +0100, Clément Léger wrote:
> Add support to get mac from device-tree using of_get_mac_address.
> 
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---

Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>

>  drivers/net/ethernet/mscc/ocelot_net.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
> index eaeba60b1bba..d76def435b23 100644
> --- a/drivers/net/ethernet/mscc/ocelot_net.c
> +++ b/drivers/net/ethernet/mscc/ocelot_net.c
> @@ -1704,7 +1704,10 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
>  		NETIF_F_HW_TC;
>  	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
>  
> -	eth_hw_addr_gen(dev, ocelot->base_mac, port);
> +	err = of_get_mac_address(portnp, dev->dev_addr);
> +	if (err)
> +		eth_hw_addr_gen(dev, ocelot->base_mac, port);
> +
>  	ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
>  			  OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
>  
> -- 
> 2.33.0
>
Julian Wiedmann Nov. 15, 2021, 11:19 a.m. UTC | #2
On 03.11.21 11:19, Clément Léger wrote:
> Add support to get mac from device-tree using of_get_mac_address.
> 
> Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> ---
>  drivers/net/ethernet/mscc/ocelot_net.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
> index eaeba60b1bba..d76def435b23 100644
> --- a/drivers/net/ethernet/mscc/ocelot_net.c
> +++ b/drivers/net/ethernet/mscc/ocelot_net.c
> @@ -1704,7 +1704,10 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
>  		NETIF_F_HW_TC;
>  	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
>  
> -	eth_hw_addr_gen(dev, ocelot->base_mac, port);
> +	err = of_get_mac_address(portnp, dev->dev_addr);

of_get_ethdev_address() maybe, so that this gets routed through Jakub's fancy
new eth_hw_addr_set() infrastructure?

> +	if (err)
> +		eth_hw_addr_gen(dev, ocelot->base_mac, port);
> +
>  	ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
>  			  OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
>  
>
Clément Léger Nov. 15, 2021, 11:24 a.m. UTC | #3
Le Mon, 15 Nov 2021 13:19:49 +0200,
Julian Wiedmann <jwi@linux.ibm.com> a écrit :

> On 03.11.21 11:19, Clément Léger wrote:
> > Add support to get mac from device-tree using of_get_mac_address.
> > 
> > Signed-off-by: Clément Léger <clement.leger@bootlin.com>
> > ---
> >  drivers/net/ethernet/mscc/ocelot_net.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
> > index eaeba60b1bba..d76def435b23 100644
> > --- a/drivers/net/ethernet/mscc/ocelot_net.c
> > +++ b/drivers/net/ethernet/mscc/ocelot_net.c
> > @@ -1704,7 +1704,10 @@ int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
> >  		NETIF_F_HW_TC;
> >  	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
> >  
> > -	eth_hw_addr_gen(dev, ocelot->base_mac, port);
> > +	err = of_get_mac_address(portnp, dev->dev_addr);  
> 
> of_get_ethdev_address() maybe, so that this gets routed through Jakub's fancy
> new eth_hw_addr_set() infrastructure?

Hi Julian,

Acked, I will use that.

> 
> > +	if (err)
> > +		eth_hw_addr_gen(dev, ocelot->base_mac, port);
> > +
> >  	ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
> >  			  OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);
> >  
> >   
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/mscc/ocelot_net.c b/drivers/net/ethernet/mscc/ocelot_net.c
index eaeba60b1bba..d76def435b23 100644
--- a/drivers/net/ethernet/mscc/ocelot_net.c
+++ b/drivers/net/ethernet/mscc/ocelot_net.c
@@ -1704,7 +1704,10 @@  int ocelot_probe_port(struct ocelot *ocelot, int port, struct regmap *target,
 		NETIF_F_HW_TC;
 	dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_TC;
 
-	eth_hw_addr_gen(dev, ocelot->base_mac, port);
+	err = of_get_mac_address(portnp, dev->dev_addr);
+	if (err)
+		eth_hw_addr_gen(dev, ocelot->base_mac, port);
+
 	ocelot_mact_learn(ocelot, PGID_CPU, dev->dev_addr,
 			  OCELOT_VLAN_UNAWARE_PVID, ENTRYTYPE_LOCKED);