summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorban_feng <Ban_Feng@asus.com>2012-03-28 11:05:29 +0800
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2015-02-03 15:49:06 +0100
commit5f7bbcaf707c56badf8dd9354994ea908561eda6 (patch)
treee0b09bb152f254b8f4d9a9fd1b3810ec71d933a8
parenta699c4f23852bad780b8ad5273d5a3171cd461f9 (diff)
eMMC: Add Product revision, Sector count and driver init log
Change-Id: I89b544afbb0a109a222621a9948399fba8f77693 Change-Id: Ie366a152100a478e7811b4395f3fae9794bb1386 Reviewed-on: http://mcrd1-5.corpnet.asus/code-review/master/45221 Reviewed-by: Ban Feng <Ban_Feng@asus.com> Tested-by: Ban Feng <Ban_Feng@asus.com> Reviewed-by: Sam hblee <Sam_hblee@asus.com> Conflicts: drivers/mmc/core/mmc.c include/linux/mmc/card.h asdf
-rw-r--r--drivers/mmc/core/core.c5
-rw-r--r--drivers/mmc/core/mmc.c16
-rw-r--r--drivers/mmc/debug_mmc.h17
-rw-r--r--drivers/mmc/host/sdhci-tegra.c6
-rw-r--r--include/linux/mmc/card.h3
5 files changed, 40 insertions, 7 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index f7528db8fd06..4b9d1873e0e2 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -40,6 +40,7 @@
#include "mmc_ops.h"
#include "sd_ops.h"
#include "sdio_ops.h"
+#include "../debug_mmc.h"
static struct workqueue_struct *workqueue;
@@ -1988,8 +1989,10 @@ static int mmc_rescan_try_freq(struct mmc_host *host, unsigned freq)
return 0;
if (!mmc_attach_sd(host))
return 0;
- if (!mmc_attach_mmc(host))
+ if (!mmc_attach_mmc(host)) {
+ MMC_printk("%s: eMMC completed", mmc_hostname(host));
return 0;
+ }
mmc_power_off(host);
return -EIO;
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 0e83a400f71d..7af569522624 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -23,6 +23,8 @@
#include "mmc_ops.h"
#include "sd_ops.h"
+#include "../debug_mmc.h"
+
static const unsigned int tran_exp[] = {
10000, 100000, 1000000, 10000000,
0, 0, 0, 0
@@ -96,7 +98,7 @@ static int mmc_decode_cid(struct mmc_card *card)
card->cid.prod_name[3] = UNSTUFF_BITS(resp, 72, 8);
card->cid.prod_name[4] = UNSTUFF_BITS(resp, 64, 8);
card->cid.prod_name[5] = UNSTUFF_BITS(resp, 56, 8);
- card->cid.prod_rev = UNSTUFF_BITS(resp, 48, 8);
+ card->cid.prv = UNSTUFF_BITS(resp, 48, 8);
card->cid.serial = UNSTUFF_BITS(resp, 16, 32);
card->cid.month = UNSTUFF_BITS(resp, 12, 4);
card->cid.year = UNSTUFF_BITS(resp, 8, 4) + 1997;
@@ -108,6 +110,8 @@ static int mmc_decode_cid(struct mmc_card *card)
return -EINVAL;
}
+ MMC_printk("cid.prv 0x%x", card->cid.prv);
+
return 0;
}
@@ -277,6 +281,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
ext_csd[EXT_CSD_SEC_CNT + 1] << 8 |
ext_csd[EXT_CSD_SEC_CNT + 2] << 16 |
ext_csd[EXT_CSD_SEC_CNT + 3] << 24;
+ MMC_printk("ext_csd.sectors 0x%x prod_name %s BOOT_MULTI 0x%x", card->ext_csd.sectors, card->cid.prod_name, ext_csd[EXT_CSD_BOOT_MULT]);
+ card->ext_csd.sec_count = card->ext_csd.sectors;
/* Cards with density > 2GiB are sector addressed */
if (card->ext_csd.sectors > (2u * 1024 * 1024 * 1024) / 512)
@@ -427,8 +433,8 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 *ext_csd)
card->ext_csd.bk_ops = 1;
/* Check whether the eMMC card needs proactive refresh */
- if ((card->cid.manfid == 0x90) && ((card->cid.prod_rev == 0x73)
- || (card->cid.prod_rev == 0x7b)))
+ if ((card->cid.manfid == 0x90) && ((card->cid.prv == 0x73)
+ || (card->cid.prv == 0x7b)))
card->ext_csd.refresh = 1;
}
@@ -521,11 +527,12 @@ MMC_DEV_ATTR(hwrev, "0x%x\n", card->cid.hwrev);
MMC_DEV_ATTR(manfid, "0x%06x\n", card->cid.manfid);
MMC_DEV_ATTR(name, "%s\n", card->cid.prod_name);
MMC_DEV_ATTR(oemid, "0x%04x\n", card->cid.oemid);
-MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prod_rev);
+MMC_DEV_ATTR(prv, "0x%x\n", card->cid.prv);
MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);
MMC_DEV_ATTR(enhanced_area_offset, "%llu\n",
card->ext_csd.enhanced_area_offset);
MMC_DEV_ATTR(enhanced_area_size, "%u\n", card->ext_csd.enhanced_area_size);
+MMC_DEV_ATTR(sec_count, "0x%x\n", card->ext_csd.sec_count);
static struct attribute *mmc_std_attrs[] = {
&dev_attr_cid.attr,
@@ -542,6 +549,7 @@ static struct attribute *mmc_std_attrs[] = {
&dev_attr_serial.attr,
&dev_attr_enhanced_area_offset.attr,
&dev_attr_enhanced_area_size.attr,
+ &dev_attr_sec_count.attr,
NULL,
};
diff --git a/drivers/mmc/debug_mmc.h b/drivers/mmc/debug_mmc.h
new file mode 100644
index 000000000000..592c919aa371
--- /dev/null
+++ b/drivers/mmc/debug_mmc.h
@@ -0,0 +1,17 @@
+#define MMC_DEBUG 1
+#if MMC_DEBUG
+#define MMC_DBG(fmt,args...) \
+ do { printk(KERN_DEBUG "[mmc_debug]:%s:%d "fmt"\n", __func__, __LINE__, ##args); } \
+ while (0)
+#else
+#define MMC_DBG(x...) do {} while (0)
+#endif
+
+
+#if 1
+#define MMC_printk(fmt,args...) \
+ do { printk(KERN_INFO "[mmc]:%s:%d "fmt"\n", __func__, __LINE__, ##args); } \
+ while (0)
+#else
+#define MMC_prink(x...) do {} while (0)
+#endif
diff --git a/drivers/mmc/host/sdhci-tegra.c b/drivers/mmc/host/sdhci-tegra.c
index 1c8efb8632e9..07109f8f4ba7 100644
--- a/drivers/mmc/host/sdhci-tegra.c
+++ b/drivers/mmc/host/sdhci-tegra.c
@@ -1250,7 +1250,11 @@ static struct platform_driver sdhci_tegra_driver = {
static int __init sdhci_tegra_init(void)
{
- return platform_driver_register(&sdhci_tegra_driver);
+ int ret = 0;
+ printk(KERN_INFO "%s+ #####\n", __func__);
+ ret = platform_driver_register(&sdhci_tegra_driver);
+ printk(KERN_INFO "%s- #####\n", __func__);
+ return ret;
}
module_init(sdhci_tegra_init);
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index 4d50754f339e..85f17ff14e7e 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -22,7 +22,7 @@ struct mmc_cid {
unsigned char hwrev;
unsigned char fwrev;
unsigned char month;
- unsigned short prod_rev;
+ unsigned int prv;
};
struct mmc_csd {
@@ -87,6 +87,7 @@ struct mmc_ext_csd {
bool refresh; /* refresh of blocks supported */
__kernel_time_t last_tv_sec; /* last time a block was refreshed */
__kernel_time_t last_bkops_tv_sec; /* last time bkops was done */
+ unsigned int sec_count;
};
struct sd_scr {