[PATCH 3/6] drivers: gianfar: MAC address

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Tue Oct 29 09:15:38 EDT 2013


On 11:24 Tue 29 Oct     , Renaud Barbier wrote:
> A framework is added to pass the board MAC address to the
> gianfar driver.
> This is in preparation for the introduction of the GEIP DA923RC
> board support.
> 


so use eth_register_ethaddr for this insteawd


> Signed-off-by: Renaud Barbier <renaud.barbier at ge.com>
> ---
>  arch/ppc/mach-mpc85xx/include/mach/gianfar.h |  2 ++
>  drivers/net/gianfar.c                        | 10 +++++++++-
>  drivers/net/gianfar.h                        |  2 ++
>  3 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/ppc/mach-mpc85xx/include/mach/gianfar.h b/arch/ppc/mach-mpc85xx/include/mach/gianfar.h
> index 6a7b9e9..c405dd5 100644
> --- a/arch/ppc/mach-mpc85xx/include/mach/gianfar.h
> +++ b/arch/ppc/mach-mpc85xx/include/mach/gianfar.h
> @@ -30,6 +30,8 @@ struct gfar_info_struct {
>  	unsigned int tbiana;
>  	unsigned int tbicr;
>  	unsigned int mdiobus_tbi;
> +	int mac_idx;
> +	int (*get_mac)(int mac_idx, unsigned char *);
>  };
>  
>  int fsl_eth_init(int num, struct gfar_info_struct *gf);
> diff --git a/drivers/net/gianfar.c b/drivers/net/gianfar.c
> index f944c6c..eaf2847 100644
> --- a/drivers/net/gianfar.c
> +++ b/drivers/net/gianfar.c
> @@ -229,7 +229,13 @@ static int gfar_open(struct eth_device *edev)
>  
>  static int gfar_get_ethaddr(struct eth_device *edev, unsigned char *mac)
>  {
> -	return -ENODEV;
> +	struct gfar_private *priv = edev->priv;
> +	int (*get_mac)(int, unsigned char *) = priv->get_mac;
> +
> +	if (get_mac)
> +		return get_mac(priv->mac_idx, mac);
> +	else
> +		return -ENODEV;
>  }
>  
>  static int gfar_set_ethaddr(struct eth_device *edev, unsigned char *mac)
> @@ -493,6 +499,8 @@ static int gfar_probe(struct device_d *dev)
>  	priv->phyaddr = gfar_info->phyaddr;
>  	priv->tbicr = gfar_info->tbicr;
>  	priv->tbiana = gfar_info->tbiana;
> +	priv->get_mac = gfar_info->get_mac;
> +	priv->mac_idx = gfar_info->mac_idx;
>  
>  	mdev = get_device_by_name("gfar-mdio0");
>  	if (mdev == NULL) {
> diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
> index 1aac479..b011445 100644
> --- a/drivers/net/gianfar.h
> +++ b/drivers/net/gianfar.h
> @@ -277,6 +277,8 @@ struct gfar_private {
>  	struct phy_info *phyinfo;
>  	volatile struct txbd8 *txbd;
>  	volatile struct rxbd8 *rxbd;
> +	int (*get_mac)(int idx, unsigned char *);
> +	int mac_idx;
>  	uint txidx;
>  	uint rxidx;
>  	uint phyaddr;
> -- 
> 1.8.3.4
> 
> 
> _______________________________________________
> barebox mailing list
> barebox at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox



More information about the barebox mailing list