From: Peter Geis To: Simon Glass , Philipp Tomsich , Kever Yang Cc: Peter Geis , u-boot@lists.denx.de Subject: [PATCH v1 09/11] rockchip: move dwc3 config to chip specific handler Date: Mon, 21 Feb 2022 20:31:28 -0500 [thread overview] Message-ID: <20220222013131.3114990-10-pgwipeout@gmail.com> (raw) In-Reply-To: <20220222013131.3114990-1-pgwipeout@gmail.com> The dwc3 code in the mach-rockchip board file is specific to the rk3399. Move it to the rk3399 chip specific code. Signed-off-by: Peter Geis --- arch/arm/mach-rockchip/board.c | 24 --------------------- arch/arm/mach-rockchip/rk3399/rk3399.c | 29 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 24 deletions(-) --- a/arch/arm/mach-rockchip/board.c +++ b/arch/arm/mach-rockchip/board.c @@ -280,30 +280,6 @@ int board_usb_cleanup(int index, enum us } #endif /* CONFIG_USB_GADGET_DWC2_OTG */ -#if defined(CONFIG_USB_DWC3_GADGET) && !defined(CONFIG_DM_USB_GADGET) -#include - -static struct dwc3_device dwc3_device_data = { - .maximum_speed = USB_SPEED_HIGH, - .base = 0xfe800000, - .dr_mode = USB_DR_MODE_PERIPHERAL, - .index = 0, - .dis_u2_susphy_quirk = 1, - .hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW, -}; - -int usb_gadget_handle_interrupts(int index) -{ - dwc3_uboot_handle_interrupt(0); - return 0; -} - -int board_usb_init(int index, enum usb_init_type init) -{ - return dwc3_uboot_init(&dwc3_device_data); -} -#endif /* CONFIG_USB_DWC3_GADGET */ - #endif /* CONFIG_USB_GADGET */ #if CONFIG_IS_ENABLED(FASTBOOT) --- a/arch/arm/mach-rockchip/rk3399/rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/rk3399.c @@ -292,3 +292,32 @@ void spl_board_init(void) } } #endif + +#if defined(CONFIG_USB_GADGET) +#include + +#if defined(CONFIG_USB_DWC3_GADGET) && !defined(CONFIG_DM_USB_GADGET) +#include + +static struct dwc3_device dwc3_device_data = { + .maximum_speed = USB_SPEED_HIGH, + .base = 0xfe800000, + .dr_mode = USB_DR_MODE_PERIPHERAL, + .index = 0, + .dis_u2_susphy_quirk = 1, + .hsphy_mode = USBPHY_INTERFACE_MODE_UTMIW, +}; + +int usb_gadget_handle_interrupts(int index) +{ + dwc3_uboot_handle_interrupt(0); + return 0; +} + +int board_usb_init(int index, enum usb_init_type init) +{ + return dwc3_uboot_init(&dwc3_device_data); +} +#endif /* CONFIG_USB_DWC3_GADGET */ + +#endif /* CONFIG_USB_GADGET */