1

I have to write a driver for a custom chip, to interface it with an SD card using SD protocol, which will have filesystems on it. Now the obvious answer is that, since its an SD card(a block device), I will have to go with Block device driver development.

One of the answers from a previous question suggest that "

Platform devices are inherently not discoverable, i.e. the hardware cannot say "Hey! I'm present!" to the software.

By reading from the SD card internal registers, I can make the SD card identify itself, so does that mean SD card cannot be treated as a Platform device?

However, since we are having our own bus for connecting this SD card host controller to the CPU, would I have to write a platform driver instead of a block one?

I am new to Linux device drivers, help me out here so I can get this thing done right!

  • Do you mean **SDIO** or SD? SD is for memory cards only. And I'm really lost where is what. Can you show a chart? – 0andriy Sep 14 '20 at 09:06
  • using SD protocol. For example : [link] (https://elixir.bootlin.com/linux/v3.16.1/source/drivers/mmc/host/sdhci-bcm2835.c) is the platform device driver for an SD card that will work with the broadcomm chip. I did a little investigation and found that most of the devs are using platform drivers which are in turn talking to the main block driver [link] (https://elixir.bootlin.com/linux/v3.16.1/source/drivers/mmc/card/block.c) – emb_linux17 Sep 14 '20 at 10:02
  • 1
    Your question does not make sense. There is no need to write your own device *"driver for (the) SD card"*. Unless you are planing to reinvent the wheel, you would need to conform to the existing framework for SD/MMC, and just write a driver for your SD card controller under **drivers/mmc/host/**. You seem to conflate SD cards and their controllers, as well as their respective drivers. – sawdust Sep 14 '20 at 22:35
  • @sawdust : thanks, that cleared my doubt in a way. I need to write a driver for the SD card host controller, not the SD card itself! – emb_linux17 Sep 16 '20 at 05:39

0 Answers0