summaryrefslogtreecommitdiff
path: root/include/usb.h
diff options
context:
space:
mode:
authorMateusz Zalega <m.zalega@samsung.com>2013-10-04 19:22:26 +0200
committerMarek Vasut <marex@denx.de>2013-10-20 23:42:40 +0200
commit16297cfb2a20c9d89834cd9e31edac5184a777a1 (patch)
treef75f4bccfd6ef79f4953c02f73c5245bc1bdb34d /include/usb.h
parentf3d7cff55951e0b47bad150bf5c329bd577e2ce5 (diff)
downloadu-boot-imx-16297cfb2a20c9d89834cd9e31edac5184a777a1.zip
u-boot-imx-16297cfb2a20c9d89834cd9e31edac5184a777a1.tar.gz
u-boot-imx-16297cfb2a20c9d89834cd9e31edac5184a777a1.tar.bz2
usb: new board-specific USB init interface
This commit unifies board-specific USB initialization implementations under one symbol (usb_board_init), declaration of which is available in usb.h. New API allows selective initialization of USB controllers whenever needed. Signed-off-by: Mateusz Zalega <m.zalega@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Cc: Marek Vasut <marex@denx.de> Cc: Lukasz Majewski <l.majewski@samsung.com>
Diffstat (limited to 'include/usb.h')
-rw-r--r--include/usb.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/include/usb.h b/include/usb.h
index a96ec23..17fb68c 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -167,10 +167,36 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
extern void udc_disconnect(void);
-#else
-#error USB Lowlevel not defined
#endif
+/*
+ * You can initialize platform's USB host or device
+ * ports by passing this enum as an argument to
+ * board_usb_init().
+ */
+enum board_usb_init_type {
+ USB_INIT_HOST,
+ USB_INIT_DEVICE
+};
+
+/*
+ * board-specific hardware initialization, called by
+ * usb drivers and u-boot commands
+ *
+ * @param index USB controller number
+ * @param init initializes controller as USB host or device
+ */
+int board_usb_init(int index, enum board_usb_init_type init);
+
+/*
+ * can be used to clean up after failed USB initialization attempt
+ * vide: board_usb_init()
+ *
+ * @param index USB controller number for selective cleanup
+ * @param init board_usb_init_type passed to board_usb_init()
+ */
+int board_usb_cleanup(int index, enum board_usb_init_type init);
+
#ifdef CONFIG_USB_STORAGE
#define USB_MAX_STOR_DEV 5