mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-17 12:41:32 +00:00
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>
This commit is contained in:
parent
a6331fa83c
commit
57ebf67bad
8 changed files with 14 additions and 29 deletions
|
@ -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;
|
||||
}
|
||||
|
|
16
cmd/usb.c
16
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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(".");
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue