[Solved] SD Card over SPI, not working for MPC8313

R.Patil at mei-india.com R.Patil at mei-india.com
Fri Jan 25 15:41:13 EST 2013

Hello All,

The problem has been resolved.

After some debugging, we observed that problem was in initialisation of 'fsl_spi' driver. The 'fsl_spi' driver extracts platform data from device tree. This platform data contains gpio number for chip-select control (cs_control). Since, MPC8313E platform doesn't support 'gpiolib', 'fsl_spi' was unable to extract gpio number for chip-select control. This was forcing it to work without chip-select line. So we did (dirty) work around to initialise 'cs_control' field explicitly (in function 'of_fsl_spi_get_chipselects' defined in spi_fsl_spi.c) with our customised handler which toggles gpio controlling chip-select. This did the job and SD card is working fine now.

Still we have some questions just for understanding purpose. We alternately tried to initialise spi platform data by old method i.e specifying it in 'mpc831x_rdb.c' as it is done in 'mpc832x_rdb.c' but that didn't work. So our first question is, does it work for MPC8323ERDB? And one more question is, does 'MPC8313ERDB' platform support 'gpiolib' driver available in mainline kernel?
The answers might help us to clean our code and also to improve our understanding.

Thanks and Regards,
Rahul Patil
-----R Patil/SW HW Dev/Pune EL2/R N D/Messung wrote: -----

To: linuxppc-dev at lists.ozlabs.org
From: R Patil/SW HW Dev/Pune EL2/R N D/Messung
Date: 01/16/2013 07:00PM
Subject: SD Card over SPI, not working for MPC8313 


We are working on board based on Freescale MPC8313ERDB. We have ported linux 3.0.46 kernel on it. We have to use SD card over SPI. We are trying to use 'mmc_spi' driver for the same. We are able to detect SD card insertion by the interrupt (gpio interrupt is used to detect card insertion). But we are not able to initialise the card. Is the 'mmc_spi' support for MPC8313ERDB broken? 

If no, what could be the reason we are getting timeout error by function 'mmc_spi_response_get()'?  

If anybody could just give a hint to solve or debug the problem.  

Thanks and Regards,
Rahul Patil

Email Disclaimer:

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and  privileged information. Computer viruses can be transmitted via email.The recipient should check this email and any  attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

More information about the Linuxppc-dev mailing list