Subject: Re: MPC85xx and linux IDE driver

From: Ben Warren <[email-masked]>
Date: Fri, 12 Oct 2007 15:48:26 -0400

Michael Brian Willis wrote:
> Hello, 
>
> I am using an MPC8540 based embedded system with a Compact Flash card in
> true IDE mode. The Compact Flash card is directly connected to the
> MPC8540 bus without the use of a pcmcia adapter. 
>
> The Compact Flash card is being initialized correctly using the U-boot
> boot-loader and is working properly as an ide device in U-boot. However
> I cannot get linux to recognize the ide device.
>
> I have tried several different linux config options and have tried
> passing kernel command line options as advised in the
> Documentation/ide.txt help file. However I have not been able to get the
> kernel to recognize my ide device. 
>
> Does anybody know if I can use the generic linux ide drivers? Or will I
> need to modify/write my own driver for this type of setup? 
>   
Here's what I use:

http://marc.info/?l=linux-kernel&m=113877891224982&w=2

Please note that if you're using a kernel newer than 2.6.18, the _insw() 
and _outsw() calls no longer exist, so you'll need to replace them. 
Here's how I modified Kumar's functions. Not necessarily the right way, 
but it seems to work:

/* xxx: use standard outsw, insw when byte lanes swapped */
static void cfide_outsw(unsigned long port, void *addr, u32 count)
{
u16 *tmp = addr;
while (count--)
out_le16((u16 *)port, *tmp++);
}

static void cfide_insw(unsigned long port, void *addr, u32 count)
{
u16 *tmp = addr;
while (count--)
*tmp++ = in_le16((u16 *)port);
}

regards,
Ben