From: Dirk Behme <dirk.behme@googlemail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Remove board specific code from ENC28J60 network driver?
Date: Fri, 25 Dec 2009 19:57:55 +0100 [thread overview]
Message-ID: <4B350B33.3040702@googlemail.com> (raw)
In-Reply-To: <200912201505.51636.vapier@gentoo.org>
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, 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, 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
>
> 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.
I started to convert the enc28j60.c to common SPI framework. Do you
like to have a look at attachment (and maybe test it?)?
It is compile tested only. And for the moment it just re-uses the
existing driver. When we know that it basically works this way, doing
it in a clean way as you describe above would be the next step.
CONFIG_NET_MULTI is still missing, too.
In your config file you have to set and configure
#define CONFIG_xxx_SPI
#define CONFIG_ENC28J60
#define CONFIG_ENC28J60_SPI_BUS 0
#define CONFIG_ENC28J60_SPI_CS 0
#define CONFIG_ENC28J60_SPI_CLK 1000000
#define CONFIG_CMD_NET
for your board.
Opinions, ideas, proposals etc?
Best regards
Dirk
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: enc28j60_convert_to_spi_framework_patch.txt
Url: http://lists.denx.de/pipermail/u-boot/attachments/20091225/87b42fb5/attachment.txt
next prev parent reply other threads:[~2009-12-25 18:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-20 19:30 [U-Boot] Remove board specific code from ENC28J60 network driver? Dirk Behme
2009-12-20 19:54 ` Ben Warren
2009-12-20 20:05 ` Mike Frysinger
2009-12-21 8:26 ` Dirk Behme
2009-12-21 13:17 ` Mike Frysinger
2009-12-25 18:57 ` Dirk Behme [this message]
2009-12-26 18:40 ` Mike Frysinger
2009-12-27 7:59 ` Dirk Behme
2009-12-27 15:32 ` Ben Warren
2009-12-27 18:55 ` Dirk Behme
2009-12-28 18:33 ` Mike Frysinger
2009-12-28 21:29 ` Ben Warren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B350B33.3040702@googlemail.com \
--to=dirk.behme@googlemail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.