usb: mtu3: add SPL support
MediaTek platforms may need the MTU3 controller before U-Boot proper is available, but the driver is currently selected and built only with the main U-Boot configuration symbols. Add an explicit SPL controller option with host and gadget modes. Make the driver build and its role checks phase-aware so each phase can select the MTU3 role it needs without coupling it to the U-Boot proper controller configuration. The upstream binding locates the xHCI child registers through the parent ranges property. Select SPL_OF_TRANSLATE for host mode so SPL can resolve that address before mapping it. Signed-off-by: Julien Masson <jmasson@baylibre.com> Signed-off-by: Carlo Caione <ccaione@baylibre.com> Reviewed-by: Marek Vasut <marek.vasut+usb@mailbox.org>
This commit is contained in:
committed by
Marek Vasut
parent
0f8cbf3a0d
commit
08b77aac33
+2
-1
@@ -66,7 +66,8 @@ obj-$(CONFIG_DRAM_SUN20I_D1) += ram/
|
||||
obj-$(CONFIG_SPL_DM_RESET) += reset/
|
||||
obj-$(CONFIG_SPL_MUSB_NEW) += usb/musb-new/
|
||||
obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/
|
||||
obj-$(CONFIG_SPL_USB_GADGET) += usb/common/
|
||||
obj-$(CONFIG_SPL_DM_USB) += usb/common/
|
||||
obj-$(CONFIG_SPL_USB_MTU3) += usb/mtu3/
|
||||
obj-$(CONFIG_SPL_USB_GADGET) += usb/gadget/udc/
|
||||
obj-$(CONFIG_SPL_WATCHDOG) += watchdog/
|
||||
obj-$(CONFIG_SPL_USB_HOST) += usb/host/
|
||||
|
||||
@@ -42,3 +42,42 @@ config USB_MTU3_DEBUG
|
||||
Say Y here to enable debugging messages in the MTU3 Driver.
|
||||
|
||||
endif
|
||||
|
||||
config SPL_USB_MTU3
|
||||
bool "MediaTek USB3 controller support in SPL"
|
||||
depends on ARCH_MEDIATEK
|
||||
depends on SPL_DM_USB
|
||||
depends on SPL_USB_HOST || (SPL_DM_USB_GADGET && SPL_USB_GADGET)
|
||||
help
|
||||
Enable the MediaTek USB3 controller in SPL. Select host or peripheral
|
||||
mode below.
|
||||
|
||||
if SPL_USB_MTU3
|
||||
|
||||
choice
|
||||
bool "MTU3 SPL Mode Selection"
|
||||
default SPL_USB_MTU3_GADGET if SPL_USB_GADGET
|
||||
default SPL_USB_MTU3_HOST if (SPL_USB_HOST && !SPL_USB_GADGET)
|
||||
help
|
||||
Select whether the MTU3 controller operates as an xHCI host or a USB
|
||||
peripheral in SPL.
|
||||
|
||||
config SPL_USB_MTU3_HOST
|
||||
bool "Host mode in SPL"
|
||||
depends on SPL_USB_HOST && USB_XHCI_HCD
|
||||
select SPL_OF_TRANSLATE
|
||||
help
|
||||
Enable the MTU3 xHCI host controller in SPL so USB devices can be
|
||||
accessed before U-Boot proper starts.
|
||||
|
||||
config SPL_USB_MTU3_GADGET
|
||||
bool "Gadget mode in SPL"
|
||||
depends on SPL_DM_USB_GADGET && SPL_USB_GADGET
|
||||
select USB_GADGET_DUALSPEED
|
||||
help
|
||||
Enable the MTU3 peripheral controller in SPL so USB gadget
|
||||
functions can use it before U-Boot proper starts.
|
||||
|
||||
endchoice
|
||||
|
||||
endif
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
ccflags-$(CONFIG_USB_MTU3_DEBUG) += -DDEBUG
|
||||
ccflags-$(CONFIG_$(PHASE_)USB_MTU3_DEBUG) += -DDEBUG
|
||||
|
||||
obj-$(CONFIG_USB_MTU3) += mtu3.o
|
||||
obj-$(CONFIG_$(PHASE_)USB_MTU3) += mtu3.o
|
||||
|
||||
mtu3-y := mtu3_plat.o
|
||||
|
||||
obj-$(CONFIG_USB_MTU3_GADGET) += mtu3_core.o mtu3_gadget_ep0.o mtu3_gadget.o
|
||||
obj-$(CONFIG_USB_MTU3_GADGET) += mtu3_qmu.o
|
||||
obj-$(CONFIG_USB_MTU3_HOST) += mtu3_host.o
|
||||
obj-$(CONFIG_$(PHASE_)USB_MTU3_GADGET) += mtu3_core.o mtu3_gadget_ep0.o
|
||||
obj-$(CONFIG_$(PHASE_)USB_MTU3_GADGET) += mtu3_gadget.o mtu3_qmu.o
|
||||
obj-$(CONFIG_$(PHASE_)USB_MTU3_HOST) += mtu3_host.o
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#ifndef _MTU3_DR_H_
|
||||
#define _MTU3_DR_H_
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_MTU3_HOST)
|
||||
#if CONFIG_IS_ENABLED(USB_MTU3_HOST)
|
||||
|
||||
int ssusb_host_init(struct ssusb_mtk *ssusb);
|
||||
void ssusb_host_exit(struct ssusb_mtk *ssusb);
|
||||
@@ -27,7 +27,7 @@ static inline void ssusb_host_exit(struct ssusb_mtk *ssusb)
|
||||
|
||||
#endif
|
||||
|
||||
#if IS_ENABLED(CONFIG_USB_MTU3_GADGET)
|
||||
#if CONFIG_IS_ENABLED(USB_MTU3_GADGET)
|
||||
int ssusb_gadget_init(struct ssusb_mtk *ssusb);
|
||||
void ssusb_gadget_exit(struct ssusb_mtk *ssusb);
|
||||
irqreturn_t mtu3_irq(int irq, void *data);
|
||||
|
||||
@@ -439,17 +439,17 @@ static int mtu3_glue_bind(struct udevice *parent)
|
||||
|
||||
switch (dr_mode) {
|
||||
case USB_DR_MODE_PERIPHERAL:
|
||||
if (IS_ENABLED(CONFIG_USB_MTU3_GADGET))
|
||||
if (CONFIG_IS_ENABLED(USB_MTU3_GADGET))
|
||||
return mtu3_bind_gadget(parent);
|
||||
break;
|
||||
case USB_DR_MODE_HOST:
|
||||
if (IS_ENABLED(CONFIG_USB_MTU3_HOST))
|
||||
if (CONFIG_IS_ENABLED(USB_MTU3_HOST))
|
||||
return mtu3_bind_host(parent);
|
||||
break;
|
||||
case USB_DR_MODE_OTG:
|
||||
if (IS_ENABLED(CONFIG_USB_MTU3_GADGET))
|
||||
if (CONFIG_IS_ENABLED(USB_MTU3_GADGET))
|
||||
return mtu3_bind_gadget(parent);
|
||||
if (IS_ENABLED(CONFIG_USB_MTU3_HOST))
|
||||
if (CONFIG_IS_ENABLED(USB_MTU3_HOST))
|
||||
return mtu3_bind_host(parent);
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user