Skip to contentSkip to conversation

Review request: Cypress c67x00 OTG controller

PATCH In review Grant Likely 5 participants 20 messages Nov 24, 2007

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

cover Review request: Cypress c67x00 OTG controller

This patch series is based on the c67x00 work done by Peter Korsgaard and posted back in April this year.

The Cypress c67x00 is an OTG controller so it can behave as either a host or gadget controller. This series implements the HCD behaviour.

The c67x00 is found on a number of the Xilinx MLxxx series of boards. I've been performing my testing on a board derived from the ML403.

My goal is to get this driver queued up for inclusion in 2.6.25, but I've been looking at this code for so long that I'm going crosseyed and missing obvious issues. Plus, I am by no means a USB expert and I'm not sure that I'm using the USB HCD API correctly.

So, this email is a request for review. I've got some time cleared away to work on this over the next week so I should be able to address comments quickly with the goal of getting it picked up for the next merge window.

Thanks,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.

#1 lore raw

PATCH 1/5 USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

From: Peter Korsgaard <[email protected]>

Some multi-role (host/peripheral) USB controllers use a shared interrupt line for all parts of the chip. Export usb_hcd_irq so drivers can call it from their interrupt handler instead of duplicating code.
Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler shouldn't be registerred by the core.

---

 drivers/usb/core/hcd.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
drivers/usb/core/hcd.c +5 -1
index fea8256..6ce305c 100644
@@ -1562,6 +1562,7 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd)
 		usb_hc_died (hcd);
 	return IRQ_HANDLED;
 }
+EXPORT_SYMBOL_GPL (usb_hcd_irq);
 
 /*-------------------------------------------------------------------------*/
 
@@ -1670,6 +1671,9 @@ EXPORT_SYMBOL (usb_put_hcd);
  * Finish the remaining parts of generic HCD initialization: allocate the
  * buffers of consistent memory, register the bus, request the IRQ line,
  * and call the driver's reset() and start() routines.
+ *
+ * If irqnum is 0, the irq will not be requested. The caller is responsible
+ * for calling usb_hcd_irq at the correct time.
  */
 int usb_add_hcd(struct usb_hcd *hcd,
 		unsigned int irqnum, unsigned long irqflags)
@@ -1723,7 +1727,7 @@ int usb_add_hcd(struct usb_hcd *hcd,
 		dev_dbg(hcd->self.controller, "supports USB remote wakeup\n");
 
 	/* enable irqs just before we start the controller */
-	if (hcd->driver->irq) {
+	if (hcd->driver->irq && irqnum) {
 		snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
 				hcd->driver->description, hcd->self.busnum);
 		if ((retval = request_irq(irqnum, &usb_hcd_irq, irqflags,
#2 lore raw

Re: [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

Quoted 7 lines · Grant Likely

From: Peter Korsgaard <[email protected]>

Some multi-role (host/peripheral) USB controllers use a shared interrupt line for all parts of the chip. Export usb_hcd_irq so drivers can call it from their interrupt handler instead of duplicating code.
Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler shouldn't be registerred by the core.

What about for platforms where irq 0 is a valid irq?

thanks,

greg k-h

#3 lore raw

Re: [linux-usb-devel] [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

Quoted 10 lines · On Fri, 23 Nov 2007 21:10:39 -0800 Greg KH <[email protected]> wrote:
Quoted 7 lines · Grant Likely

From: Peter Korsgaard <[email protected]>

Some multi-role (host/peripheral) USB controllers use a shared interrupt line for all parts of the chip. Export usb_hcd_irq so drivers can call it from their interrupt handler instead of duplicating code.
Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler shouldn't be registerred by the core.

What about for platforms where irq 0 is a valid irq?

There are no such platforms. Linus made that absolutely clear every time this came up before

	0	-	No IRQ

A platform with a physical or bus IRQ of 0 needs to remap it to a different constant.

Alan

#4 lore raw

Re: [linux-usb-devel] [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

Quoted 14 lines · Alan Cox
Quoted 10 lines · On Fri, 23 Nov 2007 21:10:39 -0800 Greg KH <[email protected]> wrote:
Quoted 7 lines · Grant Likely

From: Peter Korsgaard <[email protected]>

Some multi-role (host/peripheral) USB controllers use a shared interrupt line for all parts of the chip. Export usb_hcd_irq so drivers can call it from their interrupt handler instead of duplicating code.
Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler shouldn't be registerred by the core.

What about for platforms where irq 0 is a valid irq?

Quoted 7 lines

There are no such platforms. Linus made that absolutely clear every time this came up before

0 - No IRQ

A platform with a physical or bus IRQ of 0 needs to remap it to a different constant.

Regardless, I should probably use the NO_IRQ macro instead.

g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#5 lore raw

Re: [linux-usb-devel] [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

In reply to Alan Cox
Quoted 10 lines · Alan Cox
Quoted 2 lines

What about for platforms where irq 0 is a valid irq?

There are no such platforms. Linus made that absolutely clear every time this came up before

        0       -       No IRQ

A platform with a physical or bus IRQ of 0 needs to remap it to a different constant.

However it's also common practice to use negative numbers to flag "this is no IRQ" ... avoiding all confusions with zero.

- platform_get_irq(), platform_get_irq_byname() ... never return zero, they return irq (positive) or errno

- PNP initializes invalid IRQs to "-1", and pnp_check_irq() handles irq zero as in-range

- I'm sure I've seen negative numbers used elsewhere too

Something like

  #define is_valid_irq(x) ((x) >= 0)

would work better than expecting sudden agreement everywhere about a single number representing "this is not an IRQ".

- Dave

#6 lore raw

Re: [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

In reply to Grant Likely
Quoted 2 lines · Grant Likely

Some multi-role (host/peripheral) USB controllers use a shared interrupt line for all parts of the chip.

Like the musb_hdrc code ... soonish to go upstream (it needs some updates to catch up to usbcore urb->status changes), this is used by the Nokia 800 and 810. In terms of chips with Linux support:
DaVinci, TUSB60x0, OMAP 2430, OMAP 3430, Blackfin BF527; and ISTR a few less-publicised ones (including, yes, some PPC SOCs).

That driver hasn't needed to change usbcore for IRQ handling though.

Quoted 2 lines

Export usb_hcd_irq so drivers can call it
from their interrupt handler instead of duplicating code.

This seems to be the main point of this patch. I'd rather just make that "static" though; it should already be marked that way.

That routine doesn't do enough to make me like it any more; and with dual-role controllers, the driver lifecycle is more complex than usbcore can be expected to mediate. Best to just call the host side IRQ logic directly from your toplevel IRQ handler.

Quoted 2 lines

Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler shouldn't be registerred by the core.

The current way to get that behavior is to leave hcd->driver->irq as zero; then "irqnum" is ignored, and your dual role driver can register its own handler.

- Dave

#7 lore raw

Re: [PATCH 1/5] USB: Make usb_hcd_irq work for multi-role USB controllers w/ shared irq

Quoted 25 lines · David Brownell
Quoted 2 lines · Grant Likely

Some multi-role (host/peripheral) USB controllers use a shared interrupt line for all parts of the chip.

Like the musb_hdrc code ... soonish to go upstream (it needs some updates to catch up to usbcore urb->status changes), this is used by the Nokia 800 and 810. In terms of chips with Linux support:
DaVinci, TUSB60x0, OMAP 2430, OMAP 3430, Blackfin BF527; and ISTR a few less-publicised ones (including, yes, some PPC SOCs).

That driver hasn't needed to change usbcore for IRQ handling though.

Quoted 2 lines

Export usb_hcd_irq so drivers can call it
from their interrupt handler instead of duplicating code.

This seems to be the main point of this patch. I'd rather just make that "static" though; it should already be marked that way.

That routine doesn't do enough to make me like it any more; and with dual-role controllers, the driver lifecycle is more complex than usbcore can be expected to mediate. Best to just call the host side IRQ logic directly from your toplevel IRQ handler.

Quoted 6 lines
Quoted 2 lines

Drivers pass an irqnum of 0 to usb_add_hcd to signal that the interrupt handler shouldn't be registerred by the core.

The current way to get that behavior is to leave hcd->driver->irq as zero; then "irqnum" is ignored, and your dual role driver can register its own handler.

Okay, I'll make that change.

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#8 lore raw

PATCH 2/5 USB: Add Cypress c67x00 low level interface code

In reply to Grant Likely

From: Grant Likely <[email protected]>

This patch adds the low level support code for the Cypress c67x00 family of OTG controllers. The low level code is responsible for register access and implements the software protocol for communicating with the c67x00 device.

---

 drivers/usb/c67x00/c67x00-ll-hpi.c |  512 ++++++++++++++++++++++++++++++++++++
 drivers/usb/c67x00/c67x00.h        |  236 +++++++++++++++++
 2 files changed, 748 insertions(+), 0 deletions(-)
drivers/usb/c67x00/c67x00-ll-hpi.c new file +512 -0
new file mode 100644
index 0000000..5e1bd73
@@ -0,0 +1,512 @@
+/*
+ * c67x00-ll-hpi.c: Cypress C67X00 USB Low level interface using HPI
+ *
+ * Copyright (C) 2006-2007 Barco N.V.
+ *    Derived from the Cypress cy7c67200/300 ezusb linux driver and
+ *    based on multiple host controller drivers inside the linux kernel.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301  USA.
+ */
+
+#include <asm/io.h>
+#include <asm/byteorder.h>
+#include "c67x00.h"
+
+/* -------------------------------------------------------------------------- */
+/* Interface definitions */
+
+#define COMM_ACK			0x0FED
+#define COMM_NAK			0xDEAD
+
+#define COMM_CTRL_REG_ADDR		0x01BC
+#define COMM_CTRL_REG_DATA		0x01BE
+#define COMM_CTRL_REG_LOGIC		0x01C0
+#define COMM_WRITE_CTRL_REG		0xCE03
+#define COMM_READ_CTRL_REG		0xCE02
+
+#define COMM_RESET			0xFA50
+#define COMM_EXEC_INT			0xCE01
+#define COMM_INT_NUM			0x01C2
+/* Registers 0 to COMM_REGS-1 */
+#define COMM_R(x)			(0x01C4 + 2 * (x))
+
+#define HUSB_SIE_pCurrentTDPtr(x)	( (x) ? 0x01B2 : 0x01B0 )
+#define HUSB_SIE_pTDListDone_Sem(x)	( (x) ? 0x01B8 : 0x01B6 )
+#define HUSB_pEOT			0x01B4
+
+/* Software interrupts */
+/* 114, 115: */
+#define HUSB_SIE_INIT_INT(x)		( (x) ? 0x0073 : 0x0072 )
+#define HUSB_RESET_INT			0x0074	/* 116 */
+
+#define SUSB_INIT_INT			0x0071
+/* -------------------------------------------------------------------------- */
+/* HPI implementation */
+
+/* HPI registers */
+#define HPI_DATA	0
+#define HPI_MAILBOX	1
+#define HPI_ADDR	2
+#define HPI_STATUS	3
+
+/* These functions could also be implemented with SPI of HSS.
+ * This is currently not supported */
+static inline u16 hpi_read_reg(struct c67x00_device *dev, int reg)
+{
+	return __raw_readw(dev->hpi.base + reg * dev->hpi.regstep);
+}
+
+static inline void hpi_write_reg(struct c67x00_device *dev, int reg, u16 value)
+{
+	__raw_writew(value, dev->hpi.base + reg * dev->hpi.regstep);
+}
+
+static inline u16 hpi_read_word_nolock(struct c67x00_device *dev, u16 reg)
+{
+	hpi_write_reg(dev, HPI_ADDR, reg);
+	return hpi_read_reg(dev, HPI_DATA);
+}
+
+static inline u16 hpi_read_word(struct c67x00_device *dev, u16 reg)
+{
+	u16 value;
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	value = hpi_read_word_nolock(dev, reg);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+
+	return value;
+}
+
+static inline void hpi_write_word_nolock(struct c67x00_device *dev, u16 reg,
+					 u16 value)
+{
+	hpi_write_reg(dev, HPI_ADDR, reg);
+	hpi_write_reg(dev, HPI_DATA, value);
+}
+
+static inline void hpi_write_word(struct c67x00_device *dev, u16 reg, u16 value)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	hpi_write_word_nolock(dev, reg, value);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+/*
+ * Only data is little endian, addr has cpu endianess
+ */
+static inline void hpi_write_words_le16(struct c67x00_device *dev, u16 addr,
+					u16 * data, u16 count)
+{
+	unsigned long flags;
+	int i;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+
+	hpi_write_reg(dev, HPI_ADDR, addr);
+	for (i = 0; i < count; i++)
+		hpi_write_reg(dev, HPI_DATA, cpu_to_le16(*data++));
+
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+/*
+ * Only data is little endian, addr has cpu endianess
+ */
+static inline void hpi_read_words_le16(struct c67x00_device *dev, u16 addr,
+				       u16 * data, u16 count)
+{
+	unsigned long flags;
+	int i;
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	hpi_write_reg(dev, HPI_ADDR, addr);
+	for (i = 0; i < count; i++)
+		*data++ = le16_to_cpu(hpi_read_reg(dev, HPI_DATA));
+
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+static inline void hpi_set_bits(struct c67x00_device *dev, u16 reg, u16 mask)
+{
+	u16 value;
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	value = hpi_read_word_nolock(dev, reg);
+	hpi_write_word_nolock(dev, reg, value | mask);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+static inline void hpi_clear_bits(struct c67x00_device *dev, u16 reg, u16 mask)
+{
+	u16 value;
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	value = hpi_read_word_nolock(dev, reg);
+	hpi_write_word_nolock(dev, reg, value & ~mask);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+}
+
+static inline u16 hpi_recv_mbox(struct c67x00_device *dev)
+{
+	u16 value;
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	value = hpi_read_reg(dev, HPI_MAILBOX);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+
+	return value;
+}
+
+static inline u16 hpi_send_mbox(struct c67x00_device *dev, u16 value)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	hpi_write_reg(dev, HPI_MAILBOX, value);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+
+	return value;
+}
+
+u16 c67x00_ll_hpi_status(struct c67x00_device * dev)
+{
+	u16 value;
+	unsigned long flags;
+
+	spin_lock_irqsave(&dev->hw_lock, flags);
+	value = hpi_read_reg(dev, HPI_STATUS);
+	spin_unlock_irqrestore(&dev->hw_lock, flags);
+
+	return value;
+}
+
+void c67x00_ll_hpi_reg_init(struct c67x00_device *dev)
+{
+	int i;
+
+	hpi_recv_mbox(dev);
+	c67x00_ll_hpi_status(dev);
+	hpi_write_word(dev, HPI_IRQ_ROUTING_REG, 0);
+
+	for (i=0; i<C67X00_SIES; i++) {
+		hpi_write_word(dev, SIEMSG_REG(i), 0);
+		hpi_read_word(dev, SIEMSG_REG(i));
+	}
+}
+
+void c67x00_ll_hpi_enable_sofeop(struct c67x00_sie *sie)
+{
+	hpi_set_bits(sie->dev, HPI_IRQ_ROUTING_REG,
+		     SOFEOP_TO_HPI_EN(sie->sie_num));
+}
+
+void c67x00_ll_hpi_disable_sofeop(struct c67x00_sie *sie)
+{
+	hpi_clear_bits(sie->dev, HPI_IRQ_ROUTING_REG,
+		       SOFEOP_TO_HPI_EN(sie->sie_num));
+}
+
+/* -------------------------------------------------------------------------- */
+/* Transactions */
+
+static inline u16 ll_recv_msg(struct c67x00_device *dev)
+{
+	u16 res;
+
+	res = wait_for_completion_timeout(&dev->lcp.msg_received, 5 * HZ);
+	WARN_ON(!res);
+
+	return (res == 0) ? -EIO : 0;
+}
+
+/* -------------------------------------------------------------------------- */
+
+u16 c67x00_comm_read_ctrl_reg(struct c67x00_device * dev, u16 addr)
+{
+	unsigned long msg, res;
+	int rc;
+
+	mutex_lock(&dev->lcp.mutex);
+	hpi_write_word(dev, COMM_CTRL_REG_ADDR, addr);
+	hpi_send_mbox(dev, COMM_READ_CTRL_REG);
+	rc = ll_recv_msg(dev);
+
+	BUG_ON(rc); /* No return path for error code; crash spectacularly */
+
+	msg = dev->lcp.last_msg;
+	if (msg != COMM_ACK) {
+		dev_warn(&dev->pdev->dev, "COMM_READ_CTRL_REG didn't ACK!\n");
+		res = 0;
+	} else {
+		res = hpi_read_word(dev, COMM_CTRL_REG_DATA);
+	}
+	mutex_unlock(&dev->lcp.mutex);
+	return res;
+}
+
+int c67x00_comm_exec_int(struct c67x00_device *dev, u16 nr,
+			 struct c67x00_lcp_int_data *data)
+{
+	int i, rc;
+
+	mutex_lock(&dev->lcp.mutex);
+	hpi_write_word(dev, COMM_INT_NUM, nr);
+	for (i = 0; i < COMM_REGS; i++)
+		hpi_write_word(dev, COMM_R(i), data->regs[i]);
+	hpi_send_mbox(dev, COMM_EXEC_INT);
+	rc = ll_recv_msg(dev);
+	mutex_unlock(&dev->lcp.mutex);
+
+	return rc;
+}
+
+/* -------------------------------------------------------------------------- */
+/* General functions */
+
+u16 c67x00_ll_get_siemsg(struct c67x00_device *dev, int sie)
+{
+	return hpi_read_word(dev, SIEMSG_REG(sie));
+}
+
+void c67x00_ll_set_siemsg(struct c67x00_device *dev, int sie, u16 val)
+{
+	hpi_write_word(dev, SIEMSG_REG(sie), val);
+}
+
+u16 c67x00_ll_get_usb_ctl(struct c67x00_sie *sie)
+{
+	return hpi_read_word(sie->dev, USB_CTL_REG(sie->sie_num));
+}
+
+/* -------------------------------------------------------------------------- */
+/* Host specific functions */
+
+void c67x00_ll_set_husb_eot(struct c67x00_device *dev, u16 value)
+{
+	mutex_lock(&dev->lcp.mutex);
+	hpi_write_word(dev, HUSB_pEOT, value);
+	mutex_unlock(&dev->lcp.mutex);
+}
+
+static inline void c67x00_ll_husb_sie_init(struct c67x00_sie *sie)
+{
+	struct c67x00_device *dev = sie->dev;
+	struct c67x00_lcp_int_data data;
+	int rc;
+
+	rc = c67x00_comm_exec_int(dev, HUSB_SIE_INIT_INT(sie->sie_num), &data);
+	BUG_ON(rc); /* No return path for error code; crash spectacularly */
+}
+
+void c67x00_ll_husb_reset(struct c67x00_sie *sie, int port)
+{
+	struct c67x00_device *dev = sie->dev;
+	struct c67x00_lcp_int_data data;
+	int rc;
+
+	data.regs[0] = 50;	/* Reset USB port for 50ms */
+	data.regs[1] = port | (sie->sie_num << 1);
+	rc = c67x00_comm_exec_int(dev, HUSB_RESET_INT, &data);
+	BUG_ON(rc); /* No return path for error code; crash spectacularly */
+}
+
+void c67x00_ll_husb_set_current_td(struct c67x00_sie *sie, u16 addr)
+{
+	hpi_write_word(sie->dev, HUSB_SIE_pCurrentTDPtr(sie->sie_num), addr);
+}
+
+u16 c67x00_ll_husb_get_current_td(struct c67x00_sie *sie)
+{
+	return hpi_read_word(sie->dev, HUSB_SIE_pCurrentTDPtr(sie->sie_num));
+}
+
+/**
+ * c67x00_ll_husb_clear_status - clear the host status bits
+ */
+void c67x00_ll_husb_clear_status(struct c67x00_sie *sie, u16 bits)
+{
+	hpi_write_word(sie->dev, HOST_STAT_REG(sie->sie_num), bits);
+}
+
+u16 c67x00_ll_husb_get_status(struct c67x00_sie *sie)
+{
+	return hpi_read_word(sie->dev, HOST_STAT_REG(sie->sie_num));
+}
+
+u16 c67x00_ll_husb_get_frame(struct c67x00_sie * sie)
+{
+	return hpi_read_word(sie->dev, HOST_FRAME_REG(sie->sie_num));
+}
+
+void c67x00_ll_husb_init_host_port(struct c67x00_sie *sie)
+{
+	/* Set port into host mode */
+	hpi_set_bits(sie->dev, USB_CTL_REG(sie->sie_num), HOST_MODE);
+	c67x00_ll_husb_sie_init(sie);
+	/* Clear interrupts */
+	c67x00_ll_husb_clear_status(sie, HOST_STAT_MASK);
+	/* Check */
+	if (!(hpi_read_word(sie->dev, USB_CTL_REG(sie->sie_num)) & HOST_MODE))
+		dev_warn(sie_dev(sie),
+			 "SIE %d not set to host mode\n", sie->sie_num);
+}
+
+void c67x00_ll_husb_reset_port(struct c67x00_sie *sie, int port)
+{
+	/* Clear connect change */
+	c67x00_ll_husb_clear_status(sie, PORT_CONNECT_CHANGE(port));
+
+	/* Enable interrupts */
+	hpi_set_bits(sie->dev, HPI_IRQ_ROUTING_REG,
+		     SOFEOP_TO_CPU_EN(sie->sie_num));
+	hpi_set_bits(sie->dev, HOST_IRQ_EN_REG(sie->sie_num),
+		     SOF_EOP_IRQ_EN | DONE_IRQ_EN);
+
+	/* Enable pull down transistors */
+	hpi_set_bits(sie->dev, USB_CTL_REG(sie->sie_num), PORT_RES_EN(port));
+}
+
+/* -------------------------------------------------------------------------- */
+void c67x00_ll_susb_init(struct c67x00_sie *sie)
+{
+	struct c67x00_device *dev = sie->dev;
+	struct c67x00_lcp_int_data data;
+	int rc;
+
+	data.regs[1] = 1;	/* full speed */
+	data.regs[2] = sie->sie_num + 1;
+	rc = c67x00_comm_exec_int(dev, SUSB_INIT_INT, &data);
+	BUG_ON(rc); /* No return path for error code; crash spectacularly */
+
+	hpi_clear_bits(dev, HPI_IRQ_ROUTING_REG,
+		       SOFEOP_TO_HPI_EN(sie->sie_num));
+	hpi_set_bits(dev, HPI_IRQ_ROUTING_REG, SOFEOP_TO_CPU_EN(sie->sie_num));
+}
+
+/* -------------------------------------------------------------------------- */
+
+void c67x00_ll_irq(struct c67x00_device *dev)
+{
+	if ((dev->int_status & MBX_OUT_FLG) == 0)
+		return;
+
+	dev->lcp.last_msg = hpi_recv_mbox(dev);
+	complete(&dev->lcp.msg_received);
+}
+
+/* -------------------------------------------------------------------------- */
+
+int c67x00_ll_reset(struct c67x00_device *dev)
+{
+	int rc;
+
+	mutex_lock(&dev->lcp.mutex);
+	hpi_send_mbox(dev, COMM_RESET);
+	rc = ll_recv_msg(dev);
+	mutex_unlock(&dev->lcp.mutex);
+
+	return rc;
+}
+
+/* -------------------------------------------------------------------------- */
+
+/**
+ * c67x00_write_mem_le16 - write into c67x00 memory
+ * Only data is little endian, addr has cpu endianess.
+ */
+void c67x00_ll_hpi_write_mem_le16(struct c67x00_device *dev, u16 addr, int len,
+				  char *data)
+{
+	/* Sanity check */
+	if (addr + len > 0xffff) {
+		dev_err(&dev->pdev->dev,
+			"Trying to write beyond writable region!\n");
+		return;
+	}
+
+	if (addr & 0x01) {
+		/* unaligned access */
+		u16 tmp;
+		tmp = hpi_read_word(dev, addr - 1);
+		tmp = (tmp & 0x00ff) | (*data++ << 8);
+		hpi_write_word(dev, addr - 1, tmp);
+		addr++;
+		len--;
+	}
+
+	hpi_write_words_le16(dev, addr, (u16 *) data, len / 2);
+	data += len & ~0x01;
+	addr += len & ~0x01;
+	len &= 0x01;
+
+	if (len) {
+		u16 tmp;
+		tmp = hpi_read_word(dev, addr);
+		tmp = (tmp & 0xff00) | (*data++);
+		hpi_write_word(dev, addr, tmp);
+		addr++;
+		len--;
+	}
+
+}
+
+/**
+ * c67x00_ll_hpi_read_mem_le16 - read from c67x00 memory
+ * Only data is little endian, addr has cpu endianess.
+ */
+void c67x00_ll_hpi_read_mem_le16(struct c67x00_device *dev, u16 addr, int len,
+				 char *data)
+{
+	if (addr & 0x01) {
+		/* unaligned access */
+		u16 tmp;
+		tmp = hpi_read_word(dev, addr - 1);
+		*data++ = (tmp >> 8) & 0x00ff;
+		addr++;
+		len--;
+	}
+
+	hpi_read_words_le16(dev, addr, (u16 *) data, len / 2);
+	data += len & ~0x01;
+	addr += len & ~0x01;
+	len &= 0x01;
+
+	if (len) {
+		u16 tmp;
+		tmp = hpi_read_word(dev, addr);
+		*data++ = tmp & 0x00ff;
+		addr++;
+		len--;
+	}
+}
+
+/* -------------------------------------------------------------------------- */
+
+void c67x00_ll_init(struct c67x00_device *dev)
+{
+	mutex_init(&dev->lcp.mutex);
+	init_completion(&dev->lcp.msg_received);
+}
+
+void c67x00_ll_release(struct c67x00_device *dev)
+{
+}
drivers/usb/c67x00/c67x00.h new file +236 -0

236 lines not on this page · raw message

#9 lore raw

Re: [PATCH 2/5] USB: Add Cypress c67x00 low level interface code

Quoted 2 lines · Grant Likely

+/* These functions could also be implemented with SPI of HSS.
+ * This is currently not supported */

Give that this "HPI" interface seems to use a parallel bus with irq-safe synchronous accesses, and SPI is a serial bus where synchronous accesses can't be done in IRQ context ... that comment doesn't seem accurate.

Surely a more correct statement would be that while the chip can also be accessed using SPI, that would require updating the driver structure to stop assuming register accesses can always be done from IRQ context?

If that's not the case, then those spinlocks are overkill, and they should become mutexes. :)

- Dave

#10 lore raw

PATCH 3/5 USB: add Cypress c67x00 OTG controller core driver

In reply to Grant Likely

From: Grant Likely <[email protected]>

This patch add the core driver for the c67x00 USB OTG controller. The core driver is responsible for the platform bus binding and creating either USB HCD or USB Gadget instances for each of the serial interface engines on the chip.

This driver does not directly implement the HCD or gadget behaviours; it just controls access to the chip.

---

 drivers/usb/c67x00/c67x00-drv.c |  301 +++++++++++++++++++++++++++++++++++++++
 include/linux/usb/c67x00.h      |   45 ++++++
 2 files changed, 346 insertions(+), 0 deletions(-)
drivers/usb/c67x00/c67x00-drv.c new file +301 -0
new file mode 100644
index 0000000..e1b1db1
@@ -0,0 +1,301 @@
+/*
+ * c67x00-drv.c: Cypress C67X00 USB Common infrastructure
+ *
+ * Copyright (C) 2006-2007 Barco N.V.
+ *    Derived from the Cypress cy7c67200/300 ezusb linux driver and
+ *    based on multiple host controller drivers inside the linux kernel.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301  USA.
+ */
+
+/*
+ * This file implements the common infrastructure for using the c67x00.
+ * It is both the link between the platform configuration and subdrivers and
+ * the link between the common hardware parts and the subdrivers (e.g.
+ * interrupt handling).
+ *
+ * The c67x00 has 2 SIE's (serial interface engine) wich can be configured
+ * to be host, device or OTG (with some limitations, E.G. only SIE1 can be OTG).
+ *
+ * Depending on the platform configuration, the SIE's are created (setup_sie)
+ * and the corresponding subdriver is initialized (c67x00_probe_sie).
+ */
+
+#include <linux/device.h>
+#include <linux/list.h>
+#include <linux/usb.h>
+#include <linux/usb/c67x00.h>
+#include <asm/io.h>
+
+#include "c67x00.h"
+#include "c67x00-hcd.h"
+#include "c67x00-udc.h"
+
+static struct platform_driver c67x00_driver;
+
+static void
+c67x00_setup_sie(struct c67x00_sie *sie, struct c67x00_device *dev, int sie_num)
+{
+	static unsigned int id = 0;
+
+	/* Fill in needed attributes */
+	sie->pdev = platform_device_register_simple("c67x00_sie",
+						    id++, NULL, 0);
+	/* driver used in hub.c: hub_port_init */
+	sie->pdev->dev.driver = &c67x00_driver.driver;
+	spin_lock_init(&sie->lock);
+	sie->dev = dev;
+	sie->sie_num = sie_num;
+	sie->mode = c67x00_sie_config(dev->pdata->sie_config, sie_num);
+}
+
+static void c67x00_teardown_sie(struct c67x00_sie *sie)
+{
+	sie->pdev->dev.driver = NULL;
+	platform_device_unregister(sie->pdev);
+}
+
+/* ------------------------------------------------------------------ */
+
+static void c67x00_probe_sie(struct c67x00_sie *sie)
+{
+	switch (c67x00_sie_config(sie->dev->pdata->sie_config, sie->sie_num)) {
+	case C67X00_SIE_HOST:
+		c67x00_hcd_probe(sie);
+		break;
+
+	case C67X00_SIE_PERIPHERAL:
+		c67x00_udc_probe(sie);
+		break;
+
+	case C67X00_SIE_UNUSED:
+		dev_info(sie_dev(sie),
+			 "Not using SIE %d as requested\n", sie->sie_num);
+		break;
+
+	default:
+		dev_err(sie_dev(sie),
+			"Unsupported configuration: 0x%x for SIE %d\n",
+			c67x00_sie_config(sie->dev->pdata->sie_config,
+					  sie->sie_num), sie->sie_num);
+		break;
+	}
+}
+
+static void c67x00_remove_sie(struct c67x00_sie *sie)
+{
+	switch (c67x00_sie_config(sie->dev->pdata->sie_config, sie->sie_num)) {
+	case C67X00_SIE_HOST:
+		c67x00_hcd_remove(sie);
+		break;
+
+	case C67X00_SIE_PERIPHERAL:
+		c67x00_udc_remove(sie);
+		break;
+
+	default:
+		break;
+	}
+}
+
+/* ------------------------------------------------------------------ */
+
+static void
+c67x00_sie_irq(struct c67x00_device *c67x00, int sie_idx, int irq)
+{
+	struct c67x00_sie *sie = &c67x00->sie[sie_idx];
+
+	spin_lock(&sie->lock);
+	if (c67x00->int_status & SIEMSG_FLAG(sie_idx)) {
+		u16 msg = c67x00_ll_get_siemsg(c67x00, sie_idx);
+		if (sie->msg_received)
+			sie->msg_received(sie, msg);
+	}
+	if (sie->irq)
+		sie->irq(irq, sie);
+	spin_unlock(&sie->lock);
+}
+
+static irqreturn_t c67x00_irq(int irq, void *__dev)
+{
+	struct c67x00_device *c67x00 = __dev;
+	int i, count = 8;
+
+	c67x00->int_status = c67x00_ll_hpi_status(c67x00);
+	if (!c67x00->int_status)
+		return IRQ_NONE;
+
+	while (c67x00->int_status != 0 && (count-- >= 0)) {
+		c67x00_ll_irq(c67x00);
+		for (i = 0; i < C67X00_SIES; i++)
+			c67x00_sie_irq(c67x00, i, irq);
+		c67x00->int_status = c67x00_ll_hpi_status(c67x00);
+	}
+
+	if (c67x00->int_status)
+		dev_warn(&c67x00->pdev->dev, "Not all interrupts handled! "
+			 "status = 0x%04x\n", c67x00->int_status);
+
+	return IRQ_HANDLED;
+}
+
+/* ---------------------------------------------------------------------
+ * Platform bus binding
+ */
+
+static int __devinit c67x00_drv_probe(struct platform_device *pdev)
+{
+	struct c67x00_device *c67x00;
+	struct c67x00_platform_data *pdata;
+	struct resource *res, *res2;
+	int ret, i;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENODEV;
+
+	res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (!res2)
+		return -ENODEV;
+
+	pdata = (struct c67x00_platform_data*)pdev->dev.platform_data;
+	if (!pdata)
+		return -ENODEV;
+
+	c67x00 = kzalloc(sizeof(*c67x00), GFP_KERNEL);
+	if (!c67x00)
+		return -ENOMEM;
+
+	if (!request_mem_region(res->start, res->end - res->start + 1,
+				pdev->name)) {
+		dev_err(&pdev->dev, "Memory region busy\n");
+		ret = -EBUSY;
+		goto request_mem_failed;
+	}
+	c67x00->hpi.base = ioremap(res->start, res->end - res->start + 1);
+	if (!c67x00->hpi.base) {
+		dev_err(&pdev->dev, "Unable to map HPI registers\n");
+		ret = -EIO;
+		goto map_failed;
+	}
+
+	spin_lock_init(&c67x00->hw_lock);
+	c67x00->hpi.regstep = pdata->hpi_regstep;
+	c67x00->pdata = pdev->dev.platform_data;
+	c67x00->pdev = pdev;
+
+	for (i = 0; i < C67X00_SIES; i++)
+		c67x00_setup_sie(&c67x00->sie[i], c67x00, i);
+
+	c67x00_ll_init(c67x00);
+	c67x00_ll_hpi_reg_init(c67x00);
+
+	dev_info(&pdev->dev, "USB OTG controller, p:0x%x, v:0x%p, irq:%i\n",
+	         res->start, c67x00->hpi.base, res2->start);
+
+	ret = request_irq(res2->start, c67x00_irq, 0, pdev->name, c67x00);
+	if (ret) {
+		dev_err(&pdev->dev, "Cannot claim IRQ\n");
+		goto request_irq_failed;
+	}
+
+	ret = c67x00_ll_reset(c67x00);
+	if (ret) {
+		dev_err(&pdev->dev, "Device reset failed\n");
+		goto reset_failed;
+	}
+
+	for (i = 0; i < C67X00_SIES; i++)
+		c67x00_probe_sie(&c67x00->sie[i]);
+
+	platform_set_drvdata(pdev, c67x00);
+
+	return 0;
+
+ reset_failed:
+	free_irq(res2->start, c67x00);
+ request_irq_failed:
+	iounmap(c67x00->hpi.base);
+ map_failed:
+	release_mem_region(res->start, res->end - res->start + 1);
+ request_mem_failed:
+	kfree(c67x00);
+
+	return ret;
+}
+
+static int __devexit c67x00_drv_remove(struct platform_device *pdev)
+{
+	struct c67x00_device *c67x00 = platform_get_drvdata(pdev);
+	struct resource *res;
+	int i;
+
+	for (i = 0; i < C67X00_SIES; i++) {
+		c67x00_remove_sie(&c67x00->sie[i]);
+		c67x00_teardown_sie(&c67x00->sie[i]);
+	}
+
+	c67x00_ll_release(c67x00);
+
+	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+	if (res)
+		free_irq(res->start, c67x00);
+
+	iounmap(c67x00->hpi.base);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (res)
+		release_mem_region(res->start, res->end - res->start + 1);
+
+	kfree(c67x00);
+
+	return 0;
+}
+
+static struct platform_driver c67x00_driver = {
+	.probe = c67x00_drv_probe,
+	.remove = c67x00_drv_remove,
+	.driver = {
+		.owner = THIS_MODULE,
+		.name = "c67x00",
+	},
+};
+
+static int __init c67x00_init(void)
+{
+	int ret;
+
+	if (usb_disabled())
+		return -ENODEV;
+
+	ret = c67x00_udc_init();
+	if (ret)
+		return ret;
+
+	return platform_driver_register(&c67x00_driver);
+}
+module_init(c67x00_init);
+
+static void __exit c67x00_exit(void)
+{
+	c67x00_udc_cleanup();
+	platform_driver_unregister(&c67x00_driver);
+}
+module_exit(c67x00_exit);
+
+MODULE_AUTHOR("Peter Korsgaard, Jan Veldeman, Grant Likely");
+MODULE_DESCRIPTION("Cypress C67X00 USB Controller Driver");
+MODULE_LICENSE("GPL");
include/linux/usb/c67x00.h new file +45 -0

45 lines not on this page · raw message

#11 lore raw

PATCH 4/5 USB: add Cypress c67x00 OTG controller HCD driver

In reply to Grant Likely

From: Grant Likely <[email protected]>

This patch adds HDC support for the Cypress c67x00 family of devices.

---

 drivers/usb/c67x00/c67x00-hcd.c   |  390 ++++++++++++
 drivers/usb/c67x00/c67x00-hcd.h   |  163 +++++
 drivers/usb/c67x00/c67x00-sched.c | 1215 +++++++++++++++++++++++++++++++++++++
 3 files changed, 1768 insertions(+), 0 deletions(-)
drivers/usb/c67x00/c67x00-hcd.c new file +390 -0
new file mode 100644
index 0000000..6ffca60
@@ -0,0 +1,390 @@
+/*
+ * c67x00-hcd.c: Cypress C67X00 USB Host Controller Driver
+ *
+ * Copyright (C) 2006-2007 Barco N.V.
+ *    Derived from the Cypress cy7c67200/300 ezusb linux driver and
+ *    based on multiple host controller drivers inside the linux kernel.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301  USA.
+ */
+
+#include <linux/device.h>
+#include <linux/platform_device.h>
+#include <linux/usb.h>
+
+#include "c67x00.h"
+#include "c67x00-hcd.h"
+
+/* --------------------------------------------------------------------------
+ * Root Hub Support
+ */
+
+static __u8 c67x00_hub_des[] = {
+	0x09,			/*  __u8  bLength; */
+	0x29,			/*  __u8  bDescriptorType; Hub-descriptor */
+	0x02,			/*  __u8  bNbrPorts; */
+	0x00,			/* __u16  wHubCharacteristics; */
+	0x00,			/*   (per-port OC, no power switching) */
+	0x32,			/*  __u8  bPwrOn2pwrGood; 2ms */
+	0x00,			/*  __u8  bHubContrCurrent; 0 mA */
+	0x00,			/*  __u8  DeviceRemovable; ** 7 Ports max ** */
+	0xff,			/*  __u8  PortPwrCtrlMask; ** 7 ports max ** */
+};
+
+#define OK(x)			len = (x); break
+
+static void c67x00_hub_reset_host_port(struct c67x00_sie *sie, int port)
+{
+	struct c67x00_hcd *c67x00 = sie->private_data;
+	unsigned long flags;
+
+	c67x00_ll_husb_reset(sie, port);
+
+	spin_lock_irqsave(&c67x00->lock, flags);
+	c67x00_ll_husb_reset_port(sie, port);
+	spin_unlock_irqrestore(&c67x00->lock, flags);
+
+	c67x00_ll_set_husb_eot(sie->dev, DEFAULT_EOT);
+}
+
+static int c67x00_hub_status_data(struct usb_hcd *hcd, char *buf)
+{
+	struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd);
+	struct c67x00_sie *sie = c67x00->sie;
+	u16 status;
+	int i;
+
+	*buf = 0;
+	status = c67x00_ll_husb_get_status(sie);
+	for (i=0; i<C67X00_PORTS; i++)
+		if (status & PORT_CONNECT_CHANGE(i))
+			*buf |= (1 << i);
+
+	/* bit 0 denotes hub change, b1..n port change */
+	*buf <<= 1;
+
+	return !!*buf;
+}
+
+static int c67x00_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
+			      u16 wIndex, char *buf, u16 wLength)
+{
+	struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd);
+	struct c67x00_sie *sie = c67x00->sie;
+	u16 status, usb_status;
+	int len = 0;
+	unsigned int port = wIndex-1;
+	u16 wPortChange, wPortStatus;
+
+	switch (typeReq) {
+
+	case GetHubStatus:
+		*(__le32 *) buf = cpu_to_le32(0);
+		len = 4;	/* hub power */
+		break;
+	case GetPortStatus:
+		if (wIndex > C67X00_PORTS)
+			return -EPIPE;
+
+		status = c67x00_ll_husb_get_status(sie);
+		usb_status = c67x00_ll_get_usb_ctl(sie);
+
+		wPortChange = 0;
+		if (status & PORT_CONNECT_CHANGE(port))
+			wPortChange |= USB_PORT_STAT_C_CONNECTION;
+
+		wPortStatus = USB_PORT_STAT_POWER;
+		if (!(status & PORT_SE0_STATUS(port)))
+			wPortStatus |= USB_PORT_STAT_CONNECTION;
+		if (usb_status & LOW_SPEED_PORT(port)) {
+			wPortStatus |= USB_PORT_STAT_LOW_SPEED;
+			c67x00->low_speed_ports |= (1 << port);
+		} else
+			c67x00->low_speed_ports &= ~(1 << port);
+
+		if (usb_status & SOF_EOP_EN(port))
+			wPortStatus |= USB_PORT_STAT_ENABLE;
+
+		*(__le16 *) buf = cpu_to_le16(wPortStatus);
+		*(__le16 *) (buf + 2) = cpu_to_le16(wPortChange);
+		len = 4;
+		break;
+	case SetHubFeature:	/* We don't implement these */
+	case ClearHubFeature:
+		switch (wValue) {
+		case C_HUB_OVER_CURRENT:
+		case C_HUB_LOCAL_POWER:
+			len = 0;
+			break;
+		default:
+			return -EPIPE;
+		}
+		break;
+	case SetPortFeature:
+		if (wIndex > C67X00_PORTS)
+			return -EPIPE;
+
+		switch (wValue) {
+		case USB_PORT_FEAT_SUSPEND:
+			dev_dbg(c67x00_dev(c67x00),
+				"SetPortFeature %d (SUSPEND)\n", port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_RESET:
+			c67x00_hub_reset_host_port(sie, port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_POWER:
+			/* Power always enabled */
+			len = 0;
+			break;
+		default:
+			dev_dbg(c67x00_dev(c67x00),
+				"%s: SetPortFeature %d (0x%04x) Error!\n",
+				__FUNCTION__, port, wValue);
+			return -EPIPE;
+		}
+		break;
+	case ClearPortFeature:
+		if (wIndex > C67X00_PORTS)
+			return -EPIPE;
+
+		switch (wValue) {
+		case USB_PORT_FEAT_ENABLE:
+			/* Reset the port so that the c67x00 also notices the
+			 * disconnect */
+			c67x00_hub_reset_host_port(sie, port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_C_ENABLE:
+			dev_dbg(c67x00_dev(c67x00),
+				"ClearPortFeature (%d): C_ENABLE\n", port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_SUSPEND:
+			dev_dbg(c67x00_dev(c67x00),
+				"ClearPortFeature (%d): SUSPEND\n", port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_C_SUSPEND:
+			dev_dbg(c67x00_dev(c67x00),
+				"ClearPortFeature (%d): C_SUSPEND\n", port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_POWER:
+			dev_dbg(c67x00_dev(c67x00),
+				"ClearPortFeature (%d): POWER\n", port);
+			return -EPIPE;
+		case USB_PORT_FEAT_C_CONNECTION:
+			c67x00_ll_husb_clear_status(sie,
+						    PORT_CONNECT_CHANGE(port));
+			len = 0;
+			break;
+		case USB_PORT_FEAT_C_OVER_CURRENT:
+			dev_dbg(c67x00_dev(c67x00),
+				"ClearPortFeature (%d): OVER_CURRENT\n", port);
+			len = 0;
+			break;
+		case USB_PORT_FEAT_C_RESET:
+			dev_dbg(c67x00_dev(c67x00),
+				"ClearPortFeature (%d): C_RESET\n", port);
+			len = 0;
+			break;
+		default:
+			dev_dbg(c67x00_dev(c67x00),
+				"%s: ClearPortFeature %d (0x%04x) Error!\n",
+				__FUNCTION__, port, wValue);
+			return -EPIPE;
+		}
+		break;
+	case GetHubDescriptor:
+		len = min_t(unsigned int, sizeof(c67x00_hub_des), wLength);
+		memcpy(buf, c67x00_hub_des, len);
+		break;
+	default:
+		dev_dbg(c67x00_dev(c67x00), "%s: unknown\n", __FUNCTION__);
+	}
+
+	return 0;
+}
+
+/* ---------------------------------------------------------------------
+ * Main part of host controller driver
+ */
+
+/**
+ * c67x00_hcd_drv_irq
+ *
+ * This function is called from the interrupt handler in c67x00-drv.c
+ * We can't have the hcd register the irq (it has already been registerd
+ * by the common driver), so we must fake it through this call.
+ */
+static irqreturn_t c67x00_hcd_drv_irq(int irq, struct c67x00_sie *sie)
+{
+	struct c67x00_hcd *c67x00 = sie->private_data;
+	return usb_hcd_irq(irq, c67x00_hcd_to_hcd(c67x00));
+}
+
+static irqreturn_t c67x00_hcd_irq(struct usb_hcd *hcd)
+{
+	struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd);
+	struct c67x00_sie *sie = c67x00->sie;
+
+	if (sie->dev->int_status & SOFEOP_FLG(sie->sie_num)) {
+		c67x00_ll_husb_clear_status(sie, SOF_EOP_IRQ_FLG);
+		c67x00_sched_kick(c67x00);
+		return IRQ_HANDLED;
+	}
+	return IRQ_NONE;
+}
+
+/**
+ * c67x00_hcd_start: Host Controller start hook
+ */
+static int c67x00_hcd_start(struct usb_hcd *hcd)
+{
+	hcd->uses_new_polling = 1;
+	hcd->state = HC_STATE_RUNNING;
+	hcd->poll_rh = 1;
+	return 0;
+}
+
+/**
+ * c67x00_hcd_start: Host Controller stop hook
+ */
+static void c67x00_hcd_stop(struct usb_hcd *hcd)
+{
+	/* Nothing todo */
+}
+
+static int c67x00_hcd_get_frame(struct usb_hcd *hcd)
+{
+	struct c67x00_hcd *c67x00 = hcd_to_c67x00_hcd(hcd);
+	u16 temp_val;
+	dev_dbg(c67x00_dev(c67x00), "%s\n", __FUNCTION__);
+	temp_val = c67x00_ll_husb_get_frame(c67x00->sie);
+	temp_val &= HOST_FRAME_MASK;
+	return temp_val ? (temp_val - 1) : HOST_FRAME_MASK;
+}
+
+static struct hc_driver c67x00_hc_driver = {
+	.description = "c67x00-hcd",
+	.product_desc = "Cypress C67X00 Host Controller",
+	.hcd_priv_size = sizeof(struct c67x00_hcd),
+
+	/*
+	 * generic hardware linkage
+	 */
+	.irq = c67x00_hcd_irq,
+	.flags = HCD_USB11 | HCD_MEMORY,
+
+	/*
+	 * basic lifecycle operations
+	 */
+	.start = c67x00_hcd_start,
+	.stop = c67x00_hcd_stop,
+
+	/*
+	 * managing i/o requests and associated device resources
+	 */
+	.urb_enqueue = c67x00_urb_enqueue,
+	.urb_dequeue = c67x00_urb_dequeue,
+	.endpoint_disable = c67x00_endpoint_disable,
+
+	/*
+	 * scheduling support
+	 */
+	.get_frame_number = c67x00_hcd_get_frame,
+
+	/*
+	 * root hub support
+	 */
+	.hub_status_data = c67x00_hub_status_data,
+	.hub_control = c67x00_hub_control,
+};
+
+/* ---------------------------------------------------------------------
+ * Setup/Teardown routines
+ */
+
+int c67x00_hcd_probe(struct c67x00_sie *sie)
+{
+	int retval;
+	struct usb_hcd *hcd = NULL;
+	struct c67x00_hcd *c67x00;
+
+	hcd = usb_create_hcd(&c67x00_hc_driver, sie_dev(sie), "c67x00_sie");
+	if (!hcd) {
+		retval = -ENOMEM;
+		goto err0;
+	}
+	c67x00 = hcd_to_c67x00_hcd(hcd);
+
+	spin_lock_init(&c67x00->lock);
+	c67x00->sie = sie;
+
+	INIT_LIST_HEAD(&c67x00->list[PIPE_ISOCHRONOUS]);
+	INIT_LIST_HEAD(&c67x00->list[PIPE_INTERRUPT]);
+	INIT_LIST_HEAD(&c67x00->list[PIPE_CONTROL]);
+	INIT_LIST_HEAD(&c67x00->list[PIPE_BULK]);
+	c67x00->urb_count = 0;
+	INIT_LIST_HEAD(&c67x00->td_list);
+	INIT_LIST_HEAD(&c67x00->done_list);
+	c67x00->td_base_addr = CY_HCD_BUF_ADDR + SIE_TD_OFFSET(sie->sie_num);
+	c67x00->buf_base_addr = CY_HCD_BUF_ADDR + SIE_BUF_OFFSET(sie->sie_num);
+	c67x00->max_frame_bw = MAX_FRAME_BW_STD;
+
+	spin_lock(&sie->lock);
+	sie->private_data = c67x00;
+	sie->irq = c67x00_hcd_drv_irq;
+	sie->msg_received = c67x00_hcd_msg_received;
+	spin_unlock(&sie->lock);
+
+	c67x00_ll_husb_init_host_port(sie);
+
+	init_completion(&c67x00->endpoint_disable);
+	retval = c67x00_sched_start_scheduler(c67x00);
+	if (retval)
+		goto err1;
+
+	retval = usb_add_hcd(hcd, 0, 0);
+	if (retval) {
+		dev_dbg(sie_dev(sie), "%s: usb_add_hcd returned %d\n",
+			__FUNCTION__, retval);
+		goto err2;
+	}
+
+	return retval;
+ err2:
+	c67x00_sched_stop_scheduler(c67x00);
+ err1:
+	usb_put_hcd(hcd);
+ err0:
+	return retval;
+}
+
+/* may be called with controller, bus, and devices active */
+void c67x00_hcd_remove(struct c67x00_sie *sie)
+{
+	struct usb_hcd *hcd;
+	struct c67x00_hcd *c67x00;
+
+	c67x00 = sie->private_data;
+	hcd = c67x00_hcd_to_hcd(c67x00);
+	c67x00_sched_stop_scheduler(c67x00);
+	usb_remove_hcd(hcd);
+	usb_put_hcd(hcd);
+}
drivers/usb/c67x00/c67x00-hcd.h new file +163 -0

163 lines not on this page · raw message

drivers/usb/c67x00/c67x00-sched.c new file +1215 -0

1,215 lines not on this page · raw message

#12 lore raw

Re: [linux-usb-devel] [PATCH 4/5] USB: add Cypress c67x00 OTG controller HCD driver

Quoted 18 lines · Grant Likely

From: Grant Likely <[email protected]>

This patch adds HDC support for the Cypress c67x00 family of devices.

drivers/usb/c67x00/c67x00-sched.c new file +12 -0
+static void c67x00_sched_done(unsigned long __c67x00)
+{
+	struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
+	struct c67x00_urb_priv *urbp, *tmp;
+	struct usb_hcd *hcd = c67x00_hcd_to_hcd(c67x00);
+	struct urb *urb;
+	int status;
+
+	spin_lock(&c67x00->lock);
+
+	/* Loop over the done list and give back all the urbs */
+	list_for_each_entry_safe(urbp, tmp, &c67x00->done_list, hep_node) {

drivers/usb/c67x00/c67x00-sched.c line 1195

Quoted 10 lines
drivers/usb/c67x00/c67x00-sched.c new file +10 -0
+		urb = urbp->urb;
+		status = urbp->status;
+
+		c67x00_release_urb(c67x00, urb);
+
+		usb_hcd_unlink_urb_from_ep(hcd, urb);
+		usb_hcd_giveback_urb(hcd, urb, status);
+	}
+	spin_unlock(&c67x00->lock);
+}

You need to release the spinlock around the call to usb_hcd_giveback_urb(). Otherwise you will deadlock if the completion routine submits another URB.

Alan Stern

#13 lore raw

PATCH 5/5 USB: Add Cypress c67x00 OTG controller driver to Kconfig and Makefiles

In reply to Grant Likely

From: Grant Likely <[email protected]>

add c67x00 driver to build

---

 drivers/usb/Kconfig         |    2 ++
 drivers/usb/Makefile        |    2 ++
 drivers/usb/c67x00/Kconfig  |   22 ++++++++++++++++++++++
 drivers/usb/c67x00/Makefile |   14 ++++++++++++++
 4 files changed, 40 insertions(+), 0 deletions(-)
drivers/usb/Kconfig +2 -0
index 7580aa5..a497f96 100644
@@ -91,6 +91,8 @@ source "drivers/usb/core/Kconfig"
 
 source "drivers/usb/host/Kconfig"
 
+source "drivers/usb/c67x00/Kconfig"
+
 source "drivers/usb/class/Kconfig"
 
 source "drivers/usb/storage/Kconfig"
drivers/usb/Makefile +2 -0
index 516a640..a1ae51d 100644
@@ -17,6 +17,8 @@ obj-$(CONFIG_USB_SL811_HCD)	+= host/
 obj-$(CONFIG_USB_U132_HCD)	+= host/
 obj-$(CONFIG_USB_R8A66597_HCD)	+= host/
 
+obj-$(CONFIG_USB_C67X00_DRV)	+= c67x00/
+
 obj-$(CONFIG_USB_ACM)		+= class/
 obj-$(CONFIG_USB_PRINTER)	+= class/
 
drivers/usb/c67x00/Kconfig new file +22 -0
new file mode 100644
index 0000000..efd7923
@@ -0,0 +1,22 @@
+#
+# Cypress C67x00 USB controller
+#
+config USB_C67X00_DRV
+	tristate "Cypress C67x00 support"
+	# only allowed to be =y if both USB!=m and USB_GADGET!=m
+	depends on (!USB && USB_GADGET) || (!USB_GADGET && USB) || (USB && USB_GADGET)
+	default n
+	help
+	  The Cypress C67x00 (EZ-Host/EZ-OTG) chips are dual-role
+	  host/peripheral USB controllers.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called c67x00.
+
+config USB_C67X00_HCD
+	bool "Cypress C67X00 Host support"
+	depends on USB_C67X00_DRV
+	depends on USB
+	default y
+	help
+	  This enables the host functionality of the Cypress C67X00.
drivers/usb/c67x00/Makefile new file +14 -0
new file mode 100644
index 0000000..8ff5cd0
@@ -0,0 +1,14 @@
+#
+# Makefile for Cypress C67X00 USB Controller
+#
+
+ifeq ($(CONFIG_USB_DEBUG),y)
+	EXTRA_CFLAGS		+= -DDEBUG
+endif
+
+obj-$(CONFIG_USB_C67X00_DRV)	+= c67x00.o
+
+c67x00-y			+= c67x00-drv.o
+c67x00-y			+= c67x00-ll-hpi.o
+
+c67x00-$(CONFIG_USB_C67X00_HCD) += c67x00-hcd.o c67x00-sched.o
#14 lore raw

Re: [PATCH 5/5] USB: Add Cypress c67x00 OTG controller driver to Kconfig and Makefiles

Quoted 3 lines · Grant Likely

+config USB_C67X00_DRV
+       tristate "Cypress C67x00 support"
+       # only allowed to be =y if both USB!=m and USB_GADGET!=m

This is wrong. Remember that since this is a dual-role driver, there are exactly three possible driver modes ... and the driver must support only one of them at a time:

- Host-only ... only allowed if host side USB is enabled. The controller driver can be statically linked iff usbcore is too.

- Peripheral-only ... only allowed if peripheral side USB is enabled. Only one port may be used as the peripheral; the controller driver can be linked statically or as a module.

- OTG ... only allowed if both host and peripheral side USB are enabled. Only one port can be the OTG port, but other ports can be used for host functionality. Static/modular linkage follows (more restrictive) the host-only rule.

And of course, what a given board supports is controlled by the connectors it has ... A, B, or AB. (Possibly AB plus n*A.) So the driver should probably be able to make sense of having OTG support, but needing to cope with a non-OTG board ... or having an OTG board, a driver that only copes with one role.

Hmmm ... your patches don't include peripheral mode support yet.

Either all these gadget hooks should vanish, or you should try to get the controller mode stuff right from the beginning.

I've appended the relevant Kconfig bits from the musb_hdrc driver, which (despite some glitches) are pretty much correct.

- Dave

Quoted 7 lines

+       depends on (!USB && USB_GADGET) || (!USB_GADGET && USB) || (USB && USB_GADGET) +       default n
+       help
+         The Cypress C67x00 (EZ-Host/EZ-OTG) chips are dual-role
+         host/peripheral USB controllers.

drivers/usb/c67x00/Kconfig new file +1 -0
+

drivers/usb/c67x00/Kconfig line 22

Quoted 10 lines
drivers/usb/c67x00/Kconfig new file +10 -0
+         To compile this driver as a module, choose M here: the
+         module will be called c67x00.
+
+config USB_C67X00_HCD
+       bool "Cypress C67X00 Host support"
+       depends on USB_C67X00_DRV
+       depends on USB
+       default y
+       help
+         This enables the host functionality of the Cypress C67X00.

================
#
# USB Dual Role (OTG-ready) Controller Drivers

# for silicon based on Mentor Graphics INVENTRA designs
#

comment "Enable Host or Gadget support to see Inventra options"

	depends on !USB && USB_GADGET=n

# (M)HDRC = (Multipoint) Highspeed Dual-Role Controller config USB_MUSB_HDRC
depends on USB || USB_GADGET
tristate 'Inventra Highspeed Dual Role Controller (TI, ...)' help
Say Y here if your system has a dual role high speed USB controller based on the Mentor Graphics silicon IP. Then configure options to match your silicon and the board it's being used with, including the USB peripheral role, or the USB host role, or both.

Texas Instruments parts using this IP include DaVinci 644x, OMAP 243x, OMAP 343x, and TUSB 6010.

If you do not know what this is, please say N.

To compile this driver as a module, choose M here; the module will be called "musb_hdrc".

config USB_MUSB_SOC
boolean
depends on USB_MUSB_HDRC
default y if ARCH_DAVINCI
default y if ARCH_OMAP2430
default y if ARCH_OMAP343X
help
Use a static <asm/arch/hdrc_cnf.h> file to describe how the controller is configured (endpoints, mechanisms, etc) on the current iteration of a given system-on-chip.

comment "DaVinci 644x USB support"

	depends on USB_MUSB_HDRC && ARCH_DAVINCI

comment "OMAP 243x high speed USB support"

	depends on USB_MUSB_HDRC && ARCH_OMAP2430

comment "OMAP 343x high speed USB support"

	depends on USB_MUSB_HDRC && ARCH_OMAP343X

config USB_TUSB6010
boolean "TUSB 6010 support"
depends on USB_MUSB_HDRC && !USB_MUSB_SOC
default y
help
The TUSB 6010 chip, from Texas Instruments, connects a discrete HDRC core using a 16-bit parallel bus. It can use system-specific external DMA controllers.

choice
prompt "Driver Mode"
depends on USB_MUSB_HDRC
help
Dual-Role devices can support both host and peripheral roles, as well as a the special "OTG Device" role which can switch between both roles as needed.

# use USB_MUSB_HDRC_HCD not USB_MUSB_HOST to #ifdef host side support;
# OTG needs both roles, not just USB_MUSB_HOST.
config USB_MUSB_HOST
	depends on USB
	bool "USB Host"
	help
	  Say Y here if your system supports the USB host role.
	  If it has a USB "A" (rectangular), "Mini-A" (uncommon),
	  or "Mini-AB" connector, it supports the host role.
	  (With a "Mini-AB" connector, you should enable USB OTG.)
# use USB_GADGET_MUSB_HDRC not USB_MUSB_PERIPHERAL to #ifdef peripheral
# side support ... OTG needs both roles
config USB_MUSB_PERIPHERAL
	depends on USB_GADGET
	bool "USB Peripheral (gadget stack)"
	select USB_GADGET_MUSB_HDRC
	help
	  Say Y here if your system supports the USB peripheral role.
	  If it has a USB "B" (squarish), "Mini-B", or "Mini-AB"
	  connector, it supports the peripheral role.
	  (With a "Mini-AB" connector, you should enable USB OTG.)

config USB_MUSB_OTG
depends on USB && USB_GADGET && EXPERIMENTAL
bool "Both host and peripheral: USB OTG (On The Go) Device" select USB_GADGET_MUSB_HDRC
select USB_OTG
select PM
help
The most notable feature of USB OTG is support for a "Dual-Role" device, which can act as either a device or a host. The initial role choice can be changed later, when two dual-role devices talk to each other.

Select this if your system has a Mini-AB connector, or to simplify certain kinds of configuration.

To implement your OTG Targeted Peripherals List (TPL), enable USB_OTG_WHITELIST and update "drivers/usb/core/otg_whitelist.h" to match your requirements.

endchoice

# enable peripheral support (including with OTG)
config USB_GADGET_MUSB_HDRC
	bool
	depends on USB_MUSB_HDRC && (USB_MUSB_PERIPHERAL || USB_MUSB_OTG)
# enables host support (including with OTG)
config USB_MUSB_HDRC_HCD
	bool
	depends on USB_MUSB_HDRC && (USB_MUSB_HOST || USB_MUSB_OTG)
	select USB_OTG if USB_GADGET_MUSB_HDRC
	default y
#15 lore raw

Re: [PATCH 5/5] USB: Add Cypress c67x00 OTG controller driver to Kconfig and Makefiles

Quoted 8 lines · David Brownell

drivers/usb/c67x00/Kconfig line 6

Quoted 3 lines · Grant Likely
drivers/usb/c67x00/Kconfig new file +3 -0
+config USB_C67X00_DRV
+tristate "Cypress C67x00 support"
+# only allowed to be =y if both USB!=m and USB_GADGET!=m

This is wrong. Remember that since this is a dual-role driver, there are exactly three possible driver modes ... and the driver must support only one of them at a time:

Actually, this part has 2 serial in interface engines; either of which can be in host, peripheral or OTG mode. So; it is entirely relevant for the driver to be doing both host and peripheral at the same time with a single device.

Quoted 13 lines

- Host-only ... only allowed if host side USB is enabled. The controller driver can be statically linked iff usbcore is too.

- Peripheral-only ... only allowed if peripheral side USB is enabled. Only one port may be used as the peripheral; the controller driver can be linked statically or as a module.

- OTG ... only allowed if both host and peripheral side USB are enabled. Only one port can be the OTG port, but other ports can be used for host functionality. Static/modular linkage follows (more restrictive) the host-only rule.

Quoted 7 lines

And of course, what a given board supports is controlled by the connectors it has ... A, B, or AB. (Possibly AB plus n*A.) So the driver should probably be able to make sense of having OTG support, but needing to cope with a non-OTG board ... or having an OTG board, a driver that only copes with one role.

Hmmm ... your patches don't include peripheral mode support yet.

No, nobody has written it yet.

Quoted 6 lines

Either all these gadget hooks should vanish, or you should try to get the controller mode stuff right from the beginning.

I've appended the relevant Kconfig bits from the musb_hdrc driver, which (despite some glitches) are pretty much correct.

I'll drop the gadget hooks for now. Most likely gadget and OTG support will require more changes to this driver regardless, so it's not a big deal.

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#16 lore raw

Re: [PATCH 5/5] USB: Add Cypress c67x00 OTG controller driver to Kconfig and Makefiles

Quoted 10 lines · Grant Likely
Quoted 8 lines · David Brownell

drivers/usb/c67x00/Kconfig line 6

Quoted 3 lines · Grant Likely
drivers/usb/c67x00/Kconfig new file +3 -0
+config USB_C67X00_DRV
+tristate "Cypress C67x00 support"
+# only allowed to be =y if both USB!=m and USB_GADGET!=m

This is wrong. Remember that since this is a dual-role driver, there are exactly three possible driver modes ... and the driver must support only one of them at a time:

Quoted 4 lines

Actually, this part has 2 serial in interface engines; either of which can be in host, peripheral or OTG mode. So; it is entirely relevant for the driver to be doing both host and peripheral at the same time with a single device.

While conforming with USB specs? Has that changed recently?

In the not-too-distant past I know there was explicit language saying that such configurations are not allowed. (At least, in terms of external connectors. A board using USB for internal peripheral connections would be OK.)

Those issues can be deferred until peripheral support exists. At that point you'll need to get better solutions to those config issues...

Quoted 3 lines
Quoted 1 line

Hmmm ... your patches don't include peripheral mode support yet.

No, nobody has written it yet.

Then what's it doing in that GIT tree you pointed me at? :)

Quoted 9 lines
Quoted 5 lines

Either all these gadget hooks should vanish, or you should try to get the controller mode stuff right from the beginning.

I've appended the relevant Kconfig bits from the musb_hdrc driver, which (despite some glitches) are pretty much correct.

I'll drop the gadget hooks for now. Most likely gadget and OTG support will require more changes to this driver regardless, so it's not a big deal.

OK. Then the first incaration of this will be as a host-only driver, in its own directory, and adding peripheral support will cause minor lunacy. :)

- Dave

#17 lore raw

Re: [PATCH 5/5] USB: Add Cypress c67x00 OTG controller driver to Kconfig and Makefiles

Quoted 11 lines · David Brownell
Quoted 10 lines · Grant Likely
Quoted 8 lines · David Brownell

drivers/usb/c67x00/Kconfig line 6

Quoted 3 lines · Grant Likely
drivers/usb/c67x00/Kconfig new file +3 -0
+config USB_C67X00_DRV
+tristate "Cypress C67x00 support"
+# only allowed to be =y if both USB!=m and USB_GADGET!=m

This is wrong. Remember that since this is a dual-role driver, there are exactly three possible driver modes ... and the driver must support only one of them at a time:

Quoted 6 lines
Quoted 4 lines

Actually, this part has 2 serial in interface engines; either of which can be in host, peripheral or OTG mode. So; it is entirely relevant for the driver to be doing both host and peripheral at the same time with a single device.

While conforming with USB specs? Has that changed recently?

Let me rephrase; the silicon implements 2 USB engines with separate pinouts. They can be configured as 2 host controllers; 2 peripheral controllers or 1 of each. They share registers and the IRQ line from the software interface, but they are distinctly separate USB busses.

This driver actually implements 2 sub devices. Each sub device is either bound to the host part of the driver or the gadget part.

Quoted 9 lines

In the not-too-distant past I know there was explicit language saying that such configurations are not allowed. (At least, in terms of external connectors. A board using USB for internal peripheral connections would be OK.)

Those issues can be deferred until peripheral support exists. At that point you'll need to get better solutions to those config issues...

ok

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Hmmm ... your patches don't include peripheral mode support yet.

No, nobody has written it yet.

Then what's it doing in that GIT tree you pointed me at? :)

Sitting there being useless. :-) That driver doesn't actually work; it's just a proof of concept placeholder (which is why I didn't include it in my series)

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

Either all these gadget hooks should vanish, or you should try to get the controller mode stuff right from the beginning.

I've appended the relevant Kconfig bits from the musb_hdrc driver, which (despite some glitches) are pretty much correct.

Quoted 7 lines
Quoted 3 lines

I'll drop the gadget hooks for now. Most likely gadget and OTG support will require more changes to this driver regardless, so it's not a big deal.

OK. Then the first incaration of this will be as a host-only driver, in its own directory, and adding peripheral support will cause minor lunacy. :)

:-)

g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195
#18 lore raw
In reply to Grant Likely
Quoted 3 lines · Grant Likely

This patch series is based on the c67x00 work done by Peter Korsgaard and posted back in April this year.

What's changed since that version? Were the comments sent at that time addressed?

#19 lore raw
Quoted 7 lines · David Brownell
Quoted 3 lines · Grant Likely

This patch series is based on the c67x00 work done by Peter Korsgaard and posted back in April this year.

What's changed since that version? Were the comments sent at that time addressed?

A lot has changes since that version. I'm not sure if all the comments at that time were addressed (as in it's been a while since I've looked at them; I'll go back and take another look).

You can see my progression from Peter's version and my version here:

http://git.secretlab.ca/git/gitweb.cgi?p=linux-2.6-virtex.git;a=shortlog;h=virtex-c67x00-dev

The patches I posted are the consolidation of the series in that git tree.

Cheers,
g.

Signature · 4 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
[email protected]
(403) 399-0195