All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
@ 2015-05-05 21:56 Hans de Goede
  2015-05-05 21:56 ` [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs Hans de Goede
                   ` (16 more replies)
  0 siblings, 17 replies; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Hi Marek and Simon,

Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
dm support (tested on sunxi). This series sits on top of the series adding
companion controller support to the dm usb code and 2 ehci fixes which I
send earlier today.

Regards,

Hans

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:54   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 02/16] usb: Stop reset procedure when a dev is handed over to a companion hcd Hans de Goede
                   ` (15 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

This fixes descriptor reading of lowspeed devices through ohci not working.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 common/usb.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index 48f0780..4a09583 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -948,13 +948,18 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
 	 * send 64-byte GET-DEVICE-DESCRIPTOR request.  Since the descriptor is
 	 * only 18 bytes long, this will terminate with a short packet.  But if
 	 * the maxpacket size is 8 or 16 the device may be waiting to transmit
-	 * some more, or keeps on retransmitting the 8 byte header. */
+	 * some more, or keeps on retransmitting the 8 byte header.
+	 */
 
-	dev->descriptor.bMaxPacketSize0 = 64;	    /* Start off at 64 bytes  */
-	/* Default to 64 byte max packet size */
-	dev->maxpacketsize = PACKET_SIZE_64;
-	dev->epmaxpacketin[0] = 64;
-	dev->epmaxpacketout[0] = 64;
+	if (dev->speed == USB_SPEED_LOW) {
+		dev->descriptor.bMaxPacketSize0 = 8;
+		dev->maxpacketsize = PACKET_SIZE_8;
+	} else {
+		dev->descriptor.bMaxPacketSize0 = 64;
+		dev->maxpacketsize = PACKET_SIZE_64;
+	}
+	dev->epmaxpacketin[0] = dev->descriptor.bMaxPacketSize0;
+	dev->epmaxpacketout[0] = dev->descriptor.bMaxPacketSize0;
 
 	if (do_read) {
 		int err;
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 02/16] usb: Stop reset procedure when a dev is handed over to a companion hcd
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
  2015-05-05 21:56 ` [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:54   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable Hans de Goede
                   ` (14 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Do not try to reset a device 5 times when it is handed over to a companion
controller, also do not print an error when it has been handed over.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 common/usb_hub.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index c9be530..499554b 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -168,8 +168,15 @@ int legacy_hub_port_reset(struct usb_device *dev, int port,
 	debug("%s: resetting port %d...\n", __func__, port + 1);
 #endif
 	for (tries = 0; tries < MAX_TRIES; tries++) {
-
+		int prev_companion_device_count = usb_companion_device_count;
 		usb_set_port_feature(dev, port + 1, USB_PORT_FEAT_RESET);
+		/*
+		 * If companion device count changed, the device was handed
+		 * over and we are done.
+		 */
+		if (usb_companion_device_count != prev_companion_device_count)
+			return -ENXIO;
+
 		mdelay(200);
 
 		if (usb_get_port_status(dev, port + 1, portsts) < 0) {
@@ -269,7 +276,8 @@ int usb_hub_port_connect_change(struct usb_device *dev, int port)
 	/* Reset the port */
 	ret = legacy_hub_port_reset(dev, port, &portstatus);
 	if (ret < 0) {
-		printf("cannot reset port %i!?\n", port + 1);
+		if (ret != -ENXIO)
+			printf("cannot reset port %i!?\n", port + 1);
 		return ret;
 	}
 
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
  2015-05-05 21:56 ` [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs Hans de Goede
  2015-05-05 21:56 ` [U-Boot] [PATCH 02/16] usb: Stop reset procedure when a dev is handed over to a companion hcd Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:55   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars Hans de Goede
                   ` (13 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

devgone is never assigned a value, so the one comparisson reading it will
never be true, and devgone can be completely removed.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 97a7ede..81ef8ef 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -111,8 +111,6 @@ struct ohci_hcca ghcca[1];
 struct ohci_hcca *phcca;
 /* this allocates EDs for all possible endpoints */
 struct ohci_device ohci_dev;
-/* device which was disconnected */
-struct usb_device *devgone;
 
 static inline u32 roothub_a(struct ohci *hc)
 	{ return ohci_readl(&hc->regs->roothub.a); }
@@ -1380,12 +1378,6 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	urb->transfer_buffer_length = transfer_len;
 	urb->interval = interval;
 
-	/* device pulled? Shortcut the action. */
-	if (devgone == dev) {
-		dev->status = USB_ST_CRC_ERR;
-		return 0;
-	}
-
 #ifdef DEBUG
 	urb->actual_length = 0;
 	pkt_print(urb, dev, pipe, buffer, transfer_len,
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (2 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:55   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct Hans de Goede
                   ` (12 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

This is a preparation patch for adding driver-model support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 124 +++++++++++++++++++++++---------------------
 1 file changed, 64 insertions(+), 60 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 81ef8ef..22c7b18 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -122,9 +122,9 @@ static inline u32 roothub_portstatus(struct ohci *hc, int i)
 	{ return ohci_readl(&hc->regs->roothub.portstatus[i]); }
 
 /* forward declaration */
-static int hc_interrupt(void);
-static void td_submit_job(struct usb_device *dev, unsigned long pipe,
-			  void *buffer, int transfer_len,
+static int hc_interrupt(ohci_t *ohci);
+static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
+			  unsigned long pipe, void *buffer, int transfer_len,
 			  struct devrequest *setup, urb_priv_t *urb,
 			  int interval);
 
@@ -156,18 +156,18 @@ static void urb_free_priv(urb_priv_t *urb)
 /*-------------------------------------------------------------------------*/
 
 #ifdef DEBUG
-static int sohci_get_current_frame_number(struct usb_device *dev);
+static int sohci_get_current_frame_number(ohci_t *ohci);
 
 /* debug| print the main components of an URB
  * small: 0) header + data packets 1) just header */
 
-static void pkt_print(urb_priv_t *purb, struct usb_device *dev,
+static void pkt_print(ohci_t *ohci, urb_priv_t *purb, struct usb_device *dev,
 		      unsigned long pipe, void *buffer, int transfer_len,
 		      struct devrequest *setup, char *str, int small)
 {
 	dbg("%s URB:[%4x] dev:%2lu,ep:%2lu-%c,type:%s,len:%d/%d stat:%#lx",
 			str,
-			sohci_get_current_frame_number(dev),
+			sohci_get_current_frame_number(ohci),
 			usb_pipedevice(pipe),
 			usb_pipeendpoint(pipe),
 			usb_pipeout(pipe)? 'O': 'I',
@@ -389,9 +389,8 @@ static void ohci_dump(ohci_t *controller, int verbose)
 
 /* get a transfer request */
 
-int sohci_submit_job(urb_priv_t *urb, struct devrequest *setup)
+int sohci_submit_job(ohci_t *ohci, urb_priv_t *urb, struct devrequest *setup)
 {
-	ohci_t *ohci;
 	ed_t *ed;
 	urb_priv_t *purb_priv = urb;
 	int i, size = 0;
@@ -401,8 +400,6 @@ int sohci_submit_job(urb_priv_t *urb, struct devrequest *setup)
 	int transfer_len = urb->transfer_buffer_length;
 	int interval = urb->interval;
 
-	ohci = &gohci;
-
 	/* when controller's hung, permit only roothub cleanup attempts
 	 * such as powering down ports */
 	if (ohci->disabled) {
@@ -471,7 +468,7 @@ int sohci_submit_job(urb_priv_t *urb, struct devrequest *setup)
 		ep_link(ohci, ed);
 
 	/* fill the TDs and link it to the ed */
-	td_submit_job(dev, pipe, buffer, transfer_len,
+	td_submit_job(ohci, dev, pipe, buffer, transfer_len,
 		      setup, purb_priv, interval);
 
 	return 0;
@@ -493,7 +490,7 @@ static inline int sohci_return_job(struct ohci *hc, urb_priv_t *urb)
 			ohci_readl(&regs->intrdisable); /* PCI posting flush */
 		}
 		urb->actual_length = 0;
-		td_submit_job(
+		td_submit_job(  hc,
 				urb->dev,
 				urb->pipe,
 				urb->transfer_buffer,
@@ -515,11 +512,8 @@ static inline int sohci_return_job(struct ohci *hc, urb_priv_t *urb)
 
 #ifdef DEBUG
 /* tell us the current USB frame number */
-
-static int sohci_get_current_frame_number(struct usb_device *usb_dev)
+static int sohci_get_current_frame_number(ohci_t *ohci)
 {
-	ohci_t *ohci = &gohci;
-
 	return m16_swap(ohci->hcca->frame_no);
 }
 #endif
@@ -849,12 +843,11 @@ static void td_fill(ohci_t *ohci, unsigned int info,
 
 /* prepare all TDs of a transfer */
 
-static void td_submit_job(struct usb_device *dev, unsigned long pipe,
-			  void *buffer, int transfer_len,
+static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
+			  unsigned long pipe, void *buffer, int transfer_len,
 			  struct devrequest *setup, urb_priv_t *urb,
 			  int interval)
 {
-	ohci_t *ohci = &gohci;
 	int data_len = transfer_len;
 	void *data;
 	int cnt = 0;
@@ -1098,16 +1091,16 @@ static int dl_done_list(ohci_t *ohci)
 #define OK(x)			len = (x); break
 #ifdef DEBUG
 #define WR_RH_STAT(x)		{info("WR:status %#8x", (x)); ohci_writel((x), \
-						&gohci.regs->roothub.status); }
+						&ohci->regs->roothub.status); }
 #define WR_RH_PORTSTAT(x)	{info("WR:portstatus[%d] %#8x", wIndex-1, \
-	(x)); ohci_writel((x), &gohci.regs->roothub.portstatus[wIndex-1]); }
+	(x)); ohci_writel((x), &ohci->regs->roothub.portstatus[wIndex-1]); }
 #else
-#define WR_RH_STAT(x)		ohci_writel((x), &gohci.regs->roothub.status)
+#define WR_RH_STAT(x)		ohci_writel((x), &ohci->regs->roothub.status)
 #define WR_RH_PORTSTAT(x)	ohci_writel((x), \
-				    &gohci.regs->roothub.portstatus[wIndex-1])
+				    &ohci->regs->roothub.portstatus[wIndex-1])
 #endif
-#define RD_RH_STAT		roothub_status(&gohci)
-#define RD_RH_PORTSTAT		roothub_portstatus(&gohci, wIndex-1)
+#define RD_RH_STAT		roothub_status(ohci)
+#define RD_RH_PORTSTAT		roothub_portstatus(ohci, wIndex-1)
 
 /* request to virtual root hub */
 
@@ -1135,8 +1128,9 @@ int rh_check_port_status(ohci_t *controller)
 	return res;
 }
 
-static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
-		void *buffer, int transfer_len, struct devrequest *cmd)
+static int ohci_submit_rh_msg(ohci_t *ohci, struct usb_device *dev,
+	unsigned long pipe, void *buffer, int transfer_len,
+	struct devrequest *cmd)
 {
 	void *data = buffer;
 	int leni = transfer_len;
@@ -1149,7 +1143,7 @@ static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
 	ALLOC_ALIGN_BUFFER(__u8, databuf, 16, sizeof(u32));
 
 #ifdef DEBUG
-pkt_print(NULL, dev, pipe, buffer, transfer_len,
+pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 	  cmd, "SUB(rh)", usb_pipein(pipe));
 #else
 	mdelay(1);
@@ -1243,7 +1237,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 		break;
 
 	case RH_SET_ADDRESS:
-		gohci.rh.devnum = wValue;
+		ohci->rh.devnum = wValue;
 		OK(0);
 
 	case RH_GET_DESCRIPTOR:
@@ -1288,7 +1282,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 
 	case RH_GET_DESCRIPTOR | RH_CLASS:
 	{
-		__u32 temp = roothub_a(&gohci);
+		__u32 temp = roothub_a(ohci);
 
 		databuf[0] = 9;		/* min length; */
 		databuf[1] = 0x29;
@@ -1307,7 +1301,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 		databuf[4] = 0;
 		databuf[5] = (temp & RH_A_POTPGT) >> 24;
 		databuf[6] = 0;
-		temp = roothub_b(&gohci);
+		temp = roothub_b(ohci);
 		databuf[7] = temp & RH_B_DR;
 		if (databuf[2] < 7) {
 			databuf[8] = 0xff;
@@ -1336,7 +1330,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 	}
 
 #ifdef	DEBUG
-	ohci_dump_roothub(&gohci, 1);
+	ohci_dump_roothub(ohci, 1);
 #else
 	mdelay(1);
 #endif
@@ -1348,7 +1342,7 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 	dev->status = stat;
 
 #ifdef DEBUG
-	pkt_print(NULL, dev, pipe, buffer,
+	pkt_print(ohci, NULL, dev, pipe, buffer,
 		  transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
 #else
 	mdelay(1);
@@ -1361,8 +1355,9 @@ pkt_print(NULL, dev, pipe, buffer, transfer_len,
 
 /* common code for handling submit messages - used for all but root hub */
 /* accesses. */
-int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-		int transfer_len, struct devrequest *setup, int interval)
+static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
+		unsigned long pipe, void *buffer, int transfer_len,
+		struct devrequest *setup, int interval)
 {
 	int stat = 0;
 	int maxsize = usb_maxpacket(dev, pipe);
@@ -1380,7 +1375,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 
 #ifdef DEBUG
 	urb->actual_length = 0;
-	pkt_print(urb, dev, pipe, buffer, transfer_len,
+	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "SUB", usb_pipein(pipe));
 #else
 	mdelay(1);
@@ -1391,14 +1386,14 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 		return -1;
 	}
 
-	if (sohci_submit_job(urb, setup) < 0) {
+	if (sohci_submit_job(ohci, urb, setup) < 0) {
 		err("sohci_submit_job failed");
 		return -1;
 	}
 
 #if 0
 	mdelay(10);
-	/* ohci_dump_status(&gohci); */
+	/* ohci_dump_status(ohci); */
 #endif
 
 	timeout = USB_TIMEOUT_MS(pipe);
@@ -1406,7 +1401,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	/* wait for it to complete */
 	for (;;) {
 		/* check whether the controller is done */
-		stat = hc_interrupt();
+		stat = hc_interrupt(ohci);
 		if (stat < 0) {
 			stat = USB_ST_CRC_ERR;
 			break;
@@ -1444,7 +1439,7 @@ int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	dev->act_len = urb->actual_length;
 
 #ifdef DEBUG
-	pkt_print(urb, dev, pipe, buffer, transfer_len,
+	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "RET(ctlr)", usb_pipein(pipe));
 #else
 	mdelay(1);
@@ -1461,17 +1456,27 @@ int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 		int transfer_len)
 {
 	info("submit_bulk_msg");
-	return submit_common_msg(dev, pipe, buffer, transfer_len, NULL, 0);
+	return submit_common_msg(&gohci, dev, pipe, buffer, transfer_len,
+				 NULL, 0);
+}
+
+int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
+		int transfer_len, int interval)
+{
+	info("submit_int_msg");
+	return submit_common_msg(&gohci, dev, pipe, buffer, transfer_len, NULL,
+			interval);
 }
 
-int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-		int transfer_len, struct devrequest *setup)
+static int _ohci_submit_control_msg(ohci_t *ohci, struct usb_device *dev,
+	unsigned long pipe, void *buffer, int transfer_len,
+	struct devrequest *setup)
 {
 	int maxsize = usb_maxpacket(dev, pipe);
 
 	info("submit_control_msg");
 #ifdef DEBUG
-	pkt_print(NULL, dev, pipe, buffer, transfer_len,
+	pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 		  setup, "SUB", usb_pipein(pipe));
 #else
 	mdelay(1);
@@ -1481,22 +1486,15 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 			pipe);
 		return -1;
 	}
-	if (((pipe >> 8) & 0x7f) == gohci.rh.devnum) {
-		gohci.rh.dev = dev;
+	if (((pipe >> 8) & 0x7f) == ohci->rh.devnum) {
+		ohci->rh.dev = dev;
 		/* root hub - redirect */
-		return ohci_submit_rh_msg(dev, pipe, buffer, transfer_len,
-			setup);
+		return ohci_submit_rh_msg(ohci, dev, pipe, buffer,
+					  transfer_len, setup);
 	}
 
-	return submit_common_msg(dev, pipe, buffer, transfer_len, setup, 0);
-}
-
-int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-		int transfer_len, int interval)
-{
-	info("submit_int_msg");
-	return submit_common_msg(dev, pipe, buffer, transfer_len, NULL,
-			interval);
+	return submit_common_msg(ohci, dev, pipe, buffer, transfer_len,
+				 setup, 0);
 }
 
 /*-------------------------------------------------------------------------*
@@ -1640,9 +1638,8 @@ static int hc_start(ohci_t *ohci)
 
 /* an interrupt happens */
 
-static int hc_interrupt(void)
+static int hc_interrupt(ohci_t *ohci)
 {
-	ohci_t *ohci = &gohci;
 	struct ohci_regs *regs = ohci->regs;
 	int ints;
 	int stat = -1;
@@ -1694,7 +1691,7 @@ static int hc_interrupt(void)
 		mdelay(1);
 		ohci_writel(OHCI_INTR_WDH, &regs->intrdisable);
 		(void)ohci_readl(&regs->intrdisable); /* flush */
-		stat = dl_done_list(&gohci);
+		stat = dl_done_list(ohci);
 		ohci_writel(OHCI_INTR_WDH, &regs->intrenable);
 		(void)ohci_readl(&regs->intrdisable); /* flush */
 	}
@@ -1872,3 +1869,10 @@ int usb_lowlevel_stop(int index)
 	ohci_inited = 0;
 	return 0;
 }
+
+int submit_control_msg(struct usb_device *dev, unsigned long pipe,
+	void *buffer, int transfer_len, struct devrequest *setup)
+{
+	return _ohci_submit_control_msg(&gohci, dev, pipe, buffer,
+					transfer_len, setup);
+}
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (3 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:57   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct Hans de Goede
                   ` (11 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

This is a preparation patch for adding driver-model support.

Note we do keep ohci_dev as a separate struct so that we can later add
support for interrupt-queues which requires allocating a separate ohci_dev
per interrupt-queue.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 22 ++++++++--------------
 drivers/usb/host/ohci.h     | 20 +++++++++++---------
 2 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 22c7b18..745825c 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -109,8 +109,6 @@ static ohci_t gohci;
 struct ohci_hcca ghcca[1];
 /* a pointer to the aligned storage */
 struct ohci_hcca *phcca;
-/* this allocates EDs for all possible endpoints */
-struct ohci_device ohci_dev;
 
 static inline u32 roothub_a(struct ohci *hc)
 	{ return ohci_readl(&hc->regs->roothub.a); }
@@ -389,7 +387,8 @@ static void ohci_dump(ohci_t *controller, int verbose)
 
 /* get a transfer request */
 
-int sohci_submit_job(ohci_t *ohci, urb_priv_t *urb, struct devrequest *setup)
+int sohci_submit_job(ohci_t *ohci, ohci_dev_t *ohci_dev, urb_priv_t *urb,
+		     struct devrequest *setup)
 {
 	ed_t *ed;
 	urb_priv_t *purb_priv = urb;
@@ -412,7 +411,7 @@ int sohci_submit_job(ohci_t *ohci, urb_priv_t *urb, struct devrequest *setup)
 	urb->finished = 0;
 
 	/* every endpoint has a ed, locate and fill it */
-	ed = ep_add_ed(dev, pipe, interval, 1);
+	ed = ep_add_ed(ohci_dev, dev, pipe, interval, 1);
 	if (!ed) {
 		err("sohci_submit_job: ENOMEM");
 		return -1;
@@ -743,14 +742,14 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi)
  * info fields are setted anyway even though most of them should not
  * change
  */
-static ed_t *ep_add_ed(struct usb_device *usb_dev, unsigned long pipe,
-			int interval, int load)
+static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
+		       unsigned long pipe, int interval, int load)
 {
 	td_t *td;
 	ed_t *ed_ret;
 	volatile ed_t *ed;
 
-	ed = ed_ret = &ohci_dev.ed[(usb_pipeendpoint(pipe) << 1) |
+	ed = ed_ret = &ohci_dev->ed[(usb_pipeendpoint(pipe) << 1) |
 			(usb_pipecontrol(pipe)? 0: usb_pipeout(pipe))];
 
 	if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) {
@@ -766,7 +765,7 @@ static ed_t *ep_add_ed(struct usb_device *usb_dev, unsigned long pipe,
 		ed->hwHeadP = ed->hwTailP;
 		ed->state = ED_UNLINK;
 		ed->type = usb_pipetype(pipe);
-		ohci_dev.ed_cnt++;
+		ohci_dev->ed_cnt++;
 	}
 
 	ed->hwINFO = m32_swap(usb_pipedevice(pipe)
@@ -1386,7 +1385,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 		return -1;
 	}
 
-	if (sohci_submit_job(ohci, urb, setup) < 0) {
+	if (sohci_submit_job(ohci, &ohci->ohci_dev, urb, setup) < 0) {
 		err("sohci_submit_job failed");
 		return -1;
 	}
@@ -1763,11 +1762,6 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
 	}
 	phcca = &ghcca[0];
 	info("aligned ghcca %p", phcca);
-	memset(&ohci_dev, 0, sizeof(struct ohci_device));
-	if ((__u32)&ohci_dev.ed[0] & 0x7) {
-		err("EDs not aligned!!");
-		return -1;
-	}
 	memset(gtd, 0, sizeof(td_t) * (NUM_TD + 1));
 	if ((__u32)gtd & 0x7) {
 		err("TDs not aligned!!");
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 9a4a2c2..c319164 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -408,6 +408,13 @@ typedef struct
 } urb_priv_t;
 #define URB_DEL 1
 
+#define NUM_EDS 8		/* num of preallocated endpoint descriptors */
+
+typedef struct ohci_device {
+	ed_t ed[NUM_EDS] __aligned(16);
+	int ed_cnt;
+} ohci_dev_t;
+
 /*
  * This is the full ohci controller description
  *
@@ -417,6 +424,8 @@ typedef struct
 
 
 typedef struct ohci {
+	/* this allocates EDs for all possible endpoints */
+	struct ohci_device ohci_dev __aligned(16);
 	struct ohci_hcca *hcca;		/* hcca */
 	/*dma_addr_t hcca_dma;*/
 
@@ -439,19 +448,12 @@ typedef struct ohci {
 	const char	*slot_name;
 } ohci_t;
 
-#define NUM_EDS 8		/* num of preallocated endpoint descriptors */
-
-struct ohci_device {
-	ed_t	ed[NUM_EDS];
-	int ed_cnt;
-};
-
 /* hcd */
 /* endpoint */
 static int ep_link(ohci_t * ohci, ed_t * ed);
 static int ep_unlink(ohci_t * ohci, ed_t * ed);
-static ed_t * ep_add_ed(struct usb_device * usb_dev, unsigned long pipe,
-		int interval, int load);
+static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
+		       unsigned long pipe, int interval, int load);
 
 /*-------------------------------------------------------------------------*/
 
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (4 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:57   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable Hans de Goede
                   ` (10 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

This is a preparation patch for adding driver-model support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 10 ++--------
 drivers/usb/host/ohci.h     | 19 +++++++------------
 2 files changed, 9 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 745825c..b5676ab 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -447,7 +447,7 @@ int sohci_submit_job(ohci_t *ohci, ohci_dev_t *ohci_dev, urb_priv_t *urb,
 	/* allocate the TDs */
 	/* note that td[0] was allocated in ep_add_ed */
 	for (i = 0; i < size; i++) {
-		purb_priv->td[i] = td_alloc(dev);
+		purb_priv->td[i] = td_alloc(ohci_dev, dev);
 		if (!purb_priv->td[i]) {
 			purb_priv->length = i;
 			urb_free_priv(purb_priv);
@@ -760,7 +760,7 @@ static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
 
 	if (ed->state == ED_NEW) {
 		/* dummy td; end of td list for ed */
-		td = td_alloc(usb_dev);
+		td = td_alloc(ohci_dev, usb_dev);
 		ed->hwTailP = m32_swap((unsigned long)td);
 		ed->hwHeadP = ed->hwTailP;
 		ed->state = ED_UNLINK;
@@ -1762,12 +1762,6 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
 	}
 	phcca = &ghcca[0];
 	info("aligned ghcca %p", phcca);
-	memset(gtd, 0, sizeof(td_t) * (NUM_TD + 1));
-	if ((__u32)gtd & 0x7) {
-		err("TDs not aligned!!");
-		return -1;
-	}
-	ptd = gtd;
 	gohci.hcca = phcca;
 	memset(phcca, 0, sizeof(struct ohci_hcca));
 
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index c319164..96a0ac1 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -410,8 +410,11 @@ typedef struct
 
 #define NUM_EDS 8		/* num of preallocated endpoint descriptors */
 
+#define NUM_TD 64		/* we need more TDs than EDs */
+
 typedef struct ohci_device {
 	ed_t ed[NUM_EDS] __aligned(16);
+	td_t tds[NUM_TD] __aligned(32);
 	int ed_cnt;
 } ohci_dev_t;
 
@@ -425,7 +428,7 @@ typedef struct ohci_device {
 
 typedef struct ohci {
 	/* this allocates EDs for all possible endpoints */
-	struct ohci_device ohci_dev __aligned(16);
+	struct ohci_device ohci_dev __aligned(32);
 	struct ohci_hcca *hcca;		/* hcca */
 	/*dma_addr_t hcca_dma;*/
 
@@ -457,17 +460,9 @@ static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
 
 /*-------------------------------------------------------------------------*/
 
-/* we need more TDs than EDs */
-#define NUM_TD 64
-
-/* +1 so we can align the storage */
-td_t gtd[NUM_TD+1];
-/* pointers to aligned storage */
-td_t *ptd;
-
 /* TDs ... */
 static inline struct td *
-td_alloc (struct usb_device *usb_dev)
+td_alloc (ohci_dev_t *ohci_dev, struct usb_device *usb_dev)
 {
 	int i;
 	struct td	*td;
@@ -475,9 +470,9 @@ td_alloc (struct usb_device *usb_dev)
 	td = NULL;
 	for (i = 0; i < NUM_TD; i++)
 	{
-		if (ptd[i].usb_dev == NULL)
+		if (ohci_dev->tds[i].usb_dev == NULL)
 		{
-			td = &ptd[i];
+			td = &ohci_dev->tds[i];
 			td->usb_dev = usb_dev;
 			break;
 		}
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (5 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:57   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c Hans de Goede
                   ` (9 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

This is a preparation patch for adding driver-model support.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index b5676ab..07e0848 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -107,8 +107,6 @@ static struct pci_device_id ehci_pci_ids[] = {
 static ohci_t gohci;
 /* this must be aligned to a 256 byte boundary */
 struct ohci_hcca ghcca[1];
-/* a pointer to the aligned storage */
-struct ohci_hcca *phcca;
 
 static inline u32 roothub_a(struct ohci *hc)
 	{ return ohci_readl(&hc->regs->roothub.a); }
@@ -1760,10 +1758,9 @@ int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
 		err("HCCA not aligned!!");
 		return -1;
 	}
-	phcca = &ghcca[0];
-	info("aligned ghcca %p", phcca);
-	gohci.hcca = phcca;
-	memset(phcca, 0, sizeof(struct ohci_hcca));
+	gohci.hcca = &ghcca[0];
+	info("aligned ghcca %p", gohci.hcca);
+	memset(gohci.hcca, 0, sizeof(struct ohci_hcca));
 
 	gohci.disabled = 1;
 	gohci.sleeping = 0;
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (6 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:58   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0 Hans de Goede
                   ` (8 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Non static function and variable declarations do not belong in a .h file.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 86 +++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci.h     | 93 ---------------------------------------------
 2 files changed, 86 insertions(+), 93 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 07e0848..15aea98 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -108,6 +108,61 @@ static ohci_t gohci;
 /* this must be aligned to a 256 byte boundary */
 struct ohci_hcca ghcca[1];
 
+/* mapping of the OHCI CC status to error codes */
+static int cc_to_error[16] = {
+	/* No  Error  */	       0,
+	/* CRC Error  */	       USB_ST_CRC_ERR,
+	/* Bit Stuff  */	       USB_ST_BIT_ERR,
+	/* Data Togg  */	       USB_ST_CRC_ERR,
+	/* Stall      */	       USB_ST_STALLED,
+	/* DevNotResp */	       -1,
+	/* PIDCheck   */	       USB_ST_BIT_ERR,
+	/* UnExpPID   */	       USB_ST_BIT_ERR,
+	/* DataOver   */	       USB_ST_BUF_ERR,
+	/* DataUnder  */	       USB_ST_BUF_ERR,
+	/* reservd    */	       -1,
+	/* reservd    */	       -1,
+	/* BufferOver */	       USB_ST_BUF_ERR,
+	/* BuffUnder  */	       USB_ST_BUF_ERR,
+	/* Not Access */	       -1,
+	/* Not Access */	       -1
+};
+
+static const char *cc_to_string[16] = {
+	"No Error",
+	"CRC: Last data packet from endpoint contained a CRC error.",
+	"BITSTUFFING: Last data packet from endpoint contained a bit " \
+		     "stuffing violation",
+	"DATATOGGLEMISMATCH: Last packet from endpoint had data toggle PID\n" \
+		     "that did not match the expected value.",
+	"STALL: TD was moved to the Done Queue because the endpoint returned" \
+		     " a STALL PID",
+	"DEVICENOTRESPONDING: Device did not respond to token (IN) or did\n" \
+		     "not provide a handshake (OUT)",
+	"PIDCHECKFAILURE: Check bits on PID from endpoint failed on data PID\n"\
+		     "(IN) or handshake (OUT)",
+	"UNEXPECTEDPID: Receive PID was not valid when encountered or PID\n" \
+		     "value is not defined.",
+	"DATAOVERRUN: The amount of data returned by the endpoint exceeded\n" \
+		     "either the size of the maximum data packet allowed\n" \
+		     "from the endpoint (found in MaximumPacketSize field\n" \
+		     "of ED) or the remaining buffer size.",
+	"DATAUNDERRUN: The endpoint returned less than MaximumPacketSize\n" \
+		     "and that amount was not sufficient to fill the\n" \
+		     "specified buffer",
+	"reserved1",
+	"reserved2",
+	"BUFFEROVERRUN: During an IN, HC received data from endpoint faster\n" \
+		     "than it could be written to system memory",
+	"BUFFERUNDERRUN: During an OUT, HC could not retrieve data from\n" \
+		     "system memory fast enough to keep up with data USB " \
+		     "data rate.",
+	"NOT ACCESSED: This code is set by software before the TD is placed" \
+		     "on a list to be processed by the HC.(1)",
+	"NOT ACCESSED: This code is set by software before the TD is placed" \
+		     "on a list to be processed by the HC.(2)",
+};
+
 static inline u32 roothub_a(struct ohci *hc)
 	{ return ohci_readl(&hc->regs->roothub.a); }
 static inline u32 roothub_b(struct ohci *hc)
@@ -123,6 +178,37 @@ static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
 			  unsigned long pipe, void *buffer, int transfer_len,
 			  struct devrequest *setup, urb_priv_t *urb,
 			  int interval);
+static int ep_link(ohci_t * ohci, ed_t * ed);
+static int ep_unlink(ohci_t * ohci, ed_t * ed);
+static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
+		       unsigned long pipe, int interval, int load);
+
+/*-------------------------------------------------------------------------*/
+
+/* TDs ... */
+static struct td *td_alloc(ohci_dev_t *ohci_dev, struct usb_device *usb_dev)
+{
+	int i;
+	struct td *td;
+
+	td = NULL;
+	for (i = 0; i < NUM_TD; i++)
+	{
+		if (ohci_dev->tds[i].usb_dev == NULL)
+		{
+			td = &ohci_dev->tds[i];
+			td->usb_dev = usb_dev;
+			break;
+		}
+	}
+
+	return td;
+}
+
+static inline void ed_free(struct ed *ed)
+{
+	ed->usb_dev = NULL;
+}
 
 /*-------------------------------------------------------------------------*
  * URB support functions
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 96a0ac1..24f5e4e 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -25,64 +25,7 @@ int usb_cpu_init(void);
 int usb_cpu_stop(void);
 int usb_cpu_init_fail(void);
 
-static int cc_to_error[16] = {
-
-/* mapping of the OHCI CC status to error codes */
-	/* No  Error  */	       0,
-	/* CRC Error  */	       USB_ST_CRC_ERR,
-	/* Bit Stuff  */	       USB_ST_BIT_ERR,
-	/* Data Togg  */	       USB_ST_CRC_ERR,
-	/* Stall      */	       USB_ST_STALLED,
-	/* DevNotResp */	       -1,
-	/* PIDCheck   */	       USB_ST_BIT_ERR,
-	/* UnExpPID   */	       USB_ST_BIT_ERR,
-	/* DataOver   */	       USB_ST_BUF_ERR,
-	/* DataUnder  */	       USB_ST_BUF_ERR,
-	/* reservd    */	       -1,
-	/* reservd    */	       -1,
-	/* BufferOver */	       USB_ST_BUF_ERR,
-	/* BuffUnder  */	       USB_ST_BUF_ERR,
-	/* Not Access */	       -1,
-	/* Not Access */	       -1
-};
-
-static const char *cc_to_string[16] = {
-	"No Error",
-	"CRC: Last data packet from endpoint contained a CRC error.",
-	"BITSTUFFING: Last data packet from endpoint contained a bit " \
-		     "stuffing violation",
-	"DATATOGGLEMISMATCH: Last packet from endpoint had data toggle PID\n" \
-		     "that did not match the expected value.",
-	"STALL: TD was moved to the Done Queue because the endpoint returned" \
-		     " a STALL PID",
-	"DEVICENOTRESPONDING: Device did not respond to token (IN) or did\n" \
-		     "not provide a handshake (OUT)",
-	"PIDCHECKFAILURE: Check bits on PID from endpoint failed on data PID\n"\
-		     "(IN) or handshake (OUT)",
-	"UNEXPECTEDPID: Receive PID was not valid when encountered or PID\n" \
-		     "value is not defined.",
-	"DATAOVERRUN: The amount of data returned by the endpoint exceeded\n" \
-		     "either the size of the maximum data packet allowed\n" \
-		     "from the endpoint (found in MaximumPacketSize field\n" \
-		     "of ED) or the remaining buffer size.",
-	"DATAUNDERRUN: The endpoint returned less than MaximumPacketSize\n" \
-		     "and that amount was not sufficient to fill the\n" \
-		     "specified buffer",
-	"reserved1",
-	"reserved2",
-	"BUFFEROVERRUN: During an IN, HC received data from endpoint faster\n" \
-		     "than it could be written to system memory",
-	"BUFFERUNDERRUN: During an OUT, HC could not retrieve data from\n" \
-		     "system memory fast enough to keep up with data USB " \
-		     "data rate.",
-	"NOT ACCESSED: This code is set by software before the TD is placed" \
-		     "on a list to be processed by the HC.(1)",
-	"NOT ACCESSED: This code is set by software before the TD is placed" \
-		     "on a list to be processed by the HC.(2)",
-};
-
 /* ED States */
-
 #define ED_NEW		0x00
 #define ED_UNLINK	0x01
 #define ED_OPER		0x02
@@ -450,39 +393,3 @@ typedef struct ohci {
 
 	const char	*slot_name;
 } ohci_t;
-
-/* hcd */
-/* endpoint */
-static int ep_link(ohci_t * ohci, ed_t * ed);
-static int ep_unlink(ohci_t * ohci, ed_t * ed);
-static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
-		       unsigned long pipe, int interval, int load);
-
-/*-------------------------------------------------------------------------*/
-
-/* TDs ... */
-static inline struct td *
-td_alloc (ohci_dev_t *ohci_dev, struct usb_device *usb_dev)
-{
-	int i;
-	struct td	*td;
-
-	td = NULL;
-	for (i = 0; i < NUM_TD; i++)
-	{
-		if (ohci_dev->tds[i].usb_dev == NULL)
-		{
-			td = &ohci_dev->tds[i];
-			td->usb_dev = usb_dev;
-			break;
-		}
-	}
-
-	return td;
-}
-
-static inline void
-ed_free (struct ed *ed)
-{
-	ed->usb_dev = NULL;
-}
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (7 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:59   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus Hans de Goede
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Fix taken from the Linux kernel ohci driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 15aea98..02aa7f3 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -988,7 +988,7 @@ static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
 		}
 
 		/* Status phase */
-		info = usb_pipeout(pipe)?
+		info = (usb_pipeout(pipe) || data_len == 0) ?
 			TD_CC | TD_DP_IN | TD_T_DATA1:
 			TD_CC | TD_DP_OUT | TD_T_DATA1;
 		td_fill(ohci, info, data, 0, dev, cnt++, urb);
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (8 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0 Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 23:02   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout Hans de Goede
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Add proper cache flushing / invalidating for non cache coherent cpus, for now
only enable this for new (driver-model) usb code to avoid regressions.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 67 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci.h     | 22 +++++++++++----
 2 files changed, 84 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 02aa7f3..3744658 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -103,6 +103,32 @@ static struct pci_device_id ehci_pci_ids[] = {
 # define m32_swap(x) cpu_to_le32(x)
 #endif /* CONFIG_SYS_OHCI_BE_CONTROLLER */
 
+#ifdef CONFIG_DM_USB
+/*
+ * We really should do proper cache flushing everywhere, but for now we only
+ * do it for new (driver-model) usb code to avoid regressions.
+ */
+#define flush_dcache_buffer(addr, size) \
+	flush_dcache_range((unsigned long)(addr), \
+		ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN))
+#define invalidate_dcache_buffer(addr, size) \
+	invalidate_dcache_range((unsigned long)(addr), \
+		ALIGN((unsigned long)(addr) + size, ARCH_DMA_MINALIGN))
+#else
+#define flush_dcache_buffer(addr, size)
+#define invalidate_dcache_buffer(addr, size)
+#endif
+
+/* Do not use sizeof(ed / td) as our ed / td structs contain extra members */
+#define flush_dcache_ed(addr) flush_dcache_buffer(addr, 16)
+#define flush_dcache_td(addr) flush_dcache_buffer(addr, 16)
+#define flush_dcache_iso_td(addr) flush_dcache_buffer(addr, 32)
+#define flush_dcache_hcca(addr) flush_dcache_buffer(addr, 256)
+#define invalidate_dcache_ed(addr) invalidate_dcache_buffer(addr, 16)
+#define invalidate_dcache_td(addr) invalidate_dcache_buffer(addr, 16)
+#define invalidate_dcache_iso_td(addr) invalidate_dcache_buffer(addr, 32)
+#define invalidate_dcache_hcca(addr) invalidate_dcache_buffer(addr, 256)
+
 /* global ohci_t */
 static ohci_t gohci;
 /* this must be aligned to a 256 byte boundary */
@@ -293,9 +319,11 @@ void ep_print_int_eds(ohci_t *ohci, char *str)
 		ed_p = &(ohci->hcca->int_table [i]);
 		if (*ed_p == 0)
 		    continue;
+		invalidate_dcache_ed(ed_p);
 		printf(__FILE__ ": %s branch int %2d(%2x):", str, i, i);
 		while (*ed_p != 0 && j--) {
 			ed_t *ed = (ed_t *)m32_swap(ed_p);
+			invalidate_dcache_ed(ed);
 			printf(" ed: %4x;", ed->hwINFO);
 			ed_p = &ed->hwNextED;
 		}
@@ -326,6 +354,7 @@ static void maybe_print_eds(char *label, __u32 value)
 
 	if (value) {
 		dbg("%s %08x", label, value);
+		invalidate_dcache_ed(edp);
 		dbg("%08x", edp->hwINFO);
 		dbg("%08x", edp->hwTailP);
 		dbg("%08x", edp->hwHeadP);
@@ -460,6 +489,7 @@ static void ohci_dump(ohci_t *controller, int verbose)
 	ohci_dump_status(controller);
 	if (verbose)
 		ep_print_int_eds(controller, "hcca");
+	invalidate_dcache_hcca(controller->hcca);
 	dbg("hcca frame #%04x", controller->hcca->frame_no);
 	ohci_dump_roothub(controller, 1);
 }
@@ -597,6 +627,7 @@ static inline int sohci_return_job(struct ohci *hc, urb_priv_t *urb)
 /* tell us the current USB frame number */
 static int sohci_get_current_frame_number(ohci_t *ohci)
 {
+	invalidate_dcache_hcca(ohci->hcca);
 	return m16_swap(ohci->hcca->frame_no);
 }
 #endif
@@ -675,6 +706,7 @@ static int ep_link(ohci_t *ohci, ed_t *edi)
 	switch (ed->type) {
 	case PIPE_CONTROL:
 		ed->hwNextED = 0;
+		flush_dcache_ed(ed);
 		if (ohci->ed_controltail == NULL)
 			ohci_writel(ed, &ohci->regs->ed_controlhead);
 		else
@@ -692,6 +724,7 @@ static int ep_link(ohci_t *ohci, ed_t *edi)
 
 	case PIPE_BULK:
 		ed->hwNextED = 0;
+		flush_dcache_ed(ed);
 		if (ohci->ed_bulktail == NULL)
 			ohci_writel(ed, &ohci->regs->ed_bulkhead);
 		else
@@ -724,7 +757,9 @@ static int ep_link(ohci_t *ohci, ed_t *edi)
 					inter = ep_rev(6,
 						 ((ed_t *)ed_p)->int_interval);
 			ed->hwNextED = *ed_p;
+			flush_dcache_ed(ed);
 			*ed_p = m32_swap((unsigned long)ed);
+			flush_dcache_hcca(ohci->hcca);
 		}
 		break;
 	}
@@ -737,6 +772,8 @@ static int ep_link(ohci_t *ohci, ed_t *edi)
 static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed,
 			    unsigned index, unsigned period)
 {
+	__maybe_unused unsigned long aligned_ed_p;
+
 	for (; index < NUM_INTS; index += period) {
 		__u32	*ed_p = &ohci->hcca->int_table [index];
 
@@ -745,6 +782,12 @@ static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed,
 			if (((struct ed *)
 					m32_swap((unsigned long)ed_p)) == ed) {
 				*ed_p = ed->hwNextED;
+#ifdef CONFIG_DM_USB
+				aligned_ed_p = (unsigned long)ed_p;
+				aligned_ed_p &= ~(ARCH_DMA_MINALIGN - 1);
+				flush_dcache_range(aligned_ed_p,
+					aligned_ed_p + ARCH_DMA_MINALIGN);
+#endif
 				break;
 			}
 			ed_p = &(((struct ed *)
@@ -764,6 +807,7 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi)
 	int i;
 
 	ed->hwINFO |= m32_swap(OHCI_ED_SKIP);
+	flush_dcache_ed(ed);
 
 	switch (ed->type) {
 	case PIPE_CONTROL:
@@ -777,6 +821,7 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi)
 				&ohci->regs->ed_controlhead);
 		} else {
 			ed->ed_prev->hwNextED = ed->hwNextED;
+			flush_dcache_ed(ed->ed_prev);
 		}
 		if (ohci->ed_controltail == ed) {
 			ohci->ed_controltail = ed->ed_prev;
@@ -797,6 +842,7 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi)
 			       &ohci->regs->ed_bulkhead);
 		} else {
 			ed->ed_prev->hwNextED = ed->hwNextED;
+			flush_dcache_ed(ed->ed_prev);
 		}
 		if (ohci->ed_bulktail == ed) {
 			ohci->ed_bulktail = ed->ed_prev;
@@ -865,6 +911,8 @@ static ed_t *ep_add_ed(ohci_dev_t *ohci_dev, struct usb_device *usb_dev,
 		ed->int_load = load;
 	}
 
+	flush_dcache_ed(ed);
+
 	return ed_ret;
 }
 
@@ -890,6 +938,7 @@ static void td_fill(ohci_t *ohci, unsigned int info,
 	/* use this td as the next dummy */
 	td_pt = urb_priv->td [index];
 	td_pt->hwNextTD = 0;
+	flush_dcache_td(td_pt);
 
 	/* fill the old dummy TD */
 	td = urb_priv->td [index] =
@@ -917,9 +966,11 @@ static void td_fill(ohci_t *ohci, unsigned int info,
 		td->hwBE = 0;
 
 	td->hwNextTD = m32_swap((unsigned long)td_pt);
+	flush_dcache_td(td);
 
 	/* append to queue */
 	td->ed->hwTailP = td->hwNextTD;
+	flush_dcache_ed(td->ed);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -937,6 +988,8 @@ static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
 	__u32 info = 0;
 	unsigned int toggle = 0;
 
+	flush_dcache_buffer(buffer, data_len);
+
 	/* OHCI handles the DATA-toggles itself, we just use the USB-toggle
 	 * bits for reseting */
 	if (usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe))) {
@@ -976,6 +1029,7 @@ static void td_submit_job(ohci_t *ohci, struct usb_device *dev,
 	case PIPE_CONTROL:
 		/* Setup phase */
 		info = TD_CC | TD_DP_SETUP | TD_T_DATA0;
+		flush_dcache_buffer(setup, 8);
 		td_fill(ohci, info, setup, 8, dev, cnt++, urb);
 
 		/* Optional Data phase */
@@ -1047,6 +1101,7 @@ static void check_status(td_t *td_list)
 	if (cc) {
 		err(" USB-error: %s (%x)", cc_to_string[cc], cc);
 
+		invalidate_dcache_ed(td_list->ed);
 		if (*phwHeadP & m32_swap(0x1)) {
 			if (lurb_priv &&
 			    ((td_list->index + 1) < urb_len)) {
@@ -1059,9 +1114,11 @@ static void check_status(td_t *td_list)
 						     td_list->index - 1;
 			} else
 				*phwHeadP &= m32_swap(0xfffffff2);
+			flush_dcache_ed(td_list->ed);
 		}
 #ifdef CONFIG_MPC5200
 		td_list->hwNextTD = 0;
+		flush_dcache_td(td_list);
 #endif
 	}
 }
@@ -1074,11 +1131,14 @@ static td_t *dl_reverse_done_list(ohci_t *ohci)
 	td_t *td_rev = NULL;
 	td_t *td_list = NULL;
 
+	invalidate_dcache_hcca(ohci->hcca);
 	td_list_hc = m32_swap(ohci->hcca->done_head) & 0xfffffff0;
 	ohci->hcca->done_head = 0;
+	flush_dcache_hcca(ohci->hcca);
 
 	while (td_list_hc) {
 		td_list = (td_t *)td_list_hc;
+		invalidate_dcache_td(td_list);
 		check_status(td_list);
 		td_list->next_dl_td = td_rev;
 		td_rev = td_list;
@@ -1113,6 +1173,7 @@ static int takeback_td(ohci_t *ohci, td_t *td_list)
 	urb_priv_t *lurb_priv;
 	__u32 tdINFO, edHeadP, edTailP;
 
+	invalidate_dcache_td(td_list);
 	tdINFO = m32_swap(td_list->hwINFO);
 
 	ed = td_list->ed;
@@ -1138,6 +1199,7 @@ static int takeback_td(ohci_t *ohci, td_t *td_list)
 		lurb_priv->td_cnt, lurb_priv->length);
 
 	if (ed->state != ED_NEW && (!usb_pipeint(lurb_priv->pipe))) {
+		invalidate_dcache_ed(ed);
 		edHeadP = m32_swap(ed->hwHeadP) & 0xfffffff0;
 		edTailP = m32_swap(ed->hwTailP);
 
@@ -1521,6 +1583,9 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 	dev->status = stat;
 	dev->act_len = urb->actual_length;
 
+	if (usb_pipein(pipe) && dev->status == 0 && dev->act_len)
+		invalidate_dcache_buffer(buffer, dev->act_len);
+
 #ifdef DEBUG
 	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "RET(ctlr)", usb_pipein(pipe));
@@ -1727,6 +1792,8 @@ static int hc_interrupt(ohci_t *ohci)
 	int ints;
 	int stat = -1;
 
+	invalidate_dcache_hcca(ohci->hcca);
+
 	if ((ohci->hcca->done_head != 0) &&
 				!(m32_swap(ohci->hcca->done_head) & 0x01)) {
 		ints =  OHCI_INTR_WDH;
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 24f5e4e..f52b4c1 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -18,6 +18,18 @@
 # define ohci_writel(a, b) (*((volatile u32 *)(b)) = ((volatile u32)a))
 #endif /* CONFIG_SYS_OHCI_SWAP_REG_ACCESS */
 
+#if defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 16
+#define ED_ALIGNMENT ARCH_DMA_MINALIGN
+#else
+#define ED_ALIGNMENT 16
+#endif
+
+#if defined CONFIG_DM_USB && ARCH_DMA_MINALIGN > 32
+#define TD_ALIGNMENT ARCH_DMA_MINALIGN
+#else
+#define TD_ALIGNMENT 32
+#endif
+
 /* functions for doing board or CPU specific setup/cleanup */
 int usb_board_stop(void);
 
@@ -52,7 +64,7 @@ struct ed {
 	struct usb_device *usb_dev;
 	void *purb;
 	__u32 unused[2];
-} __attribute__((aligned(16)));
+} __attribute__((aligned(ED_ALIGNMENT)));
 typedef struct ed ed_t;
 
 
@@ -112,7 +124,7 @@ struct td {
 	__u32 data;
 
 	__u32 unused2[2];
-} __attribute__((aligned(32)));
+} __attribute__((aligned(TD_ALIGNMENT)));
 typedef struct td td_t;
 
 #define OHCI_ED_SKIP	(1 << 14)
@@ -356,8 +368,8 @@ typedef struct
 #define NUM_TD 64		/* we need more TDs than EDs */
 
 typedef struct ohci_device {
-	ed_t ed[NUM_EDS] __aligned(16);
-	td_t tds[NUM_TD] __aligned(32);
+	ed_t ed[NUM_EDS] __aligned(ED_ALIGNMENT);
+	td_t tds[NUM_TD] __aligned(TD_ALIGNMENT);
 	int ed_cnt;
 } ohci_dev_t;
 
@@ -371,7 +383,7 @@ typedef struct ohci_device {
 
 typedef struct ohci {
 	/* this allocates EDs for all possible endpoints */
-	struct ohci_device ohci_dev __aligned(32);
+	struct ohci_device ohci_dev __aligned(TD_ALIGNMENT);
 	struct ohci_hcca *hcca;		/* hcca */
 	/*dma_addr_t hcca_dma;*/
 
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (9 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 22:59   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 12/16] usb: ohci: Do not resubmit and leak urbs for interrupt packets Hans de Goede
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Interrupts transfers timing out is normal, so do not log an error for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 3744658..494b760 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1572,7 +1572,8 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 				dbg("*");
 
 		} else {
-			err("CTL:TIMEOUT ");
+			if (!usb_pipeint(pipe))
+				err("CTL:TIMEOUT ");
 			dbg("submit_common_msg: TO status %x\n", stat);
 			urb->finished = 1;
 			stat = USB_ST_CRC_ERR;
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 12/16] usb: ohci: Do not resubmit and leak urbs for interrupt packets
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (10 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 23:00   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths Hans de Goede
                   ` (4 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Auto-resubmission of interrupt packets does not match the u-boot usb model.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 41 ++---------------------------------------
 1 file changed, 2 insertions(+), 39 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 494b760..da500c0 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -587,40 +587,6 @@ int sohci_submit_job(ohci_t *ohci, ohci_dev_t *ohci_dev, urb_priv_t *urb,
 	return 0;
 }
 
-static inline int sohci_return_job(struct ohci *hc, urb_priv_t *urb)
-{
-	struct ohci_regs *regs = hc->regs;
-
-	switch (usb_pipetype(urb->pipe)) {
-	case PIPE_INTERRUPT:
-		/* implicitly requeued */
-		if (urb->dev->irq_handle &&
-				(urb->dev->irq_act_len = urb->actual_length)) {
-			ohci_writel(OHCI_INTR_WDH, &regs->intrenable);
-			ohci_readl(&regs->intrenable); /* PCI posting flush */
-			urb->dev->irq_handle(urb->dev);
-			ohci_writel(OHCI_INTR_WDH, &regs->intrdisable);
-			ohci_readl(&regs->intrdisable); /* PCI posting flush */
-		}
-		urb->actual_length = 0;
-		td_submit_job(  hc,
-				urb->dev,
-				urb->pipe,
-				urb->transfer_buffer,
-				urb->transfer_buffer_length,
-				NULL,
-				urb,
-				urb->interval);
-		break;
-	case PIPE_CONTROL:
-	case PIPE_BULK:
-		break;
-	default:
-		return 0;
-	}
-	return 1;
-}
-
 /*-------------------------------------------------------------------------*/
 
 #ifdef DEBUG
@@ -1153,7 +1119,7 @@ static td_t *dl_reverse_done_list(ohci_t *ohci)
 static void finish_urb(ohci_t *ohci, urb_priv_t *urb, int status)
 {
 	if ((status & (ED_OPER | ED_UNLINK)) && (urb->state != URB_DEL))
-		urb->finished = sohci_return_job(ohci, urb);
+		urb->finished = 1;
 	else
 		dbg("finish_urb: strange.., ED state %x, \n", status);
 }
@@ -1593,10 +1559,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 #else
 	mdelay(1);
 #endif
-
-	/* free TDs in urb_priv */
-	if (!usb_pipeint(pipe))
-		urb_free_priv(urb);
+	urb_free_priv(urb);
 	return 0;
 }
 
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (11 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 12/16] usb: ohci: Do not resubmit and leak urbs for interrupt packets Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 23:01   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places Hans de Goede
                   ` (3 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

The common usb_hub code already waits a full second after powering up ports,
so there is no need for additional delays inside the hcd code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index da500c0..dc0892f 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1338,7 +1338,6 @@ pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 			OK(0);
 		case (RH_PORT_POWER):
 			WR_RH_PORTSTAT(RH_PS_PPS);
-			mdelay(100);
 			OK(0);
 		case (RH_PORT_ENABLE): /* BUG IN HUP CODE *********/
 			if (RD_RH_PORTSTAT & RH_PS_CCS)
@@ -1737,9 +1736,6 @@ static int hc_start(ohci_t *ohci)
 	ohci_writel(RH_HS_LPSC, &ohci->regs->roothub.status);
 #endif	/* OHCI_USE_NPS */
 
-	/* POTPGT delay is bits 24-31, in 2 ms units. */
-	mdelay((roothub_a(ohci) >> 23) & 0x1fe);
-
 	/* connect the virtual root hub */
 	ohci->rh.devnum = 0;
 
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (12 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 23:01   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 15/16] usb: ohci: Add dm support Hans de Goede
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

For some reason the ohci code is full with:

		pkt_print(...)
		mdelay(1);

AFAICT there is no reason for the mdelay(1) calls. This commit disables them
when building the ohci code for new driver-model using boards. It leaves
the mdelay(1) calls in place when building for older boards, so as to avoid
causing any regressions there.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index dc0892f..d06d9dc 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1256,7 +1256,7 @@ static int ohci_submit_rh_msg(ohci_t *ohci, struct usb_device *dev,
 #ifdef DEBUG
 pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 	  cmd, "SUB(rh)", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	if (usb_pipeint(pipe)) {
@@ -1441,7 +1441,7 @@ pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 
 #ifdef	DEBUG
 	ohci_dump_roothub(ohci, 1);
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 
@@ -1454,7 +1454,7 @@ pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 #ifdef DEBUG
 	pkt_print(ohci, NULL, dev, pipe, buffer,
 		  transfer_len, cmd, "RET(rh)", 0/*usb_pipein(pipe)*/);
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 
@@ -1487,7 +1487,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 	urb->actual_length = 0;
 	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "SUB", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	if (!maxsize) {
@@ -1555,7 +1555,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 #ifdef DEBUG
 	pkt_print(ohci, urb, dev, pipe, buffer, transfer_len,
 		  setup, "RET(ctlr)", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	urb_free_priv(urb);
@@ -1589,7 +1589,7 @@ static int _ohci_submit_control_msg(ohci_t *ohci, struct usb_device *dev,
 #ifdef DEBUG
 	pkt_print(ohci, NULL, dev, pipe, buffer, transfer_len,
 		  setup, "SUB", usb_pipein(pipe));
-#else
+#elif !defined CONFIG_DM_USB
 	mdelay(1);
 #endif
 	if (!maxsize) {
@@ -1786,7 +1786,7 @@ static int hc_interrupt(ohci_t *ohci)
 
 #ifdef	DEBUG
 		ohci_dump(ohci, 1);
-#else
+#elif !defined CONFIG_DM_USB
 		mdelay(1);
 #endif
 		/* FIXME: be optimistic, hope that bug won't repeat often. */
@@ -1798,7 +1798,9 @@ static int hc_interrupt(ohci_t *ohci)
 	}
 
 	if (ints & OHCI_INTR_WDH) {
+#if !defined CONFIG_DM_USB
 		mdelay(1);
+#endif
 		ohci_writel(OHCI_INTR_WDH, &regs->intrdisable);
 		(void)ohci_readl(&regs->intrdisable); /* flush */
 		stat = dl_done_list(ohci);
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 15/16] usb: ohci: Add dm support
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (13 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 23:04   ` Marek Vasut
  2015-05-05 21:56 ` [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support Hans de Goede
  2015-05-05 22:23 ` [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Marek Vasut
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

Add driver-model support to the ohci code.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/usb/host/ohci-hcd.c | 84 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/usb/host/ohci.h     |  7 ++++
 2 files changed, 91 insertions(+)

diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index d06d9dc..9a0313a 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -30,6 +30,8 @@
 
 #include <common.h>
 #include <asm/byteorder.h>
+#include <dm.h>
+#include <errno.h>
 
 #if defined(CONFIG_PCI_OHCI)
 # include <pci.h>
@@ -129,10 +131,12 @@ static struct pci_device_id ehci_pci_ids[] = {
 #define invalidate_dcache_iso_td(addr) invalidate_dcache_buffer(addr, 32)
 #define invalidate_dcache_hcca(addr) invalidate_dcache_buffer(addr, 256)
 
+#ifndef CONFIG_DM_USB
 /* global ohci_t */
 static ohci_t gohci;
 /* this must be aligned to a 256 byte boundary */
 struct ohci_hcca ghcca[1];
+#endif
 
 /* mapping of the OHCI CC status to error codes */
 static int cc_to_error[16] = {
@@ -1562,6 +1566,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev,
 	return 0;
 }
 
+#ifndef CONFIG_DM_USB
 /* submit routines called from usb.c */
 int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 		int transfer_len)
@@ -1578,6 +1583,7 @@ int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
 	return submit_common_msg(&gohci, dev, pipe, buffer, transfer_len, NULL,
 			interval);
 }
+#endif
 
 static int _ohci_submit_control_msg(ohci_t *ohci, struct usb_device *dev,
 	unsigned long pipe, void *buffer, int transfer_len,
@@ -1830,6 +1836,8 @@ static int hc_interrupt(ohci_t *ohci)
 
 /*-------------------------------------------------------------------------*/
 
+#ifndef CONFIG_DM_USB
+
 /*-------------------------------------------------------------------------*/
 
 /* De-allocate all resources.. */
@@ -1976,3 +1984,79 @@ int submit_control_msg(struct usb_device *dev, unsigned long pipe,
 	return _ohci_submit_control_msg(&gohci, dev, pipe, buffer,
 					transfer_len, setup);
 }
+#endif
+
+#ifdef CONFIG_DM_USB
+static int ohci_submit_control_msg(struct udevice *dev, struct usb_device *udev,
+				   unsigned long pipe, void *buffer, int length,
+				   struct devrequest *setup)
+{
+	ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
+
+	return _ohci_submit_control_msg(ohci, udev, pipe, buffer,
+					length, setup);
+}
+
+static int ohci_submit_bulk_msg(struct udevice *dev, struct usb_device *udev,
+				unsigned long pipe, void *buffer, int length)
+{
+	ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
+
+	return submit_common_msg(ohci, udev, pipe, buffer, length, NULL, 0);
+}
+
+static int ohci_submit_int_msg(struct udevice *dev, struct usb_device *udev,
+			       unsigned long pipe, void *buffer, int length,
+			       int interval)
+{
+	ohci_t *ohci = dev_get_priv(usb_get_bus(dev));
+
+	return submit_common_msg(ohci, udev, pipe, buffer, length,
+				 NULL, interval);
+}
+
+int ohci_register(struct udevice *dev, struct ohci_regs *regs)
+{
+	struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+	ohci_t *ohci = dev_get_priv(dev);
+	u32 reg;
+
+	priv->desc_before_addr = true;
+
+	ohci->regs = regs;
+	ohci->hcca = memalign(256, sizeof(struct ohci_hcca));
+	if (!ohci->hcca)
+		return -ENOMEM;
+	memset(ohci->hcca, 0, sizeof(struct ohci_hcca));
+
+	if (hc_reset(ohci) < 0)
+		return -EIO;
+
+	if (hc_start(ohci) < 0)
+		return -EIO;
+
+	reg = ohci_readl(&regs->revision);
+	printf("USB OHCI %x.%x\n", (reg >> 4) & 0xf, reg & 0xf);
+
+	return 0;
+}
+
+int ohci_deregister(struct udevice *dev)
+{
+	ohci_t *ohci = dev_get_priv(dev);
+
+	if (hc_reset(ohci) < 0)
+		return -EIO;
+
+	/* TODO free hcca, and ohci ? */
+
+	return 0;
+}
+
+struct dm_usb_ops ohci_usb_ops = {
+	.control = ohci_submit_control_msg,
+	.bulk = ohci_submit_bulk_msg,
+	.interrupt = ohci_submit_int_msg,
+};
+
+#endif
diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index f52b4c1..3f9869b 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -405,3 +405,10 @@ typedef struct ohci {
 
 	const char	*slot_name;
 } ohci_t;
+
+#ifdef CONFIG_DM_USB
+extern struct dm_usb_ops ohci_usb_ops;
+
+int ohci_register(struct udevice *dev, struct ohci_regs *regs);
+int ohci_deregister(struct udevice *dev);
+#endif
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (14 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 15/16] usb: ohci: Add dm support Hans de Goede
@ 2015-05-05 21:56 ` Hans de Goede
  2015-05-05 23:03   ` Marek Vasut
  2015-05-05 22:23 ` [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Marek Vasut
  16 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 21:56 UTC (permalink / raw)
  To: u-boot

This commit adds support for the OHCI companionen controller, which makes
usb-1 devices directly plugged into to usb root port work.

Note for now this switches usb-keyboard support for sunxi back from int-queue
support to the old interrupt polling method. Adding int-queue support to the
ohci code and switching back to int-queue support is in the works.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |   2 +
 drivers/usb/host/Makefile                     |   1 +
 drivers/usb/host/ohci-sunxi.c                 | 100 ++++++++++++++++++++++++++
 include/configs/sunxi-common.h                |   5 +-
 4 files changed, 107 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/host/ohci-sunxi.c

diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
index c28ee05..63c3319 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
@@ -320,6 +320,8 @@ struct sunxi_ccm_reg {
 #define CCM_USB_CTRL_PHY0_RST (0x1 << 0)
 #define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
 #define CCM_USB_CTRL_PHY2_RST (0x1 << 2)
+#define CCM_USB_CTRL_OHCI0_CLK (0x1 << 6)
+#define CCM_USB_CTRL_OHCI1_CLK (0x1 << 7)
 #define CCM_USB_CTRL_PHYGATE (0x1 << 8)
 /* These 3 are sun6i only, define them as 0 on sun4i */
 #define CCM_USB_CTRL_PHY0_CLK 0
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 3b57e56..4d35d3e 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
 obj-$(CONFIG_USB_SL811HS) += sl811-hcd.o
 obj-$(CONFIG_USB_OHCI_S3C24XX) += ohci-s3c24xx.o
 obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o
+obj-$(CONFIG_USB_OHCI_SUNXI) += ohci-sunxi.o
 
 # echi
 obj-$(CONFIG_USB_EHCI) += ehci-hcd.o
diff --git a/drivers/usb/host/ohci-sunxi.c b/drivers/usb/host/ohci-sunxi.c
new file mode 100644
index 0000000..4276d06
--- /dev/null
+++ b/drivers/usb/host/ohci-sunxi.c
@@ -0,0 +1,100 @@
+/*
+ * Sunxi ohci glue
+ *
+ * Copyright (C) 2015 Hans de Goede <hdegoede@redhat.com>
+ *
+ * Based on code from
+ * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/arch/clock.h>
+#include <asm/arch/usb_phy.h>
+#include <asm/io.h>
+#include <dm.h>
+#include <usb.h>
+#include "ohci.h"
+
+struct ohci_sunxi_priv {
+	ohci_t ohci;
+	int ahb_gate_mask; /* Mask of ahb_gate0 clk gate bits for this hcd */
+	int usb_gate_mask; /* Mask of usb_clk_cfg clk gate bits for this hcd */
+	int phy_index;     /* Index of the usb-phy attached to this hcd */
+};
+
+static int ohci_usb_probe(struct udevice *dev)
+{
+	struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+	struct usb_bus_priv *bus_priv = dev_get_uclass_priv(dev);
+	struct ohci_sunxi_priv *priv = dev_get_priv(dev);
+	struct ohci_regs *regs = (struct ohci_regs *)dev_get_addr(dev);
+
+	bus_priv->companion = true;
+
+	if (regs == (void *)(SUNXI_USB1_BASE + 0x400)) {
+		priv->ahb_gate_mask = 1 << AHB_GATE_OFFSET_USB_OHCI0;
+		priv->usb_gate_mask = CCM_USB_CTRL_OHCI0_CLK;
+		priv->phy_index = 1;
+	} else {
+		priv->ahb_gate_mask = 1 << AHB_GATE_OFFSET_USB_OHCI1;
+		priv->usb_gate_mask = CCM_USB_CTRL_OHCI1_CLK;
+		priv->phy_index = 2;
+	}
+
+	setbits_le32(&ccm->ahb_gate0, priv->ahb_gate_mask);
+	setbits_le32(&ccm->usb_clk_cfg, priv->usb_gate_mask);
+#ifdef CONFIG_SUNXI_GEN_SUN6I
+	setbits_le32(&ccm->ahb_reset0_cfg, priv->ahb_gate_mask);
+#endif
+
+	sunxi_usb_phy_init(priv->phy_index);
+	sunxi_usb_phy_power_on(priv->phy_index);
+
+	return ohci_register(dev, regs);
+}
+
+static int ohci_usb_remove(struct udevice *dev)
+{
+	struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+	struct ohci_sunxi_priv *priv = dev_get_priv(dev);
+	int ret;
+
+	ret = ohci_deregister(dev);
+	if (ret)
+		return ret;
+
+	sunxi_usb_phy_power_off(priv->phy_index);
+	sunxi_usb_phy_exit(priv->phy_index);
+
+#ifdef CONFIG_SUNXI_GEN_SUN6I
+	clrbits_le32(&ccm->ahb_reset0_cfg, priv->ahb_gate_mask);
+#endif
+	clrbits_le32(&ccm->usb_clk_cfg, priv->usb_gate_mask);
+	clrbits_le32(&ccm->ahb_gate0, priv->ahb_gate_mask);
+
+	return 0;
+}
+
+static const struct udevice_id ohci_usb_ids[] = {
+	{ .compatible = "allwinner,sun4i-a10-ohci", },
+	{ .compatible = "allwinner,sun5i-a13-ohci", },
+	{ .compatible = "allwinner,sun6i-a31-ohci", },
+	{ .compatible = "allwinner,sun7i-a20-ohci", },
+	{ .compatible = "allwinner,sun8i-a23-ohci", },
+	{ .compatible = "allwinner,sun9i-a80-ohci", },
+	{ }
+};
+
+U_BOOT_DRIVER(usb_ohci) = {
+	.name	= "ohci_sunxi",
+	.id	= UCLASS_USB,
+	.of_match = ohci_usb_ids,
+	.probe = ohci_usb_probe,
+	.remove = ohci_usb_remove,
+	.ops	= &ohci_usb_ops,
+	.platdata_auto_alloc_size = sizeof(struct usb_platdata),
+	.priv_auto_alloc_size = sizeof(struct ohci_sunxi_priv),
+	.flags	= DM_FLAG_ALLOC_PRIV_DMA,
+};
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index dfe7213..b888828 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -363,6 +363,9 @@ extern int soft_i2c_gpio_scl;
 #endif
 
 #ifdef CONFIG_USB_EHCI
+#define CONFIG_USB_OHCI_NEW
+#define CONFIG_USB_OHCI_SUNXI
+#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 1
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1
 #endif
 
@@ -380,7 +383,7 @@ extern int soft_i2c_gpio_scl;
 #define CONFIG_CONSOLE_MUX
 #define CONFIG_PREBOOT
 #define CONFIG_SYS_STDIO_DEREGISTER
-#define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
+#define CONFIG_SYS_USB_EVENT_POLL
 #endif
 
 #if !defined CONFIG_ENV_IS_IN_MMC && \
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
                   ` (15 preceding siblings ...)
  2015-05-05 21:56 ` [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support Hans de Goede
@ 2015-05-05 22:23 ` Marek Vasut
  2015-05-05 22:24   ` Simon Glass
  2015-05-05 22:50   ` Hans de Goede
  16 siblings, 2 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:23 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
> Hi Marek and Simon,

Hi!

> Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
> dm support (tested on sunxi). This series sits on top of the series adding
> companion controller support to the dm usb code and 2 ehci fixes which I
> send earlier today.

Who do you what to pick this (and the EHCI DM one) please ?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 22:23 ` [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Marek Vasut
@ 2015-05-05 22:24   ` Simon Glass
  2015-05-05 22:50   ` Hans de Goede
  1 sibling, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-05 22:24 UTC (permalink / raw)
  To: u-boot

Hi Marek,

On 5 May 2015 at 16:23, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
>> Hi Marek and Simon,
>
> Hi!
>
>> Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
>> dm support (tested on sunxi). This series sits on top of the series adding
>> companion controller support to the dm usb code and 2 ehci fixes which I
>> send earlier today.
>
> Who do you what to pick this (and the EHCI DM one) please ?

I'm happy to pick it up with your ack. My perspective is mostly on driver model.

Regards,
Simon

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 22:23 ` [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Marek Vasut
  2015-05-05 22:24   ` Simon Glass
@ 2015-05-05 22:50   ` Hans de Goede
  2015-05-05 22:52     ` Marek Vasut
  2015-05-05 22:52     ` Simon Glass
  1 sibling, 2 replies; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 22:50 UTC (permalink / raw)
  To: u-boot

Hi,

On 05/06/2015 12:23 AM, Marek Vasut wrote:
> On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
>> Hi Marek and Simon,
>
> Hi!
>
>> Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
>> dm support (tested on sunxi). This series sits on top of the series adding
>> companion controller support to the dm usb code and 2 ehci fixes which I
>> send earlier today.
>
> Who do you what to pick this (and the EHCI DM one) please ?

Since this entire series only touches non dm code, except for the last
one I was sortof expecting you to pick it up, but going through the dm
tree, or through the sunxi tree for that matter is fine with me to.

Regards,

Hans

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 22:50   ` Hans de Goede
@ 2015-05-05 22:52     ` Marek Vasut
  2015-05-05 22:53       ` Simon Glass
  2015-05-05 22:52     ` Simon Glass
  1 sibling, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:52 UTC (permalink / raw)
  To: u-boot

On Wednesday, May 06, 2015 at 12:50:08 AM, Hans de Goede wrote:
> Hi,

Hi!

> On 05/06/2015 12:23 AM, Marek Vasut wrote:
> > On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
> >> Hi Marek and Simon,
> > 
> > Hi!
> > 
> >> Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
> >> dm support (tested on sunxi). This series sits on top of the series
> >> adding companion controller support to the dm usb code and 2 ehci fixes
> >> which I send earlier today.
> > 
> > Who do you what to pick this (and the EHCI DM one) please ?
> 
> Since this entire series only touches non dm code, except for the last
> one I was sortof expecting you to pick it up, but going through the dm
> tree, or through the sunxi tree for that matter is fine with me to.

I don't have much which can interfere in the usb tree, so going through
-dm is fine with me. Please take it through -dm .

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 22:50   ` Hans de Goede
  2015-05-05 22:52     ` Marek Vasut
@ 2015-05-05 22:52     ` Simon Glass
  1 sibling, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-05 22:52 UTC (permalink / raw)
  To: u-boot

Hi Hans,

On 5 May 2015 at 16:50, Hans de Goede <hdegoede@redhat.com> wrote:
> Hi,
>
>
> On 05/06/2015 12:23 AM, Marek Vasut wrote:
>>
>> On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
>>>
>>> Hi Marek and Simon,
>>
>>
>> Hi!
>>
>>> Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
>>> dm support (tested on sunxi). This series sits on top of the series
>>> adding
>>> companion controller support to the dm usb code and 2 ehci fixes which I
>>> send earlier today.
>>
>>
>> Who do you what to pick this (and the EHCI DM one) please ?
>
>
> Since this entire series only touches non dm code, except for the last
> one I was sortof expecting you to pick it up, but going through the dm
> tree, or through the sunxi tree for that matter is fine with me to.

Sounds good if that's OK with you Marek. Would like to see if this can
go in soonish (maybe next week?).

Regards,
Simon

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 22:52     ` Marek Vasut
@ 2015-05-05 22:53       ` Simon Glass
  2015-05-05 23:03         ` Marek Vasut
  0 siblings, 1 reply; 55+ messages in thread
From: Simon Glass @ 2015-05-05 22:53 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:52, Marek Vasut <marex@denx.de> wrote:
> On Wednesday, May 06, 2015 at 12:50:08 AM, Hans de Goede wrote:
>> Hi,
>
> Hi!
>
>> On 05/06/2015 12:23 AM, Marek Vasut wrote:
>> > On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
>> >> Hi Marek and Simon,
>> >
>> > Hi!
>> >
>> >> Here is a series with a few usb core fixes, a lot of ohci fixes and ohci
>> >> dm support (tested on sunxi). This series sits on top of the series
>> >> adding companion controller support to the dm usb code and 2 ehci fixes
>> >> which I send earlier today.
>> >
>> > Who do you what to pick this (and the EHCI DM one) please ?
>>
>> Since this entire series only touches non dm code, except for the last
>> one I was sortof expecting you to pick it up, but going through the dm
>> tree, or through the sunxi tree for that matter is fine with me to.
>
> I don't have much which can interfere in the usb tree, so going through
> -dm is fine with me. Please take it through -dm .

Ah, OK. Will await your review/ack.

Regards,
Simon

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs
  2015-05-05 21:56 ` [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs Hans de Goede
@ 2015-05-05 22:54   ` Marek Vasut
  2015-05-06 21:43     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:54 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:04 PM, Hans de Goede wrote:
> This fixes descriptor reading of lowspeed devices through ohci not working.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 02/16] usb: Stop reset procedure when a dev is handed over to a companion hcd
  2015-05-05 21:56 ` [U-Boot] [PATCH 02/16] usb: Stop reset procedure when a dev is handed over to a companion hcd Hans de Goede
@ 2015-05-05 22:54   ` Marek Vasut
  0 siblings, 0 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:54 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:05 PM, Hans de Goede wrote:
> Do not try to reset a device 5 times when it is handed over to a companion
> controller, also do not print an error when it has been handed over.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable
  2015-05-05 21:56 ` [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable Hans de Goede
@ 2015-05-05 22:55   ` Marek Vasut
  2015-05-06 21:43     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:55 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:06 PM, Hans de Goede wrote:
> devgone is never assigned a value, so the one comparisson reading it will
> never be true, and devgone can be completely removed.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars
  2015-05-05 21:56 ` [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars Hans de Goede
@ 2015-05-05 22:55   ` Marek Vasut
  2015-05-06 21:43     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:55 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:07 PM, Hans de Goede wrote:
> This is a preparation patch for adding driver-model support.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct
  2015-05-05 21:56 ` [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct Hans de Goede
@ 2015-05-05 22:57   ` Marek Vasut
  2015-05-06 21:43     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:57 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:08 PM, Hans de Goede wrote:
> This is a preparation patch for adding driver-model support.
> 
> Note we do keep ohci_dev as a separate struct so that we can later add
> support for interrupt-queues which requires allocating a separate ohci_dev
> per interrupt-queue.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct
  2015-05-05 21:56 ` [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct Hans de Goede
@ 2015-05-05 22:57   ` Marek Vasut
  2015-05-06 21:44     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:57 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:09 PM, Hans de Goede wrote:
> This is a preparation patch for adding driver-model support.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable
  2015-05-05 21:56 ` [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable Hans de Goede
@ 2015-05-05 22:57   ` Marek Vasut
  2015-05-06 21:44     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:57 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:10 PM, Hans de Goede wrote:
> This is a preparation patch for adding driver-model support.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c
  2015-05-05 21:56 ` [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c Hans de Goede
@ 2015-05-05 22:58   ` Marek Vasut
  2015-05-06 21:44     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:58 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:11 PM, Hans de Goede wrote:
> Non static function and variable declarations do not belong in a .h file.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0
  2015-05-05 21:56 ` [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0 Hans de Goede
@ 2015-05-05 22:59   ` Marek Vasut
  2015-05-05 23:25     ` Hans de Goede
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:59 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:12 PM, Hans de Goede wrote:
> Fix taken from the Linux kernel ohci driver.

Commit ID from Linux where this came from would be nice to have
in the commit message, but that's a minor thing.

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout
  2015-05-05 21:56 ` [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout Hans de Goede
@ 2015-05-05 22:59   ` Marek Vasut
  2015-05-06 21:44     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 22:59 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:14 PM, Hans de Goede wrote:
> Interrupts transfers timing out is normal, so do not log an error for this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 12/16] usb: ohci: Do not resubmit and leak urbs for interrupt packets
  2015-05-05 21:56 ` [U-Boot] [PATCH 12/16] usb: ohci: Do not resubmit and leak urbs for interrupt packets Hans de Goede
@ 2015-05-05 23:00   ` Marek Vasut
  0 siblings, 0 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:00 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:15 PM, Hans de Goede wrote:
> Auto-resubmission of interrupt packets does not match the u-boot usb model.

Just a bit more verbose commit message would be helpful, really ;-)

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths
  2015-05-05 21:56 ` [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths Hans de Goede
@ 2015-05-05 23:01   ` Marek Vasut
  2015-05-10  9:10     ` Hans de Goede
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:01 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:16 PM, Hans de Goede wrote:
> The common usb_hub code already waits a full second after powering up
> ports, so there is no need for additional delays inside the hcd code.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

This makes a driver depend on the behavior of the subsystem, which might
change though, right ? Won't this bite us in the future ?

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places
  2015-05-05 21:56 ` [U-Boot] [PATCH 14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places Hans de Goede
@ 2015-05-05 23:01   ` Marek Vasut
  0 siblings, 0 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:01 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:17 PM, Hans de Goede wrote:
> For some reason the ohci code is full with:
> 
> 		pkt_print(...)
> 		mdelay(1);
> 
> AFAICT there is no reason for the mdelay(1) calls. This commit disables
> them when building the ohci code for new driver-model using boards. It
> leaves the mdelay(1) calls in place when building for older boards, so as
> to avoid causing any regressions there.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

You might as well define a ohcidelay(1) function to avoid poluting the
code with ifdefs .

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus
  2015-05-05 21:56 ` [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus Hans de Goede
@ 2015-05-05 23:02   ` Marek Vasut
  2015-05-06 21:44     ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:02 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:13 PM, Hans de Goede wrote:
> Add proper cache flushing / invalidating for non cache coherent cpus, for
> now only enable this for new (driver-model) usb code to avoid regressions.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support
  2015-05-05 21:56 ` [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support Hans de Goede
@ 2015-05-05 23:03   ` Marek Vasut
  2015-05-09 13:56     ` Ian Campbell
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:03 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:19 PM, Hans de Goede wrote:
> This commit adds support for the OHCI companionen controller, which makes
> usb-1 devices directly plugged into to usb root port work.
> 
> Note for now this switches usb-keyboard support for sunxi back from
> int-queue support to the old interrupt polling method. Adding int-queue
> support to the ohci code and switching back to int-queue support is in the
> works.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support
  2015-05-05 22:53       ` Simon Glass
@ 2015-05-05 23:03         ` Marek Vasut
  0 siblings, 0 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:03 UTC (permalink / raw)
  To: u-boot

On Wednesday, May 06, 2015 at 12:53:31 AM, Simon Glass wrote:
> On 5 May 2015 at 16:52, Marek Vasut <marex@denx.de> wrote:
> > On Wednesday, May 06, 2015 at 12:50:08 AM, Hans de Goede wrote:
> >> Hi,
> > 
> > Hi!
> > 
> >> On 05/06/2015 12:23 AM, Marek Vasut wrote:
> >> > On Tuesday, May 05, 2015 at 11:56:03 PM, Hans de Goede wrote:
> >> >> Hi Marek and Simon,
> >> > 
> >> > Hi!
> >> > 
> >> >> Here is a series with a few usb core fixes, a lot of ohci fixes and
> >> >> ohci dm support (tested on sunxi). This series sits on top of the
> >> >> series adding companion controller support to the dm usb code and 2
> >> >> ehci fixes which I send earlier today.
> >> > 
> >> > Who do you what to pick this (and the EHCI DM one) please ?
> >> 
> >> Since this entire series only touches non dm code, except for the last
> >> one I was sortof expecting you to pick it up, but going through the dm
> >> tree, or through the sunxi tree for that matter is fine with me to.
> > 
> > I don't have much which can interfere in the usb tree, so going through
> > -dm is fine with me. Please take it through -dm .
> 
> Ah, OK. Will await your review/ack.

I'm just nagging a little here and there, otherwise the series looks good.

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 15/16] usb: ohci: Add dm support
  2015-05-05 21:56 ` [U-Boot] [PATCH 15/16] usb: ohci: Add dm support Hans de Goede
@ 2015-05-05 23:04   ` Marek Vasut
  0 siblings, 0 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:04 UTC (permalink / raw)
  To: u-boot

On Tuesday, May 05, 2015 at 11:56:18 PM, Hans de Goede wrote:
> Add driver-model support to the ohci code.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

I'll leave thorough review of this to Simon, but a brief skim
tells me to add 

Reviewed-by: Marek Vasut <marex@denx.de>

The "todo" in ohci_deregister() is a bit concerning btw.

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0
  2015-05-05 22:59   ` Marek Vasut
@ 2015-05-05 23:25     ` Hans de Goede
  2015-05-05 23:38       ` Marek Vasut
  0 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-05 23:25 UTC (permalink / raw)
  To: u-boot

Hi,

On 05/06/2015 12:59 AM, Marek Vasut wrote:
> On Tuesday, May 05, 2015 at 11:56:12 PM, Hans de Goede wrote:
>> Fix taken from the Linux kernel ohci driver.
>
> Commit ID from Linux where this came from would be nice to have
> in the commit message, but that's a minor thing.

I did not take this from a specific commit, I noticed this
when comparing bits of the u-boot and linux code.

Regards,

Hans

>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>
>
> Best regards,
> Marek Vasut
>

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0
  2015-05-05 23:25     ` Hans de Goede
@ 2015-05-05 23:38       ` Marek Vasut
  2015-05-06 21:44         ` Simon Glass
  0 siblings, 1 reply; 55+ messages in thread
From: Marek Vasut @ 2015-05-05 23:38 UTC (permalink / raw)
  To: u-boot

On Wednesday, May 06, 2015 at 01:25:29 AM, Hans de Goede wrote:
> Hi,
> 
> On 05/06/2015 12:59 AM, Marek Vasut wrote:
> > On Tuesday, May 05, 2015 at 11:56:12 PM, Hans de Goede wrote:
> >> Fix taken from the Linux kernel ohci driver.
> > 
> > Commit ID from Linux where this came from would be nice to have
> > in the commit message, but that's a minor thing.
> 
> I did not take this from a specific commit, I noticed this
> when comparing bits of the u-boot and linux code.

Then that's also ok. Thanks !

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs
  2015-05-05 22:54   ` Marek Vasut
@ 2015-05-06 21:43     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:43 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:54, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:04 PM, Hans de Goede wrote:
>> This fixes descriptor reading of lowspeed devices through ohci not working.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars
  2015-05-05 22:55   ` Marek Vasut
@ 2015-05-06 21:43     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:43 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:55, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:07 PM, Hans de Goede wrote:
>> This is a preparation patch for adding driver-model support.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct
  2015-05-05 22:57   ` Marek Vasut
@ 2015-05-06 21:43     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:43 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:57, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:08 PM, Hans de Goede wrote:
>> This is a preparation patch for adding driver-model support.
>>
>> Note we do keep ohci_dev as a separate struct so that we can later add
>> support for interrupt-queues which requires allocating a separate ohci_dev
>> per interrupt-queue.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable
  2015-05-05 22:55   ` Marek Vasut
@ 2015-05-06 21:43     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:43 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:55, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:06 PM, Hans de Goede wrote:
>> devgone is never assigned a value, so the one comparisson reading it will
>> never be true, and devgone can be completely removed.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct
  2015-05-05 22:57   ` Marek Vasut
@ 2015-05-06 21:44     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:44 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:57, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:09 PM, Hans de Goede wrote:
>> This is a preparation patch for adding driver-model support.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable
  2015-05-05 22:57   ` Marek Vasut
@ 2015-05-06 21:44     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:44 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:57, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:10 PM, Hans de Goede wrote:
>> This is a preparation patch for adding driver-model support.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c
  2015-05-05 22:58   ` Marek Vasut
@ 2015-05-06 21:44     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:44 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:58, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:11 PM, Hans de Goede wrote:
>> Non static function and variable declarations do not belong in a .h file.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0
  2015-05-05 23:38       ` Marek Vasut
@ 2015-05-06 21:44         ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:44 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 17:38, Marek Vasut <marex@denx.de> wrote:
> On Wednesday, May 06, 2015 at 01:25:29 AM, Hans de Goede wrote:
>> Hi,
>>
>> On 05/06/2015 12:59 AM, Marek Vasut wrote:
>> > On Tuesday, May 05, 2015 at 11:56:12 PM, Hans de Goede wrote:
>> >> Fix taken from the Linux kernel ohci driver.
>> >
>> > Commit ID from Linux where this came from would be nice to have
>> > in the commit message, but that's a minor thing.
>>
>> I did not take this from a specific commit, I noticed this
>> when comparing bits of the u-boot and linux code.
>
> Then that's also ok. Thanks !

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus
  2015-05-05 23:02   ` Marek Vasut
@ 2015-05-06 21:44     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:44 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 17:02, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:13 PM, Hans de Goede wrote:
>> Add proper cache flushing / invalidating for non cache coherent cpus, for
>> now only enable this for new (driver-model) usb code to avoid regressions.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Reviewed-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout
  2015-05-05 22:59   ` Marek Vasut
@ 2015-05-06 21:44     ` Simon Glass
  0 siblings, 0 replies; 55+ messages in thread
From: Simon Glass @ 2015-05-06 21:44 UTC (permalink / raw)
  To: u-boot

On 5 May 2015 at 16:59, Marek Vasut <marex@denx.de> wrote:
> On Tuesday, May 05, 2015 at 11:56:14 PM, Hans de Goede wrote:
>> Interrupts transfers timing out is normal, so do not log an error for this.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dm, thanks!

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support
  2015-05-05 23:03   ` Marek Vasut
@ 2015-05-09 13:56     ` Ian Campbell
  0 siblings, 0 replies; 55+ messages in thread
From: Ian Campbell @ 2015-05-09 13:56 UTC (permalink / raw)
  To: u-boot

On Wed, 2015-05-06 at 01:03 +0200, Marek Vasut wrote:
> On Tuesday, May 05, 2015 at 11:56:19 PM, Hans de Goede wrote:
> > This commit adds support for the OHCI companionen controller, which makes

"companion"

> > usb-1 devices directly plugged into to usb root port work.
> > 
> > Note for now this switches usb-keyboard support for sunxi back from
> > int-queue support to the old interrupt polling method. Adding int-queue
> > support to the ohci code and switching back to int-queue support is in the
> > works.
> > 
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> Acked-by: Marek Vasut <marex@denx.de>

Likewise,
Acked-by: Ian Campbell <ijc@hellion.org.uk>

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths
  2015-05-05 23:01   ` Marek Vasut
@ 2015-05-10  9:10     ` Hans de Goede
  2015-05-10  9:49       ` Marek Vasut
  0 siblings, 1 reply; 55+ messages in thread
From: Hans de Goede @ 2015-05-10  9:10 UTC (permalink / raw)
  To: u-boot

Hi,

On 06-05-15 01:01, Marek Vasut wrote:
> On Tuesday, May 05, 2015 at 11:56:16 PM, Hans de Goede wrote:
>> The common usb_hub code already waits a full second after powering up
>> ports, so there is no need for additional delays inside the hcd code.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>
> This makes a driver depend on the behavior of the subsystem, which might
> change though, right ?  Won't this bite us in the future ?

Well since the usb spec says that we must wait a minimum amount of time
after port power on (exact time is in the hub descriptor) the subsys code
better not change otherwise we would be violating the spec in the future,
also note that we must not only do the wait for root ports but also
for external hub ports, so we can really never drop the wait from the
subsys code, and having a separate wait for just the root hub in the hcd
code will only lead to doing the waiting twice.

I'll change the commit message to make this clear.

Regards,

Hans

^ permalink raw reply	[flat|nested] 55+ messages in thread

* [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths
  2015-05-10  9:10     ` Hans de Goede
@ 2015-05-10  9:49       ` Marek Vasut
  0 siblings, 0 replies; 55+ messages in thread
From: Marek Vasut @ 2015-05-10  9:49 UTC (permalink / raw)
  To: u-boot

On Sunday, May 10, 2015 at 11:10:00 AM, Hans de Goede wrote:
> Hi,

Hi!

> On 06-05-15 01:01, Marek Vasut wrote:
> > On Tuesday, May 05, 2015 at 11:56:16 PM, Hans de Goede wrote:
> >> The common usb_hub code already waits a full second after powering up
> >> ports, so there is no need for additional delays inside the hcd code.
> >> 
> >> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > 
> > This makes a driver depend on the behavior of the subsystem, which might
> > change though, right ?  Won't this bite us in the future ?
> 
> Well since the usb spec says that we must wait a minimum amount of time
> after port power on (exact time is in the hub descriptor) the subsys code
> better not change otherwise we would be violating the spec in the future,
> also note that we must not only do the wait for root ports but also
> for external hub ports, so we can really never drop the wait from the
> subsys code, and having a separate wait for just the root hub in the hcd
> code will only lead to doing the waiting twice.
> 
> I'll change the commit message to make this clear.

Thanks!

Best regards,
Marek Vasut

^ permalink raw reply	[flat|nested] 55+ messages in thread

end of thread, other threads:[~2015-05-10  9:49 UTC | newest]

Thread overview: 55+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-05 21:56 [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Hans de Goede
2015-05-05 21:56 ` [U-Boot] [PATCH 01/16] usb: Fix maxpacketsize for first descriptor read for low-speed usb devs Hans de Goede
2015-05-05 22:54   ` Marek Vasut
2015-05-06 21:43     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 02/16] usb: Stop reset procedure when a dev is handed over to a companion hcd Hans de Goede
2015-05-05 22:54   ` Marek Vasut
2015-05-05 21:56 ` [U-Boot] [PATCH 03/16] usb: ohci: Remove unused devgone global variable Hans de Goede
2015-05-05 22:55   ` Marek Vasut
2015-05-06 21:43     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 04/16] usb: ohci: Pass around a pointer to ohci_t rather then accessing global vars Hans de Goede
2015-05-05 22:55   ` Marek Vasut
2015-05-06 21:43     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 05/16] usb: ohci: Move the ohci_dev struct to inside the main ohci struct Hans de Goede
2015-05-05 22:57   ` Marek Vasut
2015-05-06 21:43     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 06/16] usb: ohci: Move the td array struct to inside the ohci_dev struct Hans de Goede
2015-05-05 22:57   ` Marek Vasut
2015-05-06 21:44     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 07/16] usb: ohci: Remove unnecessary phcca variable Hans de Goede
2015-05-05 22:57   ` Marek Vasut
2015-05-06 21:44     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 08/16] usb: ohci: Move static func and var declarations from ohci.h to ohci-hcd.c Hans de Goede
2015-05-05 22:58   ` Marek Vasut
2015-05-06 21:44     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 09/16] usb: ohci: Fix ctrl in messages with a data-len of 0 Hans de Goede
2015-05-05 22:59   ` Marek Vasut
2015-05-05 23:25     ` Hans de Goede
2015-05-05 23:38       ` Marek Vasut
2015-05-06 21:44         ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 10/16] usb: ohci: Add proper cache flushing / invalidating for non cache coherent cpus Hans de Goede
2015-05-05 23:02   ` Marek Vasut
2015-05-06 21:44     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 11/16] usb: ohci: Don't log an error on interrupt packet timeout Hans de Goede
2015-05-05 22:59   ` Marek Vasut
2015-05-06 21:44     ` Simon Glass
2015-05-05 21:56 ` [U-Boot] [PATCH 12/16] usb: ohci: Do not resubmit and leak urbs for interrupt packets Hans de Goede
2015-05-05 23:00   ` Marek Vasut
2015-05-05 21:56 ` [U-Boot] [PATCH 13/16] usb: ohci: Remove unnecessary delays from hc_start and power power-on paths Hans de Goede
2015-05-05 23:01   ` Marek Vasut
2015-05-10  9:10     ` Hans de Goede
2015-05-10  9:49       ` Marek Vasut
2015-05-05 21:56 ` [U-Boot] [PATCH 14/16] usb: ohci: Skip unnecessary mdelay(1) calls in various places Hans de Goede
2015-05-05 23:01   ` Marek Vasut
2015-05-05 21:56 ` [U-Boot] [PATCH 15/16] usb: ohci: Add dm support Hans de Goede
2015-05-05 23:04   ` Marek Vasut
2015-05-05 21:56 ` [U-Boot] [PATCH 16/16] sunxi: ohci: Add ohci usb host controller support Hans de Goede
2015-05-05 23:03   ` Marek Vasut
2015-05-09 13:56     ` Ian Campbell
2015-05-05 22:23 ` [U-Boot] [PATCH 00/16] usb core fixes + ohci fixes + ohci dm support Marek Vasut
2015-05-05 22:24   ` Simon Glass
2015-05-05 22:50   ` Hans de Goede
2015-05-05 22:52     ` Marek Vasut
2015-05-05 22:53       ` Simon Glass
2015-05-05 23:03         ` Marek Vasut
2015-05-05 22:52     ` Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.