summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2015-01-11 17:17:00 +0100
committerHans de Goede <hdegoede@redhat.com>2015-01-22 12:34:56 +0100
commit1a800f7af3ef5f42ff703fd4b313b79e471f6ced (patch)
tree81f65ef00e29291c33933c42387323b550ddfe74 /board
parentea87948f1ac904f482fdcefc1b428961efb4dcc7 (diff)
downloadu-boot-imx-1a800f7af3ef5f42ff703fd4b313b79e471f6ced.zip
u-boot-imx-1a800f7af3ef5f42ff703fd4b313b79e471f6ced.tar.gz
u-boot-imx-1a800f7af3ef5f42ff703fd4b313b79e471f6ced.tar.bz2
sunxi: Hookup OTG USB controller support
Hookup OTG USB controller support and enable the otg controller + USB-keyb on various tablets. This allows tablet owners to interact with u-boot without needing to solder a serial console onto their tablet PCB. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk>
Diffstat (limited to 'board')
-rw-r--r--board/sunxi/Kconfig9
-rw-r--r--board/sunxi/board.c25
2 files changed, 34 insertions, 0 deletions
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index cea356c..f1501d4 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -357,6 +357,15 @@ config VIDEO_LCD_PANEL_MIPI_4_LANE_513_MBPS_VIA_SSD2828
endchoice
+config USB_MUSB_SUNXI
+ bool "Enable sunxi OTG / DRC USB controller in host mode"
+ default n
+ ---help---
+ Say y here to enable support for the sunxi OTG / DRC USB controller
+ used on almost all sunxi boards. Note currently u-boot can only have
+ one usb host controller enabled at a time, so enabling this on boards
+ which also use the ehci host controller will result in build errors.
+
config USB_KEYBOARD
boolean "Enable USB keyboard support"
default y
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 6b19f75..b70e00c 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -28,7 +28,9 @@
#include <asm/arch/dram.h>
#include <asm/arch/gpio.h>
#include <asm/arch/mmc.h>
+#include <asm/arch/usbc.h>
#include <asm/io.h>
+#include <linux/usb/musb.h>
#include <net.h>
DECLARE_GLOBAL_DATA_PTR;
@@ -209,6 +211,26 @@ void sunxi_board_init(void)
}
#endif
+#if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET)
+static struct musb_hdrc_config musb_config = {
+ .multipoint = 1,
+ .dyn_fifo = 1,
+ .num_eps = 6,
+ .ram_bits = 11,
+};
+
+static struct musb_hdrc_platform_data musb_plat = {
+#if defined(CONFIG_MUSB_HOST)
+ .mode = MUSB_HOST,
+#else
+ .mode = MUSB_PERIPHERAL,
+#endif
+ .config = &musb_config,
+ .power = 250,
+ .platform_ops = &sunxi_musb_ops,
+};
+#endif
+
#ifdef CONFIG_MISC_INIT_R
int misc_init_r(void)
{
@@ -228,6 +250,9 @@ int misc_init_r(void)
eth_setenv_enetaddr("ethaddr", mac_addr);
}
+#if defined(CONFIG_MUSB_HOST) || defined(CONFIG_MUSB_GADGET)
+ musb_register(&musb_plat, NULL, (void *)SUNXI_USB0_BASE);
+#endif
return 0;
}
#endif