Linux 2.6 removable media block device driver question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux