[U-Boot] U-Boot for AMCC Sequoia Board (PPC440EPX) fails to boot for version 2009.11-rc1 onwards

Hayes,Doug Doug.Hayes at safenet-inc.com
Thu Sep 15 17:08:02 CEST 2011


Hi Stefan;
Here's an update on what I've discovered in 2 different areas (I am using an older ELDK 4.1.4 for all this code) :
1) SW2 switch configurations that work on Sequoia board with 2011.06 U-boot and some that don't since 2009.11-rc1.
2) Compiler error when accessing data from EHCI controller registers.

1 - Sequoia Board Configurations
--------------------------------
The following first 4 SW2 dip switch settings will allow the latest 2011.06 U-Boot to run to the prompt (other settings there is no serial output). The last 2 configs. produce no output 2009.11-rc1 onwards. SW2 has labels 4,3,2,1 and for config. IDs below OFF=0, ON=1.  For example config. ID 5 has 4=OFF, 3=ON, 2=OFF, 1=ON.  Frequencies (MHz) and boot strap option are shown:
  Config. ID  CPU  PLB  OPB  EBC  PCI  BS-opt  PCI-async	Comments
  0           666  166  83   55   83   H I2C   66            Boots with 2011.06
  8           666  166  83   55   41   H I2C   33            Boots with 2011.06
  13          533  133  66   66   33   C EBC   33            Boots with 2011.06
  14          333  133  66   66   33   B EBC   33            Boots with 2011.06
  5           533  133  66   66   66   C EBC                 No output 2009.11-rc1 onwards
  6           333  166  66   66   66   B EBC                 No output 2009.11-rc1 onwards

Note: Removing the 2 calls to ppc4xx_pci_sync_clock_config() in sequoia.c allows configs. 5 & 6 to run as well.  I have not pursued this any further as config. 0 gives us a 66 Mhz PCI setting.

2 - Compiler error reading EHCI controller registers
----------------------------------------------------
I could not get EHCI devices (high-speed) to be detected on the Sequoia board with the 2011.06 release. OHCI worked fine.  I tracked it down to the use of the HC_VERSION and HC_LENGTH macros used to extract the version and capability length from the hccr->cr_capbase register at 0xE0000300.  A clue was when I did "usb reset" the version showed as "USB EHCI 0.10" instead of "USB EHCI 1.00".  This is because the code has taken the wrong 16 bits of the register.  For this controller the data reads as big endian if a 32-bit read is done.  For 8 & 16-bit reads the data is returned little endian. For instance, this cr_capbase reads as 0x01000010 for a 32-bit read, but as "10 00 00 01" as 8-bit reads. At the end of usb_low_level_init() in ehci-hcd.c it tries to extract the version major number by reading 32 bits, then shifting right 16 bits then shifting 8 bits. My ELDK 4.1.4 compiler shortcuts this and just does an "lhz" 16-bit read (even though the ehci_readl(x) has "volatile u32 *") followed by an 8 bit shift.  The 16-bit read gets 0x0010 instead.  The HC_LENGTH macro used in ehci_hcd_init() in ehci-ppc4xx.c had a similar shortcut done trying to get the capability length and read the version bytes instead.  This caused all the "hcor" registers to only be shifted by 1 instead of by 0x10 thereby causing all those register accesses to be incorrect. The following Diff outputs (changes are in ">" file) shows the changes we have made to correct the problem - use of volatile and 32-bit operations.  This could obviously cause problems for any other code that sub-divides the 32-bit register values for devices that behave the same way.  Perhaps newer compilers have fixed this problem.  

# diff ehci-hcd.c /work/sandboxes/u-boot-2011.06_rel/drivers/usb/host/
800c800
<       uint32_t reg;
---
>       volatile uint32_t reg;
854,855c854,855
<       reg = HC_VERSION(ehci_readl(&hccr->cr_capbase));
<       printf("USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
---
>       reg = ehci_readl(&hccr->cr_capbase);
>       printf("USB EHCI %x.%02x\n", reg >> 24, (reg >> 16) & 0x00ff);

# diff ehci-ppc4xx.c /work/sandboxes/u-boot-2011.06_rel/drivers/usb/host/
33a34
>       volatile uint32_t reg;
34a36
>       reg = ehci_readl(&hccr->cr_capbase);
36c38
<               HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
---
>                       HC_LENGTH(reg));

Hope that is useful.  Thanks for all the help.

Doug

-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de] 
Sent: Tuesday, September 13, 2011 4:11 AM
To: Hayes,Doug
Cc: U-Boot-Users
Subject: Re: [U-Boot] U-Boot for AMCC Sequoia Board (PPC440EPX) fails to boot for version 2009.11-rc1 onwards

Doug,

On Friday 09 September 2011 22:04:51 Hayes,Doug wrote:
> I removed the same 2 calls from the latest U-Boot (2011.06) and it boots to
> U-Boot prompt as well. Not sure how to set the card to 33MHz, it may
> already start at 33MHz.  The documentation on SW2 doesn't mention PCI
> settings (our current setting for SW2 is 4321:OFF,ON,OFF,ON?).  We are
> using Bootstrap Option C which comes up at PCI 33 MHz then I assume is
> changed to 66MHz by SW?

Hmmm. I checked with exactly your configuration:

U-Boot 2011.06-00588-g49ea2e3 (Sep 09 2011 - 08:20:40)

CPU:   AMCC PowerPC 440EPx Rev. A at 528 MHz (PLB=132 OPB=66 EBC=66 PCI=66 
MHz)
       Security/Kasumi support
       Bootstrap Option C - Boot ROM Location EBC (16 bits)
       Internal PCI arbiter enabled, PCI async ext clock used
       32 kB I-Cache 32 kB D-Cache
Board: Sequoia - AMCC PPC440EPx Evaluation Board, Rev. F, PCI-Async=66 MHz
I2C:   ready
DRAM:  256 MiB
Flash: 64 MiB
NAND:  32 MiB
PCI:   Bus Dev VenId DevId Class Int
USB:   Host(int phy) Device(ext phy)
Net:   ppc_4xx_eth0, ppc_4xx_eth1

Type run flash_nfs to mount root filesystem over NFS

Hit any key to stop autoboot:  0 
=> 

As you can see, I'm using the latest U-Boot source (without modifications). 
And it boots without problems to the prompt. So I'm not really sure why this 
doesn't work on your sequoia board.

You don't have any PCI devices plugged into your board, correct?

Do you have access to another board to test it on a different HW?

> On another note do you know if EHCI is supported for the USB host
> controller on the Sequioa 440EPX in the latest U-Boot. OHCI runs no
> problem but when I compile for EHCI it doesn't see devices when plugged
> in.  There is an errata [USB23] for this device which doesn't appear fixed
> here which may be the cause of this (but the code in U-Boot doesn't match
> the Linux code where the patch comes from).  Just wanted to know if EHCI
> is supported at all (there is some code there).  Thanks.

Yes, EHCI is supported. You need to make sure, that the USB devices connected 
to the Sequoia board are high-speed devices though. Here a log with EHCI 
enabled:

=> usb reset
(Re)start USB...
USB:   Register 1111 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
       scanning bus for storage devices... 1 Storage Device(s) found
=> usb tree

Device Tree:
  1  Hub (480 Mb/s, 0mA)
  |  u-boot EHCI Host Controller 
  |
  +-2  Mass Storage (480 Mb/s, 200mA)
       Memorex  Flashdrive 601B  076B02DE06F0

Best regards,
Stefan

--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: office at denx.de
The information contained in this electronic mail transmission 
may be privileged and confidential, and therefore, protected 
from disclosure. If you have received this communication in 
error, please notify us immediately by replying to this 
message and deleting it from your computer without copying 
or disclosing it.




More information about the U-Boot mailing list