Skip to contentSkip to conversation

USB/ISP1760: Add support for the generic platfrom device centralized driver model (v2)

PATCH In review Bryan Wu 3 participants 3 messages Nov 18, 2008 – Nov 24, 2008 USB

lore
Share & tools
lore

Bryan Wu

author
#0 lore raw

PATCH 1/1 USB/ISP1760: Add support for the generic platfrom device centralized driver model (v2)

From: Michael Hennerich <[email protected]>

v2-v1:
- cleanup style issue
- add Kconfig option CONFIG_USB_ISP1760_PDEV
- isp1760 interrupt is default setup TRIGGER_LOW

---
 drivers/usb/host/Kconfig      |    6 +++
 drivers/usb/host/isp1760-if.c |   95 +++++++++++++++++++++++++++++++++++++++++
 include/linux/usb/isp1760.h   |   19 ++++++++
 3 files changed, 120 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/usb/isp1760.h
drivers/usb/host/Kconfig +6 -0
index 427b3ac..1e38e8a 100644
@@ -123,6 +123,12 @@ config USB_ISP1760_HCD
 	  To compile this driver as a module, choose M here: the
 	  module will be called isp1760.
 
+config USB_ISP1760_PDEV
+	bool "Support for the generic platfrom device driver model"
+	depends on USB_ISP1760_HCD
+	---help---
+	  Enables support for the generic platfrom device centralized driver model
+
 config USB_ISP1362_HCD
 	tristate "ISP1362 HCD support"
 	depends on USB
drivers/usb/host/isp1760-if.c +95 -0

125 lines not on this page · raw message

include/linux/usb/isp1760.h new file +19 -0
new file mode 100644
index 0000000..74ffbce
@@ -0,0 +1,19 @@
+/*
+ * board initialization should put one of these into dev->platform_data
+ * and place the isp1760 onto platform_bus named "isp1760-hcd".
+ */
+
+#ifndef __LINUX_USB_ISP1760_H
+#define __LINUX_USB_ISP1760_H
+
+struct isp1760_platform_data {
+	unsigned is_isp1761:1;			/* Chip is ISP1761 */
+	unsigned port1_disable:1;		/* Port 1 disabled */
+	unsigned bus_width_16:1;		/* 16/32-bit data bus width */
+	unsigned port1_otg:1;			/* Port 1 supports OTG */
+	unsigned analog_oc:1;			/* Analog overcurrent */
+	unsigned dack_polarity_high:1;		/* DACK active high */
+	unsigned dreq_polarity_high:1;		/* DREQ active high */
+};
+
+#endif /* __LINUX_USB_ISP1760_H */
Signature · 1 line
1.5.6.3
#1 lore raw
Quoted 6 lines · Bryan Wu

From: Michael Hennerich <[email protected]>

v2-v1:
- cleanup style issue
- add Kconfig option CONFIG_USB_ISP1760_PDEV
- isp1760 interrupt is default setup TRIGGER_LOW

Trigger low should be fine.

Quoted 15 lines
---
 drivers/usb/host/Kconfig      |    6 +++
 drivers/usb/host/isp1760-if.c |   95 +++++++++++++++++++++++++++++++++++++++++
 include/linux/usb/isp1760.h   |   19 ++++++++
 3 files changed, 120 insertions(+), 0 deletions(-)
 create mode 100644 include/linux/usb/isp1760.h
drivers/usb/host/Kconfig +0 -0
index 427b3ac..1e38e8a 100644

drivers/usb/host/Kconfig config USB_ISP1760_HCD · line 131

Quoted 9 lines
drivers/usb/host/Kconfig +6 -0
@@ -123,6 +123,12 @@ config USB_ISP1760_HCD
 	  To compile this driver as a module, choose M here: the
 	  module will be called isp1760.
 
+config USB_ISP1760_PDEV
+	bool "Support for the generic platfrom device driver model"
+	depends on USB_ISP1760_HCD
+	---help---
+	  Enables support for the generic platfrom device centralized driver model
+

This is probably a misunderstanding. In the previous email I was refering the patch [1] which removes the Kconfig entries and makes it unconditional. Since platform device are always available we can get rid of depend on PCI || OF in Kconfig and depend just on USB same like isp116x does. The patch I am refering to is mainline so this won't apply, sorry. I'm fine with the other parts of the patch.

[1] http://marc.info/?l=linux-usb&m=122563596420156&w=2

Sebastian

#2 lore raw
In reply to Bryan Wu

Bryan Wu <[email protected]>

drivers/usb/host/isp1760-if.c static struct pci_driver isp1761_pci_driver = { · line 342

Quoted 8 lines · writes:

- isp1760 interrupt is default setup TRIGGER_LOW
...

drivers/usb/host/isp1760-if.c +5 -0
+	irq = platform_get_irq(pdev, 0);
...
+	hcd = isp1760_register(addr->start, resource_size(addr), irq,
+		IRQF_DISABLED | IRQF_SHARED | IRQF_TRIGGER_LOW,
+		&pdev->dev, dev_name(&pdev->dev),
+		devflags);

TRIGGER_LOW default is bad on e.g. XScale platforms which have edge triggered interrupts. It would be better to use the resource flags for interrupt configuration. E.g.

----

	struct resource				*irq_res;
        unsigned long                           flags;

	irq_res  = platform_get_resource(pdev, IORESOURCE_IRQ, 0);

        flags = ((irq_res->flags & IRQF_TRIGGER_MASK) |
                 ((irq_res->flags & IORESOURCE_IRQ_SHAREABLE) ?
                 IRQF_SHARED : 0));

        if ((irq_res->flags & (IORESOURCE_IRQ_HIGHEDGE|IORESOURCE_IRQ_LOWEDGE)))
		dev_flags |= ISP1760_FLAG_INTR_EDGE_TRIG;

hcd = isp1760_register(addr->start, resource_size(addr), irq,
IRQF_DISABLED | flags,
&pdev->dev, dev_name(&pdev->dev), devflags);
----

Enrico