From: Jiebing Li <jiebing.li@xxxxxxxxx> Add Intel Penwell USB Device Controller Support in langwell_udc driver. This driver will support both langwell/penwell USB Device controller with this patch. Signed-off-by: Jiebing Li <jiebing.li@xxxxxxxxx> Signed-off-by: Hao Wu <hao.wu@xxxxxxxxx> --- drivers/usb/gadget/Kconfig | 4 +- drivers/usb/gadget/langwell_udc.c | 50 ++++++++++-------------------------- drivers/usb/gadget/langwell_udc.h | 2 +- include/linux/usb/langwell_udc.h | 2 +- 4 files changed, 18 insertions(+), 40 deletions(-) diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 607d0db..db84f31 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig @@ -475,11 +475,11 @@ config USB_GOKU select USB_GADGET_SELECTED config USB_GADGET_LANGWELL - boolean "Intel Langwell USB Device Controller" + boolean "Intel Langwell/Penwell USB Device Controller" depends on PCI select USB_GADGET_DUALSPEED help - Intel Langwell USB Device Controller is a High-Speed USB + Intel Langwell/Penwell USB Device Controller is a High-Speed USB On-The-Go device controller. The number of programmable endpoints is different through diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index 14db6e5..2ba3ace 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c @@ -1,6 +1,6 @@ /* - * Intel Langwell USB Device Controller driver - * Copyright (C) 2008-2009, Intel Corporation. + * Intel Langwell/Penwell USB Device Controller driver + * Copyright (C) 2008-2010, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -21,7 +21,7 @@ /* #undef DEBUG */ /* #undef VERBOSE_DEBUG */ -#if defined(CONFIG_USB_LANGWELL_OTG) +#if defined(CONFIG_USB_LANGWELL_OTG) || defined(CONFIG_USB_PENWELL_OTG) #define OTG_TRANSCEIVER #endif @@ -53,8 +53,8 @@ #include "langwell_udc.h" -#define DRIVER_DESC "Intel Langwell USB Device Controller driver" -#define DRIVER_VERSION "16 May 2009" +#define DRIVER_DESC "Intel Langwell/Penwell USB Device Controller driver" +#define DRIVER_VERSION "June 3, 2010" static const char driver_name[] = "langwell_udc"; static const char driver_desc[] = DRIVER_DESC; @@ -1552,21 +1552,6 @@ static void stop_activity(struct langwell_udc *dev, /*-------------------------------------------------------------------------*/ -/* device "function" sysfs attribute file */ -static ssize_t show_function(struct device *_dev, - struct device_attribute *attr, char *buf) -{ - struct langwell_udc *dev = the_controller; - - if (!dev->driver || !dev->driver->function - || strlen(dev->driver->function) > PAGE_SIZE) - return 0; - - return scnprintf(buf, PAGE_SIZE, "%s\n", dev->driver->function); -} -static DEVICE_ATTR(function, S_IRUGO, show_function, NULL); - - /* device "langwell_udc" sysfs attribute file */ static ssize_t show_langwell_udc(struct device *_dev, struct device_attribute *attr, char *buf) @@ -1885,10 +1870,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, return retval; } - retval = device_create_file(&dev->pdev->dev, &dev_attr_function); - if (retval) - goto err_unbind; - dev->usb_state = USB_STATE_ATTACHED; dev->ep0_state = WAIT_FOR_SETUP; dev->ep0_dir = USB_DIR_OUT; @@ -1909,14 +1890,6 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver, driver->driver.name); dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); return 0; - -err_unbind: - driver->unbind(&dev->gadget); - dev->gadget.dev.driver = NULL; - dev->driver = NULL; - - dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); - return retval; } EXPORT_SYMBOL(usb_gadget_probe_driver); @@ -1932,7 +1905,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) dev_dbg(&dev->pdev->dev, "---> %s()\n", __func__); - if (unlikely(!driver || !driver->unbind)) + if (unlikely(!driver || !driver->unbind || !driver->disconnect)) return -EINVAL; /* exit PHY low power suspend */ @@ -1962,8 +1935,6 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver) dev->gadget.dev.driver = NULL; dev->driver = NULL; - device_remove_file(&dev->pdev->dev, &dev_attr_function); - dev_info(&dev->pdev->dev, "unregistered driver '%s'\n", driver->driver.name); dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); @@ -2804,7 +2775,7 @@ static void handle_bus_suspend(struct langwell_udc *dev) /* enter PHY low power suspend */ if (dev->pdev->device != 0x0829) - langwell_phy_low_power(dev, 0); + langwell_phy_low_power(dev, 1); dev_dbg(&dev->pdev->dev, "<--- %s()\n", __func__); } @@ -3507,6 +3478,13 @@ static const struct pci_device_id pci_ids[] = { { .device = 0x0811, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, +}, { + .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), + .class_mask = ~0, + .vendor = 0x8086, + .device = 0x0829, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, }, { /* end: all zeroes */ } }; diff --git a/drivers/usb/gadget/langwell_udc.h b/drivers/usb/gadget/langwell_udc.h index 988d6d1..cf77d63 100644 --- a/drivers/usb/gadget/langwell_udc.h +++ b/drivers/usb/gadget/langwell_udc.h @@ -1,5 +1,5 @@ /* - * Intel Langwell USB Device Controller driver + * Intel Langwell/Penwell USB Device Controller driver * Copyright (C) 2008-2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it diff --git a/include/linux/usb/langwell_udc.h b/include/linux/usb/langwell_udc.h index 2d2d1bb..ab959cb 100644 --- a/include/linux/usb/langwell_udc.h +++ b/include/linux/usb/langwell_udc.h @@ -1,5 +1,5 @@ /* - * Intel Langwell USB Device Controller driver + * Intel Langwell/Penwell USB Device Controller driver * Copyright (C) 2008-2009, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it -- 1.6.0.6 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html