From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeroen Hofstee Date: Tue, 04 Nov 2014 20:39:46 +0100 Subject: [U-Boot] [PATCH v2 1/3] usb:ehci-mx6 add board_ehci_usb_mode function In-Reply-To: <5458D66D.6040000@freescale.com> References: <1415087402-26007-1-git-send-email-Peng.Fan@freescale.com> <1415087402-26007-2-git-send-email-Peng.Fan@freescale.com> <5458BB34.3020406@myspectrum.nl> <5458D66D.6040000@freescale.com> Message-ID: <54592B82.1020302@myspectrum.nl> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hello Peng, On 04-11-14 14:36, Peng Fan wrote: > > Hi Jeroen, > > ? 11/4/2014 7:40 PM, Jeroen Hofstee ??: >> Hello Peng, >> >> On 04-11-14 08:50, Peng Fan wrote: >>> Include a weak function board_ehci_usb_mode to gives board code >>> a choice. If the board want the otg port work in host mode but not >>> device mode, this should be handled. >>> >>> Signed-off-by: Peng Fan >>> Signed-off-by: Ye Li >>> --- >>> >>> Changes v2: >>> Introduce a new weak function to let board have a choice to >>> decide which mode >>> to work at. >>> >>> drivers/usb/host/ehci-mx6.c | 7 +++++++ >>> 1 file changed, 7 insertions(+) >>> >>> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c >>> index 9ec5a0a..3662a80 100644 >>> --- a/drivers/usb/host/ehci-mx6.c >>> +++ b/drivers/usb/host/ehci-mx6.c >>> @@ -193,6 +193,11 @@ static void usb_oc_config(int index) >>> __raw_writel(val, ctrl); >>> } >>> >>> +int __weak board_ehci_usb_mode(int index, enum usb_init_type *type) >>> +{ >>> + return 0; >>> +} >>> + >>> int __weak board_ehci_hcd_init(int port) >>> { >>> return 0; >>> @@ -223,6 +228,8 @@ int ehci_hcd_init(int index, enum usb_init_type >>> init, >>> usb_internal_phy_clock_gate(index, 1); >>> type = usb_phy_enable(index, ehci) ? USB_INIT_DEVICE : >>> USB_INIT_HOST; >>> >>> + board_ehci_usb_mode(index, &type); >>> + >>> *hccr = (struct ehci_hccr *)((uint32_t)&ehci->caplength); >>> *hcor = (struct ehci_hcor *)((uint32_t)*hccr + >>> HC_LENGTH(ehci_readl(&(*hccr)->cr_capbase))); >> >> Can you add a prototype type as well and make sure it is included? > I did not find a good place for the prototype type. I think ehci.h is > not fine to include this prototype. Any suggestions? Ah, good point. I have reserved USB as well for the "not trivial" to fix warnings. Ideally there should be a header in drivers somewhere defining what different usb drivers can/should support when dealing with common usb code and one in include/... for the board interface. Since this is currently lacking, I am also fine checking it in without a valid prototype and fix it later. Regards, Jeroen