From: Mike Frysinger <vapier@gentoo.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ne2000: Fix broken build of three boards after CONFIG_NET_MULTI drop
Date: Sun, 16 Oct 2011 15:39:30 -0400 [thread overview]
Message-ID: <201110161539.31270.vapier@gentoo.org> (raw)
In-Reply-To: <1318788777-1679-1-git-send-email-bernhard.kaindl@gmx.net>
On Sunday 16 October 2011 14:12:57 Bernhard Kaindl wrote:
> ne2000 wasn't converted to CONFIG_NET_MULTI when the non-multi support was
> dropped, so boards using it (qemu-mips, shmin, r7780mp) failed to compile
> for multiple definition of eth_rx() and friends due to old ne2000_base.c.
ah i wrote a patch for this but forgot to post it :/
> - Tested using qemu-mips board,
> - Tested the two renesas / sh boards r7780mp and shmin to compile again,
> and should work.
but i couldn't test it, so this is even better
> --- a/board/qemu-mips/qemu-mips.c
> +++ b/board/qemu-mips/qemu-mips.c
>
> +int board_eth_init(bd_t *bis)
> +{
> + return ne2000_initialize();
> +}
> --- a/board/shmin/shmin.c
> +++ b/board/shmin/shmin.c
>
> +int board_eth_init(bd_t *bis)
> +{
> + return ne2000_initialize();
> +}
did you need to include netdev.h in this files for the new ne2000_initialize()
prototype ?
> --- a/drivers/net/ne2000_base.c
> +++ b/drivers/net/ne2000_base.c
>
> +int ne2000_initialize(void)
> +{
> + struct eth_device *dev;
> +
> + nic.base = (u8 *) CONFIG_DRIVER_NE2000_BASE;
> + nic.data = nic.base + DP_DATA;
> + nic.tx_buf1 = START_PG;
> + nic.tx_buf2 = START_PG2;
> + nic.rx_buf_start = RX_START;
> + nic.rx_buf_end = RX_END;
this should be using dev->priv rather than a global "nic" data structure
> + dev = calloc(sizeof(*dev), 1);
> + pbuf = malloc(NE2000_RX_BUFFER_SIZE);
> + if (dev == NULL || pbuf == NULL)
> + return -1;
if dev worked but pbuf failed, this leaks memory
also, you should return 0 here not -1
> + if (!get_prom(dev->enetaddr, nic.base))
> + return -1;
> +
> + dp83902a_init(dev);
these should probably be in the eth->init step and not here
> + eth_setenv_enetaddr("ethaddr", dev->enetaddr);
NAK: implement eth->write_hwaddr, and the driver should only use dev->enetaddr
rather than touching the env
> + /* For PCMCIA support: See doc/README.ne2000 on how to enable */
> +#ifdef CONFIG_DRIVER_NE2000_CCR
> + {
> + vu_char *p = (vu_char *) CONFIG_DRIVER_NE2000_CCR;
> +
> + PRINTK("CCR before is %x\n", *p);
> + *p = CONFIG_DRIVER_NE2000_VAL;
> + PRINTK("CCR after is %x\n", *p);
> + }
> +#endif
i think this should be in ne2k_init
> --- a/include/netdev.h
> +++ b/include/netdev.h
>
> +int ne2000_initialize();
needs to be "(void)"
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20111016/cb39e5ac/attachment.pgp
next prev parent reply other threads:[~2011-10-16 19:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-16 18:12 [U-Boot] [PATCH] ne2000: Fix broken build of three boards after CONFIG_NET_MULTI drop Bernhard Kaindl
2011-10-16 19:39 ` Mike Frysinger [this message]
2011-10-17 22:05 ` Bernhard Kaindl
2011-10-17 22:26 ` Mike Frysinger
2011-10-17 22:29 ` Mike Frysinger
2011-10-20 20:56 ` [U-Boot] [PATCH v2] ne2000: Convert to new net-multi model, fixes build of three boards Bernhard Kaindl
2011-12-07 21:45 ` Marek Vasut
2011-12-08 21:27 ` Wolfgang Denk
2011-12-09 3:47 ` Mike Frysinger
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=201110161539.31270.vapier@gentoo.org \
--to=vapier@gentoo.org \
--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.