summaryrefslogtreecommitdiff
path: root/drivers/mmc
diff options
context:
space:
mode:
authorRyan QIAN <b32804@freescale.com>2012-01-07 12:38:06 +0800
committerRyan QIAN <b32804@freescale.com>2012-01-31 10:51:37 +0800
commit17f465f30d2c713e8c1a7afb5d42b8d160a03b45 (patch)
tree1e8e55324d162fd1db6f74de2f50b86e9cdffdd3 /drivers/mmc
parent16c4fa163c5913ad52e4561f50e12f89db96bb0c (diff)
ENGR00173286 merge "eMMC: improve boot_info message output"
ENGR133884 eMMC: improve boot_info message output Output bit means of important esd_csd register Read esd_csd info each time when cat boot_info becasue user may change config affect esd_csd value. boot_info:0x07; ALT_BOOT_MODE:1 - Supports alternate boot method DDR_BOOT_MODE:1 - Supports alternate dual data rate during boot HS_BOOTMODE:1 - Supports high speed timing during boot boot_size:0512KB boot_partition:0x48; BOOT_ACK:1 - Boot acknowledge sent during boot operation BOOT_PARTITION-ENABLE: 1 - Boot partition 1 enabled PARTITION_ACCESS:0 - No access to boot partition boot_bus:0x01 BOOT_MODE:0 - Use single data rate + backward compatible timings in boot operation RESET_BOOT_BUS_WIDTH:0 - Reset bus width to x1, single data rate and backward compatible timings after boot operation BOOT_BUS_WIDTH:1 - x4 (sdr/ddr) bus width in boot operation mode Signed-off-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: Ryan QIAN <b32804@freescale.com>
Diffstat (limited to 'drivers/mmc')
-rw-r--r--drivers/mmc/core/mmc.c112
1 files changed, 108 insertions, 4 deletions
diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index b582d1ceeb41..579450ba8a1e 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -779,12 +779,116 @@ 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(serial, "0x%08x\n", card->cid.serial);
-MMC_DEV_ATTR(boot_info, "boot_info:0x%02x; boot_size:%04dKB;"
- " boot_partition:0x%02x; boot_bus:0x%02x\n",
- card->ext_csd.boot_info, card->ext_csd.boot_size * 128,
- card->ext_csd.boot_config, card->ext_csd.boot_bus_width);
+
+static ssize_t mmc_boot_info_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ char *boot_partition[8] = {
+ "Device not boot enabled",
+ "Boot partition 1 enabled",
+ "Boot partition 2 enabled",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "Reserved",
+ "User area enabled for boot"};
+
+ char *boot_partition_access[8] = {
+ "No access to boot partition",
+ "R/W boot partition 1",
+ "R/W boot partition 2",
+ "R/W Replay Protected Memory Block (RPMB)",
+ "Access to General Purpose partition 1",
+ "Access to General Purpose partition 2",
+ "Access to General Purpose partition 3",
+ "Access to General Purpose partition 4"};
+
+ char *bus_width[4] = {
+ "x1 (sdr) or x4 (ddr) bus width in boot operation mode",
+ "x4 (sdr/ddr) bus width in boot operation mode",
+ "x8 (sdr/ddr) bus width in boot operation mode",
+ "Reserved"};
+
+ char *boot_mode[4] = {
+ "Use single data rate + backward compatible timings in boot operation",
+ "Use single data rate + high speed timings in boot operation mode",
+ "Use dual data rate in boot operation",
+ "Reserved"};
+
+ int partition;
+ int access;
+ int width;
+ int mode;
+ u8 *ext_csd = NULL;
+ struct mmc_card *card = container_of(dev, struct mmc_card, dev);
+
+ /* read it again because user may change it */
+ mmc_claim_host(card->host);
+ mmc_get_ext_csd(card, &ext_csd);
+ mmc_release_host(card->host);
+ mmc_read_ext_csd(card, ext_csd);
+
+ partition = (card->ext_csd.boot_config >> 3) & 0x7;
+ access = card->ext_csd.boot_config & 0x7;
+ width = card->ext_csd.boot_bus_width & 0x3;
+ mode = (card->ext_csd.boot_bus_width >> 3) & 0x3;
+
+ return sprintf(buf,
+ "boot_info:0x%02x;\n"
+ " ALT_BOOT_MODE:%x - %s\n"
+ " DDR_BOOT_MODE:%x - %s\n"
+ " HS_BOOTMODE:%x - %s\n"
+ "boot_size:%04dKB\n"
+ "boot_partition:0x%02x;\n"
+ " BOOT_ACK:%x - %s\n"
+ " BOOT_PARTITION-ENABLE: %x - %s\n"
+ " PARTITION_ACCESS:%x - %s\n"
+ "boot_bus:0x%02x\n"
+ " BOOT_MODE:%x - %s\n"
+ " RESET_BOOT_BUS_WIDTH:%x - %s\n"
+ " BOOT_BUS_WIDTH:%x - %s\n",
+
+ card->ext_csd.boot_info,
+ !!(card->ext_csd.boot_info & 0x1),
+ (card->ext_csd.boot_info & 0x1) ?
+ "Supports alternate boot method" :
+ "Does not support alternate boot method",
+ !!(card->ext_csd.boot_info & 0x2),
+ (card->ext_csd.boot_info & 0x2) ?
+ "Supports alternate dual data rate during boot" :
+ "Does not support dual data rate during boot",
+ !!(card->ext_csd.boot_info & 0x4),
+ (card->ext_csd.boot_info & 0x4) ?
+ "Supports high speed timing during boot" :
+ "Does not support high speed timing during boot",
+
+ card->ext_csd.boot_size * 128,
+
+ card->ext_csd.boot_config,
+ !!(card->ext_csd.boot_config & 0x40),
+ (card->ext_csd.boot_config & 0x40) ?
+ "Boot acknowledge sent during boot operation" :
+ "No boot acknowledge sent",
+ partition,
+ boot_partition[partition],
+ access,
+ boot_partition_access[access],
+
+ card->ext_csd.boot_bus_width,
+ mode,
+ boot_mode[mode],
+ !!(card->ext_csd.boot_bus_width & 0x4),
+ (card->ext_csd.boot_bus_width & 0x4) ?
+ "Retain boot bus width and boot mode after boot operation" :
+ "Reset bus width to x1, single data rate and backward"
+ "compatible timings after boot operation",
+ width,
+ bus_width[width]);
+}
+
DEVICE_ATTR(boot_config, S_IWUGO, NULL, setup_boot_partitions);
DEVICE_ATTR(boot_bus_config, S_IWUGO, NULL, setup_boot_bus);
+DEVICE_ATTR(boot_info, S_IRUGO, mmc_boot_info_show, NULL);
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);