mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-05 14:31:31 +00:00
USB: Enable finer grain control over init process
Previously enabling USB would automatically (using an init hook) initialize the USB peripheral. This would take over the GPIO lines assigned to the USB module. This is not OK on Ryu for Case Closed Debug because it interferes with the AP's access to the USB 2.0 lines even when not in Case Close Debug mode. This change adds a configuration option to inhibit this default initialization of the USB peripheral. It also renames the existing CONFIG_USB_INHIBIT to CONFIG_USB_INHIBIT_CONNECT now that there are two possible inhibitions. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable console on ryu_p2 and discovery-stm32f072 board Verify that it works on both Change-Id: I6734357131b4356e3d4164349d6c74deac196ce5 Reviewed-on: https://chromium-review.googlesource.com/229138 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
This commit is contained in:
committed by
chrome-internal-fetch
parent
4340685cf9
commit
079742b1ff
@@ -21,7 +21,7 @@
|
||||
#define CONFIG_HW_CRC
|
||||
#define CONFIG_USB
|
||||
#define CONFIG_USB_BOS
|
||||
#define CONFIG_USB_INHIBIT
|
||||
#define CONFIG_USB_INHIBIT_CONNECT
|
||||
#define CONFIG_USB_POWER_DELIVERY
|
||||
#define CONFIG_USB_PD_ALT_MODE
|
||||
#define CONFIG_USB_PD_DUAL_ROLE
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#define CONFIG_SPI_CS_GPIO GPIO_PD_MCDP_SPI_CS_L
|
||||
#define CONFIG_USB
|
||||
#define CONFIG_USB_BOS
|
||||
#define CONFIG_USB_INHIBIT
|
||||
#define CONFIG_USB_INHIBIT_CONNECT
|
||||
#define CONFIG_USB_POWER_DELIVERY
|
||||
#define CONFIG_USB_PD_ALT_MODE
|
||||
#define CONFIG_USB_PD_DUAL_ROLE
|
||||
|
||||
@@ -295,13 +295,16 @@ void usb_init(void)
|
||||
/* set interrupts mask : reset/correct tranfer/errors */
|
||||
STM32_USB_CNTR = 0xe400;
|
||||
|
||||
#ifndef CONFIG_USB_INHIBIT
|
||||
#ifndef CONFIG_USB_INHIBIT_CONNECT
|
||||
usb_connect();
|
||||
#endif
|
||||
|
||||
CPRINTF("USB init done\n");
|
||||
}
|
||||
|
||||
#ifndef CONFIG_USB_INHIBIT_INIT
|
||||
DECLARE_HOOK(HOOK_INIT, usb_init, HOOK_PRIO_DEFAULT);
|
||||
#endif
|
||||
|
||||
void usb_release(void)
|
||||
{
|
||||
|
||||
@@ -1129,8 +1129,11 @@
|
||||
/* Compile chip support for the USB device controller */
|
||||
#undef CONFIG_USB
|
||||
|
||||
/* Disable automatic connection of USB peripheral */
|
||||
#undef CONFIG_USB_INHIBIT_CONNECT
|
||||
|
||||
/* Disable automatic initialization of USB peripheral */
|
||||
#undef CONFIG_USB_INHIBIT
|
||||
#undef CONFIG_USB_INHIBIT_INIT
|
||||
|
||||
/* Support simple control of power to the device's USB ports */
|
||||
#undef CONFIG_USB_PORT_POWER_DUMB
|
||||
|
||||
@@ -14,9 +14,10 @@
|
||||
|
||||
/*
|
||||
* Initialize the USB peripheral, enabling its clock and configuring the DP/DN
|
||||
* GPIOs correctly. This function is called via an init hook, but may need to
|
||||
* be called again if usb_release is called. This function will call
|
||||
* usb_connect by default unless CONFIG_USB_INHIBIT is defined.
|
||||
* GPIOs correctly. This function is called via an init hook (unless the board
|
||||
* defined CONFIG_USB_INHIBIT_INIT), but may need to be called again if
|
||||
* usb_release is called. This function will call usb_connect by default
|
||||
* unless CONFIG_USB_INHIBIT_CONNECT is defined.
|
||||
*/
|
||||
void usb_init(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user