Message ID | 20130128182218.GB9436@obsidianresearch.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Thanks Jason, A question for Simon below On Mon, Jan 28, 2013 at 11:22:18AM -0700, Jason Gunthorpe wrote: > On Sun, Jan 27, 2013 at 11:52:41AM +0100, Sebastian Hesselbarth wrote: > > > I agree that loosing the MAC address _is_ an issue but there must > > be another way to retain it during gated ge clocks than not gate the > > clocks at all. > > > > I can think of some ways to retain it but don't know what is the most > > common with linux: > > - make u-boot pass it through cmdline and let mv643xx get it from there > > - have kirkwood's common code grab it before clk gates kick in > > The cannonical solution here is to have a DT attribute > 'local-mac-address' that is filled in by the bootloader rather than > attempting to pass the mac address to the kernel through the ethernet > controller registers. Simon, Can you try this in conjunction with enabling ARM_ATAG_DTB_COMPAT ? Does that solve your issue? thx, Jason. > > Until the bootloaders are fixed a reasonable hack is to have the > platform startup code look for an all-zeros local-mac-address in the > DT and if found then copy the MAC from the ethernet registers into the > DT. Then the ethernet driver can safely be a module since the MAC is > captured in the DT. > > I've been using this patch here on top of the original Ian Molton > patch. > > Jason: Can you include something like this as well? > > 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 >
On Mon, Jan 28, 2013 at 11:22:18AM -0700, Jason Gunthorpe wrote: > On Sun, Jan 27, 2013 at 11:52:41AM +0100, Sebastian Hesselbarth wrote: > > > I agree that loosing the MAC address _is_ an issue but there must > > be another way to retain it during gated ge clocks than not gate the > > clocks at all. > > > > I can think of some ways to retain it but don't know what is the most > > common with linux: > > - make u-boot pass it through cmdline and let mv643xx get it from there > > - have kirkwood's common code grab it before clk gates kick in > > The cannonical solution here is to have a DT attribute > 'local-mac-address' that is filled in by the bootloader rather than > attempting to pass the mac address to the kernel through the ethernet > controller registers. > > Until the bootloaders are fixed a reasonable hack is to have the > platform startup code look for an all-zeros local-mac-address in the > DT and if found then copy the MAC from the ethernet registers into the > DT. Then the ethernet driver can safely be a module since the MAC is > captured in the DT. > > I've been using this patch here on top of the original Ian Molton > patch. > > Jason: Can you include something like this as well? Seems reasonable. Mind updating the binding docs? I'd also like to confirm that legacy, factory-installed bootloaders are passing the mac addr via a special ATAG. My cursory check of the current mainline u-boot code doesn't include it, but Marvell's version may have. 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 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Mon, Jan 28, 2013 at 02:46:56PM -0500, Jason Cooper wrote: > Simon, > > Can you try this in conjunction with enabling ARM_ATAG_DTB_COMPAT ? > Does that solve your issue? I use CONFIG_ARM_ATAG_DTB_COMPAT=y CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y in my standard configuration already. I don't use the original U-Boot that came with the device, but a mainline one which supports my box. - Simon
On Tue, Jan 29, 2013 at 08:54:27PM +0100, Simon Baatz wrote: > On Mon, Jan 28, 2013 at 02:46:56PM -0500, Jason Cooper wrote: > > Simon, > > > > Can you try this in conjunction with enabling ARM_ATAG_DTB_COMPAT ? > > Does that solve your issue? > > I use > > CONFIG_ARM_ATAG_DTB_COMPAT=y > CONFIG_ARM_ATAG_DTB_COMPAT_CMDLINE_FROM_BOOTLOADER=y > > in my standard configuration already. I don't use the original U-Boot > that came with the device, but a mainline one which supports my box. Ahh, I thought you were using the stock bootloader that came with the device. Thanks for clearing that up. 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);