[PATCH] usb: renesas_usbhs: use devm_request_irq()
This patch uses devm_request_irq() instead of request_irq(), and removed free_irq() from driver Signed-off-by: Kuninori Morimoto kuninori.morimoto...@renesas.com --- drivers/usb/renesas_usbhs/mod.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/renesas_usbhs/mod.c b/drivers/usb/renesas_usbhs/mod.c index 35c5208..2672487 100644 --- a/drivers/usb/renesas_usbhs/mod.c +++ b/drivers/usb/renesas_usbhs/mod.c @@ -151,7 +151,7 @@ int usbhs_mod_probe(struct usbhs_priv *priv) goto mod_init_host_err; /* irq settings */ - ret = request_irq(priv-irq, usbhs_interrupt, + ret = devm_request_irq(dev, priv-irq, usbhs_interrupt, priv-irqflags, dev_name(dev), priv); if (ret) { dev_err(dev, irq request err\n); @@ -172,7 +172,6 @@ void usbhs_mod_remove(struct usbhs_priv *priv) { usbhs_mod_host_remove(priv); usbhs_mod_gadget_remove(priv); - free_irq(priv-irq, priv); } /* -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Mouse and keyboard freeze on Ivy Bridge platform
Hi, I am encountering random keyboard and mouse freezes which can only be resolved by a hard reset (by pushing the power switch of the computer case). I have this frequent and irritating issue with two differents Ivy Bridge platforms: 1. Processor: Intel Core i5 3450 (IGP HD 2500) Motherboard: MSI Z77A-G43 (with uptodate BIOS) 2. Processor: Intel Core i5 3570K (IGP HD 4000) Motherboard: ASUS P8Z77-V LX (with uptodate BIOS) I use Debian on these platforms and I tried several Linux kernels: * linux-image-3.2.0-3-amd64 (package from Debian testing) * linux-image-3.4-trunk-amd64 (package from Debian experimental) * linux-image-3.5-trunk-amd64 (package from Debian experimental) I pointed out this bug to the Debian kernel team: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689368 The mouse and keyboard are both USB devices and it seems that the bug is coming from the echci-hcd module: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689368#24 I attached the dmesg output and the kern.log file to my first message to Debian: * http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=35;filename=dmesg.20121001-231244;att=1;bug=689268 * http://bugs.debian.org/cgi-bin/bugreport.cgi?msg=35;filename=kern.log.20121001-232320.gz;att=2;bug=689268 As mentioned to the Debian maintainers, this bug is very frequent (I had up to four freezes in an hour) and my PC are really unusable! Can I run additional tests or give you additional informations to help you resolve this painful bug? Sebastien -- Sébastien Dinot, sebastien.di...@free.fr http://sebastien.dinot.free.fr/ Ne goûtez pas au logiciel libre, vous ne pourriez plus vous en passer ! -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/7] usb: core: reuse kbasename()
On Tue, Oct 2, 2012 at 6:00 PM, Andy Shevchenko andriy.shevche...@linux.intel.com wrote: --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c @@ -200,14 +200,9 @@ int usb_register_dev(struct usb_interface *intf, /* create a usb class device for this usb interface */ snprintf(name, sizeof(name), class_driver-name, minor - minor_base); - temp = strrchr(name, '/'); - if (temp (temp[1] != '\0')) I have checked current linux-next, the drivers define .name in the usb_class_driver structure as '...%d'. So, what is the reason to check for trailing '/' here? Historical reasons or there is a (broken/3rd party/etc) driver with it? - ++temp; - else - temp = name; intf-usb_dev = device_create(usb_class-class, intf-dev, MKDEV(USB_MAJOR, minor), class_driver, - %s, temp); + %s, kbasename(name)); -- With Best Regards, Andy Shevchenko -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/5] usb: phy: samsung: Introducing usb phy driver for hsotg
From v6: Added TODO for phy bindings with controller Dropped platform_set_drvdata() from driver probe This driver uses usb_phy interface to interact with s3c-hsotg. Supports phy_init and phy_shutdown functions to enable/disable phy. Tested with smdk6410 and smdkv310. More SoCs can be brought under later. Signed-off-by: Praveen Paneri p.pan...@samsung.com Acked-by: Heiko Stuebner he...@sntech.de --- .../devicetree/bindings/usb/samsung-usbphy.txt | 11 + drivers/usb/phy/Kconfig|8 + drivers/usb/phy/Makefile |1 + drivers/usb/phy/samsung-usbphy.c | 355 include/linux/platform_data/samsung-usbphy.h | 27 ++ 5 files changed, 402 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/usb/samsung-usbphy.txt create mode 100644 drivers/usb/phy/samsung-usbphy.c create mode 100644 include/linux/platform_data/samsung-usbphy.h diff --git a/Documentation/devicetree/bindings/usb/samsung-usbphy.txt b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt new file mode 100644 index 000..7d54d59 --- /dev/null +++ b/Documentation/devicetree/bindings/usb/samsung-usbphy.txt @@ -0,0 +1,11 @@ +* Samsung's usb phy transceiver + +The Samsung's phy transceiver is used for controlling usb otg phy for +s3c-hsotg usb device controller. +TODO: Adding the PHY binding with controller(s) according to the under +developement generic PHY driver. + +Required properties: +- compatible : should be samsung,exynos4210-usbphy +- reg : base physical address of the phy registers and length of memory mapped + region. diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index 63c339b..313685f 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -32,3 +32,11 @@ config MV_U3D_PHY help Enable this to support Marvell USB 3.0 phy controller for Marvell SoC. + +config SAMSUNG_USBPHY + bool Samsung USB PHY controller Driver + depends on USB_S3C_HSOTG + select USB_OTG_UTILS + help + Enable this to support Samsung USB phy controller for samsung + SoCs. diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index b069f29..55dcfc1 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -8,3 +8,4 @@ obj-$(CONFIG_OMAP_USB2) += omap-usb2.o obj-$(CONFIG_USB_ISP1301) += isp1301.o obj-$(CONFIG_MV_U3D_PHY) += mv_u3d_phy.o obj-$(CONFIG_USB_EHCI_TEGRA) += tegra_usb_phy.o +obj-$(CONFIG_SAMSUNG_USBPHY) += samsung-usbphy.o diff --git a/drivers/usb/phy/samsung-usbphy.c b/drivers/usb/phy/samsung-usbphy.c new file mode 100644 index 000..ee2dee0 --- /dev/null +++ b/drivers/usb/phy/samsung-usbphy.c @@ -0,0 +1,355 @@ +/* linux/drivers/usb/phy/samsung-usbphy.c + * + * Copyright (c) 2012 Samsung Electronics Co., Ltd. + * http://www.samsung.com + * + * Author: Praveen Paneri p.pan...@samsung.com + * + * Samsung USB2.0 High-speed OTG transceiver, talks to S3C HS OTG controller + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * 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. + */ + +#include linux/module.h +#include linux/platform_device.h +#include linux/clk.h +#include linux/delay.h +#include linux/err.h +#include linux/io.h +#include linux/of.h +#include linux/usb/otg.h +#include linux/platform_data/samsung-usbphy.h + +/* Register definitions */ + +#define S3C_PHYPWR (0x00) + +#define S3C_PHYPWR_NORMAL_MASK (0x19 0) +#define S3C_PHYPWR_OTG_DISABLE (1 4) +#define S3C_PHYPWR_ANALOG_POWERDOWN(1 3) +#define S3C_PHYPWR_FORCE_SUSPEND (1 1) +/* For Exynos4 */ +#define EXYNOS4_PHYPWR_NORMAL_MASK (0x39 0) +#define EXYNOS4_PHYPWR_SLEEP (1 5) + +#define S3C_PHYCLK (0x04) + +#define S3C_PHYCLK_MODE_SERIAL (1 6) +#define S3C_PHYCLK_EXT_OSC (1 5) +#define S3C_PHYCLK_COMMON_ON_N (1 4) +#define S3C_PHYCLK_ID_PULL (1 2) +#define S3C_PHYCLK_CLKSEL_MASK (0x3 0) +#define S3C_PHYCLK_CLKSEL_SHIFT(0) +#define S3C_PHYCLK_CLKSEL_48M (0x0 0) +#define S3C_PHYCLK_CLKSEL_12M (0x2 0) +#define S3C_PHYCLK_CLKSEL_24M (0x3 0) + +#define S3C_RSTCON (0x08) + +#define S3C_RSTCON_PHYCLK (1 2) +#define S3C_RSTCON_HCLK(1 1)
Re: [RFT] usb: Fix TX errors on devices with unsupported LPM states.
On Tue, Oct 02, 2012 at 02:42:41PM -0700, Sarah Sharp wrote: USB 3.0 devices are required to support Link PM. However, some of them don't support U1, or don't support U2, or don't support either. There is no way in the USB 3.0 specification to say that a device doesn't support U1 or U2, so these devices set the U1 or U2 exit latency to the maximum possible values (10ms for U1, 2047ms for U2). It still failed for me. :-( Can you send me the `sudo lsusb -v` output for the device? Also, please see if you can get a new cable and retest. I attached the lsusb -v output (had to use another usb3 controller to obtain it). I can't really use another cable because it comes with its own usb3 mini cable. All the other usb3 cables I have are the normal sized ones (with the fatter end). Cheers, Don Bus 006 Device 002: ID 1058:0730 Western Digital Technologies, Inc. Device Descriptor: bLength18 bDescriptorType 1 bcdUSB 3.00 bDeviceClass0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 9 idVendor 0x1058 Western Digital Technologies, Inc. idProduct 0x0730 bcdDevice 10.16 iManufacturer 1 Western Digital iProduct2 My Passport 0730 iSerial 3 575837314132314434373235 bNumConfigurations 1 Configuration Descriptor: bLength 9 bDescriptorType 2 wTotalLength 44 bNumInterfaces 1 bConfigurationValue 1 iConfiguration 0 bmAttributes 0x80 (Bus Powered) MaxPower 224mA Interface Descriptor: bLength 9 bDescriptorType 4 bInterfaceNumber0 bAlternateSetting 0 bNumEndpoints 2 bInterfaceClass 8 Mass Storage bInterfaceSubClass 6 SCSI bInterfaceProtocol 80 Bulk-Only iInterface 0 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x84 EP 4 IN bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Endpoint Descriptor: bLength 7 bDescriptorType 5 bEndpointAddress 0x03 EP 3 OUT bmAttributes2 Transfer TypeBulk Synch Type None Usage Type Data wMaxPacketSize 0x0400 1x 1024 bytes bInterval 0 bMaxBurst 15 Binary Object Store Descriptor: bLength 5 bDescriptorType15 wTotalLength 22 bNumDeviceCaps 2 SuperSpeed USB Device Capability: bLength10 bDescriptorType16 bDevCapabilityType 3 bmAttributes 0x00 Latency Tolerance Messages (LTM) Supported wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 1 Lowest fully-functional device speed is Full Speed (12Mbps) bU1DevExitLat 0 micro seconds bU2DevExitLat 0 micro seconds USB 2.0 Extension Device Capability: bLength 7 bDescriptorType16 bDevCapabilityType 2 bmAttributes 0x0002 Link Power Management (LPM) Supported Device Status: 0x0002 (Bus Powered) Remote Wakeup Enabled -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] umc-bus.c: fix usage of device_trylock
Hi all. I've probably found a wrong usage of device_trylock inside the driver umc-bus.c: device_trylock has the same semantics of mutex_trylock, so it returns 1 if the lock has been acquired successfully. Please, find below a patch. Best regards, Claudio Subject: umc-bus.c: fix usage of device_trylock From: Claudio Scordino clau...@evidence.eu.com device_trylock has the same semantics of mutex_trylock, so it returns 1 if the lock has been acquired successfully. Signed-off-by: Claudio Scordino clau...@evidence.eu.com --- drivers/uwb/umc-bus.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/uwb/umc-bus.c b/drivers/uwb/umc-bus.c index 82a84d5..5c5b3fc 100644 --- a/drivers/uwb/umc-bus.c +++ b/drivers/uwb/umc-bus.c @@ -63,7 +63,7 @@ int umc_controller_reset(struct umc_dev *umc) struct device *parent = umc-dev.parent; int ret = 0; - if (device_trylock(parent)) + if (!device_trylock(parent)) return -EAGAIN; ret = device_for_each_child(parent, parent, umc_bus_pre_reset_helper); if (ret = 0) -- 1.7.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/7] usb: core: reuse kbasename()
On Wed, Oct 03, 2012 at 11:27:27AM +0300, Andy Shevchenko wrote: On Tue, Oct 2, 2012 at 6:00 PM, Andy Shevchenko andriy.shevche...@linux.intel.com wrote: --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c @@ -200,14 +200,9 @@ int usb_register_dev(struct usb_interface *intf, /* create a usb class device for this usb interface */ snprintf(name, sizeof(name), class_driver-name, minor - minor_base); - temp = strrchr(name, '/'); - if (temp (temp[1] != '\0')) I have checked current linux-next, the drivers define .name in the usb_class_driver structure as '...%d'. So, what is the reason to check for trailing '/' here? Historical reasons or there is a (broken/3rd party/etc) driver with it? I really do not remember why it was done this way, sorry. I have no problem not doing it anymore, as long as you are willing to fix any potential bugs that might pop up :) And no, I don't worry about 3rd party drivers, that shouldn't be an issue at all here. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Linux xHCI driver problems (reset ep)
On Tue, 2 Oct 2012, Yuliya T wrote: Our device goes through a software-directed firmware reset which clears the device-side toggle bits (or sequence numbers). The endpoint is not halted though. Therefore, we want a clean way to reset the toggle bits (or sequence numbers) on the host without having to reconnect to the device. For USB2 (EHCI) we have always related on ClearFeature(ENDPOINT_HALT). Do you have any suggestions, or for the sake of interoperability and consistency, do you think it might be a good idea to just pass the reset ep command down to the hardware and let it decide what to do? How about doing a Set-Interface or Set-Configuration instead? Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 04/25] MIPS: Netlogic: use ehci-platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/netlogic/xlr/platform.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index 71b44d8..1731dfd 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c @@ -15,6 +15,7 @@ #include linux/serial_8250.h #include linux/serial_reg.h #include linux/i2c.h +#include linux/usb/ehci_pdriver.h #include asm/netlogic/haldefs.h #include asm/netlogic/xlr/iomap.h @@ -123,6 +124,10 @@ static u64 xls_usb_dmamask = ~(u32)0; }, \ } +static struct usb_ehci_pdata xls_usb_ehci_pdata = { + .caps_offset= 0, +}; + static struct platform_device xls_usb_ehci_device = USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ); static struct platform_device xls_usb_ohci_device_0 = @@ -172,6 +177,7 @@ int xls_platform_usb_init(void) memres = CPHYSADDR((unsigned long)usb_mmio); xls_usb_ehci_device.resource[0].start = memres; xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1; + xls_usb_ehci_device.dev.platform_data = xls_usb_ehci_pdata; memres += 0x400; xls_usb_ohci_device_0.resource[0].start = memres; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 20/25] MIPS: Netlogic: convert to use OHCI platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/netlogic/xlr/platform.c |5 + 1 file changed, 5 insertions(+) diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index 320b7ef..755ddcc 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c @@ -16,6 +16,7 @@ #include linux/serial_reg.h #include linux/i2c.h #include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/netlogic/haldefs.h #include asm/netlogic/xlr/iomap.h @@ -129,6 +130,8 @@ static struct usb_ehci_pdata xls_usb_ehci_pdata = { .need_io_watchdog = 1, }; +static struct usb_ohci_pdata xls_usb_ohci_pdata; + static struct platform_device xls_usb_ehci_device = USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ); static struct platform_device xls_usb_ohci_device_0 = @@ -183,10 +186,12 @@ int xls_platform_usb_init(void) memres += 0x400; xls_usb_ohci_device_0.resource[0].start = memres; xls_usb_ohci_device_0.resource[0].end = memres + 0x400 - 1; + xls_usb_ohci_device_0.dev.platform_data = xls_usb_ohci_pdata; memres += 0x400; xls_usb_ohci_device_1.resource[0].start = memres; xls_usb_ohci_device_1.resource[0].end = memres + 0x400 - 1; + xls_usb_ohci_device_1.dev.platform_data = xls_usb_ohci_pdata; return platform_add_devices(xls_platform_devices, ARRAY_SIZE(xls_platform_devices)); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 17/25] USB: ohci: remove CNS3xxx OHCI platform driver
All users have been converted to use the OHCI platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/Kconfig|6 +- drivers/usb/host/ohci-cns3xxx.c | 166 --- drivers/usb/host/ohci-hcd.c |5 -- 3 files changed, 5 insertions(+), 172 deletions(-) delete mode 100644 drivers/usb/host/ohci-cns3xxx.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 0754dd1..3742f73 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -410,9 +410,13 @@ config USB_OHCI_EXYNOS Enable support for the Samsung Exynos SOC's on-chip OHCI controller. config USB_CNS3XXX_OHCI - bool Cavium CNS3XXX OHCI Module + bool Cavium CNS3XXX OHCI Module (DEPRECATED) depends on USB_OHCI_HCD ARCH_CNS3XXX + select USB_OHCI_HCD_PLATFORM ---help--- + This option is deprecated now and the driver was removed, use + USB_OHCI_HCD_PLATFORM instead. + Enable support for the CNS3XXX SOC's on-chip OHCI controller. It is needed for low-speed USB 1.0 device support. diff --git a/drivers/usb/host/ohci-cns3xxx.c b/drivers/usb/host/ohci-cns3xxx.c deleted file mode 100644 index 2c9f233..000 --- a/drivers/usb/host/ohci-cns3xxx.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2008 Cavium Networks - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, Version 2, as - * published by the Free Software Foundation. - */ - -#include linux/platform_device.h -#include linux/atomic.h -#include mach/cns3xxx.h -#include mach/pm.h - -static int __devinit -cns3xxx_ohci_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int ret; - - /* -* EHCI and OHCI share the same clock and power, -* resetting twice would cause the 1st controller been reset. -* Therefore only do power up at the first up device, and -* power down at the last down device. -* -* Set USB AHB INCR length to 16 -*/ - if (atomic_inc_return(usb_pwr_ref) == 1) { - cns3xxx_pwr_power_up(1 PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB); - cns3xxx_pwr_clk_en(1 PM_CLK_GATE_REG_OFFSET_USB_HOST); - cns3xxx_pwr_soft_rst(1 PM_SOFT_RST_REG_OFFST_USB_HOST); - __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 24)), - MISC_CHIP_CONFIG_REG); - } - - ret = ohci_init(ohci); - if (ret 0) - return ret; - - ohci-num_ports = 1; - - ret = ohci_run(ohci); - if (ret 0) { - dev_err(hcd-self.controller, can't start %s\n, - hcd-self.bus_name); - ohci_stop(hcd); - return ret; - } - return 0; -} - -static const struct hc_driver cns3xxx_ohci_hc_driver = { - .description= hcd_name, - .product_desc = CNS3XXX OHCI Host controller, - .hcd_priv_size = sizeof(struct ohci_hcd), - .irq= ohci_irq, - .flags = HCD_USB11 | HCD_MEMORY, - .start = cns3xxx_ohci_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - .urb_enqueue= ohci_urb_enqueue, - .urb_dequeue= ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - .get_frame_number = ohci_get_frame, - .hub_status_data= ohci_hub_status_data, - .hub_control= ohci_hub_control, -#ifdef CONFIG_PM - .bus_suspend= ohci_bus_suspend, - .bus_resume = ohci_bus_resume, -#endif - .start_port_reset = ohci_start_port_reset, -}; - -static int cns3xxx_ohci_probe(struct platform_device *pdev) -{ - struct device *dev = pdev-dev; - struct usb_hcd *hcd; - const struct hc_driver *driver = cns3xxx_ohci_hc_driver; - struct resource *res; - int irq; - int retval; - - if (usb_disabled()) - return -ENODEV; - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(dev, Found HC with no IRQ.\n); - return -ENODEV; - } - irq = res-start; - - hcd = usb_create_hcd(driver, dev, dev_name(dev)); - if (!hcd) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, Found HC with no register addr.\n); - retval = -ENODEV; - goto err1; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, - driver-description)) { - dev_dbg(dev, controller
[PATCH 23/25] USB: ohci: remove OHCI SH platform driver
All users have been converted to use the OHCI platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/Kconfig|6 +- drivers/usb/host/ohci-hcd.c |5 -- drivers/usb/host/ohci-sh.c | 141 --- 3 files changed, 5 insertions(+), 147 deletions(-) delete mode 100644 drivers/usb/host/ohci-sh.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index e9c277b..437533e 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -397,9 +397,13 @@ config USB_OHCI_HCD_SSB If unsure, say N. config USB_OHCI_SH - bool OHCI support for SuperH USB controller + bool OHCI support for SuperH USB controller (DEPRECATED) depends on USB_OHCI_HCD SUPERH + select USB_OHCI_HCD_PLATFORM ---help--- + This option is deprecated now and the driver was removed, use + USB_OHCI_HCD_PLATFORM instead. + Enables support for the on-chip OHCI controller on the SuperH. If you use the PCI OHCI controller, this option is not necessary. diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 2cafe98..028f60d 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1054,11 +1054,6 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERohci_hcd_da8xx_driver #endif -#ifdef CONFIG_USB_OHCI_SH -#include ohci-sh.c -#define PLATFORM_DRIVERohci_hcd_sh_driver -#endif - #ifdef CONFIG_USB_OHCI_HCD_PPC_OF #include ohci-ppc-of.c diff --git a/drivers/usb/host/ohci-sh.c b/drivers/usb/host/ohci-sh.c deleted file mode 100644 index 76a20c2..000 --- a/drivers/usb/host/ohci-sh.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * OHCI HCD (Host Controller Driver) for USB. - * - * Copyright (C) 2008 Renesas Solutions Corp. - * - * Author : Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com - * - * 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; version 2 of the License. - * - * 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 St, Fifth Floor, Boston, MA 02110-1301 USA - * - */ - -#include linux/platform_device.h - -static int ohci_sh_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - - ohci_hcd_init(ohci); - ohci_init(ohci); - ohci_run(ohci); - return 0; -} - -static const struct hc_driver ohci_sh_hc_driver = { - .description = hcd_name, - .product_desc = SuperH OHCI, - .hcd_priv_size =sizeof(struct ohci_hcd), - - /* -* generic hardware linkage -*/ - .irq = ohci_irq, - .flags =HCD_USB11 | HCD_MEMORY, - - /* -* basic lifecycle operations -*/ - .start =ohci_sh_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - - /* -* managing i/o requests and associated device resources -*/ - .urb_enqueue = ohci_urb_enqueue, - .urb_dequeue = ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - - /* -* scheduling support -*/ - .get_frame_number = ohci_get_frame, - - /* -* root hub support -*/ - .hub_status_data = ohci_hub_status_data, - .hub_control = ohci_hub_control, -#ifdef CONFIG_PM - .bus_suspend = ohci_bus_suspend, - .bus_resume = ohci_bus_resume, -#endif - .start_port_reset = ohci_start_port_reset, -}; - -/*-*/ - -static int ohci_hcd_sh_probe(struct platform_device *pdev) -{ - struct resource *res = NULL; - struct usb_hcd *hcd = NULL; - int irq = -1; - int ret; - - if (usb_disabled()) - return -ENODEV; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, platform_get_resource error.\n); - return -ENODEV; - } - - irq = platform_get_irq(pdev, 0); - if (irq 0) { - dev_err(pdev-dev, platform_get_irq error.\n); - return -ENODEV; - } - - /* initialize hcd */ - hcd = usb_create_hcd(ohci_sh_hc_driver, pdev-dev, (char *)hcd_name); - if (!hcd) { - dev_err(pdev-dev, Failed to create hcd\n); -
[PATCH 08/25] USB: ehci: remove Alchemy EHCI driver
The platform code has been converted to use the ehci-platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ehci-au1xxx.c | 184 drivers/usb/host/ehci-hcd.c|5 -- 2 files changed, 189 deletions(-) delete mode 100644 drivers/usb/host/ehci-au1xxx.c diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c deleted file mode 100644 index 65c945e..000 --- a/drivers/usb/host/ehci-au1xxx.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * EHCI HCD (Host Controller Driver) for USB. - * - * Bus Glue for AMD Alchemy Au1xxx - * - * Based on ohci-au1xxx.c by Matt Porter mpor...@kernel.crashing.org - * - * Modified for AMD Alchemy Au1200 EHC - * by K.Boge karsten.b...@amd.com - * - * This file is licenced under the GPL. - */ - -#include linux/platform_device.h -#include asm/mach-au1x00/au1000.h - - -extern int usb_disabled(void); - -static int au1xxx_ehci_setup(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - int ret; - - ehci-caps = hcd-regs; - ret = ehci_setup(hcd); - - ehci-need_io_watchdog = 0; - return ret; -} - -static const struct hc_driver ehci_au1xxx_hc_driver = { - .description= hcd_name, - .product_desc = Au1xxx EHCI, - .hcd_priv_size = sizeof(struct ehci_hcd), - - /* -* generic hardware linkage -*/ - .irq= ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - - /* -* basic lifecycle operations -* -* FIXME -- ehci_init() doesn't do enough here. -* See ehci-ppc-soc for a complete implementation. -*/ - .reset = au1xxx_ehci_setup, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - - /* -* managing i/o requests and associated device resources -*/ - .urb_enqueue= ehci_urb_enqueue, - .urb_dequeue= ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - - /* -* scheduling support -*/ - .get_frame_number = ehci_get_frame, - - /* -* root hub support -*/ - .hub_status_data= ehci_hub_status_data, - .hub_control= ehci_hub_control, - .bus_suspend= ehci_bus_suspend, - .bus_resume = ehci_bus_resume, - .relinquish_port= ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) -{ - struct usb_hcd *hcd; - struct resource *res; - int ret; - - if (usb_disabled()) - return -ENODEV; - - if (pdev-resource[1].flags != IORESOURCE_IRQ) { - pr_debug(resource[1] is not IORESOURCE_IRQ); - return -ENOMEM; - } - hcd = usb_create_hcd(ehci_au1xxx_hc_driver, pdev-dev, Au1xxx); - if (!hcd) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - hcd-regs = devm_request_and_ioremap(pdev-dev, res); - if (!hcd-regs) { - pr_debug(devm_request_and_ioremap failed); - ret = -ENOMEM; - goto err1; - } - - if (alchemy_usb_control(ALCHEMY_USB_EHCI0, 1)) { - printk(KERN_INFO %s: controller init failed!\n, pdev-name); - ret = -ENODEV; - goto err1; - } - - ret = usb_add_hcd(hcd, pdev-resource[1].start, - IRQF_SHARED); - if (ret == 0) { - platform_set_drvdata(pdev, hcd); - return ret; - } - - alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); -err1: - usb_put_hcd(hcd); - return ret; -} - -static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - - usb_remove_hcd(hcd); - alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); - usb_put_hcd(hcd); - platform_set_drvdata(pdev, NULL); - - return 0; -} - -#ifdef CONFIG_PM -static int ehci_hcd_au1xxx_drv_suspend(struct device *dev) -{ - struct usb_hcd *hcd = dev_get_drvdata(dev); - bool do_wakeup = device_may_wakeup(dev); - int rc; - - rc = ehci_suspend(hcd, do_wakeup); - alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); - - return rc; -} - -static int ehci_hcd_au1xxx_drv_resume(struct device *dev) -{ - struct usb_hcd *hcd = dev_get_drvdata(dev); - - alchemy_usb_control(ALCHEMY_USB_EHCI0, 1); - ehci_resume(hcd,
[PATCH 15/25] USB: ohci: remove PNX8550 OHCI driver
The users have been converted to use the platform OHCI driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ohci-hcd.c |5 - drivers/usb/host/ohci-pnx8550.c | 243 --- 2 files changed, 248 deletions(-) delete mode 100644 drivers/usb/host/ohci-pnx8550.c diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 2b1e8d8..17ed0a8 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1034,11 +1034,6 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERohci_hcd_au1xxx_driver #endif -#ifdef CONFIG_PNX8550 -#include ohci-pnx8550.c -#define PLATFORM_DRIVERohci_hcd_pnx8550_driver -#endif - #ifdef CONFIG_USB_OHCI_HCD_PPC_SOC #include ohci-ppc-soc.c #define PLATFORM_DRIVERohci_hcd_ppc_soc_driver diff --git a/drivers/usb/host/ohci-pnx8550.c b/drivers/usb/host/ohci-pnx8550.c deleted file mode 100644 index 148d27d..000 --- a/drivers/usb/host/ohci-pnx8550.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * OHCI HCD (Host Controller Driver) for USB. - * - * (C) Copyright 1999 Roman Weissgaerber wei...@vienna.at - * (C) Copyright 2000-2002 David Brownell dbrown...@users.sourceforge.net - * (C) Copyright 2002 Hewlett-Packard Company - * (C) Copyright 2005 Embedded Alley Solutions, Inc. - * - * Bus Glue for PNX8550 - * - * Written by Christopher Hoover c...@hpl.hp.com - * Based on fragments of previous driver by Russell King et al. - * - * Modified for LH7A404 from ohci-sa.c - * by Durgesh Pattamatta pattamat...@sharpsec.com - * - * Modified for PNX8550 from ohci-sa.c and sa-omap.c - * by Vitaly Wool vitalyw...@gmail.com - * - * This file is licenced under the GPL. - */ - -#include linux/device.h -#include linux/platform_device.h -#include asm/mach-pnx8550/usb.h -#include asm/mach-pnx8550/int.h -#include asm/mach-pnx8550/pci.h - -#ifndef CONFIG_PNX8550 -#error This file is PNX8550 bus glue. CONFIG_PNX8550 must be defined. -#endif - -extern int usb_disabled(void); - -/*-*/ - -static void pnx8550_start_hc(struct platform_device *dev) -{ - /* -* Set register CLK48CTL to enable and 48MHz -*/ - outl(0x0003, PCI_BASE | 0x0004770c); - - /* -* Set register CLK12CTL to enable and 48MHz -*/ - outl(0x0003, PCI_BASE | 0x00047710); - - udelay(100); -} - -static void pnx8550_stop_hc(struct platform_device *dev) -{ - udelay(10); -} - - -/*-*/ - -/* configure so an HC device and id are always provided */ -/* always called with process context; sleeping is OK */ - - -/** - * usb_hcd_pnx8550_probe - initialize pnx8550-based HCDs - * Context: !in_interrupt() - * - * Allocates basic resources for this USB host controller, and - * then invokes the start() method for the HCD associated with it - * through the hotplug entry's driver_data. - * - */ -int usb_hcd_pnx8550_probe (const struct hc_driver *driver, - struct platform_device *dev) -{ - int retval; - struct usb_hcd *hcd; - - if (dev-resource[0].flags != IORESOURCE_MEM || - dev-resource[1].flags != IORESOURCE_IRQ) { - dev_err (dev-dev,invalid resource type\n); - return -ENOMEM; - } - - hcd = usb_create_hcd (driver, dev-dev, pnx8550); - if (!hcd) - return -ENOMEM; - hcd-rsrc_start = dev-resource[0].start; - hcd-rsrc_len = dev-resource[0].end - dev-resource[0].start + 1; - - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) { - dev_err(dev-dev, request_mem_region [0x%08llx, 0x%08llx] - failed\n, hcd-rsrc_start, hcd-rsrc_len); - retval = -EBUSY; - goto err1; - } - - hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len); - if (!hcd-regs) { - dev_err(dev-dev, ioremap [[0x%08llx, 0x%08llx] failed\n, - hcd-rsrc_start, hcd-rsrc_len); - retval = -ENOMEM; - goto err2; - } - - pnx8550_start_hc(dev); - - ohci_hcd_init(hcd_to_ohci(hcd)); - - retval = usb_add_hcd(hcd, dev-resource[1].start, 0); - if (retval == 0) - return retval; - - pnx8550_stop_hc(dev); - iounmap(hcd-regs); - err2: - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); - err1: - usb_put_hcd(hcd); - return retval; -} - - -/* may be called without controller electrically present */ -/* may be called with controller, bus, and devices active */ - -/** - * usb_hcd_pnx8550_remove - shutdown processing for pnx8550-based HCDs - * @dev: USB Host Controller being removed - * Context: !in_interrupt() - * - * Reverses the effect of usb_hcd_pnx8550_probe(), first invoking - *
[PATCH 03/25] USB: ehci: remove Loongson 1B EHCI driver.
The platform code registering the EHCI driver now uses the platform EHCI driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ehci-hcd.c |5 -- drivers/usb/host/ehci-ls1x.c | 147 -- 2 files changed, 152 deletions(-) delete mode 100644 drivers/usb/host/ehci-ls1x.c diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 442f774..2f517d9 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1319,11 +1319,6 @@ MODULE_LICENSE (GPL); #definePLATFORM_DRIVER ehci_mv_driver #endif -#ifdef CONFIG_MACH_LOONGSON1 -#include ehci-ls1x.c -#define PLATFORM_DRIVERehci_ls1x_driver -#endif - #ifdef CONFIG_MIPS_SEAD3 #include ehci-sead3.c #definePLATFORM_DRIVER ehci_hcd_sead3_driver diff --git a/drivers/usb/host/ehci-ls1x.c b/drivers/usb/host/ehci-ls1x.c deleted file mode 100644 index ca75965..000 --- a/drivers/usb/host/ehci-ls1x.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Bus Glue for Loongson LS1X built-in EHCI controller. - * - * Copyright (c) 2012 Zhang, Keguang keguang.zh...@gmail.com - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - - -#include linux/platform_device.h - -static int ehci_ls1x_reset(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - int ret; - - ehci-caps = hcd-regs; - - ret = ehci_setup(hcd); - if (ret) - return ret; - - ehci_port_power(ehci, 0); - - return 0; -} - -static const struct hc_driver ehci_ls1x_hc_driver = { - .description= hcd_name, - .product_desc = LOONGSON1 EHCI, - .hcd_priv_size = sizeof(struct ehci_hcd), - - /* -* generic hardware linkage -*/ - .irq= ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - - /* -* basic lifecycle operations -*/ - .reset = ehci_ls1x_reset, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - - /* -* managing i/o requests and associated device resources -*/ - .urb_enqueue= ehci_urb_enqueue, - .urb_dequeue= ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - - /* -* scheduling support -*/ - .get_frame_number = ehci_get_frame, - - /* -* root hub support -*/ - .hub_status_data= ehci_hub_status_data, - .hub_control= ehci_hub_control, - .relinquish_port= ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static int ehci_hcd_ls1x_probe(struct platform_device *pdev) -{ - struct usb_hcd *hcd; - struct resource *res; - int irq; - int ret; - - pr_debug(initializing loongson1 ehci USB Controller\n); - - if (usb_disabled()) - return -ENODEV; - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no IRQ. Check %s setup!\n, - dev_name(pdev-dev)); - return -ENODEV; - } - irq = res-start; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - return -ENODEV; - } - - hcd = usb_create_hcd(ehci_ls1x_hc_driver, pdev-dev, - dev_name(pdev-dev)); - if (!hcd) - return -ENOMEM; - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - hcd-regs = devm_request_and_ioremap(pdev-dev, res); - if (hcd-regs == NULL) { - dev_dbg(pdev-dev, error mapping memory\n); - ret = -EFAULT; - goto err_put_hcd; - } - - ret = usb_add_hcd(hcd, irq, IRQF_SHARED); - if (ret) - goto err_put_hcd; - - return ret; - -err_put_hcd: - usb_put_hcd(hcd); - return ret; -} - -static int ehci_hcd_ls1x_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - - usb_remove_hcd(hcd); - usb_put_hcd(hcd); - - return 0; -} - -static struct platform_driver ehci_ls1x_driver = { - .probe = ehci_hcd_ls1x_probe, - .remove = ehci_hcd_ls1x_remove, - .shutdown =
[PATCH 16/25] ARM: cns3xxx: use OHCI platform driver
Since both the EHCI and OHCI platform drivers use the same power_{on,off} callbacks, rename them to cns3xx_usb_power_{on,off} to show that they are shared. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/arm/mach-cns3xxx/cns3420vb.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c index 906094c..8a00cee8 100644 --- a/arch/arm/mach-cns3xxx/cns3420vb.c +++ b/arch/arm/mach-cns3xxx/cns3420vb.c @@ -25,6 +25,7 @@ #include linux/mtd/physmap.h #include linux/mtd/partitions.h #include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/setup.h #include asm/mach-types.h #include asm/hardware/gic.h @@ -127,7 +128,7 @@ static struct resource cns3xxx_usb_ehci_resources[] = { static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32); -static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev) +static int csn3xxx_usb_power_on(struct platform_device *pdev) { /* * EHCI and OHCI share the same clock and power, @@ -148,7 +149,7 @@ static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev) return 0; } -static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev) +static void csn3xxx_usb_power_off(struct platform_device *pdev) { /* * EHCI and OHCI share the same clock and power, @@ -162,8 +163,8 @@ static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev) static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = { .port_power_off = 1, - .power_on = csn3xxx_usb_ehci_power_on, - .power_off = csn3xxx_usb_ehci_power_off, + .power_on = csn3xxx_usb_power_on, + .power_off = csn3xxx_usb_power_off, }; static struct platform_device cns3xxx_usb_ehci_device = { @@ -191,13 +192,20 @@ static struct resource cns3xxx_usb_ohci_resources[] = { static u64 cns3xxx_usb_ohci_dma_mask = DMA_BIT_MASK(32); +static struct usb_ohci_pdata cns3xxx_usb_ohci_pdata = { + .num_ports = 1, + .power_on = csn3xxx_usb_power_on, + .power_off = csn3xxx_usb_power_off, +}; + static struct platform_device cns3xxx_usb_ohci_device = { - .name = cns3xxx-ohci, + .name = ohci-platform, .num_resources = ARRAY_SIZE(cns3xxx_usb_ohci_resources), .resource = cns3xxx_usb_ohci_resources, .dev = { .dma_mask = cns3xxx_usb_ohci_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = cns3xxx_usb_ohci_pdata, }, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/25] MIPS: Alchemy: use the ehci platform driver
On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: Use the ehci platform driver power_{on,suspend,off} callbacks to perform the USB block gate enabling/disabling as what the ehci-au1xxx.c driver does. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/alchemy/common/platform.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index c0f3ce6..57335a2 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -17,6 +17,7 @@ #include linux/platform_device.h #include linux/serial_8250.h #include linux/slab.h +#include linux/usb/ehci_pdriver.h #include asm/mach-au1x00/au1000.h #include asm/mach-au1x00/au1xxx_dbdma.h @@ -122,6 +123,25 @@ static void __init alchemy_setup_uarts(int ctype) static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32); static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32); +/* Power on callback for the ehci platform driver */ +static int alchemy_ehci_power_on(struct platform_device *pdev) +{ + return alchemy_usb_control(ALCHEMY_USB_EHCI0, 1); +} + +/* Power off/suspend callback for the ehci platform driver */ +static void alchemy_ehci_power_off(struct platform_device *pdev) +{ + alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); +} + +static struct usb_ehci_pdata alchemy_ehci_pdata = { + .need_io_watchdog = 0, This member doesn't exist. Manuel -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 11/25] ARM: cns3xxx: use ehci platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/arm/mach-cns3xxx/cns3420vb.c | 44 - 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c index 2c5fb4c..906094c 100644 --- a/arch/arm/mach-cns3xxx/cns3420vb.c +++ b/arch/arm/mach-cns3xxx/cns3420vb.c @@ -24,6 +24,7 @@ #include linux/mtd/mtd.h #include linux/mtd/physmap.h #include linux/mtd/partitions.h +#include linux/usb/ehci_pdriver.h #include asm/setup.h #include asm/mach-types.h #include asm/hardware/gic.h @@ -32,6 +33,7 @@ #include asm/mach/time.h #include mach/cns3xxx.h #include mach/irqs.h +#include mach/pm.h #include core.h #include devices.h @@ -125,13 +127,53 @@ static struct resource cns3xxx_usb_ehci_resources[] = { static u64 cns3xxx_usb_ehci_dma_mask = DMA_BIT_MASK(32); +static int csn3xxx_usb_ehci_power_on(struct platform_device *pdev) +{ + /* +* EHCI and OHCI share the same clock and power, +* resetting twice would cause the 1st controller been reset. +* Therefore only do power up at the first up device, and +* power down at the last down device. +* +* Set USB AHB INCR length to 16 +*/ + if (atomic_inc_return(usb_pwr_ref) == 1) { + cns3xxx_pwr_power_up(1 PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB); + cns3xxx_pwr_clk_en(1 PM_CLK_GATE_REG_OFFSET_USB_HOST); + cns3xxx_pwr_soft_rst(1 PM_SOFT_RST_REG_OFFST_USB_HOST); + __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 24)), + MISC_CHIP_CONFIG_REG); + } + + return 0; +} + +static void csn3xxx_usb_ehci_power_off(struct platform_device *pdev) +{ + /* +* EHCI and OHCI share the same clock and power, +* resetting twice would cause the 1st controller been reset. +* Therefore only do power up at the first up device, and +* power down at the last down device. +*/ + if (atomic_dec_return(usb_pwr_ref) == 0) + cns3xxx_pwr_clk_dis(1 PM_CLK_GATE_REG_OFFSET_USB_HOST); +} + +static struct usb_ehci_pdata cns3xxx_usb_ehci_pdata = { + .port_power_off = 1, + .power_on = csn3xxx_usb_ehci_power_on, + .power_off = csn3xxx_usb_ehci_power_off, +}; + static struct platform_device cns3xxx_usb_ehci_device = { - .name = cns3xxx-ehci, + .name = ehci-platform, .num_resources = ARRAY_SIZE(cns3xxx_usb_ehci_resources), .resource = cns3xxx_usb_ehci_resources, .dev = { .dma_mask = cns3xxx_usb_ehci_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = cns3xxx_usb_ehci_pdata, }, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 07/25] MIPS: Alchemy: use the ehci platform driver
Use the ehci platform driver power_{on,suspend,off} callbacks to perform the USB block gate enabling/disabling as what the ehci-au1xxx.c driver does. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/alchemy/common/platform.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index c0f3ce6..57335a2 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -17,6 +17,7 @@ #include linux/platform_device.h #include linux/serial_8250.h #include linux/slab.h +#include linux/usb/ehci_pdriver.h #include asm/mach-au1x00/au1000.h #include asm/mach-au1x00/au1xxx_dbdma.h @@ -122,6 +123,25 @@ static void __init alchemy_setup_uarts(int ctype) static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32); static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32); +/* Power on callback for the ehci platform driver */ +static int alchemy_ehci_power_on(struct platform_device *pdev) +{ + return alchemy_usb_control(ALCHEMY_USB_EHCI0, 1); +} + +/* Power off/suspend callback for the ehci platform driver */ +static void alchemy_ehci_power_off(struct platform_device *pdev) +{ + alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); +} + +static struct usb_ehci_pdata alchemy_ehci_pdata = { + .need_io_watchdog = 0, + .power_on = alchemy_ehci_power_on, + .power_off = alchemy_ehci_power_off, + .power_suspend = alchemy_ehci_power_off, +}; + static unsigned long alchemy_ohci_data[][2] __initdata = { [ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT }, [ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT }, @@ -188,9 +208,10 @@ static void __init alchemy_setup_usb(int ctype) res[1].start = alchemy_ehci_data[ctype][1]; res[1].end = res[1].start; res[1].flags = IORESOURCE_IRQ; - pdev-name = au1xxx-ehci; + pdev-name = ehci-platform; pdev-id = 0; pdev-dev.dma_mask = alchemy_ehci_dmamask; + pdev-dev.platform_data = alchemy_ehci_pdata; if (platform_device_register(pdev)) printk(KERN_INFO Alchemy USB: cannot add EHCI0\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 21/25] USB: ohci: remove Netlogic XLS OHCI platform driver
All users have been converted to use the OHCI platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ohci-hcd.c |5 -- drivers/usb/host/ohci-xls.c | 152 --- 2 files changed, 157 deletions(-) delete mode 100644 drivers/usb/host/ohci-xls.c diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index b099024..2cafe98 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1095,11 +1095,6 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERohci_hcd_tilegx_driver #endif -#ifdef CONFIG_CPU_XLR -#include ohci-xls.c -#define PLATFORM_DRIVERohci_xls_driver -#endif - #ifdef CONFIG_USB_OHCI_HCD_PLATFORM #include ohci-platform.c #define PLATFORM_DRIVERohci_platform_driver diff --git a/drivers/usb/host/ohci-xls.c b/drivers/usb/host/ohci-xls.c deleted file mode 100644 index 84201cd..000 --- a/drivers/usb/host/ohci-xls.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * OHCI HCD for Netlogic XLS processors. - * - * (C) Copyright 2011 Netlogic Microsystems Inc. - * - * Based on ohci-au1xxx.c, and other Linux OHCI drivers. - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include linux/platform_device.h -#include linux/signal.h - -static int ohci_xls_probe_internal(const struct hc_driver *driver, - struct platform_device *dev) -{ - struct resource *res; - struct usb_hcd *hcd; - int retval, irq; - - /* Get our IRQ from an earlier registered Platform Resource */ - irq = platform_get_irq(dev, 0); - if (irq 0) { - dev_err(dev-dev, Found HC with no IRQ\n); - return -ENODEV; - } - - /* Get our Memory Handle */ - res = platform_get_resource(dev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev-dev, MMIO Handle incorrect!\n); - return -ENODEV; - } - - hcd = usb_create_hcd(driver, dev-dev, XLS); - if (!hcd) { - retval = -ENOMEM; - goto err1; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, - driver-description)) { - dev_dbg(dev-dev, Controller already in use\n); - retval = -EBUSY; - goto err2; - } - - hcd-regs = ioremap_nocache(hcd-rsrc_start, hcd-rsrc_len); - if (hcd-regs == NULL) { - dev_dbg(dev-dev, error mapping memory\n); - retval = -EFAULT; - goto err3; - } - - retval = usb_add_hcd(hcd, irq, IRQF_SHARED); - if (retval != 0) - goto err4; - return retval; - -err4: - iounmap(hcd-regs); -err3: - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); -err2: - usb_put_hcd(hcd); -err1: - dev_err(dev-dev, init fail, %d\n, retval); - return retval; -} - -static int ohci_xls_reset(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - - ohci_hcd_init(ohci); - return ohci_init(ohci); -} - -static int __devinit ohci_xls_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci; - int ret; - - ohci = hcd_to_ohci(hcd); - ret = ohci_run(ohci); - if (ret 0) { - dev_err(hcd-self.controller, can't start %s\n, - hcd-self.bus_name); - ohci_stop(hcd); - return ret; - } - return 0; -} - -static struct hc_driver ohci_xls_hc_driver = { - .description= hcd_name, - .product_desc = XLS OHCI Host Controller, - .hcd_priv_size = sizeof(struct ohci_hcd), - .irq= ohci_irq, - .flags = HCD_MEMORY | HCD_USB11, - .reset = ohci_xls_reset, - .start = ohci_xls_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - .urb_enqueue= ohci_urb_enqueue, - .urb_dequeue= ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - .get_frame_number = ohci_get_frame, - .hub_status_data = ohci_hub_status_data, - .hub_control= ohci_hub_control, -#ifdef CONFIG_PM - .bus_suspend= ohci_bus_suspend, - .bus_resume = ohci_bus_resume, -#endif - .start_port_reset = ohci_start_port_reset, -}; - -static int ohci_xls_probe(struct platform_device *dev) -{ - int ret; - - pr_debug(In ohci_xls_probe); - if (usb_disabled()) - return -ENODEV; - ret = ohci_xls_probe_internal(ohci_xls_hc_driver, dev); - return ret; -} - -static int ohci_xls_remove(struct platform_device *dev) -{ - struct usb_hcd *hcd = platform_get_drvdata(dev); - -
[PATCH 06/25] USB: ehci: allow need_io_watchdog to be passed to ehci-platform driver
And convert all the existing users of ehci-platform to specify a correct need_io_watchdog value. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/ath79/dev-usb.c |2 ++ arch/mips/loongson1/common/platform.c |1 + arch/mips/netlogic/xlr/platform.c |1 + drivers/usb/host/bcma-hcd.c |1 + drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ssb-hcd.c|1 + include/linux/usb/ehci_pdriver.h |3 +++ 7 files changed, 10 insertions(+) diff --git a/arch/mips/ath79/dev-usb.c b/arch/mips/ath79/dev-usb.c index b2a2311..42b259b 100644 --- a/arch/mips/ath79/dev-usb.c +++ b/arch/mips/ath79/dev-usb.c @@ -71,12 +71,14 @@ static u64 ath79_ehci_dmamask = DMA_BIT_MASK(32); static struct usb_ehci_pdata ath79_ehci_pdata_v1 = { .has_synopsys_hc_bug= 1, .port_power_off = 1, + .need_io_watchdog = 1, }; static struct usb_ehci_pdata ath79_ehci_pdata_v2 = { .caps_offset= 0x100, .has_tt = 1, .port_power_off = 1, + .need_io_watchdog = 1, }; static struct platform_device ath79_ehci_device = { diff --git a/arch/mips/loongson1/common/platform.c b/arch/mips/loongson1/common/platform.c index 2874bf2..fa6b5d6 100644 --- a/arch/mips/loongson1/common/platform.c +++ b/arch/mips/loongson1/common/platform.c @@ -110,6 +110,7 @@ static struct resource ls1x_ehci_resources[] = { static struct usb_ehci_pdata ls1x_ehci_pdata = { .port_power_off = 1, + .need_io_watchdog = 1, }; struct platform_device ls1x_ehci_device = { diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index 1731dfd..320b7ef 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c @@ -126,6 +126,7 @@ static u64 xls_usb_dmamask = ~(u32)0; static struct usb_ehci_pdata xls_usb_ehci_pdata = { .caps_offset= 0, + .need_io_watchdog = 1, }; static struct platform_device xls_usb_ehci_device = diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c index 443da21..e404f5c 100644 --- a/drivers/usb/host/bcma-hcd.c +++ b/drivers/usb/host/bcma-hcd.c @@ -160,6 +160,7 @@ static void __devinit bcma_hcd_init_chip(struct bcma_device *dev) } static const struct usb_ehci_pdata ehci_pdata = { + .need_io_watchdog = 1, }; static const struct usb_ohci_pdata ohci_pdata = { diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 764e010..08d5dec 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -32,6 +32,7 @@ static int ehci_platform_reset(struct usb_hcd *hcd) ehci-has_synopsys_hc_bug = pdata-has_synopsys_hc_bug; ehci-big_endian_desc = pdata-big_endian_desc; ehci-big_endian_mmio = pdata-big_endian_mmio; + ehci-need_io_watchdog = pdata-need_io_watchdog; ehci-caps = hcd-regs + pdata-caps_offset; retval = ehci_setup(hcd); diff --git a/drivers/usb/host/ssb-hcd.c b/drivers/usb/host/ssb-hcd.c index c2a29fa..77e2851 100644 --- a/drivers/usb/host/ssb-hcd.c +++ b/drivers/usb/host/ssb-hcd.c @@ -96,6 +96,7 @@ static u32 __devinit ssb_hcd_init_chip(struct ssb_device *dev) } static const struct usb_ehci_pdata ehci_pdata = { + .need_io_watchdog= 1, }; static const struct usb_ohci_pdata ohci_pdata = { diff --git a/include/linux/usb/ehci_pdriver.h b/include/linux/usb/ehci_pdriver.h index c9d09f8..988504d 100644 --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -29,6 +29,8 @@ * initialization. * @port_power_off:set to 1 if the controller needs to be powered down * after initialization. + * @need_io_watchdog: set to 1 if the controller needs the I/O watchdog to + * run. * * These are general configuration options for the EHCI controller. All of * these options are activating more or less workarounds for some hardware. @@ -41,6 +43,7 @@ struct usb_ehci_pdata { unsignedbig_endian_mmio:1; unsignedport_power_on:1; unsignedport_power_off:1; + unsignedneed_io_watchdog:1; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 14/25] MIPS: PNX8550: use OHCI platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/pnx8550/common/platform.c | 31 ++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/mips/pnx8550/common/platform.c b/arch/mips/pnx8550/common/platform.c index 5264cc0..0a8faea 100644 --- a/arch/mips/pnx8550/common/platform.c +++ b/arch/mips/pnx8550/common/platform.c @@ -20,6 +20,7 @@ #include linux/serial.h #include linux/serial_pnx8xxx.h #include linux/platform_device.h +#include linux/usb/ohci_pdriver.h #include int.h #include usb.h @@ -96,12 +97,40 @@ static u64 ohci_dmamask = DMA_BIT_MASK(32); static u64 uart_dmamask = DMA_BIT_MASK(32); +static int pnx8550_usb_ohci_power_on(struct platform_device *pdev) +{ + /* +* Set register CLK48CTL to enable and 48MHz +*/ + outl(0x0003, PCI_BASE | 0x0004770c); + + /* +* Set register CLK12CTL to enable and 48MHz +*/ + outl(0x0003, PCI_BASE | 0x00047710); + + udelay(100); + + return 0; +} + +static void pnx8550_usb_ohci_power_off(struct platform_device *pdev) +{ + udelay(10); +} + +static struct usb_ohci_pdata pnx8550_usb_ohci_pdata = { + .power_on = pnx8550_usb_ohci_power_on, + .power_off = pnx8550_usb_ohci_power_off, +}; + static struct platform_device pnx8550_usb_ohci_device = { - .name = pnx8550-ohci, + .name = ohci-platform, .id = -1, .dev = { .dma_mask = ohci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = pnx8550_usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources), .resource = pnx8550_usb_ohci_resources, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 01/25] USB: ehci: remove IXP4xx EHCI driver
This driver is not registered by any in-tree user. If needed it can easily be registered using the ehci-platform driver with caps_offset set to 0x100. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ehci-hcd.c|5 -- drivers/usb/host/ehci-ixp4xx.c | 139 2 files changed, 144 deletions(-) delete mode 100644 drivers/usb/host/ehci-ixp4xx.c diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 6bf6c42..442f774 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1249,11 +1249,6 @@ MODULE_LICENSE (GPL); #definePLATFORM_DRIVER ehci_orion_driver #endif -#ifdef CONFIG_ARCH_IXP4XX -#include ehci-ixp4xx.c -#definePLATFORM_DRIVER ixp4xx_ehci_driver -#endif - #ifdef CONFIG_USB_W90X900_EHCI #include ehci-w90x900.c #definePLATFORM_DRIVER ehci_hcd_w90x900_driver diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c deleted file mode 100644 index f224c0a..000 --- a/drivers/usb/host/ehci-ixp4xx.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * IXP4XX EHCI Host Controller Driver - * - * Author: Vladimir Barinov vbari...@embeddedalley.com - * - * Based on ehci-fsl.c by Randy Vinson rvin...@mvista.com - * - * 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed as is without any warranty of any kind, whether express - * or implied. - */ - -#include linux/platform_device.h - -static int ixp4xx_ehci_init(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - int retval = 0; - - ehci-big_endian_desc = 1; - ehci-big_endian_mmio = 1; - - ehci-caps = hcd-regs + 0x100; - - hcd-has_tt = 1; - - retval = ehci_setup(hcd); - if (retval) - return retval; - - ehci_port_power(ehci, 0); - - return retval; -} - -static const struct hc_driver ixp4xx_ehci_hc_driver = { - .description= hcd_name, - .product_desc = IXP4XX EHCI Host Controller, - .hcd_priv_size = sizeof(struct ehci_hcd), - .irq= ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - .reset = ixp4xx_ehci_init, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - .urb_enqueue= ehci_urb_enqueue, - .urb_dequeue= ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - .get_frame_number = ehci_get_frame, - .hub_status_data= ehci_hub_status_data, - .hub_control= ehci_hub_control, -#if defined(CONFIG_PM) - .bus_suspend= ehci_bus_suspend, - .bus_resume = ehci_bus_resume, -#endif - .relinquish_port= ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static int ixp4xx_ehci_probe(struct platform_device *pdev) -{ - struct usb_hcd *hcd; - const struct hc_driver *driver = ixp4xx_ehci_hc_driver; - struct resource *res; - int irq; - int retval; - - if (usb_disabled()) - return -ENODEV; - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no IRQ. Check %s setup!\n, - dev_name(pdev-dev)); - return -ENODEV; - } - irq = res-start; - - hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev)); - if (!hcd) { - retval = -ENOMEM; - goto fail_create_hcd; - } - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, - Found HC with no register addr. Check %s setup!\n, - dev_name(pdev-dev)); - retval = -ENODEV; - goto fail_request_resource; - } - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - hcd-regs = devm_request_and_ioremap(pdev-dev, res); - if (hcd-regs == NULL) { - dev_dbg(pdev-dev, error mapping memory\n); - retval = -EFAULT; - goto fail_request_resource; - } - - retval = usb_add_hcd(hcd, irq, IRQF_SHARED); - if (retval) - goto fail_request_resource; - - return retval; - -fail_request_resource: - usb_put_hcd(hcd); -fail_create_hcd: - dev_err(pdev-dev, init %s fail, %d\n, dev_name(pdev-dev), retval); - return retval; -} - -static int ixp4xx_ehci_remove(struct platform_device *pdev) -{ -
[PATCH 24/25] MIPS: Alchemy: use the OHCI platform driver
This also greatly simplifies the power_{on,off} callbacks and make them work on platform device id instead of checking the OHCI controller base address like what was done in ohci-au1xxx.c. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/alchemy/common/platform.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 57335a2..cd12458 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -18,6 +18,7 @@ #include linux/serial_8250.h #include linux/slab.h #include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/mach-au1x00/au1000.h #include asm/mach-au1x00/au1xxx_dbdma.h @@ -142,6 +143,34 @@ static struct usb_ehci_pdata alchemy_ehci_pdata = { .power_suspend = alchemy_ehci_power_off, }; +/* Power on callback for the ohci platform driver */ +static int alchemy_ohci_power_on(struct platform_device *pdev) +{ + int unit; + + unit = (pdev-id == 1) ? + ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; + + return alchemy_usb_control(unit, 1); +} + +/* Power off/suspend callback for the ohci platform driver */ +static void alchemy_ohci_power_off(struct platform_device *pdev) +{ + int unit; + + unit = (pdev-id == 1) ? + ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; + + alchemy_usb_control(unit, 0); +} + +static struct usb_ohci_pdata alchemy_ohci_pdata = { + .power_on = alchemy_ohci_power_on, + .power_off = alchemy_ohci_power_off, + .power_suspend = alchemy_ohci_power_off, +}; + static unsigned long alchemy_ohci_data[][2] __initdata = { [ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT }, [ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT }, @@ -192,6 +221,7 @@ static void __init alchemy_setup_usb(int ctype) pdev-name = au1xxx-ohci; pdev-id = 0; pdev-dev.dma_mask = alchemy_ohci_dmamask; + pdev-dev.platform_data = alchemy_ohci_pdata; if (platform_device_register(pdev)) printk(KERN_INFO Alchemy USB: cannot add OHCI0\n); @@ -231,6 +261,7 @@ static void __init alchemy_setup_usb(int ctype) pdev-name = au1xxx-ohci; pdev-id = 1; pdev-dev.dma_mask = alchemy_ohci_dmamask; + pdev-dev.platform_data = alchemy_ohci_pdata; if (platform_device_register(pdev)) printk(KERN_INFO Alchemy USB: cannot add OHCI1\n); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 10/25] USB: ehci: remove Octeon EHCI driver
Users of this driver have been converted to use the ehci platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/Kconfig |8 +- drivers/usb/host/ehci-octeon.c | 203 2 files changed, 6 insertions(+), 205 deletions(-) delete mode 100644 drivers/usb/host/ehci-octeon.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index b1deb0f..18cf37f 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -627,11 +627,15 @@ config USB_IMX21_HCD module will be called imx21-hcd. config USB_OCTEON_EHCI - bool Octeon on-chip EHCI support - depends on USB USB_EHCI_HCD CPU_CAVIUM_OCTEON + bool Octeon on-chip EHCI support (DEPRECATED) + depends on USB CPU_CAVIUM_OCTEON default n select USB_EHCI_BIG_ENDIAN_MMIO + select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD help + This option is deprecated now and the driver was removed, use + USB_EHCI_HCD_PLATFORM instead. + Enable support for the Octeon II SOC's on-chip EHCI controller. It is needed for high-speed (480Mbit/sec) USB 2.0 device support. All CN6XXX based chips with USB are diff --git a/drivers/usb/host/ehci-octeon.c b/drivers/usb/host/ehci-octeon.c deleted file mode 100644 index ba26957a..000 --- a/drivers/usb/host/ehci-octeon.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * EHCI HCD glue for Cavium Octeon II SOCs. - * - * Loosely based on ehci-au1xxx.c - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - * - * Copyright (C) 2010 Cavium Networks - * - */ - -#include linux/platform_device.h - -#include asm/octeon/octeon.h -#include asm/octeon/cvmx-uctlx-defs.h - -#define OCTEON_EHCI_HCD_NAME octeon-ehci - -/* Common clock init code. */ -void octeon2_usb_clocks_start(void); -void octeon2_usb_clocks_stop(void); - -static void ehci_octeon_start(void) -{ - union cvmx_uctlx_ehci_ctl ehci_ctl; - - octeon2_usb_clocks_start(); - - ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); - /* Use 64-bit addressing. */ - ehci_ctl.s.ehci_64b_addr_en = 1; - ehci_ctl.s.l2c_addr_msb = 0; - ehci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ - ehci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ - cvmx_write_csr(CVMX_UCTLX_EHCI_CTL(0), ehci_ctl.u64); -} - -static void ehci_octeon_stop(void) -{ - octeon2_usb_clocks_stop(); -} - -static const struct hc_driver ehci_octeon_hc_driver = { - .description= hcd_name, - .product_desc = Octeon EHCI, - .hcd_priv_size = sizeof(struct ehci_hcd), - - /* -* generic hardware linkage -*/ - .irq= ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - - /* -* basic lifecycle operations -*/ - .reset = ehci_setup, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - - /* -* managing i/o requests and associated device resources -*/ - .urb_enqueue= ehci_urb_enqueue, - .urb_dequeue= ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - - /* -* scheduling support -*/ - .get_frame_number = ehci_get_frame, - - /* -* root hub support -*/ - .hub_status_data= ehci_hub_status_data, - .hub_control= ehci_hub_control, - .bus_suspend= ehci_bus_suspend, - .bus_resume = ehci_bus_resume, - .relinquish_port= ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static u64 ehci_octeon_dma_mask = DMA_BIT_MASK(64); - -static int ehci_octeon_drv_probe(struct platform_device *pdev) -{ - struct usb_hcd *hcd; - struct ehci_hcd *ehci; - struct resource *res_mem; - int irq; - int ret; - - if (usb_disabled()) - return -ENODEV; - - irq = platform_get_irq(pdev, 0); - if (irq 0) { - dev_err(pdev-dev, No irq assigned\n); - return -ENODEV; - } - - res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (res_mem == NULL) { - dev_err(pdev-dev, No register space assigned\n); - return -ENODEV; - } - - /* -* We can DMA from anywhere. But the descriptors must be in -* the lower 4GB. -*/ - pdev-dev.coherent_dma_mask = DMA_BIT_MASK(32); - pdev-dev.dma_mask = ehci_octeon_dma_mask; - -
[PATCH 13/25] USB: ohci: allow platform driver to specify the number of ports
Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ohci-platform.c |4 include/linux/usb/ohci_pdriver.h |2 ++ 2 files changed, 6 insertions(+) diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c index e24ec9f..1caaf65 100644 --- a/drivers/usb/host/ohci-platform.c +++ b/drivers/usb/host/ohci-platform.c @@ -31,6 +31,10 @@ static int ohci_platform_reset(struct usb_hcd *hcd) ohci-flags |= OHCI_QUIRK_FRAME_NO; ohci_hcd_init(ohci); + + if (pdata-num_ports) + ohci-num_ports = pdata-num_ports; + err = ohci_init(ohci); return err; diff --git a/include/linux/usb/ohci_pdriver.h b/include/linux/usb/ohci_pdriver.h index 74e7755..012f2b7 100644 --- a/include/linux/usb/ohci_pdriver.h +++ b/include/linux/usb/ohci_pdriver.h @@ -25,6 +25,7 @@ * @big_endian_desc: BE descriptors * @big_endian_mmio: BE registers * @no_big_frame_no: no big endian frame_no shift + * @num_ports: number of ports * * These are general configuration options for the OHCI controller. All of * these options are activating more or less workarounds for some hardware. @@ -33,6 +34,7 @@ struct usb_ohci_pdata { unsignedbig_endian_desc:1; unsignedbig_endian_mmio:1; unsignedno_big_frame_no:1; + unsigned intnum_ports; /* Turn on all power and clocks */ int (*power_on)(struct platform_device *pdev); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 05/25] USB: ehci: remove Netlogic XLS EHCI driver
The platform code has been migrated to use the ehci-platform driver. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ehci-hcd.c |5 -- drivers/usb/host/ehci-xls.c | 142 --- 2 files changed, 147 deletions(-) delete mode 100644 drivers/usb/host/ehci-xls.c diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2f517d9..f2a9982 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1309,11 +1309,6 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERehci_grlib_driver #endif -#ifdef CONFIG_CPU_XLR -#include ehci-xls.c -#define PLATFORM_DRIVERehci_xls_driver -#endif - #ifdef CONFIG_USB_EHCI_MV #include ehci-mv.c #definePLATFORM_DRIVER ehci_mv_driver diff --git a/drivers/usb/host/ehci-xls.c b/drivers/usb/host/ehci-xls.c deleted file mode 100644 index 8dc6a22..000 --- a/drivers/usb/host/ehci-xls.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * EHCI HCD for Netlogic XLS processors. - * - * (C) Copyright 2011 Netlogic Microsystems Inc. - * - * Based on various ehci-*.c drivers - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive for - * more details. - */ - -#include linux/platform_device.h - -static int ehci_xls_setup(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - - ehci-caps = hcd-regs; - - return ehci_setup(hcd); -} - -int ehci_xls_probe_internal(const struct hc_driver *driver, - struct platform_device *pdev) -{ - struct usb_hcd *hcd; - struct resource *res; - int retval, irq; - - /* Get our IRQ from an earlier registered Platform Resource */ - irq = platform_get_irq(pdev, 0); - if (irq 0) { - dev_err(pdev-dev, Found HC with no IRQ. Check %s setup!\n, - dev_name(pdev-dev)); - return -ENODEV; - } - - /* Get our Memory Handle */ - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(pdev-dev, Error: MMIO Handle %s setup!\n, - dev_name(pdev-dev)); - return -ENODEV; - } - hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev)); - if (!hcd) { - retval = -ENOMEM; - goto err1; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, - driver-description)) { - dev_dbg(pdev-dev, controller already in use\n); - retval = -EBUSY; - goto err2; - } - hcd-regs = ioremap_nocache(hcd-rsrc_start, hcd-rsrc_len); - - if (hcd-regs == NULL) { - dev_dbg(pdev-dev, error mapping memory\n); - retval = -EFAULT; - goto err3; - } - - retval = usb_add_hcd(hcd, irq, IRQF_SHARED); - if (retval != 0) - goto err4; - return retval; - -err4: - iounmap(hcd-regs); -err3: - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); -err2: - usb_put_hcd(hcd); -err1: - dev_err(pdev-dev, init %s fail, %d\n, dev_name(pdev-dev), - retval); - return retval; -} - -static struct hc_driver ehci_xls_hc_driver = { - .description= hcd_name, - .product_desc = XLS EHCI Host Controller, - .hcd_priv_size = sizeof(struct ehci_hcd), - .irq= ehci_irq, - .flags = HCD_USB2 | HCD_MEMORY, - .reset = ehci_xls_setup, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - - .urb_enqueue= ehci_urb_enqueue, - .urb_dequeue= ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - - .get_frame_number = ehci_get_frame, - - .hub_status_data = ehci_hub_status_data, - .hub_control= ehci_hub_control, - .bus_suspend= ehci_bus_suspend, - .bus_resume = ehci_bus_resume, - .relinquish_port = ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static int ehci_xls_probe(struct platform_device *pdev) -{ - if (usb_disabled()) - return -ENODEV; - - return ehci_xls_probe_internal(ehci_xls_hc_driver, pdev); -} - -static int ehci_xls_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); - - usb_remove_hcd(hcd); - iounmap(hcd-regs); - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); - usb_put_hcd(hcd); - return 0; -} - -MODULE_ALIAS(ehci-xls); - -static struct platform_driver
[PATCH 14/25] MIPS: PNX8550: useOHCI platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/pnx8550/common/platform.c | 31 ++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/mips/pnx8550/common/platform.c b/arch/mips/pnx8550/common/platform.c index 5264cc0..0a8faea 100644 --- a/arch/mips/pnx8550/common/platform.c +++ b/arch/mips/pnx8550/common/platform.c @@ -20,6 +20,7 @@ #include linux/serial.h #include linux/serial_pnx8xxx.h #include linux/platform_device.h +#include linux/usb/ohci_pdriver.h #include int.h #include usb.h @@ -96,12 +97,40 @@ static u64 ohci_dmamask = DMA_BIT_MASK(32); static u64 uart_dmamask = DMA_BIT_MASK(32); +static int pnx8550_usb_ohci_power_on(struct platform_device *pdev) +{ + /* +* Set register CLK48CTL to enable and 48MHz +*/ + outl(0x0003, PCI_BASE | 0x0004770c); + + /* +* Set register CLK12CTL to enable and 48MHz +*/ + outl(0x0003, PCI_BASE | 0x00047710); + + udelay(100); + + return 0; +} + +static void pnx8550_usb_ohci_power_off(struct platform_device *pdev) +{ + udelay(10); +} + +static struct usb_ohci_pdata pnx8550_usb_ohci_pdata = { + .power_on = pnx8550_usb_ohci_power_on, + .power_off = pnx8550_usb_ohci_power_off, +}; + static struct platform_device pnx8550_usb_ohci_device = { - .name = pnx8550-ohci, + .name = ohci-platform, .id = -1, .dev = { .dma_mask = ohci_dmamask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = pnx8550_usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources), .resource = pnx8550_usb_ohci_resources, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 09/25] MIPS: Octeon: use ehci-platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/cavium-octeon/octeon-platform.c | 43 - 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index 0938df1..539e1bc 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -18,9 +18,11 @@ #include linux/of_platform.h #include linux/of_fdt.h #include linux/libfdt.h +#include linux/usb/ehci_pdriver.h #include asm/octeon/octeon.h #include asm/octeon/cvmx-rnm-defs.h +#include asm/octeon/cvmx-uctlx-defs.h #include asm/octeon/cvmx-helper.h #include asm/octeon/cvmx-helper-board.h @@ -169,6 +171,41 @@ out: device_initcall(octeon_rng_device_init); #ifdef CONFIG_USB +void octeon2_usb_clocks_start(void); +void octeon2_usb_clocks_stop(void); + +static int octeon_ehci_power_on(struct platform_device *pdev) +{ + union cvmx_uctlx_ehci_ctl ehci_ctl; + + octeon2_usb_clocks_start(); + + ehci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_EHCI_CTL(0)); + /* Use 64-bit addressing. */ + ehci_ctl.s.ehci_64b_addr_en = 1; + ehci_ctl.s.l2c_addr_msb = 0; + ehci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ + ehci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ + cvmx_write_csr(CVMX_UCTLX_EHCI_CTL(0), ehci_ctl.u64); + + return 0; +} + +static void octeon_ehci_power_off(struct platform_device *pdev) +{ + octeon2_usb_clocks_stop(); +} + +static struct usb_ehci_pdata octeon_ehci_pdata = { +#ifdef __BIG_ENDIAN + .big_endian_mmio = 1, +#endif + .port_power_on = 1, + .power_on = octeon_ehci_power_on, + .power_off = octeon_ehci_power_off, +}; + +static u64 octeon_ehci_dma_mask = DMA_BIT_MASK(64); static int __init octeon_ehci_device_init(void) { @@ -190,7 +227,7 @@ static int __init octeon_ehci_device_init(void) if (octeon_is_simulation() || usb_disabled()) return 0; /* No USB in the simulator. */ - pd = platform_device_alloc(octeon-ehci, 0); + pd = platform_device_alloc(ehci-platform, 0); if (!pd) { ret = -ENOMEM; goto out; @@ -207,6 +244,10 @@ static int __init octeon_ehci_device_init(void) if (ret) goto fail; + pd.dev.platform_data = octeon_ehci_pdata; + pd.dev.coherent_dma_mask = DMA_BIT_MASK(32); + pd.dev.dma_mask = octeon_ehci_dma_mask; + ret = platform_device_add(pd); if (ret) goto fail; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 22/25] sh: convert boards to use the OHCI platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/sh/kernel/cpu/sh3/setup-sh7720.c |6 +- arch/sh/kernel/cpu/sh4a/setup-sh7757.c |6 +- arch/sh/kernel/cpu/sh4a/setup-sh7763.c |6 +- arch/sh/kernel/cpu/sh4a/setup-sh7786.c |6 +- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7720.c b/arch/sh/kernel/cpu/sh3/setup-sh7720.c index 0c2f1b2..42d991f 100644 --- a/arch/sh/kernel/cpu/sh3/setup-sh7720.c +++ b/arch/sh/kernel/cpu/sh3/setup-sh7720.c @@ -20,6 +20,7 @@ #include linux/serial_sci.h #include linux/sh_timer.h #include linux/sh_intc.h +#include linux/usb/ohci_pdriver.h #include asm/rtc.h #include cpu/serial.h @@ -103,12 +104,15 @@ static struct resource usb_ohci_resources[] = { static u64 usb_ohci_dma_mask = 0xUL; +static struct usb_ohci_pdata usb_ohci_pdata; + static struct platform_device usb_ohci_device = { - .name = sh_ohci, + .name = ohci-platform, .id = -1, .dev = { .dma_mask = usb_ohci_dma_mask, .coherent_dma_mask = 0x, + .platform_data = usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(usb_ohci_resources), .resource = usb_ohci_resources, diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c index 4a2f357..9079a0f 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c @@ -19,6 +19,7 @@ #include linux/sh_timer.h #include linux/sh_dma.h #include linux/sh_intc.h +#include linux/usb/ohci_pdriver.h #include cpu/dma-register.h #include cpu/sh7757.h @@ -750,12 +751,15 @@ static struct resource usb_ohci_resources[] = { }, }; +static struct usb_ohci_pdata usb_ohci_pdata; + static struct platform_device usb_ohci_device = { - .name = sh_ohci, + .name = ohci-platform, .id = -1, .dev = { .dma_mask = usb_ohci_device.dev.coherent_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(usb_ohci_resources), .resource = usb_ohci_resources, diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c index bd0a8fb..1686aca 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7763.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7763.c @@ -16,6 +16,7 @@ #include linux/sh_intc.h #include linux/io.h #include linux/serial_sci.h +#include linux/usb/ohci_pdriver.h static struct plat_sci_port scif0_platform_data = { .mapbase= 0xffe0, @@ -106,12 +107,15 @@ static struct resource usb_ohci_resources[] = { static u64 usb_ohci_dma_mask = 0xUL; +static struct usb_ohci_pdata usb_ohci_pdata; + static struct platform_device usb_ohci_device = { - .name = sh_ohci, + .name = ohci-platform, .id = -1, .dev = { .dma_mask = usb_ohci_dma_mask, .coherent_dma_mask = 0x, + .platform_data = usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(usb_ohci_resources), .resource = usb_ohci_resources, diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c index 2e6952f..ab52d4d 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7786.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7786.c @@ -23,6 +23,7 @@ #include linux/sh_timer.h #include linux/sh_dma.h #include linux/sh_intc.h +#include linux/usb/ohci_pdriver.h #include cpu/dma-register.h #include asm/mmzone.h @@ -583,12 +584,15 @@ static struct resource usb_ohci_resources[] = { }, }; +static struct usb_ohci_pdata usb_ohci_pdata; + static struct platform_device usb_ohci_device = { - .name = sh_ohci, + .name = ohci-platform, .id = -1, .dev = { .dma_mask = usb_ohci_device.dev.coherent_dma_mask, .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = usb_ohci_pdata, }, .num_resources = ARRAY_SIZE(usb_ohci_resources), .resource = usb_ohci_resources, -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 02/25] MIPS: Loongson 1B: use ehci-platform instead of ehci-ls1x.
The Loongson 1B EHCI driver does nothing more than what the EHCI platform driver already does, so use the generic implementation. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/configs/ls1b_defconfig |1 + arch/mips/loongson1/common/platform.c |8 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/mips/configs/ls1b_defconfig b/arch/mips/configs/ls1b_defconfig index 80cff8b..7eb7554 100644 --- a/arch/mips/configs/ls1b_defconfig +++ b/arch/mips/configs/ls1b_defconfig @@ -76,6 +76,7 @@ CONFIG_HID_GENERIC=m CONFIG_USB=y CONFIG_USB_ANNOUNCE_NEW_DEVICES=y CONFIG_USB_EHCI_HCD=y +CONFIG_USB_EHCI_HCD_PLATFORM=y # CONFIG_USB_EHCI_TT_NEWSCHED is not set CONFIG_USB_STORAGE=m CONFIG_USB_SERIAL=m diff --git a/arch/mips/loongson1/common/platform.c b/arch/mips/loongson1/common/platform.c index e92d59c..2874bf2 100644 --- a/arch/mips/loongson1/common/platform.c +++ b/arch/mips/loongson1/common/platform.c @@ -13,6 +13,7 @@ #include linux/phy.h #include linux/serial_8250.h #include linux/stmmac.h +#include linux/usb/ehci_pdriver.h #include asm-generic/sizes.h #include loongson1.h @@ -107,13 +108,18 @@ static struct resource ls1x_ehci_resources[] = { }, }; +static struct usb_ehci_pdata ls1x_ehci_pdata = { + .port_power_off = 1, +}; + struct platform_device ls1x_ehci_device = { - .name = ls1x-ehci, + .name = ehci-platform, .id = -1, .num_resources = ARRAY_SIZE(ls1x_ehci_resources), .resource = ls1x_ehci_resources, .dev= { .dma_mask = ls1x_ehci_dmamask, + .platform_data = ls1x_ehci_pdata, }, }; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 18/25] MIPS: Octeon: use OHCI platform driver
Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/cavium-octeon/octeon-platform.c | 37 - 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/arch/mips/cavium-octeon/octeon-platform.c b/arch/mips/cavium-octeon/octeon-platform.c index 539e1bc..07b0a3b 100644 --- a/arch/mips/cavium-octeon/octeon-platform.c +++ b/arch/mips/cavium-octeon/octeon-platform.c @@ -19,6 +19,7 @@ #include linux/of_fdt.h #include linux/libfdt.h #include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/octeon/octeon.h #include asm/octeon/cvmx-rnm-defs.h @@ -260,6 +261,36 @@ out: } device_initcall(octeon_ehci_device_init); +static int octeon_ohci_power_on(struct platform_device *pdev) +{ + union cvmx_uctlx_ohci_ctl ohci_ctl; + + octeon2_usb_clocks_start(); + + ohci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_OHCI_CTL(0)); + ohci_ctl.s.l2c_addr_msb = 0; + ohci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ + ohci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ + cvmx_write_csr(CVMX_UCTLX_OHCI_CTL(0), ohci_ctl.u64); + + return 0; +} + +static octeon_ohci_power_off(struct platform_device *pdev) +{ + octeon2_usb_clocks_stop(); +} + +static struct usb_ohci_pdata octeon_ohci_pdata = { +#ifdef __BIG_ENDIAN + .big_endian_mmio = 1, +#endif + .power_on = octeon_ohci_power_on, + .power_off = octeon_ohci_power_off, +}; + +static u32 octeon_ohci_dma_mask = DMA_BIT_MASK(32); + static int __init octeon_ohci_device_init(void) { struct platform_device *pd; @@ -280,7 +311,7 @@ static int __init octeon_ohci_device_init(void) if (octeon_is_simulation() || usb_disabled()) return 0; /* No USB in the simulator. */ - pd = platform_device_alloc(octeon-ohci, 0); + pd = platform_device_alloc(ohci-platform, 0); if (!pd) { ret = -ENOMEM; goto out; @@ -297,6 +328,10 @@ static int __init octeon_ohci_device_init(void) if (ret) goto fail; + pd.dev.platform_data = octeon_ohci_pdata; + pd.dev.coherent_dma_mask = DMA_BIT_MASK(32); + pd.dev.dma_mask = octeon_ohci_dma_mask; + ret = platform_device_add(pd); if (ret) goto fail; -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 12/25] USB: ehci: remove CNS3xxx EHCI platform driver
The users have been converted to use the ehci platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/Kconfig|6 +- drivers/usb/host/ehci-cns3xxx.c | 155 --- drivers/usb/host/ehci-hcd.c | 10 --- 3 files changed, 5 insertions(+), 166 deletions(-) delete mode 100644 drivers/usb/host/ehci-cns3xxx.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 18cf37f..0754dd1 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -215,9 +215,13 @@ config USB_W90X900_EHCI Enables support for the W90X900 USB controller config USB_CNS3XXX_EHCI - bool Cavium CNS3XXX EHCI Module + bool Cavium CNS3XXX EHCI Module (DEPRECATED) depends on USB_EHCI_HCD ARCH_CNS3XXX + select USB_EHCI_HCD_PLATFORM ---help--- + This option is deprecated now and the driver was removed, use + USB_EHCI_HCD_PLATFORM instead. + Enable support for the CNS3XXX SOC's on-chip EHCI controller. It is needed for high-speed (480Mbit/sec) USB 2.0 device support. diff --git a/drivers/usb/host/ehci-cns3xxx.c b/drivers/usb/host/ehci-cns3xxx.c deleted file mode 100644 index d91708d..000 --- a/drivers/usb/host/ehci-cns3xxx.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2008 Cavium Networks - * - * This file is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, Version 2, as - * published by the Free Software Foundation. - */ - -#include linux/platform_device.h -#include linux/atomic.h -#include mach/cns3xxx.h -#include mach/pm.h - -static int cns3xxx_ehci_init(struct usb_hcd *hcd) -{ - struct ehci_hcd *ehci = hcd_to_ehci(hcd); - int retval; - - /* -* EHCI and OHCI share the same clock and power, -* resetting twice would cause the 1st controller been reset. -* Therefore only do power up at the first up device, and -* power down at the last down device. -* -* Set USB AHB INCR length to 16 -*/ - if (atomic_inc_return(usb_pwr_ref) == 1) { - cns3xxx_pwr_power_up(1 PM_PLL_HM_PD_CTRL_REG_OFFSET_PLL_USB); - cns3xxx_pwr_clk_en(1 PM_CLK_GATE_REG_OFFSET_USB_HOST); - cns3xxx_pwr_soft_rst(1 PM_SOFT_RST_REG_OFFST_USB_HOST); - __raw_writel((__raw_readl(MISC_CHIP_CONFIG_REG) | (0X2 24)), - MISC_CHIP_CONFIG_REG); - } - - ehci-caps = hcd-regs; - - hcd-has_tt = 0; - - retval = ehci_setup(hcd); - if (retval) - return retval; - - ehci_port_power(ehci, 0); - - return retval; -} - -static const struct hc_driver cns3xxx_ehci_hc_driver = { - .description= hcd_name, - .product_desc = CNS3XXX EHCI Host Controller, - .hcd_priv_size = sizeof(struct ehci_hcd), - .irq= ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, - .reset = cns3xxx_ehci_init, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, - .urb_enqueue= ehci_urb_enqueue, - .urb_dequeue= ehci_urb_dequeue, - .endpoint_disable = ehci_endpoint_disable, - .endpoint_reset = ehci_endpoint_reset, - .get_frame_number = ehci_get_frame, - .hub_status_data= ehci_hub_status_data, - .hub_control= ehci_hub_control, -#ifdef CONFIG_PM - .bus_suspend= ehci_bus_suspend, - .bus_resume = ehci_bus_resume, -#endif - .relinquish_port= ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; - -static int cns3xxx_ehci_probe(struct platform_device *pdev) -{ - struct device *dev = pdev-dev; - struct usb_hcd *hcd; - const struct hc_driver *driver = cns3xxx_ehci_hc_driver; - struct resource *res; - int irq; - int retval; - - if (usb_disabled()) - return -ENODEV; - - res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); - if (!res) { - dev_err(dev, Found HC with no IRQ.\n); - return -ENODEV; - } - irq = res-start; - - hcd = usb_create_hcd(driver, pdev-dev, dev_name(pdev-dev)); - if (!hcd) - return -ENOMEM; - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) { - dev_err(dev, Found HC with no register addr.\n); - retval = -ENODEV; - goto err1; - } - - hcd-rsrc_start = res-start; - hcd-rsrc_len = resource_size(res); - - hcd-regs = devm_request_and_ioremap(pdev-dev, res); -
[PATCH 25/25] USB: ohci: remove Alchemy OHCI platform driver.
All users have been converted to use the OHCI platform driver instead. The driver was also doing quirky things with the internal OHCI hcd structure during suspend/resume, work that is taken care of by the core OHCI code in ohci-hub.c. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/ohci-au1xxx.c | 234 drivers/usb/host/ohci-hcd.c|5 - 2 files changed, 239 deletions(-) delete mode 100644 drivers/usb/host/ohci-au1xxx.c diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c deleted file mode 100644 index c611699..000 --- a/drivers/usb/host/ohci-au1xxx.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * OHCI HCD (Host Controller Driver) for USB. - * - * (C) Copyright 1999 Roman Weissgaerber wei...@vienna.at - * (C) Copyright 2000-2002 David Brownell dbrown...@users.sourceforge.net - * (C) Copyright 2002 Hewlett-Packard Company - * - * Bus Glue for AMD Alchemy Au1xxx - * - * Written by Christopher Hoover c...@hpl.hp.com - * Based on fragments of previous driver by Russell King et al. - * - * Modified for LH7A404 from ohci-sa.c - * by Durgesh Pattamatta pattamat...@sharpsec.com - * Modified for AMD Alchemy Au1xxx - * by Matt Porter mpor...@kernel.crashing.org - * - * This file is licenced under the GPL. - */ - -#include linux/platform_device.h -#include linux/signal.h - -#include asm/mach-au1x00/au1000.h - - -extern int usb_disabled(void); - -static int __devinit ohci_au1xxx_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int ret; - - ohci_dbg(ohci, ohci_au1xxx_start, ohci:%p, ohci); - - if ((ret = ohci_init(ohci)) 0) - return ret; - - if ((ret = ohci_run(ohci)) 0) { - dev_err(hcd-self.controller, can't start %s, - hcd-self.bus_name); - ohci_stop(hcd); - return ret; - } - - return 0; -} - -static const struct hc_driver ohci_au1xxx_hc_driver = { - .description = hcd_name, - .product_desc = Au1xxx OHCI, - .hcd_priv_size =sizeof(struct ohci_hcd), - - /* -* generic hardware linkage -*/ - .irq = ohci_irq, - .flags =HCD_USB11 | HCD_MEMORY, - - /* -* basic lifecycle operations -*/ - .start =ohci_au1xxx_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - - /* -* managing i/o requests and associated device resources -*/ - .urb_enqueue = ohci_urb_enqueue, - .urb_dequeue = ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - - /* -* scheduling support -*/ - .get_frame_number = ohci_get_frame, - - /* -* root hub support -*/ - .hub_status_data = ohci_hub_status_data, - .hub_control = ohci_hub_control, -#ifdef CONFIG_PM - .bus_suspend = ohci_bus_suspend, - .bus_resume = ohci_bus_resume, -#endif - .start_port_reset = ohci_start_port_reset, -}; - -static int ohci_hcd_au1xxx_drv_probe(struct platform_device *pdev) -{ - int ret, unit; - struct usb_hcd *hcd; - - if (usb_disabled()) - return -ENODEV; - - if (pdev-resource[1].flags != IORESOURCE_IRQ) { - pr_debug(resource[1] is not IORESOURCE_IRQ\n); - return -ENOMEM; - } - - hcd = usb_create_hcd(ohci_au1xxx_hc_driver, pdev-dev, au1xxx); - if (!hcd) - return -ENOMEM; - - hcd-rsrc_start = pdev-resource[0].start; - hcd-rsrc_len = pdev-resource[0].end - pdev-resource[0].start + 1; - - if (!request_mem_region(hcd-rsrc_start, hcd-rsrc_len, hcd_name)) { - pr_debug(request_mem_region failed\n); - ret = -EBUSY; - goto err1; - } - - hcd-regs = ioremap(hcd-rsrc_start, hcd-rsrc_len); - if (!hcd-regs) { - pr_debug(ioremap failed\n); - ret = -ENOMEM; - goto err2; - } - - unit = (hcd-rsrc_start == AU1300_USB_OHCI1_PHYS_ADDR) ? - ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; - if (alchemy_usb_control(unit, 1)) { - printk(KERN_INFO %s: controller init failed!\n, pdev-name); - ret = -ENODEV; - goto err3; - } - - ohci_hcd_init(hcd_to_ohci(hcd)); - - ret = usb_add_hcd(hcd, pdev-resource[1].start, - IRQF_SHARED); - if (ret == 0) { - platform_set_drvdata(pdev, hcd); - return ret; - } - - alchemy_usb_control(unit, 0); -err3: - iounmap(hcd-regs); -err2: - release_mem_region(hcd-rsrc_start, hcd-rsrc_len); -err1: - usb_put_hcd(hcd); - return ret; -} - -static int
[PATCH 00/25] USB: EHCI and OHCI platform driver conversions
Hi all, This patch series does trivial conversions of various EHCI and OHCI drivers in the tree. Each conversion is done in a two-step process to ensure bisectability: first register {e,o}hci-platform, then delete the old {e,o}hci platform driver and keep its Kconfig knob as deprecated. Once this series goes in, I will tackle the remaining drivers making use of clocks and add Device Tree support to the EHCI/OHCI platform drivers. Thanks! Florian Fainelli (25): USB: ehci: remove IXP4xx EHCI driver MIPS: Loongson 1B: use ehci-platform instead of ehci-ls1x. USB: ehci: remove Loongson 1B EHCI driver. MIPS: Netlogic: use ehci-platform driver USB: ehci: remove Netlogic XLS EHCI driver USB: ehci: allow need_io_watchdog to be passed to ehci-platform driver MIPS: Alchemy: use the ehci platform driver USB: ehci: remove Alchemy EHCI driver MIPS: Octeon: use ehci-platform driver USB: ehci: remove Octeon EHCI driver ARM: cns3xxx: use ehci platform driver USB: ehci: remove CNS3xxx EHCI platform driver USB: ohci: allow platform driver to specify the number of ports MIPS: PNX8550: use OHCI platform driver USB: ohci: remove PNX8550 OHCI driver ARM: cns3xxx: use OHCI platform driver USB: ohci: remove CNS3xxx OHCI platform driver MIPS: Octeon: use OHCI platform driver USB: ohci: remove Octeon OHCI platform driver MIPS: Netlogic: convert to use OHCI platform driver USB: ohci: remove Netlogic XLS OHCI platform driver sh: convert boards to use the OHCI platform driver USB: ohci: remove OHCI SH platform driver MIPS: Alchemy: use the OHCI platform driver USB: ohci: remove Alchemy OHCI platform driver. arch/arm/mach-cns3xxx/cns3420vb.c | 54 ++- arch/mips/alchemy/common/platform.c | 54 ++- arch/mips/ath79/dev-usb.c |2 + arch/mips/cavium-octeon/octeon-platform.c | 80 +- arch/mips/configs/ls1b_defconfig |1 + arch/mips/loongson1/common/platform.c |9 +- arch/mips/netlogic/xlr/platform.c | 12 ++ arch/mips/pnx8550/common/platform.c | 31 +++- arch/sh/kernel/cpu/sh3/setup-sh7720.c |6 +- arch/sh/kernel/cpu/sh4a/setup-sh7757.c|6 +- arch/sh/kernel/cpu/sh4a/setup-sh7763.c|6 +- arch/sh/kernel/cpu/sh4a/setup-sh7786.c|6 +- drivers/usb/host/Kconfig | 32 +++- drivers/usb/host/bcma-hcd.c |1 + drivers/usb/host/ehci-au1xxx.c| 184 -- drivers/usb/host/ehci-cns3xxx.c | 155 -- drivers/usb/host/ehci-hcd.c | 30 drivers/usb/host/ehci-ixp4xx.c| 139 - drivers/usb/host/ehci-ls1x.c | 147 - drivers/usb/host/ehci-octeon.c| 203 drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ehci-xls.c | 142 - drivers/usb/host/ohci-au1xxx.c| 234 --- drivers/usb/host/ohci-cns3xxx.c | 166 drivers/usb/host/ohci-hcd.c | 30 drivers/usb/host/ohci-octeon.c| 214 - drivers/usb/host/ohci-platform.c |4 + drivers/usb/host/ohci-pnx8550.c | 243 - drivers/usb/host/ohci-sh.c| 141 - drivers/usb/host/ohci-xls.c | 152 -- drivers/usb/host/ssb-hcd.c|1 + include/linux/usb/ehci_pdriver.h |3 + include/linux/usb/ohci_pdriver.h |2 + 33 files changed, 294 insertions(+), 2197 deletions(-) delete mode 100644 drivers/usb/host/ehci-au1xxx.c delete mode 100644 drivers/usb/host/ehci-cns3xxx.c delete mode 100644 drivers/usb/host/ehci-ixp4xx.c delete mode 100644 drivers/usb/host/ehci-ls1x.c delete mode 100644 drivers/usb/host/ehci-octeon.c delete mode 100644 drivers/usb/host/ehci-xls.c delete mode 100644 drivers/usb/host/ohci-au1xxx.c delete mode 100644 drivers/usb/host/ohci-cns3xxx.c delete mode 100644 drivers/usb/host/ohci-octeon.c delete mode 100644 drivers/usb/host/ohci-pnx8550.c delete mode 100644 drivers/usb/host/ohci-sh.c delete mode 100644 drivers/usb/host/ohci-xls.c -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 07/25] MIPS: Alchemy: use the ehci platform driver
On Wednesday 03 October 2012 17:14:21 Manuel Lauss wrote: On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: Use the ehci platform driver power_{on,suspend,off} callbacks to perform the USB block gate enabling/disabling as what the ehci-au1xxx.c driver does. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/alchemy/common/platform.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index c0f3ce6..57335a2 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -17,6 +17,7 @@ #include linux/platform_device.h #include linux/serial_8250.h #include linux/slab.h +#include linux/usb/ehci_pdriver.h #include asm/mach-au1x00/au1000.h #include asm/mach-au1x00/au1xxx_dbdma.h @@ -122,6 +123,25 @@ static void __init alchemy_setup_uarts(int ctype) static u64 alchemy_ohci_dmamask = DMA_BIT_MASK(32); static u64 __maybe_unused alchemy_ehci_dmamask = DMA_BIT_MASK(32); +/* Power on callback for the ehci platform driver */ +static int alchemy_ehci_power_on(struct platform_device *pdev) +{ + return alchemy_usb_control(ALCHEMY_USB_EHCI0, 1); +} + +/* Power off/suspend callback for the ehci platform driver */ +static void alchemy_ehci_power_off(struct platform_device *pdev) +{ + alchemy_usb_control(ALCHEMY_USB_EHCI0, 0); +} + +static struct usb_ehci_pdata alchemy_ehci_pdata = { + .need_io_watchdog = 0, This member doesn't exist. Thanks to get_maintainers.pl you did not get the patch that adds it, and it seems like the mailing-list archives did not get it everywhere too, I can ensure you that's is there, it's actually PATCH 6/25 of this serie. -- Florian -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 19/25] USB: ohci: remove Octeon OHCI platform driver
All users have been converted to use the OHCI platform driver instead. Signed-off-by: Florian Fainelli flor...@openwrt.org --- drivers/usb/host/Kconfig |6 +- drivers/usb/host/ohci-hcd.c|5 - drivers/usb/host/ohci-octeon.c | 214 3 files changed, 5 insertions(+), 220 deletions(-) delete mode 100644 drivers/usb/host/ohci-octeon.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 3742f73..e9c277b 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -650,12 +650,16 @@ config USB_OCTEON_EHCI supported. config USB_OCTEON_OHCI - bool Octeon on-chip OHCI support + bool Octeon on-chip OHCI support (DEPRECATED) depends on USB USB_OHCI_HCD CPU_CAVIUM_OCTEON default USB_OCTEON_EHCI select USB_OHCI_BIG_ENDIAN_MMIO select USB_OHCI_LITTLE_ENDIAN + select USB_EHCI_HCD_PLATFORM if USB_OHCI_HCD help + This option is deprecated now and the driver was removed, use + USB_OHCI_HCD_PLATFORM instead. + Enable support for the Octeon II SOC's on-chip OHCI controller. It is needed for low-speed USB 1.0 device support. All CN6XXX based chips with USB are supported. diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 5648f09..b099024 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1090,11 +1090,6 @@ MODULE_LICENSE (GPL); #define PLATFORM_DRIVERohci_hcd_jz4740_driver #endif -#ifdef CONFIG_USB_OCTEON_OHCI -#include ohci-octeon.c -#define PLATFORM_DRIVERohci_octeon_driver -#endif - #ifdef CONFIG_TILE_USB #include ohci-tilegx.c #define PLATFORM_DRIVERohci_hcd_tilegx_driver diff --git a/drivers/usb/host/ohci-octeon.c b/drivers/usb/host/ohci-octeon.c deleted file mode 100644 index d469bf9..000 --- a/drivers/usb/host/ohci-octeon.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - * EHCI HCD glue for Cavium Octeon II SOCs. - * - * Loosely based on ehci-au1xxx.c - * - * This file is subject to the terms and conditions of the GNU General Public - * License. See the file COPYING in the main directory of this archive - * for more details. - * - * Copyright (C) 2010 Cavium Networks - * - */ - -#include linux/platform_device.h - -#include asm/octeon/octeon.h -#include asm/octeon/cvmx-uctlx-defs.h - -#define OCTEON_OHCI_HCD_NAME octeon-ohci - -/* Common clock init code. */ -void octeon2_usb_clocks_start(void); -void octeon2_usb_clocks_stop(void); - -static void ohci_octeon_hw_start(void) -{ - union cvmx_uctlx_ohci_ctl ohci_ctl; - - octeon2_usb_clocks_start(); - - ohci_ctl.u64 = cvmx_read_csr(CVMX_UCTLX_OHCI_CTL(0)); - ohci_ctl.s.l2c_addr_msb = 0; - ohci_ctl.s.l2c_buff_emod = 1; /* Byte swapped. */ - ohci_ctl.s.l2c_desc_emod = 1; /* Byte swapped. */ - cvmx_write_csr(CVMX_UCTLX_OHCI_CTL(0), ohci_ctl.u64); - -} - -static void ohci_octeon_hw_stop(void) -{ - /* Undo ohci_octeon_start() */ - octeon2_usb_clocks_stop(); -} - -static int __devinit ohci_octeon_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int ret; - - ret = ohci_init(ohci); - - if (ret 0) - return ret; - - ret = ohci_run(ohci); - - if (ret 0) { - ohci_err(ohci, can't start %s, hcd-self.bus_name); - ohci_stop(hcd); - return ret; - } - - return 0; -} - -static const struct hc_driver ohci_octeon_hc_driver = { - .description= hcd_name, - .product_desc = Octeon OHCI, - .hcd_priv_size = sizeof(struct ohci_hcd), - - /* -* generic hardware linkage -*/ - .irq = ohci_irq, - .flags =HCD_USB11 | HCD_MEMORY, - - /* -* basic lifecycle operations -*/ - .start =ohci_octeon_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - - /* -* managing i/o requests and associated device resources -*/ - .urb_enqueue = ohci_urb_enqueue, - .urb_dequeue = ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - - /* -* scheduling support -*/ - .get_frame_number = ohci_get_frame, - - /* -* root hub support -*/ - .hub_status_data = ohci_hub_status_data, - .hub_control = ohci_hub_control, - - .start_port_reset = ohci_start_port_reset, -}; - -static int ohci_octeon_drv_probe(struct platform_device *pdev) -{ - struct usb_hcd *hcd; - struct ohci_hcd *ohci; - void *reg_base; - struct resource *res_mem; - int irq; - int ret; - - if (usb_disabled()) - return -ENODEV; - - irq = platform_get_irq(pdev, 0); -
Re: [PATCH 24/25] MIPS: Alchemy: use the OHCI platform driver
On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: This also greatly simplifies the power_{on,off} callbacks and make them work on platform device id instead of checking the OHCI controller base address like what was done in ohci-au1xxx.c. That was by design -- the base address is far more reliable in identifying the correct controller instance than the platform device id. There are systems in the field which don't use the alchemy/common/platform.c file at all. Manuel -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 24/25] MIPS: Alchemy: use the OHCI platform driver
On Wednesday 03 October 2012 17:21:37 Manuel Lauss wrote: On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: This also greatly simplifies the power_{on,off} callbacks and make them work on platform device id instead of checking the OHCI controller base address like what was done in ohci-au1xxx.c. That was by design -- the base address is far more reliable in identifying the correct controller instance than the platform device id. There are systems in the field which don't use the alchemy/common/platform.c file at all. Fair enough, but the way it was done previously was very error-prone if the base address changed for any reason in the platform code, and you did not notice it had to be changed in the OHCI driver too, then it simply did not work. By systems in the field you mean out of tree users? If so, I'd say that it's up to you to get them maintained or merged. -- Florian -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 24/25] MIPS: Alchemy: use the OHCI platform driver
On Wed, Oct 3, 2012 at 5:24 PM, Florian Fainelli flor...@openwrt.org wrote: On Wednesday 03 October 2012 17:21:37 Manuel Lauss wrote: On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: This also greatly simplifies the power_{on,off} callbacks and make them work on platform device id instead of checking the OHCI controller base address like what was done in ohci-au1xxx.c. That was by design -- the base address is far more reliable in identifying the correct controller instance than the platform device id. There are systems in the field which don't use the alchemy/common/platform.c file at all. Fair enough, but the way it was done previously was very error-prone if the base address changed for any reason in the platform code, and you did not notice it had to be changed in the OHCI driver too, then it simply did not Since the Alchemy line is dead this point is moot. work. By systems in the field you mean out of tree users? If so, I'd say that it's up to you to get them maintained or merged. I'm not against the patch at all, quite the contrary. Manuel -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 00/25] USB: EHCI and OHCI platform driver conversions
On Wed, 3 Oct 2012, Florian Fainelli wrote: Hi all, This patch series does trivial conversions of various EHCI and OHCI drivers in the tree. Each conversion is done in a two-step process to ensure bisectability: first register {e,o}hci-platform, then delete the old {e,o}hci platform driver and keep its Kconfig knob as deprecated. Once this series goes in, I will tackle the remaining drivers making use of clocks and add Device Tree support to the EHCI/OHCI platform drivers. It's hard to imagine that you could test all these changes. Which ones have you tested? A few of the things look slightly odd. I'll reply to individual patches to point them out. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/25] USB: ehci: allow need_io_watchdog to be passed to ehci-platform driver
On Wed, 3 Oct 2012, Florian Fainelli wrote: And convert all the existing users of ehci-platform to specify a correct need_io_watchdog value. IMO (and I realize that not everybody agrees), the patch description should not be considered an extension of the patch title, as though the title were the first sentence and the description the remainder of the same paragraph. Descriptions should stand on their own and be comprehensible even to somebody who hasn't read the title. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/ath79/dev-usb.c |2 ++ arch/mips/loongson1/common/platform.c |1 + arch/mips/netlogic/xlr/platform.c |1 + drivers/usb/host/bcma-hcd.c |1 + drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ssb-hcd.c|1 + include/linux/usb/ehci_pdriver.h |3 +++ 7 files changed, 10 insertions(+) More importantly... Nearly every driver will have need_io_watchdog set. Only a few of them explicitly turn it off. The approach you're using puts an extra burden on most of the drivers. diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci-platform.c index 764e010..08d5dec 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -32,6 +32,7 @@ static int ehci_platform_reset(struct usb_hcd *hcd) ehci-has_synopsys_hc_bug = pdata-has_synopsys_hc_bug; ehci-big_endian_desc = pdata-big_endian_desc; ehci-big_endian_mmio = pdata-big_endian_mmio; + ehci-need_io_watchdog = pdata-need_io_watchdog; --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -29,6 +29,8 @@ * initialization. * @port_power_off: set to 1 if the controller needs to be powered down * after initialization. + * @need_io_watchdog:set to 1 if the controller needs the I/O watchdog to + * run. Instead, how about adding a no_io_watchdog flag? Then after ehci-platform.c calls ehci_setup(), it can see whether to turn off ehci-need_io_watchdog. This way, most of this patch would become unnecessary. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 24/25] MIPS: Alchemy: use the OHCI platform driver
On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: This also greatly simplifies the power_{on,off} callbacks and make them work on platform device id instead of checking the OHCI controller base address like what was done in ohci-au1xxx.c. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/alchemy/common/platform.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 57335a2..cd12458 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -18,6 +18,7 @@ #include linux/serial_8250.h #include linux/slab.h #include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/mach-au1x00/au1000.h #include asm/mach-au1x00/au1xxx_dbdma.h @@ -142,6 +143,34 @@ static struct usb_ehci_pdata alchemy_ehci_pdata = { .power_suspend = alchemy_ehci_power_off, }; +/* Power on callback for the ohci platform driver */ +static int alchemy_ohci_power_on(struct platform_device *pdev) +{ + int unit; + + unit = (pdev-id == 1) ? + ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; + + return alchemy_usb_control(unit, 1); +} + +/* Power off/suspend callback for the ohci platform driver */ +static void alchemy_ohci_power_off(struct platform_device *pdev) +{ + int unit; + + unit = (pdev-id == 1) ? + ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; + + alchemy_usb_control(unit, 0); +} + +static struct usb_ohci_pdata alchemy_ohci_pdata = { + .power_on = alchemy_ohci_power_on, + .power_off = alchemy_ohci_power_off, + .power_suspend = alchemy_ohci_power_off, +}; + static unsigned long alchemy_ohci_data[][2] __initdata = { [ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT }, [ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT }, @@ -192,6 +221,7 @@ static void __init alchemy_setup_usb(int ctype) pdev-name = au1xxx-ohci; Should be ohci-platform (2x). With this change USB works on all my Alchemy boards. I'd also suggest to move drivers/usb/host/alchemy-common.c to arch/mips/alchemy/common/usb.c. (same for octeon2-common.c) Manuel -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 06/25] USB: ehci: allow need_io_watchdog to be passed to ehci-platform driver
On Wednesday 03 October 2012 12:01:22 Alan Stern wrote: On Wed, 3 Oct 2012, Florian Fainelli wrote: And convert all the existing users of ehci-platform to specify a correct need_io_watchdog value. IMO (and I realize that not everybody agrees), the patch description should not be considered an extension of the patch title, as though the title were the first sentence and the description the remainder of the same paragraph. Descriptions should stand on their own and be comprehensible even to somebody who hasn't read the title. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/ath79/dev-usb.c |2 ++ arch/mips/loongson1/common/platform.c |1 + arch/mips/netlogic/xlr/platform.c |1 + drivers/usb/host/bcma-hcd.c |1 + drivers/usb/host/ehci-platform.c |1 + drivers/usb/host/ssb-hcd.c|1 + include/linux/usb/ehci_pdriver.h |3 +++ 7 files changed, 10 insertions(+) More importantly... Nearly every driver will have need_io_watchdog set. Only a few of them explicitly turn it off. The approach you're using puts an extra burden on most of the drivers. diff --git a/drivers/usb/host/ehci-platform.c b/drivers/usb/host/ehci- platform.c index 764e010..08d5dec 100644 --- a/drivers/usb/host/ehci-platform.c +++ b/drivers/usb/host/ehci-platform.c @@ -32,6 +32,7 @@ static int ehci_platform_reset(struct usb_hcd *hcd) ehci-has_synopsys_hc_bug = pdata-has_synopsys_hc_bug; ehci-big_endian_desc = pdata-big_endian_desc; ehci-big_endian_mmio = pdata-big_endian_mmio; + ehci-need_io_watchdog = pdata-need_io_watchdog; --- a/include/linux/usb/ehci_pdriver.h +++ b/include/linux/usb/ehci_pdriver.h @@ -29,6 +29,8 @@ * initialization. * @port_power_off:set to 1 if the controller needs to be powered down * after initialization. + * @need_io_watchdog: set to 1 if the controller needs the I/O watchdog to + * run. Instead, how about adding a no_io_watchdog flag? Then after ehci-platform.c calls ehci_setup(), it can see whether to turn off ehci-need_io_watchdog. Sounds good, you are right, this also greatly reduces the chances to miss one user of this feature. This way, most of this patch would become unnecessary. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 24/25] MIPS: Alchemy: use the OHCI platform driver
On Wednesday 03 October 2012 18:07:28 Manuel Lauss wrote: On Wed, Oct 3, 2012 at 5:03 PM, Florian Fainelli flor...@openwrt.org wrote: This also greatly simplifies the power_{on,off} callbacks and make them work on platform device id instead of checking the OHCI controller base address like what was done in ohci-au1xxx.c. Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/alchemy/common/platform.c | 31 +++ 1 file changed, 31 insertions(+) diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c index 57335a2..cd12458 100644 --- a/arch/mips/alchemy/common/platform.c +++ b/arch/mips/alchemy/common/platform.c @@ -18,6 +18,7 @@ #include linux/serial_8250.h #include linux/slab.h #include linux/usb/ehci_pdriver.h +#include linux/usb/ohci_pdriver.h #include asm/mach-au1x00/au1000.h #include asm/mach-au1x00/au1xxx_dbdma.h @@ -142,6 +143,34 @@ static struct usb_ehci_pdata alchemy_ehci_pdata = { .power_suspend = alchemy_ehci_power_off, }; +/* Power on callback for the ohci platform driver */ +static int alchemy_ohci_power_on(struct platform_device *pdev) +{ + int unit; + + unit = (pdev-id == 1) ? + ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; + + return alchemy_usb_control(unit, 1); +} + +/* Power off/suspend callback for the ohci platform driver */ +static void alchemy_ohci_power_off(struct platform_device *pdev) +{ + int unit; + + unit = (pdev-id == 1) ? + ALCHEMY_USB_OHCI1 : ALCHEMY_USB_OHCI0; + + alchemy_usb_control(unit, 0); +} + +static struct usb_ohci_pdata alchemy_ohci_pdata = { + .power_on = alchemy_ohci_power_on, + .power_off = alchemy_ohci_power_off, + .power_suspend = alchemy_ohci_power_off, +}; + static unsigned long alchemy_ohci_data[][2] __initdata = { [ALCHEMY_CPU_AU1000] = { AU1000_USB_OHCI_PHYS_ADDR, AU1000_USB_HOST_INT }, [ALCHEMY_CPU_AU1500] = { AU1000_USB_OHCI_PHYS_ADDR, AU1500_USB_HOST_INT }, @@ -192,6 +221,7 @@ static void __init alchemy_setup_usb(int ctype) pdev-name = au1xxx-ohci; Should be ohci-platform (2x). With this change USB works on all my Alchemy boards. Yes, Hauke Merthens just pointed this issue at me. I'd also suggest to move drivers/usb/host/alchemy-common.c to arch/mips/alchemy/common/usb.c. (same for octeon2-common.c) Ok, sounds good. -- Florian -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/25] MIPS: Octeon: use ehci-platform driver
On 10/03/2012 08:03 AM, Florian Fainelli wrote: Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/cavium-octeon/octeon-platform.c | 43 - 1 file changed, 42 insertions(+), 1 deletion(-) NACK. OCTEON uses device tree now (or as soon as I send in the corresponding patches), so this would just be churning the code. David Daney -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 25/25] USB: ohci: remove Alchemy OHCI platform driver.
On Wed, 3 Oct 2012, Florian Fainelli wrote: All users have been converted to use the OHCI platform driver instead. The driver was also doing quirky things with the internal OHCI hcd structure during suspend/resume, work that is taken care of by the core OHCI code in ohci-hub.c. This is highly questionable. It depends on the platform's details (how wakeup signals are transmitted). -#ifdef CONFIG_PM -static int ohci_hcd_au1xxx_drv_suspend(struct device *dev) -{ - struct usb_hcd *hcd = dev_get_drvdata(dev); - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - unsigned long flags; - int rc; - - rc = 0; - - /* Root hub was already suspended. Disable irq emission and - * mark HW unaccessible, bail out if RH has been resumed. Use - * the spinlock to properly synchronize with possible pending - * RH suspend or resume activity. - */ - spin_lock_irqsave(ohci-lock, flags); - if (ohci-rh_state != OHCI_RH_SUSPENDED) { - rc = -EINVAL; - goto bail; - } This stuff about checking the root hub isn't needed. - ohci_writel(ohci, OHCI_INTR_MIE, ohci-regs-intrdisable); - (void)ohci_readl(ohci, ohci-regs-intrdisable); - - clear_bit(HCD_FLAG_HW_ACCESSIBLE, hcd-flags); But this stuff _is_ needed. The right way to do this is to move the contents of ohci_pci_suspend() and ohci_pci_resume() into ohci-hcd.c; call them ohci_suspend() and ohci_resume(). The ohci_finish_controller_resume() routine should be merged into ohci_resume(); there's no reason to have two separate functions for this. Then the platform drivers can call these new routines at the appropriate times. The part about checking that the root hub is suspended can be removed. That bug hasn't shown up in years. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 04/25] MIPS: Netlogic: use ehci-platform driver
On Wed, 3 Oct 2012, Florian Fainelli wrote: Signed-off-by: Florian Fainelli flor...@openwrt.org IMO, patches should always have a non-empty changelog. Even if it is relatively trivial. The same comment applies to several other patches in this series. --- arch/mips/netlogic/xlr/platform.c |6 ++ 1 file changed, 6 insertions(+) Does this need to enable CONFIG_USB_EHCI_HCD_PLATFORM is some defconfig file, like you did with the MIPS Loongson 1B? And likewise for quite a few of the other patches in this series. diff --git a/arch/mips/netlogic/xlr/platform.c b/arch/mips/netlogic/xlr/platform.c index 71b44d8..1731dfd 100644 --- a/arch/mips/netlogic/xlr/platform.c +++ b/arch/mips/netlogic/xlr/platform.c @@ -15,6 +15,7 @@ #include linux/serial_8250.h #include linux/serial_reg.h #include linux/i2c.h +#include linux/usb/ehci_pdriver.h #include asm/netlogic/haldefs.h #include asm/netlogic/xlr/iomap.h @@ -123,6 +124,10 @@ static u64 xls_usb_dmamask = ~(u32)0; }, \ } +static struct usb_ehci_pdata xls_usb_ehci_pdata = { + .caps_offset= 0, +}; + static struct platform_device xls_usb_ehci_device = USB_PLATFORM_DEV(ehci-xls, 0, PIC_USB_IRQ); static struct platform_device xls_usb_ohci_device_0 = @@ -172,6 +177,7 @@ int xls_platform_usb_init(void) memres = CPHYSADDR((unsigned long)usb_mmio); xls_usb_ehci_device.resource[0].start = memres; xls_usb_ehci_device.resource[0].end = memres + 0x400 - 1; + xls_usb_ehci_device.dev.platform_data = xls_usb_ehci_pdata; memres += 0x400; xls_usb_ohci_device_0.resource[0].start = memres; Don't you need to change/set the pdev name also? Likewise for patch 20/25 and 24/25. Alan Stern -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 18/25] MIPS: Octeon: use OHCI platform driver
On 10/03/2012 08:03 AM, Florian Fainelli wrote: Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/cavium-octeon/octeon-platform.c | 37 - 1 file changed, 36 insertions(+), 1 deletion(-) NACK. Same reason as for the EHCI one (09/25): OCTEON uses device tree now (or as soon as I send in the corresponding patches), so this would just be churning the code. David Daney -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFT] usb: Fix TX errors on devices with unsupported LPM states.
On Wed, Oct 03, 2012 at 09:34:43AM -0400, Don Zickus wrote: On Tue, Oct 02, 2012 at 02:42:41PM -0700, Sarah Sharp wrote: USB 3.0 devices are required to support Link PM. However, some of them don't support U1, or don't support U2, or don't support either. There is no way in the USB 3.0 specification to say that a device doesn't support U1 or U2, so these devices set the U1 or U2 exit latency to the maximum possible values (10ms for U1, 2047ms for U2). It still failed for me. :-( Can you send me the `sudo lsusb -v` output for the device? Also, please see if you can get a new cable and retest. I attached the lsusb -v output (had to use another usb3 controller to obtain it). I can't really use another cable because it comes with its own usb3 mini cable. All the other usb3 cables I have are the normal sized ones (with the fatter end). Hah, I think I see the issue: SuperSpeed USB Device Capability: bLength10 bDescriptorType16 bDevCapabilityType 3 bmAttributes 0x00 Latency Tolerance Messages (LTM) Supported wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 1 Lowest fully-functional device speed is Full Speed (12Mbps) bU1DevExitLat 0 micro seconds bU2DevExitLat 0 micro seconds The device is claiming it won't experience *any* exit latency for U1 or U2. That probably means it doesn't support U1 or U2 at all. So we need to blacklist both the max values and the min values. Patch shortly. Sarah Sharp -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 1/2] Convert ehci-hcd to a library
Hi, On Tue, Oct 02, 2012 at 04:07:08PM -0400, Alan Stern wrote: On Tue, 2 Oct 2012, Felipe Balbi wrote: --- usb-3.6.orig/drivers/usb/host/ehci.h +++ usb-3.6/drivers/usb/host/ehci.h @@ -761,26 +761,73 @@ static inline u32 hc32_to_cpup (const st /*-*/ -#ifdef CONFIG_PCI - -/* For working around the MosChip frame-index-register bug */ -static unsigned ehci_read_frame_index(struct ehci_hcd *ehci); +#define ehci_dbg(ehci, fmt, args...) \ + dev_dbg(ehci_to_hcd(ehci)-self.controller , fmt , ## args ) +#define ehci_err(ehci, fmt, args...) \ + dev_err(ehci_to_hcd(ehci)-self.controller , fmt , ## args ) +#define ehci_info(ehci, fmt, args...) \ + dev_info(ehci_to_hcd(ehci)-self.controller , fmt , ## args ) +#define ehci_warn(ehci, fmt, args...) \ + dev_warn(ehci_to_hcd(ehci)-self.controller , fmt , ## args ) +#ifdef VERBOSE_DEBUG +#define ehci_vdbg ehci_dbg How about: #define ehci_vdbg(ehci, fmt, args...) \ dev_vdbg(ehci_to_hcd(ehci)-self.controller , fmt , ## args ) That can be changed separately if anybody cares. This was just the result of simply moving code from ehci-dbg.c to ehci.h. agreed. #else - -static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci) -{ - return ehci_readl(ehci, ehci-regs-frame_index); -} - + static inline void ehci_vdbg(struct ehci_hcd *ehci, ...) {} #endif -/*-*/ - #ifndef DEBUG #define STUB_DEBUG_FILES #endif /* DEBUG */ /*-*/ +/* Declarations of things exported for use by ehci platform drivers */ + +extern const struct hc_driverehci_hc_driver; + +extern irqreturn_t ehci_irq(struct usb_hcd *hcd); + +extern int ehci_setup(struct usb_hcd *hcd); +extern int ehci_run(struct usb_hcd *hcd); +extern void ehci_stop(struct usb_hcd *hcd); +extern void ehci_shutdown(struct usb_hcd *hcd); + +extern int ehci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, + gfp_t mem_flags); +extern int ehci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, + int status); +extern void ehci_endpoint_disable(struct usb_hcd *hcd, + struct usb_host_endpoint *ep); +extern void ehci_endpoint_reset(struct usb_hcd *hcd, + struct usb_host_endpoint *ep); + +extern int ehci_get_frame(struct usb_hcd *hcd); + +extern int ehci_hub_status_data(struct usb_hcd *hcd, char *buf); +extern int ehci_hub_control(struct usb_hcd *hcd, u16 typeReq, + u16 wValue, u16 wIndex, + char *buf, u16 wLength); +extern void ehci_relinquish_port(struct usb_hcd *hcd, int portnum); +extern int ehci_port_handed_over(struct usb_hcd *hcd, int portnum); +extern void ehci_clear_tt_buffer_complete(struct usb_hcd *hcd, + struct usb_host_endpoint *ep); + +extern void ehci_port_power(struct ehci_hcd *ehci, int is_on); + +#ifdef CONFIG_PM +extern int ehci_suspend(struct usb_hcd *hcd, bool do_wakeup); +extern int ehci_resume(struct usb_hcd *hcd, bool hibernated); +extern int ehci_bus_suspend(struct usb_hcd *hcd); +extern int ehci_bus_resume(struct usb_hcd *hcd); + +#else + +#define ehci_bus_suspend NULL +#define ehci_bus_resume NULL +#endif /* CONFIG_PM */ + +extern int ehci_lpm_set_da(struct ehci_hcd *ehci, int dev_addr, int port_num); +extern int ehci_lpm_check(struct ehci_hcd *ehci, int port); this is one thing I don't like. Exposing these implementation details to another unrelated driver (ehci-{pci,omap,tegra,etc}.c is just a small bridge driver which should only be preparing the platform (be it an SoC or a Desktop) and passing correct resources for ehci core driver. This is why I would prefer to have the extra struct device for ehci core with a parent device on the bridge drivers (pci, omap, tegra, etc). We wouldn't have to expose all these details. Even though there's no difference technically, I still think it easier to understand that way. And, like I suggested before, in cases where platform needs a special callback for e.g. workaround implementation, we can allow those to be overwritten if ehci-$platform.c passes a function pointer via platform_data to ehci core driver. Let's see if I understand all this. You don't want the platform drivers to define their own hc_driver structures; instead you want the hc_driver structure to be set up by the core and have the platform drivers
[RFT] usb: Don't enable LPM if the exit latency is zero.
Hi Don, Please test this patch on top of the other patch. Sarah Sharp 8---8 Some USB 3.0 devices signal that they don't implement Link PM by having all zeroes in the U1/U2 exit latencies in their SuperSpeed BOS descriptor. Don found that a Western Digital device he has experiences transfer errors when LPM is enabled. The lsusb shows the U1/U2 exit latencies are set to zero: Binary Object Store Descriptor: bLength 5 bDescriptorType15 wTotalLength 22 bNumDeviceCaps 2 SuperSpeed USB Device Capability: bLength10 bDescriptorType16 bDevCapabilityType 3 bmAttributes 0x00 Latency Tolerance Messages (LTM) Supported wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 1 Lowest fully-functional device speed is Full Speed (12Mbps) bU1DevExitLat 0 micro seconds bU2DevExitLat 0 micro seconds The fix is to not enable LPM for a particular link state if we find its corresponding exit latency is zero. Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com Reported-by: Don Zickus dzic...@redhat.com --- drivers/usb/core/hub.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 55bef91..2568441 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3484,8 +3484,16 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, enum usb3_link_state state) { int timeout; - __u8 u1_mel; - __le16 u2_mel; + __u8 u1_mel = udev-bos-ss_cap-bU1devExitLat; + __le16 u2_mel = udev-bos-ss_cap-bU2DevExitLat; + + /* If the device says it doesn't have *any* exit latency to come out of +* U1 or U2, it's probably lying. Assume it doesn't implement that link +* state. +*/ + if ((state == USB3_LPM_U1 u1_mel == 0) || + (state == USB3_LPM_U2 u2_mel == 0)) + return; /* We allow the host controller to set the U1/U2 timeout internally * first, so that it can change its schedule to account for the @@ -3512,8 +3520,6 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, * link commands. This can cause transfer errors, so only enable * device-initiated LPM. */ - u1_mel = udev-bos-ss_cap-bU1devExitLat; - u2_mel = udev-bos-ss_cap-bU2DevExitLat; if ((state == USB3_LPM_U1 u1_mel == USB_U1_MAX_VALID_MEL) || (state == USB3_LPM_U2 le16_to_cpu(u2_mel) == USB_U2_MAX_VALID_MEL)) { -- 1.7.9 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 09/25] MIPS: Octeon: use ehci-platform driver
On Wednesday 03 October 2012 09:45:48 David Daney wrote: On 10/03/2012 08:03 AM, Florian Fainelli wrote: Signed-off-by: Florian Fainelli flor...@openwrt.org --- arch/mips/cavium-octeon/octeon-platform.c | 43 - 1 file changed, 42 insertions(+), 1 deletion(-) NACK. OCTEON uses device tree now (or as soon as I send in the corresponding patches), so this would just be churning the code. Please send the changes to enable Device Tree for EHCI and OHCI, and when both platform drivers get Device Tree capability we can easily change them. -- Florian -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFT] usb: Don't enable LPM if the exit latency is zero.
On Wed, Oct 03, 2012 at 11:29:00AM -0700, Sarah Sharp wrote: Hi Don, Please test this patch on top of the other patch. So yeah, that seemed to work. :-) Thanks! Cheers, Don Sarah Sharp 8---8 Some USB 3.0 devices signal that they don't implement Link PM by having all zeroes in the U1/U2 exit latencies in their SuperSpeed BOS descriptor. Don found that a Western Digital device he has experiences transfer errors when LPM is enabled. The lsusb shows the U1/U2 exit latencies are set to zero: Binary Object Store Descriptor: bLength 5 bDescriptorType15 wTotalLength 22 bNumDeviceCaps 2 SuperSpeed USB Device Capability: bLength10 bDescriptorType16 bDevCapabilityType 3 bmAttributes 0x00 Latency Tolerance Messages (LTM) Supported wSpeedsSupported 0x000e Device can operate at Full Speed (12Mbps) Device can operate at High Speed (480Mbps) Device can operate at SuperSpeed (5Gbps) bFunctionalitySupport 1 Lowest fully-functional device speed is Full Speed (12Mbps) bU1DevExitLat 0 micro seconds bU2DevExitLat 0 micro seconds The fix is to not enable LPM for a particular link state if we find its corresponding exit latency is zero. Signed-off-by: Sarah Sharp sarah.a.sh...@linux.intel.com Reported-by: Don Zickus dzic...@redhat.com --- drivers/usb/core/hub.c | 14 ++ 1 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 55bef91..2568441 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -3484,8 +3484,16 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, enum usb3_link_state state) { int timeout; - __u8 u1_mel; - __le16 u2_mel; + __u8 u1_mel = udev-bos-ss_cap-bU1devExitLat; + __le16 u2_mel = udev-bos-ss_cap-bU2DevExitLat; + + /* If the device says it doesn't have *any* exit latency to come out of + * U1 or U2, it's probably lying. Assume it doesn't implement that link + * state. + */ + if ((state == USB3_LPM_U1 u1_mel == 0) || + (state == USB3_LPM_U2 u2_mel == 0)) + return; /* We allow the host controller to set the U1/U2 timeout internally * first, so that it can change its schedule to account for the @@ -3512,8 +3520,6 @@ static void usb_enable_link_state(struct usb_hcd *hcd, struct usb_device *udev, * link commands. This can cause transfer errors, so only enable * device-initiated LPM. */ - u1_mel = udev-bos-ss_cap-bU1devExitLat; - u2_mel = udev-bos-ss_cap-bU2DevExitLat; if ((state == USB3_LPM_U1 u1_mel == USB_U1_MAX_VALID_MEL) || (state == USB3_LPM_U2 le16_to_cpu(u2_mel) == USB_U2_MAX_VALID_MEL)) { -- 1.7.9 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Mouse and keyboard freeze on Ivy Bridge platform
Alan Stern wrote: On Wed, 3 Oct 2012 sebastien.di...@free.fr wrote: I am encountering random keyboard and mouse freezes which can only be resolved by a hard reset (by pushing the power switch of the computer case). [...] Please build a kernel with CONFIG_USB_DEBUG enabled. When a hang occurs, get a list of hang tasks (Alt-SysRq-w probably won't work, but echo w /proc/sysrq-trigger from a network login should). Then send the dmesg output Sebastien: for reference, here's a way to build a kernel with CONFIG_USB_DEBUG enabled. # prerequisites apt-get install git build-essential # get the kernel history, if you don't already ahve it git clone \ git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git # configure cd linux cp /boot/config-$(uname -r) .config; # current configuration scripts/config --disable DEBUG_INFO make localmodconfig; # optional: minimize configuration scripts/config --enable USB_DEBUG # build, test make deb-pkg; # can use -jnum for parallel build dpkg -i ../name of package; # as root reboot Thanks, Jonathan -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [RFC 1/2] Convert ehci-hcd to a library
On Wed, 3 Oct 2012, Felipe Balbi wrote: There will be a few cases where the platform code needs to call a core routine. So we'd still need to export a few routines, but not nearly as many as I did here. I think there shouldn't be.. well, unless we need to apply some very specific workaround like OMAP's port suspend workaround where we need to switch a clock parent. In that case we need to add code to hub_control() and the best way is to do our workaround thing, then call the generic hub_control() Specifically, I was thinking of ehci_suspend, ehci_resume, ehci_setup, and ehci_port_power. Adding another layer to the device hierarchy might allow us to avoid exporting ehci_suspend and ehci_resume, but doing that would be a major change visible to userspace and I'm not convinced it would be for the best. (Also, there is the special call to ehci_pci_reinit in ehci_pci_resume _after_ ehci_resume runs -- that would be difficult to handle. Other platform drivers may have similar requirements.) Some drivers need to change a few values in the ehci_hcd structure after ehci_setup runs. Exporting it seems to be the easiest way to accomplish this. The port power stuff almost certainly isn't needed. The EHCI core driver and usbcore are responsible for managing port power anyway; the platform drivers shouldn't be concerned with it. I'm planning on removing it from the platform drivers at some point -- but for now they use it. +#ifdef CONFIG_PCI + +/* For working around the MosChip frame-index-register bug */ +static unsigned ehci_read_frame_index(struct ehci_hcd *ehci); + +#else + +static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci) +{ + return ehci_readl(ehci, ehci-regs-frame_index); +} + +#endif See this is one example. What if two other different plaforms need to work around silicon bugs on different cases ? Will we start sprinkling ifdefs in this driver again ? This isn't as significant as it appears. The #ifdef CONFIG_PCI part is just a minor optimization, because this particular quirk affects only PCI controllers. We could get rid of the inline routine entirely and use the out-of-line ehci_read_frame_index() routine on all platforms. that'll prevent certain compiler optimizations to happen, no ? I mean, do you think GCC would still inline the cases where it's really just a register read (which is just one instruction on ARM) ? No; you're right. I would much rather have something like: static const struct ehci_platform_data moschip_pci_platform_data __devinitconst = { .frame_index = moschip_pci_frame_index, [ ... ] }; static int ehci_pci_probe(struct pci_device *pci) { struct platform_device *ehci; ehci = platform_device_alloc(); [ ... ] /* check if MosChip */ ret = platform_device_add_data(ehci, moschip_pci_platform_data, sizeof(struct ehci_platform_data)); [ ... ] return 0; } Then on ehci-core, instead of adding ifdefs all over, you could: static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci) { if (unlikely(ehci-ops-frame_index)) return ehci-ops-frame_index(ehci_to_dev(ehci)); return ehci_readl(ehci, ehci-regs-frame_index); } That also is more than a single instruction, because it involves a test. But the scheme could be made to work easily enough for all platforms, although I would do it slightly differently: static inline unsigned ehci_read_frame_index(struct ehci_hcd *ehci) { if (unlikely(ehci-frame_index_bug)) return ehci_moschip_read_frame_index(ehci); return ehci_readl(ehci, ehci-regs-frame_index); } This, together with moving the ehci_info() etc. macros from ehci-dbg.c to ehci.h are simple cleanups that can be done before the real conversion. Another such cleanup involves the Link Power Management code. I don't know why ehci-lpm.c is always included in the build even though it gets used only by ehci-pci.c and ehci-vt8500.c. On the other hand, it doesn't seem to be at all system specific; LPM is part of the official spec. The ehci_update_device routine in ehci-pci.c, for example, would work on any system (although most systems don't implement LPM and so would set ehci-has_lpm to 0). Done properly, we wouldn't need to export any of the routines in ehci-lpm.c. I would rather see ehci-pci.c passing a ops structure with a set of function pointers to the core layer. As pointed out above, ehci_pci_hc_driver essentially _is_ such an ops structure. I can think of a few ways to initialize these structures. not really, because that's something ehci core should be passing to usbcore, that's the language they talk. If we need to change the implementation of what of EHCI specification says, we need to do it between ehci core and ehci-$platform. The parts of
[PATCH v3] Enable USB peripheral on dm365 EVM
From: Constantine Shulyupin co...@makelinux.com From: Miguel Aguilar miguel.agui...@ridgerun.com Signed-off-by: Constantine Shulyupin co...@makelinux.com --- Tested with usb gadget g_zero. This patch is based on code from Arago, Angstom, and RidgeRun projects. Original patch is three years ago: http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg14741.html --- arch/arm/mach-davinci/board-dm365-evm.c |8 arch/arm/mach-davinci/usb.c |2 ++ drivers/usb/musb/davinci.h |1 + drivers/usb/musb/musb_core.c| 20 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-davinci/board-dm365-evm.c b/arch/arm/mach-davinci/board-dm365-evm.c index 3a4743b..dfcb67f 100644 --- a/arch/arm/mach-davinci/board-dm365-evm.c +++ b/arch/arm/mach-davinci/board-dm365-evm.c @@ -38,6 +38,8 @@ #include mach/mmc.h #include mach/nand.h #include mach/keyscan.h +#include mach/usb.h +#include mach/hardware.h #include media/tvp514x.h @@ -92,6 +94,9 @@ static inline int have_tvp7002(void) #define CPLD_CCD_DIR3 CPLD_OFFSET(0x3f,0) #define CPLD_CCD_IO3 CPLD_OFFSET(0x3f,1) +#define USBPHY_CTL_PADDR 0x01c40034 +#define USBPHY_CLKFREQ_24MHZ BIT(13) + static void __iomem *cpld; @@ -613,6 +618,9 @@ static __init void dm365_evm_init(void) dm365_init_spi0(BIT(0), dm365_evm_spi_info, ARRAY_SIZE(dm365_evm_spi_info)); + writel(readl(IO_ADDRESS(USBPHY_CTL_PADDR)) | USBPHY_CLKFREQ_24MHZ, + IO_ADDRESS(USBPHY_CTL_PADDR)); + davinci_setup_usb(500, 8); } MACHINE_START(DAVINCI_DM365_EVM, DaVinci DM365 EVM) diff --git a/arch/arm/mach-davinci/usb.c b/arch/arm/mach-davinci/usb.c index 23d2b6d..664c689 100644 --- a/arch/arm/mach-davinci/usb.c +++ b/arch/arm/mach-davinci/usb.c @@ -49,6 +49,8 @@ static struct musb_hdrc_platform_data usb_data = { .mode = MUSB_PERIPHERAL, #elif defined(CONFIG_USB_MUSB_HOST) .mode = MUSB_HOST, +#else + .mode = MUSB_OTG, #endif .clock = usb, .config = musb_config, diff --git a/drivers/usb/musb/davinci.h b/drivers/usb/musb/davinci.h index 371baa0..e737d97 100644 --- a/drivers/usb/musb/davinci.h +++ b/drivers/usb/musb/davinci.h @@ -16,6 +16,7 @@ /* Integrated highspeed/otg PHY */ #define USBPHY_CTL_PADDR 0x01c40034 +#define USBPHY_CLKFREQ_24MHZ BIT(13) #define USBPHY_DATAPOL BIT(11) /* (dm355) switch D+/D- */ #define USBPHY_PHYCLKGDBIT(8) #define USBPHY_SESNDEN BIT(7) /* v(sess_end) comparator */ diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 26f1bef..277fe65 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2051,9 +2051,17 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) dev_info(dev, USB %s mode controller at %p using %s, IRQ %d\n, ({char *s; switch (musb-board_mode) { -case MUSB_HOST:s = Host; break; -case MUSB_PERIPHERAL: s = Peripheral; break; -default: s = OTG; break; +case MUSB_HOST: + s = Host; +break; +case MUSB_PERIPHERAL: + s = Peripheral; +break; +case MUSB_OTG: + s = OTG; +break; +default: + s = Undefined; }; s; }), ctrl, (is_dma_capable() musb-dma_controller) @@ -2402,11 +2410,7 @@ static int __init musb_init(void) if (usb_disabled()) return 0; - pr_info(%s: version MUSB_VERSION , - ?dma? - , - otg (peripheral+host), - musb_driver_name); + pr_info(%s: version %s\n, MUSB_VERSION, musb_driver_name); return platform_driver_register(musb_driver); } module_init(musb_init); -- 1.7.9.5 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3] Enable USB peripheral on dm365 EVM
On Thu, Oct 04, 2012 at 12:04:19AM +0200, co...@makelinux.com wrote: From: Constantine Shulyupin co...@makelinux.com From: Miguel Aguilar miguel.agui...@ridgerun.com Signed-off-by: Constantine Shulyupin co...@makelinux.com --- Tested with usb gadget g_zero. This patch is based on code from Arago, Angstom, and RidgeRun projects. Original patch is three years ago: http://www.mail-archive.com/davinci-linux-open-source@linux.davincidsp.com/msg14741.html You can't have two From: lines. And put the information above, in the changelog entry. Also, it looks like you are modifying printk lines for no reason, why do that in this patch? That shouldn't be needed, right? greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/2] usb: gadget: Make webcam gadget select USB_LIBCOMPOSITE
Composite gadget support is now available as a library instead of being built with each gadget. Composite drivers need to select USB_LIBCOMPOSITE. Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- drivers/usb/gadget/Kconfig |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index dfb51a4..e0ff51b 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -952,6 +952,7 @@ endif config USB_G_WEBCAM tristate USB Webcam Gadget depends on VIDEO_DEV + select USB_LIBCOMPOSITE help The Webcam Gadget acts as a composite USB Audio and Video Class device. It provides a userspace API to process UVC control requests -- 1.7.8.6 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/2] MAINTAINERS: Add maintainer entry for the USB webcam gadget
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com --- MAINTAINERS |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index d919e3d..b118b23 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7392,6 +7392,13 @@ S: Maintained F: Documentation/video4linux/w9968cf.txt F: drivers/media/video/w996* +USB WEBCAM GADGET +M: Laurent Pinchart laurent.pinch...@ideasonboard.com +L: linux-usb@vger.kernel.org +S: Maintained +F: drivers/usb/gadget/*uvc*.c +F: drivers/usb/gadget/webcam.c + USB WIRELESS RNDIS DRIVER (rndis_wlan) M: Jussi Kivilinna jussi.kivili...@mbnet.fi L: linux-wirel...@vger.kernel.org -- 1.7.8.6 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/2] USB webcam gadget driver fix for linux-next
Hi, The first patch in this series should fix the UVC gadget compilation errors in linux-next. The second patch should make sure I'll be notified next time a patch tries to break it :-) Both patches are based on Linus' tree. Laurent Pinchart (2): usb: gadget: Make webcam gadget select USB_LIBCOMPOSITE MAINTAINERS: Add maintainer entry for the USB webcam gadget MAINTAINERS|7 +++ drivers/usb/gadget/Kconfig |1 + 2 files changed, 8 insertions(+), 0 deletions(-) -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 0/2] USB webcam gadget driver fix for linux-next
On Thu, Oct 04, 2012 at 02:32:40AM +0200, Laurent Pinchart wrote: Hi, The first patch in this series should fix the UVC gadget compilation errors in linux-next. The second patch should make sure I'll be notified next time a patch tries to break it :-) Both patches are based on Linus' tree. Thanks, I'll queue these up soon. greg k-h -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/1] usb: Include generic_interrupt for OMAP2_PLUS
On Wed, Oct 3, 2012 at 7:15 PM, Philippe De Swert philippe.desw...@jollamobile.com wrote: So any comments on the approach here (see patch kept below)? Or should I immediately send it as a new patch to get the comments? I sent it in this thread as it also solves the issue I have. Patch is fine for me. Not sure if Felipe has some comments. BTW: CONFIG_SOC_OMAP3430 could be easily removed as it only changes minor things in the musb stack. It would clean up the code and get rid of this very misleading option as it has nothing to do with any OMAP3430 soc specific handling. It would be better if some OMAP3430 users can comment on this. From deae78e1084749f340ae8b8aaeca51818d5bfc55 Mon Sep 17 00:00:00 2001 From: Philippe De Swert philippe.desw...@jollamobile.com Date: Wed, 26 Sep 2012 17:00:46 +0300 Subject: [PATCH 1/1] musb: Move generic_interrupt out of the way Have all musb drivers define their own isr. Signed-off-by: Philippe De Swert philippe.desw...@jollamobile.com --- drivers/usb/musb/musb_core.c | 33 ++--- drivers/usb/musb/omap2430.c | 22 ++ drivers/usb/musb/ux500.c | 21 + 3 files changed, 45 insertions(+), 31 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 26f1bef..1d5ee34 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1496,35 +1496,6 @@ static int __devinit musb_core_init(u16 musb_type, struct musb *musb) return 0; } -/*-*/ - -#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430) || \ - defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_ARCH_U8500) - -static irqreturn_t generic_interrupt(int irq, void *__hci) -{ - unsigned long flags; - irqreturn_t retval = IRQ_NONE; - struct musb *musb = __hci; - - spin_lock_irqsave(musb-lock, flags); - - musb-int_usb = musb_readb(musb-mregs, MUSB_INTRUSB); - musb-int_tx = musb_readw(musb-mregs, MUSB_INTRTX); - musb-int_rx = musb_readw(musb-mregs, MUSB_INTRRX); - - if (musb-int_usb || musb-int_tx || musb-int_rx) - retval = musb_interrupt(musb); - - spin_unlock_irqrestore(musb-lock, flags); - - return retval; -} - -#else -#define generic_interruptNULL -#endif - /* * handle all the irqs defined by the HDRC core. for now we expect: other * irq sources (phy, dma, etc) will be handled first, musb-int_* values @@ -1907,7 +1878,8 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb-ops = plat-platform_ops; /* The musb_platform_init() call: - * - adjusts musb-mregs and musb-isr if needed, + * - adjusts musb-mregs if needed + * - sets the musb-isr * - may initialize an integrated tranceiver * - initializes musb-xceiv, usually by otg_get_phy() * - stops powering VBUS @@ -1917,7 +1889,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) * external/discrete ones in various flavors (twl4030 family, * isp1504, non-OTG, etc) mostly hooking up through ULPI. */ - musb-isr = generic_interrupt; status = musb_platform_init(musb); if (status 0) goto fail1; diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 5fdb9da..5461619d 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c @@ -306,6 +306,26 @@ static void omap_musb_mailbox_work(struct work_struct *mailbox_work) omap_musb_set_mailbox(glue); } +static irqreturn_t omap2430_musb_interrupt(int irq, void *__hci) +{ +unsigned long flags; +irqreturn_t retval = IRQ_NONE; +struct musb *musb = __hci; + +spin_lock_irqsave(musb-lock, flags); + +musb-int_usb = musb_readb(musb-mregs, MUSB_INTRUSB); +musb-int_tx = musb_readw(musb-mregs, MUSB_INTRTX); +musb-int_rx = musb_readw(musb-mregs, MUSB_INTRRX); + +if (musb-int_usb || musb-int_tx || musb-int_rx) +retval = musb_interrupt(musb); + +spin_unlock_irqrestore(musb-lock, flags); + +return retval; +} + static int omap2430_musb_init(struct musb *musb) { u32 l; @@ -325,6 +345,8 @@ static int omap2430_musb_init(struct musb *musb) return -ENODEV; } + musb-isr = omap2430_musb_interrupt; + status = pm_runtime_get_sync(dev); if (status 0) { dev_err(dev, pm_runtime_get_sync FAILED %d\n, status); diff --git a/drivers/usb/musb/ux500.c b/drivers/usb/musb/ux500.c index a8c0fad..ec9aaec 100644 --- a/drivers/usb/musb/ux500.c +++ b/drivers/usb/musb/ux500.c @@ -36,6 +36,26 @@ struct ux500_glue { }; #define glue_to_musb(g) platform_get_drvdata(g-musb) +static irqreturn_t
RE: [PATCH] usb: ehci-s5p: use clk_prepare_enable and clk_disable_unprepare
On Wednesday, October 03, 2012 8:41 AM Thomas Abraham wrote Convert clk_enable/clk_disable to clk_prepare_enable/clk_disable_unprepare calls as required by common clock framework. Signed-off-by: Thomas Abraham thomas.abra...@linaro.org It looks good. Also, I have tested this patch with Exynos4210. Acked-by: Jingoo Han jg1@samsung.com Best regards, Jingoo Han --- drivers/usb/host/ehci-s5p.c | 10 +- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/host/ehci-s5p.c b/drivers/usb/host/ehci-s5p.c index 85b74be..abc178d 100644 --- a/drivers/usb/host/ehci-s5p.c +++ b/drivers/usb/host/ehci-s5p.c @@ -136,7 +136,7 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev) goto fail_clk; } - err = clk_enable(s5p_ehci-clk); + err = clk_prepare_enable(s5p_ehci-clk); if (err) goto fail_clk; @@ -183,7 +183,7 @@ static int __devinit s5p_ehci_probe(struct platform_device *pdev) return 0; fail_io: - clk_disable(s5p_ehci-clk); + clk_disable_unprepare(s5p_ehci-clk); fail_clk: usb_put_hcd(hcd); return err; @@ -200,7 +200,7 @@ static int __devexit s5p_ehci_remove(struct platform_device *pdev) if (pdata pdata-phy_exit) pdata-phy_exit(pdev, S5P_USB_PHY_HOST); - clk_disable(s5p_ehci-clk); + clk_disable_unprepare(s5p_ehci-clk); usb_put_hcd(hcd); @@ -231,7 +231,7 @@ static int s5p_ehci_suspend(struct device *dev) if (pdata pdata-phy_exit) pdata-phy_exit(pdev, S5P_USB_PHY_HOST); - clk_disable(s5p_ehci-clk); + clk_disable_unprepare(s5p_ehci-clk); return rc; } @@ -243,7 +243,7 @@ static int s5p_ehci_resume(struct device *dev) struct platform_device *pdev = to_platform_device(dev); struct s5p_ehci_platdata *pdata = pdev-dev.platform_data; - clk_enable(s5p_ehci-clk); + clk_prepare_enable(s5p_ehci-clk); if (pdata pdata-phy_init) pdata-phy_init(pdev, S5P_USB_PHY_HOST); -- 1.7.4.1 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html