Skip to contentSkip to conversation

Block request processing for MMC/SD over SPI bus

DISCUSSION Hans Eklund 2 participants 3 messages Aug 1, 2006 – Aug 8, 2006

lore
Share & tools
lore
#0 lore raw

(CC to [email protected])

After trying other forums and irc for help on this matter i hope someone on the LKML can help.

-Background(skip if short of time).
First linux driver for me and first post on LKML, but in short, i have been developing a MMC/SD card driver in SPI mode for uClinux on the Analog Devices Blackfin based platform. However, since the 2.6.15 version im moving over to the common SPI framework and all code will probably be platform independent soon. The driver is working quite well but need some tuning in the request processing.

The driver is also independent of any previous MMC related work at this point since MMC over SPI mode differs somewhat from the MMC mode.

I have implemeted the request processing from scratch. I have followed the Linux Device Drivers and the Understanding Linux Kernel as far as possible, but they are not very extensive on error handling. I have also had a look at the ATA and SCSI drivers.

-Questions
A snip of my current request processing can be found here: with comments and some questions.

http://hasse.yohoo.nu/strat.txt

The big issue is error handling and how i report back to the user space processes that the device is dead(if hardware fails for example), basically how to gracefully handle critical issues. At this point, if retries on broken sectors fails im not sure how to report back to the I/O scheduler and block layer so the device can be halted. Now, the kernel actually hangs(or retries same sector forever). Im really at a dead end here. Could really use some help at this point.

Also, Is there any work done similar to mine?
Would there be interest in incorporating the driver in future kernels?

Answers/CC to [email protected] since i did not dare to plunge into the lkml traffic just yet.

Best regards
Hans Eklund
Rubico AB
Sweden.

#1 lore raw
Quoted 2 lines · Hans Eklund

The driver is also independent of any previous MMC related work at this point since MMC over SPI mode differs somewhat from the MMC mode.

You may be interested to know that David Brownell (I believe) has a driver which connects the SPI framework to the MMC subsystem, allowing the MMC subsystem to talk to cards in SPI mode.

Maybe David can help, or point you in the direction of someone who can in the case that I'm misremembering.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#2 lore raw
Quoted 10 lines · Russell King
Quoted 2 lines · Hans Eklund

The driver is also independent of any previous MMC related work at this point since MMC over SPI mode differs somewhat from the MMC mode.

You may be interested to know that David Brownell (I believe) has a driver which connects the SPI framework to the MMC subsystem, allowing the MMC subsystem to talk to cards in SPI mode.

Maybe David can help, or point you in the direction of someone who can in the case that I'm misremembering.

Hi again Russel.

I have been talking to David Brownell and some other developers connected to ADI(Analgo devices) about the SPI to MMC subsystem driver. That idea will probably be implemented in a later phase. For now, i will complete my MMC/SD driver that connects to the common SPI framwork and will remain independent of the MMC subsystem so it can be used on uClinux platforms(ADI Blackfin based to a start) sooner.

For that reason am i talking to you. By a mere coincidence i saw that you are the author of /drivers/mmc/mmc_queue.c driver and hence i guess you have some knowledge regarding request processing that may be useful to the project.

I would say my driver need some attention to that particular part. And i would appreciate any help. As of now, it is a very naive way of walking the request queue(a la LDD handbook) and it need to support some basic error handling.

I have posted a copy of the make_request implementation here(~150 lines):

http://hasse.yohoo.nu/strat.txt

It is quite extesively commented, and some important questions at the end. Hope you can have look at it and maybe give me a guideline.

If you dont have the time, i understand, maybe you know someone who has?

best regards

Hans Eklund,
Rubico AB, www.rubico.se
Sweden.