aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2016-05-01 11:36:13 -0600
committerSimon Glass2016-05-17 09:54:43 -0600
commit57ebf67bad82da0b3ade1728fb39a64d1c29822f (patch)
treed1d11a85ed37eec6e51d4afaf3c65cf3012c2a83
parenta6331fa83cb4a1557df4acfa4214d556f4596904 (diff)
dm: usb: Drop the get_dev() function
This function is implemented by the legacy block functions now. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
-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 2ed90de9d52..4740c8394c5 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 f1a7debdf3d..b83d3233b78 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 c42848e6fc8..04fa66758cb 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 80bf3db5d0c..f2da3a3cadc 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 f055c74aa84..1b33928cc5a 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 6900097e799..696b3ac51b3 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 e3811c68de8..f2069109707 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 5adad368380..02a0ccdd77b 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);