[U-Boot-Users] Boot from Compact Flash

Ed Okerson eokerson at texasconnect.net
Tue Nov 18 22:38:27 CET 2003


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





More information about the U-Boot mailing list