From: Ben Warren Date: Mon, 16 Jul 2007 10:02:33 -0400 Subject: [U-Boot-Users] guide/document on writing network drivers In-Reply-To: <200707151710.12311.vapier@gentoo.org> References: <200707151710.12311.vapier@gentoo.org> Message-ID: <1184594553.31056.13.camel@saruman.qstreams.net> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Mike, On Sun, 2007-07-15 at 17:10 -0400, Mike Frysinger wrote: > is there a document somewhere covering the API for the ethernet layer ? some > drivers i look at implement the eth_* functions (like drivers/smc9111.c) > while others hook into the generic net/ layer but requires adding a call to > the init function in net/eth.c ... > -mike The second method you describe is preferred because it allows multiple, different ethernet controllers to exist on a board. Each device is registered into a list, which can then be traversed when trying to access a network. The drivers end up looking more like Linux ones, which is something we should aspire towards. As you've pointed out, though, this method requires you to explicitly add an initialize() call to net/eth.c, which is clumsy to say the least. I haven't had a chance yet to look at what the smart guys are doing in v2. In my mind this design is a serious candidate for refactoring... cheers, Ben