summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/cm5200/fwupdate.c2
-rw-r--r--cmd/usb.c16
-rw-r--r--common/spl/spl_usb.c2
-rw-r--r--common/usb_storage.c17
-rw-r--r--disk/part.c2
-rw-r--r--drivers/Makefile1
-rw-r--r--include/part.h2
-rw-r--r--include/usb.h1
8 files changed, 14 insertions, 29 deletions
diff --git a/board/cm5200/fwupdate.c b/board/cm5200/fwupdate.c
index 2ed90de9d5..4740c8394c 100644
--- a/board/cm5200/fwupdate.c
+++ b/board/cm5200/fwupdate.c
@@ -105,7 +105,7 @@ static int load_rescue_image(ulong addr)
/* Detect storage device */
for (devno = 0; devno < USB_MAX_STOR_DEV; devno++) {
- stor_dev = usb_stor_get_dev(devno);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB, devno);
if (stor_dev->type != DEV_TYPE_UNKNOWN)
break;
}
diff --git a/cmd/usb.c b/cmd/usb.c
index f1a7debdf3..b83d3233b7 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -723,7 +723,8 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
int devno, ok = 0;
if (argc == 2) {
for (devno = 0; ; ++devno) {
- stor_dev = usb_stor_get_dev(devno);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB,
+ devno);
if (stor_dev == NULL)
break;
if (stor_dev->type != DEV_TYPE_UNKNOWN) {
@@ -736,7 +737,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
}
} else {
devno = simple_strtoul(argv[2], NULL, 16);
- stor_dev = usb_stor_get_dev(devno);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB, devno);
if (stor_dev != NULL &&
stor_dev->type != DEV_TYPE_UNKNOWN) {
ok++;
@@ -762,7 +763,8 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned long n;
printf("\nUSB read: device %d block # %ld, count %ld"
" ... ", usb_stor_curr_dev, blk, cnt);
- stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB,
+ usb_stor_curr_dev);
n = blk_dread(stor_dev, blk, cnt, (ulong *)addr);
printf("%ld blocks read: %s\n", n,
(n == cnt) ? "OK" : "ERROR");
@@ -783,7 +785,8 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
unsigned long n;
printf("\nUSB write: device %d block # %ld, count %ld"
" ... ", usb_stor_curr_dev, blk, cnt);
- stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB,
+ usb_stor_curr_dev);
n = blk_dwrite(stor_dev, blk, cnt, (ulong *)addr);
printf("%ld blocks write: %s\n", n,
(n == cnt) ? "OK" : "ERROR");
@@ -796,7 +799,7 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
if (argc == 3) {
int dev = (int)simple_strtoul(argv[2], NULL, 10);
printf("\nUSB device %d: ", dev);
- stor_dev = usb_stor_get_dev(dev);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB, dev);
if (stor_dev == NULL) {
printf("unknown device\n");
return 1;
@@ -810,7 +813,8 @@ static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return 0;
} else {
printf("\nUSB device %d: ", usb_stor_curr_dev);
- stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB,
+ usb_stor_curr_dev);
dev_print(stor_dev);
if (stor_dev->type == DEV_TYPE_UNKNOWN)
return 1;
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c
index c42848e6fc..04fa66758c 100644
--- a/common/spl/spl_usb.c
+++ b/common/spl/spl_usb.c
@@ -39,7 +39,7 @@ int spl_usb_load_image(void)
#ifdef CONFIG_USB_STORAGE
/* try to recognize storage devices immediately */
usb_stor_curr_dev = usb_stor_scan(1);
- stor_dev = usb_stor_get_dev(usb_stor_curr_dev);
+ stor_dev = blk_get_devnum_by_type(IF_TYPE_USB, usb_stor_curr_dev);
if (!stor_dev)
return -ENODEV;
#endif
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 80bf3db5d0..f2da3a3cad 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -136,23 +136,6 @@ static unsigned long usb_stor_write(struct blk_desc *block_dev, lbaint_t blknr,
#endif
void uhci_show_temp_int_td(void);
-#ifdef CONFIG_PARTITIONS
-struct blk_desc *usb_stor_get_dev(int index)
-{
-#ifdef CONFIG_BLK
- struct udevice *dev;
- int ret;
-
- ret = blk_get_device(IF_TYPE_USB, index, &dev);
- if (ret)
- return NULL;
- return dev_get_uclass_platdata(dev);
-#else
- return (index < usb_max_devs) ? &usb_dev_desc[index] : NULL;
-#endif
-}
-#endif
-
static void usb_show_progress(void)
{
debug(".");
diff --git a/disk/part.c b/disk/part.c
index f055c74aa8..1b33928cc5 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -32,7 +32,7 @@ const struct block_drvr block_drvr[] = {
{ .name = "scsi", .get_dev = scsi_get_dev, },
#endif
#if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
- { .name = "usb", .get_dev = usb_stor_get_dev, },
+ { .name = "usb", },
#endif
#if defined(CONFIG_MMC)
{
diff --git a/drivers/Makefile b/drivers/Makefile
index 6900097e79..696b3ac51b 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -36,6 +36,7 @@ obj-$(CONFIG_SPL_WATCHDOG_SUPPORT) += watchdog/
obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += usb/host/
obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
obj-$(CONFIG_SPL_SATA_SUPPORT) += block/
+obj-$(CONFIG_SPL_USB_HOST_SUPPORT) += block/
else
diff --git a/include/part.h b/include/part.h
index e3811c68de..f206910970 100644
--- a/include/part.h
+++ b/include/part.h
@@ -76,7 +76,6 @@ struct blk_desc *blk_get_dev(const char *ifname, int dev);
struct blk_desc *ide_get_dev(int dev);
struct blk_desc *sata_get_dev(int dev);
struct blk_desc *scsi_get_dev(int dev);
-struct blk_desc *usb_stor_get_dev(int dev);
struct blk_desc *mmc_get_dev(int dev);
/**
@@ -178,7 +177,6 @@ static inline struct blk_desc *blk_get_dev(const char *ifname, int dev)
static inline struct blk_desc *ide_get_dev(int dev) { return NULL; }
static inline struct blk_desc *sata_get_dev(int dev) { return NULL; }
static inline struct blk_desc *scsi_get_dev(int dev) { return NULL; }
-static inline struct blk_desc *usb_stor_get_dev(int dev) { return NULL; }
static inline struct blk_desc *mmc_get_dev(int dev) { return NULL; }
static inline int mmc_select_hwpart(int dev_num, int hwpart) { return -1; }
static inline struct blk_desc *systemace_get_dev(int dev) { return NULL; }
diff --git a/include/usb.h b/include/usb.h
index 5adad36838..02a0ccdd77 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -228,7 +228,6 @@ int board_usb_cleanup(int index, enum usb_init_type init);
#ifdef CONFIG_USB_STORAGE
#define USB_MAX_STOR_DEV 7
-struct blk_desc *usb_stor_get_dev(int index);
int usb_stor_scan(int mode);
int usb_stor_info(void);