}
EXPORT_SYMBOL(mmc_erase_group_aligned);
-#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
void mmc_rescan(struct work_struct *work)
{
struct mmc_host *host =
container_of(work, struct mmc_host, detect.work);
u32 ocr;
int err;
+ unsigned long flags;
int extend_wakelock = 0;
-
+ spin_lock_irqsave(&host->lock, flags);
+
+ if (host->rescan_disable) {
+ spin_unlock_irqrestore(&host->lock, flags);
+ return;
+ }
+
+ spin_unlock_irqrestore(&host->lock, flags);
+
+
mmc_bus_get(host);
/* if there is a card registered, check whether it is still present */
* release the lock here.
*/
mmc_bus_put(host);
+
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
printk("\n%s...%d.. ===== mmc_rescan Begin....======xbw[%s]=====\n",__FILE__, __LINE__, mmc_hostname(host));
+#endif
if (host->ops->get_cd && host->ops->get_cd(host) == 0)
{
- printk("\n=================\n%s..%d.. ====find no SDMMC host.====xbw[%s]=====\n", \
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ printk("\n=================\n%s..%d.. ====find no SDMMC host.====xbw[%s]=====\n", \
__FUNCTION__, __LINE__, mmc_hostname(host));
-
+#endif
goto out;
}
mmc_claim_host(host);
-
+
mmc_power_up(host);
- mmc_go_idle(host);
-
- /*
- In oder to improve the initialization process in rockchip IC, I modify the following code about the the initialization process of SDIO-SD-MMC.
- So I deleted the CMD8 and add a conditional to distinguish between the two card type,i.e.SDMMC process and SDIO process.
- For detail,please refer to "RK29XX Technical Reference Manual" and "SD-MMC-SDIO Specifications".
- Noted by xbw@2011-04-09
- */
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ //sdio_reset(host); //This does not make sense , deleted by xbw at 2011-08-08
+#else
+ sdio_reset(host);
+#endif
- //mmc_send_if_cond(host, host->ocr_avail); //deleted by xbw@2011-04-09
+ mmc_go_idle(host);
+
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ //mmc_send_if_cond(host, host->ocr_avail); //This does not make sense, deleted by xbw at 2011-08-08
- if( strncmp( mmc_hostname(host) ,"mmc0" , strlen("mmc0")) ){
+ if( strncmp( mmc_hostname(host) ,"mmc0" , strlen("mmc0")) ){
/*
* First we search for SDIO...
*/
goto out;
}
}
-
-
- /*
- * ...then normal SD...
- */
- err = mmc_send_app_op_cond(host, 0, &ocr);
- if (!err) {
- printk("\n%s..%d.. ===== Begin to identify card as SD-card ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
-
- if (mmc_attach_sd(host, ocr))
- {
- printk("\n=====\n%s..%d.. ===== Initialize SD-card unsuccessfully!!! ===xbw[%s]===\n====\n",\
- __FUNCTION__, __LINE__, mmc_hostname(host));
-
- mmc_power_off(host);
- }
- else
- {
- printk("%s..%d.. ===== Initialize SD-card successfully. ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
- }
- extend_wakelock = 1;
- goto out;
- }
-
- /*
- * ...and finally MMC.
- */
- err = mmc_send_op_cond(host, 0, &ocr);
- if (!err) {
- printk("\n%s..%d.. ===== Begin to identify card as MMC-card ===xbw[%s]===\n", __FUNCTION__, __LINE__, mmc_hostname(host));
-
- if (mmc_attach_mmc(host, ocr))
- {
- printk("\n =====\n%s..%d.. ===== Initialize MMC-card unsuccessfully!!! ===xbw[%s]===\n======\n",\
- __FUNCTION__, __LINE__, mmc_hostname(host));
-
- mmc_power_off(host);
- }
- else
- {
- printk("%s...%d.. ===== Initialize MMC-card successfully. ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host));
- }
- extend_wakelock = 1;
- goto out;
- }
-
- mmc_release_host(host);
- mmc_power_off(host);
-
-out:
-
- if (extend_wakelock)
- wake_lock_timeout(&mmc_delayed_work_wake_lock, HZ / 2);
- else
- wake_unlock(&mmc_delayed_work_wake_lock);
-
- if (host->caps & MMC_CAP_NEEDS_POLL)
- mmc_schedule_delayed_work(&host->detect, HZ);
-}
-
+
#else
-void mmc_rescan(struct work_struct *work)
-{
- struct mmc_host *host =
- container_of(work, struct mmc_host, detect.work);
- u32 ocr;
- int err;
- unsigned long flags;
- int extend_wakelock = 0;
-
- spin_lock_irqsave(&host->lock, flags);
-
- if (host->rescan_disable) {
- spin_unlock_irqrestore(&host->lock, flags);
- return;
- }
-
- spin_unlock_irqrestore(&host->lock, flags);
-
-
- mmc_bus_get(host);
-
- /* if there is a card registered, check whether it is still present */
- if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead)
- host->bus_ops->detect(host);
-
- /* If the card was removed the bus will be marked
- * as dead - extend the wakelock so userspace
- * can respond */
- if (host->bus_dead)
- extend_wakelock = 1;
-
- mmc_bus_put(host);
-
-
- mmc_bus_get(host);
-
- /* if there still is a card present, stop here */
- if (host->bus_ops != NULL) {
- mmc_bus_put(host);
- goto out;
- }
-
- /* detect a newly inserted card */
-
- /*
- * Only we can add a new handler, so it's safe to
- * release the lock here.
- */
- mmc_bus_put(host);
-
- if (host->ops->get_cd && host->ops->get_cd(host) == 0)
- goto out;
-
- mmc_claim_host(host);
-
- mmc_power_up(host);
- sdio_reset(host);
- mmc_go_idle(host);
-
mmc_send_if_cond(host, host->ocr_avail);
/*
}
goto out;
}
+#endif
/*
* ...then normal SD...
*/
err = mmc_send_app_op_cond(host, 0, &ocr);
if (!err) {
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ printk("\n%s..%d.. ===== Begin to identify card as SD-card ===xbw[%s]===\n",\
+ __FUNCTION__, __LINE__, mmc_hostname(host));
+#endif
if (mmc_attach_sd(host, ocr))
+ {
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ printk("\n=====\n%s..%d.. ===== Initialize SD-card unsuccessfully!!! ===xbw[%s]===\n====\n",\
+ __FUNCTION__, __LINE__, mmc_hostname(host));
+#endif
mmc_power_off(host);
+ }
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ else
+ {
+ printk("%s..%d.. ===== Initialize SD-card successfully. ===xbw[%s]===\n",\
+ __FUNCTION__, __LINE__, mmc_hostname(host));
+ }
+#endif
extend_wakelock = 1;
goto out;
}
*/
err = mmc_send_op_cond(host, 0, &ocr);
if (!err) {
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ printk("\n%s..%d.. ===== Begin to identify card as MMC-card ===xbw[%s]===\n",\
+ __FUNCTION__, __LINE__, mmc_hostname(host));
+#endif
if (mmc_attach_mmc(host, ocr))
+ {
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ printk("\n =====\n%s..%d.. ===== Initialize MMC-card unsuccessfully!!! ===xbw[%s]===\n======\n",\
+ __FUNCTION__, __LINE__, mmc_hostname(host));
+#endif
mmc_power_off(host);
+ }
+#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD)
+ else
+ {
+ printk("%s...%d.. ===== Initialize MMC-card successfully. ===xbw[%s]===\n",\
+ __FUNCTION__, __LINE__, mmc_hostname(host));
+ }
+#endif
extend_wakelock = 1;
goto out;
}
if (host->caps & MMC_CAP_NEEDS_POLL)
mmc_schedule_delayed_work(&host->detect, HZ);
}
-#endif
void mmc_start_host(struct mmc_host *host)
{