MPC85xx and linux IDE driver
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
Quoted 10 lines · Michael Brian Willis
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.
Quoted 8 lines
I have tried several different linux config options and have tried passing kernel command line options as advised in the
Documentation/ide.txthelp 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
Quoted 3 lines · Ben Warren
Here's what I use:
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=yCONFIG_IDE_MAX_HWIFS=4CONFIG_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 setCONFIG_BLK_DEV_CFIDE=y
# CONFIG_BLK_DEV_IDEDMA is not set
# CONFIG_BLK_DEV_HD is not set
Quoted 10 lines · Michael Brian Willis
Quoted 4 lines · Ben Warren
Here's what I use:
Thanks for the response Ben.
Quoted 9 lines
I have put the driver you mentioned in my linux source and added the necessary information in the
Kconfigfile and theMakefile. 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));
}
Quoted 4 lines
Thank you for your help so far, anymore help/direction is greatly appreciated.
Glad to help.
regards,
Ben
Quoted 3 lines · Ben Warren
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
Quoted 10 lines · Michael Brian Willis
Quoted 2 lines · Ben Warren
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!
Quoted 3 lines
Thanks again for all of your help!
You're welcome.