diff mbox

[v2,1/2] ARM: kirkwood: Ensure that kirkwood_ge0[01]_init() finds its clock

Message ID 20130130230518.GA7395@obsidianresearch.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Gunthorpe Jan. 30, 2013, 11:05 p.m. UTC
On Wed, Jan 30, 2013 at 05:43:00PM -0500, Jason Cooper wrote:
> > On 01/29/2013 09:32 PM, Jason Cooper wrote:
> > >On Tue, Jan 29, 2013 at 09:08:46PM +0100, Sebastian Hesselbarth wrote:
> > >>Leaves Issue 3, gbe forgets about its MAC address when gated or powered
> > >>down. That should be done with local-mac-address passed by DT enabled
> > >>u-boot or any other (dirty) ATAG hack ;)
> > >
> > >A patch to mv643xx_eth to pull this from DT should solve this.
> 
> Somewhere, Jason Gunthorpe shared his patch to do this.  I'll poke
> around for it and try to get it merged in.

Yes, you asked for the doc update and I haven't had a moment to get a
tree setup for that..

Here are some words though:

     - local-mac-address : Optional, the MAC address to assign to the
       device. If not specified then the MAC address in the HW
       registers is used, but the driver can not be made modular.

Comments

Jason Cooper Jan. 31, 2013, 12:29 a.m. UTC | #1
On Wed, Jan 30, 2013 at 04:05:18PM -0700, Jason Gunthorpe wrote:
> On Wed, Jan 30, 2013 at 05:43:00PM -0500, Jason Cooper wrote:
> > > On 01/29/2013 09:32 PM, Jason Cooper wrote:
> > > >On Tue, Jan 29, 2013 at 09:08:46PM +0100, Sebastian Hesselbarth wrote:
> > > >>Leaves Issue 3, gbe forgets about its MAC address when gated or powered
> > > >>down. That should be done with local-mac-address passed by DT enabled
> > > >>u-boot or any other (dirty) ATAG hack ;)
> > > >
> > > >A patch to mv643xx_eth to pull this from DT should solve this.
> > 
> > Somewhere, Jason Gunthorpe shared his patch to do this.  I'll poke
> > around for it and try to get it merged in.
> 
> Yes, you asked for the doc update and I haven't had a moment to get a
> tree setup for that..

Ahh, that's right.  Sorry, wasn't trying to put pressure on you.  Just
trying to make a reminder to myself of what to look for when I get to
around to it.  (I have a separate IMAP folder for such things ;-) )

> Here are some words though:
> 
>      - local-mac-address : Optional, the MAC address to assign to the
>        device. If not specified then the MAC address in the HW
>        registers is used, but the driver can not be made modular.

I like it.  If I haven't seen anything when I get to this, I'll add this
to your patch.  Please Ack if it's ok.  I prefer not to change peoples
patches without approval.

thx,

Jason.

> 
> diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index 7048d7c..2b2cfcb 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -2891,6 +2891,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
>  	struct mv643xx_eth_private *mp;
>  	struct net_device *dev;
>  	struct resource *res;
> +	const u8 *mac;
> +	int len;
>  	int err;
>  
>  	if (pdev->dev.of_node) {
> @@ -2912,6 +2914,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
>  		else
>  			pd->phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT;
>  
> +		mac = of_get_property(pdev->dev.of_node, "local-mac-address", &len);
> +		if (mac && len == 6)
> +		    memcpy(pd->mac_addr, mac, sizeof pd->mac_addr);
> +
>  		np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
>  		if (np) {
>  			pd->shared = of_find_device_by_node(np);
> -- 
> 1.7.5.4
>
Jason Gunthorpe Jan. 31, 2013, 12:39 a.m. UTC | #2
On Wed, Jan 30, 2013 at 07:29:16PM -0500, Jason Cooper wrote:

> > Yes, you asked for the doc update and I haven't had a moment to get a
> > tree setup for that..
> 
> Ahh, that's right.  Sorry, wasn't trying to put pressure on you.  Just
> trying to make a reminder to myself of what to look for when I get to
> around to it.  (I have a separate IMAP folder for such things ;-) )

No worries, right now I'm in a spot where the lastest ARM stuff has
diverged so much that it is a major job to get my custom board working
against the latest tree, so I'm kinda stuck waiting on some spare
time/things to settle out...
 
> > Here are some words though:
> > 
> >      - local-mac-address : Optional, the MAC address to assign to the
> >        device. If not specified then the MAC address in the HW
> >        registers is used, but the driver can not be made modular.
> 
> I like it.  If I haven't seen anything when I get to this, I'll add this
> to your patch.  Please Ack if it's ok.  I prefer not to change peoples
> patches without approval.

Please feel free to merge this text and the patch into Ian's DT patch,
or rebase ontop of the latest version as you like:

Signed-off-by: Jason Gunthorpe

Thanks for sorting this ethernet stuff!

Jason
diff mbox

Patch

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 7048d7c..2b2cfcb 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2891,6 +2891,8 @@  static int mv643xx_eth_probe(struct platform_device *pdev)
 	struct mv643xx_eth_private *mp;
 	struct net_device *dev;
 	struct resource *res;
+	const u8 *mac;
+	int len;
 	int err;
 
 	if (pdev->dev.of_node) {
@@ -2912,6 +2914,10 @@  static int mv643xx_eth_probe(struct platform_device *pdev)
 		else
 			pd->phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT;
 
+		mac = of_get_property(pdev->dev.of_node, "local-mac-address", &len);
+		if (mac && len == 6)
+		    memcpy(pd->mac_addr, mac, sizeof pd->mac_addr);
+
 		np = of_parse_phandle(pdev->dev.of_node, "mdio", 0);
 		if (np) {
 			pd->shared = of_find_device_by_node(np);