[U-Boot] Remove board specific code from ENC28J60 network driver?

Dirk Behme dirk.behme at googlemail.com
Mon Dec 21 09:26:06 CET 2009


On 20.12.2009 21:05, Mike Frysinger wrote:
> On Sunday 20 December 2009 14:30:35 Dirk Behme wrote:
>> For TI OMAP3 Beagle based Zippy expansion board from TinCanTools [1]
>> I'm currently looking into reusing spi based ENC28J60 network driver
>>
>> drivers/net/enc28j60.c
>>
>> It seems to me that it uses LPC2292 specific macros
>>
>> IO1CLR, IO1SET and IO1DIR
>>
>> These macros are defined in
>>
>> asm-arm/arch-lpc2292/lpc2292_registers.h
>
> this is why we didnt bother trying to get this part working on Blackfin boards
> under u-boot.  it works fine for us under Linux,

Similar situation with Beagle and Zippy.

> but the u-boot driver is a
> joke.

:(

>>    From enc28j60.c:
>>
>> ...
>> #define enc_enable() PUT32(IO1CLR, ENC_SPI_SLAVE_CS)
>> #define enc_disable() PUT32(IO1SET, ENC_SPI_SLAVE_CS)
>> ...
>>
>> ...
>> /* configure GPIO */
>> (*((volatile unsigned long *) IO1DIR)) |= ENC_SPI_SLAVE_CS;
>> (*((volatile unsigned long *) IO1DIR)) |= ENC_RESET;
>>
>> /* CS and RESET active low */
>> PUT32 (IO1SET, ENC_SPI_SLAVE_CS);
>> PUT32 (IO1SET, ENC_RESET);
>> ...
>>
>> Anybody with an idea how to move this code to some (LPC2292?) board
>> specific files to make enc28j60.c more generic to be able to reuse it
>> on other boards?
>
> unless the maintainers of the LPC2292 board are willing to help

Any idea who are the LPC2292 board maintainers? I couldn't find a 
LPC2292 entry in MAINTAINERS. Initial check in of enc28j60.c seems to 
be done by Peter Pearse.

>, i'd say just
> avoid the issue:
>   - rename/move this driver to indicate it is specific to LPC2292
>   - create a new driver based on the old one using the common SPI framework

Two additional questions:

- Which is the 'the common SPI framework'? Files?

- Just for correct understanding: We are talking about two issues 
here? The first issue is that enc28j60.c has board specific code, for 
e.g. setting GPIOs (as shown above)? And the second issue is that it 
doesn't use common SPI framework? Correct?

> once it starts using the common SPI framework, i should be able to easily help
> with testing on Blackfin boards.  we have a little addon card that lets us
> hook it up to a bunch of different boards.

Ok, I will have a look to it, but can't promise anything. At least it 
sounds like a good plan :) Any help will be appreciated, though ;)

Best regards

Dirk



More information about the U-Boot mailing list