public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <cbouatmailru@gmail.com>
To: Huang Changming-R66093 <r66093@freescale.com>
Cc: Chris Ball <cjb@laptop.org>,
	"linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>
Subject: Re: [PATCH 4/5 v4] ESDHC: Workaround for data crc error on p1010rdb
Date: Fri, 13 Jan 2012 16:12:31 +0400	[thread overview]
Message-ID: <20120113121231.GE8837@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <8A2FC72B45BB5A4C9F801431E06AE48F11669381@039-SN1MPN1-005.039d.mgd.msft.net>

On Fri, Jan 13, 2012 at 02:37:07AM +0000, Huang Changming-R66093 wrote:
> Hi, Anton,
> Could you have any comment about this serial patch?
> 
> Thanks
> Jerry Huang
> 
[...]
> > @@ -56,6 +56,13 @@ static inline void esdhc_set_clock(struct sdhci_host
> > *host, unsigned int clock)
> >  	if (clock == 0)
> >  		goto out;
> > 
> > +	if (host->quirks2 & SDHCI_QUIRK2_RELAX_FREQ) {
> > +		if (clock > 20000000)
> > +			clock -= 5000000;
> > +		if (clock > 40000000)
> > +			clock -= 5000000;
> > +	}
> > +

That's weird. According to the code, you are underclocking a device
(i.e. the card actually expects higher clocks).

Did you check (with an oscilloscope) what clocks HW actually generates?
Maybe it just generates higher than expected clocks, then this code
would be a correct workaround.

Otherwise, if HW generates correct/precise clock, then you probably
would rather not permit high clocks at all... but then you limit max
freq to 20 MHz. :-(

Oh well, if the patch works for your HW, I'm fine with it.

Acked-by: Anton Vorontsov <cbouatmailru@gmail.com>

> >  	while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
> >  		pre_div *= 2;
> > 
> > diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-
> > pltfm.c
> > index e64f773..841ffc1 100644
> > --- a/drivers/mmc/host/sdhci-pltfm.c
> > +++ b/drivers/mmc/host/sdhci-pltfm.c
> > @@ -79,6 +79,9 @@ void sdhci_get_of_property(struct platform_device *pdev)
> >  			|| of_device_is_compatible(np, "fsl,mpc8536-esdhc"))
> >  			host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL;
> > 
> > +		if (of_device_is_compatible(np, "fsl,p1010-esdhc"))
> > +			host->quirks2 |= SDHCI_QUIRK2_RELAX_FREQ;
> > +
> >  		clk = of_get_property(np, "clock-frequency", &size);
> >  		if (clk && size == sizeof(*clk) && *clk)
> >  			pltfm_host->clock = be32_to_cpup(clk);
> > diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
> > index e4b6935..f7c1e13 100644
> > --- a/include/linux/mmc/sdhci.h
> > +++ b/include/linux/mmc/sdhci.h
> > @@ -91,6 +91,8 @@ struct sdhci_host {
> >  	unsigned int quirks2;	/* More deviations from spec. */
> > 
> >  #define SDHCI_QUIRK2_OWN_CARD_DETECTION			(1<<0)
> > +/* Controller operates the cards at reduced frequency */
> > +#define SDHCI_QUIRK2_RELAX_FREQ				(1<<1)
> > 
> >  	int irq;		/* Device IRQ */
> >  	void __iomem *ioaddr;	/* Mapped address */
> > --
> > 1.7.5.4
> 
> 

-- 
Anton Vorontsov
Email: cbouatmailru@gmail.com

  reply	other threads:[~2012-01-13 12:12 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  5:33 [PATCH 0/1] new version workaround for FSL's eSDHC controller r66093
2012-01-06  5:33 ` [PATCH 1/5 v2] ESDHC: add PIO mode support r66093
2012-01-06  5:33   ` [PATCH 2/5 v2] ESDHC: set the timeout to the max value r66093
2012-01-06  5:33     ` [PATCH 3/5 v4] ESDHC: Power management for ESDHC r66093
2012-01-06  5:33       ` [PATCH 4/5 v4] ESDHC: Workaround for data crc error on p1010rdb r66093
2012-01-06  5:33         ` [PATCH 5/5 v4] ESDHC: Fix DMA errors in kernel booting on P1010 r66093
2012-01-06 15:00           ` Chris Ball
2012-01-09  2:59             ` Huang Changming-R66093
2012-01-13  2:37         ` [PATCH 4/5 v4] ESDHC: Workaround for data crc error on p1010rdb Huang Changming-R66093
2012-01-13 12:12           ` Anton Vorontsov [this message]
2012-01-16  4:43             ` Huang Changming-R66093
2012-01-13  2:36       ` [PATCH 3/5 v4] ESDHC: Power management for ESDHC Huang Changming-R66093
2012-01-13 11:50         ` Anton Vorontsov
2012-01-13  2:36     ` [PATCH 2/5 v2] ESDHC: set the timeout to the max value Huang Changming-R66093
2012-01-13 11:54       ` Anton Vorontsov
2012-01-16  3:35         ` Huang Changming-R66093
2012-01-13  2:35   ` [PATCH 1/5 v2] ESDHC: add PIO mode support Huang Changming-R66093
2012-01-13 11:56     ` Anton Vorontsov

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=20120113121231.GE8837@oksana.dev.rtsoft.ru \
    --to=cbouatmailru@gmail.com \
    --cc=cjb@laptop.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=r66093@freescale.com \
    /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