* [PATCH] mmc-util: add the method to enable the bkops
@ 2012-07-17 2:44 Jaehoon Chung
2012-07-17 9:36 ` S, Venkatraman
0 siblings, 1 reply; 5+ messages in thread
From: Jaehoon Chung @ 2012-07-17 2:44 UTC (permalink / raw)
To: linux-mmc
Cc: Chris Ball, Kyungmin Park, Maya Erez, svenkatr@ti.com,
Saugata Das, Konstantin Dorfman, Adrian Hunter, Ulf Hansson,
Per FORLIN, Hanumath Prasad, Sebastian Rasmussen, Dong, Chuanxiao
This patch added the method to enable the bkops.
In ext_csd register, BKOPS_EN bit is one-time programable.
So if you want to use the bkops, use the this command.
<usage>
#mmc bkops enable /dev/mmcblk0
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
mmc.c | 5 +++++
mmc.h | 7 +++++++
mmc_cmds.c | 39 +++++++++++++++++++++++++++++++++++++++
mmc_cmds.h | 1 +
4 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/mmc.c b/mmc.c
index 379d667..3a12653 100644
--- a/mmc.c
+++ b/mmc.c
@@ -75,6 +75,11 @@ static struct Command commands[] = {
"Enable the boot partition for the <device>.\nTo receive acknowledgment of boot from the card set <send_ack>\nto 1, else set it to 0.",
NULL
},
+ { do_write_bkops_en, -1,
+ "bkops enable", "<device>\n"
+ "Enable the eMMC BKOPS feature enable on <device>.",
+ NULL
+ },
{ 0, 0, 0, 0 }
};
diff --git a/mmc.h b/mmc.h
index 0a521a8..3d77b38 100644
--- a/mmc.h
+++ b/mmc.h
@@ -31,12 +31,14 @@
*/
#define EXT_CSD_S_CMD_SET 504
#define EXT_CSD_HPI_FEATURE 503
+#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
#define EXT_CSD_BOOT_INFO 228 /* R/W */
#define EXT_CSD_PART_SWITCH_TIME 199
#define EXT_CSD_BOOT_CFG 179
#define EXT_CSD_PART_CONFIG 179
#define EXT_CSD_BOOT_WP 173
#define EXT_CSD_WR_REL_PARAM 166
+#define EXT_CSD_BKOPS_EN 163 /* R/W */
#define EXT_CSD_NATIVE_SECTOR_SIZE 63 /* R */
#define EXT_CSD_USE_NATIVE_SECTOR 62 /* R/W */
#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
@@ -48,6 +50,11 @@
#define EN_REL_WR (1<<2)
/*
+ * BKOPS_EN field definition
+ */
+#define BKOPS_ENABLE (1<<0)
+
+/*
* EXT_CSD field definitions
*/
#define EXT_CSD_HPI_SUPP (1<<0)
diff --git a/mmc_cmds.c b/mmc_cmds.c
index 90619db..271d1e4 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -280,6 +280,45 @@ int do_write_boot_en(int nargs, char **argv)
return ret;
}
+int do_write_bkops_en(int nargs, char **argv)
+{
+ __u8 ext_csd[512], value = 0;
+ int fd, ret;
+ char *device;
+
+ CHECK(nargs != 2, "Usage: mmc bkops enable </path/to/mmcblkX>\n",
+ exit(1));
+
+ device = argv[1];
+
+ fd = open(device, O_RDWR);
+ if (fd < 0) {
+ perror("open");
+ exit(1);
+ }
+
+ ret = read_extcsd(fd, ext_csd);
+ if (ret) {
+ fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
+ exit(1);
+ }
+
+ if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
+ fprintf(stderr, "Didn't support BKOPS from %s\n", device);
+ exit(1);
+ }
+
+ ret = write_extcsd_value(fd, EXT_CSD_BKOPS_EN, BKOPS_ENABLE);
+ if (ret) {
+ fprintf(stderr, "Could not write 0x%02x to "
+ "EXT_CSD[%d] in %s\n",
+ value, EXT_CSD_BKOPS_EN, device);
+ exit(1);
+ }
+
+ return ret;
+}
+
int do_read_extcsd(int nargs, char **argv)
{
__u8 ext_csd[512], ext_csd_rev, reg;
diff --git a/mmc_cmds.h b/mmc_cmds.h
index 2eb1df5..1dd4324 100644
--- a/mmc_cmds.h
+++ b/mmc_cmds.h
@@ -21,3 +21,4 @@ int do_writeprotect_get(int nargs, char **argv);
int do_writeprotect_set(int nargs, char **argv);
int do_disable_512B_emulation(int nargs, char **argv);
int do_write_boot_en(int nargs, char **argv);
+int do_write_bkops_en(int nargs, char **argv);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc-util: add the method to enable the bkops
2012-07-17 2:44 [PATCH] mmc-util: add the method to enable the bkops Jaehoon Chung
@ 2012-07-17 9:36 ` S, Venkatraman
2012-07-17 10:18 ` Jaehoon Chung
0 siblings, 1 reply; 5+ messages in thread
From: S, Venkatraman @ 2012-07-17 9:36 UTC (permalink / raw)
To: Jaehoon Chung
Cc: linux-mmc, Chris Ball, Kyungmin Park, Maya Erez, Saugata Das,
Konstantin Dorfman, Adrian Hunter, Ulf Hansson, Per FORLIN,
Hanumath Prasad, Sebastian Rasmussen, Dong, Chuanxiao
Minor printk nits..
On Tue, Jul 17, 2012 at 8:14 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> This patch added the method to enable the bkops.
> In ext_csd register, BKOPS_EN bit is one-time programable.
> So if you want to use the bkops, use the this command.
>
> <usage>
> #mmc bkops enable /dev/mmcblk0
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> mmc.c | 5 +++++
> mmc.h | 7 +++++++
> mmc_cmds.c | 39 +++++++++++++++++++++++++++++++++++++++
> mmc_cmds.h | 1 +
> 4 files changed, 52 insertions(+), 0 deletions(-)
>
> diff --git a/mmc.c b/mmc.c
> index 379d667..3a12653 100644
> --- a/mmc.c
> +++ b/mmc.c
> @@ -75,6 +75,11 @@ static struct Command commands[] = {
> "Enable the boot partition for the <device>.\nTo receive acknowledgment of boot from the card set <send_ack>\nto 1, else set it to 0.",
> NULL
> },
> + { do_write_bkops_en, -1,
> + "bkops enable", "<device>\n"
> + "Enable the eMMC BKOPS feature enable on <device>.",
s/feature enable on/feature on/
> + NULL
> + },
> { 0, 0, 0, 0 }
> };
>
> diff --git a/mmc.h b/mmc.h
> index 0a521a8..3d77b38 100644
> --- a/mmc.h
> +++ b/mmc.h
> @@ -31,12 +31,14 @@
> */
> #define EXT_CSD_S_CMD_SET 504
> #define EXT_CSD_HPI_FEATURE 503
> +#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
> #define EXT_CSD_BOOT_INFO 228 /* R/W */
> #define EXT_CSD_PART_SWITCH_TIME 199
> #define EXT_CSD_BOOT_CFG 179
> #define EXT_CSD_PART_CONFIG 179
> #define EXT_CSD_BOOT_WP 173
> #define EXT_CSD_WR_REL_PARAM 166
> +#define EXT_CSD_BKOPS_EN 163 /* R/W */
> #define EXT_CSD_NATIVE_SECTOR_SIZE 63 /* R */
> #define EXT_CSD_USE_NATIVE_SECTOR 62 /* R/W */
> #define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
> @@ -48,6 +50,11 @@
> #define EN_REL_WR (1<<2)
>
> /*
> + * BKOPS_EN field definition
> + */
> +#define BKOPS_ENABLE (1<<0)
> +
> +/*
> * EXT_CSD field definitions
> */
> #define EXT_CSD_HPI_SUPP (1<<0)
> diff --git a/mmc_cmds.c b/mmc_cmds.c
> index 90619db..271d1e4 100644
> --- a/mmc_cmds.c
> +++ b/mmc_cmds.c
> @@ -280,6 +280,45 @@ int do_write_boot_en(int nargs, char **argv)
> return ret;
> }
>
> +int do_write_bkops_en(int nargs, char **argv)
> +{
> + __u8 ext_csd[512], value = 0;
> + int fd, ret;
> + char *device;
> +
> + CHECK(nargs != 2, "Usage: mmc bkops enable </path/to/mmcblkX>\n",
> + exit(1));
> +
> + device = argv[1];
> +
> + fd = open(device, O_RDWR);
> + if (fd < 0) {
> + perror("open");
> + exit(1);
> + }
> +
> + ret = read_extcsd(fd, ext_csd);
> + if (ret) {
> + fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
> + exit(1);
> + }
> +
> + if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
> + fprintf(stderr, "Didn't support BKOPS from %s\n", device);
Better reported as fprintf(stderr, "%s does not support BKOPS\n", device);
After fixing this, feel free to add my
Reviewed-by: Venkatraman S<svenkatr@ti.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc-util: add the method to enable the bkops
2012-07-17 9:36 ` S, Venkatraman
@ 2012-07-17 10:18 ` Jaehoon Chung
0 siblings, 0 replies; 5+ messages in thread
From: Jaehoon Chung @ 2012-07-17 10:18 UTC (permalink / raw)
To: S, Venkatraman
Cc: Jaehoon Chung, linux-mmc, Chris Ball, Kyungmin Park, Maya Erez,
Saugata Das, Konstantin Dorfman, Adrian Hunter, Ulf Hansson,
Per FORLIN, Hanumath Prasad, Sebastian Rasmussen, Dong, Chuanxiao
Hi,
Also i will fix, then resend the patch.
Best Regards,
Jaehoon Chung
On 07/17/2012 06:36 PM, S, Venkatraman wrote:
> Minor printk nits..
>
> On Tue, Jul 17, 2012 at 8:14 AM, Jaehoon Chung <jh80.chung@samsung.com> wrote:
>> This patch added the method to enable the bkops.
>> In ext_csd register, BKOPS_EN bit is one-time programable.
>> So if you want to use the bkops, use the this command.
>>
>> <usage>
>> #mmc bkops enable /dev/mmcblk0
>>
>> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>> mmc.c | 5 +++++
>> mmc.h | 7 +++++++
>> mmc_cmds.c | 39 +++++++++++++++++++++++++++++++++++++++
>> mmc_cmds.h | 1 +
>> 4 files changed, 52 insertions(+), 0 deletions(-)
>>
>> diff --git a/mmc.c b/mmc.c
>> index 379d667..3a12653 100644
>> --- a/mmc.c
>> +++ b/mmc.c
>> @@ -75,6 +75,11 @@ static struct Command commands[] = {
>> "Enable the boot partition for the <device>.\nTo receive acknowledgment of boot from the card set <send_ack>\nto 1, else set it to 0.",
>> NULL
>> },
>> + { do_write_bkops_en, -1,
>> + "bkops enable", "<device>\n"
>> + "Enable the eMMC BKOPS feature enable on <device>.",
> s/feature enable on/feature on/
>
>> + NULL
>> + },
>> { 0, 0, 0, 0 }
>> };
>>
>> diff --git a/mmc.h b/mmc.h
>> index 0a521a8..3d77b38 100644
>> --- a/mmc.h
>> +++ b/mmc.h
>> @@ -31,12 +31,14 @@
>> */
>> #define EXT_CSD_S_CMD_SET 504
>> #define EXT_CSD_HPI_FEATURE 503
>> +#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
>> #define EXT_CSD_BOOT_INFO 228 /* R/W */
>> #define EXT_CSD_PART_SWITCH_TIME 199
>> #define EXT_CSD_BOOT_CFG 179
>> #define EXT_CSD_PART_CONFIG 179
>> #define EXT_CSD_BOOT_WP 173
>> #define EXT_CSD_WR_REL_PARAM 166
>> +#define EXT_CSD_BKOPS_EN 163 /* R/W */
>> #define EXT_CSD_NATIVE_SECTOR_SIZE 63 /* R */
>> #define EXT_CSD_USE_NATIVE_SECTOR 62 /* R/W */
>> #define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
>> @@ -48,6 +50,11 @@
>> #define EN_REL_WR (1<<2)
>>
>> /*
>> + * BKOPS_EN field definition
>> + */
>> +#define BKOPS_ENABLE (1<<0)
>> +
>> +/*
>> * EXT_CSD field definitions
>> */
>> #define EXT_CSD_HPI_SUPP (1<<0)
>> diff --git a/mmc_cmds.c b/mmc_cmds.c
>> index 90619db..271d1e4 100644
>> --- a/mmc_cmds.c
>> +++ b/mmc_cmds.c
>> @@ -280,6 +280,45 @@ int do_write_boot_en(int nargs, char **argv)
>> return ret;
>> }
>>
>> +int do_write_bkops_en(int nargs, char **argv)
>> +{
>> + __u8 ext_csd[512], value = 0;
>> + int fd, ret;
>> + char *device;
>> +
>> + CHECK(nargs != 2, "Usage: mmc bkops enable </path/to/mmcblkX>\n",
>> + exit(1));
>> +
>> + device = argv[1];
>> +
>> + fd = open(device, O_RDWR);
>> + if (fd < 0) {
>> + perror("open");
>> + exit(1);
>> + }
>> +
>> + ret = read_extcsd(fd, ext_csd);
>> + if (ret) {
>> + fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
>> + exit(1);
>> + }
>> +
>> + if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
>> + fprintf(stderr, "Didn't support BKOPS from %s\n", device);
>
> Better reported as fprintf(stderr, "%s does not support BKOPS\n", device);
>
> After fixing this, feel free to add my
> Reviewed-by: Venkatraman S<svenkatr@ti.com>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] mmc-util: add the method to enable the bkops
@ 2012-09-21 10:08 Jaehoon Chung
2012-09-21 10:21 ` Chris Ball
0 siblings, 1 reply; 5+ messages in thread
From: Jaehoon Chung @ 2012-09-21 10:08 UTC (permalink / raw)
To: linux-mmc; +Cc: Chris Ball, Kyungmin Park, svenkatr@ti.com, Maya Erez
This patch added the method to enable the bkops.
In ext_csd register, BKOPS_EN bit is one-time programable.
So if you want to use the bkops, use the this command.
<usage>
#mmc bkops enable /dev/mmcblk0
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewd-by: Venkatraman S <svenkatr@ti.com>
---
mmc.c | 5 +++++
mmc.h | 7 +++++++
mmc_cmds.c | 39 +++++++++++++++++++++++++++++++++++++++
mmc_cmds.h | 1 +
4 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/mmc.c b/mmc.c
index 379d667..d5ef2bb 100644
--- a/mmc.c
+++ b/mmc.c
@@ -75,6 +75,11 @@ static struct Command commands[] = {
"Enable the boot partition for the <device>.\nTo receive acknowledgment of boot from the card set <send_ack>\nto 1, else set it to 0.",
NULL
},
+ { do_write_bkops_en, -1,
+ "bkops enable", "<device>\n"
+ "Enable the eMMC BKOPS feature on <device>.",
+ NULL
+ },
{ 0, 0, 0, 0 }
};
diff --git a/mmc.h b/mmc.h
index 0a521a8..3d77b38 100644
--- a/mmc.h
+++ b/mmc.h
@@ -31,12 +31,14 @@
*/
#define EXT_CSD_S_CMD_SET 504
#define EXT_CSD_HPI_FEATURE 503
+#define EXT_CSD_BKOPS_SUPPORT 502 /* RO */
#define EXT_CSD_BOOT_INFO 228 /* R/W */
#define EXT_CSD_PART_SWITCH_TIME 199
#define EXT_CSD_BOOT_CFG 179
#define EXT_CSD_PART_CONFIG 179
#define EXT_CSD_BOOT_WP 173
#define EXT_CSD_WR_REL_PARAM 166
+#define EXT_CSD_BKOPS_EN 163 /* R/W */
#define EXT_CSD_NATIVE_SECTOR_SIZE 63 /* R */
#define EXT_CSD_USE_NATIVE_SECTOR 62 /* R/W */
#define EXT_CSD_DATA_SECTOR_SIZE 61 /* R */
@@ -48,6 +50,11 @@
#define EN_REL_WR (1<<2)
/*
+ * BKOPS_EN field definition
+ */
+#define BKOPS_ENABLE (1<<0)
+
+/*
* EXT_CSD field definitions
*/
#define EXT_CSD_HPI_SUPP (1<<0)
diff --git a/mmc_cmds.c b/mmc_cmds.c
index 90619db..4c935e0 100644
--- a/mmc_cmds.c
+++ b/mmc_cmds.c
@@ -280,6 +280,45 @@ int do_write_boot_en(int nargs, char **argv)
return ret;
}
+int do_write_bkops_en(int nargs, char **argv)
+{
+ __u8 ext_csd[512], value = 0;
+ int fd, ret;
+ char *device;
+
+ CHECK(nargs != 2, "Usage: mmc bkops enable </path/to/mmcblkX>\n",
+ exit(1));
+
+ device = argv[1];
+
+ fd = open(device, O_RDWR);
+ if (fd < 0) {
+ perror("open");
+ exit(1);
+ }
+
+ ret = read_extcsd(fd, ext_csd);
+ if (ret) {
+ fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
+ exit(1);
+ }
+
+ if (!(ext_csd[EXT_CSD_BKOPS_SUPPORT] & 0x1)) {
+ fprintf(stderr, "%s dosen't support BKOPS\n", device);
+ exit(1);
+ }
+
+ ret = write_extcsd_value(fd, EXT_CSD_BKOPS_EN, BKOPS_ENABLE);
+ if (ret) {
+ fprintf(stderr, "Could not write 0x%02x to "
+ "EXT_CSD[%d] in %s\n",
+ value, EXT_CSD_BKOPS_EN, device);
+ exit(1);
+ }
+
+ return ret;
+}
+
int do_read_extcsd(int nargs, char **argv)
{
__u8 ext_csd[512], ext_csd_rev, reg;
diff --git a/mmc_cmds.h b/mmc_cmds.h
index 2eb1df5..1dd4324 100644
--- a/mmc_cmds.h
+++ b/mmc_cmds.h
@@ -21,3 +21,4 @@ int do_writeprotect_get(int nargs, char **argv);
int do_writeprotect_set(int nargs, char **argv);
int do_disable_512B_emulation(int nargs, char **argv);
int do_write_boot_en(int nargs, char **argv);
+int do_write_bkops_en(int nargs, char **argv);
-- 1.7.4.1 --
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] mmc-util: add the method to enable the bkops
2012-09-21 10:08 Jaehoon Chung
@ 2012-09-21 10:21 ` Chris Ball
0 siblings, 0 replies; 5+ messages in thread
From: Chris Ball @ 2012-09-21 10:21 UTC (permalink / raw)
To: Jaehoon Chung; +Cc: linux-mmc, Kyungmin Park, svenkatr@ti.com, Maya Erez
Hi Jaehoon,
On Fri, Sep 21 2012, Jaehoon Chung wrote:
> This patch added the method to enable the bkops.
> In ext_csd register, BKOPS_EN bit is one-time programable.
> So if you want to use the bkops, use the this command.
>
> <usage>
> #mmc bkops enable /dev/mmcblk0
>
> Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Reviewd-by: Venkatraman S <svenkatr@ti.com>
Thanks for the reminder -- pushed to mmc-utils.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-09-21 10:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-17 2:44 [PATCH] mmc-util: add the method to enable the bkops Jaehoon Chung
2012-07-17 9:36 ` S, Venkatraman
2012-07-17 10:18 ` Jaehoon Chung
-- strict thread matches above, loose matches on Subject: below --
2012-09-21 10:08 Jaehoon Chung
2012-09-21 10:21 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).