On Mon, Jul 16, 2007 at 11:54:54AM -0700, David Brownell wrote:
> On Monday 16 July 2007, Anton Vorontsov wrote:
> > Hello David,
> > 
> > On Sat, Jul 14, 2007 at 03:04:51PM -0700, David Brownell wrote:
> > > Here's an updated version of the MMC-over-SPI patches, reworked to
> > > address most of Pierre's issues (moving even more code into the MMC
> > > core) and to clean up the I/O paths.
> > > 
> > > ...
> > 
> > Much thanks for the patches!
> > 
> > Though, I still have some troubles with getting MMC(SD)-over-SPI to
> > work.
> > 
> > I'm using slightly patched spi_mpc83xx.c driver + these four mmc
> > patches.
> > 
> > spi_mpc83xx.c tested only in loopback mode and using oscilloscope.
> > It _seem_ to work fine, but as I didn't tested it on real hardware
> > (other than MMC/SD), I can't say if it's fault of spi_mpc83xx or
> > mmc_spi.
> 
> I can't say either, but my first thought is that it might be a
> card-specific quirk.  I already found one in that particular place,
> and the messages below look fine until the very end.

Uhh.. can you believe?

mmc_spi spi1.0: ASSUMING unshared SPI bus!
mmc_spi spi1.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
mmcblk0: mmc0:0000 SD01G 1006080KiB
 mmcblk0: p1
[EMAIL PROTECTED]:~# mount /dev/mmcblk0p1 /mnt/
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
[EMAIL PROTECTED]:~# ls /mnt/
bin  etc  include  lib  libexec  lost+found  man  sbin  share  var
[EMAIL PROTECTED]:~#

Yup, I've turned debugging off, it's plainly working.


The only change I've made is:

--- a/drivers/mmc/host/mmc_spi.c
+++ b/drivers/mmc/host/mmc_spi.c
@@ -1184,7 +1184,7 @@ static int mmc_spi_probe(struct spi_device *spi)
         * Docs are very explicit that sampling is on the rising edge, so
         * SPI_MODE_0 and SPI_MODE_3 having different CPOL may not matter.
         */
-       spi->mode |= SPI_CPOL | SPI_CPHA;
+       spi->mode = 0;
        spi->bits_per_word = 8;
 
        status = spi_setup(spi);


Am I understanding correctly that SPI_CPOL is:

  ~~~| |~~| |~~~~
     | |  | |
0    |_|  |_|
(does not work for me)

While !SPI_CPOL is:

     |~|  |~|
     | |  | |
0 ___| |__| |____
(works great for me)

Is that correct? Not vice versa?

At least that is what I'm observing on oscilloscope. Maybe it's
something still messed in mpc83xx_spi.c (I've already fixed a lot),
or maybe something else. So, if mmc_spi modes are correct, then
mpc83xx_spi having inversed values, and should be fixed.

With only SPI_CPHA that thing does not work also.


Today I've tested it on bunch of cards, MMC Transcend 64MB,
MMC SanDisk 16MB, SD Kingston 128MB and 1GB. All of them work.

Thus, despite minor issues, mmc_spi works great, much thanks!

-- 
Anton Vorontsov
email: [EMAIL PROTECTED]
backup email: [EMAIL PROTECTED]
irc://irc.freenode.net/bd2

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

Reply via email to