Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Michael Hennerich and committed by
Greg Kroah-Hartman
9da69c60 331ac6b2

+44 -1
+4
drivers/usb/host/isp1760-hcd.c
··· 386 386 hwmode |= HW_DACK_POL_HIGH; 387 387 if (priv->devflags & ISP1760_FLAG_DREQ_POL_HIGH) 388 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 395 * We have to set this first in case we're in 16-bit mode.
+2
drivers/usb/host/isp1760-hcd.h
··· 142 142 #define ISP1760_FLAG_DACK_POL_HIGH 0x00000010 /* DACK active high */ 143 143 #define ISP1760_FLAG_DREQ_POL_HIGH 0x00000020 /* DREQ active high */ 144 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 148 /* chip memory management */ 147 149 struct memory_chunk {
+20 -1
drivers/usb/host/isp1760-if.c
··· 3 3 * Currently there is support for 4 4 * - OpenFirmware 5 5 * - PCI 6 + * - PDEV (generic platform device centralized driver model) 6 7 * 7 8 * (c) 2007 Sebastian Siewior <bigeasy@linutronix.de> 8 9 * ··· 12 11 #include <linux/usb.h> 13 12 #include <linux/io.h> 14 13 #include <linux/platform_device.h> 14 + #include <linux/usb/isp1760.h> 15 15 16 16 #include "../core/hcd.h" 17 17 #include "isp1760-hcd.h" ··· 310 308 struct resource *mem_res; 311 309 struct resource *irq_res; 312 310 resource_size_t mem_size; 311 + struct isp1760_platform_data *priv = pdev->dev.platform_data; 312 + unsigned int devflags = 0; 313 313 unsigned long irqflags = IRQF_SHARED | IRQF_DISABLED; 314 314 315 315 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ··· 334 330 } 335 331 irqflags |= irq_res->flags & IRQF_TRIGGER_MASK; 336 332 333 + if (priv) { 334 + if (priv->is_isp1761) 335 + devflags |= ISP1760_FLAG_ISP1761; 336 + if (priv->bus_width_16) 337 + devflags |= ISP1760_FLAG_BUS_WIDTH_16; 338 + if (priv->port1_otg) 339 + devflags |= ISP1760_FLAG_OTG_EN; 340 + if (priv->analog_oc) 341 + devflags |= ISP1760_FLAG_ANALOG_OC; 342 + if (priv->dack_polarity_high) 343 + devflags |= ISP1760_FLAG_DACK_POL_HIGH; 344 + if (priv->dreq_polarity_high) 345 + devflags |= ISP1760_FLAG_DREQ_POL_HIGH; 346 + } 347 + 337 348 hcd = isp1760_register(mem_res->start, mem_size, irq_res->start, 338 - irqflags, &pdev->dev, dev_name(&pdev->dev), 0); 349 + irqflags, &pdev->dev, dev_name(&pdev->dev), devflags); 339 350 if (IS_ERR(hcd)) { 340 351 pr_warning("isp1760: Failed to register the HCD device\n"); 341 352 ret = -ENODEV;
+18
include/linux/usb/isp1760.h
··· 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 + 9 + struct 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 */