Message ID | CAA+hA=TKYdkaVJtNg1457oSCgrtaT3xpg32m7Hn7xJxh8OGk7g@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thursday 04 September 2014 17:37:59 Dong Aisheng wrote: > index 49f04bc..83d17a9 100644 > --- a/drivers/mmc/core/mmc_ops.c > +++ b/drivers/mmc/core/mmc_ops.c > @@ -440,6 +440,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, > u8 index, u8 value, > if (!use_busy_signal) > return 0; > > + /* > + * WORKAROUND: for Sandisk eMMC cards, it might need certain delay > + * before sending CMD13 after CMD6 > + */ > + mdelay(1); > + > /* Must check status to be sure of no errors */ > timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); > do { > > mdelay() is a rather nasty function to call because it hogs the CPU. Better use msleep(), which will allow another process to use the CPU in the meantime. It might be worthwhile to check the manufacturer ID field so we don't delay the boot process for non-sandisk devices. Arnd -- 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
2014-09-04 11:43 GMT+02:00 Arnd Bergmann <arnd@arndb.de>: > On Thursday 04 September 2014 17:37:59 Dong Aisheng wrote: >> index 49f04bc..83d17a9 100644 >> --- a/drivers/mmc/core/mmc_ops.c >> +++ b/drivers/mmc/core/mmc_ops.c >> @@ -440,6 +440,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, >> u8 index, u8 value, >> if (!use_busy_signal) >> return 0; >> >> + /* >> + * WORKAROUND: for Sandisk eMMC cards, it might need certain delay >> + * before sending CMD13 after CMD6 >> + */ >> + mdelay(1); >> + >> /* Must check status to be sure of no errors */ >> timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); >> do { >> >> > > mdelay() is a rather nasty function to call because it hogs the CPU. > Better use msleep(), which will allow another process to use the > CPU in the meantime. > It might be worthwhile to check the manufacturer ID field so we > don't delay the boot process for non-sandisk devices. OK, so I will also move MFID defines from drivers/mmc/core/block.c to include/linux/mmc/card.h which will allow the use of these defines from mmc_ops.c. I am testing right now and if it works, I will send a patch. Thanks, JM -- 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
2014-09-04 11:55 GMT+02:00 Jean-Michel Hautbois <jhautbois@gmail.com>: > 2014-09-04 11:43 GMT+02:00 Arnd Bergmann <arnd@arndb.de>: >> On Thursday 04 September 2014 17:37:59 Dong Aisheng wrote: >>> index 49f04bc..83d17a9 100644 >>> --- a/drivers/mmc/core/mmc_ops.c >>> +++ b/drivers/mmc/core/mmc_ops.c >>> @@ -440,6 +440,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, >>> u8 index, u8 value, >>> if (!use_busy_signal) >>> return 0; >>> >>> + /* >>> + * WORKAROUND: for Sandisk eMMC cards, it might need certain delay >>> + * before sending CMD13 after CMD6 >>> + */ >>> + mdelay(1); >>> + >>> /* Must check status to be sure of no errors */ >>> timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS); >>> do { >>> >>> >> >> mdelay() is a rather nasty function to call because it hogs the CPU. >> Better use msleep(), which will allow another process to use the >> CPU in the meantime. >> It might be worthwhile to check the manufacturer ID field so we >> don't delay the boot process for non-sandisk devices. > > OK, so I will also move MFID defines from drivers/mmc/core/block.c to > include/linux/mmc/card.h which will allow the use of these defines > from mmc_ops.c. > > I am testing right now and if it works, I will send a patch. > Thanks, > JM And that will not work because card->cid.manfid is not yet defined when __mmc_switch() is called. The patch works, but now I need to have it SANDISK dependent. Thanks, JM -- 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
On Thursday 04 September 2014 12:06:41 Jean-Michel Hautbois wrote: > And that will not work because card->cid.manfid is not yet defined > when __mmc_switch() is called. > The patch works, but now I need to have it SANDISK dependent. > Ok, I see. Then just use msleep() here. Arnd -- 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
2014-09-04 12:12 GMT+02:00 Arnd Bergmann <arnd@arndb.de>: > On Thursday 04 September 2014 12:06:41 Jean-Michel Hautbois wrote: >> And that will not work because card->cid.manfid is not yet defined >> when __mmc_switch() is called. >> The patch works, but now I need to have it SANDISK dependent. >> > > Ok, I see. Then just use msleep() here. > > Arnd Well, in fact, in dirvers/mmc/core/mmc.c : card->cid.manfid = UNSTUFF_BITS(resp, 120, 8); It gets 0x45 on my eMMC but SANDISK datasheet says 0x02. And in __mmc_switch, it is set, but to 0x45 which is not tested correctly against CID_MANFID_SANDISK which is set to 0x2. So maybe some sandisk have MID at 0x2 and some others have something else ? JM -- 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/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 49f04bc..83d17a9 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -440,6 +440,12 @@ int __mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 value, if (!use_busy_signal) return 0; + /* + * WORKAROUND: for Sandisk eMMC cards, it might need certain delay + * before sending CMD13 after CMD6 + */ + mdelay(1); + /* Must check status to be sure of no errors */ timeout = jiffies + msecs_to_jiffies(MMC_OPS_TIMEOUT_MS);