Device tree aware EMAC driver
Based on BenH's earlier work, this is a new version of the EMAC driver for the built-in ethernet found on PowerPC 4xx embedded CPUs. The same ASIC is also found in the Axon bridge chip. This new version is designed to work in the arch/powerpc tree, using the device tree to probe the device, rather than the old and ugly arch/ppc OCP layer.
This driver is designed to sit alongside the old driver (it lies in drivers/net/ibm_emac and this one in drivers/net/ibm_newemac). The old driver is left in place to support arch/ppc until arch/ppc itself reaches its final demise (not too long now, with luck).
This driver still has a number of things that could do with cleaning up, but I think they can be fixed up after merging. Specifically:
- Should be adjusted to properly use the dma mapping API.
Axon needs this.
- Probe logic needs reworking, in conjuction with the general
probing code for of_platform devices. The dependencies here between EMAC, MAL, ZMII etc. make this complicated. At present, it usually works, because we initialize and register the sub-drivers before the EMAC driver itself, and (being in driver code) runs after the devices themselves have been instantiated from the device tree.
---
Paul, I discussed with BenH, and although there are some problems with the driver still, we think it's good enough to merge in 2.6.24, the warts can be fixed up later.
Too big for the list, patch is at:
http://ozlabs.org/~dgibson/home/emac/powerpc-emac-new-20070807.patch
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 22 lines · On Tue, 7 Aug 2007 16:22:31 +1000 David Gibson <[email protected]>…
Based on BenH's earlier work, this is a new version of the EMAC driver for the built-in ethernet found on PowerPC 4xx embedded CPUs. The same ASIC is also found in the Axon bridge chip. This new version is designed to work in the
arch/powerpctree, using the device tree to probe the device, rather than the old and uglyarch/ppcOCP layer.This driver is designed to sit alongside the old driver (it lies in
drivers/net/ibm_emacand this one indrivers/net/ibm_newemac). The old driver is left in place to supportarch/ppcuntilarch/ppcitself reaches its final demise (not too long now, with luck).This driver still has a number of things that could do with cleaning up, but I think they can be fixed up after merging. Specifically:
- Should be adjusted to properly use the dma mapping API.
Axon needs this.
- Probe logic needs reworking, in conjuction with the general
probing code forof_platformdevices. The dependencies here between EMAC, MAL, ZMII etc. make this complicated. At present, it usually works, because we initialize and register the sub-drivers before the EMAC driver itself, and (being in driver code) runs after the devices themselves have been instantiated from the device tree.
Quoted 1 line
Signed-off-by David Gibson <[email protected]>
Hm. Should this go through Jeff Garzik or Paul? If it's the latter, I'll pull this into my git tree soon.
josh
Quoted 25 lines · Josh Boyer
Quoted 22 lines · On Tue, 7 Aug 2007 16:22:31 +1000 David Gibson <[email protected]>…
Based on BenH's earlier work, this is a new version of the EMAC driver for the built-in ethernet found on PowerPC 4xx embedded CPUs. The same ASIC is also found in the Axon bridge chip. This new version is designed to work in the
arch/powerpctree, using the device tree to probe the device, rather than the old and uglyarch/ppcOCP layer.This driver is designed to sit alongside the old driver (it lies in
drivers/net/ibm_emacand this one indrivers/net/ibm_newemac). The old driver is left in place to supportarch/ppcuntilarch/ppcitself reaches its final demise (not too long now, with luck).This driver still has a number of things that could do with cleaning up, but I think they can be fixed up after merging. Specifically:
- Should be adjusted to properly use the dma mapping API.
Axon needs this.
- Probe logic needs reworking, in conjuction with the general
probing code forof_platformdevices. The dependencies here between EMAC, MAL, ZMII etc. make this complicated. At present, it usually works, because we initialize and register the sub-drivers before the EMAC driver itself, and (being in driver code) runs after the devices themselves have been instantiated from the device tree.
Quoted 4 lines
Quoted 1 line
Signed-off-by David Gibson <[email protected]>Hm. Should this go through Jeff Garzik or Paul? If it's the latter, I'll pull this into my git tree soon.
Through Jeff Garzik, I think. I was planning to send it to him today or tomorrow if there are no screams from the linuxppc-dev list.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 5 lines · David Gibson
Based on BenH's earlier work, this is a new version of the EMAC driver for the built-in ethernet found on PowerPC 4xx embedded CPUs. The same ASIC is also found in the Axon bridge chip. This new version is designed to work in the
arch/powerpctree, using the device tree to probe the device, rather than the old and uglyarch/ppcOCP layer.
<snip>
Hi David,
I had a look over the patch FWIW, asside from the points below
looks good.
Minor nits:
* Shouldn't ndev->priv accesses, use netdev_priv() ? if not a comment somewhere about why not will keep the janators off your back.
* c++ style comments
* in emac_probe():
+ /* Wait for dependent devices */
+ err = -ENODEV;
+ err = emac_wait_deps(dev);
The initialisation to -ENODEV is pointless right? * s/get_property/of_get_property/g or you'll make sfr grumpy ;P
* In drivers/net/ibm_newemac/Makefile, I think the preferred method is to use ibm_newemac-y rather than ibm_newemac-objs.
Is there any reason to leave config IBM_NEW_EMAC (and IBM_EMAC) in drivers/net/Kconfig ? It seems to me they'd be nicer to in the appropriate drivers/net/*Kconfig.
Yours Tony
linux.conf.au http://linux.conf.au/ || http://lca2008.linux.org.au/
Jan 28 - Feb 02 2008 The Australian Linux Technical Conference!
Quoted 9 lines · Tony Breeds
Quoted 5 lines · David Gibson
Based on BenH's earlier work, this is a new version of the EMAC driver for the built-in ethernet found on PowerPC 4xx embedded CPUs. The same ASIC is also found in the Axon bridge chip. This new version is designed to work in the
arch/powerpctree, using the device tree to probe the device, rather than the old and uglyarch/ppcOCP layer.<snip>
Quoted 7 lines
Hi David,
I had a look over the patch FWIW, asside from the points below
looks good.Minor nits:
* Shouldn'tndev->privaccesses, usenetdev_priv()? if not a comment somewhere about why not will keep the janators off your back.
netdev_priv() hey? Hadn't heard of that before. I guess so... Changed.
Quoted 1 line
* c++ style comments
Eh, all the c++ comments are FIXMEs anyway. I'm inclined to leave them.
Quoted 5 lines
* in
emac_probe():+ /* Wait for dependent devices */ + err = -ENODEV; + err = emac_wait_deps(dev); The initialisation to -ENODEV is pointless right?
Yes, I think so. Removed.
Quoted 1 line
* s/get_property/of_get_property/g or you'll make sfr grumpy ;P
Oops, yes.
Quoted 6 lines
* In
drivers/net/ibm_newemac/Makefile, I think the preferred method is to use ibm_newemac-y rather than ibm_newemac-objs.Is there any reason to leave config
IBM_NEW_EMAC(andIBM_EMAC) indrivers/net/Kconfig? It seems to me they'd be nicer to in the appropriatedrivers/net/*Kconfig.
Yes, and that also seems to be how it's done for tulip. Moved.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Quoted 2 lines
* c++ style comments
Ouch... I haven't removed them all ? I promise I didn't -add- any :-)
Quoted 5 lines
* in
emac_probe():+ /* Wait for dependent devices */ + err = -ENODEV; + err = emac_wait_deps(dev); The initialisation to -ENODEV is pointless right?
Leftover from when it was coded differently yes.
Quoted 7 lines
* s/get_property/of_get_property/g or you'll make sfr grumpy ;)
* Indrivers/net/ibm_newemac/Makefile, I think the preferred method is to use ibm_newemac-y rather than ibm_newemac-objs.Is there any reason to leave config
IBM_NEW_EMAC(andIBM_EMAC) indrivers/net/Kconfig? It seems to me they'd be nicer to in the appropriatedrivers/net/*Kconfig.
Probably.
Ben.
Quoted 3 lines · David Gibson
Eh, all the c++ comments are FIXMEs anyway. I'm inclined to leave them.
Ahah... maybe I -did- add some of those then :-) I do use C++ comments for FIXME's on purpose, because they are ugly, it improves the changes that I actually get to fix whatever needs fixing :-)
Ben.
Quoted 2 lines
* In
drivers/net/ibm_newemac/Makefile, I think the preferred method is to use ibm_newemac-y rather than ibm_newemac-objs.
I thought it was the other way around, so I checked with the Kbuild maintainer, and indeed you are correct.
Segher
Quoted 4 lines · David Gibson
This driver is designed to sit alongside the old driver (it lies in
drivers/net/ibm_emacand this one indrivers/net/ibm_newemac). The old driver is left in place to supportarch/ppcuntilarch/ppcitself reaches its final demise (not too long now, with luck).
I would very much prefer if the patch was provided as first a pure copy without changes, then the actual diffs on top of that. The way it is now is just a huge blob that's harder to review than it would otherwise be.
-Olof
Quoted 5 lines · Segher Boessenkool
Quoted 2 lines
* In
drivers/net/ibm_newemac/Makefile, I think the preferred method is to use ibm_newemac-y rather than ibm_newemac-objs.I thought it was the other way around, so I checked with the
Kbuildmaintainer, and indeed you are correct.
Changed accordingly.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson