Skip to contentSkip to conversation

ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup

PATCH In review Antony Pavlov 2 participants 4 messages Sep 12, 2011 – Sep 13, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ehci-hcd.c: handle EHCI_HAS_TT in ehci_reset() during startup

---
 drivers/usb/host/ehci-hcd.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/usb/host/ehci-hcd.c +2 -7
index 60fc181..883dc07 100644
@@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
 	host->submit_control_msg = submit_control_msg;
 	host->submit_bulk_msg = submit_bulk_msg;
 
-	if (ehci->flags & EHCI_HAS_TT) {
-		/* Set to host mode */
-		reg = ehci_readl(ehci->hcor + USBMODE);
-		reg |= USBMODE_CM_HC;
-		writel(reg, ehci->hcor + USBMODE);
-	}
-
 	usb_register_host(host);
 
+	ehci_reset(ehci);
+
 	reg = HC_VERSION(ehci_readl(&ehci->hccr->cr_capbase));
 	dev_info(dev, "USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
 
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 14 lines · Antony Pavlov
---
 drivers/usb/host/ehci-hcd.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -1
index 60fc181..883dc07 100644
@@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
 	host->submit_control_msg = submit_control_msg;
 	host->submit_bulk_msg = submit_bulk_msg;
 
-	if (ehci->flags & EHCI_HAS_TT) {

drivers/usb/host/ehci-hcd.c static int ehci_probe(struct device_d *dev) · line 927

Quoted 10 lines
drivers/usb/host/ehci-hcd.c +2 -6
-		/* Set to host mode */
-		reg = ehci_readl(ehci->hcor + USBMODE);
-		reg |= USBMODE_CM_HC;
-		writel(reg, ehci->hcor + USBMODE);
-	}
-
 	usb_register_host(host);
 
+	ehci_reset(ehci);
+

ehci_reset is called from ehci_init. Isn't that enough or do we have to call it explicitely here?

Sascha

Quoted 12 lines
drivers/usb/host/ehci-hcd.c +0 -0
 	reg = HC_VERSION(ehci_readl(&ehci->hccr->cr_capbase));
 	dev_info(dev, "USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
 
Signature · 7 lines
1.7.5.4


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw
Quoted 23 lines · Sascha Hauer
Quoted 22 lines · Antony Pavlov

---
 drivers/usb/host/ehci-hcd.c |    9 ++-------

 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -7
index 60fc181..883dc07 100644
@@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
       host->submit_control_msg = submit_control_msg;
       host->submit_bulk_msg = submit_bulk_msg;
 
-     if (ehci->flags & EHCI_HAS_TT) {
-             /* Set to host mode */
-             reg = ehci_readl(ehci->hcor + USBMODE);
-             reg |= USBMODE_CM_HC;
-             writel(reg, ehci->hcor + USBMODE);
-     }
-
       usb_register_host(host);
 
Quoted 5 lines

drivers/usb/host/ehci-hcd.c static int ehci_probe(struct device_d *dev) · line 927

Quoted 2 lines
drivers/usb/host/ehci-hcd.c +2 -0
+     ehci_reset(ehci);
+

ehci_reset is called from ehci_init. Isn't that enough or do we have to call it explicitely here?

I suppose it's preferable reset the controller after changing "host controller mode" bit (USBMODE_CM_HC). Let's check the file drivers/usb/host/ehci-hcd.c from linux kernel sources, in ehci_reset() we have:

    if (ehci_is_TDI(ehci))
                    tdi_reset (ehci);

On my Tegra board I found the problem: board hangs up on the first ehci_readl() after setting USBMODE_CM_HC bit.

Quoted 6 lines
Quoted 6 lines
drivers/usb/host/ehci-hcd.c +0 -1
       reg = HC_VERSION(ehci_readl(&ehci->hccr->cr_capbase));
       dev_info(dev, "USB EHCI %x.%02x\n", reg >> 8, reg & 0xff);
 
--

1.7.5.4

Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 30 lines · Antony Pavlov
Quoted 23 lines · Sascha Hauer
Quoted 22 lines · Antony Pavlov

---
 drivers/usb/host/ehci-hcd.c |    9 ++-------

 1 files changed, 2 insertions(+), 7 deletions(-)
drivers/usb/host/ehci-hcd.c +0 -7
index 60fc181..883dc07 100644
@@ -921,15 +921,10 @@ static int ehci_probe(struct device_d *dev)
       host->submit_control_msg = submit_control_msg;
       host->submit_bulk_msg = submit_bulk_msg;
 
-     if (ehci->flags & EHCI_HAS_TT) {
-             /* Set to host mode */
-             reg = ehci_readl(ehci->hcor + USBMODE);
-             reg |= USBMODE_CM_HC;
-             writel(reg, ehci->hcor + USBMODE);
-     }
-
       usb_register_host(host);
 
Quoted 5 lines

drivers/usb/host/ehci-hcd.c static int ehci_probe(struct device_d *dev) · line 927

Quoted 2 lines
drivers/usb/host/ehci-hcd.c +2 -0
+     ehci_reset(ehci);
+

ehci_reset is called from ehci_init. Isn't that enough or do we have to call it explicitely here?

Quoted 8 lines

I suppose it's preferable reset the controller after changing "host controller mode" bit (USBMODE_CM_HC). Let's check the file drivers/usb/host/ehci-hcd.c from linux kernel sources, in ehci_reset() we have:

   if (ehci_is_TDI(ehci))
                   tdi_reset (ehci);

May be this "patch" (linux-style) will be better?

      host->submit_control_msg = submit_control_msg;
      host->submit_bulk_msg = submit_bulk_msg;

      if (ehci->flags & EHCI_HAS_TT) {
-             /* Set to host mode */
-             reg = ehci_readl(ehci->hcor + USBMODE);
-             reg |= USBMODE_CM_HC;
-             writel(reg, ehci->hcor + USBMODE);
+             ehci_reset(ehci);
      }

      usb_register_host(host);
Signature · 7 lines
Best regards,
  Antony Pavlov

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox