[U-Boot-Users] Boot from Compact Flash

My BDI2000 is due to arrive today, I'm just waiting for FedEx to show up. In the meantime, I managed to get u-boot to run from RAM, so I wanted to get a head start on booting from Compact Flash. I have a 256MB CF card in a PCMCIA adapter. When I insert this in a Linux Laptop, it properly reports it as a SanDisk 256MB CF card. I managed to get u-boot to build Little Endian, and in that mode when I insert the PCMCIA it reports it as:
Reset IDE: Bus 0: OK Device 0: Model: aSDnsi kDSFC-B52 6 Firm: dV g.812. Ser#: 1144901E09P30101 Type: Removable Hard Disk Capacity: 117964.8 MB = 115.2 GB (-1476395001 x 512)
Obviousle the endian-ness is wrong. I tracked to the code in common/cmd_ide.c where there is a note:
/* We only need to swap data if we are running on a big endian cpu. */ /* But Au1x00 cpu:s already swaps data in big endian mode! */ #if defined(__LITTLE_ENDIAN) || defined(CONFIG_AU1X00) #define input_swap_data(x,y,z) input_data(x,y,z)
Where is the bit getting set that tells the Au1500 to swap bytes? If I build u-boot as big endian, it properly recognizes the CF card.
I am using the BdAu1500 board.
Is there a discussion somewhere about the pros/cons of running in big/little endian mode?
Ed Okerson

There seems to be a hw problem with the au1x00 series and pcmcia ( as you can see from the comment you attached ).
I have reported this to AMD and they are "looking into it".
This affects all data read/written from/to CF. For workaround see board/dbau1x00/README
I have only used au1000 in big endian mode, so I cannot tell what happens in little.
/Thomas
Ed Okerson wrote:
My BDI2000 is due to arrive today, I'm just waiting for FedEx to show up. In the meantime, I managed to get u-boot to run from RAM, so I wanted to get a head start on booting from Compact Flash. I have a 256MB CF card in a PCMCIA adapter. When I insert this in a Linux Laptop, it properly reports it as a SanDisk 256MB CF card. I managed to get u-boot to build Little Endian, and in that mode when I insert the PCMCIA it reports it as:
Reset IDE: Bus 0: OK Device 0: Model: aSDnsi kDSFC-B52 6 Firm: dV g.812. Ser#: 1144901E09P30101 Type: Removable Hard Disk Capacity: 117964.8 MB = 115.2 GB (-1476395001 x 512)
Obviousle the endian-ness is wrong. I tracked to the code in common/cmd_ide.c where there is a note:
/* We only need to swap data if we are running on a big endian cpu. */ /* But Au1x00 cpu:s already swaps data in big endian mode! */ #if defined(__LITTLE_ENDIAN) || defined(CONFIG_AU1X00) #define input_swap_data(x,y,z) input_data(x,y,z)
Where is the bit getting set that tells the Au1500 to swap bytes? If I build u-boot as big endian, it properly recognizes the CF card.
I am using the BdAu1500 board.
Is there a discussion somewhere about the pros/cons of running in big/little endian mode?
Ed Okerson
This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users

On Tue, 18 Nov 2003, Thomas Lange wrote:
There seems to be a hw problem with the au1x00 series and pcmcia ( as you can see from the comment you attached ).
I have reported this to AMD and they are "looking into it".
This affects all data read/written from/to CF. For workaround see board/dbau1x00/README
Hmm, I thought maybe it would be easier to have u-boot swap the bytes, so I modified cmd_ide.c to use the input_swap_data function as if it were running in big endian mode. But then I get linker errors:
common/libcommon.a(cmd_ide.o): In function `input_swap_data': /home/eokerson/AMD/u-boot-1.0.0/common/cmd_ide.c(.text+0x1194): undefined reference to `ld_le16' /home/eokerson/AMD/u-boot-1.0.0/common/cmd_ide.c(.text+0x11b0): undefined reference to `ld_le16' make: *** [u-boot] Error 1
Any idea where to find ld_le16()?
I have only used au1000 in big endian mode, so I cannot tell what happens in little.
Well, now we know!
Ed

OK, I have a start on this problem. I changed cmd_ide.c as follows:
/* We only need to swap data if we are running on a big endian cpu. */ /* But Au1x00 cpu:s already swaps data in big endian mode! */ #if (defined(__LITTLE_ENDIAN) && !defined(CONFIG_AU1X00)) || \ (!defined(__LITTLE_ENDIAN) && defined(CONFIG_AU1X00)) #define input_swap_data(x,y,z) input_data(x,y,z) #else static void input_swap_data(int dev, ulong *sect_buf, int words) { volatile ushort *pbuf = (ushort *)(ATA_CURR_BASE(dev)+ATA_DATA_REG); ushort *dbuf = (ushort *)sect_buf;
while (words--) { #if defined(CONFIG_AU1X00) *dbuf++ = swab16(*pbuf); *dbuf++ = swab16(*pbuf); #else *dbuf++ = ld_le16(pbuf); *dbuf++ = ld_le16(pbuf); #endif } } #endif
Now when I boot the little endian u-boot it sees the CF card as:
Device 0: Model: SanDisk SDCFB-256 Firm: Vdg 8.21. Ser#: 114409E1903P1010 Type: Removable Hard Disk Capacity: 5376.8 MB = 5.2 GB (11011840 x 512)
Everything is correct except for the capacity. The big endian load has the correct capacity:
Device 0: Model: SanDisk SDCFB-256 Firm: Vdg 8.21. Ser#: 114409E1903P1010 Type: Removable Hard Disk Capacity: 245.0 MB = 0.2 GB (501760 x 512)
Is there somewere else that reads need to be swaped as well?
Ed Okerson

Hi Ed,
On Tue, 18 Nov 2003, Ed Okerson wrote:
[ - snip - ]
Now when I boot the little endian u-boot it sees the CF card as:
Device 0: Model: SanDisk SDCFB-256 Firm: Vdg 8.21. Ser#: 114409E1903P1010 Type: Removable Hard Disk Capacity: 5376.8 MB = 5.2 GB (11011840 x 512)
Everything is correct except for the capacity. The big endian load has the correct capacity:
Device 0: Model: SanDisk SDCFB-256 Firm: Vdg 8.21. Ser#: 114409E1903P1010 Type: Removable Hard Disk Capacity: 245.0 MB = 0.2 GB (501760 x 512)
Is there somewere else that reads need to be swaped as well?
Firmware Revision, Model Number are in Big Endian, CF+ and CompactFlash Specification Revision 2.0: 6.2.1.6 Identify Drive, Table 39.
Current capacity in sectors (LBAs) (iop->lba_capacity) has Word57 LSW Word58 MSW. Same document, same table.
participants (3)
-
Ed Okerson
-
Leon KUKOVEC
-
Thomas Lange