Linux 2.6 removable media block device driver question



I'm trying to write a block driver for accessing an SD card through a memory-mapped SPI module implemented in a Xilinx FPGA. I'm working with MontaVista's PPC 2.6.10 kernel. I have finished the lower-level card access routines, and can successfully read and write blocks, and even fdisk and mount the card. Through a hardware register, I can tell if a card is inserted, so that is not the problem.

Currently, things only work if I have the sd card inserted when I load the driver module. My next step is to figure out how to handle card insertion and removal after the driver has been loaded, and how to notify the kernel that there is now a disk present.

If there is not a card present at module init, how much can you tell the kernel about your device? Should I allocate a gendisk if I don't know the capacity? Should I set up a timer to periodically check for the presence of a card, and if so, how do I notify the kernel that a new disk has been discovered.

I have a copy of Corbet, Rubini, and Kroah-Hartman's book 'Linux Device Drivers', which has been a big help. Their sample block driver, unfortunately, does not appear to show how to handle a disk that may change during execution, and may not even be present some times.

Is there a guide to the proper way to handle a changing block device?

Thanks in advance for any help,
Matthew
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: fglrx question
    ... party ati 9200SE 128mb card. ... As I recall, support for older ATI ... cards was dropped in a fairly recent driver update. ... kernel module for you on the fly as part of the boot process - for this ...
    (Fedora)
  • Re: o2Micro PCMCIA Controller Not Working in Linux - Gentoo 2004.1 - Kernel 2.6.5 - Likely a driver
    ... tweaking to get things working just so and keeping my kernel ... > card and chipset), I got my Broadcom wireless card working with a ... > compile with PCMCIA bus support and yenta-cardbus compatibility since ... > controller) or which driver to use to operate that slot. ...
    (comp.os.linux.setup)
  • Re: o2Micro PCMCIA Controller Not Working in Linux - Gentoo 2004.1 - Kernel 2.6.5 - Likely a driver
    ... tweaking to get things working just so and keeping my kernel ... > card and chipset), I got my Broadcom wireless card working with a ... > compile with PCMCIA bus support and yenta-cardbus compatibility since ... > controller) or which driver to use to operate that slot. ...
    (comp.os.linux.portable)
  • RE: [UPDATED PATCH] EFI support for ia32 kernels
    ... >> reuse a single driver image for multiple architectures assuming there ... As one of the people responsible for the EFI Specification and our ... Perhaps the UNDI network card interface that Intel developed ... BIOS can't shadow that much ROM code. ...
    (Linux-Kernel)
  • Re: [SLE] Suse 9.1 3Com 3c59x cant get to the network
    ... > This is an indication that the problem is with the 2.6 kernel module. ... > The kernel guys changed the driver interface in 2.6, ... I deleted the settings for the card as suggested. ... I rebooted into windows on the same machine (you recall I'm ...
    (SuSE)