Message ID | 1348107563-16545-1-git-send-email-Haijun.Zhang@freescale.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Sep 20, 2012 at 10:19:23AM +0800, Haijun.Zhang@freescale.com wrote: > From: Haijun Zhang <Haijun.Zhang@freescale.com> > > Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com> > Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com> > CC: Anton Vorontsov <cbouatmailru@gmail.com> > --- This one looks perfect, thanks! Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> > changes for v4: > - Correct inconsistent issue > > changes for v3: > - Correct the if statement in function workground > > changes for v2: > - Invert the condition of the if statement in function workground -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
SEksIENocmlzLA0KVGhpcyBwYXRjaCBoYXMgYmVlbiBBQ0tFRCBieSBBbnRvbiBvbmUgbW9udGgg YWdvLg0KQ291bGQgeW91IGhhdmUgYW55IGNvbW1lbnQgYWJvdXQgaXQ/DQoNCkJlc3QgUmVnYXJk cw0KSmVycnkgSHVhbmcNCg0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206 IEFudG9uIFZvcm9udHNvdiBbbWFpbHRvOmNib3VhdG1haWxydUBnbWFpbC5jb21dDQo+IFNlbnQ6 IFRodXJzZGF5LCBTZXB0ZW1iZXIgMjAsIDIwMTIgMTA6NTcgQU0NCj4gVG86IFpoYW5nIEhhaWp1 bi1CNDI2NzcNCj4gQ2M6IGxpbnV4LW1tY0B2Z2VyLmtlcm5lbC5vcmc7IEh1YW5nIENoYW5nbWlu Zy1SNjYwOTMNCj4gU3ViamVjdDogUmU6IFtQQVRDSCBWNF0gUG93ZXJwYyBlU0RIQyBSZWNvdmVy IGZyb20gdGhlIEFETUEgZXJyb3INCj4gDQo+IE9uIFRodSwgU2VwIDIwLCAyMDEyIGF0IDEwOjE5 OjIzQU0gKzA4MDAsIEhhaWp1bi5aaGFuZ0BmcmVlc2NhbGUuY29tDQo+IHdyb3RlOg0KPiA+IEZy b206IEhhaWp1biBaaGFuZyA8SGFpanVuLlpoYW5nQGZyZWVzY2FsZS5jb20+DQo+ID4NCj4gPiBT aWduZWQtb2ZmLWJ5OiBIYWlqdW4gWmhhbmcgPEhhaWp1bi5aaGFuZ0BmcmVlc2NhbGUuY29tPg0K PiA+IFNpZ25lZC1vZmYtYnk6IEplcnJ5IEh1YW5nIDxDaGFuZy1NaW5nLkh1YW5nQGZyZWVzY2Fs ZS5jb20+DQo+ID4gQ0M6IEFudG9uIFZvcm9udHNvdiA8Y2JvdWF0bWFpbHJ1QGdtYWlsLmNvbT4N Cj4gPiAtLS0NCj4gDQo+IFRoaXMgb25lIGxvb2tzIHBlcmZlY3QsIHRoYW5rcyENCj4gDQo+IEFj a2VkLWJ5OiBBbnRvbiBWb3JvbnRzb3YgPGNib3VhdG1haWxydUBnbWFpbC5jb20+DQo+IA0KPiA+ IGNoYW5nZXMgZm9yIHY0Og0KPiA+IAktIENvcnJlY3QgaW5jb25zaXN0ZW50IGlzc3VlDQo+ID4N Cj4gPiBjaGFuZ2VzIGZvciB2MzoNCj4gPiAgICAgICAgIC0gQ29ycmVjdCB0aGUgaWYgc3RhdGVt ZW50IGluIGZ1bmN0aW9uIHdvcmtncm91bmQNCj4gPg0KPiA+IGNoYW5nZXMgZm9yIHYyOg0KPiA+ ICAgICAgICAgLSBJbnZlcnQgdGhlIGNvbmRpdGlvbiBvZiB0aGUgaWYgc3RhdGVtZW50IGluIGZ1 bmN0aW9uDQo+IHdvcmtncm91bmQNCg0K -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, Chris Have you any comment about this patch? Anton has ACKed on Sep 20, and no any other feedback. Best Regards Jerry Huang > -----Original Message----- > From: Anton Vorontsov [mailto:cbouatmailru@gmail.com] > Sent: Thursday, September 20, 2012 10:57 AM > To: Zhang Haijun-B42677 > Cc: linux-mmc@vger.kernel.org; Huang Changming-R66093 > Subject: Re: [PATCH V4] Powerpc eSDHC Recover from the ADMA error > > On Thu, Sep 20, 2012 at 10:19:23AM +0800, Haijun.Zhang@freescale.com > wrote: > > From: Haijun Zhang <Haijun.Zhang@freescale.com> > > > > Signed-off-by: Haijun Zhang <Haijun.Zhang@freescale.com> > > Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale.com> > > CC: Anton Vorontsov <cbouatmailru@gmail.com> > > --- > > This one looks perfect, thanks! > > Acked-by: Anton Vorontsov <cbouatmailru@gmail.com> > > > changes for v4: > > - Correct inconsistent issue > > > > changes for v3: > > - Correct the if statement in function workground > > > > changes for v2: > > - Invert the condition of the if statement in function > workground
SGksIENocmlzLA0KVGhpcyBwYXRjaCBoYXMgYmVlbiBBQ0tlZCBieSBBbnRvbiAgb24gU2VwIDIw Lg0KSGF2ZSB5b3UgYW55IGNvbW1lbnQgYWJvdXQgaXQ/DQoNCkJlc3QgUmVnYXJkcw0KSmVycnkg SHVhbmcNCg0KDQo+IC0tLS0tT3JpZ2luYWwgTWVzc2FnZS0tLS0tDQo+IEZyb206IEFudG9uIFZv cm9udHNvdiBbbWFpbHRvOmNib3VhdG1haWxydUBnbWFpbC5jb21dDQo+IFNlbnQ6IFRodXJzZGF5 LCBTZXB0ZW1iZXIgMjAsIDIwMTIgMTA6NTcgQU0NCj4gVG86IFpoYW5nIEhhaWp1bi1CNDI2NzcN Cj4gQ2M6IGxpbnV4LW1tY0B2Z2VyLmtlcm5lbC5vcmc7IEh1YW5nIENoYW5nbWluZy1SNjYwOTMN Cj4gU3ViamVjdDogUmU6IFtQQVRDSCBWNF0gUG93ZXJwYyBlU0RIQyBSZWNvdmVyIGZyb20gdGhl IEFETUEgZXJyb3INCj4gDQo+IE9uIFRodSwgU2VwIDIwLCAyMDEyIGF0IDEwOjE5OjIzQU0gKzA4 MDAsIEhhaWp1bi5aaGFuZ0BmcmVlc2NhbGUuY29tDQo+IHdyb3RlOg0KPiA+IEZyb206IEhhaWp1 biBaaGFuZyA8SGFpanVuLlpoYW5nQGZyZWVzY2FsZS5jb20+DQo+ID4NCj4gPiBTaWduZWQtb2Zm LWJ5OiBIYWlqdW4gWmhhbmcgPEhhaWp1bi5aaGFuZ0BmcmVlc2NhbGUuY29tPg0KPiA+IFNpZ25l ZC1vZmYtYnk6IEplcnJ5IEh1YW5nIDxDaGFuZy1NaW5nLkh1YW5nQGZyZWVzY2FsZS5jb20+DQo+ ID4gQ0M6IEFudG9uIFZvcm9udHNvdiA8Y2JvdWF0bWFpbHJ1QGdtYWlsLmNvbT4NCj4gPiAtLS0N Cj4gDQo+IFRoaXMgb25lIGxvb2tzIHBlcmZlY3QsIHRoYW5rcyENCj4gDQo+IEFja2VkLWJ5OiBB bnRvbiBWb3JvbnRzb3YgPGNib3VhdG1haWxydUBnbWFpbC5jb20+DQo+IA0KPiA+IGNoYW5nZXMg Zm9yIHY0Og0KPiA+IAktIENvcnJlY3QgaW5jb25zaXN0ZW50IGlzc3VlDQo+ID4NCj4gPiBjaGFu Z2VzIGZvciB2MzoNCj4gPiAgICAgICAgIC0gQ29ycmVjdCB0aGUgaWYgc3RhdGVtZW50IGluIGZ1 bmN0aW9uIHdvcmtncm91bmQNCj4gPg0KPiA+IGNoYW5nZXMgZm9yIHYyOg0KPiA+ICAgICAgICAg LSBJbnZlcnQgdGhlIGNvbmRpdGlvbiBvZiB0aGUgaWYgc3RhdGVtZW50IGluIGZ1bmN0aW9uDQo+ IHdvcmtncm91bmQNCg0K -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi, On Tue, Nov 13 2012, Huang Changming-R66093 wrote: > Hi, Chris, > This patch has been ACKed by Anton on Sep 20. > Have you any comment about it? Something weird has happened with this patch -- the latest version has no commit message even though an earlier version did, and there seem to be two separate runs of v2-v3-v4 with the same subject but with different changes in each. Could you merge the changelog into a single list of changes, rebase against mmc-next, add the full commit message and Anton's ACK, and resend? Then I'll merge it. Thanks, - Chris.
Hi chris, Sorry to miss this mail. Patch V4 for this patch had resend. Pls review. Thanks. Regards Haijun. > -----Original Message----- > From: linux-mmc-owner@vger.kernel.org [mailto:linux-mmc- > owner@vger.kernel.org] On Behalf Of Chris Ball > Sent: Sunday, November 18, 2012 4:56 AM > To: Huang Changming-R66093 > Cc: linux-mmc@vger.kernel.org; Anton Vorontsov; Zhang Haijun-B42677 > Subject: Re: [PATCH V4] Powerpc eSDHC Recover from the ADMA error > > Hi, > > On Tue, Nov 13 2012, Huang Changming-R66093 wrote: > > Hi, Chris, > > This patch has been ACKed by Anton on Sep 20. > > Have you any comment about it? > > Something weird has happened with this patch -- the latest version has no > commit message even though an earlier version did, and there seem to be > two separate runs of v2-v3-v4 with the same subject but with different > changes in each. > > Could you merge the changelog into a single list of changes, rebase > against mmc-next, add the full commit message and Anton's ACK, and resend? > Then I'll merge it. > > Thanks, > > - Chris. > -- > Chris Ball <cjb@laptop.org> <http://printf.net/> > One Laptop Per Child > -- > To unsubscribe from this list: send the line "unsubscribe linux-mmc" in > the body of a message to majordomo@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index 1cba55a..9c6bf78 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -21,6 +21,7 @@ #include "sdhci-esdhc.h" #define VENDOR_V_22 0x12 +#define VENDOR_V_23 0x13 static u32 esdhc_readl(struct sdhci_host *host, int reg) { u32 ret; @@ -83,6 +84,18 @@ static u8 esdhc_readb(struct sdhci_host *host, int reg) return ret; } +static void esdhc_writel(struct sdhci_host *host, u32 val, int reg) +{ + /* + * Enable IRQSTATEN[BGESEN] is just to set IRQSTAT[BGE] + * when SYSCTL[RSTD]) is set for some special operations. + * No any impact other operation. + */ + if (reg == SDHCI_INT_ENABLE) + val |= SDHCI_INT_BLK_GAP; + sdhci_be32bs_writel(host, val, reg); +} + static void esdhc_writew(struct sdhci_host *host, u16 val, int reg) { if (reg == SDHCI_BLOCK_SIZE) { @@ -138,6 +151,42 @@ static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host) return of_host->clock / 256 / 16; } +/* + * For Abort or Suspend after Stop at Block Gap, ignore the ADMA + * error(IRQSTAT[ADMAE]) if both Transfer Complete(IRQSTAT[TC]) + * and Block Gap Event(IRQSTAT[BGE]) are also set. + * For Continue, apply soft reset for data(SYSCTL[RSTD]); + * and re-issue the entire read + * transaction from beginning. + */ +static void esdhci_of_adma_workaround(struct sdhci_host *host, u32 intmask) +{ + u32 tmp; + bool applicable; + dma_addr_t dmastart; + dma_addr_t dmanow; + + tmp = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS); + tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; + + applicable = (intmask & SDHCI_INT_DATA_END) && + (intmask & SDHCI_INT_BLK_GAP) && + (tmp == VENDOR_V_23); + if (!applicable) + return; + + host->data->error = 0; + dmastart = sg_dma_address(host->data->sg); + dmanow = dmastart + host->data->bytes_xfered; + /* + * Force update to the next DMA block boundary. + */ + dmanow = (dmanow & ~(SDHCI_DEFAULT_BOUNDARY_SIZE - 1)) + + SDHCI_DEFAULT_BOUNDARY_SIZE; + host->data->bytes_xfered = dmanow - dmastart; + sdhci_writel(host, dmanow, SDHCI_DMA_ADDRESS); +} + #ifdef CONFIG_PM static u32 esdhc_proctl; static void esdhc_of_suspend(struct sdhci_host *host) @@ -164,7 +213,7 @@ struct sdhci_of_data sdhci_esdhc = { .read_l = esdhc_readl, .read_w = esdhc_readw, .read_b = esdhc_readb, - .write_l = sdhci_be32bs_writel, + .write_l = esdhc_writel, .write_w = esdhc_writew, .write_b = esdhc_writeb, .set_clock = esdhc_set_clock, @@ -175,5 +224,6 @@ struct sdhci_of_data sdhci_esdhc = { .platform_suspend = esdhc_of_suspend, .platform_resume = esdhc_of_resume, #endif + .adma_workaround = esdhci_of_adma_workaround, }, }; diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 684f1a4..3d9365a 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2143,6 +2143,8 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) printk(KERN_ERR "%s: ADMA error\n", mmc_hostname(host->mmc)); sdhci_show_adma_error(host); host->data->error = -EIO; + if (host->ops->adma_workaround) + host->ops->adma_workaround(host, intmask); } if (host->data->error) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 209f707..138d8fc 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -120,6 +120,7 @@ #define SDHCI_SIGNAL_ENABLE 0x38 #define SDHCI_INT_RESPONSE 0x00000001 #define SDHCI_INT_DATA_END 0x00000002 +#define SDHCI_INT_BLK_GAP 0x00000004 #define SDHCI_INT_DMA_END 0x00000008 #define SDHCI_INT_SPACE_AVAIL 0x00000010 #define SDHCI_INT_DATA_AVAIL 0x00000020 @@ -146,7 +147,8 @@ #define SDHCI_INT_DATA_MASK (SDHCI_INT_DATA_END | SDHCI_INT_DMA_END | \ SDHCI_INT_DATA_AVAIL | SDHCI_INT_SPACE_AVAIL | \ SDHCI_INT_DATA_TIMEOUT | SDHCI_INT_DATA_CRC | \ - SDHCI_INT_DATA_END_BIT | SDHCI_INT_ADMA_ERROR) + SDHCI_INT_DATA_END_BIT | SDHCI_INT_ADMA_ERROR | \ + SDHCI_INT_BLK_GAP) #define SDHCI_INT_ALL_MASK ((unsigned int)-1) #define SDHCI_ACMD12_ERR 0x3C @@ -275,6 +277,7 @@ struct sdhci_ops { int (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs); void (*platform_suspend)(struct sdhci_host *host); void (*platform_resume)(struct sdhci_host *host); + void (*adma_workaround)(struct sdhci_host *host, u32 intmask); };