From 77d6545a14db425b338c866cf4688f277fc17f89 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Sat, 30 Jul 2011 16:07:27 +0800 Subject: [PATCH] temp revert mmc change --- drivers/mmc/card/block.c | 73 ++---------- drivers/mmc/core/bus.c | 3 - drivers/mmc/core/core.c | 245 +-------------------------------------- drivers/mmc/core/host.c | 19 +-- drivers/mmc/core/mmc.c | 38 +----- drivers/mmc/core/sd.c | 68 ----------- drivers/mmc/core/sdio.c | 23 ---- 7 files changed, 15 insertions(+), 454 deletions(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 23a0e3f20d7e..8d2bd242ac63 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -43,10 +43,6 @@ MODULE_ALIAS("mmc:block"); -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) -static DEFINE_MUTEX(block_mutex); //added by xbw at 2011-04-21 -#endif - /* * max 8 partitions per card */ @@ -109,10 +105,6 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode) { struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); int ret = -ENXIO; - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - mutex_lock(&block_mutex); //added by xbw at 2011-04-21 -#endif if (md) { if (md->usage == 2) @@ -124,9 +116,6 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode) ret = -EROFS; } } -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - mutex_unlock(&block_mutex); -#endif return ret; } @@ -134,17 +123,8 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode) static int mmc_blk_release(struct gendisk *disk, fmode_t mode) { struct mmc_blk_data *md = disk->private_data; - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - mutex_lock(&block_mutex); //added by xbw at 2011-04-21 -#endif mmc_blk_put(md); - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - mutex_unlock(&block_mutex); -#endif - return 0; } @@ -244,13 +224,6 @@ static u32 mmc_sd_num_wr_blocks(struct mmc_card *card) return result; } -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) //Deleted by xbw@2011-03-21 -//static u32 get_card_status(struct mmc_card *card, struct request *req) -//{ -// return 0; -//} - -#else static u32 get_card_status(struct mmc_card *card, struct request *req) { struct mmc_command cmd; @@ -263,11 +236,10 @@ static u32 get_card_status(struct mmc_card *card, struct request *req) cmd.flags = MMC_RSP_SPI_R2 | MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 0); if (err) - printk(KERN_DEBUG "%s: error %d sending status comand", + printk(KERN_ERR "%s: error %d sending status comand", req->rq_disk->disk_name, err); return cmd.resp[0]; } -#endif static int mmc_blk_set_blksize(struct mmc_blk_data *md, struct mmc_card *card) @@ -313,22 +285,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) mmc_claim_host(card->host); do { - #if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - //struct mmc_command cmd;//Deleted by xbw@2011-03-21 - #else - struct mmc_command cmd; - #endif - + struct mmc_command cmd; u32 readcmd, writecmd, status = 0; memset(&brq, 0, sizeof(struct mmc_blk_request)); brq.mrq.cmd = &brq.cmd; brq.mrq.data = &brq.data; - - #if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - brq.cmd.retries = 2; //suppot retry read-write; added by xbw@2011-03-21 - #endif - + brq.cmd.arg = blk_rq_pos(req); if (!mmc_card_blockaddr(card)) brq.cmd.arg <<= 9; @@ -408,11 +371,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) mmc_queue_bounce_post(mq); - #if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - //not turn CMD18 to CMD17. deleted by xbw at 2011-04-21 - - #else - /* * Check for errors here, but don't jump to cmd_err * until later as we need to wait for the card to leave @@ -421,7 +379,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) if (brq.cmd.error || brq.data.error || brq.stop.error) { if (brq.data.blocks > 1 && rq_data_dir(req) == READ) { /* Redo read one sector at a time */ - printk(KERN_DEBUG "%s: retrying using single " + printk(KERN_WARNING "%s: retrying using single " "block read\n", req->rq_disk->disk_name); disable_multi = 1; continue; @@ -429,11 +387,10 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) status = get_card_status(card, req); } else if (disable_multi == 1) { disable_multi = 0; - } - #endif + } if (brq.cmd.error) { - printk(KERN_DEBUG "%s: error %d sending read/write " + printk(KERN_ERR "%s: error %d sending read/write " "command, response %#x, card status %#x\n", req->rq_disk->disk_name, brq.cmd.error, brq.cmd.resp[0], status); @@ -443,7 +400,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) if (brq.data.error == -ETIMEDOUT && brq.mrq.stop) /* 'Stop' response contains card status */ status = brq.mrq.stop->resp[0]; - printk(KERN_DEBUG "%s: error %d transferring data," + printk(KERN_ERR "%s: error %d transferring data," " sector %u, nr %u, card status %#x\n", req->rq_disk->disk_name, brq.data.error, (unsigned)blk_rq_pos(req), @@ -451,16 +408,12 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) } if (brq.stop.error) { - printk(KERN_DEBUG "%s: error %d sending stop command, " + printk(KERN_ERR "%s: error %d sending stop command, " "response %#x, card status %#x\n", req->rq_disk->disk_name, brq.stop.error, brq.stop.resp[0], status); } - #if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - //Deleted by xbw@2011-03-21 - - #else if (!mmc_host_is_spi(card->host) && rq_data_dir(req) != READ) { do { int err; @@ -470,7 +423,7 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) cmd.flags = MMC_RSP_R1 | MMC_CMD_AC; err = mmc_wait_for_cmd(card->host, &cmd, 5); if (err) { - printk(KERN_DEBUG "%s: error %d requesting status\n", + printk(KERN_ERR "%s: error %d requesting status\n", req->rq_disk->disk_name, err); goto cmd_err; } @@ -490,9 +443,8 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) goto cmd_err; #endif } -#endif - if (brq.cmd.error || brq.stop.error || brq.data.error) { + if (brq.cmd.error || brq.stop.error || brq.data.error) { if (rq_data_dir(req) == READ) { /* * After an error, we redo I/O one sector at a @@ -620,11 +572,6 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card) sprintf(md->disk->disk_name, "mmcblk%d", devidx); -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - printk("%s..%d **** devidx=%d, dev_use[0]=%lu, disk_name=%s *** ==xbw[%s]==\n",\ - __FUNCTION__,__LINE__, devidx, dev_use[0], md->disk->disk_name,mmc_hostname(card->host)); -#endif - blk_queue_logical_block_size(md->queue.queue, 512); if (!mmc_card_sd(card) && mmc_card_blockaddr(card)) { diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c index ab9a939963d8..bdb165f93046 100755 --- a/drivers/mmc/core/bus.c +++ b/drivers/mmc/core/bus.c @@ -279,9 +279,6 @@ void mmc_remove_card(struct mmc_card *card) #endif if (mmc_card_present(card)) { -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) - mmc_card_clr_present(card); -#endif if (mmc_host_is_spi(card->host)) { printk(KERN_INFO "%s: SPI card removed\n", mmc_hostname(card->host)); diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index dd2a7a006438..fb25fd001f4a 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -202,11 +202,7 @@ void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq) mmc_start_request(host, mrq); -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - wait_for_completion_timeout(&complete,HZ*3); //for cmd dead. Modifyed by xbw at 2011-06-02 -#else wait_for_completion(&complete); -#endif } EXPORT_SYMBOL(mmc_wait_for_req); @@ -1063,155 +1059,7 @@ void mmc_detect_change(struct mmc_host *host, unsigned long delay) EXPORT_SYMBOL(mmc_detect_change); -#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; - int extend_wakelock = 0; - - - 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); - printk("\n%s...%d.. ===== mmc_rescan Begin....======xbw[%s]=====\n",__FILE__, __LINE__, mmc_hostname(host)); - - if (host->ops->get_cd && host->ops->get_cd(host) == 0) - { - printk("\n=================\n%s..%d.. ====find no SDMMC host.====xbw[%s]=====\n", \ - __FUNCTION__, __LINE__, mmc_hostname(host)); - - 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 - */ - - //mmc_send_if_cond(host, host->ocr_avail); //deleted by xbw@2011-04-09 - - if( strncmp( mmc_hostname(host) ,"mmc0" , strlen("mmc0")) ){ - /* - * First we search for SDIO... - */ - err = mmc_send_io_op_cond(host, 0, &ocr); - if (!err) { - printk("\n%s..%d.. ===== Begin to identify card as SDIO-card===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host)); - - if (mmc_attach_sdio(host, ocr)) - { - printk("\n=====\n %s..%d.. ===== Initialize SDIO-card unsuccessfully!!! ===xbw[%s]===\n=====\n",\ - __FUNCTION__, __LINE__, mmc_hostname(host)); - - mmc_power_off(host); - } - else - { - printk("%s..%d.. ===== Initialize SDIO successfully. ===xbw[%s]===\n",__FUNCTION__, __LINE__, mmc_hostname(host)); - } - extend_wakelock = 1; - 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 = @@ -1219,20 +1067,6 @@ void mmc_rescan(struct work_struct *work) u32 ocr; int err; int extend_wakelock = 0; - -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) - unsigned long flags; - - spin_lock_irqsave(&host->lock, flags); - - if (host->rescan_disable) { - spin_unlock_irqrestore(&host->lock, flags); - return; - } - - spin_unlock_irqrestore(&host->lock, flags); -#endif - mmc_bus_get(host); @@ -1320,7 +1154,6 @@ out: if (host->caps & MMC_CAP_NEEDS_POLL) mmc_schedule_delayed_work(&host->detect, HZ); } -#endif void mmc_start_host(struct mmc_host *host) { @@ -1457,10 +1290,6 @@ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) if (host->bus_ops && !host->bus_dead) { if (host->bus_ops->suspend) err = host->bus_ops->suspend(host); - -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) - //deleted all detail code. -#else if (err == -ENOSYS || !host->bus_ops->resume) { /* * We simply "remove" the card in this case. @@ -1473,7 +1302,6 @@ int mmc_suspend_host(struct mmc_host *host, pm_message_t state) mmc_release_host(host); err = 0; } -#endif } mmc_bus_put(host); @@ -1504,21 +1332,6 @@ int mmc_resume_host(struct mmc_host *host) mmc_power_up(host); mmc_select_voltage(host, host->ocr); BUG_ON(!host->bus_ops->resume); - -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) - err = host->bus_ops->resume(host); - if (err) { - printk(KERN_WARNING "%s: error %d during resume " - "(card was removed?)\n", - mmc_hostname(host), err); - err = 0; - } - -#elif defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - //panic if the card is being removed during the resume, deleted by xbw at 2011-06-20 - host->bus_ops->resume(host); - -#else err = host->bus_ops->resume(host); if (err) { printk(KERN_WARNING "%s: error %d during resume " @@ -1531,72 +1344,20 @@ int mmc_resume_host(struct mmc_host *host) mmc_release_host(host); /* no need to bother upper layers */ err = 0; - } -#endif + } } mmc_bus_put(host); -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) - //delete the detect_change. -#else /* * We add a slight delay here so that resume can progress * in parallel. */ mmc_detect_change(host, 1); -#endif + return err; } -EXPORT_SYMBOL(mmc_resume_host); - -///old driver add the function reforming to kernel2.6.38 -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) -/* Do the card removal on suspend if card is assumed removeable - * Do that in pm notifier while userspace isn't yet frozen, so we will be able - to sync the card. -*/ -int mmc_pm_notify(struct notifier_block *notify_block, - unsigned long mode, void *unused) -{ - struct mmc_host *host = container_of( - notify_block, struct mmc_host, pm_notify); - unsigned long flags; - - switch (mode) { - case PM_HIBERNATION_PREPARE: - case PM_SUSPEND_PREPARE: - - spin_lock_irqsave(&host->lock, flags); - host->rescan_disable = 1; - spin_unlock_irqrestore(&host->lock, flags); - cancel_delayed_work_sync(&host->detect); - - if (!host->bus_ops || host->bus_ops->suspend) - break; - - mmc_claim_host(host); - - if (host->bus_ops->remove) - host->bus_ops->remove(host); - - mmc_detach_bus(host); - mmc_release_host(host); - break; - - case PM_POST_SUSPEND: - case PM_POST_HIBERNATION: - - spin_lock_irqsave(&host->lock, flags); - host->rescan_disable = 0; - spin_unlock_irqrestore(&host->lock, flags); - mmc_detect_change(host, 0); - - } - - return 0; -} -#endif// endif---defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) +EXPORT_SYMBOL(mmc_resume_host); #endif diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 07b4d72f27fe..a268d12f1af0 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -16,9 +16,7 @@ #include #include #include -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) -#include -#endif + #include #include "core.h" @@ -86,11 +84,6 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) init_waitqueue_head(&host->wq); INIT_DELAYED_WORK(&host->detect, mmc_rescan); INIT_DELAYED_WORK_DEFERRABLE(&host->disable, mmc_host_deeper_disable); -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) // old driver, add pm reform to kernel2.6.38 -#ifdef CONFIG_PM - host->pm_notify.notifier_call = mmc_pm_notify; -#endif -#endif /* * By default, hosts do not support SGIO or large requests. @@ -140,11 +133,6 @@ int mmc_add_host(struct mmc_host *host) mmc_start_host(host); -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) // old driver, add pm reform to kernel2.6.38 - if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY)) - register_pm_notifier(&host->pm_notify); -#endif - return 0; } @@ -160,11 +148,6 @@ EXPORT_SYMBOL(mmc_add_host); */ void mmc_remove_host(struct mmc_host *host) { -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) // old driver, add pm reform to kernel2.6.38 - if (!(host->pm_flags & MMC_PM_IGNORE_PM_NOTIFY)) - unregister_pm_notifier(&host->pm_notify); - #endif - mmc_stop_host(host); #ifdef CONFIG_DEBUG_FS diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index b6f8867fa076..32af45c419f4 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -321,13 +321,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* The extra bit indicates that we support high capacity */ err = mmc_send_op_cond(host, ocr | (1 << 30), NULL); if (err) - { -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - printk("%s..%d.. ====*Identify the card as MMC , but OCR error, so fail to initialize.===xbw[%s]===\n",\ - __FUNCTION__, __LINE__, mmc_hostname(host)); -#endif goto err; - } /* * For SPI, enable CRC as appropriate. @@ -444,10 +438,6 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, if (max_dtr > card->ext_csd.hs_max_dtr) max_dtr = card->ext_csd.hs_max_dtr; } else if (max_dtr > card->csd.max_dtr) { -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - //in order to expand the compatibility of card. Added by xbw@2011-03-21 - card->csd.max_dtr = (card->csd.max_dtr > MMC_FPP_FREQ) ? MMC_FPP_FREQ : (card->csd.max_dtr); -#endif max_dtr = card->csd.max_dtr; } @@ -670,9 +660,6 @@ static void mmc_attach_bus_ops(struct mmc_host *host) int mmc_attach_mmc(struct mmc_host *host, u32 ocr) { int err; -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - int retry_times = 3; -#endif BUG_ON(!host); WARN_ON(!host->claimed); @@ -717,33 +704,10 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr) goto err; mmc_release_host(host); - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) -//modifyed by xbw at 2011--04-11 -Retry_add: - err = mmc_add_card(host->card); - if (err) - { - //retry add the card; Added by xbw - if((--retry_times >= 0)) - { - printk("\n%s..%s..%d ****error in add partition, so retry. ===xbw[%s]===\n",__FUNCTION__,__FILE__,__LINE__, mmc_hostname(host)); - /* sleep some time */ - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/2); - - goto Retry_add; - } - goto remove_card; - - } -#else - err = mmc_add_card(host->card); + err = mmc_add_card(host->card); if (err) goto remove_card; -#endif - return 0; diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index cae635fc8ed8..8fe5e9ece251 100755 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -362,13 +362,7 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, err = mmc_send_app_op_cond(host, ocr, NULL); if (err) - { -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - printk("%s..%d.. ====*Identify the card as SD , but OCR error, so fail to initialize.===xbw[%s]===\n", \ - __FUNCTION__, __LINE__, mmc_hostname(host)); -#endif goto err; - } /* * Fetch CID from card. @@ -464,13 +458,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, printk(KERN_WARNING "%s: read switch failed (attempt %d)\n", mmc_hostname(host), retries); - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - if(0 == host->re_initialized_flags) - { - break; //Added by xbw at 2011-06-21 - } -#endif } } #else @@ -509,11 +496,6 @@ static int mmc_sd_init_card(struct mmc_host *host, u32 ocr, if (max_dtr > card->sw_caps.hs_max_dtr) max_dtr = card->sw_caps.hs_max_dtr; } else if (max_dtr > card->csd.max_dtr) { - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - //in order to expand the compatibility of card. Added by xbw@2011-03-21 - card->csd.max_dtr = (card->csd.max_dtr > SD_FPP_FREQ) ? SD_FPP_FREQ : (card->csd.max_dtr); -#endif max_dtr = card->csd.max_dtr; } @@ -594,15 +576,6 @@ static void mmc_sd_detect(struct mmc_host *host) err = mmc_send_status(host->card, NULL); if (err) { retries--; - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - if(0 == host->re_initialized_flags) - { - retries = 0; - break; //Added by xbw at 2011-06-21 - } -#endif - udelay(5); continue; } @@ -670,13 +643,6 @@ static int mmc_sd_resume(struct mmc_host *host) mmc_hostname(host), err, retries); mdelay(5); retries--; - -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - if(0 == host->re_initialized_flags) - { - break; //Added by xbw at 2011-06-21 - } -#endif continue; } break; @@ -749,10 +715,6 @@ static void mmc_sd_attach_bus_ops(struct mmc_host *host) int mmc_attach_sd(struct mmc_host *host, u32 ocr) { int err; -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - int retry_times = 3; -#endif - #ifdef CONFIG_MMC_PARANOID_SD_INIT int retries; #endif @@ -810,14 +772,6 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr) err = mmc_sd_init_card(host, host->ocr, NULL); if (err) { retries--; - - #if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - if(0 == host->re_initialized_flags) - { - retries = 0; - break; //Added by xbw at 2011-06-21 - } - #endif continue; } break; @@ -836,31 +790,9 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr) mmc_release_host(host); -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) -//modifyed by xbw at 2011--04-11 -Retry_add: err = mmc_add_card(host->card); - if (err) - { - //retry add the card; Added by xbw - if((--retry_times >= 0)) - { - printk("\n%s..%s..%d ****error in add partition, so retry. ===xbw[%s]===\n",__FUNCTION__,__FILE__,__LINE__, mmc_hostname(host)); - /* sleep some time */ - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/2); - - goto Retry_add; - } - - goto remove_card; - - } -#else - err = mmc_add_card(host->card); if (err) goto remove_card; -#endif return 0; diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c index 7280140bfea7..ac9102487e25 100644 --- a/drivers/mmc/core/sdio.c +++ b/drivers/mmc/core/sdio.c @@ -241,13 +241,7 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, */ err = mmc_send_io_op_cond(host, host->ocr, &ocr); if (err) - { -#if defined(CONFIG_SDMMC_RK29) && !defined(CONFIG_SDMMC_RK29_OLD) - printk("%s..%d.. ====*Identify the card as SDIO , but OCR error, so fail to initialize.===xbw[%s]===\n", \ - __FUNCTION__, __LINE__, mmc_hostname(host)); -#endif goto err; - } /* * For SPI, enable CRC as appropriate. @@ -268,13 +262,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, } card->type = MMC_TYPE_SDIO; - - /* - * Call the optional HC's init_card function to handle quirks. - */ - if (host->ops->init_card) - host->ops->init_card(host, card); - /* * For native busses: set card RCA and quit open drain mode. @@ -284,16 +271,6 @@ static int mmc_sdio_init_card(struct mmc_host *host, u32 ocr, if (err) goto remove; -#if defined(CONFIG_SDMMC_RK29) && defined(CONFIG_SDMMC_RK29_OLD) //old driver add the code ,reform to kernel2.6.38 - /* - * Update oldcard with the new RCA received from the SDIO - * device -- we're doing this so that it's updated in the - * "card" struct when oldcard overwrites that later. - */ - if (oldcard) - oldcard->rca = card->rca; -#endif - mmc_set_bus_mode(host, MMC_BUSMODE_PUSHPULL); } -- 2.34.1