Fix mmc_test build order
PATCH 1/1 Fix mmc_test build order
To use the mmc_test, it should be build before mmc_block.
---
drivers/mmc/card/Makefile +1 -1
@@ -6,9 +6,9 @@ ifeq ($(CONFIG_MMC_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif +obj-$(CONFIG_MMC_TEST) += mmc_test.o obj-$(CONFIG_MMC_BLOCK) += mmc_block.o mmc_block-objs := block.o queue.o -obj-$(CONFIG_MMC_TEST) += mmc_test.o obj-$(CONFIG_SDIO_UART) += sdio_uart.o
Quoted 3 lines · Kyungmin Park
To use the
mmc_test, it should be build beforemmc_block.Reported-by Adrian Hunter <[email protected]>
I did not report this. I just pointed out that mmc_test will not work if mmc_block has already been given all the MMC devices.
You can always switch between mmc_test and mmc_block by unbinding / binding e.g.
# ls -al /sys/bus/mmc/drivers/mmcblk drwxr-xr-x 2 root 0 0 Jan 1 00:00 . drwxr-xr-x 4 root 0 0 Jan 1 00:00 .. --w------- 1 root 0 4096 Jan 1 00:01 bind lrwxrwxrwx 1 root 0 0 Jan 1 00:01 mmc0:0001 -> ../../../../devices/platform/mmci-omap-hs.1/mmc_host/mmc0/mmc0:0001 --w------- 1 root 0 4096 Jan 1 00:01 uevent --w------- 1 root 0 4096 Jan 1 00:01 unbind
# echo mmc0:0001 > /sys/bus/mmc/drivers/mmcblk/unbind
# echo mmc0:0001 > /sys/bus/mmc/drivers/mmc_test/bind [ 128.221313] mmc_test mmc0:0001: Card claimed for testing.
I suggest adding explanation to the Kconfig help text for MMC_TEST and also the module decription in drivers/mmc/card/mmc_test.c
Quoted 18 lines
Signed-off-by Kyungmin Park <[email protected]>---
drivers/mmc/card/Makefile +1
-1@@ -6,9 +6,9 @@ ifeq ($(CONFIG_MMC_DEBUG),y) EXTRA_CFLAGS += -DDEBUG endif +obj-$(CONFIG_MMC_TEST) += mmc_test.o obj-$(CONFIG_MMC_BLOCK) += mmc_block.o mmc_block-objs := block.o queue.o -obj-$(CONFIG_MMC_TEST) += mmc_test.o obj-$(CONFIG_SDIO_UART) += sdio_uart.o
PATCH 1/1 mmc: add device class attribute for ext_csd
All,EXT_CSD is 512byte information (read using CMD8) for the MMC (eMMC) device. And for the latest and upcoming specification, ext_csd are much relevant then past.
So please let me know your idea to add and get the same ext_csd as MMC device attribute. This is the same way currently available for csd, cid, src, etc. (# cat /sys/class/mmc_host/mmc1/mmc1\:0001/ext_csd)
Regards,
Sukumar Ghorai
From: Sukumar Ghorai <[email protected]>
Date: Mon, 26 Jul 2010 10:47:12 +0530
Subject: [PATCH] mmc: add device class attribute for ext_csd
ext_csd is getting more informative form eMMC 4.4 onwards and better to have this in device information as currently available for csd, cid, src.
--- drivers/mmc/core/bus.c | 1 + drivers/mmc/core/mmc.c | 23 +++++++++++++++++------ include/linux/mmc/card.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-)
drivers/mmc/core/bus.c +1 -0
@@ -191,6 +191,7 @@ static void mmc_release_card(struct device *dev)if (card->info)kfree (card->info); +kfree (card->raw_ext_csd);kfree (card); }
drivers/mmc/core/mmc.c +17 -6
@@ -167,10 +167,6 @@ static int mmc_read_ext_csd(struct mmc_card *card)if (card->csd.mmca_vsn <CSD_SPEC_VER_4 )return 0 ; -/* -* As the ext_csd is so large and mostly unused, we don't store the -* raw block in mmc_card. -*/ ext_csd =kmalloc (512 ,GFP_KERNEL );if (!ext_csd) { printk(KERN_ERR "%s: could not allocate a buffer to "
@@ -250,11 +246,25 @@ static int mmc_read_ext_csd(struct mmc_card *card) } out: -kfree (ext_csd); - + card->raw_ext_csd = ext_csd;return err; } +static ssize_t mmc_ext_csd_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +int i; +struct mmc_card *card = container_of(dev, struct mmc_card, dev); + +for (i =0 ; i <512 ; i++) + buf +=sprintf (buf,"%02x" , card->raw_ext_csd[i]); + + buf -=512 ; +return 512 ; +} + +static DEVICE_ATTR(ext_csd, S_IRUGO, mmc_ext_csd_show, NULL); +MMC_DEV_ATTR (cid,"%08x%08x%08x%08x\n" , card->raw_cid[0 ], card->raw_cid[1 ], card->raw_cid[2 ], card->raw_cid[3 ]); MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1],
@@ -270,6 +280,7 @@ MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);static struct attribute *mmc_std_attrs[] = { &dev_attr_cid.attr, &dev_attr_csd.attr, + &dev_attr_ext_csd.attr, &dev_attr_date.attr, &dev_attr_fwrev.attr, &dev_attr_hwrev.attr,
include/linux/mmc/card.h +1 -0
@@ -105,6 +105,7 @@ struct mmc_card {u32 raw_cid[4 ];/* raw card CID */ u32 raw_csd[4 ];/* raw card CSD */ u32 raw_scr[2 ];/* raw card SCR */ +u8 *raw_ext_csd;/* raw card EXT CSD for MMC */ struct mmc_cid cid;/* card identification */ struct mmc_csd csd;/* card specific */ struct mmc_ext_csd ext_csd;/* mmc v4 extended card specific */
From: Sukumar Ghorai <[email protected]>
Date: Mon, 26 Jul 2010 10:47:12 +0530
Subject: [PATCH] mmc: add device class attribute for ext_csd
ext_csd is getting more informative form eMMC 4.4 onwards and better to have this in device information as currently available for csd, cid, src.
--- drivers/mmc/core/bus.c | 1 + drivers/mmc/core/mmc.c | 23 +++++++++++++++++------ include/linux/mmc/card.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-)
drivers/mmc/core/bus.c +1 -0
@@ -191,6 +191,7 @@ static void mmc_release_card(struct device *dev)if (card->info)kfree (card->info); +kfree (card->raw_ext_csd);kfree (card); }
drivers/mmc/core/mmc.c +17 -6
@@ -167,10 +167,6 @@ static int mmc_read_ext_csd(struct mmc_card *card)if (card->csd.mmca_vsn <CSD_SPEC_VER_4 )return 0 ; -/* -* As the ext_csd is so large and mostly unused, we don't store the -* raw block in mmc_card. -*/ ext_csd =kmalloc (512 ,GFP_KERNEL );if (!ext_csd) { printk(KERN_ERR "%s: could not allocate a buffer to "
@@ -250,11 +246,25 @@ static int mmc_read_ext_csd(struct mmc_card *card) } out: -kfree (ext_csd); - + card->raw_ext_csd = ext_csd;return err; } +static ssize_t mmc_ext_csd_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +int i; +struct mmc_card *card = container_of(dev, struct mmc_card, dev); + +for (i =0 ; i <512 ; i++) + buf +=sprintf (buf,"%02x" , card->raw_ext_csd[i]); + + buf -=512 ; +return 512 ; +} + +static DEVICE_ATTR(ext_csd, S_IRUGO, mmc_ext_csd_show, NULL); +MMC_DEV_ATTR (cid,"%08x%08x%08x%08x\n" , card->raw_cid[0 ], card->raw_cid[1 ], card->raw_cid[2 ], card->raw_cid[3 ]); MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1],
@@ -270,6 +280,7 @@ MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);static struct attribute *mmc_std_attrs[] = { &dev_attr_cid.attr, &dev_attr_csd.attr, + &dev_attr_ext_csd.attr, &dev_attr_date.attr, &dev_attr_fwrev.attr, &dev_attr_hwrev.attr,
include/linux/mmc/card.h +1 -0
@@ -105,6 +105,7 @@ struct mmc_card {u32 raw_cid[4 ];/* raw card CID */ u32 raw_csd[4 ];/* raw card CSD */ u32 raw_scr[2 ];/* raw card SCR */ +u8 *raw_ext_csd;/* raw card EXT CSD for MMC */ struct mmc_cid cid;/* card identification */ struct mmc_csd csd;/* card specific */ struct mmc_ext_csd ext_csd;/* mmc v4 extended card specific */
Re: [PATCH] mmc: add device class attribute for ext_csd
Quoted 6 lines · Sukumar
All,
EXT_CSDis 512byte information (read using CMD8) for the MMC (eMMC) device. And for the latest and upcoming specification,ext_csdare much relevant then past.So please let me know your idea to add and get the same
ext_csdas MMC device attribute. This is the same way currently available for csd, cid, src, etc. (# cat /sys/class/mmc_host/mmc1/mmc1\:0001/ext_csd)
Some of the values in Extended CSD can change so storing it could cause incorrect values to be reported.
Note that Extended CSD is available via debugfs
e.g. for device mmc0:0001 with debugfs mounted on /sys/kernel/debug
cat /sys/kernel/debug/mmc0/mmc0\:0001/ext_csd
Quoted 93 lines
Regards,
Sukumar GhoraiFrom: Sukumar Ghorai <[email protected]>
Date: Mon, 26 Jul 2010 10:47:12 +0530
Subject: [PATCH] mmc: add device class attribute forext_csd
ext_csdis getting more informative form eMMC 4.4 onwards and better to have this in device information as currently available for csd, cid, src.Signed-off-by Sukumar Ghorai <[email protected]>--- drivers/mmc/core/bus.c | 1 + drivers/mmc/core/mmc.c | 23 +++++++++++++++++------ include/linux/mmc/card.h | 1 + 3 files changed, 19 insertions(+), 6 deletions(-)drivers/mmc/core/bus.c +1
-0@@ -191,6 +191,7 @@ static void mmc_release_card(struct device *dev)if (card->info)kfree (card->info); +kfree (card->raw_ext_csd);kfree (card); }drivers/mmc/core/mmc.c +17
-6@@ -167,10 +167,6 @@ static int mmc_read_ext_csd(struct mmc_card *card)if (card->csd.mmca_vsn <CSD_SPEC_VER_4 )return 0 ; -/* -* As the ext_csd is so large and mostly unused, we don't store the -* raw block in mmc_card. -*/ ext_csd =kmalloc (512 ,GFP_KERNEL );if (!ext_csd) { printk(KERN_ERR "%s: could not allocate a buffer to "@@ -250,11 +246,25 @@ static int mmc_read_ext_csd(struct mmc_card *card) } out: -kfree (ext_csd); - + card->raw_ext_csd = ext_csd;return err; } +static ssize_t mmc_ext_csd_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +int i; +struct mmc_card *card = container_of(dev, struct mmc_card, dev); + +for (i =0 ; i <512 ; i++) + buf +=sprintf (buf,"%02x" , card->raw_ext_csd[i]); + + buf -=512 ; +return 512 ; +} + +static DEVICE_ATTR(ext_csd, S_IRUGO, mmc_ext_csd_show, NULL); +MMC_DEV_ATTR (cid,"%08x%08x%08x%08x\n" , card->raw_cid[0 ], card->raw_cid[1 ], card->raw_cid[2 ], card->raw_cid[3 ]); MMC_DEV_ATTR(csd, "%08x%08x%08x%08x\n", card->raw_csd[0], card->raw_csd[1],@@ -270,6 +280,7 @@ MMC_DEV_ATTR(serial, "0x%08x\n", card->cid.serial);static struct attribute *mmc_std_attrs[] = { &dev_attr_cid.attr, &dev_attr_csd.attr, + &dev_attr_ext_csd.attr, &dev_attr_date.attr, &dev_attr_fwrev.attr, &dev_attr_hwrev.attr,include/linux/mmc/card.h +1
-0@@ -105,6 +105,7 @@ struct mmc_card {u32 raw_cid[4 ];/* raw card CID */ u32 raw_csd[4 ];/* raw card CSD */ u32 raw_scr[2 ];/* raw card SCR */ +u8 *raw_ext_csd;/* raw card EXT CSD for MMC */ struct mmc_cid cid;/* card identification */ struct mmc_csd csd;/* card specific */ struct mmc_ext_csd ext_csd;/* mmc v4 extended card specific */
RE: [PATCH] mmc: add device class attribute for ext_csd
Quoted 16 lines
-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: Monday, July 26, 2010 6:13 PM
To: Ghorai, Sukumar
Cc: [email protected]; Andrew Morton
Subject: Re: [PATCH] mmc: add device class attribute forext_csdQuoted 2 lines · Sukumar
All,
EXT_CSDis 512byte information (read using CMD8) for the MMC (eMMC)device.
Quoted 1 line
And for the latest and upcoming specification,
ext_csdare much relevantthen past.
Quoted 1 line
Quoted 7 lines
Quoted 1 line
So please let me know your idea to add and get the same
ext_csdas MMCdevice attribute. This is the same way currently available for csd, cid, src, etc.
Quoted 1 line
(# cat /sys/class/mmc_host/mmc1/mmc1\:0001/ext_csd)
Some of the values in Extended CSD can change so storing it could cause incorrect values to be reported.
[Ghorai] I was thinking to get the original value as reference, such that we know that host is capable for maximum negotiation, like 8-bit, DDR mode, voltage, etc.
1. Is there any other way to get the original value supported by card?
2. If yes, is it worth full to do?
Quoted 4 lines
Note that Extended CSD is available via debugfs
e.g. for device mmc0:0001 with debugfs mounted on/sys/kernel/debugcat /sys/kernel/debug/mmc0/mmc0\:0001/ext_csd
[Ghorai] Thanks. I got it.
<<snip>>
Re: [PATCH] mmc: add device class attribute for ext_csd
Quoted 15 lines · Sukumar
Quoted 15 lines
-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: Monday, July 26, 2010 6:13 PM
To: Ghorai, Sukumar
Cc: [email protected]; Andrew Morton
Subject: Re: [PATCH] mmc: add device class attribute forext_csdQuoted 2 lines · Sukumar
All,
EXT_CSDis 512byte information (read using CMD8) for the MMC (eMMC)device.
Quoted 1 line
And for the latest and upcoming specification,
ext_csdare much relevantthen past.
Quoted 1 line
So please let me know your idea to add and get the same
ext_csdas MMC
Quoted 8 lines
Quoted 5 lines
device attribute. This is the same way currently available for csd, cid, src, etc.
Quoted 1 line
(# cat /sys/class/mmc_host/mmc1/mmc1\:0001/ext_csd)
Some of the values in Extended CSD can change so storing it could cause incorrect values to be reported.
[Ghorai] I was thinking to get the original value as reference, such that we know that host is capable for maximum negotiation, like 8-bit, DDR mode, voltage, etc.
1. Is there any other way to get the original value supported by card?
2. If yes, is it worth full to do?
If it is for debugging, would a debug prints do instead e.g.
drivers/mmc/core/mmc.c +3 -0
@@ -249,6 +249,9 @@ static int mmc_read_ext_csd(struct mmc_card *card)1 << ext_csd[EXT_CSD_S_A_TIMEOUT ]; } +pr_debug ("%s: initial ext_csd bus width code %02x" , +mmc_hostname (host), ext_csd[EXT_CSD_BUS_WIDTH ]); +
out:
kfree(ext_csd);
Quoted 13 lines
Quoted 5 lines
Note that Extended CSD is available via debugfs
e.g. for device mmc0:0001 with debugfs mounted on/sys/kernel/debugcat /sys/kernel/debug/mmc0/mmc0\:0001/ext_csd[Ghorai] Thanks. I got it.
<<snip>>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] mmc: add device class attribute for ext_csd
Quoted 44 lines
-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: Tuesday, July 27, 2010 1:22 PM
To: Ghorai, Sukumar
Cc: [email protected]; Andrew Morton
Subject: Re: [PATCH] mmc: add device class attribute forext_csdQuoted 8 lines · Sukumar
Quoted 8 lines
-----Original Message-----
From: Adrian Hunter [mailto:[email protected]]
Sent: Monday, July 26, 2010 6:13 PM
To: Ghorai, Sukumar
Cc: [email protected]; Andrew Morton
Subject: Re: [PATCH] mmc: add device class attribute forext_csdQuoted 5 lines
Quoted 5 lines
Quoted 2 lines · Sukumar
All,
EXT_CSDis 512byte information (read using CMD8) for the MMC (eMMC)device.
Quoted 1 line
And for the latest and upcoming specification,
ext_csdare muchrelevant
Quoted 8 lines
Quoted 7 lines
then past.
Quoted 1 line
So please let me know your idea to add and get the same
ext_csdas MMCdevice attribute. This is the same way currently available for csd, cid, src, etc.
Quoted 1 line
(# cat /sys/class/mmc_host/mmc1/mmc1\:0001/ext_csd)
Some of the values in Extended CSD can change so storing it could cause incorrect values to be reported.
[Ghorai] I was thinking to get the original value as reference, such
that we know that host is capable for maximum negotiation, like 8-bit, DDR mode, voltage, etc.
Quoted 2 lines
1. Is there any other way to get the original value supported by card?
2. If yes, is it worth full to do?If it is for debugging, would a debug prints do instead e.g.
drivers/mmc/core/mmc.c +0
-0
drivers/mmc/core/mmc.c static int mmc_read_ext_csd(struct mmc_card *card) · line 254
Quoted 6 lines
drivers/mmc/core/mmc.c +3
-0@@ -249,6 +249,9 @@ static int mmc_read_ext_csd(struct mmc_card *card)1 << ext_csd[EXT_CSD_S_A_TIMEOUT ]; } +pr_debug ("%s: initial ext_csd bus width code %02x" , +mmc_hostname (host), ext_csd[EXT_CSD_BUS_WIDTH ]); +
[Ghorai] yes, we need this kind messages in some format.
So let me add some more important debug print message(s) from ext_csd and submit as a patch.
Quoted 18 lines
drivers/mmc/core/mmc.c +0
-0out:kfree (ext_csd);Quoted 15 lines
Quoted 7 lines
Note that Extended CSD is available via debugfs
e.g. for device mmc0:0001 with debugfs mounted on/sys/kernel/debugcat /sys/kernel/debug/mmc0/mmc0\:0001/ext_csd[Ghorai] Thanks. I got it.
<<snip>>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html