* [U-Boot] [PATCH 2/4] disk: support devices with HW partitions
2014-05-07 18:19 [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
@ 2014-05-07 18:19 ` Stephen Warren
2014-05-23 9:09 ` Pantelis Antoniou
2014-05-07 18:19 ` [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device() Stephen Warren
` (3 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Stephen Warren @ 2014-05-07 18:19 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
Some device types (e.g. eMMC) have hardware-level partitions (for eMMC,
separate boot and user data partitions). This change allows the user to
specify the HW partition they wish to access when passing a device ID to
U-Boot Commands such as part, ls, load, ums, etc.
The syntax allows an optional ".$hwpartid" to be appended to the device
name string for those commands.
Existing syntax, for MMC device 0, default HW partition ID, SW partition
ID 1:
ls mmc 0:1 /
New syntax, for MMC device 0, HW partition ID 1 (boot0), SW partition
ID 2:
ls mmc 0.1:2 /
For my purposes, this is most useful for the ums (USB mass storage
gadget) command, but there's no reason not to allow the new syntax
globally.
This patch adds the core support infra-structure. The next patch will
provide the implementation for MMC.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
disk/part.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 64 insertions(+), 10 deletions(-)
diff --git a/disk/part.c b/disk/part.c
index b8c6aac80162..5e10cae015e5 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -22,6 +22,7 @@
struct block_drvr {
char *name;
block_dev_desc_t* (*get_dev)(int dev);
+ int (*select_hwpart)(int dev_num, int hwpart);
};
static const struct block_drvr block_drvr[] = {
@@ -52,11 +53,13 @@ static const struct block_drvr block_drvr[] = {
DECLARE_GLOBAL_DATA_PTR;
#ifdef HAVE_BLOCK_DEVICE
-block_dev_desc_t *get_dev(const char *ifname, int dev)
+block_dev_desc_t *get_dev_hwpart(const char *ifname, int dev, int hwpart)
{
const struct block_drvr *drvr = block_drvr;
block_dev_desc_t* (*reloc_get_dev)(int dev);
+ int (*select_hwpart)(int dev_num, int hwpart);
char *name;
+ int ret;
if (!ifname)
return NULL;
@@ -68,17 +71,41 @@ block_dev_desc_t *get_dev(const char *ifname, int dev)
while (drvr->name) {
name = drvr->name;
reloc_get_dev = drvr->get_dev;
+ select_hwpart = drvr->select_hwpart;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
name += gd->reloc_off;
reloc_get_dev += gd->reloc_off;
-#endif
- if (strncmp(ifname, name, strlen(name)) == 0)
- return reloc_get_dev(dev);
+ if (select_hwpart)
+ select_hwpart += gd->reloc_off;
+#endif
+ if (strncmp(ifname, name, strlen(name)) == 0) {
+ block_dev_desc_t *dev_desc = reloc_get_dev(dev);
+ if (!dev_desc)
+ return NULL;
+ if (hwpart == -1)
+ return dev_desc;
+ if (!select_hwpart)
+ return NULL;
+ ret = select_hwpart(dev_desc->dev, hwpart);
+ if (ret < 0)
+ return NULL;
+ return dev_desc;
+ }
drvr++;
}
return NULL;
}
+
+block_dev_desc_t *get_dev(const char *ifname, int dev)
+{
+ return get_dev_hwpart(ifname, dev, -1);
+}
#else
+block_dev_desc_t *get_dev_hwpart(const char *ifname, int dev, int hwpart)
+{
+ return NULL;
+}
+
block_dev_desc_t *get_dev(const char *ifname, int dev)
{
return NULL;
@@ -413,25 +440,52 @@ int get_partition_info(block_dev_desc_t *dev_desc, int part
return -1;
}
-int get_device(const char *ifname, const char *dev_str,
+int get_device(const char *ifname, const char *dev_hwpart_str,
block_dev_desc_t **dev_desc)
{
char *ep;
- int dev;
+ char *dup_str = NULL;
+ const char *dev_str, *hwpart_str;
+ int dev, hwpart;
+
+ hwpart_str = strchr(dev_hwpart_str, '.');
+ if (hwpart_str) {
+ dup_str = strdup(dev_hwpart_str);
+ dup_str[hwpart_str - dev_hwpart_str] = 0;
+ dev_str = dup_str;
+ hwpart_str++;
+ } else {
+ dev_str = dev_hwpart_str;
+ hwpart = -1;
+ }
dev = simple_strtoul(dev_str, &ep, 16);
if (*ep) {
printf("** Bad device specification %s %s **\n",
ifname, dev_str);
- return -1;
+ dev = -1;
+ goto cleanup;
+ }
+
+ if (hwpart_str) {
+ hwpart = simple_strtoul(hwpart_str, &ep, 16);
+ if (*ep) {
+ printf("** Bad HW partition specification %s %s **\n",
+ ifname, hwpart_str);
+ dev = -1;
+ goto cleanup;
+ }
}
- *dev_desc = get_dev(ifname, dev);
+ *dev_desc = get_dev_hwpart(ifname, dev, hwpart);
if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
- printf("** Bad device %s %s **\n", ifname, dev_str);
- return -1;
+ printf("** Bad device %s %s **\n", ifname, dev_hwpart_str);
+ dev = -1;
+ goto cleanup;
}
+cleanup:
+ free(dup_str);
return dev;
}
--
1.8.1.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 2/4] disk: support devices with HW partitions
2014-05-07 18:19 ` [U-Boot] [PATCH 2/4] disk: support devices with HW partitions Stephen Warren
@ 2014-05-23 9:09 ` Pantelis Antoniou
0 siblings, 0 replies; 17+ messages in thread
From: Pantelis Antoniou @ 2014-05-23 9:09 UTC (permalink / raw)
To: u-boot
Hi Stephen,
On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> Some device types (e.g. eMMC) have hardware-level partitions (for eMMC,
> separate boot and user data partitions). This change allows the user to
> specify the HW partition they wish to access when passing a device ID to
> U-Boot Commands such as part, ls, load, ums, etc.
>
> The syntax allows an optional ".$hwpartid" to be appended to the device
> name string for those commands.
>
> Existing syntax, for MMC device 0, default HW partition ID, SW partition
> ID 1:
>
> ls mmc 0:1 /
>
> New syntax, for MMC device 0, HW partition ID 1 (boot0), SW partition
> ID 2:
>
> ls mmc 0.1:2 /
>
> For my purposes, this is most useful for the ums (USB mass storage
> gadget) command, but there's no reason not to allow the new syntax
> globally.
>
> This patch adds the core support infra-structure. The next patch will
> provide the implementation for MMC.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> disk/part.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 file changed, 64 insertions(+), 10 deletions(-)
>
> diff --git a/disk/part.c b/disk/part.c
> index b8c6aac80162..5e10cae015e5 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -22,6 +22,7 @@
> struct block_drvr {
> char *name;
> block_dev_desc_t* (*get_dev)(int dev);
> + int (*select_hwpart)(int dev_num, int hwpart);
> };
>
> static const struct block_drvr block_drvr[] = {
> @@ -52,11 +53,13 @@ static const struct block_drvr block_drvr[] = {
> DECLARE_GLOBAL_DATA_PTR;
>
> #ifdef HAVE_BLOCK_DEVICE
> -block_dev_desc_t *get_dev(const char *ifname, int dev)
> +block_dev_desc_t *get_dev_hwpart(const char *ifname, int dev, int hwpart)
> {
> const struct block_drvr *drvr = block_drvr;
> block_dev_desc_t* (*reloc_get_dev)(int dev);
> + int (*select_hwpart)(int dev_num, int hwpart);
> char *name;
> + int ret;
>
> if (!ifname)
> return NULL;
> @@ -68,17 +71,41 @@ block_dev_desc_t *get_dev(const char *ifname, int dev)
> while (drvr->name) {
> name = drvr->name;
> reloc_get_dev = drvr->get_dev;
> + select_hwpart = drvr->select_hwpart;
> #ifdef CONFIG_NEEDS_MANUAL_RELOC
> name += gd->reloc_off;
> reloc_get_dev += gd->reloc_off;
> -#endif
> - if (strncmp(ifname, name, strlen(name)) == 0)
> - return reloc_get_dev(dev);
> + if (select_hwpart)
> + select_hwpart += gd->reloc_off;
> +#endif
> + if (strncmp(ifname, name, strlen(name)) == 0) {
> + block_dev_desc_t *dev_desc = reloc_get_dev(dev);
> + if (!dev_desc)
> + return NULL;
> + if (hwpart == -1)
> + return dev_desc;
> + if (!select_hwpart)
> + return NULL;
> + ret = select_hwpart(dev_desc->dev, hwpart);
> + if (ret < 0)
> + return NULL;
> + return dev_desc;
> + }
> drvr++;
> }
> return NULL;
> }
> +
> +block_dev_desc_t *get_dev(const char *ifname, int dev)
> +{
> + return get_dev_hwpart(ifname, dev, -1);
> +}
> #else
> +block_dev_desc_t *get_dev_hwpart(const char *ifname, int dev, int hwpart)
> +{
> + return NULL;
> +}
> +
> block_dev_desc_t *get_dev(const char *ifname, int dev)
> {
> return NULL;
> @@ -413,25 +440,52 @@ int get_partition_info(block_dev_desc_t *dev_desc, int part
> return -1;
> }
>
> -int get_device(const char *ifname, const char *dev_str,
> +int get_device(const char *ifname, const char *dev_hwpart_str,
> block_dev_desc_t **dev_desc)
> {
> char *ep;
> - int dev;
> + char *dup_str = NULL;
> + const char *dev_str, *hwpart_str;
> + int dev, hwpart;
> +
> + hwpart_str = strchr(dev_hwpart_str, '.');
> + if (hwpart_str) {
> + dup_str = strdup(dev_hwpart_str);
> + dup_str[hwpart_str - dev_hwpart_str] = 0;
> + dev_str = dup_str;
> + hwpart_str++;
> + } else {
> + dev_str = dev_hwpart_str;
> + hwpart = -1;
> + }
>
> dev = simple_strtoul(dev_str, &ep, 16);
> if (*ep) {
> printf("** Bad device specification %s %s **\n",
> ifname, dev_str);
> - return -1;
> + dev = -1;
> + goto cleanup;
> + }
> +
> + if (hwpart_str) {
> + hwpart = simple_strtoul(hwpart_str, &ep, 16);
> + if (*ep) {
> + printf("** Bad HW partition specification %s %s **\n",
> + ifname, hwpart_str);
> + dev = -1;
> + goto cleanup;
> + }
> }
>
> - *dev_desc = get_dev(ifname, dev);
> + *dev_desc = get_dev_hwpart(ifname, dev, hwpart);
> if (!(*dev_desc) || ((*dev_desc)->type == DEV_TYPE_UNKNOWN)) {
> - printf("** Bad device %s %s **\n", ifname, dev_str);
> - return -1;
> + printf("** Bad device %s %s **\n", ifname, dev_hwpart_str);
> + dev = -1;
> + goto cleanup;
> }
>
> +cleanup:
> + free(dup_str);
> return dev;
> }
>
> --
> 1.8.1.5
>
Applied
Thanks
-- Pantelis
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
2014-05-07 18:19 [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
2014-05-07 18:19 ` [U-Boot] [PATCH 2/4] disk: support devices with HW partitions Stephen Warren
@ 2014-05-07 18:19 ` Stephen Warren
2014-05-07 18:22 ` Fabio Estevam
2014-05-23 9:21 ` Pantelis Antoniou
2014-05-07 18:19 ` [U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function Stephen Warren
` (2 subsequent siblings)
4 siblings, 2 replies; 17+ messages in thread
From: Stephen Warren @ 2014-05-07 18:19 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
This enables specifying which eMMC HW partition to target for any U-Boot
command that uses the generic get_partition() function to parse its
command-line arguments.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
disk/part.c | 6 +++++-
drivers/mmc/mmc.c | 26 ++++++++++++++++++++++++++
include/part.h | 2 ++
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/disk/part.c b/disk/part.c
index 5e10cae015e5..2827089d8d5f 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -39,7 +39,11 @@ static const struct block_drvr block_drvr[] = {
{ .name = "usb", .get_dev = usb_stor_get_dev, },
#endif
#if defined(CONFIG_MMC)
- { .name = "mmc", .get_dev = mmc_get_dev, },
+ {
+ .name = "mmc",
+ .get_dev = mmc_get_dev,
+ .select_hwpart = mmc_select_hwpart,
+ },
#endif
#if defined(CONFIG_SYSTEMACE)
{ .name = "ace", .get_dev = systemace_get_dev, },
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 16051e52ff16..3089d8d807a8 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -550,6 +550,32 @@ static int mmc_set_capacity(struct mmc *mmc, int part_num)
return 0;
}
+int mmc_select_hwpart(int dev_num, int hwpart)
+{
+ struct mmc *mmc = find_mmc_device(dev_num);
+ int ret;
+
+ if (!mmc)
+ return -1;
+
+ if (mmc->part_num == hwpart)
+ return 0;
+
+ if (mmc->part_config == MMCPART_NOAVAILABLE) {
+ printf("Card doesn't support part_switch\n");
+ return -1;
+ }
+
+ ret = mmc_switch_part(dev_num, hwpart);
+ if (ret)
+ return -1;
+
+ mmc->part_num = hwpart;
+
+ return 0;
+}
+
+
int mmc_switch_part(int dev_num, unsigned int part_num)
{
struct mmc *mmc = find_mmc_device(dev_num);
diff --git a/include/part.h b/include/part.h
index 53532dcd6120..f2c8c641faa8 100644
--- a/include/part.h
+++ b/include/part.h
@@ -103,6 +103,7 @@ block_dev_desc_t* sata_get_dev(int dev);
block_dev_desc_t* scsi_get_dev(int dev);
block_dev_desc_t* usb_stor_get_dev(int dev);
block_dev_desc_t* mmc_get_dev(int dev);
+int mmc_select_hwpart(int dev_num, int hwpart);
block_dev_desc_t* systemace_get_dev(int dev);
block_dev_desc_t* mg_disk_get_dev(int dev);
block_dev_desc_t *host_get_dev(int dev);
@@ -126,6 +127,7 @@ static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* usb_stor_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* mmc_get_dev(int dev) { return NULL; }
+static inline int mmc_select_hwpart(int dev_num, int hwpart) { return -1; }
static inline block_dev_desc_t* systemace_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t* mg_disk_get_dev(int dev) { return NULL; }
static inline block_dev_desc_t *host_get_dev(int dev) { return NULL; }
--
1.8.1.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
2014-05-07 18:19 ` [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device() Stephen Warren
@ 2014-05-07 18:22 ` Fabio Estevam
2014-05-07 18:27 ` Stephen Warren
2014-05-23 9:21 ` Pantelis Antoniou
1 sibling, 1 reply; 17+ messages in thread
From: Fabio Estevam @ 2014-05-07 18:22 UTC (permalink / raw)
To: u-boot
On Wed, May 7, 2014 at 3:19 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> +int mmc_select_hwpart(int dev_num, int hwpart)
> +{
> + struct mmc *mmc = find_mmc_device(dev_num);
> + int ret;
> +
> + if (!mmc)
> + return -1;
> +
> + if (mmc->part_num == hwpart)
> + return 0;
> +
> + if (mmc->part_config == MMCPART_NOAVAILABLE) {
> + printf("Card doesn't support part_switch\n");
> + return -1;
> + }
> +
> + ret = mmc_switch_part(dev_num, hwpart);
> + if (ret)
> + return -1;
Can't you return more appropriate return values rather than -1?
^ permalink raw reply [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
2014-05-07 18:22 ` Fabio Estevam
@ 2014-05-07 18:27 ` Stephen Warren
0 siblings, 0 replies; 17+ messages in thread
From: Stephen Warren @ 2014-05-07 18:27 UTC (permalink / raw)
To: u-boot
On 05/07/2014 12:22 PM, Fabio Estevam wrote:
> On Wed, May 7, 2014 at 3:19 PM, Stephen Warren <swarren@wwwdotorg.org> wrote:
>
>> +int mmc_select_hwpart(int dev_num, int hwpart)
...
>> + ret = mmc_switch_part(dev_num, hwpart);
>> + if (ret)
>> + return -1;
>
> Can't you return more appropriate return values rather than -1?
Oh yes, I should return ret there. I'll hold off for a while before
posting V2 though.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
2014-05-07 18:19 ` [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device() Stephen Warren
2014-05-07 18:22 ` Fabio Estevam
@ 2014-05-23 9:21 ` Pantelis Antoniou
2014-05-23 15:58 ` Stephen Warren
1 sibling, 1 reply; 17+ messages in thread
From: Pantelis Antoniou @ 2014-05-23 9:21 UTC (permalink / raw)
To: u-boot
Hi Stephen,
On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> This enables specifying which eMMC HW partition to target for any U-Boot
> command that uses the generic get_partition() function to parse its
> command-line arguments.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> disk/part.c | 6 +++++-
> drivers/mmc/mmc.c | 26 ++++++++++++++++++++++++++
> include/part.h | 2 ++
> 3 files changed, 33 insertions(+), 1 deletion(-)
>
> diff --git a/disk/part.c b/disk/part.c
> index 5e10cae015e5..2827089d8d5f 100644
> --- a/disk/part.c
> +++ b/disk/part.c
> @@ -39,7 +39,11 @@ static const struct block_drvr block_drvr[] = {
> { .name = "usb", .get_dev = usb_stor_get_dev, },
> #endif
> #if defined(CONFIG_MMC)
> - { .name = "mmc", .get_dev = mmc_get_dev, },
> + {
> + .name = "mmc",
> + .get_dev = mmc_get_dev,
> + .select_hwpart = mmc_select_hwpart,
> + },
> #endif
> #if defined(CONFIG_SYSTEMACE)
> { .name = "ace", .get_dev = systemace_get_dev, },
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 16051e52ff16..3089d8d807a8 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -550,6 +550,32 @@ static int mmc_set_capacity(struct mmc *mmc, int part_num)
> return 0;
> }
>
> +int mmc_select_hwpart(int dev_num, int hwpart)
> +{
> + struct mmc *mmc = find_mmc_device(dev_num);
> + int ret;
> +
> + if (!mmc)
> + return -1;
> +
> + if (mmc->part_num == hwpart)
> + return 0;
> +
> + if (mmc->part_config == MMCPART_NOAVAILABLE) {
> + printf("Card doesn't support part_switch\n");
> + return -1;
> + }
> +
> + ret = mmc_switch_part(dev_num, hwpart);
> + if (ret)
> + return -1;
> +
> + mmc->part_num = hwpart;
> +
> + return 0;
> +}
> +
> +
> int mmc_switch_part(int dev_num, unsigned int part_num)
> {
> struct mmc *mmc = find_mmc_device(dev_num);
> diff --git a/include/part.h b/include/part.h
> index 53532dcd6120..f2c8c641faa8 100644
> --- a/include/part.h
> +++ b/include/part.h
> @@ -103,6 +103,7 @@ block_dev_desc_t* sata_get_dev(int dev);
> block_dev_desc_t* scsi_get_dev(int dev);
> block_dev_desc_t* usb_stor_get_dev(int dev);
> block_dev_desc_t* mmc_get_dev(int dev);
> +int mmc_select_hwpart(int dev_num, int hwpart);
> block_dev_desc_t* systemace_get_dev(int dev);
> block_dev_desc_t* mg_disk_get_dev(int dev);
> block_dev_desc_t *host_get_dev(int dev);
> @@ -126,6 +127,7 @@ static inline block_dev_desc_t* sata_get_dev(int dev) { return NULL; }
> static inline block_dev_desc_t* scsi_get_dev(int dev) { return NULL; }
> static inline block_dev_desc_t* usb_stor_get_dev(int dev) { return NULL; }
> static inline block_dev_desc_t* mmc_get_dev(int dev) { return NULL; }
> +static inline int mmc_select_hwpart(int dev_num, int hwpart) { return -1; }
> static inline block_dev_desc_t* systemace_get_dev(int dev) { return NULL; }
> static inline block_dev_desc_t* mg_disk_get_dev(int dev) { return NULL; }
> static inline block_dev_desc_t *host_get_dev(int dev) { return NULL; }
> --
> 1.8.1.5
>
Applied, but expect a follow up patch for returning something else than -1.
Thanks
-- Pantelis
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
^ permalink raw reply [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
2014-05-23 9:21 ` Pantelis Antoniou
@ 2014-05-23 15:58 ` Stephen Warren
2014-05-23 16:02 ` Pantelis Antoniou
0 siblings, 1 reply; 17+ messages in thread
From: Stephen Warren @ 2014-05-23 15:58 UTC (permalink / raw)
To: u-boot
On 05/23/2014 03:21 AM, Pantelis Antoniou wrote:
> Hi Stephen,
>
> On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
>> This enables specifying which eMMC HW partition to target for any U-Boot
>> command that uses the generic get_partition() function to parse its
>> command-line arguments.
> Applied, but expect a follow up patch for returning something else than -1.
What else should it return? -1 is consistent with plenty of code in that
file...
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
2014-05-23 15:58 ` Stephen Warren
@ 2014-05-23 16:02 ` Pantelis Antoniou
0 siblings, 0 replies; 17+ messages in thread
From: Pantelis Antoniou @ 2014-05-23 16:02 UTC (permalink / raw)
To: u-boot
Hi Stephen,
On May 23, 2014, at 6:58 PM, Stephen Warren wrote:
> On 05/23/2014 03:21 AM, Pantelis Antoniou wrote:
>> Hi Stephen,
>>
>> On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
>>> This enables specifying which eMMC HW partition to target for any U-Boot
>>> command that uses the generic get_partition() function to parse its
>>> command-line arguments.
>
>> Applied, but expect a follow up patch for returning something else than -1.
>
> What else should it return? -1 is consistent with plenty of code in that
> file...
>
Some kind of -ERRNO value?
Regards
-- Pantelis
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function
2014-05-07 18:19 [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
2014-05-07 18:19 ` [U-Boot] [PATCH 2/4] disk: support devices with HW partitions Stephen Warren
2014-05-07 18:19 ` [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device() Stephen Warren
@ 2014-05-07 18:19 ` Stephen Warren
2014-05-23 9:24 ` Pantelis Antoniou
2014-05-14 17:30 ` [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
2014-05-23 9:02 ` Pantelis Antoniou
4 siblings, 1 reply; 17+ messages in thread
From: Stephen Warren @ 2014-05-07 18:19 UTC (permalink / raw)
To: u-boot
From: Stephen Warren <swarren@nvidia.com>
The implementation of mmc_select_hwpart() was cribbed from do_mmcops().
Update do_mmcops() to call mmc_select_hwpart() to avoid duplication.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
common/cmd_mmc.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index c1916c9b56a6..572aa895fa1c 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -193,7 +193,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
print_mmc_devices('\n');
return 0;
} else if (strcmp(argv[1], "dev") == 0) {
- int dev, part = -1;
+ int dev, part = -1, ret;
struct mmc *mmc;
if (argc == 2)
@@ -219,20 +219,11 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
mmc_init(mmc);
if (part != -1) {
- int ret;
- if (mmc->part_config == MMCPART_NOAVAILABLE) {
- printf("Card doesn't support part_switch\n");
+ ret = mmc_select_hwpart(dev, part);
+ printf("switch to partitions #%d, %s\n",
+ part, (!ret) ? "OK" : "ERROR");
+ if (ret)
return 1;
- }
-
- if (part != mmc->part_num) {
- ret = mmc_switch_part(dev, part);
- if (!ret)
- mmc->part_num = part;
-
- printf("switch to partitions #%d, %s\n",
- part, (!ret) ? "OK" : "ERROR");
- }
}
curr_device = dev;
if (mmc->part_config == MMCPART_NOAVAILABLE)
--
1.8.1.5
^ permalink raw reply related [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function
2014-05-07 18:19 ` [U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function Stephen Warren
@ 2014-05-23 9:24 ` Pantelis Antoniou
2014-05-23 16:45 ` Stephen Warren
0 siblings, 1 reply; 17+ messages in thread
From: Pantelis Antoniou @ 2014-05-23 9:24 UTC (permalink / raw)
To: u-boot
Hi Stephen,
On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> The implementation of mmc_select_hwpart() was cribbed from do_mmcops().
> Update do_mmcops() to call mmc_select_hwpart() to avoid duplication.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> common/cmd_mmc.c | 19 +++++--------------
> 1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
> index c1916c9b56a6..572aa895fa1c 100644
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
> @@ -193,7 +193,7 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> print_mmc_devices('\n');
> return 0;
> } else if (strcmp(argv[1], "dev") == 0) {
> - int dev, part = -1;
> + int dev, part = -1, ret;
> struct mmc *mmc;
>
> if (argc == 2)
> @@ -219,20 +219,11 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>
> mmc_init(mmc);
> if (part != -1) {
> - int ret;
> - if (mmc->part_config == MMCPART_NOAVAILABLE) {
> - printf("Card doesn't support part_switch\n");
> + ret = mmc_select_hwpart(dev, part);
> + printf("switch to partitions #%d, %s\n",
> + part, (!ret) ? "OK" : "ERROR");
> + if (ret)
> return 1;
> - }
> -
> - if (part != mmc->part_num) {
> - ret = mmc_switch_part(dev, part);
> - if (!ret)
> - mmc->part_num = part;
> -
> - printf("switch to partitions #%d, %s\n",
> - part, (!ret) ? "OK" : "ERROR");
> - }
> }
> curr_device = dev;
> if (mmc->part_config == MMCPART_NOAVAILABLE)
> --
> 1.8.1.5
>
Due to patch order mangling, I've applied but with some manual placement. Please verify that
it works properly on your end after the patches land at u-boot-mmc.
Thanks
-- Pantelis
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
^ permalink raw reply [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function
2014-05-23 9:24 ` Pantelis Antoniou
@ 2014-05-23 16:45 ` Stephen Warren
0 siblings, 0 replies; 17+ messages in thread
From: Stephen Warren @ 2014-05-23 16:45 UTC (permalink / raw)
To: u-boot
On 05/23/2014 03:24 AM, Pantelis Antoniou wrote:
> Hi Stephen,
>
> On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
>
>> From: Stephen Warren <swarren@nvidia.com>
>>
>> The implementation of mmc_select_hwpart() was cribbed from do_mmcops().
>> Update do_mmcops() to call mmc_select_hwpart() to avoid duplication.
> Due to patch order mangling, I've applied but with some manual placement. Please verify that
> it works properly on your end after the patches land at u-boot-mmc.
I think this looks fine, thanks.
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text
2014-05-07 18:19 [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
` (2 preceding siblings ...)
2014-05-07 18:19 ` [U-Boot] [PATCH 4/4] cmd_mmc: use new mmc_select_hwpart() function Stephen Warren
@ 2014-05-14 17:30 ` Stephen Warren
2014-05-14 21:17 ` Tom Rini
2014-05-23 9:02 ` Pantelis Antoniou
4 siblings, 1 reply; 17+ messages in thread
From: Stephen Warren @ 2014-05-14 17:30 UTC (permalink / raw)
To: u-boot
On 05/07/2014 12:19 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> All the sub-commands start with the main command anme, but it was
> missing from one of the help texts.
Tom, it looks like I forgot to CC you on these patches. I assume they'll
go into the main U-Boot tree. Do you need me to resend them? If not, do
they look OK?
Thanks.
^ permalink raw reply [flat|nested] 17+ messages in thread* [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text
2014-05-14 17:30 ` [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
@ 2014-05-14 21:17 ` Tom Rini
2014-05-14 21:29 ` Pantelis Antoniou
0 siblings, 1 reply; 17+ messages in thread
From: Tom Rini @ 2014-05-14 21:17 UTC (permalink / raw)
To: u-boot
On Wed, May 14, 2014 at 11:30:35AM -0600, Stephen Warren wrote:
> On 05/07/2014 12:19 PM, Stephen Warren wrote:
> > From: Stephen Warren <swarren@nvidia.com>
> >
> > All the sub-commands start with the main command anme, but it was
> > missing from one of the help texts.
>
> Tom, it looks like I forgot to CC you on these patches. I assume they'll
> go into the main U-Boot tree. Do you need me to resend them? If not, do
> they look OK?
Acked-by: Tom Rini <trini@ti.com>
I had tossed the series to Pantelis in patchwork since it's mostly MMC
related.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140514/6b644749/attachment.pgp>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text
2014-05-14 21:17 ` Tom Rini
@ 2014-05-14 21:29 ` Pantelis Antoniou
2014-05-22 23:30 ` Stephen Warren
0 siblings, 1 reply; 17+ messages in thread
From: Pantelis Antoniou @ 2014-05-14 21:29 UTC (permalink / raw)
To: u-boot
Hi Tom,
Sorry about that; It's all on my pile of work to do when I get back home.
On May 14, 2014, at 2:17 PM, Tom Rini wrote:
> On Wed, May 14, 2014 at 11:30:35AM -0600, Stephen Warren wrote:
>> On 05/07/2014 12:19 PM, Stephen Warren wrote:
>>> From: Stephen Warren <swarren@nvidia.com>
>>>
>>> All the sub-commands start with the main command anme, but it was
>>> missing from one of the help texts.
>>
>> Tom, it looks like I forgot to CC you on these patches. I assume they'll
>> go into the main U-Boot tree. Do you need me to resend them? If not, do
>> they look OK?
>
> Acked-by: Tom Rini <trini@ti.com>
>
> I had tossed the series to Pantelis in patchwork since it's mostly MMC
> related.
>
> --
> Tom
Regards
-- Pantelis
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text
2014-05-14 21:29 ` Pantelis Antoniou
@ 2014-05-22 23:30 ` Stephen Warren
0 siblings, 0 replies; 17+ messages in thread
From: Stephen Warren @ 2014-05-22 23:30 UTC (permalink / raw)
To: u-boot
On 05/14/2014 03:29 PM, Pantelis Antoniou wrote:
> Hi Tom,
>
> Sorry about that; It's all on my pile of work to do when I get back home.
Did these get applied somewhere?
>
> On May 14, 2014, at 2:17 PM, Tom Rini wrote:
>
>> On Wed, May 14, 2014 at 11:30:35AM -0600, Stephen Warren wrote:
>>> On 05/07/2014 12:19 PM, Stephen Warren wrote:
>>>> From: Stephen Warren <swarren@nvidia.com>
>>>>
>>>> All the sub-commands start with the main command anme, but it was
>>>> missing from one of the help texts.
>>>
>>> Tom, it looks like I forgot to CC you on these patches. I assume they'll
>>> go into the main U-Boot tree. Do you need me to resend them? If not, do
>>> they look OK?
>>
>> Acked-by: Tom Rini <trini@ti.com>
>>
>> I had tossed the series to Pantelis in patchwork since it's mostly MMC
>> related.
>>
>> --
>> Tom
>
> Regards
>
> -- Pantelis
>
^ permalink raw reply [flat|nested] 17+ messages in thread
* [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text
2014-05-07 18:19 [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
` (3 preceding siblings ...)
2014-05-14 17:30 ` [U-Boot] [PATCH 1/4] cmd_part: fix type in part command help text Stephen Warren
@ 2014-05-23 9:02 ` Pantelis Antoniou
4 siblings, 0 replies; 17+ messages in thread
From: Pantelis Antoniou @ 2014-05-23 9:02 UTC (permalink / raw)
To: u-boot
Hi Stephen,
On May 7, 2014, at 9:19 PM, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia.com>
>
> All the sub-commands start with the main command anme, but it was
anme=name
> missing from one of the help texts.
>
> Signed-off-by: Stephen Warren <swarren@nvidia.com>
> ---
> common/cmd_part.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/cmd_part.c b/common/cmd_part.c
> index 14248548d9fe..c84bc27b4042 100644
> --- a/common/cmd_part.c
> +++ b/common/cmd_part.c
> @@ -82,7 +82,7 @@ int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> U_BOOT_CMD(
> part, 5, 1, do_part,
> "disk partition related commands",
> - "uuid <interface> <dev>:<part>\n"
> + "part uuid <interface> <dev>:<part>\n"
> " - print partition UUID\n"
> "part uuid <interface> <dev>:<part> <varname>\n"
> " - set environment variable to partition UUID\n"
> --
> 1.8.1.5
>
Fixed typos and applied.
Thanks
-- Pantelis
Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>
^ permalink raw reply [flat|nested] 17+ messages in thread