aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hennerich <michael.hennerich@analog.com>2009-07-15 23:22:54 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:29 -0400
commit9da69c604d87afea37b5411867bb76e3c624cc92 (patch)
treeb22b9a8c7e471633054b3b019411c584473b07c5
parent331ac6b288d9f3689514ced1878041fb0df7e13c (diff)
USB: isp1760: allow platform devices to customize devflags
Platform device support was merged earlier, but support for boards to customize the devflags aspect of the controller was not. We want this on Blackfin systems to control the bus width, but might as well expose all of the fields while we're at it. Signed-off-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/host/isp1760-hcd.c4
-rw-r--r--drivers/usb/host/isp1760-hcd.h2
-rw-r--r--drivers/usb/host/isp1760-if.c21
-rw-r--r--include/linux/usb/isp1760.h18
4 files changed, 44 insertions, 1 deletions
diff --git a/drivers/usb/host/isp1760-hcd.c b/drivers/usb/host/isp1760-hcd.c
index 15438469f21a..9600a58299db 100644
--- a/drivers/usb/host/isp1760-hcd.c
+++ b/drivers/usb/host/isp1760-hcd.c
@@ -386,6 +386,10 @@ static int isp1760_hc_setup(struct usb_hcd *hcd)
386 hwmode |= HW_DACK_POL_HIGH; 386 hwmode |= HW_DACK_POL_HIGH;
387 if (priv->devflags & ISP1760_FLAG_DREQ_POL_HIGH) 387 if (priv->devflags & ISP1760_FLAG_DREQ_POL_HIGH)
388 hwmode |= HW_DREQ_POL_HIGH; 388 hwmode |= HW_DREQ_POL_HIGH;
389 if (priv->devflags & ISP1760_FLAG_INTR_POL_HIGH)
390 hwmode |= HW_INTR_HIGH_ACT;
391 if (priv->devflags & ISP1760_FLAG_INTR_EDGE_TRIG)
392 hwmode |= HW_INTR_EDGE_TRIG;
389 393
390 /* 394 /*
391 * We have to set this first in case we're in 16-bit mode. 395 * We have to set this first in case we're in 16-bit mode.
diff --git a/drivers/usb/host/isp1760-hcd.h b/drivers/usb/host/isp1760-hcd.h
index 462f4943cb1b..6931ef5c9650 100644
--- a/drivers/usb/host/isp1760-hcd.h
+++ b/drivers/usb/host/isp1760-hcd.h
@@ -142,6 +142,8 @@ typedef void (packet_enqueue)(struct usb_hcd *hcd, struct isp1760_qh *qh,
142#define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */ 142#define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */
143#define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */ 143#define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */
144#define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */ 144#define ISP1760_FLAG_ISP1761 0x00000040 /* Chip is ISP1761 */
145#define ISP1760_FLAG_INTR_POL_HIGH 0x00000080 /* Interrupt polarity active high */
146#define ISP1760_FLAG_INTR_EDGE_TRIG 0x00000100 /* Interrupt edge triggered */
145 147
146/* chip memory management */ 148/* chip memory management */
147struct memory_chunk { 149struct memory_chunk {
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c
index d4feebfc63bd..1c9f977a5c9c 100644
--- a/drivers/usb/host/isp1760-if.c
+++ b/drivers/usb/host/isp1760-if.c
@@ -3,6 +3,7 @@
3 * Currently there is support for 3 * Currently there is support for
4 * - OpenFirmware 4 * - OpenFirmware
5 * - PCI 5 * - PCI
6 * - PDEV (generic platform device centralized driver model)
6 * 7 *
7 * (c) 2007 Sebastian Siewior <bigeasy@linutronix.de> 8 * (c) 2007 Sebastian Siewior <bigeasy@linutronix.de>
8 * 9 *
@@ -11,6 +12,7 @@
11#include <linux/usb.h> 12#include <linux/usb.h>
12#include <linux/io.h> 13#include <linux/io.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/usb/isp1760.h>
14 16
15#include "../core/hcd.h" 17#include "../core/hcd.h"
16#include "isp1760-hcd.h" 18#include "isp1760-hcd.h"
@@ -308,6 +310,8 @@ static int __devinit isp1760_plat_probe(struct platform_device *pdev)
308 struct resource *mem_res; 310 struct resource *mem_res;
309 struct resource *irq_res; 311 struct resource *irq_res;
310 resource_size_t mem_size; 312 resource_size_t mem_size;
313 struct isp1760_platform_data *priv = pdev->dev.platform_data;
314 unsigned int devflags = 0;
311 unsigned long irqflags = IRQF_SHARED | IRQF_DISABLED; 315 unsigned long irqflags = IRQF_SHARED | IRQF_DISABLED;
312 316
313 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 317 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -330,8 +334,23 @@ static int __devinit isp1760_plat_probe(struct platform_device *pdev)
330 } 334 }
331 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK; 335 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK;
332 336
337 if (priv) {
338 if (priv->is_isp1761)
339 devflags |= ISP1760_FLAG_ISP1761;
340 if (priv->bus_width_16)
341 devflags |= ISP1760_FLAG_BUS_WIDTH_16;
342 if (priv->port1_otg)
343 devflags |= ISP1760_FLAG_OTG_EN;
344 if (priv->analog_oc)
345 devflags |= ISP1760_FLAG_ANALOG_OC;
346 if (priv->dack_polarity_high)
347 devflags |= ISP1760_FLAG_DACK_POL_HIGH;
348 if (priv->dreq_polarity_high)
349 devflags |= ISP1760_FLAG_DREQ_POL_HIGH;
350 }
351
333 hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, 352 hcd = isp1760_register(mem_res->start, mem_size, irq_res->start,
334 irqflags, &pdev->dev, dev_name(&pdev->dev), 0); 353 irqflags, &pdev->dev, dev_name(&pdev->dev), devflags);
335 if (IS_ERR(hcd)) { 354 if (IS_ERR(hcd)) {
336 pr_warning("isp1760: Failed to register the HCD device\n"); 355 pr_warning("isp1760: Failed to register the HCD device\n");
337 ret = -ENODEV; 356 ret = -ENODEV;
diff --git a/include/linux/usb/isp1760.h b/include/linux/usb/isp1760.h
new file mode 100644
index 000000000000..de7de53c5531
--- /dev/null
+++ b/include/linux/usb/isp1760.h
@@ -0,0 +1,18 @@
1/*
2 * board initialization should put one of these into dev->platform_data
3 * and place the isp1760 onto platform_bus named "isp1760-hcd".
4 */
5
6#ifndef __LINUX_USB_ISP1760_H
7#define __LINUX_USB_ISP1760_H
8
9struct isp1760_platform_data {
10 unsigned is_isp1761:1; /* Chip is ISP1761 */
11 unsigned bus_width_16:1; /* 16/32-bit data bus width */
12 unsigned port1_otg:1; /* Port 1 supports OTG */
13 unsigned analog_oc:1; /* Analog overcurrent */
14 unsigned dack_polarity_high:1; /* DACK active high */
15 unsigned dreq_polarity_high:1; /* DREQ active high */
16};
17
18#endif /* __LINUX_USB_ISP1760_H */