Re: [PATCH][RESEND] usb: gadget: composite: Provide a list of available functions

2014-07-10 Thread Andrzej Pietrasiewicz

Hello All,

Uhm, errr please disregard this patch as well.
I still get it wrong.

W dniu 09.07.2014 14:15, Andrzej Pietrasiewicz pisze:

When gadgets are composed with configfs the user must know what are the
available function names. The names are parts of usb_f_*.ko
modules' aliases. If a function is compiled as a module, the information
can be found in modules.alias file. But if a function is compiled-in,
there is no way to know the function's name.

This patch adds a sysfs attribute in libcomposite's sys directory to
show functions which are already registered. Functions which are
compiled-in will be in this list as well.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
---


snip



diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index bcc2a62..352571b 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1553,13 +1553,36 @@ void unregister_gadget_item(struct config_item *item)
  }


snip


  static int __init gadget_cfs_init(void)
  {
int ret;

config_group_init(gadget_subsys.su_group);

+   ret = sysfs_create_file(THIS_MODULE-mkobj.kobj,
+   sysfs_func_list.attr);


THIS_MODULE is NULL if compiled-in.

AP
--
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] usb: usb5303: make use of uninitialized err variable

2014-07-10 Thread Geert Uytterhoeven
Hi Greg,

On Thu, Jul 10, 2014 at 12:46 AM, Greg Kroah-Hartman
gre...@linuxfoundation.org wrote:
 On Mon, Jun 02, 2014 at 07:45:25PM +0200, Emil Goode wrote:
 The variable err is not initialized here, this patch uses it
 to store an eventual error value from devm_clk_get().

 Signed-off-by: Emil Goode emilgo...@gmail.com
 Acked-by: Geert Uytterhoeven ge...@linux-m68k.org
 ---
  drivers/usb/misc/usb3503.c |   10 +++---
  1 file changed, 7 insertions(+), 3 deletions(-)

 This patch fails to apply to my tree :(

You've already applied
commit ec5734c41bee2ee7c938a8f34853d31cada7e67a
Author: Tushar Behera tusha...@samsung.com
Date:   Tue Jun 17 16:38:50 2014 +0530

usb: misc: usb3503: Update error code in print message

'err' is uninitialized, rather print the error code directly.

which fixes it slightly different.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say programmer or something like that.
-- Linus Torvalds
--
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] usbnet: smsc95xx: add reset_resume function with reset operation

2014-07-10 Thread David Miller
From: Joonyoung Shim jy0922.s...@samsung.com
Date: Thu, 10 Jul 2014 11:49:42 +0900

 The smsc95xx needs to resume with reset operation. Otherwise it causes
 system hang by network error like below after resume. This case appears
 on odroid u3 board.
 
 [9.727600] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 [9.727648] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 [9.727689] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 [9.727728] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 [9.729486] PM: resume of devices complete after 2011.219 msecs
 [   10.117609] Restarting tasks ... done.
 [   11.725099] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 [   13.480846] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 [   13.481361] smsc95xx 1-2:1.0 eth0: kevent 2 may have been dropped
 ...
 
 Signed-off-by: Joonyoung Shim jy0922.s...@samsung.com

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


Re: [PATCH net-next v2] r8152: support jumbo frame for RTL8153

2014-07-10 Thread David Miller
From: Hayes Wang hayesw...@realtek.com
Date: Thu, 10 Jul 2014 10:58:54 +0800

 The maximum jumbo frame size for RTL8153 is 9K bytes.
 Change the max rx packet size to 9K.
 Change the use of the shared fifo from 6K (default) to 12K for tx.
 
 Signed-off-by: Hayes Wang hayesw...@realtek.com

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


[PATCH v2 0/2] ARM: shmobile: lager: USBHS callback elimination

2014-07-10 Thread Ulrich Hecht
Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
  usb: renesas_usbhs: add R-Car Gen. 2 init and power control
  ARM: shmobile: lager: remove USBHS callbacks

 arch/arm/mach-shmobile/board-lager.c | 126 ---
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 --
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c|  76 +
 drivers/usb/renesas_usbhs/rcar2.h|   4 ++
 include/linux/usb/renesas_usbhs.h|   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

-- 
1.8.4.5

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


[PATCH v2 1/2] usb: renesas_usbhs: add R-Car Gen. 2 init and power control

2014-07-10 Thread Ulrich Hecht
In preparation for DT conversion to reduce reliance on platform device
callbacks.

Signed-off-by: Ulrich Hecht ulrich.hecht+rene...@gmail.com
---
 drivers/usb/renesas_usbhs/Makefile |  2 +-
 drivers/usb/renesas_usbhs/common.c | 66 ++---
 drivers/usb/renesas_usbhs/common.h |  2 +
 drivers/usb/renesas_usbhs/rcar2.c  | 76 ++
 drivers/usb/renesas_usbhs/rcar2.h  |  4 ++
 include/linux/usb/renesas_usbhs.h  |  6 +++
 6 files changed, 150 insertions(+), 6 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

diff --git a/drivers/usb/renesas_usbhs/Makefile 
b/drivers/usb/renesas_usbhs/Makefile
index bc8aef4..9e47f47 100644
--- a/drivers/usb/renesas_usbhs/Makefile
+++ b/drivers/usb/renesas_usbhs/Makefile
@@ -4,7 +4,7 @@
 
 obj-$(CONFIG_USB_RENESAS_USBHS)+= renesas_usbhs.o
 
-renesas_usbhs-y:= common.o mod.o pipe.o fifo.o
+renesas_usbhs-y:= common.o mod.o pipe.o fifo.o rcar2.o
 
 ifneq ($(CONFIG_USB_RENESAS_USBHS_HCD),)
renesas_usbhs-y += mod_host.o
diff --git a/drivers/usb/renesas_usbhs/common.c 
b/drivers/usb/renesas_usbhs/common.c
index 17267b0..1b9bf8d 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -15,12 +15,14 @@
  *
  */
 #include linux/err.h
+#include linux/gpio.h
 #include linux/io.h
 #include linux/module.h
 #include linux/pm_runtime.h
 #include linux/slab.h
 #include linux/sysfs.h
 #include common.h
+#include rcar2.h
 
 /*
  * image of renesas_usbhs
@@ -284,6 +286,8 @@ static void usbhsc_set_buswait(struct usbhs_priv *priv)
 /*
  * platform default param
  */
+
+/* commonly used on old SH-Mobile SoCs */
 static u32 usbhsc_default_pipe_type[] = {
USB_ENDPOINT_XFER_CONTROL,
USB_ENDPOINT_XFER_ISOC,
@@ -297,6 +301,26 @@ static u32 usbhsc_default_pipe_type[] = {
USB_ENDPOINT_XFER_INT,
 };
 
+/* commonly used on newer SH-Mobile and R-Car SoCs */
+static u32 usbhsc_new_pipe_type[] = {
+   USB_ENDPOINT_XFER_CONTROL,
+   USB_ENDPOINT_XFER_ISOC,
+   USB_ENDPOINT_XFER_ISOC,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_INT,
+   USB_ENDPOINT_XFER_INT,
+   USB_ENDPOINT_XFER_INT,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+   USB_ENDPOINT_XFER_BULK,
+};
+
 /*
  * power control
  */
@@ -423,8 +447,7 @@ static int usbhs_probe(struct platform_device *pdev)
int ret;
 
/* check platform information */
-   if (!info ||
-   !info-platform_callback.get_id) {
+   if (!info) {
dev_err(pdev-dev, no platform information\n);
return -EINVAL;
}
@@ -451,13 +474,32 @@ static int usbhs_probe(struct platform_device *pdev)
/*
 * care platform info
 */
-   memcpy(priv-pfunc,
-  info-platform_callback,
-  sizeof(struct renesas_usbhs_platform_callback));
+
memcpy(priv-dparam,
   info-driver_param,
   sizeof(struct renesas_usbhs_driver_param));
 
+   switch (priv-dparam.type) {
+   case USBHS_TYPE_R8A7790:
+   case USBHS_TYPE_R8A7791:
+   priv-pfunc = usbhs_rcar2_ops;
+   if (!priv-dparam.pipe_type) {
+   priv-dparam.pipe_type = usbhsc_new_pipe_type;
+   priv-dparam.pipe_size =
+   ARRAY_SIZE(usbhsc_new_pipe_type);
+   }
+   break;
+   default:
+   if (!info-platform_callback.get_id) {
+   dev_err(pdev-dev, no platform callbacks);
+   return -EINVAL;
+   }
+   memcpy(priv-pfunc,
+  info-platform_callback,
+  sizeof(struct renesas_usbhs_platform_callback));
+   break;
+   }
+
/* set driver callback functions for platform */
dfunc   = info-driver_callback;
dfunc-notify_hotplug   = usbhsc_drvcllbck_notify_hotplug;
@@ -507,6 +549,20 @@ static int usbhs_probe(struct platform_device *pdev)
 */
usbhs_sys_clock_ctrl(priv, 0);
 
+   /* check GPIO determining if USB function should be enabled */
+   if (priv-dparam.enable_gpio) {
+   gpio_request_one(priv-dparam.enable_gpio, GPIOF_IN, NULL);
+   ret = !gpio_get_value(priv-dparam.enable_gpio);
+   gpio_free(priv-dparam.enable_gpio);
+   if (ret) {
+   

[PATCH v2 2/2] ARM: shmobile: lager: remove USBHS callbacks

2014-07-10 Thread Ulrich Hecht
Let the driver handle initialization and power control.

Signed-off-by: Ulrich Hecht ulrich.hecht+rene...@gmail.com
---
 arch/arm/mach-shmobile/board-lager.c | 126 ---
 1 file changed, 13 insertions(+), 113 deletions(-)

diff --git a/arch/arm/mach-shmobile/board-lager.c 
b/arch/arm/mach-shmobile/board-lager.c
index b8b2b44..c2a14c7 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -420,117 +420,17 @@ static const struct resource usbhs_resources[] 
__initconst = {
DEFINE_RES_IRQ(gic_spi(107)),
 };
 
-struct usbhs_private {
-   struct renesas_usbhs_platform_info info;
-   struct usb_phy *phy;
-};
-
-#define usbhs_get_priv(pdev) \
-   container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
-
-static int usbhs_power_ctrl(struct platform_device *pdev,
-   void __iomem *base, int enable)
-{
-   struct usbhs_private *priv = usbhs_get_priv(pdev);
-
-   if (!priv-phy)
-   return -ENODEV;
-
-   if (enable) {
-   int retval = usb_phy_init(priv-phy);
-
-   if (!retval)
-   retval = usb_phy_set_suspend(priv-phy, 0);
-   return retval;
-   }
-
-   usb_phy_set_suspend(priv-phy, 1);
-   usb_phy_shutdown(priv-phy);
-   return 0;
-}
-
-static int usbhs_hardware_init(struct platform_device *pdev)
-{
-   struct usbhs_private *priv = usbhs_get_priv(pdev);
-   struct usb_phy *phy;
-   int ret;
-
-   /* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5
-* setting to avoid VBUS short circuit due to wrong cable.
-* PWEN should be pulled up high if USB Function is selected by SW5
-*/
-   gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */
-   if (!gpio_get_value(RCAR_GP_PIN(5, 18))) {
-   pr_warn(Error: USB Function not selected - check SW5 + SW6\n);
-   ret = -ENOTSUPP;
-   goto error;
-   }
-
-   phy = usb_get_phy_dev(pdev-dev, 0);
-   if (IS_ERR(phy)) {
-   ret = PTR_ERR(phy);
-   goto error;
-   }
-
-   priv-phy = phy;
-   return 0;
- error:
-   gpio_free(RCAR_GP_PIN(5, 18));
-   return ret;
-}
-
-static int usbhs_hardware_exit(struct platform_device *pdev)
-{
-   struct usbhs_private *priv = usbhs_get_priv(pdev);
-
-   if (!priv-phy)
-   return 0;
-
-   usb_put_phy(priv-phy);
-   priv-phy = NULL;
-
-   gpio_free(RCAR_GP_PIN(5, 18));
-   return 0;
-}
-
-static int usbhs_get_id(struct platform_device *pdev)
-{
-   return USBHS_GADGET;
-}
-
-static u32 lager_usbhs_pipe_type[] = {
-   USB_ENDPOINT_XFER_CONTROL,
-   USB_ENDPOINT_XFER_ISOC,
-   USB_ENDPOINT_XFER_ISOC,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_INT,
-   USB_ENDPOINT_XFER_INT,
-   USB_ENDPOINT_XFER_INT,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-   USB_ENDPOINT_XFER_BULK,
-};
-
-static struct usbhs_private usbhs_priv __initdata = {
-   .info = {
-   .platform_callback = {
-   .power_ctrl = usbhs_power_ctrl,
-   .hardware_init  = usbhs_hardware_init,
-   .hardware_exit  = usbhs_hardware_exit,
-   .get_id = usbhs_get_id,
-   },
-   .driver_param = {
-   .buswait_bwait  = 4,
-   .pipe_type = lager_usbhs_pipe_type,
-   .pipe_size = ARRAY_SIZE(lager_usbhs_pipe_type),
-   },
-   }
+static struct renesas_usbhs_platform_info usbhs_info __initdata = {
+   .driver_param = {
+   .buswait_bwait  = 4,
+   .type = USBHS_TYPE_R8A7790,
+   /* USB0 Function - use PWEN as GPIO input to detect DIP
+* Switch SW5 setting to avoid VBUS short circuit due to
+* wrong cable.  PWEN should be pulled up high if USB
+* Function is selected by SW5.
+*/
+   .enable_gpio = RCAR_GP_PIN(5, 18),
+   },
 };
 
 static void __init lager_register_usbhs(void)
@@ -540,8 +440,8 @@ static void __init lager_register_usbhs(void)
  renesas_usbhs, -1,
  usbhs_resources,
  ARRAY_SIZE(usbhs_resources),
- usbhs_priv.info,
- sizeof(usbhs_priv.info));
+ usbhs_info,
+ sizeof(usbhs_info));
 }
 
 /* USBHS PHY */
-- 
1.8.4.5

--
To 

Re: [PATCH V4] USB: Add LVS Test device driver

2014-07-10 Thread Pratyush Anand
On Thu, Jul 10, 2014 at 06:40:43AM +0800, Greg KH wrote:
 On Thu, May 29, 2014 at 10:03:42AM +0530, Pratyush Anand wrote:
  OTG3 and EH Compliance Plan 1.0 talks about Super Speed OTG Verification
  system (SS-OVS) which consists of an excersizer and analyzer.
  
  USB Compliance Suite from Lecroy or Ellisys can act as such SS-OVS for
  Link Layer Validation (LVS).
  
  Some modifications are needed for an embedded Linux USB host to pass all
  these tests.  Most of these tests require just Link to be in U0. They do
  not work with default Linux USB stack since, default stack does port
  reset and then starts sending setup packet, which is not expected by
  Link Layer Validation (LVS) device of Lecroy Compliance Suit.  Then,
  There are many Link Layer Tests which need host to generate specific
  traffic.
  
  This patch supports specific traffic generation cases. As of now all the
  host Lecroy Link Layer-USBIF tests (except TD7.26) passes
  with this patch for single run using  Lecroy USB Compliance Suite
  Version 1.98 Build 239 and Lecroy USB Protocol Analyzer version 4.80
  Build 1603. Therefore patch seems to be a good candidate for inclusion.
  Further modification can be done on top of it.
  
  lvstest driver will not bind to any device by default. It can bind
  manually to a super speed USB host controller root hub. Therefore, regular
  hub driver must be unbound before this driver is bound. For example, if
  2-0:1.0 is the xhci root hub, then execute following to unbind hub driver.
  
   echo 2-0:1.0  /sys/bus/usb/drivers/hub/unbind
  
  Then write Linux Foundation's vendor ID which is used by root hubs and
  SS root hub's device ID into new_id file. Writing IDs into new_id file
  will also bind the lvs driver with any available SS root hub interfaces.
  
   echo 1D6B 3  /sys/bus/usb/drivers/lvs/new_id
  
  Now connect LVS device with root hub port.
  
  Test case specific traffic can be generated as follows whenever needed:
  
  1. To issue Get Device descriptor command for TD.7.06:
   echo   /sys/bus/usb/devices/2-0\:1.0/get_dev_desc
  
  2. To set U1 timeout to 127 for TD.7.18
   echo 127  /sys/bus/usb/devices/2-0\:1.0/u1_timeout
  
  3. To set U2 timeout to 0 for TD.7.18
   echo 0  /sys/bus/usb/devices/2-0\:1.0/u2_timeout
  
  4. To issue Hot Reset for TD.7.29
   echo   /sys/bus/usb/devices/2-0\:1.0/hot_reset
  
  5. To issue U3 Entry for TD.7.35
   echo   /sys/bus/usb/devices/2-0\:1.0/u3_entry
  
  6. To issue U3 Exit for TD.7.36
   echo   /sys/bus/usb/devices/2-0\:1.0/u3_exit
  
  Signed-off-by: Pratyush Anand pratyush.an...@st.com
  Acked-by: Alan Stern st...@rowland.harvard.edu
 
 I get the following build error with this driver enabled:
 
 ERROR: usb_alloc_dev [drivers/usb/misc/lvstest.ko] undefined!
 scripts/Makefile.modpost:90: recipe for target '__modpost' failed
 

I always complied it statically and I could not catch it :(

Will send a patch to add EXPORT_SYMBOL_GPL(usb_alloc_dev);

 Please be more careful when sending patches in...

Sure.

~Pratyush

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


Re: [PATCH v2 0/2] ARM: shmobile: lager: USBHS callback elimination

2014-07-10 Thread Kuninori Morimoto

Hi

 Changes in v2:
 - move phy handle to struct usbhs_priv
 - add new default pipe type to driver
 - remove pipe type from Lager board code
 
 Ulrich Hecht (2):
   usb: renesas_usbhs: add R-Car Gen. 2 init and power control
   ARM: shmobile: lager: remove USBHS callbacks
 
  arch/arm/mach-shmobile/board-lager.c | 126 
 ---
  drivers/usb/renesas_usbhs/Makefile   |   2 +-
  drivers/usb/renesas_usbhs/common.c   |  66 --
  drivers/usb/renesas_usbhs/common.h   |   2 +
  drivers/usb/renesas_usbhs/rcar2.c|  76 +
  drivers/usb/renesas_usbhs/rcar2.h|   4 ++
  include/linux/usb/renesas_usbhs.h|   6 ++
  7 files changed, 163 insertions(+), 119 deletions(-)
  create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
  create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

Acked-by: Kuninori Morimoto kuninori.morimoto...@renesas.com

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


[PATCHv2] usb: gadget: composite: Provide a list of available functions

2014-07-10 Thread Andrzej Pietrasiewicz
When gadgets are composed with configfs the user must know what are the
available function names. The names are parts of usb_f_*.ko
modules' aliases. If a function is compiled as a module, the information
can be found in modules.alias file. But if a function is compiled-in,
there is no way to know the function's name.

This patch adds a sysfs attribute in libcomposite's sys directory to
show functions which are already registered. Functions which are
compiled-in will be in this list as well.

Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
---
This time there should be no obvious mistakes: potential
buffer overrun is checked and THIS_MODULE is not dereferenced at all.
Tested with libcomposite compiled-in and modular.

v1..v2:
- changed the location in sysfs: usb_gadget class is added

 drivers/usb/gadget/configfs.c  | 25 +
 drivers/usb/gadget/functions.c | 25 +
 drivers/usb/gadget/u_f.h   |  2 ++
 3 files changed, 52 insertions(+)

diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
index bcc2a62..358242a 100644
--- a/drivers/usb/gadget/configfs.c
+++ b/drivers/usb/gadget/configfs.c
@@ -1553,13 +1553,37 @@ void unregister_gadget_item(struct config_item *item)
 }
 EXPORT_SYMBOL_GPL(unregister_gadget_item);
 
+static ssize_t gadget_func_list_show(struct class *c,
+struct class_attribute *a, char *buf)
+{
+   return usb_function_list_functions(buf, PAGE_SIZE);
+}
+
+static struct class_attribute usb_gadget_attrs[] = {
+   __ATTR(func_list, S_IRUGO, gadget_func_list_show, NULL),
+   __ATTR_NULL,
+};
+
+static struct class usb_gadget_class = {
+   .name   = usb_gadget,
+   .owner  = THIS_MODULE,
+   .class_attrs= usb_gadget_attrs,
+};
+
 static int __init gadget_cfs_init(void)
 {
int ret;
 
config_group_init(gadget_subsys.su_group);
 
+   ret = class_register(usb_gadget_class);
+   if (ret)
+   return ret;
+
ret = configfs_register_subsystem(gadget_subsys);
+   if (ret)
+   class_unregister(usb_gadget_class);
+
return ret;
 }
 module_init(gadget_cfs_init);
@@ -1567,5 +1591,6 @@ module_init(gadget_cfs_init);
 static void __exit gadget_cfs_exit(void)
 {
configfs_unregister_subsystem(gadget_subsys);
+   class_unregister(usb_gadget_class);
 }
 module_exit(gadget_cfs_exit);
diff --git a/drivers/usb/gadget/functions.c b/drivers/usb/gadget/functions.c
index b13f839..fc43c1c 100644
--- a/drivers/usb/gadget/functions.c
+++ b/drivers/usb/gadget/functions.c
@@ -114,3 +114,28 @@ void usb_function_unregister(struct usb_function_driver 
*fd)
mutex_unlock(func_lock);
 }
 EXPORT_SYMBOL_GPL(usb_function_unregister);
+
+/*
+ * Returns number of characters written excluding the terminating '\0',
+ * if written.
+ */
+size_t usb_function_list_functions(char *buf, size_t len)
+{
+   struct usb_function_driver *fd;
+   char *_buf = buf;
+   size_t n;
+
+   mutex_lock(func_lock);
+   list_for_each_entry(fd, func_list, list) {
+   n = snprintf(_buf, len, %s\n, fd-name);
+   if (n = len) {
+   mutex_unlock(func_lock);
+   return -ENOMEM;
+   }
+   _buf += n;
+   len -= n;
+   }
+   mutex_unlock(func_lock);
+
+   return _buf - buf;
+}
diff --git a/drivers/usb/gadget/u_f.h b/drivers/usb/gadget/u_f.h
index 1d5f0eb..f1a8dff 100644
--- a/drivers/usb/gadget/u_f.h
+++ b/drivers/usb/gadget/u_f.h
@@ -47,6 +47,8 @@ struct usb_request;
 
 struct usb_request *alloc_ep_req(struct usb_ep *ep, int len, int default_len);
 
+size_t usb_function_list_functions(char *buf, size_t len);
+
 #endif /* __U_F_H__ */
 
 
-- 
1.8.3.2

--
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 v1 6/9] usb: xhci: Add NVIDIA Tegra XHCI host-controller driver

2014-07-10 Thread Arnd Bergmann
On Wednesday 09 July 2014, Alan Stern wrote:
 On Tue, 8 Jul 2014, Andrew Bresticker wrote:
 
   I think at the very least you should add a function
   xhci_default_driver(struct hc_driver *driver) to xhci-plat.c (or
   even better to xhci.c and use it for PCI as well) that initializes all
   function pointers to the default (internal) symbols, and can then be
   overridden afterwards.
  
  Currently all XHCI host drivers (PCI, platform, MVEBU) will be built
  into the xhci-hcd module.  I could append the Tegra driver to that
  module or introduce a xhci_init_driver() like EHCI does as Julius
  suggests.  USB folks, do you have a preference?
 
 As the EHCI maintainer, I naturally approve of Julius's suggestion.  

I'm not a USB maintainer, but I also agree that's the best way forward,
since it's similar to what all other similar drivers in the kernel do.

Arnd
--
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] usb: usb5303: make use of uninitialized err variable

2014-07-10 Thread Emil Goode
Hello Greg and Geert,

On Thu, Jul 10, 2014 at 09:38:00AM +0200, Geert Uytterhoeven wrote:
 Hi Greg,
 
 On Thu, Jul 10, 2014 at 12:46 AM, Greg Kroah-Hartman
 gre...@linuxfoundation.org wrote:
  On Mon, Jun 02, 2014 at 07:45:25PM +0200, Emil Goode wrote:
  The variable err is not initialized here, this patch uses it
  to store an eventual error value from devm_clk_get().
 
  Signed-off-by: Emil Goode emilgo...@gmail.com
  Acked-by: Geert Uytterhoeven ge...@linux-m68k.org
  ---
   drivers/usb/misc/usb3503.c |   10 +++---
   1 file changed, 7 insertions(+), 3 deletions(-)
 
  This patch fails to apply to my tree :(
 
 You've already applied
 commit ec5734c41bee2ee7c938a8f34853d31cada7e67a
 Author: Tushar Behera tusha...@samsung.com
 Date:   Tue Jun 17 16:38:50 2014 +0530
 
 usb: misc: usb3503: Update error code in print message
 
 'err' is uninitialized, rather print the error code directly.
 
 which fixes it slightly different.

Yes, my patch was sent about two weeks earlier, but of course please pick
the one you think is best.

Best regards,

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


xhci error: Transfer event TRB DMA ptr not part of current TD

2014-07-10 Thread Hans de Goede
Hi Sarah, Matthias, et al,

I've been running a full Linux distro from an uas enclosure with a ssd
for testing purposes (mostly for testing the distro on different
hardware but also for uas testing).

While testing this on a Thinkpad T440s I noticed the error
from $subject happening exactly once in the log. This always happens
when initializing the uas disk enclosure with the ssd. This happens
with both 3.15 and 3.16-rc4.

I've run a battery of tests to try and pin this down, here is the
test matrix:

 T440s (Ivy Bridge)   E6430 (Sandy Bridge)  Desktop 
(NEC)
Renesas uPD720231 + ssd:  FAIL (*) OKOK (**)
ASM1053E + hdd :  OK   OKOK (**)
ASM1053E + ssd :  OK   OKOK (**)

*) Putting an USB-3 hub in between makes no difference
**) Tested with an USB-3 hub in between

Where FAIL means that the error shows up.

The 2 enclosures tested with are:
Renesas uPD720231: 
http://www.amazon.com/SEDNA-SE-EH-322-U-External-Enclosure-Support/dp/B00E0MLIVE
ASM1053E: http://plugable.com/products/usb3-sata-uasp1

The 3 xhci controllers tested with are:

T440s (Ivy Bridge):
00:14.0 USB controller [0c03]: Intel Corporation 8 Series USB xHCI HC 
[8086:9c31] (rev 04)

E6430 (Sandy Bridge):
00:14.0 USB controller [0c03]: Intel Corporation 7 Series/C210 Series Chipset 
Family USB xHCI Host Controller [8086:1e31] (rev 04)

Desktop (NEC):
01:00.0 USB controller [0c03]: NEC Corporation uPD720200 USB 3.0 Host 
Controller [1033:0194] (rev 04)

So this seems to only happen (and even then only once on init) when
pairing a Renesas uPD720231 with an Ivy Bridge chipset xHCI controller.

For completeness sake, the ssd used in both cases was: a 120G Crucial M500,
model string: Crucial_ CT120M500SSD1 .

If you want me to build a kernel with a patch added to add some extra
debugging around the problem area to pin this down, send me such a
patch and I'll happily run some tests with it.

Regards,

Hans


p.s.

While doing all this testing I've also found a regression with 3.16 and the
Renesas uPD720231, which I'm bisecting now, so more on that later.

I can work around the regression by limiting the max amount of streams
(and thus outstanding requests) to 16. Which means the regression might not
be specific to the uPD720231, as the ASM1053E only supports 16 streams to
begin with.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] USB: serial: ftdi_sio: Add Infineon Triboard

2014-07-10 Thread Michal Sojka
This adds support for Infineon TriBoard TC1798 [1]. Only interface 1
is used as serial line (see [2], Figure 8-6).

[1] 
http://www.infineon.com/cms/de/product/microcontroller/development-tools-software-and-kits/tricore-tm-development-tools-software-and-kits/starterkits-and-evaluation-boards/starter-kit-tc1798/channel.html?channel=db3a304333b8a7ca0133cfa3d73e4268
[2] 
http://www.infineon.com/dgdl/TriBoardManual-TC1798-V10.pdf?folderId=db3a304412b407950112b409ae7c0343fileId=db3a304333b8a7ca0133cfae99fe426a

Signed-off-by: Michal Sojka sojk...@fel.cvut.cz
---
 drivers/usb/serial/ftdi_sio.c | 2 ++
 drivers/usb/serial/ftdi_sio_ids.h | 6 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 115662c1..0c2b6e0 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -944,6 +944,8 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_2_PID) },
{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_3_PID) },
{ USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_842_4_PID) },
+   /* Infineon Devices */
+   { USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
{ } /* Terminating entry */
 };
 
diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
index 500474c..8d959a7 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -584,6 +584,12 @@
 #define RATOC_PRODUCT_ID_USB60F0xb020
 
 /*
+ * Infineon Technologies
+ */
+#define INFINEON_VID   0x058b
+#define INFINEON_TRIBOARD_PID  0x0028 /* DAS JTAG TriBoard TC1798 V1.0 */
+
+/*
  * Acton Research Corp.
  */
 #define ACTON_VID  0x0647  /* Vendor ID */
-- 
2.0.0

--
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 3/3] MAINTAINERS: Add dwc3-st.c file to ARCH/STI architecture

2014-07-10 Thread Felipe Balbi
On Tue, Jul 08, 2014 at 08:53:32AM +0100, Lee Jones wrote:
 On Tue, 08 Jul 2014, Maxime Coquelin wrote:
  On 07/05/2014 08:25 AM, Peter Griffin wrote:
  Signed-off-by: Peter Griffin peter.grif...@linaro.org
  
  Acked-by: Maxime Coquelin maxime.coque...@st.com
 
 Maxime,
   Once Acked by Felipe, I think this should go in via your tree to
 avoid conflicts with other ARM/STI ARCHITECTURE additions.

there are still many unresolved comments on patches 1 and 2.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCHv2] usb: gadget: composite: Provide a list of available functions

2014-07-10 Thread Felipe Balbi
On Thu, Jul 10, 2014 at 12:30:59PM +0200, Andrzej Pietrasiewicz wrote:
 When gadgets are composed with configfs the user must know what are the
 available function names. The names are parts of usb_f_*.ko
 modules' aliases. If a function is compiled as a module, the information
 can be found in modules.alias file. But if a function is compiled-in,
 there is no way to know the function's name.
 
 This patch adds a sysfs attribute in libcomposite's sys directory to
 show functions which are already registered. Functions which are
 compiled-in will be in this list as well.
 
 Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com
 ---
 This time there should be no obvious mistakes: potential
 buffer overrun is checked and THIS_MODULE is not dereferenced at all.
 Tested with libcomposite compiled-in and modular.
 
 v1..v2:
 - changed the location in sysfs: usb_gadget class is added
 
  drivers/usb/gadget/configfs.c  | 25 +
  drivers/usb/gadget/functions.c | 25 +
  drivers/usb/gadget/u_f.h   |  2 ++
  3 files changed, 52 insertions(+)
 
 diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c
 index bcc2a62..358242a 100644
 --- a/drivers/usb/gadget/configfs.c
 +++ b/drivers/usb/gadget/configfs.c
 @@ -1553,13 +1553,37 @@ void unregister_gadget_item(struct config_item *item)
  }
  EXPORT_SYMBOL_GPL(unregister_gadget_item);
  
 +static ssize_t gadget_func_list_show(struct class *c,
 +  struct class_attribute *a, char *buf)
 +{
 + return usb_function_list_functions(buf, PAGE_SIZE);
 +}
 +
 +static struct class_attribute usb_gadget_attrs[] = {
 + __ATTR(func_list, S_IRUGO, gadget_func_list_show, NULL),
 + __ATTR_NULL,
 +};
 +
 +static struct class usb_gadget_class = {

another class ? Please don't, we already have the udc class, we could
find a way to just use that instead.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 1/4] usb: move the OTG state from the USB PHY to the OTG structure

2014-07-10 Thread Felipe Balbi
On Wed, Jul 09, 2014 at 12:17:13PM +0200, Antoine Ténart wrote:
 Before using the PHY framework instead of the USB PHY one, we need to
 move the OTG state into another place, since it won't be available when
 USB PHY isn't used. This patch moves the OTG state into the OTG
 structure, and makes all the needed modifications in the drivers
 using the OTG state.
 
 Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com

This looks good to me. I'm interested in what will be the best way to
merge this series :-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 3/3] MAINTAINERS: Add dwc3-st.c file to ARCH/STI architecture

2014-07-10 Thread Lee Jones
On Thu, 10 Jul 2014, Felipe Balbi wrote:

 On Tue, Jul 08, 2014 at 08:53:32AM +0100, Lee Jones wrote:
  On Tue, 08 Jul 2014, Maxime Coquelin wrote:
   On 07/05/2014 08:25 AM, Peter Griffin wrote:
   Signed-off-by: Peter Griffin peter.grif...@linaro.org
   
   Acked-by: Maxime Coquelin maxime.coque...@st.com
  
  Maxime,
Once Acked by Felipe, I think this should go in via your tree to
  avoid conflicts with other ARM/STI ARCHITECTURE additions.
 
 there are still many unresolved comments on patches 1 and 2.

Once Acked ;)

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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 4/4] usb: chipidea: add support to the PHY framework for ChipIdea

2014-07-10 Thread Felipe Balbi
On Wed, Jul 09, 2014 at 12:17:16PM +0200, Antoine Ténart wrote:
 This patch adds the support to the PHY framework for ChipIdea drivers
 while keeping the USB PHY compatibility. Changes are done in both the
 ChipIdea common code and in the drivers accessing the PHY. This is done
 by renaming 'phy' into 'usb_phy' and adding a new 'phy' member into the
 ci_hdrc structre.
 
 Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com
 ---
  drivers/usb/chipidea/ci.h  |  4 ++-
  drivers/usb/chipidea/ci_hdrc_imx.c |  2 +-
  drivers/usb/chipidea/ci_hdrc_msm.c |  6 ++--
  drivers/usb/chipidea/core.c| 67 
 +++---
  drivers/usb/chipidea/debug.c   |  4 ++-
  drivers/usb/chipidea/host.c| 17 ++
  drivers/usb/chipidea/otg_fsm.c |  6 ++--
  drivers/usb/chipidea/udc.c |  4 +--
  include/linux/usb/chipidea.h   |  4 ++-
  9 files changed, 86 insertions(+), 28 deletions(-)
 
 diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
 index 9563cb56d564..139589c8ab90 100644
 --- a/drivers/usb/chipidea/ci.h
 +++ b/drivers/usb/chipidea/ci.h
 @@ -201,7 +201,9 @@ struct ci_hdrc {
  
   struct ci_hdrc_platform_data*platdata;
   int vbus_active;
 - struct usb_phy  *transceiver;
 + struct phy  *transceiver;
 + /* old usb_phy interface */
 + struct usb_phy  *usb_transceiver;

while at that, do you mind calling all struct usb_phy pointers
'usb_phy' ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 2/4] usb: add support to the PHY framework for OTG

2014-07-10 Thread Felipe Balbi
Hi,

On Wed, Jul 09, 2014 at 12:17:14PM +0200, Antoine Ténart wrote:
 This patch adds the support to PHY framework in OTG code, and keeps the
 USB PHY compatibility. This is done in two steps: renaming 'phy' into
 'usb_phy' and adding a new 'phy' member into the usb_otg structure.
 These modifications are done in all drivers accessing the OTG PHY.
 
 Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com

looks good to me

 ---
  drivers/phy/phy-omap-usb2.c |  6 ++--
  drivers/usb/chipidea/otg_fsm.c  |  2 +-
  drivers/usb/phy/phy-ab8500-usb.c|  6 ++--
  drivers/usb/phy/phy-fsl-usb.c   | 12 
  drivers/usb/phy/phy-generic.c   |  2 +-
  drivers/usb/phy/phy-gpio-vbus-usb.c |  2 +-
  drivers/usb/phy/phy-isp1301-omap.c  | 10 +++
  drivers/usb/phy/phy-msm-usb.c   | 59 
 +++--
  drivers/usb/phy/phy-mv-usb.c|  4 +--
  drivers/usb/phy/phy-samsung-usb2.c  |  2 +-
  drivers/usb/phy/phy-tahvo.c |  8 +++--
  drivers/usb/phy/phy-ulpi.c  |  6 ++--
  include/linux/usb/otg.h |  5 +++-
  13 files changed, 65 insertions(+), 59 deletions(-)
 
 diff --git a/drivers/phy/phy-omap-usb2.c b/drivers/phy/phy-omap-usb2.c
 index 1f444f91ed7d..13d3e36e208b 100644
 --- a/drivers/phy/phy-omap-usb2.c
 +++ b/drivers/phy/phy-omap-usb2.c
 @@ -60,7 +60,7 @@ EXPORT_SYMBOL_GPL(omap_usb2_set_comparator);
  
  static int omap_usb_set_vbus(struct usb_otg *otg, bool enabled)
  {
 - struct omap_usb *phy = phy_to_omapusb(otg-phy);
 + struct omap_usb *phy = phy_to_omapusb(otg-usb_phy);
  
   if (!phy-comparator)
   return -ENODEV;
 @@ -70,7 +70,7 @@ static int omap_usb_set_vbus(struct usb_otg *otg, bool 
 enabled)
  
  static int omap_usb_start_srp(struct usb_otg *otg)
  {
 - struct omap_usb *phy = phy_to_omapusb(otg-phy);
 + struct omap_usb *phy = phy_to_omapusb(otg-usb_phy);
  
   if (!phy-comparator)
   return -ENODEV;
 @@ -255,7 +255,7 @@ static int omap_usb2_probe(struct platform_device *pdev)
   otg-set_vbus   = omap_usb_set_vbus;
   if (phy_data-flags  OMAP_USB2_HAS_START_SRP)
   otg-start_srp  = omap_usb_start_srp;
 - otg-phy= phy-phy;
 + otg-usb_phy= phy-phy;
  
   platform_set_drvdata(pdev, phy);
   pm_runtime_enable(phy-dev);
 diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
 index 8cb2508a6b71..d8490e758a74 100644
 --- a/drivers/usb/chipidea/otg_fsm.c
 +++ b/drivers/usb/chipidea/otg_fsm.c
 @@ -788,7 +788,7 @@ int ci_hdrc_otg_fsm_init(struct ci_hdrc *ci)
   return -ENOMEM;
   }
  
 - otg-phy = ci-transceiver;
 + otg-usb_phy = ci-transceiver;
   otg-gadget = ci-gadget;
   ci-fsm.otg = otg;
   ci-transceiver-otg = ci-fsm.otg;
 diff --git a/drivers/usb/phy/phy-ab8500-usb.c 
 b/drivers/usb/phy/phy-ab8500-usb.c
 index 2d5250143ce1..3a802fa7dae2 100644
 --- a/drivers/usb/phy/phy-ab8500-usb.c
 +++ b/drivers/usb/phy/phy-ab8500-usb.c
 @@ -1056,7 +1056,7 @@ static int ab8500_usb_set_peripheral(struct usb_otg 
 *otg,
   if (!otg)
   return -ENODEV;
  
 - ab = phy_to_ab(otg-phy);
 + ab = phy_to_ab(otg-usb_phy);
  
   ab-phy.otg-gadget = gadget;
  
 @@ -1080,7 +1080,7 @@ static int ab8500_usb_set_host(struct usb_otg *otg, 
 struct usb_bus *host)
   if (!otg)
   return -ENODEV;
  
 - ab = phy_to_ab(otg-phy);
 + ab = phy_to_ab(otg-usb_phy);
  
   ab-phy.otg-host = host;
  
 @@ -1382,7 +1382,7 @@ static int ab8500_usb_probe(struct platform_device 
 *pdev)
   ab-phy.set_power   = ab8500_usb_set_power;
   ab-phy.otg-state  = OTG_STATE_UNDEFINED;
  
 - otg-phy= ab-phy;
 + otg-usb_phy= ab-phy;
   otg-set_host   = ab8500_usb_set_host;
   otg-set_peripheral = ab8500_usb_set_peripheral;
  
 diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c
 index a22f88fb8176..548bbc4a89d9 100644
 --- a/drivers/usb/phy/phy-fsl-usb.c
 +++ b/drivers/usb/phy/phy-fsl-usb.c
 @@ -499,7 +499,7 @@ int fsl_otg_start_host(struct otg_fsm *fsm, int on)
  {
   struct usb_otg *otg = fsm-otg;
   struct device *dev;
 - struct fsl_otg *otg_dev = container_of(otg-phy, struct fsl_otg, phy);
 + struct fsl_otg *otg_dev = container_of(otg-usb_phy, struct fsl_otg, 
 phy);
   u32 retval = 0;
  
   if (!otg-host)
 @@ -594,7 +594,7 @@ static int fsl_otg_set_host(struct usb_otg *otg, struct 
 usb_bus *host)
   if (!otg)
   return -ENODEV;
  
 - otg_dev = container_of(otg-phy, struct fsl_otg, phy);
 + otg_dev = container_of(otg-usb_phy, struct fsl_otg, phy);
   if (otg_dev != fsl_otg_dev)
   return -ENODEV;
  
 @@ -644,7 +644,7 @@ static int fsl_otg_set_peripheral(struct usb_otg *otg,
   if (!otg)
   return -ENODEV;
  
 - otg_dev = container_of(otg-phy, struct 

Re: [PATCH 1/4] usb: move the OTG state from the USB PHY to the OTG structure

2014-07-10 Thread Antoine Ténart
Hi Felipe,

On Thu, Jul 10, 2014 at 08:40:23AM -0500, Felipe Balbi wrote:
 On Wed, Jul 09, 2014 at 12:17:13PM +0200, Antoine Ténart wrote:
  Before using the PHY framework instead of the USB PHY one, we need to
  move the OTG state into another place, since it won't be available when
  USB PHY isn't used. This patch moves the OTG state into the OTG
  structure, and makes all the needed modifications in the drivers
  using the OTG state.
  
  Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com
 
 This looks good to me. I'm interested in what will be the best way to
 merge this series :-)

I was asking myself the same question :) If splits or squashes are needed
please ask. At least, I'll split the s/phy/usb_phy/ and the generic PHY
addition in two patches as Alan asked.

Antoine


-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
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 4/4] USB: PHY: tegra: Call tegra_usb_phy_close only on device removal

2014-07-10 Thread Felipe Balbi
Hi,

On Fri, Jul 04, 2014 at 04:09:39AM +0300, Tuomas Tynkkynen wrote:
 tegra_usb_phy_close() is supposed to undo the effects of
 tegra_usb_phy_init(). It is also currently added as the USB PHY shutdown
 callback, which is wrong, since tegra_usb_phy_init() is only called

you could just make tegra_usb_phy_init() be called as u_phy-init().
That way you even delay enabling clocks and regulators to the point
where they are more likely to be needed. Also, if EHCI is never loaded,
you won't power up the PHY for no reason.

 during probing wheras the shutdown callback can get called multiple
 times. This then leads to warnings about unbalanced regulator_disable if
 the EHCI driver is unbound and bound again at runtime.
 
 Signed-off-by: Tuomas Tynkkynen ttynkky...@nvidia.com

I suppose this has no dependencies with the rest of the series ?

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 4/4] usb: chipidea: add support to the PHY framework for ChipIdea

2014-07-10 Thread Antoine Ténart
On Thu, Jul 10, 2014 at 08:42:27AM -0500, Felipe Balbi wrote:
 On Wed, Jul 09, 2014 at 12:17:16PM +0200, Antoine Ténart wrote:
  This patch adds the support to the PHY framework for ChipIdea drivers
  while keeping the USB PHY compatibility. Changes are done in both the
  ChipIdea common code and in the drivers accessing the PHY. This is done
  by renaming 'phy' into 'usb_phy' and adding a new 'phy' member into the
  ci_hdrc structre.
  
  Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com
  ---
   drivers/usb/chipidea/ci.h  |  4 ++-
   drivers/usb/chipidea/ci_hdrc_imx.c |  2 +-
   drivers/usb/chipidea/ci_hdrc_msm.c |  6 ++--
   drivers/usb/chipidea/core.c| 67 
  +++---
   drivers/usb/chipidea/debug.c   |  4 ++-
   drivers/usb/chipidea/host.c| 17 ++
   drivers/usb/chipidea/otg_fsm.c |  6 ++--
   drivers/usb/chipidea/udc.c |  4 +--
   include/linux/usb/chipidea.h   |  4 ++-
   9 files changed, 86 insertions(+), 28 deletions(-)
  
  diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
  index 9563cb56d564..139589c8ab90 100644
  --- a/drivers/usb/chipidea/ci.h
  +++ b/drivers/usb/chipidea/ci.h
  @@ -201,7 +201,9 @@ struct ci_hdrc {
   
  struct ci_hdrc_platform_data*platdata;
  int vbus_active;
  -   struct usb_phy  *transceiver;
  +   struct phy  *transceiver;
  +   /* old usb_phy interface */
  +   struct usb_phy  *usb_transceiver;
 
 while at that, do you mind calling all struct usb_phy pointers
 'usb_phy' ?

Not at all.
With s/usb_transceiver/usb_phy/, what about 'transceiver'?


Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
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 4/4] usb: chipidea: add support to the PHY framework for ChipIdea

2014-07-10 Thread Felipe Balbi
On Thu, Jul 10, 2014 at 03:51:24PM +0200, Antoine Ténart wrote:
 On Thu, Jul 10, 2014 at 08:42:27AM -0500, Felipe Balbi wrote:
  On Wed, Jul 09, 2014 at 12:17:16PM +0200, Antoine Ténart wrote:
   This patch adds the support to the PHY framework for ChipIdea drivers
   while keeping the USB PHY compatibility. Changes are done in both the
   ChipIdea common code and in the drivers accessing the PHY. This is done
   by renaming 'phy' into 'usb_phy' and adding a new 'phy' member into the
   ci_hdrc structre.
   
   Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com
   ---
drivers/usb/chipidea/ci.h  |  4 ++-
drivers/usb/chipidea/ci_hdrc_imx.c |  2 +-
drivers/usb/chipidea/ci_hdrc_msm.c |  6 ++--
drivers/usb/chipidea/core.c| 67 
   +++---
drivers/usb/chipidea/debug.c   |  4 ++-
drivers/usb/chipidea/host.c| 17 ++
drivers/usb/chipidea/otg_fsm.c |  6 ++--
drivers/usb/chipidea/udc.c |  4 +--
include/linux/usb/chipidea.h   |  4 ++-
9 files changed, 86 insertions(+), 28 deletions(-)
   
   diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
   index 9563cb56d564..139589c8ab90 100644
   --- a/drivers/usb/chipidea/ci.h
   +++ b/drivers/usb/chipidea/ci.h
   @@ -201,7 +201,9 @@ struct ci_hdrc {

 struct ci_hdrc_platform_data*platdata;
 int vbus_active;
   - struct usb_phy  *transceiver;
   + struct phy  *transceiver;
   + /* old usb_phy interface */
   + struct usb_phy  *usb_transceiver;
  
  while at that, do you mind calling all struct usb_phy pointers
  'usb_phy' ?
 
 Not at all.
 With s/usb_transceiver/usb_phy/, what about 'transceiver'?

perhaps call it phy ? That way all drivers have similar naming scheme.
Plus, I rather type 3 letters than 11 :-p

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 4/4] usb: chipidea: add support to the PHY framework for ChipIdea

2014-07-10 Thread Antoine Ténart
On Thu, Jul 10, 2014 at 08:56:00AM -0500, Felipe Balbi wrote:
 On Thu, Jul 10, 2014 at 03:51:24PM +0200, Antoine Ténart wrote:
  On Thu, Jul 10, 2014 at 08:42:27AM -0500, Felipe Balbi wrote:
   On Wed, Jul 09, 2014 at 12:17:16PM +0200, Antoine Ténart wrote:
This patch adds the support to the PHY framework for ChipIdea drivers
while keeping the USB PHY compatibility. Changes are done in both the
ChipIdea common code and in the drivers accessing the PHY. This is done
by renaming 'phy' into 'usb_phy' and adding a new 'phy' member into the
ci_hdrc structre.

Signed-off-by: Antoine Ténart antoine.ten...@free-electrons.com
---
 drivers/usb/chipidea/ci.h  |  4 ++-
 drivers/usb/chipidea/ci_hdrc_imx.c |  2 +-
 drivers/usb/chipidea/ci_hdrc_msm.c |  6 ++--
 drivers/usb/chipidea/core.c| 67 
+++---
 drivers/usb/chipidea/debug.c   |  4 ++-
 drivers/usb/chipidea/host.c| 17 ++
 drivers/usb/chipidea/otg_fsm.c |  6 ++--
 drivers/usb/chipidea/udc.c |  4 +--
 include/linux/usb/chipidea.h   |  4 ++-
 9 files changed, 86 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 9563cb56d564..139589c8ab90 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -201,7 +201,9 @@ struct ci_hdrc {
 
struct ci_hdrc_platform_data*platdata;
int vbus_active;
-   struct usb_phy  *transceiver;
+   struct phy  *transceiver;
+   /* old usb_phy interface */
+   struct usb_phy  *usb_transceiver;
   
   while at that, do you mind calling all struct usb_phy pointers
   'usb_phy' ?
  
  Not at all.
  With s/usb_transceiver/usb_phy/, what about 'transceiver'?
 
 perhaps call it phy ? That way all drivers have similar naming scheme.
 Plus, I rather type 3 letters than 11 :-p

I'll update then :)


-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
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 4/4] USB: PHY: tegra: Call tegra_usb_phy_close only on device removal

2014-07-10 Thread Tuomas Tynkkynen


On 10/07/14 16:48, Felipe Balbi wrote:

* PGP Signed by an unknown key

Hi,

On Fri, Jul 04, 2014 at 04:09:39AM +0300, Tuomas Tynkkynen wrote:

tegra_usb_phy_close() is supposed to undo the effects of
tegra_usb_phy_init(). It is also currently added as the USB PHY shutdown
callback, which is wrong, since tegra_usb_phy_init() is only called


you could just make tegra_usb_phy_init() be called as u_phy-init().


Apart from enabling pll_u and vbus, that function mostly fetches clocks 
etc. from the device tree and as such should preferably fail the probe() 
and not when the EHCI driver enables the PHY. (Renaming it would 
probably be a good idea.)



That way you even delay enabling clocks and regulators to the point
where they are more likely to be needed. Also, if EHCI is never loaded,
you won't power up the PHY for no reason.



That's true, but due to the above that'd be a bigger refactoring.


during probing wheras the shutdown callback can get called multiple
times. This then leads to warnings about unbalanced regulator_disable if
the EHCI driver is unbound and bound again at runtime.

Signed-off-by: Tuomas Tynkkynen ttynkky...@nvidia.com


I suppose this has no dependencies with the rest of the series ?



No. But Greg apparently applied these to his tree earlier today.

Thanks,
Tuomas.

--
nvpublic
--
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: [PATCHv2] usb: gadget: composite: Provide a list of available functions

2014-07-10 Thread Krzysztof Opasiak
 -Original Message-
 From: linux-usb-ow...@vger.kernel.org [mailto:linux-usb-
 ow...@vger.kernel.org] On Behalf Of Felipe Balbi
 Sent: Thursday, July 10, 2014 3:39 PM
 To: Andrzej Pietrasiewicz
 Cc: linux-usb@vger.kernel.org; Felipe Balbi; Greg Kroah-Hartman;
 Sebastian Andrzej Siewior; Marek Szyprowski
 Subject: Re: [PATCHv2] usb: gadget: composite: Provide a list of
 available functions

(...)

  +static ssize_t gadget_func_list_show(struct class *c,
  +struct class_attribute *a, char
*buf)
 {
  +   return usb_function_list_functions(buf, PAGE_SIZE); }
  +
  +static struct class_attribute usb_gadget_attrs[] = {
  +   __ATTR(func_list, S_IRUGO, gadget_func_list_show, NULL),
  +   __ATTR_NULL,
  +};
  +
  +static struct class usb_gadget_class = {
 
 another class ? Please don't, we already have the udc class, we
 could find a way to just use that instead.
 

Using udc clas is not a good idea. This may cause failures in userspace.
How would you like to tell that this is not really a udc? Only type of
file will be different than for the udcs (udcs are symlink and this
would be normal file or directory). But who knows how much scripts or
soft depends on assumption that /sys/class/udc contains only names of
udc available in system?

Libusbg is good example. When you pass NULL as udc name to
usbg_enable_gadget() method, it scandir() the /sys/class/udc and take
the first entry of this directory. If we add something what is not an
udc this library and potentially many other userspace apps behavior will
be changed and they may suddenly fail.

I know that this solution has some disadvantages but I don't see any
better one which wont destroy the userspace. Maybe you have some idea?
Please share it with us:) Please let me also recall v1 version of this
patch which has been changed because it fails when libcomposite is built
into kernel (it hasn't own directory in /sys/module so adding an
attribute causes NULL pointer dereference)

--
BR's
Krzysztof Opasiak


--
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 2/2] hso: fix deadlock when receiving bursts of data

2014-07-10 Thread Olivier Sobrie
Hi David,

On Tue, Jul 08, 2014 at 04:16:33PM -0700, David Miller wrote:
 From: Olivier Sobrie oliv...@sobrie.be
 Date: Mon,  7 Jul 2014 11:06:07 +0200
 
  When the module sends bursts of data, sometimes a deadlock happens in
  the hso driver when the tty buffer doesn't get the chance to be flushed
  quickly enough.
  
  To avoid this, first, we remove the endless while loop in
  put_rx_bufdata() which is the root cause of the deadlock.
  Secondly, when there is no room anymore in the tty buffer, we set up a
  timer of 100 msecs to give a chance to the upper layer to flush the tty
  buffer and make room for new data.
  
  Signed-off-by: Olivier Sobrie oliv...@sobrie.be
 
 I agree with the feedback you've been given in that adding a delay
 like this is really not a reasonable solution.
 
 Why is it so difficult to make the event which places the data there
 trigger to necessary calls to pull the data out of the URB transfer
 buffer?
 
 This should be totally and completely event based.

The function put_rxbuf_data() is called from the urb completion handler.
It puts the data of the urb transfer in the tty buffer with
tty_insert_flip_string_flags() and schedules a work queue in order to
push the data to the ldisc.
Problem is that we are in a urb completion handler so we can't wait
until there is room in the tty buffer.
An option I see is: If tty_insert_flip_string_flags() returns 0, start a
workqueue that will insert the remaining data in the tty buffer and then
restart the urb. But I'm not convinced that it is a good solution.
I should miss something...

In put_rxbuf_data(), when tty_insert_flip_string_flags() returns 0, would
it be correct to set the TTY_THROTTLED flag? I assume not...

I'll have a look in other drivers how such cases are handled.

Thanks,

-- 
Olivier
--
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 2/2] hso: fix deadlock when receiving bursts of data

2014-07-10 Thread David Laight
From: Olivier Sobrie
...
 The function put_rxbuf_data() is called from the urb completion handler.
 It puts the data of the urb transfer in the tty buffer with
 tty_insert_flip_string_flags() and schedules a work queue in order to
 push the data to the ldisc.
 Problem is that we are in a urb completion handler so we can't wait
 until there is room in the tty buffer.

Surely you can just keep the urb?
Resubmit it later when all the data has been transferred.

David



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


gadget/net2272.c:2075: possible bad test ?

2014-07-10 Thread David Binderman
Hello there,

[linux-3.16-rc4/drivers/usb/gadget/net2272.c:2075]: (style) Boolean result is 
used in bitwise operation. Clarify expression with parentheses.

if (!intcsr  (1  NET2272_PCI_IRQ)) {

Maybe the programmer intended

if (!(intcsr  (1  NET2272_PCI_IRQ))) {

Regards

David Binderman


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



host/ohci-tmio.c:104: possible novice coding error ?

2014-07-10 Thread David Binderman
Hello there,

[linux-3.16-rc4/drivers/usb/host/ohci-tmio.c:104]: (warning) Redundant bitwise 
operation on 'pm' in 'switch' statement. 'break;' missing?

switch (ohci-num_ports) {
default:
dev_err(dev-dev, Unsupported amount of ports: %d\n, 
ohci-num_ports);
case 3:
pm |= CCR_PM_USBPW3;
case 2:
pm |= CCR_PM_USBPW2;
case 1:
pm |= CCR_PM_USBPW1;
}

Suggest add missing breaks.

Regards

David Binderman


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


Re: [PATCH v2 2/4] ARM: tegra: Add resets has-utmi-pad-registers flag to all USB PHYs

2014-07-10 Thread Tuomas Tynkkynen

Thierry,

Since Stephen's on a vacation, I'd like to double-check with you that 
the DT changes looks good. Greg has applied these to the USB tree today.


Thanks,
Tuomas

On 04/07/14 04:09, Tuomas Tynkkynen wrote:

Add new properties to all of the Tegra PHYs that are now required
according to the binding.

In order to stay compatible with old device trees, the USB drivers
will still function without these reset properties but with the old,
potentially buggy behaviour.

Signed-off-by: Tuomas Tynkkynen ttynkky...@nvidia.com
---
v2 changes: new patch, didn't exist in v1
  arch/arm/boot/dts/tegra114.dtsi |5 +
  arch/arm/boot/dts/tegra124.dtsi |7 +++
  arch/arm/boot/dts/tegra20.dtsi  |7 +++
  arch/arm/boot/dts/tegra30.dtsi  |7 +++
  4 files changed, 26 insertions(+)

diff --git a/arch/arm/boot/dts/tegra114.dtsi b/arch/arm/boot/dts/tegra114.dtsi
index 335a1d8..80b8edd 100644
--- a/arch/arm/boot/dts/tegra114.dtsi
+++ b/arch/arm/boot/dts/tegra114.dtsi
@@ -672,6 +672,8 @@
 tegra_car TEGRA114_CLK_PLL_U,
 tegra_car TEGRA114_CLK_USBD;
clock-names = reg, pll_u, utmi-pads;
+   resets = tegra_car 22, tegra_car 22;
+   reset-names = usb, utmi-pads;
nvidia,hssync-start-delay = 0;
nvidia,idle-wait-delay = 17;
nvidia,elastic-limit = 16;
@@ -682,6 +684,7 @@
nvidia,hssquelch-level = 2;
nvidia,hsdiscon-level = 5;
nvidia,xcvr-hsslew = 12;
+   nvidia,has-utmi-pad-registers;
status = disabled;
};

@@ -705,6 +708,8 @@
 tegra_car TEGRA114_CLK_PLL_U,
 tegra_car TEGRA114_CLK_USBD;
clock-names = reg, pll_u, utmi-pads;
+   resets = tegra_car 59, tegra_car 22;
+   reset-names = usb, utmi-pads;
nvidia,hssync-start-delay = 0;
nvidia,idle-wait-delay = 17;
nvidia,elastic-limit = 16;
diff --git a/arch/arm/boot/dts/tegra124.dtsi b/arch/arm/boot/dts/tegra124.dtsi
index d675186..5b14d79 100644
--- a/arch/arm/boot/dts/tegra124.dtsi
+++ b/arch/arm/boot/dts/tegra124.dtsi
@@ -643,6 +643,8 @@
 tegra_car TEGRA124_CLK_PLL_U,
 tegra_car TEGRA124_CLK_USBD;
clock-names = reg, pll_u, utmi-pads;
+   resets = tegra_car 22, tegra_car 22;
+   reset-names = usb, utmi-pads;
nvidia,hssync-start-delay = 0;
nvidia,idle-wait-delay = 17;
nvidia,elastic-limit = 16;
@@ -653,6 +655,7 @@
nvidia,hssquelch-level = 2;
nvidia,hsdiscon-level = 5;
nvidia,xcvr-hsslew = 12;
+   nvidia,has-utmi-pad-registers;
status = disabled;
};

@@ -677,6 +680,8 @@
 tegra_car TEGRA124_CLK_PLL_U,
 tegra_car TEGRA124_CLK_USBD;
clock-names = reg, pll_u, utmi-pads;
+   resets = tegra_car 58, tegra_car 22;
+   reset-names = usb, utmi-pads;
nvidia,hssync-start-delay = 0;
nvidia,idle-wait-delay = 17;
nvidia,elastic-limit = 16;
@@ -711,6 +716,8 @@
 tegra_car TEGRA124_CLK_PLL_U,
 tegra_car TEGRA124_CLK_USBD;
clock-names = reg, pll_u, utmi-pads;
+   resets = tegra_car 59, tegra_car 22;
+   reset-names = usb, utmi-pads;
nvidia,hssync-start-delay = 0;
nvidia,idle-wait-delay = 17;
nvidia,elastic-limit = 16;
diff --git a/arch/arm/boot/dts/tegra20.dtsi b/arch/arm/boot/dts/tegra20.dtsi
index 243d84c..1908f69 100644
--- a/arch/arm/boot/dts/tegra20.dtsi
+++ b/arch/arm/boot/dts/tegra20.dtsi
@@ -645,6 +645,8 @@
 tegra_car TEGRA20_CLK_CLK_M,
 tegra_car TEGRA20_CLK_USBD;
clock-names = reg, pll_u, timer, utmi-pads;
+   resets = tegra_car 22, tegra_car 22;
+   reset-names = usb, utmi-pads;
nvidia,has-legacy-mode;
nvidia,hssync-start-delay = 9;
nvidia,idle-wait-delay = 17;
@@ -653,6 +655,7 @@
nvidia,xcvr-setup = 9;
nvidia,xcvr-lsfslew = 1;
nvidia,xcvr-lsrslew = 1;
+   nvidia,has-utmi-pad-registers;
status = disabled;
};

@@ -676,6 +679,8 @@
 tegra_car TEGRA20_CLK_PLL_U,
 tegra_car TEGRA20_CLK_CDEV2;
clock-names = reg, pll_u, ulpi-link;
+   resets = tegra_car 58, tegra_car 22;
+   reset-names = usb, utmi-pads;
status = disabled;
};

@@ -700,6 +705,8 @@
 tegra_car TEGRA20_CLK_CLK_M,
   

[PATCH 1/3] usb: host: st-hcd: Add USB HCD support for STi SoCs

2014-07-10 Thread Peter Griffin
This driver adds support for the USB HCD present in STi
SoC's from STMicroelectronics. It has been tested on the
stih416-b2020 board.

Signed-off-by: Peter Griffin peter.grif...@linaro.org
---
 drivers/usb/host/Kconfig  |  17 ++
 drivers/usb/host/Makefile |   1 +
 drivers/usb/host/st-hcd.c | 471 ++
 3 files changed, 489 insertions(+)
 create mode 100644 drivers/usb/host/st-hcd.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 61b7817..dc0358e 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -753,6 +753,23 @@ config USB_HCD_SSB
 
  If unsure, say N.
 
+config USB_HCD_ST
+   tristate STMicroelectronics STi family HCD support
+   depends on ARCH_STI
+   select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
+   select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
+   select MFD_SYSCON
+   select GENERIC_PHY
+   help
+ Enable support for the EHCI and OCHI host controller on ST
+ consumer electronics SoCs.
+
+ It converts the ST driver into two platform device drivers
+ for EHCI and OHCI and provides bus configuration, clock and power
+ management for the combined hardware block.
+
+ If unsure, say N.
+
 config USB_HCD_TEST_MODE
bool HCD test mode support
---help---
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index af89a90..af0b81d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -74,3 +74,4 @@ obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o
 obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o
 obj-$(CONFIG_USB_FOTG210_HCD)  += fotg210-hcd.o
 obj-$(CONFIG_USB_MAX3421_HCD)  += max3421-hcd.o
+obj-$(CONFIG_USB_HCD_ST)   += st-hcd.o
diff --git a/drivers/usb/host/st-hcd.c b/drivers/usb/host/st-hcd.c
new file mode 100644
index 000..8a9636c
--- /dev/null
+++ b/drivers/usb/host/st-hcd.c
@@ -0,0 +1,471 @@
+/*
+ * STMicroelectronics HCD (Host Controller Driver) for USB 2.0 and 1.1.
+ *
+ * Copyright (c) 2013 STMicroelectronics (RD) Ltd.
+ * Authors: Stephen Gallimore stephen.gallim...@st.com
+ *  Peter Griffin peter.grif...@linaro.org
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2, as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/platform_device.h
+#include linux/slab.h
+#include linux/dma-mapping.h
+#include linux/of.h
+#include linux/pm_runtime.h
+#include linux/pm_clock.h
+#include linux/delay.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+#include linux/clk.h
+#include linux/io.h
+#include linux/module.h
+#include linux/reset.h
+#include linux/regmap.h
+#include linux/phy/phy.h
+#include linux/mfd/syscon.h
+#include linux/usb/ohci_pdriver.h
+#include linux/usb/ehci_pdriver.h
+
+#include ohci.h
+
+#define EHCI_CAPS_SIZE 0x10
+#define AHB2STBUS_INSREG01 (EHCI_CAPS_SIZE + 0x84)
+
+struct st_hcd_dev {
+   int port_nr;
+   struct platform_device *ehci_device;
+   struct platform_device *ohci_device;
+   struct clk *ic_clk; /* Interconnect clock to the controller block */
+   struct clk *ohci_clk; /* 48MHz clock for OHCI */
+   struct reset_control *pwr;
+   struct reset_control *rst;
+   struct phy *phy;
+};
+
+static inline void st_ehci_configure_bus(void __iomem *regs)
+{
+   /* Set EHCI packet buffer IN/OUT threshold to 128 bytes */
+   u32 threshold = 128 | (128  16);
+
+   writel(threshold, regs + AHB2STBUS_INSREG01);
+}
+
+static int st_hcd_enable_clocks(struct device *dev,
+   struct st_hcd_dev *hcd_dev)
+{
+   int err;
+   /*
+* The interconnect input clock have either fixed
+* rate or the rate is defined on boot, so we are only concerned about
+* enabling any gates for this clock.
+*/
+   err = clk_prepare_enable(hcd_dev-ic_clk);
+   if (err) {
+   dev_err(dev, can't enable ic clock\n);
+   return err;
+   }
+   /*
+* The 48MHz OHCI clock is usually provided by a programmable
+* frequency synthesizer, which is often not programmed on boot/chip
+* reset, so we set its rate here to ensure it is correct.
+*
+* However not all SoC's have a dedicated ohci clock so it isn't fatal
+* for this not to  exist.
+*/
+   if (!IS_ERR(hcd_dev-ohci_clk)) {
+   err = clk_set_rate(hcd_dev-ohci_clk, 4800);
+   if (err) {
+   dev_err(dev, can't set ohci_clk rate\n);
+   goto error;
+   }
+
+   err = clk_prepare_enable(hcd_dev-ohci_clk);
+   if (err) {
+   dev_err(dev, can't enable ohci_clk\n);
+   goto error;
+   }
+   }
+
+   return 0;
+error:
+   clk_disable_unprepare(hcd_dev-ic_clk);
+   return err;
+}
+

[PATCH 2/3] usb: host: st-hcd: Add st-hcd devicetree bindings documentation.

2014-07-10 Thread Peter Griffin
This patch documents the device tree documentation required for
the ST HCD controller found in STMicroelectronics SoCs.

Signed-off-by: Peter Griffin peter.grif...@linaro.org
---
 Documentation/devicetree/bindings/usb/st-hcd.txt | 51 
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/st-hcd.txt

diff --git a/Documentation/devicetree/bindings/usb/st-hcd.txt 
b/Documentation/devicetree/bindings/usb/st-hcd.txt
new file mode 100644
index 000..f2500dd
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/st-hcd.txt
@@ -0,0 +1,51 @@
+ST HCD (Host Controller Driver) for USB 2.0 and 1.1
+
+The device node has the following properties.
+
+Required properties:
+ - compatible  : must be st,usb-300x
+ - reg : physical base addresses of the controller and length 
of memory mapped
+ region
+ - reg-names   : names associated to the reg defines above, should be 
ehci and ohci
+ - interrupts  : interrupt numbers to the cpu
+ - interrupt-names : should be ehci and ohci
+
+ - pinctrl-names   : a pinctrl state named default must be defined
+-  pinctrl-0   : phandle referencing pin configuration of the USB 
controller
+See: Documentation/devicetree/bindings/pinctrl/pinctrl-binding.txt
+
+ - clocks  : phandle list of usb clocks.
+ - clock-names : should be ic for interconnect clock and ohci for 
the 48MHz clock
+See: Documentation/devicetree/bindings/clock/clock-bindings.txt
+
+ - resets  : phandle to the powerdown and reset controller for the 
USB IP
+ - reset-names : should be power and softreset.
+See: Documentation/devicetree/bindings/reset/st,sti-powerdown.txt
+See: Documentation/devicetree/bindings/reset/reset.txt
+
+Example:
+
+usb0: usb@fe10 {
+   compatible  = st,usb-300x;
+   reg = 0xfe1ffc00 0x100,
+ 0xfe1ffe00 0x100;
+   reg-names   = ohci, ehci;
+
+   interrupts  =  GIC_SPI 148 IRQ_TYPE_NONE,
+  GIC_SPI 149 IRQ_TYPE_NONE;
+   interrupt-names = ehci,ohci;
+   pinctrl-names   = default;
+   pinctrl-0   = pinctrl_usb0;
+   clocks  = clk_s_a1_ls CLK_ICN_IF_2,
+ clockgen_b0 0;
+   clock-names = ic, ohci;
+
+   resets  = powerdown STIH416_USB0_POWERDOWN,
+ softreset STIH416_USB0_SOFTRESET;
+   reset-names = power, softreset;
+
+   phys = usb2_phy;
+   phy-names = usb2-phy;
+};
+
+
-- 
1.9.1

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


[PATCH 3/3] MAINTAINERS: Add st-hcd to ARCH/STI architecture

2014-07-10 Thread Peter Griffin
Signed-off-by: Peter Griffin peter.grif...@linaro.org
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 702ca10..359a64e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1325,6 +1325,7 @@ F:drivers/pinctrl/pinctrl-st.c
 F: drivers/media/rc/st_rc.c
 F: drivers/i2c/busses/i2c-st.c
 F: drivers/tty/serial/st-asc.c
+F: drivers/usb/host/st-hcd.c
 
 ARM/TECHNOLOGIC SYSTEMS TS7250 MACHINE SUPPORT
 M: Lennert Buytenhek ker...@wantstofly.org
-- 
1.9.1

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


[PATCH 0/3] Add USB HCD support for STi SoCs

2014-07-10 Thread Peter Griffin
This driver adds support for the USB HCD controller present in STi
SoC's from STMicroelectronics. It has been tested on the stih416-b2020
board.

The original author is no longer with the company and therefore emails
to his address bounce, thus I have not added him to CC.

Peter Griffin (3):
  usb: host: st-hcd: Add USB HCD support for STi SoCs
  usb: host: st-hcd: Add st-hcd devicetree bindings documentation.
  MAINTAINERS: Add st-hcd to ARCH/STI architecture

 Documentation/devicetree/bindings/usb/st-hcd.txt |  51 +++
 MAINTAINERS  |   1 +
 drivers/usb/host/Kconfig |  17 +
 drivers/usb/host/Makefile|   1 +
 drivers/usb/host/st-hcd.c| 471 +++
 5 files changed, 541 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/st-hcd.txt
 create mode 100644 drivers/usb/host/st-hcd.c

-- 
1.9.1

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


Re: [PATCH v2 3/3] MAINTAINERS: Add dwc3-st.c file to ARCH/STI architecture

2014-07-10 Thread Peter Griffin
Hi Felipe,

  Maxime,
Once Acked by Felipe, I think this should go in via your tree to
  avoid conflicts with other ARM/STI ARCHITECTURE additions.
 
 there are still many unresolved comments on patches 1 and 2.

Yes, sorry I've been a bit busy this week on other activities to send a V3.

I will get this fixed up addressing the comments received so far, and sent out
a V3 early next week.

regards,

Peter.


--
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: host/ohci-tmio.c:104: possible novice coding error ?

2014-07-10 Thread Alan Stern
On Thu, 10 Jul 2014, David Binderman wrote:

 Hello there,
 
 [linux-3.16-rc4/drivers/usb/host/ohci-tmio.c:104]: (warning) Redundant 
 bitwise operation on 'pm' in 'switch' statement. 'break;' missing?
 
 switch (ohci-num_ports) {
 default:
 dev_err(dev-dev, Unsupported amount of ports: %d\n, 
 ohci-num_ports);
 case 3:
 pm |= CCR_PM_USBPW3;
 case 2:
 pm |= CCR_PM_USBPW2;
 case 1:
 pm |= CCR_PM_USBPW1;
 }
 
 Suggest add missing breaks.

Please don't; that would mess up the driver.  Instead, fix the
definition of CCR_PM_USBPW3.  I don't know what it should be, but right 
now it's equal to CCR_PM_USBPW2, which is obviously wrong.

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 2/2] hso: fix deadlock when receiving bursts of data

2014-07-10 Thread David Laight
From: One Thousand Gnomes
 On Thu, 10 Jul 2014 14:37:37 +
 David Laight david.lai...@aculab.com wrote:
 
  From: Olivier Sobrie
  ...
   The function put_rxbuf_data() is called from the urb completion handler.
   It puts the data of the urb transfer in the tty buffer with
   tty_insert_flip_string_flags() and schedules a work queue in order to
   push the data to the ldisc.
   Problem is that we are in a urb completion handler so we can't wait
   until there is room in the tty buffer.
 
 The tty provides the input queue, if the queue is full then just chuck
 the data in the bitbucket.  hso is trying to be far too clever.
 
 If hso is fast enough that the buffering isn't sufficient on the tty side
 then we need to fix the tty buffer size.

You really want to apply flow control back over the 'serial' link.
That may just cause data discards earlier on the local system.
But it is possible that not resubmitting the receive urb will cause the
modem to flow control back to the sender.
In which case there is some chance that data won't be lost.

David

 
 Arguably what we need are tty fastpaths for non N_TTY but thats rather
 more work. There's no fundamental reason that hso can't throw the buffer
 at buffer straight at the PPP ldisc and straight into the network stack -
 just that
 
 1. The tty mid layer glue is standing in the way
 2. The change of line discipline code has to lock against it
 
 Alan


--
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 2/2] hso: fix deadlock when receiving bursts of data

2014-07-10 Thread One Thousand Gnomes
On Thu, 10 Jul 2014 14:37:37 +
David Laight david.lai...@aculab.com wrote:

 From: Olivier Sobrie
 ...
  The function put_rxbuf_data() is called from the urb completion handler.
  It puts the data of the urb transfer in the tty buffer with
  tty_insert_flip_string_flags() and schedules a work queue in order to
  push the data to the ldisc.
  Problem is that we are in a urb completion handler so we can't wait
  until there is room in the tty buffer.

The tty provides the input queue, if the queue is full then just chuck
the data in the bitbucket.  hso is trying to be far too clever.

If hso is fast enough that the buffering isn't sufficient on the tty side
then we need to fix the tty buffer size.

Arguably what we need are tty fastpaths for non N_TTY but thats rather
more work. There's no fundamental reason that hso can't throw the buffer
at buffer straight at the PPP ldisc and straight into the network stack -
just that 

1. The tty mid layer glue is standing in the way
2. The change of line discipline code has to lock against it

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


[PATCH v4] u_ether: move hardware transmit to RX NAPI

2014-07-10 Thread Weinn Jheng
In order to reduce the interrupt times in the embedded system,
a receiving workqueue is introduced.
This modification also enhanced the overall throughput as the
benefits of reducing interrupt occurrence.

This work was derived from previous work:
u_ether: move hardware transmit to RX workqueue.
Which should be base on codeaurora's work.

However, the benchmark on my platform shows the throughput
with workqueue is slightly better than NAPI.

Signed-off-by: Weinn Jheng clanlab.p...@gmail.com
Cc: David S. Miller da...@davemloft.net
Cc: Stephen Hemminger shemmin...@vyatta.com
Cc: Felipe Balbi ba...@ti.com
Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Cc: Manu Gautam mgau...@codeaurora.org
Cc: Andrzej Pietrasiewicz andrze...@samsung.com
---
Changes for v2:
  - Trying to fix the plug/unplug problem which cause KE.
Changes for v3:
  - Fix plug/unplug problem in gether_disconenct.
  - Refine the rx/tx_completion function assigment.
  - This patch has been tested on beaglebone black.
Changes for v4:
  - Move NAPI disable to a work queue and see if this won't cause KE
on replug.

 drivers/usb/gadget/u_ether.c | 138 ++-
 1 file changed, 98 insertions(+), 40 deletions(-)

diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c
index 97b0277..785d018 100644
--- a/drivers/usb/gadget/u_ether.c
+++ b/drivers/usb/gadget/u_ether.c
@@ -48,6 +48,8 @@
 
 #define UETH__VERSION  29-May-2008
 
+#define GETHER_NAPI_WEIGHT 5
+
 struct eth_dev {
/* lock is held while accessing port_usb
 */
@@ -72,6 +74,8 @@ struct eth_dev {
struct sk_buff_head *list);
 
struct work_struct  work;
+   struct work_struct  napi_work;
+   struct napi_struct  rx_napi;
 
unsigned long   todo;
 #defineWORK_RX_MEMORY  0
@@ -187,6 +191,7 @@ static void defer_kevent(struct eth_dev *dev, int flag)
 }
 
 static void rx_complete(struct usb_ep *ep, struct usb_request *req);
+static void tx_complete(struct usb_ep *ep, struct usb_request *req);
 
 static int
 rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
@@ -242,7 +247,6 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, 
gfp_t gfp_flags)
 
req-buf = skb-data;
req-length = size;
-   req-complete = rx_complete;
req-context = skb;
 
retval = usb_ep_queue(out, req, gfp_flags);
@@ -253,18 +257,16 @@ enomem:
DBG(dev, rx submit -- %d\n, retval);
if (skb)
dev_kfree_skb_any(skb);
-   spin_lock_irqsave(dev-req_lock, flags);
-   list_add(req-list, dev-rx_reqs);
-   spin_unlock_irqrestore(dev-req_lock, flags);
}
return retval;
 }
 
 static void rx_complete(struct usb_ep *ep, struct usb_request *req)
 {
-   struct sk_buff  *skb = req-context, *skb2;
+   struct sk_buff  *skb = req-context;
struct eth_dev  *dev = ep-driver_data;
int status = req-status;
+   boolrx_queue = 0;
 
switch (status) {
 
@@ -288,30 +290,8 @@ static void rx_complete(struct usb_ep *ep, struct 
usb_request *req)
} else {
skb_queue_tail(dev-rx_frames, skb);
}
-   skb = NULL;
-
-   skb2 = skb_dequeue(dev-rx_frames);
-   while (skb2) {
-   if (status  0
-   || ETH_HLEN  skb2-len
-   || skb2-len  VLAN_ETH_FRAME_LEN) {
-   dev-net-stats.rx_errors++;
-   dev-net-stats.rx_length_errors++;
-   DBG(dev, rx length %d\n, skb2-len);
-   dev_kfree_skb_any(skb2);
-   goto next_frame;
-   }
-   skb2-protocol = eth_type_trans(skb2, dev-net);
-   dev-net-stats.rx_packets++;
-   dev-net-stats.rx_bytes += skb2-len;
-
-   /* no buffer copies needed, unless hardware can't
-* use skb buffers.
-*/
-   status = netif_rx(skb2);
-next_frame:
-   skb2 = skb_dequeue(dev-rx_frames);
-   }
+   if (!status)
+   rx_queue = 1;
break;
 
/* software-driven interface shutdown */
@@ -334,28 +314,27 @@ quiesce:
/* FALLTHROUGH */
 
default:
+   rx_queue = 1;
+   dev_kfree_skb_any(skb);
dev-net-stats.rx_errors++;
DBG(dev, rx status %d\n, status);
break;
}
 
-   if (skb)
-   dev_kfree_skb_any(skb);
-   if (!netif_running(dev-net)) {
 clean:
-   spin_lock(dev-req_lock);

Re: [PATCH 1/3] usb: host: st-hcd: Add USB HCD support for STi SoCs

2014-07-10 Thread Alan Stern
On Thu, 10 Jul 2014, Peter Griffin wrote:

 This driver adds support for the USB HCD present in STi
 SoC's from STMicroelectronics. It has been tested on the
 stih416-b2020 board.

This driver file, along with the Kconfig changes, belongs in the
arch/platform-specific source directory.  Not in drivers/usb/host/.  
It is, after all, a platform driver that registers two platform
devices.

 +++ b/drivers/usb/host/Kconfig
 @@ -753,6 +753,23 @@ config USB_HCD_SSB
  
 If unsure, say N.
  
 +config USB_HCD_ST
 + tristate STMicroelectronics STi family HCD support

Why does this need to be tristate?  Why not always build it into the 
kernel?  Or at least make it boolean rather than tristate.

 + depends on ARCH_STI
 + select USB_OHCI_HCD_PLATFORM if USB_OHCI_HCD
 + select USB_EHCI_HCD_PLATFORM if USB_EHCI_HCD
 + select MFD_SYSCON
 + select GENERIC_PHY
 + help
 +   Enable support for the EHCI and OCHI host controller on ST

s/OCHI/OHCI/

 +   consumer electronics SoCs.
 +
 +   It converts the ST driver into two platform device drivers

It converts the ST driver?  That doesn't sound right at all.  You could 
eliminate this paragraph completely and nobody would miss it.

 +   for EHCI and OHCI and provides bus configuration, clock and power
 +   management for the combined hardware block.

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 4/4] xhci: Allow xHCI drivers to be built as separate modules

2014-07-10 Thread Julius Werner
 diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
 index af89a90..bafba71 100644
 --- a/drivers/usb/host/Makefile
 +++ b/drivers/usb/host/Makefile
 @@ -15,19 +15,19 @@ fhci-$(CONFIG_FHCI_DEBUG) += fhci-dbg.o
  xhci-hcd-y := xhci.o xhci-mem.o
  xhci-hcd-y += xhci-ring.o xhci-hub.o xhci-dbg.o
  xhci-hcd-y += xhci-trace.o
 -xhci-hcd-$(CONFIG_PCI) += xhci-pci.o

 -ifneq ($(CONFIG_USB_XHCI_PLATFORM), )
 -   xhci-hcd-y  += xhci-plat.o
 +xhci-plat-hcd-y := xhci-plat.o
  ifneq ($(CONFIG_USB_XHCI_MVEBU), )
 -   xhci-hcd-y  += xhci-mvebu.o
 -endif

nit: Can do this even simpler now, just
xhci-plat-hcd-$(CONFIG_USB_XHCI_MVEBU) += xhci-mvebu.o without the
ifneq.

 +   xhci-plat-hcd-y += xhci-mvebu.o
  endif

  obj-$(CONFIG_USB_WHCI_HCD) += whci/

  obj-$(CONFIG_PCI)  += pci-quirks.o

 +obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o
 +obj-$(CONFIG_USB_XHCI_PLATFORM) += xhci-plat-hcd.o
 +
  obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o
  obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
  obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)+= ehci-platform.o

Great patch series, thank you!
--
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


Greetings To You,

2014-07-10 Thread Mr Cole Davidson
Greetings To You,

Hello dear, I wish to approach you with a request that would be of immense
benefit to both of us.I came across your email and I picked interest to
contact you, please can we be friends? or partnership with me in some
business investment, Maybe you can assist. There is a purpose that made me
to contact you. I wish you will have the desire to communicate with me so
that I can be able to let you know more details of contacting you.
Indicate your intrest by repplaying ungentry from my private
email-coledave1...@yahoo.com,

Thanks and God bless you for your understanding.
Waiting to read from you soon.

Regards.
Mr Cole Davidson,
--
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 2/2] hso: fix deadlock when receiving bursts of data

2014-07-10 Thread One Thousand Gnomes
 You really want to apply flow control back over the 'serial' link.
 That may just cause data discards earlier on the local system.
 But it is possible that not resubmitting the receive urb will cause the
 modem to flow control back to the sender.
 In which case there is some chance that data won't be lost.

If you are doing PPP and you can't keep up the sooner you chuck data the
better. Flow control actually works against performance and good network
behaviour. It's counter intuitive but TCP/IP works best if any
performance bottlenecks are immediately visible and not covered over.

Alan
--
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: host/ohci-tmio.c:104: possible novice coding error ?

2014-07-10 Thread Dmitry Eremin-Solenikov
Hello,

On Thu, Jul 10, 2014 at 7:53 PM, Alan Stern st...@rowland.harvard.edu wrote:
 On Thu, 10 Jul 2014, David Binderman wrote:

 Hello there,

 [linux-3.16-rc4/drivers/usb/host/ohci-tmio.c:104]: (warning) Redundant 
 bitwise operation on 'pm' in 'switch' statement. 'break;' missing?

 switch (ohci-num_ports) {
 default:
 dev_err(dev-dev, Unsupported amount of ports: %d\n, 
 ohci-num_ports);
 case 3:
 pm |= CCR_PM_USBPW3;
 case 2:
 pm |= CCR_PM_USBPW2;
 case 1:
 pm |= CCR_PM_USBPW1;
 }

 Suggest add missing breaks.

 Please don't; that would mess up the driver.  Instead, fix the
 definition of CCR_PM_USBPW3.  I don't know what it should be, but right
 now it's equal to CCR_PM_USBPW2, which is obviously wrong.

No, the breaks are omitted there on purpose. USBPW3 might be wrong.
I checked the specs, it should be 0x10 (I was not able to check it - my hardware
has only 2 usb ports). Please correct it if it is incorrect.

-- 
With best wishes
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 v2 0/2] ARM: shmobile: lager: USBHS callback elimination

2014-07-10 Thread Yoshihiro Shimoda
Hi Ulrich,

(2014/07/10 16:53), Ulrich Hecht wrote:
 Changes in v2:
 - move phy handle to struct usbhs_priv
 - add new default pipe type to driver
 - remove pipe type from Lager board code
 
 Ulrich Hecht (2):
   usb: renesas_usbhs: add R-Car Gen. 2 init and power control
   ARM: shmobile: lager: remove USBHS callbacks
 
  arch/arm/mach-shmobile/board-lager.c | 126 
 ---
  drivers/usb/renesas_usbhs/Makefile   |   2 +-
  drivers/usb/renesas_usbhs/common.c   |  66 --
  drivers/usb/renesas_usbhs/common.h   |   2 +
  drivers/usb/renesas_usbhs/rcar2.c|  76 +
  drivers/usb/renesas_usbhs/rcar2.h|   4 ++
  include/linux/usb/renesas_usbhs.h|   6 ++
  7 files changed, 163 insertions(+), 119 deletions(-)
  create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
  create mode 100644 drivers/usb/renesas_usbhs/rcar2.h
 

I tested these patches on Lager legacy, and these patches worked correctly.

Tested-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com

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


Re: [PATCH v2 2/4] usb: host: xhci-plat: Get PHYs for xhci's hcds

2014-07-10 Thread Vivek Gautam
Hi Julius,


On Wed, Jul 9, 2014 at 11:26 PM, Julius Werner jwer...@chromium.org wrote:
 On Wed, Jul 9, 2014 at 3:01 AM, Vivek Gautam gautam.vi...@samsung.com wrote:
 The host controller by itself may sometimes need to handle PHY
 and/or calibrate some of the PHY settings to get full support out
 of the PHY controller. The PHY core provides a calibration
 funtionality now to do so.
 Therefore, facilitate getting the two possible PHYs, viz.
 USB 2.0 type (UTMI+) and USB 3.0 type (PIPE3), provided
 by the parent - Synopsys's DWC3 controller

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/xhci-plat.c |   36 
  1 file changed, 36 insertions(+)

 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
 index 29d8adb..e50bd7d 100644
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c
 @@ -16,6 +16,7 @@
  #include linux/module.h
  #include linux/of.h
  #include linux/platform_device.h
 +#include linux/phy/phy.h
  #include linux/slab.h

  #include xhci.h
 @@ -101,6 +102,7 @@ static int xhci_plat_probe(struct platform_device *pdev)
 struct clk  *clk;
 int ret;
 int irq;
 +   struct device   *parent;

 if (usb_disabled())
 return -ENODEV;
 @@ -165,6 +167,23 @@ static int xhci_plat_probe(struct platform_device *pdev)
 goto unmap_registers;
 }

 +   parent = pdev-dev.parent;
 +   /*
 +* Get possile USB 2.0 type PHY (UTMI+) registered by xhci's parent:
 +* Synopsys-dwc3
 +*/
 +   if (of_device_is_compatible(parent-of_node, synopsys,dwc3) ||
 +   of_device_is_compatible(parent-of_node, snps,dwc3)) {
 +   hcd-gen_phy = devm_phy_get(pdev-dev, usb2-phy);
 +   if (IS_ERR(hcd-gen_phy)) {
 +   ret = PTR_ERR(hcd-gen_phy);
 +   if (ret != -ENOSYS  ret != -ENODEV) {
 +   dev_err(pdev-dev, no usb2 phy 
 configured\n);
 +   return ret;
 +   }
 +   }
 +   }

 Why does this need to check for DWC3? I think this code should be as
 generic as possible. Can't you just devm_phy_get(usb2-phy), and keep
 going with a dev_dbg() message if it fails? If the platform has a phy
 it will find it, if not that's fine too.

Right, i was misled with the phy requisition in usb_add_hcd(), which i
thought would be
called first, and we would have been trying to overwrite the 'gen_phy'
member here. My bad!!

You are right, in this case we will not need the check for DWC3, and
we will still have the
liberty to get two different PHYs (usb2-phy and usb3-phy).


 Looks like Heikki's patch assigns the phy names in DWC3-specific code,
 so I'm not sure if they are supposed to be specific to that
 controller... but DWC3 is the only merged XHCI controller this applys
 to right now, so why not make that a general convention? The concept
 of having one usb2-phy and one usb3-phy is probably common across
 most xHC implementations (unless they share a single phy in which case
 they could just leave one of them unset), so it will be much easier to
 handle if they all chose the same two names for those (and we can
 avoid a big list of special cases here).

Right, i will remove these checks then, and let this be generic so that each
xHCI could get 'usb2-phy' and 'usb3-phy', if it's available.


 +
 ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
 if (ret)
 goto disable_clk;
 @@ -191,6 +210,23 @@ static int xhci_plat_probe(struct platform_device *pdev)
 if (HCC_MAX_PSA(xhci-hcc_params) = 4)
 xhci-shared_hcd-can_do_streams = 1;

 +   /*
 +* Get possile USB 3.0 type PHY (PIPE3) registered by xhci's parent:
 +* Synopsys-dwc3
 +*/
 +   if (of_device_is_compatible(parent-of_node, synopsys,dwc3) ||
 +   of_device_is_compatible(parent-of_node, snps,dwc3)) {
 +   xhci-shared_hcd-gen_phy = devm_phy_get(pdev-dev,
 +usb3-phy);
 +   if (IS_ERR(xhci-shared_hcd-gen_phy)) {
 +   ret = PTR_ERR(xhci-shared_hcd-gen_phy);
 +   if (ret != -ENOSYS  ret != -ENODEV) {
 +   dev_err(pdev-dev, no usb3 phy 
 configured\n);
 +   return ret;
 +   }
 +   }
 +   }
 +
 ret = usb_add_hcd(xhci-shared_hcd, irq, IRQF_SHARED);
 if (ret)
 goto put_usb3_hcd;
 --
 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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
--
To 

Re: [PATCH v2 3/4] usb: host: xhci-plat: Caibrate PHY post host reset

2014-07-10 Thread Vivek Gautam
On Wed, Jul 9, 2014 at 11:28 PM, Julius Werner jwer...@chromium.org wrote:
 On Wed, Jul 9, 2014 at 3:01 AM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Some quirky PHYs may require to be calibrated post the host
 controller initialization.
 The USB 3.0 DRD PHY on Exynos5420/5800 systems, coming along with
 Synopsys's DWC3 controller, is one such PHY which needs to be
 calibrated post xhci's reset at initialization time and at
 resume time, to get the controller work at SuperSpeed.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/xhci-plat.c |   39 +--
  1 file changed, 37 insertions(+), 2 deletions(-)

 diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
 index e50bd7d..decf349 100644
 --- a/drivers/usb/host/xhci-plat.c
 +++ b/drivers/usb/host/xhci-plat.c
 @@ -35,7 +35,27 @@ static void xhci_plat_quirks(struct device *dev, struct 
 xhci_hcd *xhci)
  /* called during probe() after chip reset completes */
  static int xhci_plat_setup(struct usb_hcd *hcd)
  {
 -   return xhci_gen_setup(hcd, xhci_plat_quirks);
 +   struct device *parent;
 +   int ret;
 +
 +   ret = xhci_gen_setup(hcd, xhci_plat_quirks);
 +   if (ret) {
 +   dev_err(hcd-self.controller, xhci setup failed\n);
 +   return ret;
 +   }
 +
 +   parent = hcd-self.controller-parent;
 +   if (of_device_is_compatible(parent-of_node, synopsys,dwc3) ||
 +   of_device_is_compatible(parent-of_node, snps,dwc3)) {
 +   if (!IS_ERR(hcd-gen_phy)) {
 +   ret = phy_calibrate(hcd-gen_phy);
 +   if (ret  0  ret != -ENOTSUPP)
 +   dev_err(hcd-self.controller,
 +   failed to calibrate USB PHY\n);
 +   }
 +   }

 Here as well, is it really necessary to special-case it so much? I'd
 say if there is a PHY and it has a calibrate function bound we call
 it, and if not we just go ahead.

 I also think that this would fit better in core/hcd.c since it's not
 really XHCI specific... it's conceivable that an EHCI controller might
 also need to tune some PHY settings after reset (in fact Tegra does
 something similar, although it already has another hack for that now),
 so if we introduce this general facility why not offer it to
 everyone?.

True, lets move it to core/hcd.c to make the entire calibration thing
more generic.


 +
 +   return ret;
  }

  static int xhci_plat_start(struct usb_hcd *hcd)
 @@ -288,8 +308,23 @@ static int xhci_plat_resume(struct device *dev)
  {
 struct usb_hcd  *hcd = dev_get_drvdata(dev);
 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
 +   int ret;
 +
 +   ret = xhci_resume(xhci, 0);
 +   if (ret)
 +   return ret;

 -   return xhci_resume(xhci, 0);
 +   if (of_device_is_compatible(dev-parent-of_node, synopsys,dwc3) ||
 +   of_device_is_compatible(dev-parent-of_node, snps,dwc3)) {
 +   if (!IS_ERR(hcd-gen_phy)) {
 +   ret = phy_calibrate(hcd-gen_phy);
 +   if (ret  0  ret != -ENOTSUPP)
 +   dev_err(hcd-self.controller,
 +   failed to calibrate USB PHY\n);
 +   }
 +   }
 +
 +   return ret;
  }

  static const struct dev_pm_ops xhci_plat_pm_ops = {
 --
 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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
--
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


[no subject]

2014-07-10 Thread WESTERN UNION
-- 
Attention

Customer, $200,000,00 USD was won by your email from
the Western Union.Please contact Mr Morris Smith so that your fund will
be remitted to you through Western Union Transfer

Regard
Mr Morris Smith
+2348117653376
--
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