[PATCH v2 2/2] arm/dts: omap4: Add ocp2scp data

2012-07-18 Thread Kishon Vijay Abraham I
Add ocp2scp data node in omap4 device tree file.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/omap4.dtsi |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 359c497..29c6243 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -272,5 +272,13 @@
ti,hwmods = mmc5;
ti,needs-special-reset;
};
+
+   ocp2scp {
+   compatible = ti,omap-ocp2scp;
+   #address-cells = 1;
+   #size-cells = 1;
+   ranges;
+   ti,hwmods = ocp2scp_usb_phy;
+   };
};
 };
-- 
1.7.5.4

--
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 v2 1/2] drivers: bus: add a new driver for omap-ocp2scp

2012-07-18 Thread Kishon Vijay Abraham I
Adds a new driver *omap-ocp2scp*. This driver takes the responsibility of
creating all the devices that is connected to OCP2SCP. In the case of OMAP4,
USB2PHY is connected to ocp2scp.

This also includes device tree support for ocp2scp driver and
the documentation with device tree binding information is updated.

Cc: Felipe Balbi ba...@ti.com
Acked-by: Arnd Bergmann a...@arndb.de
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/bus/omap-ocp2scp.txt   |   10 ++
 drivers/Kconfig|2 +
 drivers/Makefile   |2 +
 drivers/bus/Kconfig|   15 +++
 drivers/bus/Makefile   |5 +
 drivers/bus/omap-ocp2scp.c |   98 
 6 files changed, 132 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
 create mode 100644 drivers/bus/Kconfig
 create mode 100644 drivers/bus/Makefile
 create mode 100644 drivers/bus/omap-ocp2scp.c

diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt 
b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
new file mode 100644
index 000..d2fe064
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
@@ -0,0 +1,10 @@
+* OMAP OCP2SCP - ocp interface to scp interface
+
+properties:
+- compatible : Should be ti,omap-ocp2scp
+- #address-cells, #size-cells : Must be present if the device has sub-nodes
+- ranges : the child address space are mapped 1:1 onto the parent address space
+- ti,hwmods : must be ocp2scp_usb_phy
+
+Sub-nodes:
+All the devices connected to ocp2scp are described using sub-node to ocp2scp
diff --git a/drivers/Kconfig b/drivers/Kconfig
index bfc9186..4fe1e4c 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -2,6 +2,8 @@ menu Device Drivers
 
 source drivers/base/Kconfig
 
+source drivers/bus/Kconfig
+
 source drivers/connector/Kconfig
 
 source drivers/mtd/Kconfig
diff --git a/drivers/Makefile b/drivers/Makefile
index 2ba29ff..cac3819 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -5,6 +5,8 @@
 # Rewritten to use lists instead of if-statements.
 #
 
+obj-y  += bus/
+
 # GPIO must come after pinctrl as gpios may need to mux pins etc
 obj-y  += pinctrl/
 obj-y  += gpio/
diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
new file mode 100644
index 000..6270415
--- /dev/null
+++ b/drivers/bus/Kconfig
@@ -0,0 +1,15 @@
+#
+# Bus Devices
+#
+
+menu Bus devices
+
+config OMAP_OCP2SCP
+   tristate OMAP OCP2SCP DRIVER
+   help
+ Driver to enable ocp2scp module which transforms ocp interface
+ protocol to scp protocol. In OMAP4, USB PHY is connected via
+ OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
+ OCP2SCP.
+
+endmenu
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
new file mode 100644
index 000..0ec50bc
--- /dev/null
+++ b/drivers/bus/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for the bus drivers.
+#
+
+obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o
diff --git a/drivers/bus/omap-ocp2scp.c b/drivers/bus/omap-ocp2scp.c
new file mode 100644
index 000..8c3db3a
--- /dev/null
+++ b/drivers/bus/omap-ocp2scp.c
@@ -0,0 +1,98 @@
+/*
+ * omap-ocp2scp.c - transform ocp interface protocol to scp protocol
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I kis...@ti.com
+ *
+ * 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/err.h
+#include linux/pm_runtime.h
+#include linux/of.h
+#include linux/of_platform.h
+
+static int ocp2scp_remove_devices(struct device *dev, void *c)
+{
+   struct platform_device *pdev = to_platform_device(dev);
+
+   platform_device_unregister(pdev);
+
+   return 0;
+}
+
+static int __devinit omap_ocp2scp_probe(struct platform_device *pdev)
+{
+   int ret;
+   struct device_node  *np = pdev-dev.of_node;
+
+   if (np) {
+   ret = of_platform_populate(np, NULL, NULL, pdev-dev);
+   if (ret) {
+   dev_err(pdev-dev, failed to add resources for 
ocp2scp child\n);
+   goto err0;
+   }
+   }
+   pm_runtime_enable(pdev-dev);
+
+   return 0;
+
+err0:
+   device_for_each_child(pdev-dev, NULL, 

[PATCH v3 03/11] drivers: usb: otg: make twl6030_usb as a comparator driver to omap_usb2

2012-07-18 Thread Kishon Vijay Abraham I
All the PHY configuration other than VBUS, ID GND and OTG SRP are removed
from twl6030. The phy configurations are taken care by the dedicated
usb2 phy driver. So twl6030 is made as comparator driver for VBUS and
ID detection.

Writing to control module which is now handled in omap2430.c should be
removed once a driver for control module is in place.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 drivers/usb/musb/omap2430.c   |   52 ---
 drivers/usb/musb/omap2430.h   |9 +++
 drivers/usb/otg/twl6030-usb.c |  114 +
 3 files changed, 67 insertions(+), 108 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 5fdb9da..addbebf 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -44,6 +44,7 @@ struct omap2430_glue {
struct platform_device  *musb;
enum omap_musb_vbus_id_status status;
struct work_struct  omap_musb_mailbox_work;
+   u32 __iomem *control_otghs;
 };
 #define glue_to_musb(g)platform_get_drvdata(g-musb)
 
@@ -51,6 +52,26 @@ struct omap2430_glue *_glue;
 
 static struct timer_list musb_idle_timer;
 
+/**
+ * omap4_usb_phy_mailbox - write to usb otg mailbox
+ * @glue: struct omap2430_glue *
+ * @val: the value to be written to the mailbox
+ *
+ * On detection of a device (ID pin is grounded), this API should be called
+ * to set AVALID, VBUSVALID and ID pin is grounded.
+ *
+ * When OMAP is connected to a host (OMAP in device mode), this API
+ * is called to set AVALID, VBUSVALID and ID pin in high impedance.
+ *
+ * XXX: This function will be removed once we have a seperate driver for
+ * control module
+ */
+static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
+{
+   if (glue-control_otghs)
+   writel(val, glue-control_otghs);
+}
+
 static void musb_do_idle(unsigned long _musb)
 {
struct musb *musb = (void *)_musb;
@@ -245,6 +266,7 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
+   u32 val;
struct musb *musb = glue_to_musb(glue);
struct device *dev = musb-controller;
struct musb_hdrc_platform_data *pdata = dev-platform_data;
@@ -260,7 +282,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
musb-xceiv-last_event = USB_EVENT_ID;
if (!is_otg_enabled(musb) || musb-gadget_driver) {
pm_runtime_get_sync(dev);
-   usb_phy_init(musb-xceiv);
+   val = AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
omap2430_musb_set_vbus(musb, 1);
}
break;
@@ -273,7 +296,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
musb-xceiv-last_event = USB_EVENT_VBUS;
if (musb-gadget_driver)
pm_runtime_get_sync(dev);
-   usb_phy_init(musb-xceiv);
+   val = IDDIG | AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
break;
 
case OMAP_MUSB_ID_FLOAT:
@@ -291,7 +315,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
if (musb-xceiv-otg-set_vbus)
otg_set_vbus(musb-xceiv-otg, 0);
}
-   usb_phy_shutdown(musb-xceiv);
+   val = SESSEND | IDDIG;
+   omap4_usb_phy_mailbox(glue, val);
break;
default:
dev_dbg(dev, ID float\n);
@@ -366,6 +391,7 @@ err1:
 static void omap2430_musb_enable(struct musb *musb)
 {
u8  devctl;
+   u32 val;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct device *dev = musb-controller;
struct omap2430_glue *glue = dev_get_drvdata(dev-parent);
@@ -375,7 +401,8 @@ static void omap2430_musb_enable(struct musb *musb)
switch (glue-status) {
 
case OMAP_MUSB_ID_GROUND:
-   usb_phy_init(musb-xceiv);
+   val = AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
if (data-interface_type != MUSB_INTERFACE_UTMI)
break;
devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
@@ -394,7 +421,8 @@ static void omap2430_musb_enable(struct musb *musb)
break;
 
case OMAP_MUSB_VBUS_VALID:
-   usb_phy_init(musb-xceiv);
+   val = IDDIG | AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
break;
 
default:
@@ -404,11 +432,14 @@ static void omap2430_musb_enable(struct musb *musb)
 
 static void omap2430_musb_disable(struct musb *musb)
 {
+   u32 val;
struct device *dev = musb-controller;
struct omap2430_glue *glue = 

[PATCH v3 01/11] drivers: usb: otg: add a new driver for omap usb2 phy

2012-07-18 Thread Kishon Vijay Abraham I
All phy related programming like enabling/disabling the clocks, powering
on/off the phy is taken care of by this driver. It is also used for OTG
related functionality like srp.

This also includes device tree support for usb2 phy driver and
the documentation with device tree binding information is updated.

Currently writing to control module register is taken care in this
driver which will be removed once the control module driver is in place.

Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/bus/omap-ocp2scp.txt   |3 +
 Documentation/devicetree/bindings/usb/omap-usb.txt |   16 ++
 drivers/usb/otg/Kconfig|   10 +
 drivers/usb/otg/Makefile   |1 +
 drivers/usb/otg/omap-usb2.c|  271 
 include/linux/usb/omap_usb.h   |   45 
 include/linux/usb/phy_companion.h  |   34 +++
 7 files changed, 380 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
 create mode 100644 drivers/usb/otg/omap-usb2.c
 create mode 100644 include/linux/usb/omap_usb.h
 create mode 100644 include/linux/usb/phy_companion.h

diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt 
b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
index d2fe064..bb0c7f4 100644
--- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
+++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
@@ -8,3 +8,6 @@ properties:
 
 Sub-nodes:
 All the devices connected to ocp2scp are described using sub-node to ocp2scp
+- usb2phy :
+   The binding details of usb2phy can be found in:
+   Documentation/devicetree/bindings/usb/omap-usb.txt
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
new file mode 100644
index 000..80a28c9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -0,0 +1,16 @@
+OMAP USB PHY
+
+OMAP USB2 PHY
+
+Required properties:
+ - compatible: Should be ti,omap-usb2
+ - reg : Address and length of the register set for the device. Also
+add the address of control module dev conf register until a driver for
+control module is added
+
+This is usually a subnode of ocp2scp to which it is connected.
+
+usb2phy@0x4a0ad080 {
+   compatible = ti,omap-usb2;
+   reg = 0x4a0ad080 0x58;
+};
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index 5c87db0..c751db7 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -78,6 +78,16 @@ config TWL6030_USB
  are hooked to this driver through platform_data structure.
  The definition of internal PHY APIs are in the mach-omap2 layer.
 
+config OMAP_USB2
+   tristate OMAP USB2 PHY Driver
+   depends on OMAP_OCP2SCP
+   select USB_OTG_UTILS
+   help
+ Enable this to support the transceiver that is part of SOC. This
+ driver takes care of all the PHY functionality apart from comparator.
+ The USB OTG controller communicates with the comparator using this
+ driver.
+
 config NOP_USB_XCEIV
tristate NOP USB Transceiver Driver
select USB_OTG_UTILS
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile
index 41aa509..2c2a3ca 100644
--- a/drivers/usb/otg/Makefile
+++ b/drivers/usb/otg/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_GPIO_VBUS)   += gpio_vbus.o
 obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
 obj-$(CONFIG_TWL4030_USB)  += twl4030-usb.o
 obj-$(CONFIG_TWL6030_USB)  += twl6030-usb.o
+obj-$(CONFIG_OMAP_USB2)+= omap-usb2.o
 obj-$(CONFIG_NOP_USB_XCEIV)+= nop-usb-xceiv.o
 obj-$(CONFIG_USB_ULPI) += ulpi.o
 obj-$(CONFIG_USB_ULPI_VIEWPORT)+= ulpi_viewport.o
diff --git a/drivers/usb/otg/omap-usb2.c b/drivers/usb/otg/omap-usb2.c
new file mode 100644
index 000..2f9e257
--- /dev/null
+++ b/drivers/usb/otg/omap-usb2.c
@@ -0,0 +1,271 @@
+/*
+ * omap-usb2.c - USB PHY, talking to musb controller in OMAP.
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I kis...@ti.com
+ *
+ * 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/slab.h
+#include linux/of.h
+#include linux/io.h
+#include linux/usb/omap_usb.h
+#include linux/usb/phy_companion.h
+#include linux/clk.h
+#include linux/err.h
+#include 

[PATCH v3 06/11] arm/dts: Add twl6030-usb data

2012-07-18 Thread Kishon Vijay Abraham I
Add twl6030-usb data node in twl6030 device tree file

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/omap4-panda.dts |4 
 arch/arm/boot/dts/omap4-sdp.dts   |4 
 arch/arm/boot/dts/twl6030.dtsi|6 ++
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4-panda.dts 
b/arch/arm/boot/dts/omap4-panda.dts
index 1efe0c5..7052422 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -89,3 +89,7 @@
ti,non-removable;
bus-width = 4;
 };
+
+twlusb {
+   usb-supply = vusb;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index d08c4d1..6326d7c 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -158,3 +158,7 @@
bus-width = 4;
ti,non-removable;
 };
+
+twlusb {
+   usb-supply = vusb;
+};
diff --git a/arch/arm/boot/dts/twl6030.dtsi b/arch/arm/boot/dts/twl6030.dtsi
index 3b2f351..5efd6d3 100644
--- a/arch/arm/boot/dts/twl6030.dtsi
+++ b/arch/arm/boot/dts/twl6030.dtsi
@@ -83,4 +83,10 @@
clk32kg: regulator@12 {
compatible = ti,twl6030-clk32kg;
};
+
+   twlusb: twl6030-usb {
+   compatible = ti,twl6030-usb;
+   interrupts =  4 10 ;
+   regulator = vusb;
+   };
 };
-- 
1.7.5.4

--
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 v3 05/11] drivers: usb: twl6030: Add dt support for twl6030 usb

2012-07-18 Thread Kishon Vijay Abraham I
Add device tree support for twl6030 usb driver.
Update the Documentation with device tree binding information.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/usb/twl-usb.txt|   22 +++
 drivers/usb/otg/twl6030-usb.c  |   39 +---
 2 files changed, 48 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/twl-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/twl-usb.txt 
b/Documentation/devicetree/bindings/usb/twl-usb.txt
new file mode 100644
index 000..e3f6d73
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/twl-usb.txt
@@ -0,0 +1,22 @@
+USB COMPARATOR OF TWL CHIPS
+
+TWL6030 USB COMPARATOR
+ - compatible : Should be ti,twl6030-usb
+ - interrupts : Two interrupt numbers to the cpu should be specified. First
+   interrupt number is the otg interrupt number that raises ID interrupts when
+   the controller has to act as host and the second interrupt number is the
+   usb interrupt number that raises VBUS interrupts when the controller has to
+   act as device
+ - usb-supply : phandle to the regulator device tree node. It should be vusb
+   if it is twl6030 or ldousb if it is twl6025 subclass.
+
+twl6030-usb {
+   compatible = ti,twl6030-usb;
+   interrupts =  4 10 ;
+   regulator = vusb;
+};
+
+Board specific device node entry
+twl6030-usb {
+   usb-supply = vusb;
+};
diff --git a/drivers/usb/otg/twl6030-usb.c b/drivers/usb/otg/twl6030-usb.c
index 9994dd22..6b0d0a1 100644
--- a/drivers/usb/otg/twl6030-usb.c
+++ b/drivers/usb/otg/twl6030-usb.c
@@ -105,7 +105,7 @@ struct twl6030_usb {
u8  asleep;
boolirq_enabled;
boolvbus_enable;
-   unsigned long   features;
+   const char  *regulator;
 };
 
 #definecomparator_to_twl(x) container_of((x), struct twl6030_usb, 
comparator)
@@ -153,13 +153,6 @@ static int twl6030_start_srp(struct phy_companion 
*comparator)
 
 static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
 {
-   char *regulator_name;
-
-   if (twl-features  TWL6025_SUBCLASS)
-   regulator_name = ldousb;
-   else
-   regulator_name = vusb;
-
/* Set to OTG_REV 1.3 and turn on the ID_WAKEUP_COMP */
twl6030_writeb(twl, TWL6030_MODULE_ID0 , 0x1, TWL6030_BACKUP_REG);
 
@@ -169,7 +162,7 @@ static int twl6030_usb_ldo_init(struct twl6030_usb *twl)
/* Program MISC2 register and set bit VUSB_IN_VBAT */
twl6030_writeb(twl, TWL6030_MODULE_ID0 , 0x10, TWL6030_MISC2);
 
-   twl-usb3v3 = regulator_get(twl-dev, regulator_name);
+   twl-usb3v3 = regulator_get(twl-dev, twl-regulator);
if (IS_ERR(twl-usb3v3))
return -ENODEV;
 
@@ -321,9 +314,9 @@ static int __devinit twl6030_usb_probe(struct 
platform_device *pdev)
 {
struct twl6030_usb  *twl;
int status, err;
-   struct twl4030_usb_data *pdata;
-   struct device *dev = pdev-dev;
-   pdata = dev-platform_data;
+   struct device_node  *np = pdev-dev.of_node;
+   struct device   *dev = pdev-dev;
+   struct twl4030_usb_data *pdata = dev-platform_data;
 
twl = devm_kzalloc(dev, sizeof *twl, GFP_KERNEL);
if (!twl)
@@ -332,13 +325,24 @@ static int __devinit twl6030_usb_probe(struct 
platform_device *pdev)
twl-dev= pdev-dev;
twl-irq1   = platform_get_irq(pdev, 0);
twl-irq2   = platform_get_irq(pdev, 1);
-   twl-features   = pdata-features;
twl-linkstat   = OMAP_MUSB_UNKNOWN;
 
twl-comparator.set_vbus= twl6030_set_vbus;
twl-comparator.start_srp   = twl6030_start_srp;
omap_usb2_set_comparator(twl-comparator);
 
+   if (np) {
+   twl-regulator = usb;
+   } else if (pdata) {
+   if (pdata-features  TWL6025_SUBCLASS)
+   twl-regulator = ldousb;
+   else
+   twl-regulator = vusb;
+   } else {
+   dev_err(pdev-dev, twl6030 initialized without pdata\n);
+   return -EINVAL;
+   }
+
/* init spinlock for workqueue */
spin_lock_init(twl-lock);
 
@@ -400,12 +404,21 @@ static int __exit twl6030_usb_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id twl6030_usb_id_table[] = {
+   { .compatible = ti,twl6030-usb },
+   {}
+};
+MODULE_DEVICE_TABLE(of, twl6030_usb_id_table);
+#endif
+
 static struct platform_driver twl6030_usb_driver = {
.probe  = twl6030_usb_probe,
.remove = __exit_p(twl6030_usb_remove),
.driver = {
.name   = twl6030_usb,
.owner  = THIS_MODULE,
+   .of_match_table = 

[PATCH v3 08/11] arm/dts: Add twl4030-usb data

2012-07-18 Thread Kishon Vijay Abraham I
Add twl4030-usb data node in twl4030 device tree file.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/twl4030.dtsi |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index 22f4d13..761a5a5 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -37,6 +37,18 @@
regulator-max-microvolt = 315;
};
 
+   vusb1v5: regulator-vusb1v5 {
+   compatible = ti,twl4030-vusb1v5;
+   };
+
+   vusb1v8: regulator-vusb1v8 {
+   compatible = ti,twl4030-vusb1v8;
+   };
+
+   vusb3v1: regulator-vusb3v1 {
+   compatible = ti,twl4030-vusb3v1;
+   };
+
twl_gpio: gpio {
compatible = ti,twl4030-gpio;
gpio-controller;
@@ -44,4 +56,13 @@
interrupt-controller;
#interrupt-cells = 1;
};
+
+   twl4030-usb {
+   compatible = ti,twl4030-usb;
+   interrupts =  10 4 ;
+   usb1v5-supply = vusb1v5;
+   usb1v8-supply = vusb1v8;
+   usb3v1-supply = vusb3v1;
+   usb_mode = 1;
+   };
 };
-- 
1.7.5.4

--
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 v3 04/11] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-07-18 Thread Kishon Vijay Abraham I
The mailbox register for usb otg in omap is present in control module.
On detection of any events VBUS or ID, this register should be written
to send the notification to musb core.

Till we have a separate control module driver to write to control module,
omap2430 will handle the register writes to control module by itself. So
a new address space to represent this control module register is added
to usb_otg_hs.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index ba24d15..c50d828 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5922,6 +5922,11 @@ static struct omap_hwmod_addr_space 
omap44xx_usb_otg_hs_addrs[] = {
.pa_end = 0x4a0ab7ff,
.flags  = ADDR_TYPE_RT
},
+   {
+   .pa_start   = 0x4a00233c,
+   .pa_end = 0x4a00233f,
+   .flags  = ADDR_TYPE_RT
+   },
{ }
 };
 
-- 
1.7.5.4

--
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 v3 07/11] drivers: usb: twl4030: Add device tree support for twl4030 usb

2012-07-18 Thread Kishon Vijay Abraham I
Add device tree support for twl4030 usb driver.
Update the Documentation with device tree binding information.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/usb/twl-usb.txt|   19 ++
 drivers/usb/otg/twl4030-usb.c  |   26 +++
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/twl-usb.txt 
b/Documentation/devicetree/bindings/usb/twl-usb.txt
index e3f6d73..bdf1dd4 100644
--- a/Documentation/devicetree/bindings/usb/twl-usb.txt
+++ b/Documentation/devicetree/bindings/usb/twl-usb.txt
@@ -20,3 +20,22 @@ Board specific device node entry
 twl6030-usb {
usb-supply = vusb;
 };
+
+TWL4030 USB PHY AND COMPARATOR
+ - compatible : Should be ti,twl4030-usb
+ - interrupts : The interrupt numbers to the cpu should be specified. First
+   interrupt number is the otg interrupt number that raises ID interrupts
+   and VBUS interrupts. The second interrupt number is optional.
+ - supply-name-supply : phandle to the regulator device tree node.
+   supply-name should be vusb1v5, vusb1v8 and vusb3v1
+ - usb_mode : The mode used by the phy to connect to the controller. 1
+   specifies ULPI mode and 2 specifies CEA2011_3PIN mode.
+
+twl4030-usb {
+   compatible = ti,twl4030-usb;
+   interrupts =  10 4 ;
+   usb1v5-supply = vusb1v5;
+   usb1v8-supply = vusb1v8;
+   usb3v1-supply = vusb3v1;
+   usb_mode = 1;
+};
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 523cad5..f0d2e75 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -585,23 +585,28 @@ static int __devinit twl4030_usb_probe(struct 
platform_device *pdev)
struct twl4030_usb  *twl;
int status, err;
struct usb_otg  *otg;
-
-   if (!pdata) {
-   dev_dbg(pdev-dev, platform_data not available\n);
-   return -EINVAL;
-   }
+   struct device_node  *np = pdev-dev.of_node;
 
twl = devm_kzalloc(pdev-dev, sizeof *twl, GFP_KERNEL);
if (!twl)
return -ENOMEM;
 
+   if (np)
+   of_property_read_u32(np, usb_mode,
+   (enum twl4030_usb_mode *)twl-usb_mode);
+   else if (pdata)
+   twl-usb_mode = pdata-usb_mode;
+   else {
+   dev_err(pdev-dev, twl4030 initialized without pdata\n);
+   return -EINVAL;
+   }
+
otg = devm_kzalloc(pdev-dev, sizeof *otg, GFP_KERNEL);
if (!otg)
return -ENOMEM;
 
twl-dev= pdev-dev;
twl-irq= platform_get_irq(pdev, 0);
-   twl-usb_mode   = pdata-usb_mode;
twl-vbus_supplied  = false;
twl-asleep = 1;
twl-linkstat   = OMAP_MUSB_UNKNOWN;
@@ -690,12 +695,21 @@ static int __exit twl4030_usb_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id twl4030_usb_id_table[] = {
+   { .compatible = ti,twl4030-usb },
+   {}
+};
+MODULE_DEVICE_TABLE(of, twl4030_usb_id_table);
+#endif
+
 static struct platform_driver twl4030_usb_driver = {
.probe  = twl4030_usb_probe,
.remove = __exit_p(twl4030_usb_remove),
.driver = {
.name   = twl4030_usb,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(twl4030_usb_id_table),
},
 };
 
-- 
1.7.5.4

--
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 v3 09/11] drivers: usb: musb: Add device tree support for omap musb glue

2012-07-18 Thread Kishon Vijay Abraham I
Added device tree support for omap musb driver and updated the
Documentation with device tree binding information.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 Documentation/devicetree/bindings/usb/omap-usb.txt |   34 -
 drivers/usb/musb/omap2430.c|   55 
 2 files changed, 88 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
index 80a28c9..39cdffb 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -1,4 +1,4 @@
-OMAP USB PHY
+OMAP USB PHY AND GLUE
 
 OMAP USB2 PHY
 
@@ -14,3 +14,35 @@ usb2phy@0x4a0ad080 {
compatible = ti,omap-usb2;
reg = 0x4a0ad080 0x58;
 };
+
+OMAP MUSB GLUE
+ - compatible : Should be ti,musb-omap2430
+ - ti,hwmods : must be usb_otg_hs
+ - multipoint : Should be 1 indicating the musb controller supports
+   multipoint. This is a MUSB configuration-specific setting.
+ - num_eps : Specifies the number of endpoints. This is also a
+   MUSB configuration-specific setting. Should be set to 16
+ - ram_bits : Specifies the ram address size. Should be set to 12
+ - interface_type : This is a board specific setting to describe the type of
+   interface between the controller and the phy. It should be 0 or 1
+   specifying ULPI and UTMI respectively.
+ - mode : Should be 3 to represent OTG. 1 signifies HOST and 2
+   represents PERIPHERAL.
+ - power : Should be 50. This signifies the controller can supply upto
+   100mA when operating in host mode.
+
+SOC specific device node entry
+usb_otg_hs: usb_otg_hs@4a0ab000 {
+   compatible = ti,musb-omap2430;
+   ti,hwmods = usb_otg_hs;
+   multipoint = 1;
+   num_eps = 16;
+   ram_bits = 12;
+};
+
+Board specific device node entry
+usb_otg_hs {
+   interface_type = 1;
+   mode = 3;
+   power = 50;
+};
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index addbebf..331e477 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -30,6 +30,7 @@
 #include linux/init.h
 #include linux/list.h
 #include linux/io.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/dma-mapping.h
 #include linux/pm_runtime.h
@@ -469,8 +470,11 @@ static u64 omap2430_dmamask = DMA_BIT_MASK(32);
 static int __devinit omap2430_probe(struct platform_device *pdev)
 {
struct musb_hdrc_platform_data  *pdata = pdev-dev.platform_data;
+   struct omap_musb_board_data *data;
struct platform_device  *musb;
struct omap2430_glue*glue;
+   struct device_node  *np = pdev-dev.of_node;
+   struct musb_hdrc_config *config;
struct resource *res;
int ret = -ENOMEM;
 
@@ -500,6 +504,43 @@ static int __devinit omap2430_probe(struct platform_device 
*pdev)
if (glue-control_otghs == NULL)
dev_dbg(pdev-dev, Failed to obtain control memory\n);
 
+   if (np) {
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(pdev-dev,
+   failed to allocate musb platfrom data\n);
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
+   if (!data) {
+   dev_err(pdev-dev,
+   failed to allocate musb board data\n);
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL);
+   if (!data) {
+   dev_err(pdev-dev,
+   failed to allocate musb hdrc config\n);
+   goto err1;
+   }
+
+   of_property_read_u32(np, mode, (u32 *)pdata-mode);
+   of_property_read_u32(np, interface_type,
+   (u32 *)data-interface_type);
+   of_property_read_u32(np, num_eps, (u32 *)config-num_eps);
+   of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits);
+   of_property_read_u32(np, mode, (u32 *)pdata-mode);
+   of_property_read_u32(np, power, (u32 *)pdata-power);
+   config-multipoint = of_property_read_bool(np, multipoint);
+
+   pdata-board_data   = data;
+   pdata-config   = config;
+   }
+
pdata-platform_ops = omap2430_ops;
 
platform_set_drvdata(pdev, glue);
@@ -597,12 +638,26 @@ static struct dev_pm_ops omap2430_pm_ops = {
 #define DEV_PM_OPS NULL
 #endif
 
+#ifdef CONFIG_OF
+static const struct of_device_id omap2430_id_table[] = {
+   {
+  

[PATCH v3 11/11] arm: omap: phy: remove unused functions from omap-phy-internal.c

2012-07-18 Thread Kishon Vijay Abraham I
All the unnessary functions in omap-phy-internal is removed.
These functionality are now handled by omap-usb2 phy driver.

Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/omap_phy_internal.c |  138 ---
 arch/arm/mach-omap2/twl-common.c|5 -
 arch/arm/mach-omap2/usb-musb.c  |3 -
 3 files changed, 0 insertions(+), 146 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_phy_internal.c 
b/arch/arm/mach-omap2/omap_phy_internal.c
index d52651a..874aecc 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -31,144 +31,6 @@
 #include plat/usb.h
 #include control.h
 
-/* OMAP control module register for UTMI PHY */
-#define CONTROL_DEV_CONF   0x300
-#define PHY_PD 0x1
-
-#define USBOTGHS_CONTROL   0x33c
-#defineAVALID  BIT(0)
-#defineBVALID  BIT(1)
-#defineVBUSVALID   BIT(2)
-#defineSESSEND BIT(3)
-#defineIDDIG   BIT(4)
-
-static struct clk *phyclk, *clk48m, *clk32k;
-static void __iomem *ctrl_base;
-static int usbotghs_control;
-
-int omap4430_phy_init(struct device *dev)
-{
-   ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
-   if (!ctrl_base) {
-   pr_err(control module ioremap failed\n);
-   return -ENOMEM;
-   }
-   /* Power down the phy */
-   __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-
-   if (!dev) {
-   iounmap(ctrl_base);
-   return 0;
-   }
-
-   phyclk = clk_get(dev, ocp2scp_usb_phy_ick);
-   if (IS_ERR(phyclk)) {
-   dev_err(dev, cannot clk_get ocp2scp_usb_phy_ick\n);
-   iounmap(ctrl_base);
-   return PTR_ERR(phyclk);
-   }
-
-   clk48m = clk_get(dev, ocp2scp_usb_phy_phy_48m);
-   if (IS_ERR(clk48m)) {
-   dev_err(dev, cannot clk_get ocp2scp_usb_phy_phy_48m\n);
-   clk_put(phyclk);
-   iounmap(ctrl_base);
-   return PTR_ERR(clk48m);
-   }
-
-   clk32k = clk_get(dev, usb_phy_cm_clk32k);
-   if (IS_ERR(clk32k)) {
-   dev_err(dev, cannot clk_get usb_phy_cm_clk32k\n);
-   clk_put(phyclk);
-   clk_put(clk48m);
-   iounmap(ctrl_base);
-   return PTR_ERR(clk32k);
-   }
-   return 0;
-}
-
-int omap4430_phy_set_clk(struct device *dev, int on)
-{
-   static int state;
-
-   if (on  !state) {
-   /* Enable the phy clocks */
-   clk_enable(phyclk);
-   clk_enable(clk48m);
-   clk_enable(clk32k);
-   state = 1;
-   } else if (state) {
-   /* Disable the phy clocks */
-   clk_disable(phyclk);
-   clk_disable(clk48m);
-   clk_disable(clk32k);
-   state = 0;
-   }
-   return 0;
-}
-
-int omap4430_phy_power(struct device *dev, int ID, int on)
-{
-   if (on) {
-   if (ID)
-   /* enable VBUS valid, IDDIG groung */
-   __raw_writel(AVALID | VBUSVALID, ctrl_base +
-   USBOTGHS_CONTROL);
-   else
-   /*
-* Enable VBUS Valid, AValid and IDDIG
-* high impedance
-*/
-   __raw_writel(IDDIG | AVALID | VBUSVALID,
-   ctrl_base + USBOTGHS_CONTROL);
-   } else {
-   /* Enable session END and IDIG to high impedance. */
-   __raw_writel(SESSEND | IDDIG, ctrl_base +
-   USBOTGHS_CONTROL);
-   }
-   return 0;
-}
-
-int omap4430_phy_suspend(struct device *dev, int suspend)
-{
-   if (suspend) {
-   /* Disable the clocks */
-   omap4430_phy_set_clk(dev, 0);
-   /* Power down the phy */
-   __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-
-   /* save the context */
-   usbotghs_control = __raw_readl(ctrl_base + USBOTGHS_CONTROL);
-   } else {
-   /* Enable the internel phy clcoks */
-   omap4430_phy_set_clk(dev, 1);
-   /* power on the phy */
-   if (__raw_readl(ctrl_base + CONTROL_DEV_CONF)  PHY_PD) {
-   __raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-   mdelay(200);
-   }
-
-   /* restore the context */
-   __raw_writel(usbotghs_control, ctrl_base + USBOTGHS_CONTROL);
-   }
-
-   return 0;
-}
-
-int omap4430_phy_exit(struct device *dev)
-{
-   if (ctrl_base)
-  

[PATCH v3 10/11] arm/dts: omap: Add usb_otg and glue data

2012-07-18 Thread Kishon Vijay Abraham I
Add usb otg data node in omap4/omap3 device tree file. Also update
the node with board specific setting in omapx-board.dts file.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/omap3-beagle.dts |6 ++
 arch/arm/boot/dts/omap3-evm.dts|6 ++
 arch/arm/boot/dts/omap3.dtsi   |8 
 arch/arm/boot/dts/omap4-panda.dts  |6 ++
 arch/arm/boot/dts/omap4-sdp.dts|6 ++
 arch/arm/boot/dts/omap4.dtsi   |8 
 6 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap3-beagle.dts 
b/arch/arm/boot/dts/omap3-beagle.dts
index 5b4506c..f3d7076 100644
--- a/arch/arm/boot/dts/omap3-beagle.dts
+++ b/arch/arm/boot/dts/omap3-beagle.dts
@@ -67,3 +67,9 @@
 mmc3 {
status = disable;
 };
+
+usb_otg_hs {
+   interface_type = 0;
+   mode = 3;
+   power = 50;
+};
diff --git a/arch/arm/boot/dts/omap3-evm.dts b/arch/arm/boot/dts/omap3-evm.dts
index 2eee16e..8963b3d 100644
--- a/arch/arm/boot/dts/omap3-evm.dts
+++ b/arch/arm/boot/dts/omap3-evm.dts
@@ -18,3 +18,9 @@
reg = 0x8000 0x1000; /* 256 MB */
};
 };
+
+usb_otg_hs {
+   interface_type = 0;
+   mode = 3;
+   power = 50;
+};
diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index 99474fa..f2694c9 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -215,5 +215,13 @@
compatible = ti,omap3-hsmmc;
ti,hwmods = mmc3;
};
+
+   usb_otg_hs: usb_otg_hs@4a0ab000 {
+   compatible = ti,omap3-musb;
+   ti,hwmods = usb_otg_hs;
+   multipoint = 1;
+   num_eps = 16;
+   ram_bits = 12;
+   };
};
 };
diff --git a/arch/arm/boot/dts/omap4-panda.dts 
b/arch/arm/boot/dts/omap4-panda.dts
index 7052422..dd19370 100644
--- a/arch/arm/boot/dts/omap4-panda.dts
+++ b/arch/arm/boot/dts/omap4-panda.dts
@@ -93,3 +93,9 @@
 twlusb {
usb-supply = vusb;
 };
+
+usb_otg_hs {
+   interface_type = 1;
+   mode = 3;
+   power = 50;
+};
diff --git a/arch/arm/boot/dts/omap4-sdp.dts b/arch/arm/boot/dts/omap4-sdp.dts
index 6326d7c..0fc10d4 100644
--- a/arch/arm/boot/dts/omap4-sdp.dts
+++ b/arch/arm/boot/dts/omap4-sdp.dts
@@ -162,3 +162,9 @@
 twlusb {
usb-supply = vusb;
 };
+
+usb_otg_hs {
+   interface_type = 1;
+   mode = 3;
+   power = 50;
+};
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 15f1890..3a6c3fa 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -285,5 +285,13 @@
  0x4a002300 0x1;
};
};
+
+   usb_otg_hs: usb_otg_hs@4a0ab000 {
+   compatible = ti,omap4-musb;
+   ti,hwmods = usb_otg_hs;
+   multipoint = 1;
+   num_eps = 16;
+   ram_bits = 12;
+   };
};
 };
-- 
1.7.5.4

--
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 v2 07/11] usb: otg: nop: add dt support

2012-07-18 Thread Gupta, Ajay Kumar
Hi,
 
 On 17-07-2012 13:13, Ajay Kumar Gupta wrote:
 
  Added device tree support for nop transceiver driver and updated the
  Documentation with device tree binding information for am33xx
 platform.
 
  Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
  ---
.../devicetree/bindings/usb/am33xx-usb.txt |3 +++
drivers/usb/otg/nop-usb-xceiv.c|   12
 
2 files changed, 15 insertions(+), 0 deletions(-)
 
  diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
 b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
  index ca8fa56..a314720 100644
  --- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
  +++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
  @@ -12,3 +12,6 @@ AM33XX MUSB GLUE
   represents PERIPHERAL.
 - power : Should be 250. This signifies the controller can
 supply upto
   500mA when operating in host mode.
  +
  +NOP USB PHY
  + - compatible : Should be ti,nop-xceiv-usb
 
 Why are you declaring it as TI specific. There's nothing company
 specific in the NOP transceiver.

Thanks for review. I will change this to nop-xceiv-usb.

Ajay
 
 WBR, Sergei
--
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] xhci: EHCI/xHCI ports switching on Intense-PC.

2012-07-18 Thread Denis Turischev
On 07/17/2012 07:54 AM, Sarah Sharp wrote:
 On Mon, Jul 16, 2012 at 07:46:06PM +0300, Denis Turischev wrote:
 Intense-PC is Compulab's mini-desktop with Intel Panther Point
 chipset.

 Unconditional ports switching provided by function
 usb_enable_xhci_ports() leads to surprising results, after shutdown
 system powered-on again after a few seconds. On Windows power
 related problems were not observed.
 
 Do you have wake on lan enabled in the BIOS?  I have heard reports from
 other users that this is a BIOS bug triggered by WOL.

Bug appears with WOL disabled too, moreover, it appears with PCH LAN
disabled at all in the BIOS.

 
 The patch avoids ports switching for Intense-PC.

 Signed-off-by: Denis Turischev de...@compulab.co.il
 ---
  drivers/usb/host/pci-quirks.c |7 +++
  1 file changed, 7 insertions(+)

 diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
 index df0828c..6f72593 100644
 --- a/drivers/usb/host/pci-quirks.c
 +++ b/drivers/usb/host/pci-quirks.c
 @@ -759,6 +759,13 @@ void usb_enable_xhci_ports(struct pci_dev *xhci_pdev)
  {
  u32 ports_available;

 +const char *brd_name;
 +brd_name = dmi_get_system_info(DMI_BOARD_NAME);
 +
 +/* quirk for Compulab's Intense-PC board */
 +if (brd_name  strstr(brd_name, Intense-PC))
 +return;
 +
 
 No, this fix is not acceptable.  You won't get USB 3.0 speeds if the
 ports are not switched over.  Now, we can add a quirk to the xHCI
 shutdown function to switch the ports back to EHCI on shutdown.  That
 might not trigger the BIOS bug.

Yes, switching back to EHCI in xhci_shutdown() solves the problem.

I suppose to do something like this in xhci_shutdown:
pdev = to_pci_dev(hcd-self.controller);

if (usb_is_intel_switchable_xhci(pdev)){
brd_name = dmi_get_system_info(DMI_BOARD_NAME);

/* quirk for Compulab's Intense-PC board */
if (brd_name  strstr(brd_name, Intense-PC))
usb_disable_xhci_ports(pdev);
}

Is it ok?

May be it worth to disable xhci ports for all intel switchable
devices, not only for Intense-PC?

--
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 PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Oliver Neukum
On Tuesday 17 July 2012 14:52:51 Sarah Sharp wrote:
 2. If an internal USB port is suspended with remote wakeup disabled,
 power off the port.  Add code to the USB core to ignore the device
 disconnect in this special case, so the driver thinks the device is
 still suspended.  Issue a reset-resume when the driver wants to resume
 the device.
 
 That policy would be safe, because for 1) we would never see a USB
 device connection, and thus wouldn't miss the connection when we powered
 off the port.  2) is safe because we won't miss a remote wakeup while
 the port is powered off, and the device can't be disconnected by the
 user because it's an internal USB device.

That is still problematic. Because it depends on the driver and the core
being able to reinit a device from a cold start. For devices that take
a firmware this is untrue. Unfortunately internal BT and 3G devices are
the most prominent examples of devices needing firmware.

Regards
Oliver

--
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: some questions about usb_serial_probe

2012-07-18 Thread loody
hi all:

2012/7/18 loody milo...@gmail.com:
 hi:

 2012/7/18 Greg KH gre...@linuxfoundation.org:
 On Wed, Jul 18, 2012 at 11:22:49AM +0800, loody wrote:
 Dear all:
 in usb_serial_probe, we create tty_port based on max_endpoints.

 Or based on the number that the driver said to create.

 My questions are:
 1. some callback functions, such serial_hangup, serial_carrier_raised,
 etc. will called by tty layer with different tty_ports.
 how tty layer know these tty_ports?

 They were registered with the tty layer.

 I only found tty_port_init to initial these tty_ports, but where we
 register these tty_ports to tty layer?

 When we register the tty device.
 Would you mind to tell me which function it is?
after tracing source code, usb_serial_device_probe seems where we
register tty device.
But we only let tty know, tty_driver, index and struct device.
it seems we don't let tty know how many tty_ports we created.
Thanks for your help in advance,
--
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 PATCH for v3.5 0/2] usb: gadget: at91_udc: fix oops regression

2012-07-18 Thread Sebastian Andrzej Siewior
On Mon, Jul 16, 2012 at 02:50:29PM +0200, Fabio Porcedda wrote:
 PROBLEM:
 1.
 usb: gadget: at91_udc: kernel oops regression when connecting the usb cable
 
 2.
 Every time i connect the usb cable the kernel got a oops
Don't really see the difference to 1

 3.
 usb gadget arm atmel at91_udc g_ether
 
 4.
 The latest working kernel release is v3.4,
 the first non-woring release is v3.5-rc1.
 
 I've used an Atmel AT91SAM9260EK board.

I would prefer to fix the bug causing the oops instead of reverting patches.

Sebastian
--
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 v2 06/11] arm/dts: am33xx: Add dt data for usbss

2012-07-18 Thread Gupta, Ajay Kumar
Hi,
 On 17-07-2012 13:13, Ajay Kumar Gupta wrote:
 
  Added device tree data for usbss on am33xx. There are two musb
 controllers
  on am33xx platform so have port0_mode and port1_mode additional data.
 
  Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
  ---
arch/arm/boot/dts/am33xx.dtsi |   11 +++
1 files changed, 11 insertions(+), 0 deletions(-)
 
  diff --git a/arch/arm/boot/dts/am33xx.dtsi
 b/arch/arm/boot/dts/am33xx.dtsi
  index 59509c4..b572803 100644
  --- a/arch/arm/boot/dts/am33xx.dtsi
  +++ b/arch/arm/boot/dts/am33xx.dtsi
  @@ -154,5 +154,16 @@
  #size-cells = 0;
  ti,hwmods = i2c3;
  };
  +
  +   usb_otg_hs: usb_otg_hs@4740 {
 
 The reg property is absent, so why did you give the node name the
 address postfix?

Currently reg property is coming from ti hwmods.

Thanks,
Ajay
 
  +   compatible = ti,musb-am33xx;
  +   ti,hwmods = usb_otg_hs;
  +   multipoint = 1;
  +   num_eps = 16;
  +   ram_bits = 12;
  +   port0_mode = 3;
  +   port1_mode = 1;
  +   power = 250;
  +   };
 
 WBR, Sergei

--
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 v2 1/2] USB: chipidea: add imx usbmisc support

2012-07-18 Thread Richard Zhao
i.MX usb controllers shares non-core registers, which may include
SoC specific controls. We take it as a usbmisc device and usbmisc
driver set operations needed by ci13xxx_imx driver.

For example, Sabrelite board has bad over-current design, we can
usbmisc to disable over-current detect.

Signed-off-by: Richard Zhao richard.z...@freescale.com
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt|2 +
 .../devicetree/bindings/usb/usbmisc-imx.txt|   12 ++
 drivers/usb/chipidea/Makefile  |2 +-
 drivers/usb/chipidea/ci13xxx_imx.c |   23 +++
 drivers/usb/chipidea/usbmisc_imx6q.c   |  161 
 5 files changed, 199 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/usb/usbmisc-imx.txt
 create mode 100644 drivers/usb/chipidea/usbmisc_imx6q.c

diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
index 2c29041..06105ce 100644
--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
@@ -8,6 +8,7 @@ Required properties:
 Optional properties:
 - fsl,usbphy: phandler of usb phy that connects to the only one port
 - vbus-supply: regulator for vbus
+- disable-over-current: disable over current detect
 
 Examples:
 usb@02184000 { /* USB OTG */
@@ -15,4 +16,5 @@ usb@02184000 { /* USB OTG */
reg = 0x02184000 0x200;
interrupts = 0 43 0x04;
fsl,usbphy = usbphy1;
+   disable-over-current;
 };
diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt 
b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
new file mode 100644
index 000..4fa500d
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
@@ -0,0 +1,12 @@
+* Freescale i.MX non-core registers
+
+Required properties:
+- compatible: Should be one of below:
+   fsl,imx6q-usbmisc for imx6q
+- reg: Should contain registers location and length
+
+Examples:
+usbmisc@02184800 {
+   compatible = fsl,imx6q-usbmisc;
+   reg = 0x02184800 0x200;
+};
diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
index 5c66d9c..57e510f 100644
--- a/drivers/usb/chipidea/Makefile
+++ b/drivers/usb/chipidea/Makefile
@@ -15,5 +15,5 @@ ifneq ($(CONFIG_PCI),)
 endif
 
 ifneq ($(CONFIG_OF_DEVICE),)
-   obj-$(CONFIG_USB_CHIPIDEA)  += ci13xxx_imx.o
+   obj-$(CONFIG_USB_CHIPIDEA)  += ci13xxx_imx.o usbmisc_imx6q.o
 endif
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index ef60d06..e790c0e 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -22,6 +22,7 @@
 #include linux/regulator/consumer.h
 
 #include ci.h
+#include ci13xxx_imx.h
 
 #define pdev_to_phy(pdev) \
((struct usb_phy *)platform_get_drvdata(pdev))
@@ -34,6 +35,25 @@ struct ci13xxx_imx_data {
struct regulator *reg_vbus;
 };
 
+static const struct usbmisc_ops *usbmisc_ops;
+
+int usbmisc_set_ops(const struct usbmisc_ops *ops)
+{
+   if (usbmisc_ops)
+   return -EBUSY;
+
+   usbmisc_ops = ops;
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(usbmisc_set_ops);
+
+void usbmisc_unset_ops(const struct usbmisc_ops *ops)
+{
+   usbmisc_ops = NULL;
+}
+EXPORT_SYMBOL_GPL(usbmisc_unset_ops);
+
 static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = {
.name   = ci13xxx_imx,
.flags  = CI13XXX_REQUIRE_TRANSCEIVER |
@@ -120,6 +140,9 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
*pdev-dev.dma_mask = DMA_BIT_MASK(32);
dma_set_coherent_mask(pdev-dev, *pdev-dev.dma_mask);
}
+
+   usbmisc_ops-init(pdev-dev);
+
plat_ci = ci13xxx_add_device(pdev-dev,
pdev-resource, pdev-num_resources,
ci13xxx_imx_platdata);
diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c 
b/drivers/usb/chipidea/usbmisc_imx6q.c
new file mode 100644
index 000..9f69a8c
--- /dev/null
+++ b/drivers/usb/chipidea/usbmisc_imx6q.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include linux/module.h
+#include linux/of_platform.h
+#include linux/clk.h
+#include linux/err.h
+#include linux/io.h
+
+#include ci13xxx_imx.h
+
+#define USB_DEV_MAX 4
+
+#define BM_OVER_CUR_DISBIT(7)
+
+struct imx6q_usbmisc {
+   void __iomem *base;
+   struct clk *clk;
+   struct device *usb_dev[USB_DEV_MAX];
+   spinlock_t lock;
+
+   int disable_oc:USB_DEV_MAX;
+};
+
+static struct imx6q_usbmisc 

[PATCH v4 08/11] arm/dts: Add twl4030-usb data

2012-07-18 Thread Kishon Vijay Abraham I
Add twl4030-usb data node in twl4030 device tree file.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/twl4030.dtsi |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/twl4030.dtsi b/arch/arm/boot/dts/twl4030.dtsi
index 22f4d13..761a5a5 100644
--- a/arch/arm/boot/dts/twl4030.dtsi
+++ b/arch/arm/boot/dts/twl4030.dtsi
@@ -37,6 +37,18 @@
regulator-max-microvolt = 315;
};
 
+   vusb1v5: regulator-vusb1v5 {
+   compatible = ti,twl4030-vusb1v5;
+   };
+
+   vusb1v8: regulator-vusb1v8 {
+   compatible = ti,twl4030-vusb1v8;
+   };
+
+   vusb3v1: regulator-vusb3v1 {
+   compatible = ti,twl4030-vusb3v1;
+   };
+
twl_gpio: gpio {
compatible = ti,twl4030-gpio;
gpio-controller;
@@ -44,4 +56,13 @@
interrupt-controller;
#interrupt-cells = 1;
};
+
+   twl4030-usb {
+   compatible = ti,twl4030-usb;
+   interrupts =  10 4 ;
+   usb1v5-supply = vusb1v5;
+   usb1v8-supply = vusb1v8;
+   usb3v1-supply = vusb3v1;
+   usb_mode = 1;
+   };
 };
-- 
1.7.5.4

--
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 v4 02/11] arm/dts: omap: Add omap-usb2 dt data

2012-07-18 Thread Kishon Vijay Abraham I
Add omap-usb2 data node in omap4 device tree file.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/boot/dts/omap4.dtsi |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 29c6243..15f1890 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -279,6 +279,11 @@
#size-cells = 1;
ranges;
ti,hwmods = ocp2scp_usb_phy;
+   usb2phy@4a0ad080 {
+   compatible = ti,omap-usb2;
+   reg = 0x4a0ad080 0x58,
+ 0x4a002300 0x1;
+   };
};
};
 };
-- 
1.7.5.4

--
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 v4 04/11] arm: omap: hwmod: add a new addr space in otg for writing to control module

2012-07-18 Thread Kishon Vijay Abraham I
The mailbox register for usb otg in omap is present in control module.
On detection of any events VBUS or ID, this register should be written
to send the notification to musb core.

Till we have a separate control module driver to write to control module,
omap2430 will handle the register writes to control module by itself. So
a new address space to represent this control module register is added
to usb_otg_hs.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index ba24d15..c50d828 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -5922,6 +5922,11 @@ static struct omap_hwmod_addr_space 
omap44xx_usb_otg_hs_addrs[] = {
.pa_end = 0x4a0ab7ff,
.flags  = ADDR_TYPE_RT
},
+   {
+   .pa_start   = 0x4a00233c,
+   .pa_end = 0x4a00233f,
+   .flags  = ADDR_TYPE_RT
+   },
{ }
 };
 
-- 
1.7.5.4

--
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 v4 01/11] drivers: usb: otg: add a new driver for omap usb2 phy

2012-07-18 Thread Kishon Vijay Abraham I
All phy related programming like enabling/disabling the clocks, powering
on/off the phy is taken care of by this driver. It is also used for OTG
related functionality like srp.

This also includes device tree support for usb2 phy driver and
the documentation with device tree binding information is updated.

Currently writing to control module register is taken care in this
driver which will be removed once the control module driver is in place.

Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/bus/omap-ocp2scp.txt   |3 +
 Documentation/devicetree/bindings/usb/omap-usb.txt |   16 ++
 drivers/usb/otg/Kconfig|   10 +
 drivers/usb/otg/Makefile   |1 +
 drivers/usb/otg/omap-usb2.c|  271 
 include/linux/usb/omap_usb.h   |   45 
 include/linux/usb/phy_companion.h  |   34 +++
 7 files changed, 380 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/omap-usb.txt
 create mode 100644 drivers/usb/otg/omap-usb2.c
 create mode 100644 include/linux/usb/omap_usb.h
 create mode 100644 include/linux/usb/phy_companion.h

diff --git a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt 
b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
index d2fe064..bb0c7f4 100644
--- a/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
+++ b/Documentation/devicetree/bindings/bus/omap-ocp2scp.txt
@@ -8,3 +8,6 @@ properties:
 
 Sub-nodes:
 All the devices connected to ocp2scp are described using sub-node to ocp2scp
+- usb2phy :
+   The binding details of usb2phy can be found in:
+   Documentation/devicetree/bindings/usb/omap-usb.txt
diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
new file mode 100644
index 000..80a28c9
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -0,0 +1,16 @@
+OMAP USB PHY
+
+OMAP USB2 PHY
+
+Required properties:
+ - compatible: Should be ti,omap-usb2
+ - reg : Address and length of the register set for the device. Also
+add the address of control module dev conf register until a driver for
+control module is added
+
+This is usually a subnode of ocp2scp to which it is connected.
+
+usb2phy@0x4a0ad080 {
+   compatible = ti,omap-usb2;
+   reg = 0x4a0ad080 0x58;
+};
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig
index 5c87db0..c751db7 100644
--- a/drivers/usb/otg/Kconfig
+++ b/drivers/usb/otg/Kconfig
@@ -78,6 +78,16 @@ config TWL6030_USB
  are hooked to this driver through platform_data structure.
  The definition of internal PHY APIs are in the mach-omap2 layer.
 
+config OMAP_USB2
+   tristate OMAP USB2 PHY Driver
+   depends on OMAP_OCP2SCP
+   select USB_OTG_UTILS
+   help
+ Enable this to support the transceiver that is part of SOC. This
+ driver takes care of all the PHY functionality apart from comparator.
+ The USB OTG controller communicates with the comparator using this
+ driver.
+
 config NOP_USB_XCEIV
tristate NOP USB Transceiver Driver
select USB_OTG_UTILS
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile
index 41aa509..2c2a3ca 100644
--- a/drivers/usb/otg/Makefile
+++ b/drivers/usb/otg/Makefile
@@ -13,6 +13,7 @@ obj-$(CONFIG_USB_GPIO_VBUS)   += gpio_vbus.o
 obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
 obj-$(CONFIG_TWL4030_USB)  += twl4030-usb.o
 obj-$(CONFIG_TWL6030_USB)  += twl6030-usb.o
+obj-$(CONFIG_OMAP_USB2)+= omap-usb2.o
 obj-$(CONFIG_NOP_USB_XCEIV)+= nop-usb-xceiv.o
 obj-$(CONFIG_USB_ULPI) += ulpi.o
 obj-$(CONFIG_USB_ULPI_VIEWPORT)+= ulpi_viewport.o
diff --git a/drivers/usb/otg/omap-usb2.c b/drivers/usb/otg/omap-usb2.c
new file mode 100644
index 000..2f9e257
--- /dev/null
+++ b/drivers/usb/otg/omap-usb2.c
@@ -0,0 +1,271 @@
+/*
+ * omap-usb2.c - USB PHY, talking to musb controller in OMAP.
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Author: Kishon Vijay Abraham I kis...@ti.com
+ *
+ * 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/slab.h
+#include linux/of.h
+#include linux/io.h
+#include linux/usb/omap_usb.h
+#include linux/usb/phy_companion.h
+#include linux/clk.h
+#include linux/err.h
+#include 

[PATCH v4 03/11] drivers: usb: otg: make twl6030_usb as a comparator driver to omap_usb2

2012-07-18 Thread Kishon Vijay Abraham I
All the PHY configuration other than VBUS, ID GND and OTG SRP are removed
from twl6030. The phy configurations are taken care by the dedicated
usb2 phy driver. So twl6030 is made as comparator driver for VBUS and
ID detection.

Writing to control module which is now handled in omap2430.c should be
removed once a driver for control module is in place.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 drivers/usb/musb/omap2430.c   |   52 ---
 drivers/usb/musb/omap2430.h   |9 +++
 drivers/usb/otg/twl6030-usb.c |  114 +
 3 files changed, 67 insertions(+), 108 deletions(-)

diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
index 5fdb9da..addbebf 100644
--- a/drivers/usb/musb/omap2430.c
+++ b/drivers/usb/musb/omap2430.c
@@ -44,6 +44,7 @@ struct omap2430_glue {
struct platform_device  *musb;
enum omap_musb_vbus_id_status status;
struct work_struct  omap_musb_mailbox_work;
+   u32 __iomem *control_otghs;
 };
 #define glue_to_musb(g)platform_get_drvdata(g-musb)
 
@@ -51,6 +52,26 @@ struct omap2430_glue *_glue;
 
 static struct timer_list musb_idle_timer;
 
+/**
+ * omap4_usb_phy_mailbox - write to usb otg mailbox
+ * @glue: struct omap2430_glue *
+ * @val: the value to be written to the mailbox
+ *
+ * On detection of a device (ID pin is grounded), this API should be called
+ * to set AVALID, VBUSVALID and ID pin is grounded.
+ *
+ * When OMAP is connected to a host (OMAP in device mode), this API
+ * is called to set AVALID, VBUSVALID and ID pin in high impedance.
+ *
+ * XXX: This function will be removed once we have a seperate driver for
+ * control module
+ */
+static void omap4_usb_phy_mailbox(struct omap2430_glue *glue, u32 val)
+{
+   if (glue-control_otghs)
+   writel(val, glue-control_otghs);
+}
+
 static void musb_do_idle(unsigned long _musb)
 {
struct musb *musb = (void *)_musb;
@@ -245,6 +266,7 @@ EXPORT_SYMBOL_GPL(omap_musb_mailbox);
 
 static void omap_musb_set_mailbox(struct omap2430_glue *glue)
 {
+   u32 val;
struct musb *musb = glue_to_musb(glue);
struct device *dev = musb-controller;
struct musb_hdrc_platform_data *pdata = dev-platform_data;
@@ -260,7 +282,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
musb-xceiv-last_event = USB_EVENT_ID;
if (!is_otg_enabled(musb) || musb-gadget_driver) {
pm_runtime_get_sync(dev);
-   usb_phy_init(musb-xceiv);
+   val = AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
omap2430_musb_set_vbus(musb, 1);
}
break;
@@ -273,7 +296,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
musb-xceiv-last_event = USB_EVENT_VBUS;
if (musb-gadget_driver)
pm_runtime_get_sync(dev);
-   usb_phy_init(musb-xceiv);
+   val = IDDIG | AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
break;
 
case OMAP_MUSB_ID_FLOAT:
@@ -291,7 +315,8 @@ static void omap_musb_set_mailbox(struct omap2430_glue 
*glue)
if (musb-xceiv-otg-set_vbus)
otg_set_vbus(musb-xceiv-otg, 0);
}
-   usb_phy_shutdown(musb-xceiv);
+   val = SESSEND | IDDIG;
+   omap4_usb_phy_mailbox(glue, val);
break;
default:
dev_dbg(dev, ID float\n);
@@ -366,6 +391,7 @@ err1:
 static void omap2430_musb_enable(struct musb *musb)
 {
u8  devctl;
+   u32 val;
unsigned long timeout = jiffies + msecs_to_jiffies(1000);
struct device *dev = musb-controller;
struct omap2430_glue *glue = dev_get_drvdata(dev-parent);
@@ -375,7 +401,8 @@ static void omap2430_musb_enable(struct musb *musb)
switch (glue-status) {
 
case OMAP_MUSB_ID_GROUND:
-   usb_phy_init(musb-xceiv);
+   val = AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
if (data-interface_type != MUSB_INTERFACE_UTMI)
break;
devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
@@ -394,7 +421,8 @@ static void omap2430_musb_enable(struct musb *musb)
break;
 
case OMAP_MUSB_VBUS_VALID:
-   usb_phy_init(musb-xceiv);
+   val = IDDIG | AVALID | VBUSVALID;
+   omap4_usb_phy_mailbox(glue, val);
break;
 
default:
@@ -404,11 +432,14 @@ static void omap2430_musb_enable(struct musb *musb)
 
 static void omap2430_musb_disable(struct musb *musb)
 {
+   u32 val;
struct device *dev = musb-controller;
struct omap2430_glue *glue = 

[PATCH v4 07/11] drivers: usb: twl4030: Add device tree support for twl4030 usb

2012-07-18 Thread Kishon Vijay Abraham I
Add device tree support for twl4030 usb driver.
Update the Documentation with device tree binding information.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 .../devicetree/bindings/usb/twl-usb.txt|   19 ++
 drivers/usb/otg/twl4030-usb.c  |   26 +++
 2 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/twl-usb.txt 
b/Documentation/devicetree/bindings/usb/twl-usb.txt
index e3f6d73..bdf1dd4 100644
--- a/Documentation/devicetree/bindings/usb/twl-usb.txt
+++ b/Documentation/devicetree/bindings/usb/twl-usb.txt
@@ -20,3 +20,22 @@ Board specific device node entry
 twl6030-usb {
usb-supply = vusb;
 };
+
+TWL4030 USB PHY AND COMPARATOR
+ - compatible : Should be ti,twl4030-usb
+ - interrupts : The interrupt numbers to the cpu should be specified. First
+   interrupt number is the otg interrupt number that raises ID interrupts
+   and VBUS interrupts. The second interrupt number is optional.
+ - supply-name-supply : phandle to the regulator device tree node.
+   supply-name should be vusb1v5, vusb1v8 and vusb3v1
+ - usb_mode : The mode used by the phy to connect to the controller. 1
+   specifies ULPI mode and 2 specifies CEA2011_3PIN mode.
+
+twl4030-usb {
+   compatible = ti,twl4030-usb;
+   interrupts =  10 4 ;
+   usb1v5-supply = vusb1v5;
+   usb1v8-supply = vusb1v8;
+   usb3v1-supply = vusb3v1;
+   usb_mode = 1;
+};
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c
index 523cad5..f0d2e75 100644
--- a/drivers/usb/otg/twl4030-usb.c
+++ b/drivers/usb/otg/twl4030-usb.c
@@ -585,23 +585,28 @@ static int __devinit twl4030_usb_probe(struct 
platform_device *pdev)
struct twl4030_usb  *twl;
int status, err;
struct usb_otg  *otg;
-
-   if (!pdata) {
-   dev_dbg(pdev-dev, platform_data not available\n);
-   return -EINVAL;
-   }
+   struct device_node  *np = pdev-dev.of_node;
 
twl = devm_kzalloc(pdev-dev, sizeof *twl, GFP_KERNEL);
if (!twl)
return -ENOMEM;
 
+   if (np)
+   of_property_read_u32(np, usb_mode,
+   (enum twl4030_usb_mode *)twl-usb_mode);
+   else if (pdata)
+   twl-usb_mode = pdata-usb_mode;
+   else {
+   dev_err(pdev-dev, twl4030 initialized without pdata\n);
+   return -EINVAL;
+   }
+
otg = devm_kzalloc(pdev-dev, sizeof *otg, GFP_KERNEL);
if (!otg)
return -ENOMEM;
 
twl-dev= pdev-dev;
twl-irq= platform_get_irq(pdev, 0);
-   twl-usb_mode   = pdata-usb_mode;
twl-vbus_supplied  = false;
twl-asleep = 1;
twl-linkstat   = OMAP_MUSB_UNKNOWN;
@@ -690,12 +695,21 @@ static int __exit twl4030_usb_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id twl4030_usb_id_table[] = {
+   { .compatible = ti,twl4030-usb },
+   {}
+};
+MODULE_DEVICE_TABLE(of, twl4030_usb_id_table);
+#endif
+
 static struct platform_driver twl4030_usb_driver = {
.probe  = twl4030_usb_probe,
.remove = __exit_p(twl4030_usb_remove),
.driver = {
.name   = twl4030_usb,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(twl4030_usb_id_table),
},
 };
 
-- 
1.7.5.4

--
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 v4 11/11] arm: omap: phy: remove unused functions from omap-phy-internal.c

2012-07-18 Thread Kishon Vijay Abraham I
All the unnessary functions in omap-phy-internal is removed.
These functionality are now handled by omap-usb2 phy driver.

Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/mach-omap2/omap_phy_internal.c |  138 ---
 arch/arm/mach-omap2/twl-common.c|5 -
 arch/arm/mach-omap2/usb-musb.c  |3 -
 3 files changed, 0 insertions(+), 146 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_phy_internal.c 
b/arch/arm/mach-omap2/omap_phy_internal.c
index d52651a..874aecc 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -31,144 +31,6 @@
 #include plat/usb.h
 #include control.h
 
-/* OMAP control module register for UTMI PHY */
-#define CONTROL_DEV_CONF   0x300
-#define PHY_PD 0x1
-
-#define USBOTGHS_CONTROL   0x33c
-#defineAVALID  BIT(0)
-#defineBVALID  BIT(1)
-#defineVBUSVALID   BIT(2)
-#defineSESSEND BIT(3)
-#defineIDDIG   BIT(4)
-
-static struct clk *phyclk, *clk48m, *clk32k;
-static void __iomem *ctrl_base;
-static int usbotghs_control;
-
-int omap4430_phy_init(struct device *dev)
-{
-   ctrl_base = ioremap(OMAP443X_SCM_BASE, SZ_1K);
-   if (!ctrl_base) {
-   pr_err(control module ioremap failed\n);
-   return -ENOMEM;
-   }
-   /* Power down the phy */
-   __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-
-   if (!dev) {
-   iounmap(ctrl_base);
-   return 0;
-   }
-
-   phyclk = clk_get(dev, ocp2scp_usb_phy_ick);
-   if (IS_ERR(phyclk)) {
-   dev_err(dev, cannot clk_get ocp2scp_usb_phy_ick\n);
-   iounmap(ctrl_base);
-   return PTR_ERR(phyclk);
-   }
-
-   clk48m = clk_get(dev, ocp2scp_usb_phy_phy_48m);
-   if (IS_ERR(clk48m)) {
-   dev_err(dev, cannot clk_get ocp2scp_usb_phy_phy_48m\n);
-   clk_put(phyclk);
-   iounmap(ctrl_base);
-   return PTR_ERR(clk48m);
-   }
-
-   clk32k = clk_get(dev, usb_phy_cm_clk32k);
-   if (IS_ERR(clk32k)) {
-   dev_err(dev, cannot clk_get usb_phy_cm_clk32k\n);
-   clk_put(phyclk);
-   clk_put(clk48m);
-   iounmap(ctrl_base);
-   return PTR_ERR(clk32k);
-   }
-   return 0;
-}
-
-int omap4430_phy_set_clk(struct device *dev, int on)
-{
-   static int state;
-
-   if (on  !state) {
-   /* Enable the phy clocks */
-   clk_enable(phyclk);
-   clk_enable(clk48m);
-   clk_enable(clk32k);
-   state = 1;
-   } else if (state) {
-   /* Disable the phy clocks */
-   clk_disable(phyclk);
-   clk_disable(clk48m);
-   clk_disable(clk32k);
-   state = 0;
-   }
-   return 0;
-}
-
-int omap4430_phy_power(struct device *dev, int ID, int on)
-{
-   if (on) {
-   if (ID)
-   /* enable VBUS valid, IDDIG groung */
-   __raw_writel(AVALID | VBUSVALID, ctrl_base +
-   USBOTGHS_CONTROL);
-   else
-   /*
-* Enable VBUS Valid, AValid and IDDIG
-* high impedance
-*/
-   __raw_writel(IDDIG | AVALID | VBUSVALID,
-   ctrl_base + USBOTGHS_CONTROL);
-   } else {
-   /* Enable session END and IDIG to high impedance. */
-   __raw_writel(SESSEND | IDDIG, ctrl_base +
-   USBOTGHS_CONTROL);
-   }
-   return 0;
-}
-
-int omap4430_phy_suspend(struct device *dev, int suspend)
-{
-   if (suspend) {
-   /* Disable the clocks */
-   omap4430_phy_set_clk(dev, 0);
-   /* Power down the phy */
-   __raw_writel(PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-
-   /* save the context */
-   usbotghs_control = __raw_readl(ctrl_base + USBOTGHS_CONTROL);
-   } else {
-   /* Enable the internel phy clcoks */
-   omap4430_phy_set_clk(dev, 1);
-   /* power on the phy */
-   if (__raw_readl(ctrl_base + CONTROL_DEV_CONF)  PHY_PD) {
-   __raw_writel(~PHY_PD, ctrl_base + CONTROL_DEV_CONF);
-   mdelay(200);
-   }
-
-   /* restore the context */
-   __raw_writel(usbotghs_control, ctrl_base + USBOTGHS_CONTROL);
-   }
-
-   return 0;
-}
-
-int omap4430_phy_exit(struct device *dev)
-{
-   if (ctrl_base)
-  

Re: [PATCH v2 1/2] USB: chipidea: add imx usbmisc support

2012-07-18 Thread Sascha Hauer
On Wed, Jul 18, 2012 at 06:29:06PM +0800, Richard Zhao wrote:
 i.MX usb controllers shares non-core registers, which may include
 SoC specific controls. We take it as a usbmisc device and usbmisc
 driver set operations needed by ci13xxx_imx driver.
 
 For example, Sabrelite board has bad over-current design, we can
 usbmisc to disable over-current detect.
 
 Signed-off-by: Richard Zhao richard.z...@freescale.com
 ---
  .../devicetree/bindings/usb/ci13xxx-imx.txt|2 +
  .../devicetree/bindings/usb/usbmisc-imx.txt|   12 ++
  drivers/usb/chipidea/Makefile  |2 +-
  drivers/usb/chipidea/ci13xxx_imx.c |   23 +++
  drivers/usb/chipidea/usbmisc_imx6q.c   |  161 
 
  5 files changed, 199 insertions(+), 1 deletion(-)
  create mode 100644 Documentation/devicetree/bindings/usb/usbmisc-imx.txt
  create mode 100644 drivers/usb/chipidea/usbmisc_imx6q.c
 
 diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
 b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 index 2c29041..06105ce 100644
 --- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 +++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
 @@ -8,6 +8,7 @@ Required properties:
  Optional properties:
  - fsl,usbphy: phandler of usb phy that connects to the only one port
  - vbus-supply: regulator for vbus
 +- disable-over-current: disable over current detect
  
  Examples:
  usb@02184000 { /* USB OTG */
 @@ -15,4 +16,5 @@ usb@02184000 { /* USB OTG */
   reg = 0x02184000 0x200;
   interrupts = 0 43 0x04;
   fsl,usbphy = usbphy1;
 + disable-over-current;
  };
 diff --git a/Documentation/devicetree/bindings/usb/usbmisc-imx.txt 
 b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
 new file mode 100644
 index 000..4fa500d
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/usbmisc-imx.txt
 @@ -0,0 +1,12 @@
 +* Freescale i.MX non-core registers
 +
 +Required properties:
 +- compatible: Should be one of below:
 + fsl,imx6q-usbmisc for imx6q
 +- reg: Should contain registers location and length
 +
 +Examples:
 +usbmisc@02184800 {
 + compatible = fsl,imx6q-usbmisc;
 + reg = 0x02184800 0x200;
 +};
 diff --git a/drivers/usb/chipidea/Makefile b/drivers/usb/chipidea/Makefile
 index 5c66d9c..57e510f 100644
 --- a/drivers/usb/chipidea/Makefile
 +++ b/drivers/usb/chipidea/Makefile
 @@ -15,5 +15,5 @@ ifneq ($(CONFIG_PCI),)
  endif
  
  ifneq ($(CONFIG_OF_DEVICE),)
 - obj-$(CONFIG_USB_CHIPIDEA)  += ci13xxx_imx.o
 + obj-$(CONFIG_USB_CHIPIDEA)  += ci13xxx_imx.o usbmisc_imx6q.o
  endif
 diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
 b/drivers/usb/chipidea/ci13xxx_imx.c
 index ef60d06..e790c0e 100644
 --- a/drivers/usb/chipidea/ci13xxx_imx.c
 +++ b/drivers/usb/chipidea/ci13xxx_imx.c
 @@ -22,6 +22,7 @@
  #include linux/regulator/consumer.h
  
  #include ci.h
 +#include ci13xxx_imx.h
  
  #define pdev_to_phy(pdev) \
   ((struct usb_phy *)platform_get_drvdata(pdev))
 @@ -34,6 +35,25 @@ struct ci13xxx_imx_data {
   struct regulator *reg_vbus;
  };
  
 +static const struct usbmisc_ops *usbmisc_ops;
 +
 +int usbmisc_set_ops(const struct usbmisc_ops *ops)
 +{
 + if (usbmisc_ops)
 + return -EBUSY;
 +
 + usbmisc_ops = ops;
 +
 + return 0;
 +}
 +EXPORT_SYMBOL_GPL(usbmisc_set_ops);
 +
 +void usbmisc_unset_ops(const struct usbmisc_ops *ops)
 +{
 + usbmisc_ops = NULL;
 +}
 +EXPORT_SYMBOL_GPL(usbmisc_unset_ops);
 +
  static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = {
   .name   = ci13xxx_imx,
   .flags  = CI13XXX_REQUIRE_TRANSCEIVER |
 @@ -120,6 +140,9 @@ static int __devinit ci13xxx_imx_probe(struct 
 platform_device *pdev)
   *pdev-dev.dma_mask = DMA_BIT_MASK(32);
   dma_set_coherent_mask(pdev-dev, *pdev-dev.dma_mask);
   }
 +
 + usbmisc_ops-init(pdev-dev);

usbmisc_ops can be NULL and also can return an error.

 +
   plat_ci = ci13xxx_add_device(pdev-dev,
   pdev-resource, pdev-num_resources,
   ci13xxx_imx_platdata);
 diff --git a/drivers/usb/chipidea/usbmisc_imx6q.c 
 b/drivers/usb/chipidea/usbmisc_imx6q.c
 new file mode 100644
 index 000..9f69a8c
 --- /dev/null
 +++ b/drivers/usb/chipidea/usbmisc_imx6q.c
 @@ -0,0 +1,161 @@
 +/*
 + * Copyright 2012 Freescale Semiconductor, Inc.
 + *
 + * The code contained herein is licensed under the GNU General Public
 + * License. You may obtain a copy of the GNU General Public License
 + * Version 2 or later at the following locations:
 + *
 + * http://www.opensource.org/licenses/gpl-license.html
 + * http://www.gnu.org/copyleft/gpl.html
 + */
 +
 +#include linux/module.h
 +#include linux/of_platform.h
 +#include linux/clk.h
 +#include linux/err.h
 +#include linux/io.h
 +
 +#include ci13xxx_imx.h
 +
 +#define USB_DEV_MAX 4
 +
 +#define BM_OVER_CUR_DIS  BIT(7)
 +
 

[PATCH v2 0/2] usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams

2012-07-18 Thread Laurent Pinchart
Hi,

Here's a second version of the Logitech UVC devices RESET_RESUME quirk patches.
As interface information is not available at the time usb_detect_quirks() is
called, I've added a new usb_detect_interface_quirks() function that is called
later during the enumeration process.

The patches have been tested with a Logitech C905 webcam and with a non-Logitech
UVC webcam. The RESET_RESUME quirk gets enabled for the Logitech camera only.

Laurent Pinchart (2):
  usb: Add quirk detection based on interface information
  usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams

 drivers/usb/core/driver.c |   38 +++
 drivers/usb/core/hub.c|2 +
 drivers/usb/core/quirks.c |  156 +++--
 drivers/usb/core/usb.h|4 +
 4 files changed, 122 insertions(+), 78 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


[PATCH v2 2/2] usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams

2012-07-18 Thread Laurent Pinchart
Most Logitech UVC webcams (both early models that don't advertise UVC
compatibility and newer UVC-advertised devices) require the RESET_RESUME
quirk. Instead of listing each and every model, match the devices based
on the UVC interface information.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/usb/core/quirks.c |   63 +++--
 1 files changed, 21 insertions(+), 42 deletions(-)

diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
index cbd15d1..9fc7ce6 100644
--- a/drivers/usb/core/quirks.c
+++ b/drivers/usb/core/quirks.c
@@ -43,53 +43,23 @@ static const struct usb_device_id usb_quirk_list[] = {
/* Creative SB Audigy 2 NX */
{ USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Logitech Webcam C200 */
-   { USB_DEVICE(0x046d, 0x0802), .driver_info = USB_QUIRK_RESET_RESUME },
+   /* Logitech Quickcam Fusion */
+   { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Logitech Webcam C250 */
-   { USB_DEVICE(0x046d, 0x0804), .driver_info = USB_QUIRK_RESET_RESUME },
+   /* Logitech Quickcam Orbit MP */
+   { USB_DEVICE(0x046d, 0x08c2), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Logitech Webcam C300 */
-   { USB_DEVICE(0x046d, 0x0805), .driver_info = USB_QUIRK_RESET_RESUME },
+   /* Logitech Quickcam Pro for Notebook */
+   { USB_DEVICE(0x046d, 0x08c3), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Logitech Webcam B/C500 */
-   { USB_DEVICE(0x046d, 0x0807), .driver_info = USB_QUIRK_RESET_RESUME },
+   /* Logitech Quickcam Pro 5000 */
+   { USB_DEVICE(0x046d, 0x08c5), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Logitech Webcam C600 */
-   { USB_DEVICE(0x046d, 0x0808), .driver_info = USB_QUIRK_RESET_RESUME },
+   /* Logitech Quickcam OEM Dell Notebook */
+   { USB_DEVICE(0x046d, 0x08c6), .driver_info = USB_QUIRK_RESET_RESUME },
 
-   /* Logitech Webcam Pro 9000 */
-   { USB_DEVICE(0x046d, 0x0809), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C905 */
-   { USB_DEVICE(0x046d, 0x080a), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C210 */
-   { USB_DEVICE(0x046d, 0x0819), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C260 */
-   { USB_DEVICE(0x046d, 0x081a), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C310 */
-   { USB_DEVICE(0x046d, 0x081b), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C910 */
-   { USB_DEVICE(0x046d, 0x0821), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C160 */
-   { USB_DEVICE(0x046d, 0x0824), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Webcam C270 */
-   { USB_DEVICE(0x046d, 0x0825), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Quickcam Pro 9000 */
-   { USB_DEVICE(0x046d, 0x0990), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Quickcam E3500 */
-   { USB_DEVICE(0x046d, 0x09a4), .driver_info = USB_QUIRK_RESET_RESUME },
-
-   /* Logitech Quickcam Vision Pro */
-   { USB_DEVICE(0x046d, 0x09a6), .driver_info = USB_QUIRK_RESET_RESUME },
+   /* Logitech Quickcam OEM Cisco VT Camera II */
+   { USB_DEVICE(0x046d, 0x08c7), .driver_info = USB_QUIRK_RESET_RESUME },
 
/* Logitech Harmony 700-series */
{ USB_DEVICE(0x046d, 0xc122), .driver_info = USB_QUIRK_DELAY_INIT },
@@ -162,6 +132,15 @@ static const struct usb_device_id usb_quirk_list[] = {
 };
 
 static const struct usb_device_id usb_interface_quirk_list[] = {
+   /* Logitech UVC Cameras */
+   { .match_flags  = USB_DEVICE_ID_MATCH_VENDOR
+   | USB_DEVICE_ID_MATCH_INT_INFO,
+ .idVendor = 0x046d,
+ .bInterfaceClass  = USB_CLASS_VIDEO,
+ .bInterfaceSubClass   = 1,
+ .bInterfaceProtocol   = 0,
+ .driver_info  = USB_QUIRK_RESET_RESUME },
+
{ }  /* terminating entry must be last */
 };
 
-- 
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


Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Lan Tianyu

On 2012/7/18 12:43, Oliver Neukum wrote:

On Tuesday 17 July 2012 14:52:51 Sarah Sharp wrote:

2. If an internal USB port is suspended with remote wakeup disabled,
power off the port.  Add code to the USB core to ignore the device
disconnect in this special case, so the driver thinks the device is
still suspended.  Issue a reset-resume when the driver wants to resume
the device.

That policy would be safe, because for 1) we would never see a USB
device connection, and thus wouldn't miss the connection when we powered
off the port.  2) is safe because we won't miss a remote wakeup while
the port is powered off, and the device can't be disconnected by the
user because it's an internal USB device.


That is still problematic. Because it depends on the driver and the core
being able to reinit a device from a cold start. For devices that take
a firmware this is untrue. Unfortunately internal BT and 3G devices are
the most prominent examples of devices needing firmware.

hi oliver:
we can add a new variable for driver to indicate whether it can
support usb port power off mechanism to deal with this issue.

	I have a question that reset-resume still can not resolve firmware 
problem? I think this depend on driver. right?




Regards
Oliver




--
Best Regards
Tianyu Lan
linux kernel enabling team
--
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: Problems with ASMedia ASM1042 SuperSpeed USB Host

2012-07-18 Thread Ingo Rohloff
Hello Sarah, Hello Alan,

just to describe what I experienced on the ASM1402

On 17.07.2012 22:22, Alan Stern wrote:
 The events in the email message mentioned above did not involve a race.  
 It's clear that no data got transferred at all, and yet usbmon reported
 actual_length equal to transfer_buffer_length when the tranfer was 
 cancelled.

That sounds similar to what I see with the ASM1042:

What I did was this:
- I committed an URB (IN transfer) asking for 0x4000 bytes
- Device sends 0x2FFE bytes (last packet contains 1022 byte == short packet)
- Somtimes I cannot reap the URB, because it seems the URB never gets completed.

So there is no race in this case; the URB should be just completed normally by 
the short packet, but
sometimes this does not seem to happen.

I wanted to use an USB3.0 Super Speed analyzer to see what actually is 
happening on the wires, but
unfortunately my SuperSpeed Tranceivers in my device seem to have burned out 
:-(.

So it will take me at least until next week to get a new device to check this.

so long
  Ingo







--
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 v2 2/2] usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams

2012-07-18 Thread Laurent Pinchart
Hi Bjørn,

On Wednesday 18 July 2012 14:47:35 Bjørn Mork wrote:
 Laurent Pinchart laurent.pinch...@ideasonboard.com writes:
   static const struct usb_device_id usb_interface_quirk_list[] = {
  
  +   /* Logitech UVC Cameras */
  +   { .match_flags  = USB_DEVICE_ID_MATCH_VENDOR
  +   | USB_DEVICE_ID_MATCH_INT_INFO,
  + .idVendor = 0x046d,
  + .bInterfaceClass  = USB_CLASS_VIDEO,
  + .bInterfaceSubClass   = 1,
  + .bInterfaceProtocol   = 0,
  + .driver_info  = USB_QUIRK_RESET_RESUME },
  +
  
  { }  /* terminating entry must be last */
   
   };
 
 This could use the brand new USB_VENDOR_AND_INTERFACE_INFO macro.

Good point. The USB_VENDOR_AND_INTERFACE_INFO patch would need to go in first. 
Is it queued for v3.6 ?

-- 
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


[PATCH v3 0/2] usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams

2012-07-18 Thread Laurent Pinchart
Hi,

Here's a third version of the Logitech UVC devices RESET_RESUME quirk patches.
Compared to v2, the brand new USB_VENDOR_AND_INTERFACE_INFO() macro is now
used.

The patches have been tested with a Logitech C905 webcam and with a non-Logitech
UVC webcam. The RESET_RESUME quirk gets enabled for the Logitech camera only.

Laurent Pinchart (2):
  usb: Add quirk detection based on interface information
  usb: Add USB_QUIRK_RESET_RESUME for all Logitech UVC webcams

 drivers/usb/core/driver.c |   38 +++-
 drivers/usb/core/hub.c|2 +
 drivers/usb/core/quirks.c |  151 ++---
 drivers/usb/core/usb.h|4 +
 4 files changed, 117 insertions(+), 78 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 v2 1/2] USB: chipidea: add imx usbmisc support

2012-07-18 Thread Richard Zhao
[snip]
static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  
   = {
 .name   = ci13xxx_imx,
 .flags  = CI13XXX_REQUIRE_TRANSCEIVER |
   @@ -120,6 +140,9 @@ static int __devinit ci13xxx_imx_probe(struct 
   platform_device *pdev)
 *pdev-dev.dma_mask = DMA_BIT_MASK(32);
 dma_set_coherent_mask(pdev-dev, *pdev-dev.dma_mask);
 }
   +
   + usbmisc_ops-init(pdev-dev);
  
  usbmisc_ops can be NULL and also can return an error.
 Yes. And I find it can not work when usbmisc is module.
It's hard to resolve module dependency. How about build all imx related
things into a single module? ci13xxx_imx module init will call
usbmisc_imx6q_drv_init, usbmisc_imx53_drv_init etc.

Thanks
Richard
--
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 v2 1/2] USB: chipidea: add imx usbmisc support

2012-07-18 Thread Marc Kleine-Budde
On 07/18/2012 03:39 PM, Richard Zhao wrote:
 [snip]
  static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = 
 {
.name   = ci13xxx_imx,
.flags  = CI13XXX_REQUIRE_TRANSCEIVER |
 @@ -120,6 +140,9 @@ static int __devinit ci13xxx_imx_probe(struct 
 platform_device *pdev)
*pdev-dev.dma_mask = DMA_BIT_MASK(32);
dma_set_coherent_mask(pdev-dev, *pdev-dev.dma_mask);
}
 +
 +  usbmisc_ops-init(pdev-dev);

 usbmisc_ops can be NULL and also can return an error.
 Yes. And I find it can not work when usbmisc is module.
 It's hard to resolve module dependency. How about build all imx related
 things into a single module? ci13xxx_imx module init will call
 usbmisc_imx6q_drv_init, usbmisc_imx53_drv_init etc.

Why not call a single imx_usbmisc_init. The usbmisc can call the correct
function inside. The right init function can be selected via the
compatible in the device tree.

Marc
-- 
Pengutronix e.K.  | Marc Kleine-Budde   |
Industrial Linux Solutions| Phone: +49-231-2826-924 |
Vertretung West/Dortmund  | Fax:   +49-5121-206917- |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |



signature.asc
Description: OpenPGP digital signature


Re: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Oliver Neukum wrote:

  I have a question that reset-resume still can not resolve firmware 
  problem? I think this depend on driver. right?
 
 Right, but this is not really useful information. We can infer from
 a lack of support for reset_resume() that we must not cut power.
 The reverse conclusion is invalid, unfortunately.

Why?  If the driver claims to support reset-resume then it must have a
way to insure that firmware is reloaded when necessary.

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: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Lan Tianyu

On 2012/7/18 22:19, Alan Stern wrote:

An alternative to her suggestion would be to disconnect the device when
the port goes off.  When the port is powered back on, the device will
be rediscovered and probed again.

hi alan:
Reprobe may cause the devnum change. Userspace will treat it a
different device from previous one. e.g app held the device node fd,
After port went off and on, device reprobed and the fd became invalid.

This relies on userspace doing the work instead of the kernel making

 everything happen automatically.


Alan Stern




--
Best Regards
Tianyu Lan
linux kernel enabling team
--
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 1/2] usb: Add quirk detection based on interface information

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Laurent Pinchart wrote:

 When a whole class of devices (possibly from a specific vendor, or
 across multiple vendors) require a quirk, explictly listing all devices
 in the class make the quirks table unnecessarily large. Fix this by
 allowing matching devices based on interface information.
 
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com


 --- a/drivers/usb/core/hub.c
 +++ b/drivers/usb/core/hub.c
 @@ -2170,6 +2170,8 @@ int usb_new_device(struct usb_device *udev)
   udev-dev.devt = MKDEV(USB_DEVICE_MAJOR,
   (((udev-bus-busnum-1) * 128) + (udev-devnum-1)));
  
 + usb_detect_interface_quirks(udev);
 +

This is not good, because it ignores usb_authorize_device().  That's 
why I said earlier that the interface quirks should be detected at the 
end of usb_enumerate_device().

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 v3 1/2] usb: Add quirk detection based on interface information

2012-07-18 Thread Laurent Pinchart
Hi Alan,

On Wednesday 18 July 2012 10:59:41 Alan Stern wrote:
 On Wed, 18 Jul 2012, Laurent Pinchart wrote:
  When a whole class of devices (possibly from a specific vendor, or
  across multiple vendors) require a quirk, explictly listing all devices
  in the class make the quirks table unnecessarily large. Fix this by
  allowing matching devices based on interface information.
  
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  
  
  --- a/drivers/usb/core/hub.c
  +++ b/drivers/usb/core/hub.c
  @@ -2170,6 +2170,8 @@ int usb_new_device(struct usb_device *udev)
  
  udev-dev.devt = MKDEV(USB_DEVICE_MAJOR,
  
  (((udev-bus-busnum-1) * 128) + (udev-devnum-1)));
  
  +   usb_detect_interface_quirks(udev);
  +
 
 This is not good, because it ignores usb_authorize_device().  That's
 why I said earlier that the interface quirks should be detected at the
 end of usb_enumerate_device().

My bad, sorry.

Is there any chance the device can return different descriptors in separate 
usb_authorize_device() calls, leading to different quirks ?

-- 
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 v3 1/2] usb: Add quirk detection based on interface information

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Laurent Pinchart wrote:

  This is not good, because it ignores usb_authorize_device().  That's
  why I said earlier that the interface quirks should be detected at the
  end of usb_enumerate_device().
 
 My bad, sorry.
 
 Is there any chance the device can return different descriptors in separate 
 usb_authorize_device() calls, leading to different quirks ?

No, I don't think so.

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: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Oliver Neukum wrote:

 On Wednesday 18 July 2012 10:54:20 Alan Stern wrote:
  On Wed, 18 Jul 2012, Lan Tianyu wrote:
  
   On 2012/7/18 22:19, Alan Stern wrote:
An alternative to her suggestion would be to disconnect the device when
the port goes off.  When the port is powered back on, the device will
be rediscovered and probed again.
   hi alan:
 Reprobe may cause the devnum change. Userspace will treat it a
   different device from previous one. e.g app held the device node fd,
   After port went off and on, device reprobed and the fd became invalid.
  
  That's right.  Your argument suggests that power-off should be 
  controlled by userspace, not by the kernel, and it should happen only 
  when no app is holding the device node open.
 
 That is a race. And it is basically unsolvable in user space if the device
 is available to everybody.

Everything userspace does is a race.

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: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Oliver Neukum
On Wednesday 18 July 2012 11:42:50 Alan Stern wrote:
 On Wed, 18 Jul 2012, Oliver Neukum wrote:
 
  On Wednesday 18 July 2012 10:54:20 Alan Stern wrote:
   On Wed, 18 Jul 2012, Lan Tianyu wrote:
   
On 2012/7/18 22:19, Alan Stern wrote:
 An alternative to her suggestion would be to disconnect the device 
 when
 the port goes off.  When the port is powered back on, the device will
 be rediscovered and probed again.
hi alan:
Reprobe may cause the devnum change. Userspace will treat it a
different device from previous one. e.g app held the device node fd,
After port went off and on, device reprobed and the fd became invalid.
   
   That's right.  Your argument suggests that power-off should be 
   controlled by userspace, not by the kernel, and it should happen only 
   when no app is holding the device node open.
  
  That is a race. And it is basically unsolvable in user space if the device
  is available to everybody.
 
 Everything userspace does is a race.

Therefore some things should be done in kernel space ;-)

Regards
Oliver

--
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 PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Bjørn Mork
Alan Stern st...@rowland.harvard.edu writes:

 Any attempt to use a suspended device will return an error, whether the
 port is powered off or not.  The driver has to resume the device before
 using it, and Sarah is proposing that this should cause the port to
 power back on.

Assuming that powering off a port means removing power from any bus
powered device, won't this be something completely different from doing
a USB resume or reset_resume? Complex devices may choose to keep parts
of the system running while suspended in the USB bus context.
Removing power will prevent this if the device is bus powered (which I
believe you never know as there are too many devices lying about this
for various reasons).

Even if a driver support reset_resume, that only means that the driver
knows how to recreate the device state after a USB bus reset.  It does
*not* mean that the driver knows how to recreate the device state after a
cold boot of the device.  That is in general not possible.  The only way
is usually to reinitialize from scratch.  I.e. disconnect.

Somehow I am pretty sure that nothing of this is news to any of you, so
I am now sitting here wondering what part of this discussion I've
completely misunderstood...



Bjørn
--
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 net-next] net: qmi_wwan: make dynamic device IDs work

2012-07-18 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Tue, 17 Jul 2012 23:14:32 +0200

 The usbnet API use the device ID table to store a pointer to
 a minidriver. Setting a generic pointer for dynamic device
 IDs will in most cases make them work as expected.  usbnet
 will otherwise treat the dynamic IDs as blacklisted. That is
 rarely useful.
 
 There is no standard class describing devices supported by
 this driver, and most vendors don't even provide enough
 information to allow vendor specific wildcard matching. The
 result is that most of the supported devices must be
 explicitly listed in the device table.  Allowing dynamic IDs
 to work both simplifies testing and verification of new
 devices, and provides a way for end users to use a device
 before the ID is added to the driver.
 
 Signed-off-by: Bjørn Mork bj...@mork.no

Applied.
--
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 PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Oliver Neukum wrote:

 On Wednesday 18 July 2012 11:42:50 Alan Stern wrote:
  On Wed, 18 Jul 2012, Oliver Neukum wrote:
  
   On Wednesday 18 July 2012 10:54:20 Alan Stern wrote:
On Wed, 18 Jul 2012, Lan Tianyu wrote:

 On 2012/7/18 22:19, Alan Stern wrote:
  An alternative to her suggestion would be to disconnect the device 
  when
  the port goes off.  When the port is powered back on, the device 
  will
  be rediscovered and probed again.
 hi alan:
   Reprobe may cause the devnum change. Userspace will treat it a
 different device from previous one. e.g app held the device node fd,
 After port went off and on, device reprobed and the fd became invalid.

That's right.  Your argument suggests that power-off should be 
controlled by userspace, not by the kernel, and it should happen only 
when no app is holding the device node open.
   
   That is a race. And it is basically unsolvable in user space if the device
   is available to everybody.
  
  Everything userspace does is a race.
 
 Therefore some things should be done in kernel space ;-)

Oliver, you seem to be arguing both sides of this discussion.  You 
point out the the power-off operation is too dangerous in general for 
the kernel to do it, and now you say that it's too racy for userspace 
to do it.

Are we to infer that you don't want it to be done at all?

What about things like the ubiquitous USB webcams one finds in laptops 
these days?  I practically never use the one in my laptop, so turning 
off its bus power seems like a good idea.  Even if that means I have to 
turn the power on explicitly before using the webcam.

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] net: qmi_wwan: add ZTE MF821D

2012-07-18 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Thu, 12 Jul 2012 13:18:26 +0200

 Sold by O2 (telefonica germany) under the name LTE4G
 
 Tested-by: Thomas Schäfer tschae...@t-online.de
 Signed-off-by: Bjørn Mork bj...@mork.no

Applied to net-next, thanks.
--
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 PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Bjørn Mork wrote:

 Alan Stern st...@rowland.harvard.edu writes:
 
  Any attempt to use a suspended device will return an error, whether the
  port is powered off or not.  The driver has to resume the device before
  using it, and Sarah is proposing that this should cause the port to
  power back on.
 
 Assuming that powering off a port means removing power from any bus
 powered device, won't this be something completely different from doing
 a USB resume or reset_resume? Complex devices may choose to keep parts
 of the system running while suspended in the USB bus context.

Probably not anything significant, if they are bus powered.  If they 
are self powered then they continue to keep various parts running even 
when bus power is turned off.

 Removing power will prevent this if the device is bus powered (which I
 believe you never know as there are too many devices lying about this
 for various reasons).
 
 Even if a driver support reset_resume, that only means that the driver
 knows how to recreate the device state after a USB bus reset.  It does
 *not* mean that the driver knows how to recreate the device state after a
 cold boot of the device.  That is in general not possible.  The only way
 is usually to reinitialize from scratch.  I.e. disconnect.

Oliver pointed this out a few emails back.  It's worth mentioning, 
however, that drivers _do_ have to face this possibility when resuming 
from hibernation.  And as Oliver said, sometimes this does indeed 
result in a disconnect.

 Somehow I am pretty sure that nothing of this is news to any of you, so
 I am now sitting here wondering what part of this discussion I've
 completely misunderstood...

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] xhci: EHCI/xHCI ports switching on Intense-PC.

2012-07-18 Thread Sarah Sharp
On Wed, Jul 18, 2012 at 09:57:30AM +0300, Denis Turischev wrote:
 On 07/17/2012 07:54 AM, Sarah Sharp wrote:
  On Mon, Jul 16, 2012 at 07:46:06PM +0300, Denis Turischev wrote:
  Intense-PC is Compulab's mini-desktop with Intel Panther Point
  chipset.
 
  Unconditional ports switching provided by function
  usb_enable_xhci_ports() leads to surprising results, after shutdown
  system powered-on again after a few seconds. On Windows power
  related problems were not observed.
  
  Do you have wake on lan enabled in the BIOS?  I have heard reports from
  other users that this is a BIOS bug triggered by WOL.
 
 Bug appears with WOL disabled too, moreover, it appears with PCH LAN
 disabled at all in the BIOS.

Hmm, ok, not the same bug then.

  No, this fix is not acceptable.  You won't get USB 3.0 speeds if the
  ports are not switched over.  Now, we can add a quirk to the xHCI
  shutdown function to switch the ports back to EHCI on shutdown.  That
  might not trigger the BIOS bug.
 
 Yes, switching back to EHCI in xhci_shutdown() solves the problem.

Ok, good to know.

The other thing to try would be to turn off all wake on bits in the
port status registers in xhci_shutdown().  That might cause the xHCI
host to stop generating spurious PMEs.

It would actually be good to check that the xHCI host is the cause of
the PME that reboots the system.  I'm pretty sure there's a sysfs or
proc file that shows where the PMEs are coming from, but I can't
remember where it is off the top of my head.

 I suppose to do something like this in xhci_shutdown:
   pdev = to_pci_dev(hcd-self.controller);
 
   if (usb_is_intel_switchable_xhci(pdev)){
   brd_name = dmi_get_system_info(DMI_BOARD_NAME);
 
   /* quirk for Compulab's Intense-PC board */
   if (brd_name  strstr(brd_name, Intense-PC))
   usb_disable_xhci_ports(pdev);
   }
 
 Is it ok?
 
 May be it worth to disable xhci ports for all intel switchable
 devices, not only for Intense-PC?

I'm not sure.  I'm still talking with our hardware and BIOS team to
determine which boards have this issue.  I suspect it's more than just
your board.

The only thing I wonder is if the PCI quirks will run when the xHCI
driver is reloaded.  If not, the ports will never be switched back to
xHCI.

We might need to add a port switch back to xHCI in the xhci_init
function.  That means if someone unloads the xHCI driver and reloads it,
their devices will appear under EHCI, and then disconnect and switch
over to xHCI.

However, I suppose that's the same as what happens if you unload the
EHCI driver on a system with an OHCI or UHCI companion controller.  So I
think it should be OK to attempt to switchover the ports in xhci_init.

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: Kernel tracing options with USB subsystem

2012-07-18 Thread Maxin B John
Hi Bala,

On Wed, Jul 18, 2012 at 7:45 PM, Balakumar kernelfana...@gmail.com wrote:
 Hello All,

 I see that there are no tracing options (e.g. traceevents) defined in the
 USB subsystem. Like, they have been defined for scsi, scheduler, workqueues
 etc (include/trace/events/*). I am fairly new to Linux and I am trying to
 study the debugging options available. Just wanted to understand why such
 kernel tracing options are not used with USB.

Probably you are looking for usbmon. The usbmon documentation is
available at Documentation/usb/usbmon.txt.

 ~Bala
Best Regards,
Maxin B. John
--
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 PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Sarah Sharp
On Wed, Jul 18, 2012 at 12:40:38PM -0400, Alan Stern wrote:
 On Wed, 18 Jul 2012, Oliver Neukum wrote:
 
  On Wednesday 18 July 2012 11:42:50 Alan Stern wrote:
   On Wed, 18 Jul 2012, Oliver Neukum wrote:
   
On Wednesday 18 July 2012 10:54:20 Alan Stern wrote:
 On Wed, 18 Jul 2012, Lan Tianyu wrote:
 
  On 2012/7/18 22:19, Alan Stern wrote:
   An alternative to her suggestion would be to disconnect the 
   device when
   the port goes off.  When the port is powered back on, the device 
   will
   be rediscovered and probed again.
  hi alan:
  Reprobe may cause the devnum change. Userspace will treat it a
  different device from previous one. e.g app held the device node fd,
  After port went off and on, device reprobed and the fd became 
  invalid.
 
 That's right.  Your argument suggests that power-off should be 
 controlled by userspace, not by the kernel, and it should happen only 
 when no app is holding the device node open.

That is a race. And it is basically unsolvable in user space if the 
device
is available to everybody.
   
   Everything userspace does is a race.
  
  Therefore some things should be done in kernel space ;-)
 
 Oliver, you seem to be arguing both sides of this discussion.  You 
 point out the the power-off operation is too dangerous in general for 
 the kernel to do it, and now you say that it's too racy for userspace 
 to do it.
 
 Are we to infer that you don't want it to be done at all?
 
 What about things like the ubiquitous USB webcams one finds in laptops 
 these days?  I practically never use the one in my laptop, so turning 
 off its bus power seems like a good idea.  Even if that means I have to 
 turn the power on explicitly before using the webcam.

Are there any webcams that require firmware?  Perhaps we can look at the
drivers on a case-by-case basis and see if we can power off the port
during suspend.

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: Kernel tracing options with USB subsystem

2012-07-18 Thread Alan Stern
On Wed, 18 Jul 2012, Balakumar wrote:

 Hello All,
 
 I see that there are no tracing options (e.g. traceevents) defined in 
 the USB subsystem. Like, they have been defined for scsi, scheduler, 
 workqueues etc (include/trace/events/*). I am fairly new to Linux and I 
 am trying to study the debugging options available. Just wanted to 
 understand why such kernel tracing options are not used with USB.

As far as I know, the only reason there aren't any USB tracepoints is 
because nobody has ever felt the need to add some.

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: [RFC PATCH] USB: enable power/wakeup to control remote wakeup in the runtime suspend

2012-07-18 Thread Oliver Neukum
On Wednesday 18 July 2012 12:40:38 Alan Stern wrote:
 
 Oliver, you seem to be arguing both sides of this discussion.  You

But there are more than two sides in this discussion.

 point out the the power-off operation is too dangerous in general for 
 the kernel to do it, and now you say that it's too racy for userspace 
 to do it.

It is too dangerous in general. Therefore it may be safe in particular.
 
 Are we to infer that you don't want it to be done at all?

No, now that I think about it an attribute for the drivers is necessary.
Like drivers have supports_autosuspend they also should have 
supports_power_off. In addition it is necessary for ports to have
an attribute in sysfs which allows user space to block power off.

And it is a bit complicated. Power may be cut, if

a) a port is internal and unpluggable, or

b) a port is internal and it's interfaces' drivers set supports_power_off, 
unless:

1) remote wakeup is requested
2) user space has blocked it via the new sysfs attribute
3) USB_QUIRK_RESET_MORPHS is set

 What about things like the ubiquitous USB webcams one finds in laptops 
 these days?  I practically never use the one in my laptop, so turning 
 off its bus power seems like a good idea.  Even if that means I have to 
 turn the power on explicitly before using the webcam.

That would work. Btusb wouldn't work.

Regards
Oliver

--
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] usb composite: fix locking in usb_function_activate

2012-07-18 Thread Michael Grzeschik
The lockdep hunter mentions a non consistent usage of spin_lock and
spin_lock_irqsafe in the composite_disconnect and usb_function_activate
function:

[   15.700897] =
[   15.705255] [ INFO: inconsistent lock state ]
[   15.709617] 3.5.0-rc5+ #413 Not tainted
[   15.713453] -
[   15.717812] inconsistent {HARDIRQ-ON-W} - {IN-HARDIRQ-W} usage.
[   15.723822] uvc-gadget/116 [HC1[1]:SC0[0]:HE0:SE1] takes:
[   15.729222]  ((cdev-lock)-rlock){?.+...}, at: [7f0049e8] 
composite_disconnect+0x2c/0x74 [g_webcam]
[   15.738797] {HARDIRQ-ON-W} state was registered at:
[   15.743677]   [8006de3c] mark_lock+0x148/0x688
[   15.748325]   [8006ecb0] __lock_acquire+0x934/0x1b74
[   15.753481]   [8007047c] lock_acquire+0x98/0x138
[   15.758288]   [804c776c] _raw_spin_lock+0x4c/0x84
[   15.763188]   [7f006ae4] usb_function_activate+0x28/0x94 [g_webcam]
[   15.769652]   [7f00820c] usb_ep_autoconfig_reset+0x78/0x98 [g_webcam]
[   15.776287]   [7f0082a4] uvc_v4l2_open+0x78/0x94 [g_webcam]
[   15.782054]   [80366a38] v4l2_open+0x104/0x130
[   15.786697]   [800efd30] chrdev_open+0xa0/0x170
[   15.791423]   [800e9718] do_dentry_open.isra.13+0x1e8/0x264
[   15.797186]   [800ea5d4] nameidata_to_filp+0x58/0x94
[   15.802340]   [800fa29c] do_last.isra.31+0x2a0/0x808
[   15.807497]   [800faa40] path_openat+0xc8/0x3e8
[   15.812216]   [800fae90] do_filp_open+0x3c/0x90
[   15.816936]   [800ea6fc] do_sys_open+0xec/0x184
[   15.821655]   [800ea7c4] sys_open+0x30/0x34
[   15.826027]   [8000e5c0] ret_fast_syscall+0x0/0x48
[   15.831015] irq event stamp: 6048
[   15.834330] hardirqs last  enabled at (6047): [804c81b8] 
_raw_spin_unlock_irqrestore+0x40/0x54
[   15.843132] hardirqs last disabled at (6048): [8000e174] 
__irq_svc+0x34/0x60
[   15.850370] softirqs last  enabled at (5940): [80028380] 
__do_softirq+0x188/0x270
[   15.858043] softirqs last disabled at (5935): [80028944] irq_exit+0xa0/0xa8
[   15.865195]
[   15.865195] other info that might help us debug this:
[   15.871724]  Possible unsafe locking scenario:
[   15.871724]
[   15.877645]CPU0
[   15.880091]
[   15.882537]   lock((cdev-lock)-rlock);
[   15.886659]   Interrupt
[   15.889278] lock((cdev-lock)-rlock);
[   15.893573]
[   15.893573]  *** DEADLOCK ***
[   15.893573]
[   15.899496] no locks held by uvc-gadget/116.
[   15.903765]
[   15.903765] stack backtrace:
[   15.908125] Backtrace:
[   15.910604] [80012038] (dump_backtrace+0x0/0x114) from [804bf8a4] 
(dump_stack+0x20/0x24)
[   15.919043]  r6:dfb8e6f0 r5:dfb8e400 r4:809717ec r3:6193
[   15.924766] [804bf884] (dump_stack+0x0/0x24) from [804c0c0c] 
(print_usage_bug+0x258/0x2c0)
[   15.933388] [804c09b4] (print_usage_bug+0x0/0x2c0) from [8006e240] 
(mark_lock+0x54c/0x688)
[   15.942006] [8006dcf4] (mark_lock+0x0/0x688) from [8006edb8] 
(__lock_acquire+0xa3c/0x1b74)
[   15.950625] [8006e37c] (__lock_acquire+0x0/0x1b74) from [8007047c] 
(lock_acquire+0x98/0x138)
[   15.959418] [800703e4] (lock_acquire+0x0/0x138) from [804c78fc] 
(_raw_spin_lock_irqsave+0x58/0x94)
[   15.968736] [804c78a4] (_raw_spin_lock_irqsave+0x0/0x94) from [7f0049e8] 
(composite_disconnect+0x2c/0x74 [g_webcam])
[   15.979605]  r7:0012 r6:df82b0c4 r5:ded755bc r4:ded75580
[   15.985331] [7f0049bc] (composite_disconnect+0x0/0x74 [g_webcam]) from 
[8033c170] (_gadget_stop_activity+0xc4/0x120)
[   15.996200]  r6:df82b0c4 r5:df82b0c8 r4:df82b0d0 r3:7f0049bc
[   16.001919] [8033c0ac] (_gadget_stop_activity+0x0/0x120) from [8033e390] 
(udc_irq+0x724/0xcb8)
[   16.010877]  r6:df82b010 r5: r4:df82b010 r3:
[   16.016595] [8033dc6c] (udc_irq+0x0/0xcb8) from [8033baec] 
(ci_irq+0x64/0xdc)
[   16.024086] [8033ba88] (ci_irq+0x0/0xdc) from [80086538] 
(handle_irq_event_percpu+0x74/0x298)
[   16.032958]  r5:807fd414 r4:df38fdc0
[   16.036566] [800864c4] (handle_irq_event_percpu+0x0/0x298) from 
[800867a8] (handle_irq_event+0x4c/0x6c)
[   16.046315] [8008675c] (handle_irq_event+0x0/0x6c) from [80089318] 
(handle_level_irq+0xbc/0x11c)
[   16.055447]  r6:def04000 r5:807fd414 r4:807fd3c0 r3:0002
[   16.061166] [8008925c] (handle_level_irq+0x0/0x11c) from [80085cc8] 
(generic_handle_irq+0x38/0x4c)
[   16.070472]  r5:807f7f64 r4:8081e9f8
[   16.074082] [80085c90] (generic_handle_irq+0x0/0x4c) from [8000ef98] 
(handle_IRQ+0x5c/0xbc)
[   16.082788] [8000ef3c] (handle_IRQ+0x0/0xbc) from [800085cc] 
(tzic_handle_irq+0x6c/0x9c)
[   16.091225]  r8: r7:def059b0 r6:0001 r5: r4:
r3:0012
[   16.099141] [80008560] (tzic_handle_irq+0x0/0x9c) from [8000e184] 
(__irq_svc+0x44/0x60)
[   16.107494] Exception stack(0xdef059b0 to 0xdef059f8)
[   16.112550] 59a0: 0001 0001 
 dfb8e400
[   16.120732] 59c0: 4013 81a2e500  81a2e500   
80862418 def05a0c
[   16.128912] 59e0: def059c8 def059f8 80070e24 804c81bc 2013 
[   16.135542] [804c8178] 

[PATCH] usb: chipidea: ci13xxx-imx: remove global struct

2012-07-18 Thread Michael Grzeschik
This patch removes the limitation of having only one
instance of the ci13xxx-imx. Each instance of the ci13xxx-imx
could have different flags to be configured with, so we also
move this settings to the devicetree properties.

Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
---
 .../devicetree/bindings/usb/ci13xxx-imx.txt|6 +
 drivers/usb/chipidea/ci13xxx_imx.c |   25 +++-
 drivers/usb/chipidea/core.c|   11 +
 include/linux/usb/chipidea.h   |3 +++
 4 files changed, 34 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt 
b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
index 2c29041..5485eb9 100644
--- a/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
+++ b/Documentation/devicetree/bindings/usb/ci13xxx-imx.txt
@@ -8,6 +8,9 @@ Required properties:
 Optional properties:
 - fsl,usbphy: phandler of usb phy that connects to the only one port
 - vbus-supply: regulator for vbus
+- require-transceiver: enable the flag in the driver
+- pullup-on-vbus: enable the flag in the driver
+- disable-streaming: enable the flag in the driver
 
 Examples:
 usb@02184000 { /* USB OTG */
@@ -15,4 +18,7 @@ usb@02184000 { /* USB OTG */
reg = 0x02184000 0x200;
interrupts = 0 43 0x04;
fsl,usbphy = usbphy1;
+   require-transceiver;
+   pullup-on-vbus;
+   disable-streaming;
 };
diff --git a/drivers/usb/chipidea/ci13xxx_imx.c 
b/drivers/usb/chipidea/ci13xxx_imx.c
index f741a02..7116b0c 100644
--- a/drivers/usb/chipidea/ci13xxx_imx.c
+++ b/drivers/usb/chipidea/ci13xxx_imx.c
@@ -58,18 +58,10 @@ static int ci13xxx_imx_vbus(struct ci13xxx *ci, int enable)
return ret;
 }
 
-static struct ci13xxx_platform_data ci13xxx_imx_platdata __devinitdata  = {
-   .name   = ci13xxx_imx,
-   .flags  = CI13XXX_REQUIRE_TRANSCEIVER |
- CI13XXX_PULLUP_ON_VBUS |
- CI13XXX_DISABLE_STREAMING,
-   .capoffset  = DEF_CAPOFFSET,
-   .set_vbus_power = ci13xxx_imx_vbus,
-};
-
 static int __devinit ci13xxx_imx_probe(struct platform_device *pdev)
 {
struct ci13xxx_imx_data *data;
+   struct ci13xxx_platform_data *pdata;
struct platform_device *plat_ci;
struct resource *res;
struct regulator *reg_vbus;
@@ -77,6 +69,17 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
struct usb_phy *phy;
int ret;
 
+   pdata = devm_kzalloc(pdev-dev, sizeof(*pdata), GFP_KERNEL);
+   if (!pdata) {
+   dev_err(pdev-dev, Failed to allocate CI13xxx-IMX pdata!\n);
+   return -ENOMEM;
+   }
+
+   pdata-name = ci13xxx_imx;
+   pdata-capoffset = DEF_CAPOFFSET;
+   pdata-set_vbus_power = ci13xxx_imx_vbus;
+   ci13xxx_get_dr_flags(pdev-dev.of_node, pdata);
+
data = devm_kzalloc(pdev-dev, sizeof(*data), GFP_KERNEL);
if (!data) {
dev_err(pdev-dev, Failed to allocate CI13xxx-IMX data!\n);
@@ -112,7 +115,7 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
if (!IS_ERR_OR_NULL(phy)) {
usb_phy_init(phy);
data-phy = phy;
-   ci13xxx_imx_platdata.phy = phy;
+   pdata-phy = phy;
}
 
/* we only support host now, so enable vbus here */
@@ -140,7 +143,7 @@ static int __devinit ci13xxx_imx_probe(struct 
platform_device *pdev)
 
plat_ci = ci13xxx_add_device(pdev-dev,
pdev-resource, pdev-num_resources,
-   ci13xxx_imx_platdata);
+   pdata);
if (IS_ERR(plat_ci)) {
ret = PTR_ERR(plat_ci);
dev_err(pdev-dev,
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 0942b9b..556ac76 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -390,6 +390,17 @@ void ci13xxx_remove_device(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(ci13xxx_remove_device);
 
+void ci13xxx_get_dr_flags(struct device_node *of_node, struct 
ci13xxx_platform_data *pdata)
+{
+   if (of_find_property(of_node, require-transceiver, NULL))
+   pdata-flags |= CI13XXX_REQUIRE_TRANSCEIVER;
+   if (of_find_property(of_node, pullup-on-vbus, NULL))
+   pdata-flags |= CI13XXX_PULLUP_ON_VBUS;
+   if (of_find_property(of_node, disable-streaming, NULL))
+   pdata-flags |= CI13XXX_DISABLE_STREAMING;
+}
+EXPORT_SYMBOL_GPL(ci13xxx_get_dr_flags);
+
 static int __devinit ci_hdrc_probe(struct platform_device *pdev)
 {
struct device   *dev = pdev-dev;
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 080f479..0f8cdbb 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ 

Re: [PATCH 00/12] chipidea/imx: add otg support and some bug fix

2012-07-18 Thread Richard Zhao
On Mon, Jul 16, 2012 at 05:40:57PM -0700, Greg KH wrote:
 On Thu, Jul 12, 2012 at 03:01:40PM +0800, Richard Zhao wrote:
  The patch set is tested on imx6q_sabrelite board.
  
  The patch can also be found at
  https://github.com/riczhao/kernel-imx/commits/topics/usb-driver
  
  For test which merged platform patches:
  https://github.com/riczhao/kernel-imx/commits/topics/usb-test
  
  It's better apply after patch I sent out:
  usb: chipidea: cleanup dma_pool if udc_start() fails
 
 I need acks from Alexander before I can accept any of these.
ping Alexander ...
 
 thanks,
 
 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 v5 08/13] ARM: imx6q: add config-on-boot gpios

2012-07-18 Thread Richard Zhao
On Tue, Jul 17, 2012 at 02:30:17PM +0200, Dirk Behme wrote:
 On 13.06.2012 14:34, Richard Zhao wrote:
 Sometimes, boards have gpios that don't own by any driver or owner
 by a generic driver that don't like hacks. Such gpios is normally
 output and need setup once on boot. So I introduce the config-on-boot
 gpios.
 
 Signed-off-by: Richard Zhao richard.z...@freescale.com
 Cc: Shawn Guo shawn@linaro.org
 Cc: Rob Herring rob.herr...@calxeda.com
 Cc: Grant Likely grant.lik...@secretlab.ca
 ---
  .../devicetree/bindings/arm/config-on-boot.txt |   12 +++
  arch/arm/boot/dts/imx6q-sabrelite.dts  |7 
  arch/arm/mach-imx/mach-imx6q.c |   35 
  
  3 files changed, 54 insertions(+)
  create mode 100644 Documentation/devicetree/bindings/arm/config-on-boot.txt
 
 diff --git a/Documentation/devicetree/bindings/arm/config-on-boot.txt 
 b/Documentation/devicetree/bindings/arm/config-on-boot.txt
 new file mode 100644
 index 000..f98ed74
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/arm/config-on-boot.txt
 @@ -0,0 +1,12 @@
 +* Configure on Boot
 +
 +Node name: config-on-boot
 +  It must be in root node. config-on-boot means to describe settings that 
 needs
 +  to be set one time on boot but aren't owned by any driver, or the owned 
 driver
 +  is too generic to handle such settings. For example, usb hub uses generic
 +  driver in usb core code, a on-board usb may need deassert reset pin.
 +
 +Optional properties:
 +- output-gpios: Output gpio array that needs to set.
 +- output-gpio-values: This property is required if output-gpios is set.
 +  The value is a array of 0 or 1. Total count eaquals the number of gpios.
 diff --git a/arch/arm/boot/dts/imx6q-sabrelite.dts 
 b/arch/arm/boot/dts/imx6q-sabrelite.dts
 index e0ec929..1dd2261 100644
 --- a/arch/arm/boot/dts/imx6q-sabrelite.dts
 +++ b/arch/arm/boot/dts/imx6q-sabrelite.dts
 @@ -17,6 +17,13 @@
  model = Freescale i.MX6 Quad SABRE Lite Board;
  compatible = fsl,imx6q-sabrelite, fsl,imx6q;
 +config-on-boot {
 +output-gpios = 
 +gpio3 22 0;   /* vbus reset */
 +output-gpio-values = 
 +1; /* vbus reset */
 +};
 +
  memory {
  reg = 0x1000 0x4000;
  };
 diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
 index b47e98b..577cf19 100644
 --- a/arch/arm/mach-imx/mach-imx6q.c
 +++ b/arch/arm/mach-imx/mach-imx6q.c
 @@ -19,6 +19,7 @@
  #include linux/irqdomain.h
  #include linux/of.h
  #include linux/of_address.h
 +#include linux/of_gpio.h
  #include linux/of_irq.h
  #include linux/of_platform.h
  #include linux/pinctrl/machine.h
 @@ -113,6 +114,38 @@ static void __init imx6q_sabrelite_init(void)
  imx6q_sabrelite_cko1_setup();
  }
 +static void __init imx6q_config_on_boot(void)
 +{
 +struct device_node *np;
 +struct property *pp;
 +int cnt, len, i;
 +int gpio;
 +
 +np = of_find_node_by_path(/config-on-boot);
 +if (!np)
 +return;
 +cnt = of_gpio_named_count(np, output-gpios);
 +pp = of_find_property(np, output-gpio-values, len);
 +if (!pp || cnt != len / sizeof(u32)) {
 +pr_err(Invalid config-on-boot gpios!\n);
 +of_node_put(np);
 +return;
 +}
 +for (i = 0; i  cnt; i++) {
 +gpio = of_get_named_gpio(np, output-gpios, i);
 +if (gpio_is_valid(gpio))
 +gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH,
 +config-on-boot);
 
 While trying to use this code: Is there a special reason why all
 pins are set to HIGH here? The contents of 'output-gpio-values' seem
 to be ignored?
It may be bug here. The patch is rejected. imx6_sabrelite happens work
by default value. So I won't follow it any more.

Thanks
Richard
 
 Best regards
 
 Dirk
 

--
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: some questions about usb_serial_probe

2012-07-18 Thread loody
Hi:

2012/7/18 Alan Stern st...@rowland.harvard.edu:
 On Wed, 18 Jul 2012, loody wrote:

 hi all:

 2012/7/18 loody milo...@gmail.com:
  hi:
 
  2012/7/18 Greg KH gre...@linuxfoundation.org:
  On Wed, Jul 18, 2012 at 11:22:49AM +0800, loody wrote:
  Dear all:
  in usb_serial_probe, we create tty_port based on max_endpoints.
 
  Or based on the number that the driver said to create.
 
  My questions are:
  1. some callback functions, such serial_hangup, serial_carrier_raised,
  etc. will called by tty layer with different tty_ports.
  how tty layer know these tty_ports?
 
  They were registered with the tty layer.
 
  I only found tty_port_init to initial these tty_ports, but where we
  register these tty_ports to tty layer?
 
  When we register the tty device.
  Would you mind to tell me which function it is?
 after tracing source code, usb_serial_device_probe seems where we
 register tty device.
 But we only let tty know, tty_driver, index and struct device.
 it seems we don't let tty know how many tty_ports we created.
 Thanks for your help in advance,

 You didn't look at usb_serial_probe.  At the end of that function there
I found what you mentioned.
for (i = 0; i  num_ports; ++i) {

retval = device_add(port-dev);
...
 is a loop which runs over all the ports and registers them one at a
 time with the device layer.  When it is registered, the port is passed
 to usb_serial_device_probe, which then registers the port with the tty
 layer.
The port we pass to usb_serial_device_probe are usb_serial_port
instead of tty_port, we get it through to_usb_serial_port(dev);

in usb_serial_device_probe, it do following things.
1. try to call port_probe, which seems do some control for usb_port
instead of tty port.
2. calling device_create_file(dev, dev_attr_port_number);
dev in above function is embedded in usb_port not in tty_port.
3. tty_register_device(usb_serial_tty_driver, minor, dev); this is
most likely where we register tty port.
but all three parameters have no relations to tty port.

if above flow is correct, how tty layer know how many tty_ports this
usb device have?

appreciate your help,
--
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 v3 02/11] usb: musb: kill global and static for multi instance

2012-07-18 Thread Ajay Kumar Gupta
Moved global variable musb_debugfs_root and static variable
old_state to 'struct musb' to help support multi instance of
musb controller as present on AM335x platform.

Also removed the global variable orig_dma_mask and filled the
dev-dma_mask with parent device's dma_mask.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
---
 drivers/usb/musb/musb_core.c|   16 +++-
 drivers/usb/musb/musb_core.h|4 
 drivers/usb/musb/musb_debugfs.c |   14 --
 3 files changed, 15 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 3e09984..a5db4dd 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1802,10 +1802,9 @@ static const struct attribute_group musb_attr_group = {
 static void musb_irq_work(struct work_struct *data)
 {
struct musb *musb = container_of(data, struct musb, irq_work);
-   static int old_state;
 
-   if (musb-xceiv-state != old_state) {
-   old_state = musb-xceiv-state;
+   if (musb-xceiv-state != musb-xceiv_old_state) {
+   musb-xceiv_old_state = musb-xceiv-state;
sysfs_notify(musb-controller-kobj, NULL, mode);
}
 }
@@ -2115,11 +2114,6 @@ fail0:
 /* all implementations (PCI bridge to FPGA, VLYNQ, etc) should just
  * bridge to a platform device; this driver then suffices.
  */
-
-#ifndef CONFIG_MUSB_PIO_ONLY
-static u64 *orig_dma_mask;
-#endif
-
 static int __devinit musb_probe(struct platform_device *pdev)
 {
struct device   *dev = pdev-dev;
@@ -2138,10 +2132,6 @@ static int __devinit musb_probe(struct platform_device 
*pdev)
return -ENOMEM;
}
 
-#ifndef CONFIG_MUSB_PIO_ONLY
-   /* clobbered by use_dma=n */
-   orig_dma_mask = dev-dma_mask;
-#endif
status = musb_init_controller(dev, irq, base);
if (status  0)
iounmap(base);
@@ -2166,7 +2156,7 @@ static int __devexit musb_remove(struct platform_device 
*pdev)
iounmap(ctrl_base);
device_init_wakeup(pdev-dev, 0);
 #ifndef CONFIG_MUSB_PIO_ONLY
-   pdev-dev.dma_mask = orig_dma_mask;
+   pdev-dev.dma_mask = (dev-dev.parent)-dma_mask;
 #endif
return 0;
 }
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 69ed141..6b6cee9 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -452,6 +452,10 @@ struct musb {
 #endif
/* id for multiple musb instances */
u8  id;
+   int xceiv_old_state;
+#ifdef CONFIG_DEBUG_FS
+   struct dentry   *debugfs_root;
+#endif
 };
 
 static inline struct musb *gadget_to_musb(struct usb_gadget *g)
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 40a37c9..b1e8f21 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -103,8 +103,6 @@ static const struct musb_register_map musb_regmap[] = {
{  }/* Terminating Entry */
 };
 
-static struct dentry *musb_debugfs_root;
-
 static int musb_regdump_show(struct seq_file *s, void *unused)
 {
struct musb *musb = s-private;
@@ -240,20 +238,24 @@ int __devinit musb_init_debugfs(struct musb *musb)
struct dentry   *root;
struct dentry   *file;
int ret;
+   charname[10];
 
-   root = debugfs_create_dir(musb, NULL);
+   sprintf(name, musb%d, musb-id);
+   root = debugfs_create_dir(name, NULL);
if (!root) {
ret = -ENOMEM;
goto err0;
}
 
-   file = debugfs_create_file(regdump, S_IRUGO, root, musb,
+   sprintf(name, regdump%d, musb-id);
+   file = debugfs_create_file(name, S_IRUGO, root, musb,
musb_regdump_fops);
if (!file) {
ret = -ENOMEM;
goto err1;
}
 
+   sprintf(name, testmode%d, musb-id);
file = debugfs_create_file(testmode, S_IRUGO | S_IWUSR,
root, musb, musb_test_mode_fops);
if (!file) {
@@ -261,7 +263,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
goto err1;
}
 
-   musb_debugfs_root = root;
+   musb-debugfs_root = root;
 
return 0;
 
@@ -274,5 +276,5 @@ err0:
 
 void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb)
 {
-   debugfs_remove_recursive(musb_debugfs_root);
+   debugfs_remove_recursive(musb-debugfs_root);
 }
-- 
1.7.0.4

--
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 v3 00/11] usb: musb: adding multi instance support

2012-07-18 Thread Ajay Kumar Gupta
This series of patches adds,
a) Multi instances support in musb driver
b) DT support for musb_dsps glue layer
c) DT support for NOP transceiver

AM33xx and TI81xx has dual musb controller and has two usb PHY of same type.
This patch series uses 'phandle' based API devm_usb_get_phy_by_phandle() to
get the PHY of same type. This API support is being added by Kishon's patch
discussed at [1]

The series applies to linux-omap (master branch)
+ Vaibhav baseport patches on his tree at [3]
+ Kishon's multi phy patches on Felipe's branch 'xceiv'
+ Kishon's patch on phandle at [1]
+ AM33xx musb glue compile and bugfix patches at [4], [5], [6] and [7]
+ Damodar's recent patch at [2] 

and have been tested on Beaglebone board.

1. http://marc.info/?l=linux-usbm=134070369306112w=2
2. http://marc.info/?l=linux-usbm=134200284230689w=2
3. https://github.com/hvaibhav/am335x-linux/commits/am335x-upstream-staging
4. http://marc.info/?l=linux-usbm=134131746111637w=2
5. http://marc.info/?l=linux-usbm=134131746411639w=2
6. http://marc.info/?l=linux-usbm=134062716011251w=2
7. http://marc.info/?l=linux-usbm=134061179405213w=2

Changes from v2:
- Fixed Sergei's comment on not using address prefix in musb_dsps
  glue and nop transceiver dt dats.
- Also removed the ti string in compatible property for nop data.
Changes from v1:
- Defined musb_ida to manage core ids based on Felipe's comment
  in [PATCH 01/11]

Ajay Kumar Gupta (11):
  usb: musb: add musb-id to identify core instance
  usb: musb: kill global and static for multi instance
  usb: musb: am335x: add support for dual instance
  usb: otg: nop: add support for multiple tranceiver
  usb: musb: dsps: add dt support
  arm/dts: am33xx: Add dt data for usbss
  usb: otg: nop: add dt support
  arm/dts: am33xx: add dt data for usb nop phy
  usb: musb: dsps: remove explicit NOP device creation
  usb: musb: dsps: get the PHY using phandle api
  arm/dts: am33xx: add phy phandle to usbss

 .../devicetree/bindings/usb/am33xx-usb.txt |   19 ++
 arch/arm/boot/dts/am33xx.dtsi  |   21 +++
 arch/arm/mach-omap2/board-omap3evm.c   |2 +-
 drivers/usb/musb/am35x.c   |   46 +++--
 drivers/usb/musb/blackfin.c|   30 +++-
 drivers/usb/musb/da8xx.c   |   38 +++--
 drivers/usb/musb/davinci.c |   40 +++--
 drivers/usb/musb/musb_core.c   |   47 --
 drivers/usb/musb/musb_core.h   |8 +
 drivers/usb/musb/musb_debugfs.c|   14 +-
 drivers/usb/musb/musb_dsps.c   |  191 ++--
 drivers/usb/musb/omap2430.c|   26 ++-
 drivers/usb/musb/tusb6010.c|   32 +++-
 drivers/usb/musb/ux500.c   |   33 +++-
 drivers/usb/otg/nop-usb-xceiv.c|   32 +++-
 include/linux/usb/otg.h|9 +-
 16 files changed, 425 insertions(+), 163 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt

--
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 v3 10/11] usb: musb: dsps: get the PHY using phandle api

2012-07-18 Thread Ajay Kumar Gupta
AM33xx has two PHY of same type used by each musb controller so
use phandle of phy nodes to get the phy pointer.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
---
 .../devicetree/bindings/usb/am33xx-usb.txt |2 ++
 drivers/usb/musb/musb_dsps.c   |4 +++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index 9782585..e2702df 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -12,6 +12,8 @@ AM33XX MUSB GLUE
represents PERIPHERAL.
  - power : Should be 250. This signifies the controller can supply upto
500mA when operating in host mode.
+ - usb0-phy : phandle for usb0 NOP PHY
+ - usb1-phy : phandle for usb1 NOP PHY
 
 NOP USB PHY
  - compatible : Should be nop-xceiv-usb
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 4c59809..e2b0729 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -419,6 +419,7 @@ static int dsps_musb_init(struct musb *musb)
struct dsps_glue *glue = platform_get_drvdata(pdev);
const struct dsps_musb_wrapper *wrp = glue-wrp;
void __iomem *reg_base = musb-ctrl_base;
+   char name[10];
u32 rev, val;
int status;
 
@@ -426,7 +427,8 @@ static int dsps_musb_init(struct musb *musb)
musb-mregs += wrp-musb_core_offset;
 
/* Get the NOP PHY */
-   musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
+   sprintf(name, usb%d-phy, musb-id);
+   musb-xceiv = devm_usb_get_phy_by_phandle(pdev-dev, name);
if (IS_ERR_OR_NULL(musb-xceiv))
return -ENODEV;
 
-- 
1.7.0.4

--
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 v3 07/11] usb: otg: nop: add dt support

2012-07-18 Thread Ajay Kumar Gupta
Added device tree support for nop transceiver driver and updated the
Documentation with device tree binding information for am33xx platform.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
---
 .../devicetree/bindings/usb/am33xx-usb.txt |3 +++
 drivers/usb/otg/nop-usb-xceiv.c|   12 
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index ca8fa56..9782585 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -12,3 +12,6 @@ AM33XX MUSB GLUE
represents PERIPHERAL.
  - power : Should be 250. This signifies the controller can supply upto
500mA when operating in host mode.
+
+NOP USB PHY
+ - compatible : Should be nop-xceiv-usb
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 2e5e889..102e7d8 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -27,6 +27,7 @@
  */
 
 #include linux/module.h
+#include linux/of.h
 #include linux/platform_device.h
 #include linux/dma-mapping.h
 #include linux/usb/otg.h
@@ -152,12 +153,23 @@ static int __devexit nop_usb_xceiv_remove(struct 
platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id nop_xceiv_id_table[] = {
+   { .compatible = nop-xceiv-usb },
+   {}
+};
+MODULE_DEVICE_TABLE(of, nop_xceiv_id_table);
+#else
+#define nop_xceiv_id_table NULL
+#endif
+
 static struct platform_driver nop_usb_xceiv_driver = {
.probe  = nop_usb_xceiv_probe,
.remove = __devexit_p(nop_usb_xceiv_remove),
.driver = {
.name   = nop_usb_xceiv,
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(nop_xceiv_id_table),
},
 };
 
-- 
1.7.0.4

--
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 v3 03/11] usb: musb: am335x: add support for dual instance

2012-07-18 Thread Ajay Kumar Gupta
AM335x and TI81xx platform has dual musb controller so updating the
musb_dspc.c to support the same.

Changes:
- Moved otg_workaround timer to glue structure
- Moved static local variable last_timer to glue structure
- PHY on/off related cleanups

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
---
 drivers/usb/musb/musb_dsps.c |   93 +
 1 files changed, 57 insertions(+), 36 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 2174699..a2c8a06 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -105,6 +105,8 @@ struct dsps_musb_wrapper {
/* miscellaneous stuff */
u32 musb_core_offset;
u8  poll_seconds;
+   /* number of musb instances */
+   u8  instances;
 };
 
 /**
@@ -112,16 +114,18 @@ struct dsps_musb_wrapper {
  */
 struct dsps_glue {
struct device *dev;
-   struct platform_device *musb;   /* child musb pdev */
+   struct platform_device *musb[2];/* child musb pdev */
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
-   struct timer_list timer;/* otg_workaround timer */
-   u32 __iomem *usb_ctrl;
+   struct timer_list timer[2]; /* otg_workaround timer */
+   unsigned long last_timer[2];/* last timer data for each instance */
+   u32 __iomem *usb_ctrl[2];
u8  usbss_rev;
 };
 
 /**
  * musb_dsps_phy_control - phy on/off
  * @glue: struct dsps_glue *
+ * @id: musb instance
  * @on: flag for phy to be switched on or off
  *
  * This is to enable the PHY using usb_ctrl register in system control
@@ -130,11 +134,11 @@ struct dsps_glue {
  * XXX: This function will be removed once we have a seperate driver for
  * control module
  */
-static void musb_dsps_phy_control(struct dsps_glue *glue, u8 on)
+static void musb_dsps_phy_control(struct dsps_glue *glue, u8 id, u8 on)
 {
u32 usbphycfg;
 
-   usbphycfg = __raw_readl(glue-usb_ctrl);
+   usbphycfg = __raw_readl(glue-usb_ctrl[id]);
 
if (on) {
if (glue-usbss_rev == MUSB_USBSS_REV_816X) {
@@ -157,7 +161,7 @@ static void musb_dsps_phy_control(struct dsps_glue *glue, 
u8 on)
glue-usbss_rev == MUSB_USBSS_REV_33XX)
usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
}
-   __raw_writel(usbphycfg, glue-usb_ctrl);
+   __raw_writel(usbphycfg, glue-usb_ctrl[id]);
 }
 /**
  * dsps_musb_enable - enable interrupts
@@ -247,7 +251,7 @@ static void otg_timer(unsigned long _musb)
 
devctl = dsps_readb(mregs, MUSB_DEVCTL);
if (devctl  MUSB_DEVCTL_BDEVICE)
-   mod_timer(glue-timer,
+   mod_timer(glue-timer[musb-id],
jiffies + wrp-poll_seconds * HZ);
else
musb-xceiv-state = OTG_STATE_A_IDLE;
@@ -263,7 +267,6 @@ static void dsps_musb_try_idle(struct musb *musb, unsigned 
long timeout)
struct device *dev = musb-controller;
struct platform_device *pdev = to_platform_device(dev-parent);
struct dsps_glue *glue = platform_get_drvdata(pdev);
-   static unsigned long last_timer;
 
if (!is_otg_enabled(musb))
return;
@@ -276,22 +279,23 @@ static void dsps_musb_try_idle(struct musb *musb, 
unsigned long timeout)
musb-xceiv-state == OTG_STATE_A_WAIT_BCON)) {
dev_dbg(musb-controller, %s active, deleting timer\n,
otg_state_string(musb-xceiv-state));
-   del_timer(glue-timer);
-   last_timer = jiffies;
+   del_timer(glue-timer[musb-id]);
+   glue-last_timer[musb-id] = jiffies;
return;
}
 
-   if (time_after(last_timer, timeout)  timer_pending(glue-timer)) {
+   if (time_after(glue-last_timer[musb-id], timeout) 
+   timer_pending(glue-timer[musb-id])) {
dev_dbg(musb-controller,
Longer idle timer already pending, ignoring...\n);
return;
}
-   last_timer = timeout;
+   glue-last_timer[musb-id] = timeout;
 
dev_dbg(musb-controller, %s inactive, starting idle timer for %u 
ms\n,
otg_state_string(musb-xceiv-state),
jiffies_to_msecs(timeout - jiffies));
-   mod_timer(glue-timer, timeout);
+   mod_timer(glue-timer[musb-id], timeout);
 }
 
 static irqreturn_t dsps_interrupt(int irq, void *hci)
@@ -360,7 +364,7 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
 */
musb-int_usb = ~MUSB_INTR_VBUSERROR;
musb-xceiv-state = OTG_STATE_A_WAIT_VFALL;
-   mod_timer(glue-timer,
+