]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: usb: Drop the get_dev() function
authorSimon Glass <sjg@chromium.org>
Sun, 1 May 2016 17:36:13 +0000 (11:36 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 17 May 2016 15:54:43 +0000 (09:54 -0600)
This function is implemented by the legacy block functions now. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
board/cm5200/fwupdate.c
cmd/usb.c
common/spl/spl_usb.c
common/usb_storage.c
disk/part.c
drivers/Makefile
include/part.h
include/usb.h

index 2ed90de9d529d41c01bafec0c6ec92407eb97729..4740c8394c5fa699088c2316df10e11f4ea06597 100644 (file)
@@ -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;
        }
index f1a7debdf3d918f0ca5c23dc94efbc0e956b647d..b83d3233b789fffb49599ce2c9cf63abcc21112e 100644 (file)
--- 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;
index c42848e6fc84800bc2a5f49e3380af37b16a924f..04fa66758cbc0255da1fa97632dd655aeb1dd918 100644 (file)
@@ -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
index 80bf3db5d0c46f46782603f249f4c93891c65800..f2da3a3cadcd7b687d03390d5927e7444e200d3a 100644 (file)
@@ -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(".");
index f055c74aa84b8bb62825f39032935820a36d1aba..1b33928cc5a1f9ca799174262096e89350b11c16 100644 (file)
@@ -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)
        {
index 6900097e79986785d3d6f1e4691f9614780073ff..696b3ac51b32de8bb82643985a1399e6e87c7f30 100644 (file)
@@ -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
 
index e3811c68de8a31c3bf3daddad1d87f9e3187334a..f20691097071ebd62bfe89f74b0499e7c6e828eb 100644 (file)
@@ -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; }
index 5adad368380897eadae2ac6d39b7934aefa1bd82..02a0ccdd77b370b4bd62d858a2c797e926fd03f2 100644 (file)
@@ -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);