linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* MPC85xx and linux IDE driver
@ 2007-10-12 18:29 Michael Brian Willis
  2007-10-12 19:48 ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Brian Willis @ 2007-10-12 18:29 UTC (permalink / raw)
  To: linuxppc-embedded

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? 

Any help is greatly appreciated. 


Regards, 

Michael Willis
Applied Research Labs - University of Texas
willis  <at>  arlut.utexas.edu

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

* Re: MPC85xx and linux IDE driver
  2007-10-12 18:29 MPC85xx and linux IDE driver Michael Brian Willis
@ 2007-10-12 19:48 ` Ben Warren
  2007-10-17 17:47   ` Michael Brian Willis
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Warren @ 2007-10-12 19:48 UTC (permalink / raw)
  To: Michael Brian Willis; +Cc: linuxppc-embedded

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

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

* Re: MPC85xx and linux IDE driver
  2007-10-12 19:48 ` Ben Warren
@ 2007-10-17 17:47   ` Michael Brian Willis
  2007-10-17 18:44     ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Brian Willis @ 2007-10-17 17:47 UTC (permalink / raw)
  To: Ben Warren; +Cc: linuxppc-embedded


On Fri, 2007-10-12 at 15:48 -0400, Ben Warren wrote:
  
> Here's what I use:
> 
> http://marc.info/?l=linux-kernel&m=113877891224982&w=2

Thanks for the response Ben. 

I have put the driver you mentioned in my linux source and added the
necessary information in the Kconfig file and the Makefile. So, I am now
able to build the driver when I make my kernel image. However, I can't
figure out what else needs to be done in order to actually use the
driver for my compact flash device. Do I need to specify anything at the
kernel command line, or do I need to modify any other config files?
(Below is the ide portion of my linux .config file)

Thank you for your help so far, anymore help/direction is greatly
appreciated. 

Regards, 

Michael Willis
Applied Research Labs - University of Texas



#
# ATA/ATAPI/MFM/RLL support
#
CONFIG_IDE=y
CONFIG_IDE_MAX_HWIFS=4
CONFIG_BLK_DEV_IDE=y

#
# Please see Documentation/ide.txt for help/info on IDE drives
#
# CONFIG_BLK_DEV_IDE_SATA is not set
# CONFIG_BLK_DEV_IDEDISK is not set
# CONFIG_IDEDISK_MULTI_MODE is not set
# CONFIG_BLK_DEV_IDECD is not set
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set
CONFIG_IDE_TASK_IOCTL=y

#
# IDE chipset support/bugfixes
#
CONFIG_IDE_GENERIC=y
# CONFIG_BLK_DEV_IDEPCI is not set
# CONFIG_IDE_ARM is not set
CONFIG_BLK_DEV_CFIDE=y
# CONFIG_BLK_DEV_IDEDMA is not set
# CONFIG_BLK_DEV_HD is not set

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

* Re: MPC85xx and linux IDE driver
  2007-10-17 17:47   ` Michael Brian Willis
@ 2007-10-17 18:44     ` Ben Warren
  2007-10-25 21:49       ` Michael Brian Willis
  0 siblings, 1 reply; 6+ messages in thread
From: Ben Warren @ 2007-10-17 18:44 UTC (permalink / raw)
  To: Michael Brian Willis; +Cc: linuxppc-embedded

Michael Brian Willis wrote:
> On Fri, 2007-10-12 at 15:48 -0400, Ben Warren wrote:
>   
>   
>> Here's what I use:
>>
>> http://marc.info/?l=linux-kernel&m=113877891224982&w=2
>>     
>
> Thanks for the response Ben. 
>
> I have put the driver you mentioned in my linux source and added the
> necessary information in the Kconfig file and the Makefile. So, I am now
> able to build the driver when I make my kernel image. However, I can't
> figure out what else needs to be done in order to actually use the
> driver for my compact flash device. Do I need to specify anything at the
> kernel command line, or do I need to modify any other config files?
> (Below is the ide portion of my linux .config file)
>
>   
This device driver is a platform driver, so you need to register a 
platform device somewhere in your board-specific init code that contains 
the hardware details (memory mapping and IRQ #).  You can either pass 
this in via device tree or hard code it.  I chose the latter in order to 
get up and runninq quickly.  Here's the init function I use.  CS0 is @ 
0xe4000000, CS1 is @ 0xe4100000 and I'm using IRQ20, which is one of the 
external IRQs on my CPU:

/* Compact Flash Initialization */

static int __init prism_setup_cf(void)
{
    struct resource r[3];
    struct platform_device *cf_dev;
    unsigned int virq;

    memset(&r, 0, sizeof(r));
    r[0].start = 0xe4000000;
    r[0].end = 0xe400000f;
    r[0].flags = IORESOURCE_MEM;

    r[1].start = 0xe4100000;
    r[1].end = 0xe410000f;
    r[1].flags = IORESOURCE_MEM;

   
    virq = irq_find_mapping(NULL, 20);
    set_irq_type(virq, IRQ_TYPE_EDGE_FALLING);
    r[2].start = virq;
    r[2].end = 0;
    r[2].flags = IORESOURCE_IRQ;

    cf_dev = platform_device_register_simple("mmio-cfide", 0, r, 3);

    return (cf_dev ? 0 : PTR_ERR(cf_dev));
}

> Thank you for your help so far, anymore help/direction is greatly
> appreciated. 
>
>   
Glad to help.

regards,
Ben

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

* Re: MPC85xx and linux IDE driver
  2007-10-17 18:44     ` Ben Warren
@ 2007-10-25 21:49       ` Michael Brian Willis
  2007-10-25 22:04         ` Ben Warren
  0 siblings, 1 reply; 6+ messages in thread
From: Michael Brian Willis @ 2007-10-25 21:49 UTC (permalink / raw)
  To: Ben Warren; +Cc: linuxppc-embedded

On Wed, 2007-10-17 at 14:44 -0400, Ben Warren wrote:

> This device driver is a platform driver, so you need to register a 
> platform device somewhere in your board-specific init code that contains 
> the hardware details (memory mapping and IRQ #).  

After modifying your init code and putting it in my board specific ".c"
file everything is working great. 

Thanks again for all of your help!

Michael Willis

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

* Re: MPC85xx and linux IDE driver
  2007-10-25 21:49       ` Michael Brian Willis
@ 2007-10-25 22:04         ` Ben Warren
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Warren @ 2007-10-25 22:04 UTC (permalink / raw)
  To: Michael Brian Willis; +Cc: linuxppc-embedded

Michael Brian Willis wrote:
> On Wed, 2007-10-17 at 14:44 -0400, Ben Warren wrote:
>
>   
>> This device driver is a platform driver, so you need to register a 
>> platform device somewhere in your board-specific init code that contains 
>> the hardware details (memory mapping and IRQ #).  
>>     
>
> After modifying your init code and putting it in my board specific ".c"
> file everything is working great. 
>
>   
Fantastic!
> Thanks again for all of your help!
>
>   
You're welcome.

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

end of thread, other threads:[~2007-10-25 22:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-12 18:29 MPC85xx and linux IDE driver Michael Brian Willis
2007-10-12 19:48 ` Ben Warren
2007-10-17 17:47   ` Michael Brian Willis
2007-10-17 18:44     ` Ben Warren
2007-10-25 21:49       ` Michael Brian Willis
2007-10-25 22:04         ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).