* [U-Boot] [PATCH v4] mmc-uclass: correct the device number
@ 2016-07-22 9:22 Kever Yang
2016-07-23 2:08 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Kever Yang @ 2016-07-22 9:22 UTC (permalink / raw)
To: u-boot
Not like the mmc-legacy which the devnum starts from 1, it starts from 0
in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num().
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
---
Changes in v4:
- call blk_find_max_devnum() in mmc_get_next_devnum for error return.
Changes in v3:
- apply comments from Jaehoon Chung
Changes in v2:
- add comment for get_mmc_num() in mmc.h
- update mmc_get_next_devnum()
drivers/mmc/mmc-uclass.c | 6 +++---
include/mmc.h | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index 38ced41..f262c6e 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -111,18 +111,18 @@ struct mmc *find_mmc_device(int dev_num)
int get_mmc_num(void)
{
- return max(blk_find_max_devnum(IF_TYPE_MMC), 0);
+ return max((blk_find_max_devnum(IF_TYPE_MMC) + 1), 0);
}
int mmc_get_next_devnum(void)
{
int ret;
- ret = get_mmc_num();
+ ret = blk_find_max_devnum(IF_TYPE_MMC);
if (ret < 0)
return ret;
- return ret + 1;
+ return ret;
}
struct blk_desc *mmc_get_blk_desc(struct mmc *mmc)
diff --git a/include/mmc.h b/include/mmc.h
index 8f309f1..dd47f34 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -503,6 +503,12 @@ void mmc_set_clock(struct mmc *mmc, uint clock);
struct mmc *find_mmc_device(int dev_num);
int mmc_set_dev(int dev_num);
void print_mmc_devices(char separator);
+
+/**
+ * get_mmc_num() - get the total MMC device number
+ *
+ * @return 0 if there is no MMC device, else the number of devices
+ */
int get_mmc_num(void);
int mmc_hwpart_config(struct mmc *mmc, const struct mmc_hwpart_conf *conf,
enum mmc_hwpart_conf_mode mode);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v4] mmc-uclass: correct the device number
2016-07-22 9:22 [U-Boot] [PATCH v4] mmc-uclass: correct the device number Kever Yang
@ 2016-07-23 2:08 ` Simon Glass
2016-07-25 5:11 ` Jaehoon Chung
0 siblings, 1 reply; 4+ messages in thread
From: Simon Glass @ 2016-07-23 2:08 UTC (permalink / raw)
To: u-boot
On 22 July 2016 at 03:22, Kever Yang <kever.yang@rock-chips.com> wrote:
> Not like the mmc-legacy which the devnum starts from 1, it starts from 0
> in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num().
>
> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
> ---
>
> Changes in v4:
> - call blk_find_max_devnum() in mmc_get_next_devnum for error return.
>
> Changes in v3:
> - apply comments from Jaehoon Chung
>
> Changes in v2:
> - add comment for get_mmc_num() in mmc.h
> - update mmc_get_next_devnum()
>
> drivers/mmc/mmc-uclass.c | 6 +++---
> include/mmc.h | 6 ++++++
> 2 files changed, 9 insertions(+), 3 deletions(-)
Acked-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v4] mmc-uclass: correct the device number
2016-07-23 2:08 ` Simon Glass
@ 2016-07-25 5:11 ` Jaehoon Chung
2016-07-28 3:33 ` Simon Glass
0 siblings, 1 reply; 4+ messages in thread
From: Jaehoon Chung @ 2016-07-25 5:11 UTC (permalink / raw)
To: u-boot
On 07/23/2016 11:08 AM, Simon Glass wrote:
> On 22 July 2016 at 03:22, Kever Yang <kever.yang@rock-chips.com> wrote:
>> Not like the mmc-legacy which the devnum starts from 1, it starts from 0
>> in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num().
>>
>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>> ---
>>
>> Changes in v4:
>> - call blk_find_max_devnum() in mmc_get_next_devnum for error return.
>>
>> Changes in v3:
>> - apply comments from Jaehoon Chung
>>
>> Changes in v2:
>> - add comment for get_mmc_num() in mmc.h
>> - update mmc_get_next_devnum()
>>
>> drivers/mmc/mmc-uclass.c | 6 +++---
>> include/mmc.h | 6 ++++++
>> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> Acked-by: Simon Glass <sjg@chromium.org>
>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v4] mmc-uclass: correct the device number
2016-07-25 5:11 ` Jaehoon Chung
@ 2016-07-28 3:33 ` Simon Glass
0 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2016-07-28 3:33 UTC (permalink / raw)
To: u-boot
On 24 July 2016 at 23:11, Jaehoon Chung <jh80.chung@samsung.com> wrote:
> On 07/23/2016 11:08 AM, Simon Glass wrote:
>> On 22 July 2016 at 03:22, Kever Yang <kever.yang@rock-chips.com> wrote:
>>> Not like the mmc-legacy which the devnum starts from 1, it starts from 0
>>> in mmc-uclass, so the device number should be (devnum + 1) in get_mmc_num().
>>>
>>> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
>>> ---
>>>
>>> Changes in v4:
>>> - call blk_find_max_devnum() in mmc_get_next_devnum for error return.
>>>
>>> Changes in v3:
>>> - apply comments from Jaehoon Chung
>>>
>>> Changes in v2:
>>> - add comment for get_mmc_num() in mmc.h
>>> - update mmc_get_next_devnum()
>>>
>>> drivers/mmc/mmc-uclass.c | 6 +++---
>>> include/mmc.h | 6 ++++++
>>> 2 files changed, 9 insertions(+), 3 deletions(-)
>>
>> Acked-by: Simon Glass <sjg@chromium.org>
>>
>
> Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
>
>>
>>
>
Applied to u-boot-rockchip, thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-28 3:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-22 9:22 [U-Boot] [PATCH v4] mmc-uclass: correct the device number Kever Yang
2016-07-23 2:08 ` Simon Glass
2016-07-25 5:11 ` Jaehoon Chung
2016-07-28 3:33 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.