public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] net: macb: using phylib to configure phy device
Date: Thu, 15 Aug 2013 16:36:05 +0200	[thread overview]
Message-ID: <520CE755.4000201@gmail.com> (raw)
In-Reply-To: <1366790368-22327-3-git-send-email-voice.shen@atmel.com>

Hi Bo,

I'm currently applying your patches. Patch 'arm: atmel: add gmac support
for sama5d3xek board' shows that this particular patch is defective ...
please send a fix or I will not apply the gmac for sama5.

On 04/24/2013 09:59 AM, Bo Shen wrote:
> using phylib to configure phy device in macb driver
> 
> Signed-off-by: Bo Shen <voice.shen@atmel.com>
> ---
>  drivers/net/macb.c |   16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/macb.c b/drivers/net/macb.c
> index 753fb96..b83d65a 100644
> --- a/drivers/net/macb.c
> +++ b/drivers/net/macb.c
> @@ -103,6 +103,7 @@ struct macb_device {
>  	const struct device	*dev;
>  	struct eth_device	netdev;
>  	unsigned short		phy_addr;
> +	struct mii_dev		*bus;
>  };
>  #define to_macb(_nd) container_of(_nd, struct macb_device, netdev)
>  
> @@ -163,7 +164,7 @@ static u16 macb_mdio_read(struct macb_device *macb, u8 reg)
>  	return MACB_BFEXT(DATA, frame);
>  }
>  
> -#if defined(CONFIG_CMD_MII)
> +#if defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
>  
>  int macb_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)
>  {
> @@ -372,6 +373,9 @@ static int macb_phy_find(struct macb_device *macb)
>  static int macb_phy_init(struct macb_device *macb)
>  {
>  	struct eth_device *netdev = &macb->netdev;
> +#ifdef CONFIG_PHYLIB
> +	struct phy_device *phydev;
> +#endif
>  	u32 ncfgr;
>  	u16 phy_id, status, adv, lpa;
>  	int media, speed, duplex;
> @@ -391,6 +395,13 @@ static int macb_phy_init(struct macb_device *macb)
>  		return 0;
>  	}
>  
> +#ifdef CONFIG_PHYLIB
> +	phydev->bus = macb->bus;

phydev is uninitialized here ...

> +	phydev->dev = netdev;
> +	phydev->addr = macb->phy_addr;
> +	phy_config(phydev);
> +#endif
> +
>  	status = macb_mdio_read(macb, MII_BMSR);
>  	if (!(status & BMSR_LSTATUS)) {
>  		/* Try to re-negotiate if we don't have link already. */
> @@ -574,8 +585,9 @@ int macb_eth_initialize(int id, void *regs, unsigned int phy_addr)
>  
>  	eth_register(netdev);
>  
> -#if defined(CONFIG_CMD_MII)
> +#if defined(CONFIG_CMD_MII) || defined(CONFIG_PHYLIB)
>  	miiphy_register(netdev->name, macb_miiphy_read, macb_miiphy_write);
> +	macb->bus = miiphy_get_dev_by_name(netdev->name);
>  #endif
>  	return 0;
>  }
> 

  reply	other threads:[~2013-08-15 14:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24  7:59 [U-Boot] [PATCH 0/3] net: macb: add support for gigabit MAC Bo Shen
2013-04-24  7:59 ` [U-Boot] [PATCH 1/3] net: macb: using AT91FAMILY replace #ifdeferry Bo Shen
2013-05-08 11:30   ` Andreas Bießmann
2013-06-24 14:57   ` Andreas Bießmann
2013-06-25  0:13     ` Joe Hershberger
2013-04-24  7:59 ` [U-Boot] [PATCH 2/3] net: macb: using phylib to configure phy device Bo Shen
2013-08-15 14:36   ` Andreas Bießmann [this message]
2013-08-16  1:53     ` Bo Shen
2013-04-24  7:59 ` [U-Boot] [PATCH 3/3] net: macb: add support for gigabit MAC Bo Shen
2013-07-08 16:14 ` [U-Boot] [PATCH 0/3] " Joe Hershberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=520CE755.4000201@gmail.com \
    --to=andreas.devel@googlemail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox