U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] Boot from Compact Flash
       [not found] <3FB55E5C.9050306@corelatus.com>
@ 2003-11-18 19:34 ` Ed Okerson
  2003-11-18 19:56   ` Thomas Lange
  0 siblings, 1 reply; 5+ messages in thread
From: Ed Okerson @ 2003-11-18 19:34 UTC (permalink / raw)
  To: u-boot

  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Boot from Compact Flash
  2003-11-18 19:34 ` [U-Boot-Users] Boot from Compact Flash Ed Okerson
@ 2003-11-18 19:56   ` Thomas Lange
  2003-11-18 20:02     ` Ed Okerson
  2003-11-18 21:38     ` Ed Okerson
  0 siblings, 2 replies; 5+ messages in thread
From: Thomas Lange @ 2003-11-18 19:56 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Boot from Compact Flash
  2003-11-18 19:56   ` Thomas Lange
@ 2003-11-18 20:02     ` Ed Okerson
  2003-11-18 21:38     ` Ed Okerson
  1 sibling, 0 replies; 5+ messages in thread
From: Ed Okerson @ 2003-11-18 20:02 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Boot from Compact Flash
  2003-11-18 19:56   ` Thomas Lange
  2003-11-18 20:02     ` Ed Okerson
@ 2003-11-18 21:38     ` Ed Okerson
  2003-11-19 10:01       ` Leon KUKOVEC
  1 sibling, 1 reply; 5+ messages in thread
From: Ed Okerson @ 2003-11-18 21:38 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] Boot from Compact Flash
  2003-11-18 21:38     ` Ed Okerson
@ 2003-11-19 10:01       ` Leon KUKOVEC
  0 siblings, 0 replies; 5+ messages in thread
From: Leon KUKOVEC @ 2003-11-19 10:01 UTC (permalink / raw)
  To: u-boot

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.

-- 

Best Regards,
	Leon.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-11-19 10:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <3FB55E5C.9050306@corelatus.com>
2003-11-18 19:34 ` [U-Boot-Users] Boot from Compact Flash Ed Okerson
2003-11-18 19:56   ` Thomas Lange
2003-11-18 20:02     ` Ed Okerson
2003-11-18 21:38     ` Ed Okerson
2003-11-19 10:01       ` Leon KUKOVEC

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox