projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
OMAP3: igep00x0: Fix boot hang and add support for status LED.
[oweals/u-boot.git]
/
common
/
cmd_usb_mass_storage.c
diff --git
a/common/cmd_usb_mass_storage.c
b/common/cmd_usb_mass_storage.c
index 9888ed4f17563face2a0233d343a236b834f809d..2c879ea0837c5e13e69fb60333bb921e68b2d991 100644
(file)
--- a/
common/cmd_usb_mass_storage.c
+++ b/
common/cmd_usb_mass_storage.c
@@
-9,7
+9,6
@@
#include <common.h>
#include <command.h>
#include <g_dnl.h>
#include <common.h>
#include <command.h>
#include <g_dnl.h>
-#include <mmc.h>
#include <part.h>
#include <usb.h>
#include <usb_mass_storage.h>
#include <part.h>
#include <usb.h>
#include <usb_mass_storage.h>
@@
-40,17
+39,22
@@
static struct ums ums_dev = {
.name = "UMS disk",
};
.name = "UMS disk",
};
-struct ums *ums_init(
unsigned int dev_
num)
+struct ums *ums_init(
const char *devtype, const char *dev
num)
{
{
- struct mmc *mmc = NULL;
+ block_dev_desc_t *block_dev;
+ int ret;
-
mmc = find_mmc_device(dev_num
);
- if (
!mmc || mmc_init(mmc)
)
+
ret = get_device(devtype, devnum, &block_dev
);
+ if (
ret < 0
)
return NULL;
return NULL;
- ums_dev.block_dev = &mmc->block_dev;
+ /* f_mass_storage.c assumes SECTOR_SIZE sectors */
+ if (block_dev->blksz != SECTOR_SIZE)
+ return NULL;
+
+ ums_dev.block_dev = block_dev;
ums_dev.start_sector = 0;
ums_dev.start_sector = 0;
- ums_dev.num_sectors =
mmc->capacity / SECTOR_SIZE
;
+ ums_dev.num_sectors =
block_dev->lba
;
printf("UMS: disk start sector: %#x, count: %#x\n",
ums_dev.start_sector, ums_dev.num_sectors);
printf("UMS: disk start sector: %#x, count: %#x\n",
ums_dev.start_sector, ums_dev.num_sectors);
@@
-61,26
+65,38
@@
struct ums *ums_init(unsigned int dev_num)
int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
{
+ const char *usb_controller;
+ const char *devtype;
+ const char *devnum;
+ struct ums *ums;
+ unsigned int controller_index;
+ int rc;
+ int cable_ready_timeout __maybe_unused;
+
if (argc < 3)
return CMD_RET_USAGE;
if (argc < 3)
return CMD_RET_USAGE;
- const char *usb_controller = argv[1];
- const char *mmc_devstring = argv[2];
-
- unsigned int dev_num = simple_strtoul(mmc_devstring, NULL, 0);
+ usb_controller = argv[1];
+ if (argc >= 4) {
+ devtype = argv[2];
+ devnum = argv[3];
+ } else {
+ devtype = "mmc";
+ devnum = argv[2];
+ }
-
struct ums *ums = ums_init(dev_
num);
+
ums = ums_init(devtype, dev
num);
if (!ums)
return CMD_RET_FAILURE;
if (!ums)
return CMD_RET_FAILURE;
-
unsigned int
controller_index = (unsigned int)(simple_strtoul(
-
usb_controller, NULL, 0));
+ controller_index = (unsigned int)(simple_strtoul(
+ usb_controller, NULL, 0));
if (board_usb_init(controller_index, USB_INIT_DEVICE)) {
error("Couldn't init USB controller.");
return CMD_RET_FAILURE;
}
if (board_usb_init(controller_index, USB_INIT_DEVICE)) {
error("Couldn't init USB controller.");
return CMD_RET_FAILURE;
}
-
int
rc = fsg_init(ums);
+ rc = fsg_init(ums);
if (rc) {
error("fsg_init failed");
return CMD_RET_FAILURE;
if (rc) {
error("fsg_init failed");
return CMD_RET_FAILURE;
@@
-93,7
+109,7
@@
int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
}
/* Timeout unit: seconds */
}
/* Timeout unit: seconds */
-
int
cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
+ cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
if (!g_dnl_board_usb_cable_connected()) {
/*
if (!g_dnl_board_usb_cable_connected()) {
/*
@@
-141,7
+157,8
@@
exit:
return CMD_RET_SUCCESS;
}
return CMD_RET_SUCCESS;
}
-U_BOOT_CMD(ums,
CONFIG_SYS_MAXARGS
, 1, do_usb_mass_storage,
+U_BOOT_CMD(ums,
4
, 1, do_usb_mass_storage,
"Use the UMS [User Mass Storage]",
"Use the UMS [User Mass Storage]",
- "ums <USB_controller> <mmc_dev> e.g. ums 0 0"
+ "ums <USB_controller> [<devtype>] <devnum> e.g. ums 0 mmc 0\n"
+ " devtype defaults to mmc"
);
);