diff options
-rw-r--r-- | payloads/libpayload/Config.in | 23 | ||||
-rw-r--r-- | payloads/libpayload/configs/defconfig | 1 | ||||
-rw-r--r-- | payloads/libpayload/drivers/usb/usbinit.c | 39 | ||||
-rw-r--r-- | payloads/libpayload/include/usb/usb.h | 1 |
4 files changed, 24 insertions, 40 deletions
diff --git a/payloads/libpayload/Config.in b/payloads/libpayload/Config.in index ae90285943..f28f9b874e 100644 --- a/payloads/libpayload/Config.in +++ b/payloads/libpayload/Config.in @@ -378,30 +378,11 @@ config USB_GEN_HUB default n if (!USB_HUB && !USB_XHCI) default y if (USB_HUB || USB_XHCI) config USB_PCI - bool + bool "Auto-scan PCI bus for USB host controllers" + depends on USB default y if ARCH_X86 default n -config USB_MEMORY - bool - default y if ARCH_ARMV7 - default n - -config USB_OHCI_BASE_ADDRESS - hex - depends on USB_MEMORY && USB_OHCI - default 0x12120000 - -config USB_EHCI_BASE_ADDRESS - hex - depends on USB_MEMORY && USB_EHCI - default 0x12110000 - -config USB_XHCI_BASE_ADDRESS - hex - depends on USB_MEMORY && USB_XHCI - default 0x12000000 - endmenu menu "Debugging" diff --git a/payloads/libpayload/configs/defconfig b/payloads/libpayload/configs/defconfig index c4e0d15f2d..5804ed8985 100644 --- a/payloads/libpayload/configs/defconfig +++ b/payloads/libpayload/configs/defconfig @@ -71,7 +71,6 @@ CONFIG_LP_USB_HUB=y CONFIG_LP_USB_MSC=y CONFIG_LP_USB_GEN_HUB=y CONFIG_LP_USB_PCI=y -# CONFIG_LP_USB_MEMORY is not set # CONFIG_LP_BIG_ENDIAN is not set CONFIG_LP_LITTLE_ENDIAN=y CONFIG_LP_IO_ADDRESS_SPACE=y diff --git a/payloads/libpayload/drivers/usb/usbinit.c b/payloads/libpayload/drivers/usb/usbinit.c index 90c31d7ef5..1710760c87 100644 --- a/payloads/libpayload/drivers/usb/usbinit.c +++ b/payloads/libpayload/drivers/usb/usbinit.c @@ -156,21 +156,6 @@ static void usb_scan_pci_bus(int bus) } #endif -#ifdef CONFIG_LP_USB_MEMORY -static void usb_scan_memory(void) -{ -#ifdef CONFIG_LP_USB_XHCI - xhci_init(CONFIG_LP_USB_XHCI_BASE_ADDRESS); -#endif -#ifdef CONFIG_LP_USB_EHCI - ehci_init(CONFIG_LP_USB_EHCI_BASE_ADDRESS); -#endif -#ifdef CONFIG_LP_USB_OHCI - ohci_init(CONFIG_LP_USB_OHCI_BASE_ADDRESS); -#endif -} -#endif - /** * Initialize all USB controllers attached to PCI. */ @@ -179,8 +164,26 @@ int usb_initialize(void) #ifdef CONFIG_LP_USB_PCI usb_scan_pci_bus(0); #endif -#ifdef CONFIG_LP_USB_MEMORY - usb_scan_memory(); -#endif return 0; } + +hci_t *usb_add_mmio_hc(hc_type type, void *bar) +{ + switch (type) { +#ifdef CONFIG_LP_USB_OHCI + case OHCI: + return ohci_init(bar); +#endif +#ifdef CONFIG_LP_USB_EHCI + case EHCI: + return ehci_init(bar); +#endif +#ifdef CONFIG_LP_USB_XHCI + case XHCI: + return xhci_init(bar); +#endif + default: + usb_debug("HC type %d (at %p) is not supported!\n", type, bar); + return NULL; + } +} diff --git a/payloads/libpayload/include/usb/usb.h b/payloads/libpayload/include/usb/usb.h index 0bfbc20327..2bf1993b82 100644 --- a/payloads/libpayload/include/usb/usb.h +++ b/payloads/libpayload/include/usb/usb.h @@ -240,6 +240,7 @@ typedef struct { unsigned short wReportDescriptorLength; } __attribute__ ((packed)) hid_descriptor_t; +hci_t *usb_add_mmio_hc(hc_type type, void *bar); hci_t *new_controller (void); void detach_controller (hci_t *controller); void usb_poll (void); |