在 11/4/2014 6:33 PM, Marek Vasut 写道:
On Tuesday, November 04, 2014 at 08:50:00 AM, Peng Fan wrote:
Include a weak function board_ehci_usb_mode to gives board code
a choice.

What choice?

If the board want the otg port work in host mode but not
device mode, this should be handled.

How?

Also, isn't usb_phy_enable() supposed to do exactly this kind of selection
between device and host mode ?

In mx6sxsabresd board, there are two usb port, one used for otg, the other used for host. However they are connected to SOC USB controller otg1 core and otg2 core respectively. Like following:

OTG1 CORE <----> board otg port
OTG2 CORE <----> board host port

However the board do not have ID pin set for board host port. If just use usb_phy_enable, the board host port will not work, because "type = usb_phy_enable(index, ehci) ? USB_INIT_DEVICE : USB_INIT_HOST;" will always set type with USB_INIT_DEVICE.

Because i did not find way to handle this situation in board/freescale/mx6sxsabresd/mx6sxsabresd.c, add this function to let board level code handle handle 'type', if board level code want to set it's own 'type'.


Signed-off-by: Peng Fan <peng....@freescale.com>
Signed-off-by: Ye Li <b37...@freescale.com>
---

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)));

Best regards,
Marek Vasut

Regards,
Peng.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to