All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Warren <biggerbadderben@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1][Net] Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API
Date: Wed, 12 Aug 2009 15:31:26 -0700	[thread overview]
Message-ID: <4A8342BE.7050600@gmail.com> (raw)
In-Reply-To: <20090812221747.5C84F833DBD2@gemini.denx.de>

Hi Wolfgang,

Wolfgang Denk wrote:
> Dear Ben Warren,
>
> In message <1250050332-15531-2-git-send-email-biggerbadderben@gmail.com> you wrote:
>   
>> All in-tree boards that use this controller have CONFIG_NET_MULTI
>> added
>> Also:
>>   - changed CONFIG_DRIVER_CS8900 to CONFIG_CS8900
>>   - changed CS8900_BASE to CONFIG_CS8900_BASE
>>   - changed CS8900_BUS?? to CONFIG_CS8900_BUS??
>>   - cleaned up line lengths
>>   - modified VCMA9 command function that accesses the device
>>   - removed MAC address initialization from lib_arm/board.c
>>
>> Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
>>     
>
> The patch fails on "trab" (which is, as far as this patch is
> concerned, basicly identical to SMDK2400):
>
>   
Thank you very much for the fast, useful feedback!
> U-Boot 2009.08-rc2-00017-g7d4cd15-dirty (Aug 12 2009 - 23:55:37)
>
> I2C:   ready
> DRAM:  32 MB
> Flash:  8 MB
> USB:   scanning bus for devices... 1 USB Device(s) found
> 0 Storage Device(s) found
> Net:   CS8900-0
>
> Enter password - autoboot in 5 sec...
> TRAB # tftp C100000 trab/u-boot.bin-wd
> CS8900 Ethernet chip not found?!
> Using CS8900-0 device
> TFTP from server 192.168.1.1; our IP address is 192.168.3.68
> Filename 'trab/u-boot.bin-wd'.
> Load address: 0xc100000
> Loading: data abort
> pc : [<0df6b310>]          lr : [<0df4cc44>]
> sp : 0df1bd74  ip : 0df1c0e8     fp : 00000045
> r10: 0df7a320  r9 : 00000032     r8 : 0df1bfd8
> r7 : 00000000  r6 : 0df1c0e8     r5 : 0000002a  r4 : 0000005c
> r3 : 000000c0  r2 : ea000012     r1 : 0df7a320  r0 : 0df1c0e8
> Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
>
> resetting ...
>
>
> I see two issues here - the obvious "CS8900 Ethernet chip not
> found?!", and the fact that the (uninitialized?) driver then crashes
> the board.
>
>   
Uh, yeah.  Two serious problems :)
> With DEBUG enabled, I see the same, i. e. no additional information.
>
> With the following patch applied (which you might want to add - but
> please check if the changed return code makes sense; it doesn;t
> change behaviour, it seems) I get this:
>
> diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
> index 4935290..1f46d9a 100644
> --- a/drivers/net/cs8900.c
> +++ b/drivers/net/cs8900.c
> @@ -154,11 +154,14 @@ void cs8900_halt(struct eth_device *dev)
>  static int cs8900_init(struct eth_device *dev, bd_t * bd)
>  {
>  	uchar *enetaddr = dev->enetaddr;
> +	u16 id;
>  
>  	/* verify chip id */
> -	if (get_reg_init_bus(dev, PP_ChipID) != 0x630e) {
> -		printf ("CS8900 Ethernet chip not found?!\n");
> -		return 0;
> +	id = get_reg_init_bus(dev, PP_ChipID);
> +	if (id != 0x630e) {
> +		printf ("CS8900 Ethernet chip not found: ID=0x%04x instead 0x%04x\n",
> +			id, 0x630e);
> +		return 1;
>  	}
>  
>  	cs8900_reset (dev);
>
>
> TRAB # tftp C100000 trab/u-boot.bin-wd
> CS8900 Ethernet chip not found: ID=0x0012 instead 0x630e
> Using CS8900-0 device
> TFTP from server 192.168.1.1; our IP address is 192.168.3.68
> Filename 'trab/u-boot.bin-wd'.
> Load address: 0xc100000
> Loading: data abort
> pc : [<0df6b320>]          lr : [<0df4cc44>]
> sp : 0df1bd74  ip : 0df1c0e8     fp : 00000045
> r10: 0df7a320  r9 : 00000032     r8 : 0df1bfd8
> r7 : 00000000  r6 : 0df1c0e8     r5 : 0000002a  r4 : 0000005c
> r3 : 000000c0  r2 : ea000012     r1 : 0df7a320  r0 : 0df1c0e8
> Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
>
>
> So it's reading indeed a bad ID ...
>
>   
It looks like the 'trab' board uses 16-bit accesses 
(CONFIG_CS8900_BUS16).  The function 'get_reg_init_bus()' does some 
funny initialization to get the chip into 16-bit mode.  I wonder if 
maybe that's not working the same as the original.  That could explain 
the crash too.

BTW - it shouldn't matter in this case, but there's a typo in cs8900.c 
that this should fix:

diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 4935290..0c2e763 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -50,7 +50,7 @@
 
 /* packet page register access functions */
 
-#ifdef CS8900_BUS32
+#ifdef CONFIG_CS8900_BUS32
 /* we don't need 16 bit initialisation on 32 bit bus */
 #define get_reg_init_bus(x) get_reg((x))
 #else


Best regards,
> Wolfgang Denk
>
>   
regards,
Ben

  reply	other threads:[~2009-08-12 22:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-12  4:12 [U-Boot] [PATCH 0/1][Net] Convert CS8900 Ethernet driver to CONFIG_NET_MULTI API Ben Warren
2009-08-12  4:12 ` [U-Boot] [PATCH 1/1][Net] " Ben Warren
2009-08-12 22:17   ` Wolfgang Denk
2009-08-12 22:31     ` Ben Warren [this message]
2009-08-12 22:50       ` Wolfgang Denk
  -- strict thread matches above, loose matches on Subject: below --
2009-08-12 22:53 Wolfgang Denk
2009-08-12 22:55 ` 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=4A8342BE.7050600@gmail.com \
    --to=biggerbadderben@gmail.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.