[U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init()
Mateusz Zalega
m.zalega at samsung.com
Mon Mar 31 17:49:11 CEST 2014
In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.
Tested on Samsung Goni.
Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
Signed-off-by: Mateusz Zalega <m.zalega at samsung.com>
Tested-by: Mateusz Zalega <m.zalega at samsung.com>
Cc: Lukasz Majewski <l.majewski at samsung.com>
Cc: Minkyu Kang <mk7.kang at samsung.com>
---
board/samsung/common/ums.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..1375138 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -35,10 +35,10 @@ static struct ums ums_dev = {
.name = "UMS disk",
};
-static struct ums *ums_disk_init(struct mmc *mmc)
+static struct ums *ums_disk_init(const struct mmc *mmc)
{
- uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
- uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+ const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
+ const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
if (!mmc_end_sector) {
error("MMC capacity is not valid");
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
struct ums *ums_init(unsigned int dev_num)
{
- struct mmc *mmc = NULL;
+ struct mmc *mmc = find_mmc_device(dev_num);
- mmc = find_mmc_device(dev_num);
- if (!mmc)
+ if (!mmc || mmc_init(mmc))
return NULL;
-
return ums_disk_init(mmc);
}
--
1.9.0
More information about the U-Boot
mailing list