Re: [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
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... ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
Hi Stephen, On May 7, 2014, at 9:19 PM, Stephen Warren wrote: > From: Stephen Warren > > 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 > --- > 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
On 05/07/2014 12:22 PM, Fabio Estevam wrote: > On Wed, May 7, 2014 at 3:19 PM, Stephen Warren 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. ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
Re: [U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
On Wed, May 7, 2014 at 3:19 PM, Stephen Warren 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? ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
[U-Boot] [PATCH 3/4] mmc: provide a select_hwpart implementation for get_device()
From: Stephen Warren 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 --- 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 ___ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot