On Tue, Jul 21, 2009 at 4:29 PM, Leandro Dorileo<[email protected]> wrote:
> Hi Patrick
>
> I have done the changes we discussed previously. Attached follows the
> patches. The 2 first patches are just few changes in the reg
> functions(*read/write*) so we can use the same functions in both OHCI
> and UHCI.
>
> The last patches are related to the changes I proposed to control
> function. I`m copying here the commit log message:
>
> "Changed the usb API where the control function first parameter now
> is a pointer of endpoint_t instead of a pointer of usbdevice_t.
>
> The previous implementation assumed the first endpoint(index 0) as
> control, which is not true, we can have devices with more than a
> single control line."
>
> Since MSC device has always a single control endpoint I kept assuming
> that, and the changes to the drivers do exactly that, takes the first
> endpoint and passes it to control.
>
> I would like to keep those changes upstream already so it can be
> easily maintained. Please review and comment.
>
> PS: I`m cc`ing the coreboot mailing list, this way we can have more reviewers.
>
> Thanks in advance....
>
> --
> (°=   Leandro Dorileo
> //\    [email protected]   -   http://www.dorilex.net
> V_/  Software is a matter of freedom.
>



-- 
(°=   Leandro Dorileo
//\    [email protected]   -   http://www.dorilex.net
V_/  Software is a matter of freedom.
From a2fc70e33689fe59e2321bbe3d9bbf25c107f59c Mon Sep 17 00:00:00 2001
From: Leandro Dorileo <[email protected]>
Date: Mon, 29 Jun 2009 23:00:30 -0400
Subject: [PATCH 1/5] reg operations: moving

Moved the register functions from uhci.c to usb.h so every hci implementations
can beneffit. All the uhci_reg* were renamed to hci_reg*.
---
 drivers/usb/uhci.h |   10 ---------
 include/usb/usb.h  |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/uhci.h b/drivers/usb/uhci.h
index dd015ee..bde87ac 100644
--- a/drivers/usb/uhci.h
+++ b/drivers/usb/uhci.h
@@ -99,16 +99,6 @@ typedef struct {
 		     0x12
      } usbreg;
 
-     void uhci_reg_write32 (hci_t *ctrl, usbreg reg, u32 value);
-     u32 uhci_reg_read32 (hci_t *ctrl, usbreg reg);
-     void uhci_reg_write16 (hci_t *ctrl, usbreg reg, u16 value);
-     u16 uhci_reg_read16 (hci_t *ctrl, usbreg reg);
-     void uhci_reg_write8 (hci_t *ctrl, usbreg reg, u8 value);
-     u8 uhci_reg_read8 (hci_t *ctrl, usbreg reg);
-     void uhci_reg_mask32 (hci_t *ctrl, usbreg reg, u32 andmask, u32 ormask);
-     void uhci_reg_mask16 (hci_t *ctrl, usbreg reg, u16 andmask, u16 ormask);
-     void uhci_reg_mask8 (hci_t *ctrl, usbreg reg, u8 andmask, u8 ormask);
-
      typedef struct uhci {
 	     flistp_t *framelistptr;
 	     qh_t *qh_prei, *qh_intr, *qh_data, *qh_last;
diff --git a/include/usb/usb.h b/include/usb/usb.h
index d06e807..e7a5ae2 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -226,4 +226,61 @@ gen_bmRequestType (dev_req_dir dir, dev_req_type type, dev_req_recp recp)
 
 void usb_detach_device(hci_t *controller, int devno);
 int usb_attach_device(hci_t *controller, int hubaddress, int port, int lowspeed);
+
+void
+hci_reg_write32 (hci_t *ctrl, int reg, u32 value)
+{
+	outl (value, ctrl->reg_base + reg);
+}
+
+u32
+hci_reg_read32 (hci_t *ctrl, int reg)
+{
+	return inl (ctrl->reg_base + reg);
+}
+
+void
+hci_reg_write16 (hci_t *ctrl, int reg, u16 value)
+{
+	outw (value, ctrl->reg_base + reg);
+}
+
+u16
+hci_reg_read16 (hci_t *ctrl, int reg)
+{
+	return inw (ctrl->reg_base + reg);
+}
+
+void
+hci_reg_write8 (hci_t *ctrl, int reg, u8 value)
+{
+	outb (value, ctrl->reg_base + reg);
+}
+
+u8
+hci_reg_read8 (hci_t *ctrl, int reg)
+{
+	return inb (ctrl->reg_base + reg);
+}
+
+void
+hci_reg_mask32 (hci_t *ctrl, int reg, u32 andmask, u32 ormask)
+{
+	hci_reg_write32 (ctrl, reg,
+			  (hci_reg_read32 (ctrl, reg) & andmask) | ormask);
+}
+
+void
+hci_reg_mask16 (hci_t *ctrl, int reg, u16 andmask, u16 ormask)
+{
+	hci_reg_write16 (ctrl, reg,
+			  (hci_reg_read16 (ctrl, reg) & andmask) | ormask);
+}
+
+void
+hci_reg_mask8 (hci_t *ctrl, int reg, u8 andmask, u8 ormask)
+{
+	hci_reg_write8 (ctrl, reg,
+			 (hci_reg_read8 (ctrl, reg) & andmask) | ormask);
+}
 #endif
-- 
1.6.3.3

From f34391d13ddb77c1b1ec0a463e9141c43254721a Mon Sep 17 00:00:00 2001
From: Leandro Dorileo <[email protected]>
Date: Mon, 29 Jun 2009 23:03:08 -0400
Subject: [PATCH 2/5] reg functions: adaptation of uhci and uhci_rh

Adapting the uhci and uhci_rh drivers to accomplish the changes dones in the
commit 9359f55203c3c5e4422ee4bda46a11ea7a8cc6fb.
---
 drivers/usb/uhci.c    |  103 +++++++++++--------------------------------------
 drivers/usb/uhci_rh.c |   28 +++++++-------
 2 files changed, 37 insertions(+), 94 deletions(-)

diff --git a/drivers/usb/uhci.c b/drivers/usb/uhci.c
index 198b6c0..8d5c9df 100644
--- a/drivers/usb/uhci.c
+++ b/drivers/usb/uhci.c
@@ -49,14 +49,14 @@ static u8* uhci_poll_intr_queue (void *queue);
 static void
 uhci_dump (hci_t *controller)
 {
-	printf ("dump:\nUSBCMD: %x\n", uhci_reg_read16 (controller, USBCMD));
-	printf ("USBSTS: %x\n", uhci_reg_read16 (controller, USBSTS));
-	printf ("USBINTR: %x\n", uhci_reg_read16 (controller, USBINTR));
-	printf ("FRNUM: %x\n", uhci_reg_read16 (controller, FRNUM));
-	printf ("FLBASEADD: %x\n", uhci_reg_read32 (controller, FLBASEADD));
-	printf ("SOFMOD: %x\n", uhci_reg_read8 (controller, SOFMOD));
-	printf ("PORTSC1: %x\n", uhci_reg_read16 (controller, PORTSC1));
-	printf ("PORTSC2: %x\n", uhci_reg_read16 (controller, PORTSC2));
+	printf ("dump:\nUSBCMD: %x\n", hci_reg_read16 (controller, USBCMD));
+	printf ("USBSTS: %x\n", hci_reg_read16 (controller, USBSTS));
+	printf ("USBINTR: %x\n", hci_reg_read16 (controller, USBINTR));
+	printf ("FRNUM: %x\n", hci_reg_read16 (controller, FRNUM));
+	printf ("FLBASEADD: %x\n", hci_reg_read32 (controller, FLBASEADD));
+	printf ("SOFMOD: %x\n", hci_reg_read8 (controller, SOFMOD));
+	printf ("PORTSC1: %x\n", hci_reg_read16 (controller, PORTSC1));
+	printf ("PORTSC2: %x\n", hci_reg_read16 (controller, PORTSC2));
 }
 #endif
 
@@ -100,26 +100,26 @@ static void
 uhci_reset (hci_t *controller)
 {
 	/* reset */
-	uhci_reg_write16 (controller, USBCMD, 4);
+	hci_reg_write16 (controller, USBCMD, 4);
 	mdelay (50);
-	uhci_reg_write16 (controller, USBCMD, 0);
+	hci_reg_write16 (controller, USBCMD, 0);
 	mdelay (10);
-	uhci_reg_write16 (controller, USBCMD, 2);
-	while ((uhci_reg_read16 (controller, USBCMD) & 2) != 0)
+	hci_reg_write16 (controller, USBCMD, 2);
+	while ((hci_reg_read16 (controller, USBCMD) & 2) != 0)
 		mdelay (1);
 
-	uhci_reg_write32 (controller, FLBASEADD,
+	hci_reg_write32 (controller, FLBASEADD,
 			  (u32) virt_to_phys (UHCI_INST (controller)->
 					      framelistptr));
 	//printf ("framelist at %p\n",UHCI_INST(controller)->framelistptr);
 
 	/* disable irqs */
-	uhci_reg_write16 (controller, USBINTR, 0);
+	hci_reg_write16 (controller, USBINTR, 0);
 
 	/* reset framelist index */
-	uhci_reg_write16 (controller, FRNUM, 0);
+	hci_reg_write16 (controller, FRNUM, 0);
 
-	uhci_reg_mask16 (controller, USBCMD, ~0, 0xc0);	// max packets, configure flag
+	hci_reg_mask16 (controller, USBCMD, ~0, 0xc0);	// max packets, configure flag
 
 	uhci_start (controller);
 }
@@ -153,7 +153,7 @@ uhci_init (pcidev_t addr)
 	/* kill legacy support handler */
 	uhci_stop (controller);
 	mdelay (1);
-	uhci_reg_write16 (controller, USBSTS, 0x3f);
+	hci_reg_write16 (controller, USBSTS, 0x3f);
 	pci_write_config32 (controller->bus_address, 0xc0, 0x8f00);
 
 	UHCI_INST (controller)->framelistptr = memalign (0x1000, 1024 * sizeof (flistp_t *));	/* 4kb aligned to 4kb */
@@ -219,7 +219,7 @@ uhci_shutdown (hci_t *controller)
 	detach_controller (controller);
 	UHCI_INST (controller)->roothub->destroy (UHCI_INST (controller)->
 						  roothub);
-	uhci_reg_mask16 (controller, USBCMD, 0, 0);	// stop work
+	hci_reg_mask16 (controller, USBCMD, 0, 0);	// stop work
 	free (UHCI_INST (controller)->framelistptr);
 	free (UHCI_INST (controller)->qh_prei);
 	free (UHCI_INST (controller)->qh_intr);
@@ -232,13 +232,13 @@ uhci_shutdown (hci_t *controller)
 static void
 uhci_start (hci_t *controller)
 {
-	uhci_reg_mask16 (controller, USBCMD, ~0, 1);	// start work on schedule
+	hci_reg_mask16 (controller, USBCMD, ~0, 1);	// start work on schedule
 }
 
 static void
 uhci_stop (hci_t *controller)
 {
-	uhci_reg_mask16 (controller, USBCMD, ~1, 0);	// stop work on schedule
+	hci_reg_mask16 (controller, USBCMD, ~1, 0);	// stop work on schedule
 }
 
 #define GET_TD(x) ((void*)(((unsigned int)(x))&~0xf))
@@ -253,7 +253,7 @@ wait_for_completed_qh (hci_t *controller, qh_t *qh)
 			current = GET_TD (qh->elementlinkptr.ptr);
 			timeout = 1000000;
 		}
-		uhci_reg_mask16 (controller, USBSTS, ~0, 0);	// clear resettable registers
+		hci_reg_mask16 (controller, USBSTS, ~0, 0);	// clear resettable registers
 		udelay (30);
 	}
 	return (GET_TD (qh->elementlinkptr.ptr) ==
@@ -265,9 +265,9 @@ wait_for_completed_td (hci_t *controller, td_t *td)
 {
 	int timeout = 10000;
 	while ((td->status_active == 1)
-	       && ((uhci_reg_read16 (controller, USBSTS) & 2) == 0)
+	       && ((hci_reg_read16 (controller, USBSTS) & 2) == 0)
 	       && (timeout-- > 0)) {
-		uhci_reg_mask16 (controller, USBSTS, ~0, 0);	// clear resettable registers
+		hci_reg_mask16 (controller, USBSTS, ~0, 0);	// clear resettable registers
 		udelay (10);
 	}
 }
@@ -614,60 +614,3 @@ uhci_poll_intr_queue (void *q_)
 	}
 	return NULL;
 }
-
-void
-uhci_reg_write32 (hci_t *ctrl, usbreg reg, u32 value)
-{
-	outl (value, ctrl->reg_base + reg);
-}
-
-u32
-uhci_reg_read32 (hci_t *ctrl, usbreg reg)
-{
-	return inl (ctrl->reg_base + reg);
-}
-
-void
-uhci_reg_write16 (hci_t *ctrl, usbreg reg, u16 value)
-{
-	outw (value, ctrl->reg_base + reg);
-}
-
-u16
-uhci_reg_read16 (hci_t *ctrl, usbreg reg)
-{
-	return inw (ctrl->reg_base + reg);
-}
-
-void
-uhci_reg_write8 (hci_t *ctrl, usbreg reg, u8 value)
-{
-	outb (value, ctrl->reg_base + reg);
-}
-
-u8
-uhci_reg_read8 (hci_t *ctrl, usbreg reg)
-{
-	return inb (ctrl->reg_base + reg);
-}
-
-void
-uhci_reg_mask32 (hci_t *ctrl, usbreg reg, u32 andmask, u32 ormask)
-{
-	uhci_reg_write32 (ctrl, reg,
-			  (uhci_reg_read32 (ctrl, reg) & andmask) | ormask);
-}
-
-void
-uhci_reg_mask16 (hci_t *ctrl, usbreg reg, u16 andmask, u16 ormask)
-{
-	uhci_reg_write16 (ctrl, reg,
-			  (uhci_reg_read16 (ctrl, reg) & andmask) | ormask);
-}
-
-void
-uhci_reg_mask8 (hci_t *ctrl, usbreg reg, u8 andmask, u8 ormask)
-{
-	uhci_reg_write8 (ctrl, reg,
-			 (uhci_reg_read8 (ctrl, reg) & andmask) | ormask);
-}
diff --git a/drivers/usb/uhci_rh.c b/drivers/usb/uhci_rh.c
index cc3c600..308bb68 100644
--- a/drivers/usb/uhci_rh.c
+++ b/drivers/usb/uhci_rh.c
@@ -45,16 +45,16 @@ uhci_rh_enable_port (usbdev_t *dev, int port)
 		port = PORTSC1;
 	else
 		port = PORTSC2;
-	uhci_reg_mask16 (controller, port, ~(1 << 12), 0);	/* wakeup */
+	hci_reg_mask16 (controller, port, ~(1 << 12), 0);	/* wakeup */
 
-	uhci_reg_mask16 (controller, port, ~0, 1 << 9);	/* reset */
+	hci_reg_mask16 (controller, port, ~0, 1 << 9);	/* reset */
 	mdelay (30);		// >10ms
-	uhci_reg_mask16 (controller, port, ~(1 << 9), 0);
+	hci_reg_mask16 (controller, port, ~(1 << 9), 0);
 	mdelay (1);		// >5.3us per spec, <3ms because some devices make trouble
 
-	uhci_reg_mask16 (controller, port, ~0, 1 << 2);	/* enable */
+	hci_reg_mask16 (controller, port, ~0, 1 << 2);	/* enable */
 	do {
-		value = uhci_reg_read16 (controller, port);
+		value = hci_reg_read16 (controller, port);
 		mdelay (1);
 	} while (((value & (1 << 2)) == 0) && (value & 0x01));
 }
@@ -67,10 +67,10 @@ uhci_rh_disable_port (usbdev_t *dev, int port)
 	port = PORTSC2;
 	if (port == 1)
 		port = PORTSC1;
-	uhci_reg_mask16 (controller, port, ~4, 0);
+	hci_reg_mask16 (controller, port, ~4, 0);
 	int value;
 	do {
-		value = uhci_reg_read16 (controller, port);
+		value = hci_reg_read16 (controller, port);
 		mdelay (1);
 	} while ((value & (1 << 2)) != 0);
 }
@@ -92,16 +92,16 @@ uhci_rh_scanport (usbdev_t *dev, int port)
 		usb_detach_device(dev->controller, devno);
 		RH_INST (dev)->port[offset] = -1;
 	}
-	uhci_reg_mask16 (dev->controller, portsc, ~0, (1 << 3) | (1 << 2));	// clear port state change, enable port
+	hci_reg_mask16 (dev->controller, portsc, ~0, (1 << 3) | (1 << 2));	// clear port state change, enable port
 
-	if ((uhci_reg_read16 (dev->controller, portsc) & 1) != 0) {
+	if ((hci_reg_read16 (dev->controller, portsc) & 1) != 0) {
 		// device attached
 
 		uhci_rh_disable_port (dev, port);
 		uhci_rh_enable_port (dev, port);
 
 		int lowspeed =
-			(uhci_reg_read16 (dev->controller, portsc) >> 8) & 1;
+			(hci_reg_read16 (dev->controller, portsc) >> 8) & 1;
 
 		RH_INST (dev)->port[offset] = usb_attach_device(dev->controller, dev->address, portsc, lowspeed);
 	}
@@ -113,19 +113,19 @@ uhci_rh_report_port_changes (usbdev_t *dev)
 	int stored, real;
 
 	stored = (RH_INST (dev)->port[0] == -1);
-	real = ((uhci_reg_read16 (dev->controller, PORTSC1) & 1) == 0);
+	real = ((hci_reg_read16 (dev->controller, PORTSC1) & 1) == 0);
 	if (stored != real)
 		return 1;
 
 	stored = (RH_INST (dev)->port[1] == -1);
-	real = ((uhci_reg_read16 (dev->controller, PORTSC2) & 1) == 0);
+	real = ((hci_reg_read16 (dev->controller, PORTSC2) & 1) == 0);
 	if (stored != real)
 		return 2;
 
 // maybe detach+attach happened between two scans?
-	if ((uhci_reg_read16 (dev->controller, PORTSC1) & 2) > 0)
+	if ((hci_reg_read16 (dev->controller, PORTSC1) & 2) > 0)
 		return 1;
-	if ((uhci_reg_read16 (dev->controller, PORTSC2) & 2) > 0)
+	if ((hci_reg_read16 (dev->controller, PORTSC2) & 2) > 0)
 		return 2;
 
 // no change
-- 
1.6.3.3

From 6dd43739c4a1c81d814af985d80d7d69ab979f59 Mon Sep 17 00:00:00 2001
From: Leandro Dorilex <[email protected]>
Date: Tue, 21 Jul 2009 15:59:41 -0400
Subject: [PATCH 3/5] usb: API change, control receive endpoint_t

Changed the usb API where the control function first parameter now
is a pointer of endpoint_t instead of a pointer of usbdevice_t.

The previous implementation assumed the first endpoint(index 0) as
control, which is not true, we can have devices with more than a
single control line.
---
 include/usb/usb.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/include/usb/usb.h b/include/usb/usb.h
index e7a5ae2..df78395 100644
--- a/include/usb/usb.h
+++ b/include/usb/usb.h
@@ -122,7 +122,7 @@ struct usbdev_hc {
 	int (*packet) (usbdev_t *dev, int endp, int pid, int toggle,
 		       int length, u8 *data);
 	int (*bulk) (endpoint_t *ep, int size, u8 *data, int finalize);
-	int (*control) (usbdev_t *dev, pid_t pid, int dr_length,
+	int (*control) (endpoint_t *ep, pid_t pid, int dr_length,
 			void *devreq, int data_length, u8 *data);
 	void* (*create_intr_queue) (endpoint_t *ep, int reqsize, int reqcount, int reqtiming);
 	void (*destroy_intr_queue) (endpoint_t *ep, void *queue);
-- 
1.6.3.3

From 156215d68e82c95f8044eb0acbcac24ea3f0b13b Mon Sep 17 00:00:00 2001
From: Leandro Dorilex <[email protected]>
Date: Tue, 21 Jul 2009 16:14:22 -0400
Subject: [PATCH 4/5] uhci: control adaptations

Chaging the implementation of uhci_control function to match the api
changes done in the previous patch.
---
 drivers/usb/uhci.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/uhci.c b/drivers/usb/uhci.c
index 8d5c9df..ac91f18 100644
--- a/drivers/usb/uhci.c
+++ b/drivers/usb/uhci.c
@@ -38,7 +38,7 @@ static void uhci_shutdown (hci_t *controller);
 static int uhci_packet (usbdev_t *dev, int endp, int pid, int toggle,
 			int length, u8 *data);
 static int uhci_bulk (endpoint_t *ep, int size, u8 *data, int finalize);
-static int uhci_control (usbdev_t *dev, pid_t dir, int drlen, void *devreq,
+static int uhci_control (endpoint_t *ep, pid_t dir, int drlen, void *devreq,
 			 int dalen, u8 *data);
 static void* uhci_create_intr_queue (endpoint_t *ep, int reqsize, int reqcount, int reqtiming);
 static void uhci_destroy_intr_queue (endpoint_t *ep, void *queue);
@@ -288,9 +288,10 @@ min (int a, int b)
 }
 
 static int
-uhci_control (usbdev_t *dev, pid_t dir, int drlen, void *devreq, int dalen,
+uhci_control (endpoint_t *ep, pid_t dir, int drlen, void *devreq, int dalen,
 	      unsigned char *data)
 {
+    usbdev_t *dev = ep->dev;
 	int endp = 0;		/* this is control: always 0 */
 	int mlen = dev->endpoints[0].maxpacketsize;
 	int count = (2 + (dalen + mlen - 1) / mlen);
-- 
1.6.3.3

From 367142ed779d6e10c8cccd2bd17e81271fa34a9e Mon Sep 17 00:00:00 2001
From: Leandro Dorilex <[email protected]>
Date: Tue, 21 Jul 2009 16:16:56 -0400
Subject: [PATCH 5/5] control users: change the callers of ->control

This patch introduces changes in the usb main program and msc driver
as well. It basically passes an endpoint_t instead of a usbdevice_t
to control function.

We are still assuming the first endpoint to be the control one. We
may need to change the functions in usb.c with a depper adaptation
to accommodate drivers for devices with more than a single control
endpoint but for now endpoint[0] should work.
---
 drivers/usb/usb.c    |   15 ++++++++-------
 drivers/usb/usbmsc.c |    4 ++--
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/usb.c b/drivers/usb/usb.c
index d536d31..12c6eda 100644
--- a/drivers/usb/usb.c
+++ b/drivers/usb/usb.c
@@ -109,7 +109,7 @@ set_feature (usbdev_t *dev, int endp, int feature, int rtype)
 	dr.wValue = feature;
 	dr.wIndex = endp;
 	dr.wLength = 0;
-	dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
+	dev->controller->control (&dev->endpoints[endp], OUT, sizeof (dr), &dr, 0, 0);
 }
 
 void
@@ -123,7 +123,7 @@ get_status (usbdev_t *dev, int intf, int rtype, int len, void *data)
 	dr.wValue = 0;
 	dr.wIndex = intf;
 	dr.wLength = len;
-	dev->controller->control (dev, IN, sizeof (dr), &dr, len, data);
+	dev->controller->control (&dev->endpoints[intf], IN, sizeof (dr), &dr, len, data);
 }
 
 u8 *
@@ -134,6 +134,7 @@ get_descriptor (usbdev_t *dev, unsigned char bmRequestType, int descType,
 	u8 *result;
 	dev_req_t dr;
 	int size;
+    endpoint_t *ep = &dev->endpoints[langID];
 
 	dr.bmRequestType = bmRequestType;
 	dr.data_dir = device_to_host;	// always like this for descriptors
@@ -141,7 +142,7 @@ get_descriptor (usbdev_t *dev, unsigned char bmRequestType, int descType,
 	dr.wValue = (descType << 8) | descIdx;
 	dr.wIndex = langID;
 	dr.wLength = 8;
-	if (dev->controller->control (dev, IN, sizeof (dr), &dr, 8, buf)) {
+	if (dev->controller->control (ep, IN, sizeof (dr), &dr, 8, buf)) {
 		printf ("getting descriptor size (type %x) failed\n",
 			descType);
 	}
@@ -165,7 +166,7 @@ get_descriptor (usbdev_t *dev, unsigned char bmRequestType, int descType,
 	memset (result, 0, size);
 	dr.wLength = size;
 	if (dev->controller->
-	    control (dev, IN, sizeof (dr), &dr, size, result)) {
+	    control (ep, IN, sizeof (dr), &dr, size, result)) {
 		printf ("getting descriptor (type %x, size %x) failed\n",
 			descType, size);
 	}
@@ -183,7 +184,7 @@ set_configuration (usbdev_t *dev)
 	dr.wValue = dev->configuration[5];
 	dr.wIndex = 0;
 	dr.wLength = 0;
-	dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
+	dev->controller->control (&dev->endpoints[0], OUT, sizeof (dr), &dr, 0, 0);
 }
 
 int
@@ -201,7 +202,7 @@ clear_stall (endpoint_t *ep)
 	dr.wValue = ENDPOINT_HALT;
 	dr.wIndex = endp;
 	dr.wLength = 0;
-	dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
+	dev->controller->control (ep, OUT, sizeof (dr), &dr, 0, 0);
 	return 0;
 }
 
@@ -246,7 +247,7 @@ set_address (hci_t *controller, int lowspeed)
 	dev->endpoints[0].toggle = 0;
 	dev->endpoints[0].direction = SETUP;
 	mdelay (50);
-	if (dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0)) {
+	if (dev->controller->control (&dev->endpoints[0], OUT, sizeof (dr), &dr, 0, 0)) {
 		printf ("set_address failed\n");
 		return -1;
 	}
diff --git a/drivers/usb/usbmsc.c b/drivers/usb/usbmsc.c
index ad4a10c..c957c89 100644
--- a/drivers/usb/usbmsc.c
+++ b/drivers/usb/usbmsc.c
@@ -122,7 +122,7 @@ typedef struct {
 	dr.wValue = 0;
 	dr.wIndex = 0;
 	dr.wLength = 0;
-	dev->controller->control (dev, OUT, sizeof (dr), &dr, 0, 0);
+	dev->controller->control (&dev->endpoints[0], OUT, sizeof (dr), &dr, 0, 0);
 	clear_stall (MSC_INST (dev)->bulk_in);
 	clear_stall (MSC_INST (dev)->bulk_out);
 }
@@ -143,7 +143,7 @@ get_max_luns (usbdev_t *dev)
 	dr.wValue = 0;
 	dr.wIndex = 0;
 	dr.wLength = 1;
-	if (dev->controller->control (dev, IN, sizeof (dr), &dr, 1, &luns)) {
+	if (dev->controller->control (&dev->endpoints[0], IN, sizeof (dr), &dr, 1, &luns)) {
 		luns = 0;	// assume only 1 lun if req fails
 	}
 	return luns;
-- 
1.6.3.3

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to