linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Mikael Starvik <mikael.starvik-VrBV9hrLPhE@public.gmane.org>,
	Hans-Peter Nilsson
	<hans-peter.nilsson-VrBV9hrLPhE@public.gmane.org>,
	Mike Lavender
	<mike-UTnDXsALFwNjMdQLN6DIHgC/G2K4zDHf@public.gmane.org>,
	Pierre Ossman
	<drzeus-mmc-p3sGCRWkH8CeZLLa646FqQ@public.gmane.org>
Subject: Re: [patch 4/4 2.6.23-rc2 + mm2-git-mmc]	mmc_spi host driver
Date: Thu, 30 Aug 2007 10:59:00 +0200	[thread overview]
Message-ID: <20070830085900.GA18374@pengutronix.de> (raw)
In-Reply-To: <200708290959.33584.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>

On Wed, Aug 29, 2007 at 09:59:32AM -0700, David Brownell wrote:
> On Wednesday 29 August 2007, Sascha Hauer wrote:
> > Hi,
> > 
> > On Wed, Aug 08, 2007 at 09:12:54AM -0700, David Brownell wrote:
> > > +
> > > +		dev_dbg(&spi->dev, "    mmc_spi: STOP_TRAN\n");
> > > +
> > > +		/* Tweak the per-block message we set up earlier by morphing
> > > +		 * it to hold single buffer with the token followed by some
> > > +		 * all-ones bytes ... skip N(BR) (0..1), scan the rest for
> > > +		 * "not busy any longer" status, and leave chip selected.
> > > +		 */
> > > +		INIT_LIST_HEAD(&host->m.transfers);
> > > +		list_add(&host->early_status.transfer_list,
> > > +				&host->m.transfers);
> > > +
> > > +		scratch->status[0] = SPI_TOKEN_STOP_TRAN;
> > > +		memset(scratch->status + 1, 0xff, statlen - 1);
> > > +		host->early_status.tx_buf = host->early_status.rx_buf;
> > > +		host->early_status.tx_dma = host->early_status.rx_dma;
> > > +		host->early_status.len = 1 + statlen;
> > > +
> > 
> > The length to transfer here is statlen, not statlen + 1.
> 
> Right -- ACK.  Although the code could be shrunk a smidgeon
> (and IMO made clearer) by doing the memset of the full buffer,
> then just overwriting the first byte with that token.
> 
> 
> > With the following 
> > patch applied the driver works more reliably for me, though not perfect.
> > I still get occasional errors like this from some SD cards:
> > 
> > mmcblk0: error 2 sending stop command
> 
> That would be an error on the READ path, yes?  Because the
> SPI protocols only use a STOP command on multiblock reads.
> 
> 
> > This is a crc error.
> 
> You're sure?  On my systems, error 2 == ENOENT, which is
> only reported when an MMC or SD card fails CID fetch...

No, it's MMC_ERR_BADCRC. I don't use the patches from -mm at the moment,
I noticed that they report errno instead of MMC_ERR_*.

The problem with the crc is reproducible. I watched this on the logic
analyzer, it's the response from the card to a SPI_TOKEN_STOP_TRAN
transfer. It occurs on the very last block on an SD card:

mmc0: new SD card at address 0000
mmcblk0: mmc0:0000 S016B 14560KiB
 mmcblk0: p1

 root@netx:~> cat /dev/mmcblk0p1 > /dev/null
 mmcblk0: error 2 sending stop command
 end_request: I/O error, dev mmcblk0, sector 29112
 Buffer I/O error on device mmcblk0p1, logical block 3637
 mmcblk0: error 5 sending read/write command
 end_request: I/O error, dev mmcblk0, sector 29112
 Buffer I/O error on device mmcblk0p1, logical block 3637
 mmcblk0: error 5 sending read/write command
 end_request: I/O error, dev mmcblk0, sector 29112
 Buffer I/O error on device mmcblk0p1, logical block 3637
 cat: read error: Input/output error
 root@netx:~>                                                                

14560 * 1024 - 29112 * 512 = 4096

I tested this with six SD cards. They all behave like this except one
512MB Kingston card which works. A MMC card I tested works too.
Maybe we have to use a single block transfer on the last sector?

> 
> 
> > There may be still problems in my (Hilscher netx)spi driver. 
> > The mmc over spi stuff is the first testbed for this fresh driver. 
> 
> Feeling brave, aren't you?  :)

Sure, we do quality software here ;)

Sascha

-- 
Pengutronix - Linux Solutions for Science and Industry
Entwicklungszentrum Nord     http://www.pengutronix.de

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/

  parent reply	other threads:[~2007-08-30  8:59 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 16:06 [patch 0/4 2.6.23-rc2 + mm2-git-mmc] latest MMC-over-SPI support David Brownell
     [not found] ` <200708080906.18993.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-08-08 16:09   ` [patch 1/4 2.6.23-rc2 + mm2-git-mmc] MMC headers learn about SPI David Brownell
2007-08-08 16:10   ` [patch 2/4 2.6.23-rc2 + mm2-git-mmc] MMC/SD card driver learns SPI David Brownell
2007-08-08 16:11   ` [patch 3/4 2.6.23-rc2 + mm2-git-mmc] MMC core learns about SPI David Brownell
     [not found]     ` <200708080911.33099.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-08-09 13:07       ` Pierre Ossman
     [not found]         ` <20070809150747.62b1447a-mgABNEgzgxm+PRNnhPf8W5YgPPQkE1Si@public.gmane.org>
2007-08-09 15:35           ` David Brownell
     [not found]             ` <200708090835.42279.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-08-09 20:18               ` Pierre Ossman
2007-08-12 15:50       ` David Brownell
     [not found]         ` <200708120850.04271.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-08-12 15:52           ` Pierre Ossman
2007-08-29  9:22       ` Sascha Hauer
     [not found]         ` <20070829092247.GA15021-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2007-08-29 14:52           ` Pierre Ossman
     [not found]             ` <20070829165243.0236cc89-mgABNEgzgxm+PRNnhPf8W5YgPPQkE1Si@public.gmane.org>
2007-08-29 16:43               ` David Brownell
     [not found]                 ` <200708290943.59450.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-10-08 17:09                   ` Jan Nikitenko
     [not found]                     ` <470A644A.8030405-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-10-10 18:36                       ` Pierre Ossman
     [not found]                         ` <c4bc83220710190240wd13bfd1r991ba9b1b1128f6c@mail.gmail.com>
     [not found]                           ` <c4bc83220710190240wd13bfd1r991ba9b1b1128f6c-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-10-19  9:50                             ` Jan Nikitenko
     [not found]                               ` <c4bc83220710190250m6c3401end194917e2daa9104-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2007-10-22 18:34                                 ` Pierre Ossman
     [not found]                                   ` <20071022203428.300117e4-mgABNEgzgxm+PRNnhPf8W5YgPPQkE1Si@public.gmane.org>
2007-10-23  8:06                                     ` Jan Nikitenko
     [not found]                                       ` <471DAB71.8000808-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-10-27 12:08                                         ` Pierre Ossman
     [not found]                                           ` <20071027140823.5d7ec7e2-mgABNEgzgxm+PRNnhPf8W5YgPPQkE1Si@public.gmane.org>
2007-10-27 16:33                                             ` David Brownell
     [not found]                                               ` <200710270933.30538.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-10-29  8:02                                                 ` Jan Nikitenko
2007-08-08 16:12   ` [patch 4/4 2.6.23-rc2 + mm2-git-mmc] mmc_spi host driver David Brownell
     [not found]     ` <200708080912.54918.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-08-29 10:07       ` Sascha Hauer
     [not found]         ` <20070829100708.GB15021-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2007-08-29 16:59           ` David Brownell
     [not found]             ` <200708290959.33584.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-08-29 19:39               ` Pierre Ossman
     [not found]                 ` <20070829213905.71236d24-mgABNEgzgxm+PRNnhPf8W5YgPPQkE1Si@public.gmane.org>
2007-08-29 20:00                   ` David Brownell
2007-08-30  8:59               ` Sascha Hauer [this message]
     [not found]                 ` <20070830085900.GA18374-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2007-08-30 18:56                   ` David Brownell
     [not found]                     ` <20070830185623.9C6CD231986-ZcXrCSuhvln6VZ3dlLfH/g4gEjPzgfUyLrfjE7I9kuVHxeISYlDBzl6hYfS7NtTn@public.gmane.org>
2007-08-31 17:00                       ` Sascha Hauer
     [not found]                         ` <20070831170054.GA11112-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2007-08-31 23:00                           ` David Brownell
     [not found]                             ` <20070831230050.4F31F2371AF-ZcXrCSuhvln6VZ3dlLfH/g4gEjPzgfUyLrfjE7I9kuVHxeISYlDBzl6hYfS7NtTn@public.gmane.org>
2007-09-04 10:54                               ` Sascha Hauer
     [not found]                                 ` <20070904105453.GD7579-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2007-11-15 23:30                                   ` David Brownell
     [not found]                                     ` <200711151530.06591.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-11-16  1:02                                       ` Hans-Peter Nilsson
     [not found]                                         ` <200711160102.lAG12Fdo031436-PT6ZA4s7Vg53Mq0XhIy4CVaTQe2KTcn/@public.gmane.org>
2007-11-16 20:28                                           ` David Brownell
2007-08-09 10:45   ` [patch 0/4 2.6.23-rc2 + mm2-git-mmc] latest MMC-over-SPI support Anton Vorontsov
2007-08-09 13:05   ` Pierre Ossman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070830085900.GA18374@pengutronix.de \
    --to=s.hauer-bicnvbalz9megne8c9+irq@public.gmane.org \
    --cc=david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org \
    --cc=drzeus-mmc-p3sGCRWkH8CeZLLa646FqQ@public.gmane.org \
    --cc=hans-peter.nilsson-VrBV9hrLPhE@public.gmane.org \
    --cc=mikael.starvik-VrBV9hrLPhE@public.gmane.org \
    --cc=mike-UTnDXsALFwNjMdQLN6DIHgC/G2K4zDHf@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).