[PATCH v2] usb: move phy driver from mach-tegra to drivers/usb

2012-08-31 Thread Venu Byravarasu
As part of this patch:
1. Moved existing tegra phy driver to drivers/USB directory.
2. Added standard USB phy driver APIs to tegra phy driver.

Signed-off-by: Venu Byravarasu vbyravar...@nvidia.com
---
delta from v1:

1. Used standard USB phy driver APIs
2. Restored ULPI phy support, which was removed in patch v1, while moving
tegra usb phy driver from mach-tegra to drivers/usb/phy directory.


 arch/arm/mach-tegra/Makefile   |1 -
 arch/arm/mach-tegra/devices.c  |2 +-
 arch/arm/mach-tegra/devices.h  |2 +-
 drivers/usb/host/ehci-tegra.c  |   14 +-
 drivers/usb/phy/Makefile   |1 +
 .../usb_phy.c = drivers/usb/phy/tegra_usb_phy.c   |  152 +++-
 .../usb_phy.h = include/linux/usb/tegra_usb_phy.h |   16 +--
 7 files changed, 103 insertions(+), 85 deletions(-)
 rename arch/arm/mach-tegra/usb_phy.c = drivers/usb/phy/tegra_usb_phy.c (94%)
 rename arch/arm/mach-tegra/include/mach/usb_phy.h = 
include/linux/usb/tegra_usb_phy.h (86%)

diff --git a/arch/arm/mach-tegra/Makefile b/arch/arm/mach-tegra/Makefile
index b94858f..b542dac 100644
--- a/arch/arm/mach-tegra/Makefile
+++ b/arch/arm/mach-tegra/Makefile
@@ -25,7 +25,6 @@ obj-$(CONFIG_HOTPLUG_CPU)   += hotplug.o
 obj-$(CONFIG_TEGRA_SYSTEM_DMA) += dma.o
 obj-$(CONFIG_CPU_FREQ)  += cpu-tegra.o
 obj-$(CONFIG_TEGRA_PCI)+= pcie.o
-obj-$(CONFIG_USB_SUPPORT)  += usb_phy.o
 
 obj-$(CONFIG_ARCH_TEGRA_2x_SOC)+= board-dt-tegra20.o
 obj-$(CONFIG_ARCH_TEGRA_3x_SOC)+= board-dt-tegra30.o
diff --git a/arch/arm/mach-tegra/devices.c b/arch/arm/mach-tegra/devices.c
index 61e9603..63cc280 100644
--- a/arch/arm/mach-tegra/devices.c
+++ b/arch/arm/mach-tegra/devices.c
@@ -26,7 +26,7 @@
 #include mach/irqs.h
 #include mach/iomap.h
 #include mach/dma.h
-#include mach/usb_phy.h
+#include linux/usb/tegra_usb_phy.h
 
 #include gpio-names.h
 #include devices.h
diff --git a/arch/arm/mach-tegra/devices.h b/arch/arm/mach-tegra/devices.h
index 4f50527..906a61f 100644
--- a/arch/arm/mach-tegra/devices.h
+++ b/arch/arm/mach-tegra/devices.h
@@ -22,7 +22,7 @@
 #include linux/platform_device.h
 #include linux/platform_data/tegra_usb.h
 
-#include mach/usb_phy.h
+#include linux/usb/tegra_usb_phy.h
 
 extern struct tegra_ulpi_config tegra_ehci2_ulpi_phy_config;
 
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 75eca42..bd20dba 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -27,7 +27,7 @@
 #include linux/of_gpio.h
 #include linux/pm_runtime.h
 
-#include mach/usb_phy.h
+#include linux/usb/tegra_usb_phy.h
 #include mach/iomap.h
 
 #define TEGRA_USB_DMA_ALIGN 32
@@ -49,7 +49,7 @@ static void tegra_ehci_power_up(struct usb_hcd *hcd)
 
clk_prepare_enable(tegra-emc_clk);
clk_prepare_enable(tegra-clk);
-   tegra_usb_phy_power_on(tegra-phy);
+   usb_phy_set_suspend(tegra-phy-u_phy, 0);
tegra-host_resumed = 1;
 }
 
@@ -58,7 +58,7 @@ static void tegra_ehci_power_down(struct usb_hcd *hcd)
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd-self.controller);
 
tegra-host_resumed = 0;
-   tegra_usb_phy_power_off(tegra-phy);
+   usb_phy_set_suspend(tegra-phy-u_phy, 1);
clk_disable_unprepare(tegra-clk);
clk_disable_unprepare(tegra-emc_clk);
 }
@@ -715,7 +715,9 @@ static int tegra_ehci_probe(struct platform_device *pdev)
goto fail_io;
}
 
-   err = tegra_usb_phy_power_on(tegra-phy);
+   usb_phy_init(tegra-phy-u_phy);
+
+   err = usb_phy_set_suspend(tegra-phy-u_phy, 0);
if (err) {
dev_err(pdev-dev, Failed to power on the phy\n);
goto fail;
@@ -761,7 +763,7 @@ fail:
if (!IS_ERR_OR_NULL(tegra-transceiver))
otg_set_host(tegra-transceiver-otg, NULL);
 #endif
-   tegra_usb_phy_close(tegra-phy);
+   usb_phy_shutdown(tegra-phy-u_phy);
 fail_io:
clk_disable_unprepare(tegra-emc_clk);
 fail_emc_clk:
@@ -790,7 +792,7 @@ static int tegra_ehci_remove(struct platform_device *pdev)
 
usb_remove_hcd(hcd);
 
-   tegra_usb_phy_close(tegra-phy);
+   usb_phy_shutdown(tegra-phy-u_phy);
 
usb_put_hcd(hcd);
 
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index eca095b..d2c9546 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -5,3 +5,4 @@
 ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
 
 obj-$(CONFIG_USB_ISP1301)  += isp1301.o
+obj-$(CONFIG_USB_EHCI_TEGRA)   += tegra_usb_phy.o
diff --git a/arch/arm/mach-tegra/usb_phy.c b/drivers/usb/phy/tegra_usb_phy.c
similarity index 94%
rename from arch/arm/mach-tegra/usb_phy.c
rename to drivers/usb/phy/tegra_usb_phy.c
index 022b33a..4739903 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/drivers/usb/phy/tegra_usb_phy.c
@@ -1,6 +1,4 @@
 

Re: [PATCHv3] usb: dwc3: use a burst size only ss-mode

2012-08-31 Thread Felipe Balbi
Hi,

On Fri, Aug 31, 2012 at 01:42:23PM +0900, Chanho Park wrote:
 When connection is established non-ss mode, a maxburst is set to 0.
 Therefore, the value of burst size has wrong value. We must use the burst size
 only in ss-mode.
 
 Signed-off-by: Chanho Park chanho61.p...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  drivers/usb/dwc3/gadget.c |6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
 index 58fdfad..440a86b 100644
 --- a/drivers/usb/dwc3/gadget.c
 +++ b/drivers/usb/dwc3/gadget.c
 @@ -434,12 +434,16 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, 
 struct dwc3_ep *dep,
   const struct usb_ss_ep_comp_descriptor *comp_desc)
  {
   struct dwc3_gadget_ep_cmd_params params;
 + u32 burst_size;
  
   memset(params, 0x00, sizeof(params));
  
 + /* We only use a burst size in ss-mode */
 + burst_size = (com_desc) ? (dep-endpoint.maxburst - 1) : 0;

wont compile. Please, never send patches without testing as that just
wastes everybody's time.

   params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
   | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc))
 - | DWC3_DEPCFG_BURST_SIZE(dep-endpoint.maxburst - 1);
 + | DWC3_DEPCFG_BURST_SIZE(burst_size);

Also, readability can be improved with something like below:

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index e09a7c4..e2dd764 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -442,8 +442,14 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, 
struct dwc3_ep *dep,
memset(params, 0x00, sizeof(params));
 
params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
-   | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc))
-   | DWC3_DEPCFG_BURST_SIZE(dep-endpoint.maxburst - 1);
+   | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc));
+
+   /* bursts are only needed in SuperSpeed mode */
+   if (dwc-gadget.speed == USB_SPEED_SUPER) {
+   unsigned int burst = dep-endpoint.maxburst - 1;
+
+   params.param0 |= DWC3_DEPCFG_BURST_SIZE(burst);
+   }
 
if (ignore)
params.param0 |= DWC3_DEPCFG_IGN_SEQ_NUM;

this is clearer for anyone reading the source code and it also compiles
and works.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] staging: remove ccg

2012-08-31 Thread Sebastian Andrzej Siewior
The Android folks are currently using their original gadget and not
this. This gadget will be replaced by the configfs based interface. So
remove it now.

Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de
---
* Benoit Goby | 2012-08-30 15:43:18 [-0700]:

It's ok if it gets removed. Actually we're still using the original
android driver for now, not ccg.
I'll change the userland interface to support configfs when we upgrade
the kernel.

Thank you.
Greg, how are we going to do this? This patch via Felipe's tree or redo
my series without considering ccg and a rm patch against your current
staging tree?

Thanks!
Benoit

 drivers/staging/Kconfig |2 -
 drivers/staging/Makefile|1 -
 drivers/staging/ccg/Kconfig |   21 -
 drivers/staging/ccg/Makefile|4 -
 drivers/staging/ccg/TODO|6 -
 drivers/staging/ccg/ccg.c   | 1293 -
 drivers/staging/ccg/composite.c | 1598 ---
 drivers/staging/ccg/composite.h |  368 ---
 drivers/staging/ccg/sysfs-class-ccg_usb |  158 ---
 9 files changed, 3451 deletions(-)
 delete mode 100644 drivers/staging/ccg/Kconfig
 delete mode 100644 drivers/staging/ccg/Makefile
 delete mode 100644 drivers/staging/ccg/TODO
 delete mode 100644 drivers/staging/ccg/ccg.c
 delete mode 100644 drivers/staging/ccg/composite.c
 delete mode 100644 drivers/staging/ccg/composite.h
 delete mode 100644 drivers/staging/ccg/sysfs-class-ccg_usb

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index e3402d5..a1e0bac 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -126,8 +126,6 @@ source drivers/staging/ramster/Kconfig
 
 source drivers/staging/ozwpan/Kconfig
 
-source drivers/staging/ccg/Kconfig
-
 source drivers/staging/ipack/Kconfig
 
 source drivers/staging/gdm72xx/Kconfig
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index 3be59d0..3ab5926 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -56,7 +56,6 @@ obj-$(CONFIG_ANDROID) += android/
 obj-$(CONFIG_PHONE)+= telephony/
 obj-$(CONFIG_RAMSTER)  += ramster/
 obj-$(CONFIG_USB_WPAN_HCD) += ozwpan/
-obj-$(CONFIG_USB_G_CCG)+= ccg/
 obj-$(CONFIG_WIMAX_GDM72XX)+= gdm72xx/
 obj-$(CONFIG_CSR_WIFI) += csr/
 obj-$(CONFIG_OMAP_BANDGAP) += omap-thermal/
diff --git a/drivers/staging/ccg/Kconfig b/drivers/staging/ccg/Kconfig
deleted file mode 100644
index fbc67de..000
diff --git a/drivers/staging/ccg/Makefile b/drivers/staging/ccg/Makefile
deleted file mode 100644
index 693da63..000
diff --git a/drivers/staging/ccg/TODO b/drivers/staging/ccg/TODO
deleted file mode 100644
index 18612fe..000
diff --git a/drivers/staging/ccg/ccg.c b/drivers/staging/ccg/ccg.c
deleted file mode 100644
index 453c0ea..000
diff --git a/drivers/staging/ccg/composite.c b/drivers/staging/ccg/composite.c
deleted file mode 100644
index f00b0388..000
diff --git a/drivers/staging/ccg/composite.h b/drivers/staging/ccg/composite.h
deleted file mode 100644
index 9a2e4ce..000
diff --git a/drivers/staging/ccg/sysfs-class-ccg_usb 
b/drivers/staging/ccg/sysfs-class-ccg_usb
deleted file mode 100644
index dd12a33..000
-- 
1.7.10.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: [PATCHv3] usb: dwc3: use a burst size only ss-mode

2012-08-31 Thread Chanho Park
 -Original Message-
 From: Felipe Balbi [mailto:ba...@ti.com]
 Sent: Friday, August 31, 2012 3:59 PM
 To: Chanho Park
 Cc: ba...@ti.com; gre...@linuxfoundation.org; linux-usb@vger.kernel.org;
 Kyungmin Park
 Subject: Re: [PATCHv3] usb: dwc3: use a burst size only ss-mode
 
 Hi,
 
 On Fri, Aug 31, 2012 at 01:42:23PM +0900, Chanho Park wrote:
  When connection is established non-ss mode, a maxburst is set to 0.
  Therefore, the value of burst size has wrong value. We must use the
  burst size only in ss-mode.
 
  Signed-off-by: Chanho Park chanho61.p...@samsung.com
  Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
  ---
   drivers/usb/dwc3/gadget.c |6 +-
   1 file changed, 5 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
  index 58fdfad..440a86b 100644
  --- a/drivers/usb/dwc3/gadget.c
  +++ b/drivers/usb/dwc3/gadget.c
  @@ -434,12 +434,16 @@ static int dwc3_gadget_set_ep_config(struct
 dwc3 *dwc, struct dwc3_ep *dep,
  const struct usb_ss_ep_comp_descriptor *comp_desc)  {
  struct dwc3_gadget_ep_cmd_params params;
  +   u32 burst_size;
 
  memset(params, 0x00, sizeof(params));
 
  +   /* We only use a burst size in ss-mode */
  +   burst_size = (com_desc) ? (dep-endpoint.maxburst - 1) : 0;
 
 wont compile. Please, never send patches without testing as that just wastes
 everybody's time.
 
  params.param0 =
 DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
  |
 DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc))
  -   | DWC3_DEPCFG_BURST_SIZE(dep-endpoint.maxburst - 1);
  +   | DWC3_DEPCFG_BURST_SIZE(burst_size);
 
 Also, readability can be improved with something like below:
 
 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index
 e09a7c4..e2dd764 100644
 --- a/drivers/usb/dwc3/gadget.c
 +++ b/drivers/usb/dwc3/gadget.c
 @@ -442,8 +442,14 @@ static int dwc3_gadget_set_ep_config(struct dwc3
 *dwc, struct dwc3_ep *dep,
   memset(params, 0x00, sizeof(params));
 
   params.param0 =
 DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
 - |
 DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc))
 - | DWC3_DEPCFG_BURST_SIZE(dep-endpoint.maxburst - 1);
 + |
 DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc));
 +
 + /* bursts are only needed in SuperSpeed mode */
 + if (dwc-gadget.speed == USB_SPEED_SUPER) {
 + unsigned int burst = dep-endpoint.maxburst - 1;
 +
 + params.param0 |= DWC3_DEPCFG_BURST_SIZE(burst);
 + }
 
   if (ignore)
   params.param0 |= DWC3_DEPCFG_IGN_SEQ_NUM;
 
 this is clearer for anyone reading the source code and it also compiles and
 works.

I'm really sorry for you and everybody's inconvenience.
I'll reposting it after testing patch.

Best regards,
Chanho Park 

 
 --
 balbi

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


[PATCHv4] usb: dwc3: set up burst size only superspeed mode

2012-08-31 Thread Chanho Park
When connection is established non-ss mode, a maxburst is set to 0.
Therefore, the value of burst size has wrong value. We must use the burst size
only in superspeed mode.

Signed-off-by: Chanho Park chanho61.p...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/usb/dwc3/gadget.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 58fdfad..6516560 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -438,8 +438,14 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, 
struct dwc3_ep *dep,
memset(params, 0x00, sizeof(params));
 
params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc))
-   | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc))
-   | DWC3_DEPCFG_BURST_SIZE(dep-endpoint.maxburst - 1);
+   | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc));
+
+   /* Burst size is only needed in SuperSpeed mode */
+   if (dwc-gadget.speed == USB_SPEED_SUPER) {
+   u32 burst = dep-endpoint.maxburst - 1;
+
+   params.param0 |= DWC3_DEPCFG_BURST_SIZE(burst);
+   }
 
params.param1 = DWC3_DEPCFG_XFER_COMPLETE_EN
| DWC3_DEPCFG_XFER_NOT_READY_EN;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: create libcomposite, v3

2012-08-31 Thread Andrzej Pietrasiewicz
On Wednesday, August 29, 2012 9:35 PM Sebastian Andrzej Siewior wrote:
snip

 
 Okay. Dear ccg gadget submitter: Do you still need that code in staging
 tree or is it okay if it gets removed?

Dear Sebastian,

Thank you for asking for my opinion. I would like to say that we need ccg
in the tree.

It seems that the big change with converting to configfs will not happen
within the next two kernel releases, and we still don't know the new
framework will look like and work - my first patch with USB gadget -
configfs https://lkml.org/lkml/2012/6/21/154 contained only mass storage,
and there are over a dozen functions or so.

It will take time before things are fully settled.

So I suggest we try making ccg in sync with your latest changes and
reconsider keeping/removing it after the full process of gadget's
transition to configfs is completed.

Thank you,

Andrzej

 
 The current composite rework resulted in a copy of composite.c and headers
 since it is hard to fix. I'm not yet sure what happens when I start to
 remove the remaining #include dot.c statements.
 You need to convert to configfs which will change your userland interface.
 Is there a reason to keep this in tree?
 
  thanks,
 
  greg k-h
 
 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 0/5] usb: gadget: s3c2410_udc: Fixes and cleanup

2012-08-31 Thread Felipe Balbi
Hi,

On Tue, Aug 28, 2012 at 07:41:49PM +0530, Sachin Kamat wrote:
 Hi Felipe,
 
 Any comments on this series?

yes, please give me more time :-) I was waiting to see if someone else
would have any comments, as I don't have that HW :-)

Also, was trying to wait for v3.6-rc4 before queueing patches again, but
this has soaked for long enough.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v8 08/13] arm/dts: am33xx: Add dt data for usbss

2012-08-31 Thread Felipe Balbi
Hi,

On Thu, Aug 30, 2012 at 03:39:40PM +0400, Sergei Shtylyov wrote:
 Hello.
 
 On 30-08-2012 14:50, Ravi Babu wrote:
 
 From: Ajay Kumar Gupta ajay.gu...@ti.com
 
 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
 Signed-off-by: Ravi Babu ravib...@ti.com
 Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
 Signed-off-by: Ravi Babu ravib...@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..778b95e 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 {
 +compatible = ti,musb-am33xx;
 +ti,hwmods = usb_otg_hs;
 +multipoint = 1;
 +num_eps = 16;
 +ram_bits = 12;
 +port0_mode = 3;
 +port1_mode = 3;
 
Hyphen is preferred traditionally to underscore in the device tree files...

Are we having a v2 of this patch ??

-- 
balbi


signature.asc
Description: Digital signature


RE: [PATCH v8 08/13] arm/dts: am33xx: Add dt data for usbss

2012-08-31 Thread B, Ravi
 On Thu, Aug 30, 2012 at 03:39:40PM +0400, Sergei Shtylyov wrote:
  Hello.
  
  On 30-08-2012 14:50, Ravi Babu wrote:
  
  From: Ajay Kumar Gupta ajay.gu...@ti.com
  
  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
  Signed-off-by: Ravi Babu ravib...@ti.com
  Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
  Signed-off-by: Ravi Babu ravib...@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..778b95e 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 {
  +  compatible = ti,musb-am33xx;
  +  ti,hwmods = usb_otg_hs;
  +  multipoint = 1;
  +  num_eps = 16;
  +  ram_bits = 12;
  +  port0_mode = 3;
  +  port1_mode = 3;
  
 Hyphen is preferred traditionally to underscore in the 
 device tree files...
 
 Are we having a v2 of this patch ??

Felipe, I will send it shortly.

Regards
Ravi B
 
 --
 balbi
 --
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: create libcomposite, v3

2012-08-31 Thread Sebastian Andrzej Siewior

On 08/31/2012 11:29 AM, Andrzej Pietrasiewicz wrote:

Thank you for asking for my opinion. I would like to say that we need ccg
in the tree.

It seems that the big change with converting to configfs will not happen
within the next two kernel releases, and we still don't know the new
framework will look like and work - my first patch with USB gadget -
configfs https://lkml.org/lkml/2012/6/21/154 contained only mass storage,
and there are over a dozen functions or so.


And you realize that ccg remains unused right now from its biggest and
probably only user called Android? So why should we keep it?


It will take time before things are fully settled.


Yes and this Nokia gadget fork makes things complicated for no good
reason as far as I tell. I had to provide a copy of composite.c because
some things were beyond fixable.
I happy with fixing 15 gadgets in tree including nokia.c or multi.c
since those have active users.


So I suggest we try making ccg in sync with your latest changes and
reconsider keeping/removing it after the full process of gadget's
transition to configfs is completed.


I reshuffled some code already I have to do more. If you still insist
on keeping ccg I hope you have a good reason for it _and_ don't mind
when I copy all included .c files into staging as well?

btw:
I've been going over the staging mailing list and looked for ccg
patches. Besides the usual noise I just noticed akpm somewhere close to
a heart attack. So this is parked there until we have something
configfs based. Staging was meant for drivers which have to be improved
and more people can work on it. This is not the case here because here
we need a replacement with different API.


Thank you,

Andrzej


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 v8 08/13] arm/dts: am33xx: Add dt data for usbss

2012-08-31 Thread ABRAHAM, KISHON VIJAY
Hi,

On Thu, Aug 30, 2012 at 4:20 PM, Ravi Babu ravib...@ti.com wrote:
 From: Ajay Kumar Gupta ajay.gu...@ti.com

 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
 Signed-off-by: Ravi Babu ravib...@ti.com
 Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
 Signed-off-by: Ravi Babu ravib...@ti.com

One Signed-off-by: Ravi Babu would suffice :-)

Thanks
Kishon
--
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: create libcomposite, v3

2012-08-31 Thread Felipe Balbi
On Fri, Aug 31, 2012 at 12:04:56PM +0200, Sebastian Andrzej Siewior wrote:
 On 08/31/2012 11:29 AM, Andrzej Pietrasiewicz wrote:
 Thank you for asking for my opinion. I would like to say that we need ccg
 in the tree.
 
 It seems that the big change with converting to configfs will not happen
 within the next two kernel releases, and we still don't know the new
 framework will look like and work - my first patch with USB gadget -
 configfs https://lkml.org/lkml/2012/6/21/154 contained only mass storage,
 and there are over a dozen functions or so.
 
 And you realize that ccg remains unused right now from its biggest and
 probably only user called Android? So why should we keep it?

I second that, if there are no users for that ccg gadget, we need not
keep in tree. Specially since we will be providing a more stable
userland ABI which will solve the same problems ccg tries (though
wrongly) to solve.

Unless it can be proven that ccg has active users, we should get rid of
it for now before someone starts using it and we need to maintain the
ABI for the next 10 years.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH v9 11/13] usb: musb: dsps: get the PHY using phandle api

2012-08-31 Thread Ravi Babu
From: Santhapuri, Damodar damodar.santhap...@ti.com

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
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 .../devicetree/bindings/usb/am33xx-usb.txt |2 ++
 drivers/usb/musb/musb_dsps.c   |5 -
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index ca8fa56..b0caac3 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -12,3 +12,5 @@ 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
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index eb6bfec..992cd50 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -409,9 +409,11 @@ static int dsps_musb_init(struct musb *musb)
 {
struct device *dev = musb-controller;
struct platform_device *pdev = to_platform_device(dev);
+   struct platform_device *parent_pdev = to_platform_device(dev-parent);
struct dsps_glue *glue = dev_get_drvdata(dev-parent);
const struct dsps_musb_wrapper *wrp = glue-wrp;
void __iomem *reg_base = musb-ctrl_base;
+   char name[10];
u32 rev, val;
int status;
 
@@ -419,7 +421,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, pdev-id);
+   musb-xceiv = devm_usb_get_phy_by_phandle(parent_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 v9 08/13] arm/dts: am33xx: Add dt data for usbss

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

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
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 arch/arm/boot/dts/am33xx.dtsi |   11 +++
 drivers/usb/musb/musb_dsps.c  |6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 59509c4..bdde9c9 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 {
+   compatible = ti,musb-am33xx;
+   ti,hwmods = usb_otg_hs;
+   multipoint = 1;
+   num-eps = 16;
+   ram-bits = 12;
+   port0-mode = 3;
+   port1-mode = 3;
+   power = 250;
+   };
};
 };
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 2c104bf..32c8d68 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -581,9 +581,9 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue 
*glue, u8 id)
goto err2;
}
 
-   of_property_read_u32(np, num_eps, (u32 *)config-num_eps);
-   of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits);
-   sprintf(res_name, port%d_mode, id);
+   of_property_read_u32(np, num-eps, (u32 *)config-num_eps);
+   of_property_read_u32(np, ram-bits, (u32 *)config-ram_bits);
+   sprintf(res_name, port%d-mode, id);
of_property_read_u32(np, res_name, (u32 *)pdata-mode);
of_property_read_u32(np, power, (u32 *)pdata-power);
config-multipoint = of_property_read_bool(np, multipoint);
-- 
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 v9 02/13] usb: musb: dsps: enable phy control for am335x

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

Enabled the phy control logic for am335x also based on usbss
revision register.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 arch/arm/plat-omap/include/plat/usb.h |1 +
 drivers/usb/musb/musb_dsps.c  |   17 +++--
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index c2aa4ae..6459b10 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -121,6 +121,7 @@ extern void am35x_set_mode(u8 musb_mode);
 /* TI81XX specific definitions */
 #define MUSB_USBSS_REV_816X0x9
 #define MUSB_USBSS_REV_814X0xb
+#define MUSB_USBSS_REV_33XX0xd
 
 /* TI816X PHY controls bits */
 #define TI816X_USBPHY0_NORMAL_MODE (1  0)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 960258d..e62fa05 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -141,16 +141,21 @@ static void musb_dsps_phy_control(struct dsps_glue *glue, 
u8 on)
if (glue-usbss_rev == MUSB_USBSS_REV_816X) {
usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
usbphycfg = ~TI816X_USBPHY_REFCLK_OSC;
-   } else if (glue-usbss_rev == MUSB_USBSS_REV_814X) {
-   usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-   | USBPHY_DPINPUT | USBPHY_DMINPUT);
-   usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-   | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
+   } else if (glue-usbss_rev == MUSB_USBSS_REV_814X ||
+   glue-usbss_rev == MUSB_USBSS_REV_33XX) {
+   usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN);
+   usbphycfg |= USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN;
+   if (glue-usbss_rev == MUSB_USBSS_REV_814X) {
+   usbphycfg = ~(USBPHY_DPINPUT | USBPHY_DMINPUT);
+   usbphycfg |= USBPHY_DPOPBUFCTL
+   | USBPHY_DMOPBUFCTL;
+   }
}
} else {
if (glue-usbss_rev == MUSB_USBSS_REV_816X)
usbphycfg = ~TI816X_USBPHY0_NORMAL_MODE;
-   else if (glue-usbss_rev == MUSB_USBSS_REV_814X)
+   else if (glue-usbss_rev == MUSB_USBSS_REV_814X ||
+   glue-usbss_rev == MUSB_USBSS_REV_33XX)
usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
}
__raw_writel(usbphycfg, glue-usb_ctrl);
-- 
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 v9 04/13] usb: musb: kill global and static for multi instance

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

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
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 drivers/usb/musb/musb_core.c|   22 +++---
 drivers/usb/musb/musb_core.h|4 
 drivers/usb/musb/musb_debugfs.c |8 +++-
 3 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 7499fbb..44c8caa 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -100,6 +100,7 @@
 #include linux/platform_device.h
 #include linux/io.h
 #include linux/idr.h
+#include linux/dma-mapping.h
 
 #include musb_core.h
 
@@ -1797,10 +1798,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);
}
 }
@@ -2060,11 +2060,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;
@@ -2083,10 +2078,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);
@@ -2096,7 +2087,8 @@ static int __devinit musb_probe(struct platform_device 
*pdev)
 
 static int __devexit musb_remove(struct platform_device *pdev)
 {
-   struct musb *musb = dev_to_musb(pdev-dev);
+   struct device   *dev = pdev-dev;
+   struct musb *musb = dev_to_musb(dev);
void __iomem*ctrl_base = musb-ctrl_base;
 
/* this gets called on rmmod.
@@ -2109,9 +2101,9 @@ static int __devexit musb_remove(struct platform_device 
*pdev)
 
musb_free(musb);
iounmap(ctrl_base);
-   device_init_wakeup(pdev-dev, 0);
+   device_init_wakeup(dev, 0);
 #ifndef CONFIG_MUSB_PIO_ONLY
-   pdev-dev.dma_mask = orig_dma_mask;
+   dma_set_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 a69ffd6..c158aac 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -437,6 +437,10 @@ struct musb {
 #ifdef MUSB_CONFIG_PROC_FS
struct proc_dir_entry *proc_entry;
 #endif
+   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..1d6e8af 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;
@@ -241,7 +239,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
struct dentry   *file;
int ret;
 
-   root = debugfs_create_dir(musb, NULL);
+   root = debugfs_create_dir(dev_name(musb-controller), NULL);
if (!root) {
ret = -ENOMEM;
goto err0;
@@ -261,7 +259,7 @@ int __devinit musb_init_debugfs(struct musb *musb)
goto err1;
}
 
-   musb_debugfs_root = root;
+   musb-debugfs_root = root;
 
return 0;
 
@@ -274,5 +272,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 v9 10/13] usb: musb: dsps: remove explicit NOP device creation

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

As NOP device node is now added in am33xx tree so remove the call
which creates the NOP platform_device.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 drivers/usb/musb/musb_dsps.c |3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 32c8d68..eb6bfec 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -418,8 +418,7 @@ static int dsps_musb_init(struct musb *musb)
/* mentor core register starts at offset of 0x400 from musb base */
musb-mregs += wrp-musb_core_offset;
 
-   /* Register NOP driver */
-   usb_nop_xceiv_register();
+   /* Get the NOP PHY */
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
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 v9 05/13] usb: musb: am335x: add support for dual instance

2012-08-31 Thread Ravi Babu
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
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 drivers/usb/musb/musb_dsps.c |  112 +-
 1 files changed, 66 insertions(+), 46 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 36130ba..f883c25 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -106,6 +106,8 @@ struct dsps_musb_wrapper {
/* miscellaneous stuff */
u32 musb_core_offset;
u8  poll_seconds;
+   /* number of musb instances */
+   u8  instances;
 };
 
 /**
@@ -113,16 +115,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
@@ -131,11 +135,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) {
@@ -158,7 +162,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
@@ -207,8 +211,8 @@ static void otg_timer(unsigned long _musb)
struct musb *musb = (void *)_musb;
void __iomem *mregs = musb-mregs;
struct device *dev = musb-controller;
-   struct platform_device *pdev = to_platform_device(dev-parent);
-   struct dsps_glue *glue = platform_get_drvdata(pdev);
+   struct platform_device *pdev = to_platform_device(dev);
+   struct dsps_glue *glue = dev_get_drvdata(dev-parent);
const struct dsps_musb_wrapper *wrp = glue-wrp;
u8 devctl;
unsigned long flags;
@@ -244,7 +248,7 @@ static void otg_timer(unsigned long _musb)
case OTG_STATE_B_IDLE:
devctl = dsps_readb(mregs, MUSB_DEVCTL);
if (devctl  MUSB_DEVCTL_BDEVICE)
-   mod_timer(glue-timer,
+   mod_timer(glue-timer[pdev-id],
jiffies + wrp-poll_seconds * HZ);
else
musb-xceiv-state = OTG_STATE_A_IDLE;
@@ -258,9 +262,8 @@ static void otg_timer(unsigned long _musb)
 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;
+   struct platform_device *pdev = to_platform_device(dev);
+   struct dsps_glue *glue = dev_get_drvdata(dev-parent);
 
if (timeout == 0)
timeout = jiffies + msecs_to_jiffies(3);
@@ -270,22 +273,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[pdev-id]);
+   glue-last_timer[pdev-id] = jiffies;
return;
}
 
-   if (time_after(last_timer, timeout)  timer_pending(glue-timer)) {
+   if (time_after(glue-last_timer[pdev-id], timeout) 
+   

[PATCH v9 03/13] usb: musb: add musb_ida for multi instance support

2012-08-31 Thread Ravi Babu
Added musb_ida in musb_core.c to manage the multi core ids.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 drivers/usb/musb/am35x.c |   42 --
 drivers/usb/musb/blackfin.c  |   26 --
 drivers/usb/musb/da8xx.c |   34 --
 drivers/usb/musb/davinci.c   |   34 --
 drivers/usb/musb/musb_core.c |   31 +++
 drivers/usb/musb/musb_core.h |2 ++
 drivers/usb/musb/musb_dsps.c |   25 ++---
 drivers/usb/musb/omap2430.c  |   26 --
 drivers/usb/musb/tusb6010.c  |   26 --
 drivers/usb/musb/ux500.c |   33 +++--
 10 files changed, 210 insertions(+), 69 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 29b1d60..457f25e 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -459,6 +459,7 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
struct clk  *clk;
 
int ret = -ENOMEM;
+   int musbid;
 
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -466,38 +467,47 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
goto err0;
}
 
-   musb = platform_device_alloc(musb-hdrc, -1);
+   /* get the musb id */
+   musbid = musb_get_id(pdev-dev, GFP_KERNEL);
+   if (musbid  0) {
+   dev_err(pdev-dev, failed to allocate musb id\n);
+   ret = -ENOMEM;
+   goto err1;
+   }
+
+   musb = platform_device_alloc(musb-hdrc, musbid);
if (!musb) {
dev_err(pdev-dev, failed to allocate musb device\n);
-   goto err1;
+   goto err2;
}
 
phy_clk = clk_get(pdev-dev, fck);
if (IS_ERR(phy_clk)) {
dev_err(pdev-dev, failed to get PHY clock\n);
ret = PTR_ERR(phy_clk);
-   goto err2;
+   goto err3;
}
 
clk = clk_get(pdev-dev, ick);
if (IS_ERR(clk)) {
dev_err(pdev-dev, failed to get clock\n);
ret = PTR_ERR(clk);
-   goto err3;
+   goto err4;
}
 
ret = clk_enable(phy_clk);
if (ret) {
dev_err(pdev-dev, failed to enable PHY clock\n);
-   goto err4;
+   goto err5;
}
 
ret = clk_enable(clk);
if (ret) {
dev_err(pdev-dev, failed to enable clock\n);
-   goto err5;
+   goto err6;
}
 
+   musb-id= musbid;
musb-dev.parent= pdev-dev;
musb-dev.dma_mask  = am35x_dmamask;
musb-dev.coherent_dma_mask = am35x_dmamask;
@@ -515,38 +525,41 @@ static int __devinit am35x_probe(struct platform_device 
*pdev)
pdev-num_resources);
if (ret) {
dev_err(pdev-dev, failed to add resources\n);
-   goto err6;
+   goto err7;
}
 
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(pdev-dev, failed to add platform_data\n);
-   goto err6;
+   goto err7;
}
 
ret = platform_device_add(musb);
if (ret) {
dev_err(pdev-dev, failed to register musb device\n);
-   goto err6;
+   goto err7;
}
 
return 0;
 
-err6:
+err7:
clk_disable(clk);
 
-err5:
+err6:
clk_disable(phy_clk);
 
-err4:
+err5:
clk_put(clk);
 
-err3:
+err4:
clk_put(phy_clk);
 
-err2:
+err3:
platform_device_put(musb);
 
+err2:
+   musb_put_id(pdev-dev, musbid);
+
 err1:
kfree(glue);
 
@@ -558,6 +571,7 @@ static int __devexit am35x_remove(struct platform_device 
*pdev)
 {
struct am35x_glue   *glue = platform_get_drvdata(pdev);
 
+   musb_put_id(pdev-dev, glue-musb-id);
platform_device_del(glue-musb);
platform_device_put(glue-musb);
clk_disable(glue-clk);
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index 2a80dec..e8cff9b 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -455,6 +455,7 @@ static int __devinit bfin_probe(struct platform_device 
*pdev)
struct bfin_glue*glue;
 
int ret = -ENOMEM;
+   int musbid;
 
glue = kzalloc(sizeof(*glue), GFP_KERNEL);
if (!glue) {
@@ -462,12 +463,21 @@ static int __devinit bfin_probe(struct platform_device 
*pdev)
goto err0;
}
 
-  

[PATCH v9 06/13] usb: otg: nop: add support for multiple tranceiver

2012-08-31 Thread Ravi Babu
From: Santhapuri, Damodar damodar.santhap...@ti.com

Currently we have one single nop transceiver support as same is
defined as a global variable in drivers/usb/otg/nop-usb-xceiv.c.
This need to be changed to support multiple otg controller each
using nop transceiver on a platform such as am335x.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 drivers/usb/musb/am35x.c  |2 +-
 drivers/usb/musb/blackfin.c   |2 +-
 drivers/usb/musb/da8xx.c  |2 +-
 drivers/usb/musb/davinci.c|4 +-
 drivers/usb/musb/musb_dsps.c  |8 +++---
 drivers/usb/musb/tusb6010.c   |4 +-
 drivers/usb/otg/nop-usb-xceiv.c   |   54 -
 include/linux/usb/nop-usb-xceiv.h |4 +-
 8 files changed, 60 insertions(+), 20 deletions(-)

diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 457f25e..e3099fc 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -399,7 +399,7 @@ static int am35x_musb_exit(struct musb *musb)
data-set_phy_power(0);
 
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/blackfin.c b/drivers/usb/musb/blackfin.c
index e8cff9b..32b4fe4 100644
--- a/drivers/usb/musb/blackfin.c
+++ b/drivers/usb/musb/blackfin.c
@@ -427,7 +427,7 @@ static int bfin_musb_exit(struct musb *musb)
gpio_free(musb-config-gpio_vrsel);
 
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
return 0;
 }
 
diff --git a/drivers/usb/musb/da8xx.c b/drivers/usb/musb/da8xx.c
index ce11d20..f86a1c7 100644
--- a/drivers/usb/musb/da8xx.c
+++ b/drivers/usb/musb/da8xx.c
@@ -451,7 +451,7 @@ static int da8xx_musb_exit(struct musb *musb)
phy_off();
 
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c
index 606bfd0..e12d20a 100644
--- a/drivers/usb/musb/davinci.c
+++ b/drivers/usb/musb/davinci.c
@@ -437,7 +437,7 @@ static int davinci_musb_init(struct musb *musb)
 fail:
usb_put_phy(musb-xceiv);
 unregister:
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
return -ENODEV;
 }
 
@@ -485,7 +485,7 @@ static int davinci_musb_exit(struct musb *musb)
phy_off();
 
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index f883c25..25e395b 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -413,7 +413,7 @@ static int dsps_musb_init(struct musb *musb)
/* mentor core register starts at offset of 0x400 from musb base */
musb-mregs += wrp-musb_core_offset;
 
-   /* NOP driver needs change if supporting dual instance */
+   /* Register NOP driver */
usb_nop_xceiv_register();
musb-xceiv = usb_get_phy(USB_PHY_TYPE_USB2);
if (IS_ERR_OR_NULL(musb-xceiv))
@@ -447,7 +447,7 @@ static int dsps_musb_init(struct musb *musb)
return 0;
 err0:
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
return status;
 }
 
@@ -462,9 +462,9 @@ static int dsps_musb_exit(struct musb *musb)
/* Shutdown the on-chip PHY and its PLL. */
musb_dsps_phy_control(glue, pdev-id, 0);
 
-   /* NOP driver needs change if supporting dual instance */
+   /* Unregister NOP driver */
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
 
return 0;
 }
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index dc4d75e..71c4778 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -1117,7 +1117,7 @@ done:
iounmap(sync);
 
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
}
return ret;
 }
@@ -1133,7 +1133,7 @@ static int tusb_musb_exit(struct musb *musb)
iounmap(musb-sync_va);
 
usb_put_phy(musb-xceiv);
-   usb_nop_xceiv_unregister();
+   usb_nop_xceiv_unregister(musb-xceiv);
return 0;
 }
 
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index e52e35e..7e0dba3 100644
--- a/drivers/usb/otg/nop-usb-xceiv.c
+++ b/drivers/usb/otg/nop-usb-xceiv.c
@@ -32,30 +32,69 @@
 #include linux/usb/otg.h
 #include linux/usb/nop-usb-xceiv.h
 #include linux/slab.h
+#include linux/idr.h
 
 struct nop_usb_xceiv {
struct usb_phy  phy;
struct 

[PATCH v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread Ravi Babu
From: Santhapuri, Damodar damodar.santhap...@ti.com

AM335x uses NOP transceiver driver and need to enable builtin PHY
by writing into usb_ctrl register available in system control
module register space. This is being added at musb glue driver
layer untill a separate system control module driver is available.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 arch/arm/mach-omap2/board-ti8168evm.c   |1 -
 arch/arm/mach-omap2/omap_phy_internal.c |   35 
 arch/arm/plat-omap/include/plat/usb.h   |5 +-
 drivers/usb/musb/musb_dsps.c|   87 +--
 4 files changed, 73 insertions(+), 55 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ti8168evm.c 
b/arch/arm/mach-omap2/board-ti8168evm.c
index d4c8392..0c7c098 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -26,7 +26,6 @@
 #include plat/usb.h
 
 static struct omap_musb_board_data musb_board_data = {
-   .set_phy_power  = ti81xx_musb_phy_power,
.interface_type = MUSB_INTERFACE_ULPI,
.mode   = MUSB_OTG,
.power  = 500,
diff --git a/arch/arm/mach-omap2/omap_phy_internal.c 
b/arch/arm/mach-omap2/omap_phy_internal.c
index d52651a..d80bb16 100644
--- a/arch/arm/mach-omap2/omap_phy_internal.c
+++ b/arch/arm/mach-omap2/omap_phy_internal.c
@@ -254,38 +254,3 @@ void am35x_set_mode(u8 musb_mode)
 
omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
 }
-
-void ti81xx_musb_phy_power(u8 on)
-{
-   void __iomem *scm_base = NULL;
-   u32 usbphycfg;
-
-   scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
-   if (!scm_base) {
-   pr_err(system control module ioremap failed\n);
-   return;
-   }
-
-   usbphycfg = __raw_readl(scm_base + USBCTRL0);
-
-   if (on) {
-   if (cpu_is_ti816x()) {
-   usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
-   usbphycfg = ~TI816X_USBPHY_REFCLK_OSC;
-   } else if (cpu_is_ti814x()) {
-   usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
-   | USBPHY_DPINPUT | USBPHY_DMINPUT);
-   usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
-   | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
-   }
-   } else {
-   if (cpu_is_ti816x())
-   usbphycfg = ~TI816X_USBPHY0_NORMAL_MODE;
-   else if (cpu_is_ti814x())
-   usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
-
-   }
-   __raw_writel(usbphycfg, scm_base + USBCTRL0);
-
-   iounmap(scm_base);
-}
diff --git a/arch/arm/plat-omap/include/plat/usb.h 
b/arch/arm/plat-omap/include/plat/usb.h
index 548a4c8..c2aa4ae 100644
--- a/arch/arm/plat-omap/include/plat/usb.h
+++ b/arch/arm/plat-omap/include/plat/usb.h
@@ -95,7 +95,6 @@ extern void am35x_musb_reset(void);
 extern void am35x_musb_phy_power(u8 on);
 extern void am35x_musb_clear_irq(void);
 extern void am35x_set_mode(u8 musb_mode);
-extern void ti81xx_musb_phy_power(u8 on);
 
 /* AM35x */
 /* USB 2.0 PHY Control */
@@ -120,8 +119,8 @@ extern void ti81xx_musb_phy_power(u8 on);
 #define CONF2_DATPOL   (1  1)
 
 /* TI81XX specific definitions */
-#define USBCTRL0   0x620
-#define USBSTAT0   0x624
+#define MUSB_USBSS_REV_816X0x9
+#define MUSB_USBSS_REV_814X0xb
 
 /* TI816X PHY controls bits */
 #define TI816X_USBPHY0_NORMAL_MODE (1  0)
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 84d8181..960258d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -116,9 +116,46 @@ struct dsps_glue {
struct platform_device *musb;   /* child musb pdev */
const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
struct timer_list timer;/* otg_workaround timer */
+   u32 __iomem *usb_ctrl;
+   u8  usbss_rev;
 };
 
 /**
+ * musb_dsps_phy_control - phy on/off
+ * @glue: struct dsps_glue *
+ * @on: flag for phy to be switched on or off
+ *
+ * This is to enable the PHY using usb_ctrl register in system control
+ * module space.
+ *
+ * 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)
+{
+   u32 usbphycfg;
+
+   usbphycfg = __raw_readl(glue-usb_ctrl);
+
+   if (on) {
+   if (glue-usbss_rev == MUSB_USBSS_REV_816X) {
+   usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
+   usbphycfg = ~TI816X_USBPHY_REFCLK_OSC;
+   } else if (glue-usbss_rev == MUSB_USBSS_REV_814X) {
+   usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
+   | USBPHY_DPINPUT | USBPHY_DMINPUT);
+   

[PATCH v9 12/13] arm/dts: am33xx: add phy phandle to usbss

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

Added NOP PHY phandle to usbss device node as same will be used
to get the phy from otg framework.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 arch/arm/boot/dts/am33xx.dtsi |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 4b3a2b7..1e77b0b 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -172,6 +172,8 @@
port0-mode = 3;
port1-mode = 3;
power = 250;
+   usb0-phy = usb0_phy;
+   usb1-phy = usb1_phy;
};
};
 };
-- 
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 v9 09/13] arm/dts: am33xx: add dt data for usb nop phy

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

AM33xx has two musb controller and they have one NOP PHY each.
Added the device tree data for NOP PHY.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 arch/arm/boot/dts/am33xx.dtsi |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index bdde9c9..4b3a2b7 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -155,6 +155,14 @@
ti,hwmods = i2c3;
};
 
+   usb0_phy: phy0 {
+   compatible = nop-xceiv-usb;
+   };
+
+   usb1_phy: phy1 {
+   compatible = nop-xceiv-usb;
+   };
+
usb_otg_hs: usb_otg_hs {
compatible = ti,musb-am33xx;
ti,hwmods = usb_otg_hs;
-- 
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 v9 07/13] usb: musb: dsps: add dt support

2012-08-31 Thread Ravi Babu
From: Ajay Kumar Gupta ajay.gu...@ti.com

Added device tree support for dsps musb glue driver and updated the
Documentation with device tree binding information.

Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
Signed-off-by: Ravi Babu ravib...@ti.com
---
 .../devicetree/bindings/usb/am33xx-usb.txt |   14 +
 drivers/usb/musb/musb_dsps.c   |   60 +---
 2 files changed, 65 insertions(+), 9 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/usb/am33xx-usb.txt

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
new file mode 100644
index 000..ca8fa56
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -0,0 +1,14 @@
+AM33XX MUSB GLUE
+ - compatible : Should be ti,musb-am33xx
+ - 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
+ - port0_mode : Should be 3 to represent OTG. 1 signifies HOST and 2
+   represents PERIPHERAL.
+ - port1_mode : Should be 1 to represent HOST. 3 signifies OTG and 2
+   represents PERIPHERAL.
+ - power : Should be 250. This signifies the controller can supply upto
+   500mA when operating in host mode.
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 25e395b..2c104bf 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -31,6 +31,7 @@
 
 #include linux/init.h
 #include linux/io.h
+#include linux/of.h
 #include linux/err.h
 #include linux/platform_device.h
 #include linux/dma-mapping.h
@@ -46,6 +47,10 @@
 
 #include musb_core.h
 
+#ifdef CONFIG_OF
+static const struct of_device_id musb_dsps_of_match[];
+#endif
+
 /**
  * avoid using musb_readx()/musb_writex() as glue layer should not be
  * dependent on musb core layer symbols.
@@ -486,6 +491,8 @@ static int __devinit dsps_create_musb_pdev(struct dsps_glue 
*glue, u8 id)
struct device *dev = glue-dev;
struct platform_device *pdev = to_platform_device(dev);
struct musb_hdrc_platform_data  *pdata = dev-platform_data;
+   struct device_node *np = pdev-dev.of_node;
+   struct musb_hdrc_config *config;
struct platform_device  *musb;
struct resource *res;
struct resource resources[2];
@@ -552,14 +559,40 @@ static int __devinit dsps_create_musb_pdev(struct 
dsps_glue *glue, u8 id)
 
glue-musb[id]  = musb;
 
-   pdata-platform_ops = dsps_ops;
-
ret = platform_device_add_resources(musb, resources, 2);
if (ret) {
dev_err(dev, failed to add resources\n);
goto err2;
}
 
+   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 err2;
+   }
+
+   config = devm_kzalloc(pdev-dev, sizeof(*config), GFP_KERNEL);
+   if (!config) {
+   dev_err(pdev-dev,
+   failed to allocate musb hdrc config\n);
+   goto err2;
+   }
+
+   of_property_read_u32(np, num_eps, (u32 *)config-num_eps);
+   of_property_read_u32(np, ram_bits, (u32 *)config-ram_bits);
+   sprintf(res_name, port%d_mode, id);
+   of_property_read_u32(np, res_name, (u32 *)pdata-mode);
+   of_property_read_u32(np, power, (u32 *)pdata-power);
+   config-multipoint = of_property_read_bool(np, multipoint);
+
+   pdata-config   = config;
+   }
+
+   pdata-platform_ops = dsps_ops;
+
ret = platform_device_add_data(musb, pdata, sizeof(*pdata));
if (ret) {
dev_err(dev, failed to add platform_data\n);
@@ -591,14 +624,22 @@ static void __devexit dsps_delete_musb_pdev(struct 
dsps_glue *glue, u8 id)
 
 static int __devinit dsps_probe(struct platform_device *pdev)
 {
-   const struct platform_device_id *id = platform_get_device_id(pdev);
-   const struct dsps_musb_wrapper *wrp =
-   (struct dsps_musb_wrapper *)id-driver_data;
+   struct device_node *np = pdev-dev.of_node;
+   const struct of_device_id *match;
+   const struct dsps_musb_wrapper *wrp;
struct dsps_glue *glue;
struct resource *iomem;
u32 __iomem *usbss;
int ret, i;
 
+   match = of_match_node(musb_dsps_of_match, np);
+   if (!match) {
+

[PATCH v9 13/13] usb: otg: nop: add dt support

2012-08-31 Thread Ravi Babu
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
Signed-off-by: Ravi Babu ravib...@ti.com
---
 .../devicetree/bindings/usb/am33xx-usb.txt |3 +++
 drivers/usb/otg/nop-usb-xceiv.c|   10 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/am33xx-usb.txt 
b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
index b0caac3..e2702df 100644
--- a/Documentation/devicetree/bindings/usb/am33xx-usb.txt
+++ b/Documentation/devicetree/bindings/usb/am33xx-usb.txt
@@ -14,3 +14,6 @@ AM33XX MUSB GLUE
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/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c
index 7e0dba3..fdbc285 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
@@ -194,12 +195,21 @@ 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);
+#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


RE: create libcomposite, v3

2012-08-31 Thread Andrzej Pietrasiewicz
On Friday, August 31, 2012 12:12 PM Felipe Balbi wrote:

snip

 Unless it can be proven that ccg has active users, we should get rid of it
 for now before someone starts using it and we need to maintain the ABI for
 the next 10 years.

We need a configurable composite gadget in the Tizen platform to 
provide sdbd connectivity and mass storage function at the same time.

Thank you,

Andrzej


--
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: create libcomposite, v3

2012-08-31 Thread Felipe Balbi
Hi,

On Fri, Aug 31, 2012 at 01:39:21PM +0200, Andrzej Pietrasiewicz wrote:
 On Friday, August 31, 2012 12:12 PM Felipe Balbi wrote:
 
 snip
 
  Unless it can be proven that ccg has active users, we should get rid of it
  for now before someone starts using it and we need to maintain the ABI for
  the next 10 years.
 
 We need a configurable composite gadget in the Tizen platform to 
 provide sdbd connectivity and mass storage function at the same time.

You don't need a configurable composite gadget if you always have
storage and sdbd (btw, what's sdbd ? is that provided by ccg ? I don't
think so). A static (temporarily out-of-tree) tizen gadget would
suffice, once we move to configfs Tizen can start using that.

IMHO, that'll be a much lower impact on Tizen's platform. I'm also
concerned that after you start using it and we try to change, it'll just
be an argument to keep CCG as is, since it is an interface to userland
after all, and I don't want to maintain ccg for the next 10 years as
it's clearly wrong approach.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread Felipe Balbi
Hi,

On Fri, Aug 31, 2012 at 04:39:47PM +0530, Ravi Babu wrote:
 From: Santhapuri, Damodar damodar.santhap...@ti.com
 
 AM335x uses NOP transceiver driver and need to enable builtin PHY
 by writing into usb_ctrl register available in system control
 module register space. This is being added at musb glue driver
 layer untill a separate system control module driver is available.
 
 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
 Signed-off-by: Ravi Babu ravib...@ti.com

Kishon, you were adding a real phy driver for OMAP's internal phy logic
on one of your patches and I believe this will conflict with your
changes, right ?

How does this look to you ? Is this at least correct ? I suppose the
correct way would be to actually have the system control module driver
which we have been waiting, right ?

 ---
  arch/arm/mach-omap2/board-ti8168evm.c   |1 -
  arch/arm/mach-omap2/omap_phy_internal.c |   35 
  arch/arm/plat-omap/include/plat/usb.h   |5 +-
  drivers/usb/musb/musb_dsps.c|   87 
 +--
  4 files changed, 73 insertions(+), 55 deletions(-)
 
 diff --git a/arch/arm/mach-omap2/board-ti8168evm.c 
 b/arch/arm/mach-omap2/board-ti8168evm.c
 index d4c8392..0c7c098 100644
 --- a/arch/arm/mach-omap2/board-ti8168evm.c
 +++ b/arch/arm/mach-omap2/board-ti8168evm.c
 @@ -26,7 +26,6 @@
  #include plat/usb.h
  
  static struct omap_musb_board_data musb_board_data = {
 - .set_phy_power  = ti81xx_musb_phy_power,
   .interface_type = MUSB_INTERFACE_ULPI,
   .mode   = MUSB_OTG,
   .power  = 500,
 diff --git a/arch/arm/mach-omap2/omap_phy_internal.c 
 b/arch/arm/mach-omap2/omap_phy_internal.c
 index d52651a..d80bb16 100644
 --- a/arch/arm/mach-omap2/omap_phy_internal.c
 +++ b/arch/arm/mach-omap2/omap_phy_internal.c
 @@ -254,38 +254,3 @@ void am35x_set_mode(u8 musb_mode)
  
   omap_ctrl_writel(devconf2, AM35XX_CONTROL_DEVCONF2);
  }
 -
 -void ti81xx_musb_phy_power(u8 on)
 -{
 - void __iomem *scm_base = NULL;
 - u32 usbphycfg;
 -
 - scm_base = ioremap(TI81XX_SCM_BASE, SZ_2K);
 - if (!scm_base) {
 - pr_err(system control module ioremap failed\n);
 - return;
 - }
 -
 - usbphycfg = __raw_readl(scm_base + USBCTRL0);
 -
 - if (on) {
 - if (cpu_is_ti816x()) {
 - usbphycfg |= TI816X_USBPHY0_NORMAL_MODE;
 - usbphycfg = ~TI816X_USBPHY_REFCLK_OSC;
 - } else if (cpu_is_ti814x()) {
 - usbphycfg = ~(USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN
 - | USBPHY_DPINPUT | USBPHY_DMINPUT);
 - usbphycfg |= (USBPHY_OTGVDET_EN | USBPHY_OTGSESSEND_EN
 - | USBPHY_DPOPBUFCTL | USBPHY_DMOPBUFCTL);
 - }
 - } else {
 - if (cpu_is_ti816x())
 - usbphycfg = ~TI816X_USBPHY0_NORMAL_MODE;
 - else if (cpu_is_ti814x())
 - usbphycfg |= USBPHY_CM_PWRDN | USBPHY_OTG_PWRDN;
 -
 - }
 - __raw_writel(usbphycfg, scm_base + USBCTRL0);
 -
 - iounmap(scm_base);
 -}
 diff --git a/arch/arm/plat-omap/include/plat/usb.h 
 b/arch/arm/plat-omap/include/plat/usb.h
 index 548a4c8..c2aa4ae 100644
 --- a/arch/arm/plat-omap/include/plat/usb.h
 +++ b/arch/arm/plat-omap/include/plat/usb.h
 @@ -95,7 +95,6 @@ extern void am35x_musb_reset(void);
  extern void am35x_musb_phy_power(u8 on);
  extern void am35x_musb_clear_irq(void);
  extern void am35x_set_mode(u8 musb_mode);
 -extern void ti81xx_musb_phy_power(u8 on);
  
  /* AM35x */
  /* USB 2.0 PHY Control */
 @@ -120,8 +119,8 @@ extern void ti81xx_musb_phy_power(u8 on);
  #define CONF2_DATPOL (1  1)
  
  /* TI81XX specific definitions */
 -#define USBCTRL0 0x620
 -#define USBSTAT0 0x624
 +#define MUSB_USBSS_REV_816X  0x9
 +#define MUSB_USBSS_REV_814X  0xb
  
  /* TI816X PHY controls bits */
  #define TI816X_USBPHY0_NORMAL_MODE   (1  0)
 diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
 index 84d8181..960258d 100644
 --- a/drivers/usb/musb/musb_dsps.c
 +++ b/drivers/usb/musb/musb_dsps.c
 @@ -116,9 +116,46 @@ struct dsps_glue {
   struct platform_device *musb;   /* child musb pdev */
   const struct dsps_musb_wrapper *wrp; /* wrapper register offsets */
   struct timer_list timer;/* otg_workaround timer */
 + u32 __iomem *usb_ctrl;
 + u8  usbss_rev;
  };
  
  /**
 + * musb_dsps_phy_control - phy on/off
 + * @glue: struct dsps_glue *
 + * @on: flag for phy to be switched on or off
 + *
 + * This is to enable the PHY using usb_ctrl register in system control
 + * module space.
 + *
 + * 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)
 +{
 + u32 usbphycfg;
 +
 + usbphycfg = __raw_readl(glue-usb_ctrl);
 +
 + 

Re: [PATCH v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread ABRAHAM, KISHON VIJAY
Hi,

On Fri, Aug 31, 2012 at 5:53 PM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Fri, Aug 31, 2012 at 04:39:47PM +0530, Ravi Babu wrote:
 From: Santhapuri, Damodar damodar.santhap...@ti.com

 AM335x uses NOP transceiver driver and need to enable builtin PHY
 by writing into usb_ctrl register available in system control
 module register space. This is being added at musb glue driver
 layer untill a separate system control module driver is available.

 Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
 Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
 Signed-off-by: Ravi Babu ravib...@ti.com

 Kishon, you were adding a real phy driver for OMAP's internal phy logic
 on one of your patches and I believe this will conflict with your
 changes, right ?

Indeed. My final patch of that series removes some of the functions
from omap_phy_internal.c (which was taken care in the phy driver).

 How does this look to you ? Is this at least correct ? I suppose the
 correct way would be to actually have the system control module driver
 which we have been waiting, right ?

Correct. I think once we have the system control module driver in
place, we'll have everything wrt control module register writes
implemented in correct way.

Thanks
Kishon
--
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 v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread Felipe Balbi
On Fri, Aug 31, 2012 at 06:51:04PM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,
 
 On Fri, Aug 31, 2012 at 5:53 PM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Fri, Aug 31, 2012 at 04:39:47PM +0530, Ravi Babu wrote:
  From: Santhapuri, Damodar damodar.santhap...@ti.com
 
  AM335x uses NOP transceiver driver and need to enable builtin PHY
  by writing into usb_ctrl register available in system control
  module register space. This is being added at musb glue driver
  layer untill a separate system control module driver is available.
 
  Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
  Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
  Signed-off-by: Ravi Babu ravib...@ti.com
 
  Kishon, you were adding a real phy driver for OMAP's internal phy logic
  on one of your patches and I believe this will conflict with your
  changes, right ?
 
 Indeed. My final patch of that series removes some of the functions
 from omap_phy_internal.c (which was taken care in the phy driver).
 
  How does this look to you ? Is this at least correct ? I suppose the
  correct way would be to actually have the system control module driver
  which we have been waiting, right ?
 
 Correct. I think once we have the system control module driver in
 place, we'll have everything wrt control module register writes
 implemented in correct way.

So $SUBJECT will pretty much be thrown away once we have SCM driver, in
that case it's best to wait a bit longer and apply this series once SCM
driver is available and after your series too... you agree ?

-- 
balbi


signature.asc
Description: Digital signature


[PATCH] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Forest Bond
From: Forest Bond forest.b...@rapidrollout.com

Certain eGalax devices expose an interface with class HID and protocol
None.  Some work with usbhid and some work with usbtouchscreen, but
there is no easy way to differentiate.  Sending an eGalax diagnostic
packet seems to kick them all into using the right protocol for
usbtouchscreen, so we can continue to bind them all there (as opposed to
handing some off to usbhid).

This fixes a regression for devices that were claimed by (and worked
with) usbhid prior to commit 139ebe8dc80dd74cb2ac9f5603d18fbf5cff049f,
which made usbtouchscreen claim them instead.  With this patch they will
still be claimed by usbtouchscreen, but they will actually report events
usbtouchscreen can understand.  Note that these devices will be limited
to the usbtouchscreen feature set so e.g. dual touch features are not
supported.

I have the distinct pleasure of needing to support devices of both types
and have tested accordingly.

Signed-off-by: Forest Bond forest.b...@rapidrollout.com
---
 drivers/input/touchscreen/usbtouchscreen.c |   25 +
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
b/drivers/input/touchscreen/usbtouchscreen.c
index e32709e..2ce5308 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -304,6 +304,30 @@ static int e2i_read_data(struct usbtouch_usb *dev, 
unsigned char *pkt)
 #define EGALAX_PKT_TYPE_REPT   0x80
 #define EGALAX_PKT_TYPE_DIAG   0x0A
 
+static int egalax_init(struct usbtouch_usb *usbtouch)
+{
+   int ret, i;
+   struct usb_device *udev = interface_to_usbdev(usbtouch-interface);
+
+   /* An eGalax diagnostic packet kicks the device into using the right
+* protocol. */
+   for (i = 0; i  3; i++) {
+   /* Send a check active packet. The response will be read
+* later and ignored. */
+   ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ 0, 0, \x0A\x01A, 0,
+ USB_CTRL_SET_TIMEOUT);
+   if (ret = 0)
+   break;
+   if (ret != -EPIPE)
+   return ret;
+   }
+
+   return 0;
+}
+
 static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
if ((pkt[0]  EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
@@ -1056,6 +1080,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
.process_pkt= usbtouch_process_multi,
.get_pkt_len= egalax_get_pkt_len,
.read_data  = egalax_read_data,
+   .init   = egalax_init,
},
 #endif
 
-- 
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


Re: [PATCH] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Dmitry Torokhov
On Fri, Aug 31, 2012 at 09:56:58AM -0400, Forest Bond wrote:
 From: Forest Bond forest.b...@rapidrollout.com
 
 Certain eGalax devices expose an interface with class HID and protocol
 None.  Some work with usbhid and some work with usbtouchscreen, but
 there is no easy way to differentiate.  Sending an eGalax diagnostic
 packet seems to kick them all into using the right protocol for
 usbtouchscreen, so we can continue to bind them all there (as opposed to
 handing some off to usbhid).
 
 This fixes a regression for devices that were claimed by (and worked
 with) usbhid prior to commit 139ebe8dc80dd74cb2ac9f5603d18fbf5cff049f,
 which made usbtouchscreen claim them instead.  With this patch they will
 still be claimed by usbtouchscreen, but they will actually report events
 usbtouchscreen can understand.  Note that these devices will be limited
 to the usbtouchscreen feature set so e.g. dual touch features are not
 supported.
 
 I have the distinct pleasure of needing to support devices of both types
 and have tested accordingly.
 
 Signed-off-by: Forest Bond forest.b...@rapidrollout.com

Applied, thanks Forest.

 ---
  drivers/input/touchscreen/usbtouchscreen.c |   25 +
  1 files changed, 25 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
 b/drivers/input/touchscreen/usbtouchscreen.c
 index e32709e..2ce5308 100644
 --- a/drivers/input/touchscreen/usbtouchscreen.c
 +++ b/drivers/input/touchscreen/usbtouchscreen.c
 @@ -304,6 +304,30 @@ static int e2i_read_data(struct usbtouch_usb *dev, 
 unsigned char *pkt)
  #define EGALAX_PKT_TYPE_REPT 0x80
  #define EGALAX_PKT_TYPE_DIAG 0x0A
  
 +static int egalax_init(struct usbtouch_usb *usbtouch)
 +{
 + int ret, i;
 + struct usb_device *udev = interface_to_usbdev(usbtouch-interface);
 +
 + /* An eGalax diagnostic packet kicks the device into using the right
 +  * protocol. */
 + for (i = 0; i  3; i++) {
 + /* Send a check active packet. The response will be read
 +  * later and ignored. */
 + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 +   0,
 +   USB_DIR_OUT | USB_TYPE_VENDOR | 
 USB_RECIP_DEVICE,
 +   0, 0, \x0A\x01A, 0,
 +   USB_CTRL_SET_TIMEOUT);
 + if (ret = 0)
 + break;
 + if (ret != -EPIPE)
 + return ret;
 + }
 +
 + return 0;
 +}
 +
  static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  {
   if ((pkt[0]  EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
 @@ -1056,6 +1080,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] 
 = {
   .process_pkt= usbtouch_process_multi,
   .get_pkt_len= egalax_get_pkt_len,
   .read_data  = egalax_read_data,
 + .init   = egalax_init,
   },
  #endif
  
 -- 
 1.7.0.4

-- 
Dmitry
--
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 v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread ABRAHAM, KISHON VIJAY
On Fri, Aug 31, 2012 at 6:49 PM, Felipe Balbi ba...@ti.com wrote:
 On Fri, Aug 31, 2012 at 06:51:04PM +0530, ABRAHAM, KISHON VIJAY wrote:
 Hi,

 On Fri, Aug 31, 2012 at 5:53 PM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Fri, Aug 31, 2012 at 04:39:47PM +0530, Ravi Babu wrote:
  From: Santhapuri, Damodar damodar.santhap...@ti.com
 
  AM335x uses NOP transceiver driver and need to enable builtin PHY
  by writing into usb_ctrl register available in system control
  module register space. This is being added at musb glue driver
  layer untill a separate system control module driver is available.
 
  Signed-off-by: Ajay Kumar Gupta ajay.gu...@ti.com
  Signed-off-by: Santhapuri, Damodar damodar.santhap...@ti.com
  Signed-off-by: Ravi Babu ravib...@ti.com
 
  Kishon, you were adding a real phy driver for OMAP's internal phy logic
  on one of your patches and I believe this will conflict with your
  changes, right ?

 Indeed. My final patch of that series removes some of the functions
 from omap_phy_internal.c (which was taken care in the phy driver).
 
  How does this look to you ? Is this at least correct ? I suppose the
  correct way would be to actually have the system control module driver
  which we have been waiting, right ?

 Correct. I think once we have the system control module driver in
 place, we'll have everything wrt control module register writes
 implemented in correct way.

 So $SUBJECT will pretty much be thrown away once we have SCM driver, in
 that case it's best to wait a bit longer and apply this series once SCM
 driver is available and after your series too... you agree ?

Yes. That would be better.

Thanks
Kishon
--
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 v9 01/13] usb: musb: dsps: add phy control logic to glue

2012-08-31 Thread Tony Lindgren
* Ravi Babu ravib...@ti.com [120831 04:10]:
 --- a/arch/arm/plat-omap/include/plat/usb.h
 +++ b/arch/arm/plat-omap/include/plat/usb.h
 @@ -95,7 +95,6 @@ extern void am35x_musb_reset(void);
  extern void am35x_musb_phy_power(u8 on);
  extern void am35x_musb_clear_irq(void);
  extern void am35x_set_mode(u8 musb_mode);
 -extern void ti81xx_musb_phy_power(u8 on);
  
  /* AM35x */
  /* USB 2.0 PHY Control */
 @@ -120,8 +119,8 @@ extern void ti81xx_musb_phy_power(u8 on);
  #define CONF2_DATPOL (1  1)
  
  /* TI81XX specific definitions */
 -#define USBCTRL0 0x620
 -#define USBSTAT0 0x624
 +#define MUSB_USBSS_REV_816X  0x9
 +#define MUSB_USBSS_REV_814X  0xb
  
  /* TI816X PHY controls bits */
  #define TI816X_USBPHY0_NORMAL_MODE   (1  0)

This file needs to move to include/linux/platform_data/usb-omap.h
as it's blocking the ARM single zImage changes so some coordination is
required here. Felipe, can you do a minimal immutable branch with just
one patch against v3.6-rc3 that move the header so I can pull in too?

Regards,

Tony
--
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: [PATCHv3] usb: dwc3: use a burst size only ss-mode

2012-08-31 Thread Sergei Shtylyov
Hello.

On 08/31/2012 08:42 AM, Chanho Park wrote:

 When connection is established non-ss mode,
^ in missing

 a maxburst is set to 0.
 Therefore, the value of burst size has wrong value. We must use the burst size

   Value has value?

 only in ss-mode.

   What is ss-mode anyway? SuperSpeed mode?

 Signed-off-by: Chanho Park chanho61.p...@samsung.com
 Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
 ---
  drivers/usb/dwc3/gadget.c |6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)

 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
 index 58fdfad..440a86b 100644
 --- a/drivers/usb/dwc3/gadget.c
 +++ b/drivers/usb/dwc3/gadget.c
 @@ -434,12 +434,16 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, 
 struct dwc3_ep *dep,
   const struct usb_ss_ep_comp_descriptor *comp_desc)
  {
   struct dwc3_gadget_ep_cmd_params params;
 + u32 burst_size;
  
   memset(params, 0x00, sizeof(params));
  
 + /* We only use a burst size in ss-mode */
 + burst_size = (com_desc) ? (dep-endpoint.maxburst - 1) : 0;

   No parens needed around the operands of ?: operator.

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


[RFC] How to handle delays in isochronous transfers?

2012-08-31 Thread Alan Stern
Clemens and Laurent (and anyone else who's interested):

How should the lower USB layers handle delays in transferring
isochronous data?  I'm asking you because the most common usages of
isochronous transfers are for audio and video.

Here's an example to illustrate what I mean.  Typically an audio or
video driver will keep a queue of around 10 ms of data submitted to an
isochronous endpoint.  I have seen reports from users where URB
completion interrupts were delayed by as much as 50 ms.  In one case
the delay was caused by a bug in a wireless drivers that left
interrupts disabled; in another case the cause was unknown -- it might
have been a hardware problem.  At any rate, when this happens the
endpoint's queue drains completely.

Clearly this will cause a glitch in the data stream.  The question is: 
What should we do to recover and re-synchronize?

We could pretend nothing happened and continue to handle URBs normally,
scheduling each submission for the next available slot.  But for an
isochronous-OUT transfer, this would mean that all the future data
values are delayed by some 40 ms relative to the earlier data.  If
another glitch occurs then the following data will be delayed by even
more.  For some applications this might not matter, but for others
(real-time things like voice) it could be quite bad.  Similar problems 
arise with IN transfers.

Alternatively, the host controller driver could fail the next 40 ms
worth of isochronous URBs, so that the higher-level client catches up
to where it should be.  The failure could occur during submission, or
the URBs could be accepted and then forced to complete immediately,
with no data transferred.

What's the right thing to do?  My feeling is that the behavior 
should be decided not by the host controller driver but rather by the 
higher-level client.  We could use the URB_ISO_ASAP flag for this 
purpose -- right now it is essentially useless.

Or maybe we should do something else I haven't thought of.  What would
be the best approach for your purposes?

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] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Dmitry Torokhov
On Fri, Aug 31, 2012 at 10:50:38PM +0400, Sergei Shtylyov wrote:
 Hello.
 
 On 08/31/2012 05:56 PM, Forest Bond wrote:
 
  From: Forest Bond forest.b...@rapidrollout.com
 
  Certain eGalax devices expose an interface with class HID and protocol
  None.  Some work with usbhid and some work with usbtouchscreen, but
  there is no easy way to differentiate.  Sending an eGalax diagnostic
  packet seems to kick them all into using the right protocol for
  usbtouchscreen, so we can continue to bind them all there (as opposed to
  handing some off to usbhid).
 
  This fixes a regression for devices that were claimed by (and worked
  with) usbhid prior to commit 139ebe8dc80dd74cb2ac9f5603d18fbf5cff049f,
 
Please also specify that commit's summary ion parens.
 
  which made usbtouchscreen claim them instead.  With this patch they will
  still be claimed by usbtouchscreen, but they will actually report events
  usbtouchscreen can understand.  Note that these devices will be limited
  to the usbtouchscreen feature set so e.g. dual touch features are not
  supported.
 
  I have the distinct pleasure of needing to support devices of both types
  and have tested accordingly.
 
  Signed-off-by: Forest Bond forest.b...@rapidrollout.com
  ---
   drivers/input/touchscreen/usbtouchscreen.c |   25 +
   1 files changed, 25 insertions(+), 0 deletions(-)
 
  diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
  b/drivers/input/touchscreen/usbtouchscreen.c
  index e32709e..2ce5308 100644
  --- a/drivers/input/touchscreen/usbtouchscreen.c
  +++ b/drivers/input/touchscreen/usbtouchscreen.c
  @@ -304,6 +304,30 @@ static int e2i_read_data(struct usbtouch_usb *dev, 
  unsigned char *pkt)
   #define EGALAX_PKT_TYPE_REPT   0x80
   #define EGALAX_PKT_TYPE_DIAG   0x0A
   
  +static int egalax_init(struct usbtouch_usb *usbtouch)
  +{
  +   int ret, i;
  +   struct usb_device *udev = interface_to_usbdev(usbtouch-interface);
  +
  +   /* An eGalax diagnostic packet kicks the device into using the right
  +* protocol. */
 
The preferred multi-line comment style is:
 
 /*
  * bla
  * bla
  */
 
  +   for (i = 0; i  3; i++) {
  +   /* Send a check active packet. The response will be read
  +* later and ignored. */
  +   ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
  + 0,
  + USB_DIR_OUT | USB_TYPE_VENDOR | 
  USB_RECIP_DEVICE,
  + 0, 0, \x0A\x01A, 0,
 
You probably can't send data from the .const section (as well as off the
 stack) -- they can be DMA'ed and there'll be issues with cache consistency on
 non-x86 arches. You should allocate the data with kmalloc().
Although, on the second thought, maybe I'm wrong in this case... not really
 sure about sending -- receiving (to the .data section) could certainly be 
 harmful...

Hmm, do we actually send anything here? The size passed to
usb_control_msg() is 0 so I don't think we use that data at all...

Thanks.

-- 
Dmitry
--
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] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Alan Stern
On Fri, 31 Aug 2012, Dmitry Torokhov wrote:

   + /* Send a check active packet. The response will be read
   +  * later and ignored. */
   + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
   +   0,
   +   USB_DIR_OUT | USB_TYPE_VENDOR | 
   USB_RECIP_DEVICE,
   +   0, 0, \x0A\x01A, 0,
  
 You probably can't send data from the .const section (as well as off the
  stack) -- they can be DMA'ed and there'll be issues with cache consistency 
  on
  non-x86 arches. You should allocate the data with kmalloc().
 Although, on the second thought, maybe I'm wrong in this case... not 
  really
  sure about sending -- receiving (to the .data section) could certainly be 
  harmful...
 
 Hmm, do we actually send anything here? The size passed to
 usb_control_msg() is 0 so I don't think we use that data at all...

Good point.  Perhaps the 0 is a typo, in which case data does get sent
and the buffer must be kmalloc'ed.  If the 0 is correct then the buffer
should be NULL, not \x0A\x01A (and what's the purpose of the leading
'0' in the second byte?).

In addition, although the bRequestType specifies USB_DIR_OUT, the pipe
value is usb_rcvctrlpipe.  Is this transfer meant to be IN or OUT?

Alan Stern

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Forest Bond
Hi,

On Fri, Aug 31, 2012 at 04:04:58PM -0400, Alan Stern wrote:
 On Fri, 31 Aug 2012, Dmitry Torokhov wrote:
 
+   /* Send a check active packet. The response will be 
read
+* later and ignored. */
+   ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ 0, 0, \x0A\x01A, 0,
   
  You probably can't send data from the .const section (as well as off 
   the
   stack) -- they can be DMA'ed and there'll be issues with cache 
   consistency on
   non-x86 arches. You should allocate the data with kmalloc().
  Although, on the second thought, maybe I'm wrong in this case... not 
   really
   sure about sending -- receiving (to the .data section) could certainly be 
   harmful...
  
  Hmm, do we actually send anything here? The size passed to
  usb_control_msg() is 0 so I don't think we use that data at all...
 
 Good point.  Perhaps the 0 is a typo, in which case data does get sent
 and the buffer must be kmalloc'ed.  If the 0 is correct then the buffer
 should be NULL, not \x0A\x01A (and what's the purpose of the leading
 '0' in the second byte?).
 
 In addition, although the bRequestType specifies USB_DIR_OUT, the pipe
 value is usb_rcvctrlpipe.  Is this transfer meant to be IN or OUT?

The primary issue is that I'm a USB newb working on a deadline. ;)

My intention with this call was to send those three bytes out to the device.  I
tested this in Python using a libusb binding.  Oddly enough, the code as written
does in fact work in the sense that the device talks to the driver correctly
after initialization (and without it it doesn't).

Anyway, thanks for the review and sorry for being a bonehead.  I'll resend.

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com


signature.asc
Description: Digital signature


Re: [PATCH] net: qmi_wwan: new device: Foxconn/Novatel E396

2012-08-31 Thread David Miller
From: Bjørn Mork bj...@mork.no
Date: Wed, 29 Aug 2012 09:03:34 +0200

 Aleksander Morgado aleksan...@lanedo.com writes:
 
 Foxconn-branded Novatel E396, Gobi3k modem.

 Cc: Dan Williams d...@redhat.com
 Cc: Bjørn Mork bj...@mork.no
 Cc: Ben Chan benc...@google.com
 Signed-off-by: Aleksander Morgado aleksan...@lanedo.com
 ...
 If it matters to anyone:
 
 Acked-by: Bjørn Mork bj...@mork.no

Applied, thanks everyone.
--
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] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Forest Bond
Hi,

On Fri, Aug 31, 2012 at 04:04:58PM -0400, Alan Stern wrote:
 On Fri, 31 Aug 2012, Dmitry Torokhov wrote:
 
+   /* Send a check active packet. The response will be 
read
+* later and ignored. */
+   ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ 0, 0, \x0A\x01A, 0,
   
  You probably can't send data from the .const section (as well as off 
   the
   stack) -- they can be DMA'ed and there'll be issues with cache 
   consistency on
   non-x86 arches. You should allocate the data with kmalloc().
  Although, on the second thought, maybe I'm wrong in this case... not 
   really
   sure about sending -- receiving (to the .data section) could certainly be 
   harmful...
  
  Hmm, do we actually send anything here? The size passed to
  usb_control_msg() is 0 so I don't think we use that data at all...
 
 Good point.  Perhaps the 0 is a typo, in which case data does get sent
 and the buffer must be kmalloc'ed.  If the 0 is correct then the buffer
 should be NULL, not \x0A\x01A (and what's the purpose of the leading
 '0' in the second byte?).
 
 In addition, although the bRequestType specifies USB_DIR_OUT, the pipe
 value is usb_rcvctrlpipe.  Is this transfer meant to be IN or OUT?

Thanks again to all for the review.  My theory for why the previous patch worked
in spite of its wrongness is that the device actually switches modes when it
receives a control message with USB_TYPE_VENDOR even though the documentation
suggests an actual diagnostic packet must be received.

Does this (untested) patch look more reasonable?


diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
b/drivers/input/touchscreen/usbtouchscreen.c
index e32709e..64b4b17 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -304,6 +304,41 @@ static int e2i_read_data(struct usbtouch_usb *dev, 
unsigned char *pkt)
 #define EGALAX_PKT_TYPE_REPT   0x80
 #define EGALAX_PKT_TYPE_DIAG   0x0A
 
+static int egalax_init(struct usbtouch_usb *usbtouch)
+{
+   int ret, i;
+   unsigned char *buf;
+   struct usb_device *udev = interface_to_usbdev(usbtouch-interface);
+
+   /* An eGalax diagnostic packet kicks the device into using the right
+* protocol.  We send a check active packet.  The response will be
+* read later and ignored.
+*/
+
+   buf = kmalloc(3, GFP_KERNEL);
+   buf[0] = EGALAX_PKT_TYPE_DIAG;
+   buf[1] = 1; /* length */
+   buf[2] = 'A';   /* command - check active */
+
+   for (i = 0; i  3; i++) {
+   ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ 0, 0, buf, 3,
+ USB_CTRL_SET_TIMEOUT);
+   if (ret = 0) {
+   ret = 0;
+   break;
+   }
+   if (ret != -EPIPE)
+   break;
+   }
+
+   kfree(buf);
+
+   return ret;
+}
+
 static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
if ((pkt[0]  EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
@@ -1056,6 +1091,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
.process_pkt= usbtouch_process_multi,
.get_pkt_len= egalax_get_pkt_len,
.read_data  = egalax_read_data,
+   .init   = egalax_init,
},
 #endif
 

Thanks,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com


signature.asc
Description: Digital signature


Re: [PATCH] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Dmitry Torokhov
On Fri, Aug 31, 2012 at 06:53:53PM -0400, Forest Bond wrote:
 Hi,
 
 On Fri, Aug 31, 2012 at 04:04:58PM -0400, Alan Stern wrote:
  On Fri, 31 Aug 2012, Dmitry Torokhov wrote:
  
 + /* Send a check active packet. The response will be 
 read
 +  * later and ignored. */
 + ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
 +   0,
 +   USB_DIR_OUT | USB_TYPE_VENDOR | 
 USB_RECIP_DEVICE,
 +   0, 0, \x0A\x01A, 0,

   You probably can't send data from the .const section (as well as off 
the
stack) -- they can be DMA'ed and there'll be issues with cache 
consistency on
non-x86 arches. You should allocate the data with kmalloc().
   Although, on the second thought, maybe I'm wrong in this case... not 
really
sure about sending -- receiving (to the .data section) could certainly 
be harmful...
   
   Hmm, do we actually send anything here? The size passed to
   usb_control_msg() is 0 so I don't think we use that data at all...
  
  Good point.  Perhaps the 0 is a typo, in which case data does get sent
  and the buffer must be kmalloc'ed.  If the 0 is correct then the buffer
  should be NULL, not \x0A\x01A (and what's the purpose of the leading
  '0' in the second byte?).
  
  In addition, although the bRequestType specifies USB_DIR_OUT, the pipe
  value is usb_rcvctrlpipe.  Is this transfer meant to be IN or OUT?
 
 Thanks again to all for the review.  My theory for why the previous patch 
 worked
 in spite of its wrongness is that the device actually switches modes when it
 receives a control message with USB_TYPE_VENDOR even though the documentation
 suggests an actual diagnostic packet must be received.
 
 Does this (untested) patch look more reasonable?

Yes, but we still need it tested, please.

 
 
 diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
 b/drivers/input/touchscreen/usbtouchscreen.c
 index e32709e..64b4b17 100644
 --- a/drivers/input/touchscreen/usbtouchscreen.c
 +++ b/drivers/input/touchscreen/usbtouchscreen.c
 @@ -304,6 +304,41 @@ static int e2i_read_data(struct usbtouch_usb *dev, 
 unsigned char *pkt)
  #define EGALAX_PKT_TYPE_REPT 0x80
  #define EGALAX_PKT_TYPE_DIAG 0x0A
  
 +static int egalax_init(struct usbtouch_usb *usbtouch)
 +{
 + int ret, i;
 + unsigned char *buf;
 + struct usb_device *udev = interface_to_usbdev(usbtouch-interface);
 +
 + /* An eGalax diagnostic packet kicks the device into using the right
 +  * protocol.  We send a check active packet.  The response will be
 +  * read later and ignored.
 +  */
 +
 + buf = kmalloc(3, GFP_KERNEL);
 + buf[0] = EGALAX_PKT_TYPE_DIAG;
 + buf[1] = 1; /* length */
 + buf[2] = 'A';   /* command - check active */
 +
 + for (i = 0; i  3; i++) {
 + ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 +   0,
 +   USB_DIR_OUT | USB_TYPE_VENDOR | 
 USB_RECIP_DEVICE,
 +   0, 0, buf, 3,
 +   USB_CTRL_SET_TIMEOUT);
 + if (ret = 0) {
 + ret = 0;
 + break;
 + }
 + if (ret != -EPIPE)
 + break;
 + }
 +
 + kfree(buf);
 +
 + return ret;
 +}
 +
  static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
  {
   if ((pkt[0]  EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
 @@ -1056,6 +1091,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] 
 = {
   .process_pkt= usbtouch_process_multi,
   .get_pkt_len= egalax_get_pkt_len,
   .read_data  = egalax_read_data,
 + .init   = egalax_init,
   },
  #endif
  
 
 Thanks,
 Forest
 -- 
 Forest Bond
 http://www.alittletooquiet.net
 http://www.rapidrollout.com



-- 
Dmitry
--
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] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Forest Bond
Hi Dmitry,

On Fri, Aug 31, 2012 at 04:10:47PM -0700, Dmitry Torokhov wrote:
 On Fri, Aug 31, 2012 at 06:53:53PM -0400, Forest Bond wrote:
  Hi,
  
  On Fri, Aug 31, 2012 at 04:04:58PM -0400, Alan Stern wrote:
   On Fri, 31 Aug 2012, Dmitry Torokhov wrote:
   
  +   /* Send a check active packet. The response will be 
  read
  +* later and ignored. */
  +   ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
  + 0,
  + USB_DIR_OUT | USB_TYPE_VENDOR | 
  USB_RECIP_DEVICE,
  + 0, 0, \x0A\x01A, 0,
 
You probably can't send data from the .const section (as well as 
 off the
 stack) -- they can be DMA'ed and there'll be issues with cache 
 consistency on
 non-x86 arches. You should allocate the data with kmalloc().
Although, on the second thought, maybe I'm wrong in this case... 
 not really
 sure about sending -- receiving (to the .data section) could 
 certainly be harmful...

Hmm, do we actually send anything here? The size passed to
usb_control_msg() is 0 so I don't think we use that data at all...
   
   Good point.  Perhaps the 0 is a typo, in which case data does get sent
   and the buffer must be kmalloc'ed.  If the 0 is correct then the buffer
   should be NULL, not \x0A\x01A (and what's the purpose of the leading
   '0' in the second byte?).
   
   In addition, although the bRequestType specifies USB_DIR_OUT, the pipe
   value is usb_rcvctrlpipe.  Is this transfer meant to be IN or OUT?
  
  Thanks again to all for the review.  My theory for why the previous patch 
  worked
  in spite of its wrongness is that the device actually switches modes when it
  receives a control message with USB_TYPE_VENDOR even though the 
  documentation
  suggests an actual diagnostic packet must be received.
  
  Does this (untested) patch look more reasonable?
 
 Yes, but we still need it tested, please.

Great, I'll test it later this evening when I am back in front of the hardware
and follow up with a properly submitted patch.

Thanks again,
Forest
-- 
Forest Bond
http://www.alittletooquiet.net
http://www.rapidrollout.com


signature.asc
Description: Digital signature


[PATCH resend] Input: usbtouchscreen - initialize eGalax devices

2012-08-31 Thread Forest Bond
From: Forest Bond forest.b...@rapidrollout.com

Certain eGalax devices expose an interface with class HID and protocol
None.  Some work with usbhid and some work with usbtouchscreen, but
there is no easy way to differentiate.  Sending an eGalax diagnostic
packet seems to kick them all into using the right protocol for
usbtouchscreen, so we can continue to bind them all there (as opposed to
handing some off to usbhid).

This fixes a regression for devices that were claimed by (and worked
with) usbhid prior to commit 139ebe8dc80dd74cb2ac9f5603d18fbf5cff049f
(Input: usbtouchscreen - fix eGalax HID ignoring), which made
usbtouchscreen claim them instead.  With this patch they will still be
claimed by usbtouchscreen, but they will actually report events
usbtouchscreen can understand.  Note that these devices will be limited
to the usbtouchscreen feature set so e.g. dual touch features are not
supported.

I have the distinct pleasure of needing to support devices of both types
and have tested accordingly.

Signed-off-by: Forest Bond forest.b...@rapidrollout.com
---
 drivers/input/touchscreen/usbtouchscreen.c |   36 
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/usbtouchscreen.c 
b/drivers/input/touchscreen/usbtouchscreen.c
index e32709e..64b4b17 100644
--- a/drivers/input/touchscreen/usbtouchscreen.c
+++ b/drivers/input/touchscreen/usbtouchscreen.c
@@ -304,6 +304,41 @@ static int e2i_read_data(struct usbtouch_usb *dev, 
unsigned char *pkt)
 #define EGALAX_PKT_TYPE_REPT   0x80
 #define EGALAX_PKT_TYPE_DIAG   0x0A
 
+static int egalax_init(struct usbtouch_usb *usbtouch)
+{
+   int ret, i;
+   unsigned char *buf;
+   struct usb_device *udev = interface_to_usbdev(usbtouch-interface);
+
+   /* An eGalax diagnostic packet kicks the device into using the right
+* protocol.  We send a check active packet.  The response will be
+* read later and ignored.
+*/
+
+   buf = kmalloc(3, GFP_KERNEL);
+   buf[0] = EGALAX_PKT_TYPE_DIAG;
+   buf[1] = 1; /* length */
+   buf[2] = 'A';   /* command - check active */
+
+   for (i = 0; i  3; i++) {
+   ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+ 0,
+ USB_DIR_OUT | USB_TYPE_VENDOR | 
USB_RECIP_DEVICE,
+ 0, 0, buf, 3,
+ USB_CTRL_SET_TIMEOUT);
+   if (ret = 0) {
+   ret = 0;
+   break;
+   }
+   if (ret != -EPIPE)
+   break;
+   }
+
+   kfree(buf);
+
+   return ret;
+}
+
 static int egalax_read_data(struct usbtouch_usb *dev, unsigned char *pkt)
 {
if ((pkt[0]  EGALAX_PKT_TYPE_MASK) != EGALAX_PKT_TYPE_REPT)
@@ -1056,6 +1091,7 @@ static struct usbtouch_device_info usbtouch_dev_info[] = {
.process_pkt= usbtouch_process_multi,
.get_pkt_len= egalax_get_pkt_len,
.read_data  = egalax_read_data,
+   .init   = egalax_init,
},
 #endif
 
-- 
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


Re: JMicron 20337 (152d:2338) and 3TB

2012-08-31 Thread Norman Diamond

Robert Hancock wrote:

On 05/08/2012 06:12 PM, Norman Diamond wrote:

On Wed, 2012/5/9, Alan Stern wrote:

On Tue, 8 May 2012, Norman Diamond wrote:

Alan Stern wrote:

On Tue, 8 May 2012, Norman Diamond wrote:


Sometimes I guess a USB-to-[S]ATA bridge might obey ATA passthru of
an ATA Identify command though I haven't seen one.



The only ones I'm aware of are the entries marked with the SANE_SENSE
quirk in unusual_devs.h: the HP Personal Media Drive (03f0:070c), the
Genesys Logic bridge (05e3:0723), the Seagate FreeAgent Pro
(0bc2:3010), the Maxtor bridge (0d49:7310), the Western Digital bridge
(1058:0704), and a different JMicron bridge (152d:2329).  Of course,
the fact that the flag is set doesn't necessarily mean the device
really does have SAT support.


I have a Vantex NexStar TX 2.5 SATA enclosure that uses:

Bus 001 Device 006: ID 152d:2329 JMicron Technology Corp. / JMicron USA 
Technology Corp. JM20329 SATA Bridge


and ATA pass-through seems to work (at least as far as commands like 
hdparm -I and smartctl).


Thank you.  I will buy the following device for experiments:
http://dx.com/p/jmicron-usb-sata-adapter-dongle-12213

I'm not holding my breath expecting it to work with a drive larger than 
2.2TB, or DCO commands or security commands, but I'll experiment.  In 
experiments with other JMicron chips, some work with more than 2.2TB 
sometimes, some handle DCO on some ports but not others, some handle 
security commands on some ports but not others, some handle a command 
sometimes but hang other times, etc.  I don't really want to buy a JMicron 
product again, but I'll experiment with this one. 


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