Re: Direct Interface to Compact Flash

From: Gabriele Brugnoni (news_at_dveprojects.com)
Date: 10/13/05


Date: Thu, 13 Oct 2005 18:19:41 +0200

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



Relevant Pages

  • Direct Interface to Compact Flash
    ... I am writing software for an embedded Linux system that has a compact ... flash device directly wired to a general-purpose peripheral bus. ... Is there a standard way to configure a Linux IDE driver to recognize ...
    (comp.os.linux.embedded)
  • Re: IDE cdrom problem with PLEXTOR DVDR PX-608AL
    ... Actually the interrupt handler in ide-cd got rewritten and you're still using the ... IDE device, a Pioneer DVR-115D DVD-ROM, hooked up to the JMicron IDE port. ... With the IDE driver compiled into the kernel any access to the DVD is fine ...
    (Linux-Kernel)
  • RE: need to repair Win XP installation with a Win 98 CD
    ... Device Manager under Control Panel>System, and change the IDE driver to ... "Standard PCI IDE Controller" then it may boot in the new computer. ... I presume that I need to "repair" this installation with a WinXP ...
    (microsoft.public.windowsxp.setup_deployment)
  • [PATCH 2/3] ide: delete filenames from comments
    ... Please note that this platform does not support 32-bit IDE IO. ... May be copied or modified under the terms of the GNU General Public License ... It was tested with "ESS ES1868 Plug and Play AudioDrive" IDE interface. ... Catweasel and X-Surf IDE Driver ...
    (Linux-Kernel)
  • Re: Parallel ATA with libata status with the patches Im working on
    ... > makes you look very non-transparent as the IDE layer maintainer. ... Never explained FUD about current state of drivers/ide, ... FUD or "IDE driver is going away"... ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)