Skip to contentSkip to conversation

Boot from Compact Flash

U-Boot-Users Ed Okerson 3 participants 5 messages Nov 18, 2003 – Nov 19, 2003 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ed Okerson

author
#1 lore raw

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

#2 lore raw

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

Quoted 43 lines · Ed Okerson

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 at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users

author
#3 lore raw
Quoted 7 lines · Thomas Lange

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()?

Quoted 2 lines

I have only used au1000 in big endian mode, so I cannot tell what happens in little.

Well, now we know!

Ed

author
#4 lore raw
In reply to Thomas Lange

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

#5 lore raw

Hi Ed,

On Tue, 18 Nov 2003, Ed Okerson wrote:

[ - snip - ]

Quoted 6 lines

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)

Quoted 8 lines

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.

Signature · 2 lines
Best Regards,
	Leon.