Skip to contentSkip to conversation

passing function pointers through platform devices?

DISCUSSION David Brownell 2 participants 2 messages Mar 7, 2007 – Mar 9, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

I'm developing an SPI- bus >MMC/SD block driver translation layer.

Another one? There's already been significant work in that area. See for example

http://marc.theaimsgroup.com/?l=linux-kernel&m=117000652529003&w=2

Which admittedly didn't behave when I just put it onto my test rig, but seems nonetheless to be a significant step forward. It's not like everyone has hardware that can use such a driver after all!

Quoted 2 lines

As part of this layer the write protect and card detect lines need to be read. The method for determining the state of these lines will be board specific.

Example, one usually wants card detect to be an IRQ, to avoid polling...

Quoted 3 lines

Is it appropriate to pass a function pointer through a platform device (declared in the mach initialization) to implement card_available and write_protect function calls?

That's how it's done in that patch. The model being what the PXA MMC/SD card driver does, since that's the most generic model I found ... handling for example systems which need to poll for card detect, as well as ones that can use real gpio based IRQs. The mmc_spi driver doesn't need to know which kind of platform it's got.

- Dave

#1 lore raw
Quoted 6 lines · David Brownell
Quoted 1 line

I'm developing an SPI- bus >MMC/SD block driver translation layer.

Another one? There's already been significant work in that area. See for example

http://marc.theaimsgroup.com/?l=linux-kernel&m=117000652529003&w=2

Nice, I'll build on that, my previous work ignored the SPI/MMC layers (because they didn't exist at the time) and just build a stacked driver on a character SPI driver. This gives me some direction as to how to proceed.

Quoted 3 lines

Which admittedly didn't behave when I just put it onto my test rig, but seems nonetheless to be a significant step forward. It's not like everyone has hardware that can use such a driver after all!

True, but it's fairly common right now, until every microcontroller gets a hardware SD controller (which seems to be the trend)

Quoted 5 lines

That's how it's done in that patch. The model being what the PXA MMC/SD card driver does, since that's the most generic model I found ... handling for example systems which need to poll for card detect, as well as ones that can use real gpio based IRQs. The mmc_spi driver doesn't need to know which kind of platform it's got.

Sounds good, thanks

NZG