I am writing software for an embedded Linux system that has a compact
flash device directly wired to a general-purpose peripheral bus. This is
a PowerPC 440GP-based system. The IDE interface chip select will appear
at some physical memory location that I program into the peripheral bus
controller.
Is there a standard way to configure a Linux IDE driver to recognize
this memory-mapped IDE device? It seems that the ide driver in Linux
wants to talk to an IDE interface chip rather than directly to an IDE
device. For example, Documentation/ide.txt refers to IDE chipsets, I/O
ports, and the PCI bus.
Thanks,
Gregg
Gabriele Brugnoni
14-10-2005, 05:19 AM
GB wrote:
> I am writing software for an embedded Linux system that has a compact
> flash device directly wired to a general-purpose peripheral bus. This is
> a PowerPC 440GP-based system. The IDE interface chip select will appear
> at some physical memory location that I program into the peripheral bus
> controller.
>
> Is there a standard way to configure a Linux IDE driver to recognize
> this memory-mapped IDE device? It seems that the ide driver in Linux
> wants to talk to an IDE interface chip rather than directly to an IDE
> device. For example, Documentation/ide.txt refers to IDE chipsets, I/O
> ports, and the PCI bus.
>
I've do last year somethings like that.
I've written a little driver that listen to an input port, detecting the
insertion of a CF in the slot.
When it detects a device, look at the CIS structure and, if classified as an
IDE disk, do the following:
Sets the CF register to IO mapper or memory mapped mode.
Based on this choice (depends on your hardware), calls:
#include <linux/ide.h>
.....
#if CF_ACCESS_MODE == CF_MEMORY_MODE
cf_hd = ide_register ( CFMEM_BASE, CFMEM_BASE8+0x00E, IRQ_COMPACTFLASH );
#endif
#if CF_ACCESS_MODE == CF_IOMODE_CONTINUOUS
cf_hd = ide_register ( CFIO_BASE, CFIO_BASE8+0xE, IRQ_COMPACTFLASH );
#endif
#if CF_ACCESS_MODE == CF_IOMODE_PRIMARY
cf_hd = ide_register ( CFIO_BASE+x1F0, CFIO_BASE8+0x3F6,
IRQ_COMPACTFLASH );
#endif
#if CF_ACCESS_MODE == CF_IOMODE_SECONDARY
cf_hd = ide_register ( CFIO_BASE+0x170, CFIO_BASE8+0x376,
IRQ_COMPACTFLASH );
#endif
CFIO_BASE is the base address to reach your device. The offsets depends on
your bus with (8, 16 or 32).
CF_IOMODE_xxxx must be defined depending on CF modality
IRQ_COMPACTFLASH is the irq.
This works fine in a 2.4.18 kernel.
I hope that may help.
By
Gabriele