Re: [resend PATCH 1/3] ACPI / platform: provide default DMA mask

2014-10-22 Thread Adrian Hunter
On 21/10/14 16:13, Adrian Hunter wrote:
> On 21/10/14 16:08, Rafael J. Wysocki wrote:
>> On Tuesday, October 21, 2014 03:27:45 PM Adrian Hunter wrote:
>>> On 24/09/14 16:49, Rafael J. Wysocki wrote:
 On Wednesday, September 24, 2014 11:00:37 AM Heikki Krogerus wrote:
> Most devices are configured for 32-bit DMA addresses.
> Setting the mask to 32-bit here removes the need for the
> drivers to do it separately.
>
> Signed-off-by: Heikki Krogerus 
> Cc: "Rafael J. Wysocki" 

 ACK
>>>
>>> Hi
>>>
>>> I need this for another driver.  Did this patch go anywhere?
>>
>> It's not in 3.18-rc1 as far as I can say.
>>
>>> Note Heikki is away at the moment.
>>
>> That's OK.  I guess I can queue up this one for you.
>>
>> When do you need this to get into the Linus' tree?
> 
> My patches are aiming for 3.19

Actually it would be easier for me if Heikki's patch is already in
3.18, but all I need to know is when it will hit?

> 
>>
>>
> ---
>  drivers/acpi/acpi_platform.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
> index 2bf9082..8d099e6 100644
> --- a/drivers/acpi/acpi_platform.c
> +++ b/drivers/acpi/acpi_platform.c
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  
>  #include "internal.h"
> @@ -102,6 +103,7 @@ struct platform_device 
> *acpi_create_platform_device(struct acpi_device *adev)
>   pdevinfo.res = resources;
>   pdevinfo.num_res = count;
>   pdevinfo.acpi_node.companion = adev;
> + pdevinfo.dma_mask = DMA_BIT_MASK(32);
>   pdev = platform_device_register_full(&pdevinfo);
>   if (IS_ERR(pdev))
>   dev_err(&adev->dev, "platform device creation failed: %ld\n",
>

>>>
>>
> 
> 
> 

--
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] drivers: depend on instead of select BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO

2014-10-22 Thread Tomi Valkeinen
On 18/10/14 00:13, Jani Nikula wrote:
> Documentation/kbuild/kconfig-language.txt warns to use select with care,
> and in general use select only for non-visible symbols and for symbols
> with no dependencies, because select will force a symbol to a value
> without visiting the dependencies.
> 
> Select has become particularly problematic, interdependently, with the
> BACKLIGHT_CLASS_DEVICE and ACPI_VIDEO configs. For example:
> 
> scripts/kconfig/conf --randconfig Kconfig
> KCONFIG_SEED=0x48312B00
> warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 &&
> DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY
> && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI &&
> EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE
> which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)
> warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 &&
> DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY
> && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI &&
> EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE
> which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)
> 
> With tristates it's possible to end up selecting FOO=y depending on
> BAR=m in the config, which gets discovered at build time, not config
> time, like reported in the thread referenced below.
> 
> Do the following to fix the dependencies:
> 
> * Depend on instead of select BACKLIGHT_CLASS_DEVICE everywhere. Drop
>   select BACKLIGHT_LCD_SUPPORT in such cases, as it's a dependency of
>   BACKLIGHT_CLASS_DEVICE.
> 
> * Remove config FB_BACKLIGHT altogether, and replace it with a
>   dependency on BACKLIGHT_CLASS_DEVICE. All configs selecting
>   FB_BACKLIGHT select or depend on FB anyway, so we can simplify.
> 
> * Depend on (ACPI && ACPI_VIDEO) || ACPI=n in several places instead of
>   selecting ACPI_VIDEO and a number of its dependencies if ACPI is
>   enabled. This is tied to backlight, as ACPI_VIDEO depends on
>   BACKLIGHT_CLASS_DEVICE.
> 
> * Replace a couple of select INPUT/VT with depends as it seemed to be
>   necessary.

While doing 'depends on' instead of 'select' is an "easy" fix for this,
I do dislike it quite a bit. It's a major pain to go around the kernel
config, trying to find all the dependencies that a particular driver
wants. If I need fb-foobar, I should just be able to enable it, instead
of first searching and selecting its minor dependencies individually.

So, not a NACK, but a "isn't there an another way to fix this?".

Looking at backlight... BACKLIGHT_LCD_SUPPORT seems to be a "meta"
option, it only enables a Kconfig submenu.

So I think we could just remove the whole BACKLIGHT_LCD_SUPPORT option.
But if we do that, all the items in drivers/video/backlight/Kconfig with
default 'y' or 'm' would get enabled by default, so I think we should
remove the 'default's from that file. That makes sense in any case, as I
don't see why "HP Jornada 700 series LCD Driver" should be "default y".

BACKLIGHT_CLASS_DEVICE doesn't depend on anything except
BACKLIGHT_LCD_SUPPORT, so after removing BACKLIGHT_LCD_SUPPORT it should
be safe to 'select' BACKLIGHT_CLASS_DEVICE.

BACKLIGHT_CLASS_DEVICE could be made a hidden option, and the drivers in
drivers/video/backlight/Kconfig which are under BACKLIGHT_CLASS_DEVICE
could be made to select BACKLIGHT_CLASS_DEVICE instead.

That doesn't exactly fix anything, but I think it makes sense as
BACKLIGHT_CLASS_DEVICE is something that's selected from all around the
kernel, so it should be a selectable "library" instead of a Kconfig menu
option.

I didn't look at the ACPI_VIDEO side, so no idea how messy that is.

 Tomi




signature.asc
Description: OpenPGP digital signature


Re: [PATCH] USB: serial: cp210x: Add Silicon Labs 358x VID and PID.

2014-10-22 Thread Johan Hovold
On Fri, Oct 03, 2014 at 12:01:20PM -0400, Nathaniel Ting wrote:
> From: Nathaniel Ting 
> 
> Enable Silicon Labs Ember VID chips to enumerate with the cp210x usb serial
> driver. EM358x devices operating with the Ember Z-Net 5.1.2 stack may now
> connect to host PCs over a USB serial link.
> 
> Signed-off-by: Nathaniel Ting 

Applied, thanks.

Johan

> ---
>  drivers/usb/serial/cp210x.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
> index e4bb622..ab1eb9b 100644
> --- a/drivers/usb/serial/cp210x.c
> +++ b/drivers/usb/serial/cp210x.c
> @@ -154,6 +154,7 @@ static const struct usb_device_id id_table[] = {
>   { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */
>   { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */
>   { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */
> + { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */
>   { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */
>   { USB_DEVICE(0x1E29, 0x0102) }, /* Festo CPX-USB */
>   { USB_DEVICE(0x1E29, 0x0501) }, /* Festo CMSP */
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/1] usb: option: add support for Telit LE910

2014-10-22 Thread Johan Hovold
On Tue, Oct 14, 2014 at 10:47:37AM +0200, Daniele Palmas wrote:
> option driver, added VID/PID for Telit LE910 modem. Interfaces description
> is almost the same than LE920, except that the qmi interface is number 2
> (instead than 5).
> 
> Signed-off-by: Daniele Palmas 

Applied, thanks.

Johan

> ---
>  drivers/usb/serial/option.c |8 
>  1 files changed, 8 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> index d1a3f60..19280a3 100644
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -269,6 +269,7 @@ static void option_instat_callback(struct urb *urb);
>  #define TELIT_PRODUCT_DE910_DUAL 0x1010
>  #define TELIT_PRODUCT_UE910_V2   0x1012
>  #define TELIT_PRODUCT_LE920  0x1200
> +#define TELIT_PRODUCT_LE910  0x1201
>  
>  /* ZTE PRODUCTS */
>  #define ZTE_VENDOR_ID0x19d2
> @@ -589,6 +590,11 @@ static const struct option_blacklist_info 
> zte_1255_blacklist = {
>   .reserved = BIT(3) | BIT(4),
>  };
>  
> +static const struct option_blacklist_info telit_le910_blacklist = {
> + .sendsetup = BIT(0),
> + .reserved = BIT(1) | BIT(2),
> +};
> +
>  static const struct option_blacklist_info telit_le920_blacklist = {
>   .sendsetup = BIT(0),
>   .reserved = BIT(1) | BIT(5),
> @@ -1138,6 +1144,8 @@ static const struct usb_device_id option_ids[] = {
>   { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_CC864_SINGLE) },
>   { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_DE910_DUAL) },
>   { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_UE910_V2) },
> + { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE910),
> + .driver_info = (kernel_ulong_t)&telit_le910_blacklist },
>   { USB_DEVICE(TELIT_VENDOR_ID, TELIT_PRODUCT_LE920),
>   .driver_info = (kernel_ulong_t)&telit_le920_blacklist },
>   { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_MF622, 0xff, 
> 0xff, 0xff) }, /* ZTE WCDMA products */
--
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: serial: ftdi_sio: add Awinda Station and Dongle products

2014-10-22 Thread Johan Hovold
On Fri, Oct 10, 2014 at 11:52:08AM +0200, Frans Klaver wrote:
> Add new IDs for the Xsens Awinda Station and Awinda Dongle.
> 
> While at it, order the definitions by PID and add a logical separation
> between devices using Xsens' VID and those using FTDI's VID.
> 
> Cc: 
> Signed-off-by: Frans Klaver 
> ---
> Third time's a charm.

Applied, thanks.

Johan

>  drivers/usb/serial/ftdi_sio.c | 2 ++
>  drivers/usb/serial/ftdi_sio_ids.h | 6 +-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
> index dc72b92..1f73ca3 100644
> --- a/drivers/usb/serial/ftdi_sio.c
> +++ b/drivers/usb/serial/ftdi_sio.c
> @@ -661,6 +661,8 @@ static const struct usb_device_id id_table_combined[] = {
>   { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_5_PID) },
>   { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_6_PID) },
>   { USB_DEVICE(FTDI_VID, XSENS_CONVERTER_7_PID) },
> + { USB_DEVICE(XSENS_VID, XSENS_AWINDA_DONGLE_PID) },
> + { USB_DEVICE(XSENS_VID, XSENS_AWINDA_STATION_PID) },
>   { USB_DEVICE(XSENS_VID, XSENS_CONVERTER_PID) },
>   { USB_DEVICE(XSENS_VID, XSENS_MTW_PID) },
>   { USB_DEVICE(FTDI_VID, FTDI_OMNI1509) },
> diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
> b/drivers/usb/serial/ftdi_sio_ids.h
> index 5937b2d..b68084c 100644
> --- a/drivers/usb/serial/ftdi_sio_ids.h
> +++ b/drivers/usb/serial/ftdi_sio_ids.h
> @@ -143,8 +143,12 @@
>   * Xsens Technologies BV products (http://www.xsens.com).
>   */
>  #define XSENS_VID0x2639
> -#define XSENS_CONVERTER_PID  0xD00D  /* Xsens USB-serial converter */
> +#define XSENS_AWINDA_STATION_PID 0x0101
> +#define XSENS_AWINDA_DONGLE_PID 0x0102
>  #define XSENS_MTW_PID0x0200  /* Xsens MTw */
> +#define XSENS_CONVERTER_PID  0xD00D  /* Xsens USB-serial converter */
> +
> +/* Xsens devices using FTDI VID */
>  #define XSENS_CONVERTER_0_PID0xD388  /* Xsens USB converter */
>  #define XSENS_CONVERTER_1_PID0xD389  /* Xsens Wireless Receiver */
>  #define XSENS_CONVERTER_2_PID0xD38A
--
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] option: add Haier CE81B CDMA modem

2014-10-22 Thread Johan Hovold
On Tue, Oct 14, 2014 at 11:10:41AM -0500, Dan Williams wrote:
> Port layout:
> 
> 0: QCDM/DIAG
> 1: NMEA
> 2: AT
> 3: AT/PPP
> 
> Signed-off-by: Dan Williams 
> ---
>  drivers/usb/serial/option.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> index d1a3f60..8d8764d 100644
> --- a/drivers/usb/serial/option.c
> +++ b/drivers/usb/serial/option.c
> @@ -358,14 +358,15 @@ static void option_instat_callback(struct urb *urb);
>  #define ZOOM_PRODUCT_45970x9607
>  
>  /* SpeedUp SU9800 usb 3g modem */
>  #define SPEEDUP_PRODUCT_SU9800   0x9800
>  
>  /* Haier products */
>  #define HAIER_VENDOR_ID  0x201e
> +#define HAIER_PRODUCT_CE81B  0x10f8
>  #define HAIER_PRODUCT_CE100  0x2009
>  
>  /* Cinterion (formerly Siemens) products */
>  #define SIEMENS_VENDOR_ID0x0681
>  #define CINTERION_VENDOR_ID  0x1e2d
>  #define CINTERION_PRODUCT_HC25_MDM   0x0047
>  #define CINTERION_PRODUCT_HC25_MDMNET0x0040
> @@ -1616,14 +1617,15 @@ static const struct usb_device_id option_ids[] = {
>   { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
>   { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
>   },
>   { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 
> SPEEDUP_PRODUCT_SU9800, 0xff) },
>   { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
>   { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
> + { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 
> 0xff, 0xff, 0xff) },
>   { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },

Please, try to keep the id-table entries sorted alphabetically by the
define names (if possible). Fixed it up here and applied.

Thanks,
Johan

>   /* Pirelli  */
>   { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 
> 0xff) },
>   { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 
> 0xff) },
>   { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1004, 
> 0xff) },
>   { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1005, 
> 0xff) },
>   { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1006, 
> 0xff) },
--
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: kobil_sct: Remove unused transfer buffer allocs

2014-10-22 Thread Johan Hovold
On Thu, Oct 16, 2014 at 01:59:22PM -0400, Peter Hurley wrote:
> Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
> "USB: kobil_sct: fix control requests without data stage", removed

checkpatch.pl complains on your commit-reference style so you know.

> the bogus data buffer arguments, but still allocate transfer
> buffers which are not used.
> 
> Cc: Johan Hovold 
> Signed-off-by: Peter Hurley 

Applied now.

Thanks,
Johan

> ---
>  drivers/usb/serial/kobil_sct.c | 15 ---
>  1 file changed, 15 deletions(-)
> 
> diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
> index 078f9ed..3d2bd65 100644
> --- a/drivers/usb/serial/kobil_sct.c
> +++ b/drivers/usb/serial/kobil_sct.c
> @@ -414,8 +414,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
>   int result;
>   int dtr = 0;
>   int rts = 0;
> - unsigned char *transfer_buffer;
> - int transfer_buffer_length = 8;
>  
>   /* FIXME: locking ? */
>   priv = usb_get_serial_port_data(port);
> @@ -425,11 +423,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
>   return -EINVAL;
>   }
>  
> - /* allocate memory for transfer buffer */
> - transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
> - if (!transfer_buffer)
> - return -ENOMEM;
> -
>   if (set & TIOCM_RTS)
>   rts = 1;
>   if (set & TIOCM_DTR)
> @@ -469,7 +462,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
>   KOBIL_TIMEOUT);
>   }
>   dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, 
> result);
> - kfree(transfer_buffer);
>   return (result < 0) ? result : 0;
>  }
>  
> @@ -530,8 +522,6 @@ static int kobil_ioctl(struct tty_struct *tty,
>  {
>   struct usb_serial_port *port = tty->driver_data;
>   struct kobil_private *priv = usb_get_serial_port_data(port);
> - unsigned char *transfer_buffer;
> - int transfer_buffer_length = 8;
>   int result;
>  
>   if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
> @@ -541,10 +531,6 @@ static int kobil_ioctl(struct tty_struct *tty,
>  
>   switch (cmd) {
>   case TCFLSH:
> - transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL);
> - if (!transfer_buffer)
> - return -ENOBUFS;
> -
>   result = usb_control_msg(port->serial->dev,
> usb_sndctrlpipe(port->serial->dev, 0),
> SUSBCRequest_Misc,
> @@ -559,7 +545,6 @@ static int kobil_ioctl(struct tty_struct *tty,
>   dev_dbg(&port->dev,
>   "%s - Send reset_all_queues (FLUSH) URB returns: %i\n",
>   __func__, result);
> - kfree(transfer_buffer);
>   return (result < 0) ? -EIO: 0;
>   default:
>   return -ENOIOCTLCMD;
--
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] serial: Fix Entrega company name spelling

2014-10-22 Thread Johan Hovold
On Sat, Oct 04, 2014 at 12:19:59PM +0100, Mark Knibbs wrote:
> Hi,
> 
> Patch v2 change: Fix spelling in usb-serial.txt too.

Since everything you put here ends up in the commit message body, you
should keep any greetings or changelog under the cut-off line below.

Fixed it up and applied to next.

Thanks,
Johan

> Entrega is misspelled as Entregra or Entrgra, so fix that.
> 
> Signed-off-by: Mark Knibbs 
> 
> ---
> diff -uprN linux-3.17-rc7 linux-3.17-rc7.new
> diff -uprN linux-3.17-rc7/Documentation/usb/usb-serial.txt 
> linux-3.17-rc7.new/Documentation/usb/usb-serial.txt
> --- linux-3.17-rc7/Documentation/usb/usb-serial.txt   2014-09-28 
> 22:29:07.0 +0100
> +++ linux-3.17-rc7.new/Documentation/usb/usb-serial.txt   2014-10-04 
> 12:12:43.0 +0100
> @@ -145,7 +145,7 @@ Keyspan PDA Serial Adapter
>Single port DB-9 serial adapter, pushed as a PDA adapter for iMacs (mostly
>sold in Macintosh catalogs, comes in a translucent white/green dongle).
>Fairly simple device. Firmware is homebrew.
> -  This driver also works for the Xircom/Entrgra single port serial adapter.
> +  This driver also works for the Xircom/Entrega single port serial adapter.
>  
>Current status:
> Things that work:
> diff -uprN linux-3.17-rc7/drivers/usb/serial/Kconfig 
> linux-3.17-rc7.new/drivers/usb/serial/Kconfig
> --- linux-3.17-rc7/drivers/usb/serial/Kconfig 2014-09-28 22:29:07.0 
> +0100
> +++ linux-3.17-rc7.new/drivers/usb/serial/Kconfig 2014-10-04 
> 11:36:16.0 +0100
> @@ -604,10 +604,10 @@ config USB_SERIAL_CYBERJACK
> If unsure, say N.
>  
>  config USB_SERIAL_XIRCOM
> - tristate "USB Xircom / Entregra Single Port Serial Driver"
> + tristate "USB Xircom / Entrega Single Port Serial Driver"
>   select USB_EZUSB_FX2
>   help
> -   Say Y here if you want to use a Xircom or Entregra single port USB to
> +   Say Y here if you want to use a Xircom or Entrega single port USB to
> serial converter device.  This driver makes use of firmware
> developed from scratch by Brian Warner.
>  
> diff -uprN linux-3.17-rc7/drivers/usb/serial/keyspan_pda.c 
> linux-3.17-rc7.new/drivers/usb/serial/keyspan_pda.c
> --- linux-3.17-rc7/drivers/usb/serial/keyspan_pda.c   2014-09-28 
> 22:29:07.0 +0100
> +++ linux-3.17-rc7.new/drivers/usb/serial/keyspan_pda.c   2014-10-04 
> 11:43:34.0 +0100
> @@ -1,5 +1,5 @@
>  /*
> - * USB Keyspan PDA / Xircom / Entregra Converter driver
> + * USB Keyspan PDA / Xircom / Entrega Converter driver
>   *
>   * Copyright (C) 1999 - 2001 Greg Kroah-Hartman  
>   * Copyright (C) 1999, 2000 Brian Warner 
> @@ -58,11 +58,11 @@ struct keyspan_pda_private {
>  #define KEYSPAN_PDA_FAKE_ID  0x0103
>  #define KEYSPAN_PDA_ID   0x0104 /* no clue */
>  
> -/* For Xircom PGSDB9 and older Entregra version of the same device */
> +/* For Xircom PGSDB9 and older Entrega version of the same device */
>  #define XIRCOM_VENDOR_ID 0x085a
>  #define XIRCOM_FAKE_ID   0x8027
> -#define ENTREGRA_VENDOR_ID   0x1645
> -#define ENTREGRA_FAKE_ID 0x8093
> +#define ENTREGA_VENDOR_ID0x1645
> +#define ENTREGA_FAKE_ID  0x8093
>  
>  static const struct usb_device_id id_table_combined[] = {
>  #ifdef KEYSPAN
> @@ -70,7 +70,7 @@ static const struct usb_device_id id_tab
>  #endif
>  #ifdef XIRCOM
>   { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
> - { USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
> + { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
>  #endif
>   { USB_DEVICE(KEYSPAN_VENDOR_ID, KEYSPAN_PDA_ID) },
>   { } /* Terminating entry */
> @@ -93,7 +93,7 @@ static const struct usb_device_id id_tab
>  #ifdef XIRCOM
>  static const struct usb_device_id id_table_fake_xircom[] = {
>   { USB_DEVICE(XIRCOM_VENDOR_ID, XIRCOM_FAKE_ID) },
> - { USB_DEVICE(ENTREGRA_VENDOR_ID, ENTREGRA_FAKE_ID) },
> + { USB_DEVICE(ENTREGA_VENDOR_ID, ENTREGA_FAKE_ID) },
>   { }
>  };
>  #endif
> @@ -667,7 +667,7 @@ static int keyspan_pda_fake_startup(stru
>  #endif
>  #ifdef XIRCOM
>   else if ((le16_to_cpu(serial->dev->descriptor.idVendor) == 
> XIRCOM_VENDOR_ID) ||
> -  (le16_to_cpu(serial->dev->descriptor.idVendor) == 
> ENTREGRA_VENDOR_ID))
> +  (le16_to_cpu(serial->dev->descriptor.idVendor) == 
> ENTREGA_VENDOR_ID))
>   fw_name = "keyspan_pda/xircom_pgs.fw";
>  #endif
>   else {
> @@ -744,7 +744,7 @@ static struct usb_serial_driver xircom_p
>   .owner =THIS_MODULE,
>   .name = "xircom_no_firm",
>   },
> - .description =  "Xircom / Entregra PGS - (prerenumeration)",
> + .description =  "Xircom / Entrega PGS - (prerenumeration)",
>   .id_table = id_table_fake_xircom,
>   .num_ports =1,
>   .attach = 

Re: [PATCH] usb: serial: Fix indentation style issue

2014-10-22 Thread Johan Hovold
On Sat, Oct 11, 2014 at 07:20:49AM -0700, Greg Kroah-Hartman wrote:
> On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
> > Fix a style issue
> > 
> > Signed-off-by: Philip Munksgaard 
> > ---
> >  drivers/usb/serial/option.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > index d1a3f60..d88998d 100644
> > --- a/drivers/usb/serial/option.c
> > +++ b/drivers/usb/serial/option.c
> > @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = {
> > { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
> > { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> >   .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
> > -   },
> > +   },
> 
> Why not fix the same 'space' issue on the line before this at the same
> time?

And what about the remaining white-space issues in this file? Do we
really want to go down this path?

I could take a patch fixing them all at once (this time). It's you
who'll have to deal with the changed contexts when back porting device
ids, Greg. ;)

Johan
--
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: kobil_sct: Remove unused transfer buffer allocs

2014-10-22 Thread Peter Hurley
On 10/22/2014 04:20 AM, Johan Hovold wrote:
> On Thu, Oct 16, 2014 at 01:59:22PM -0400, Peter Hurley wrote:
>> Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
>> "USB: kobil_sct: fix control requests without data stage", removed
> 
> checkpatch.pl complains on your commit-reference style so you know.

Thanks for letting me know.

Joe,

Why is checkpatch complaining about the commit reference above?

$ ./scripts/checkpatch.pl 
../patches/fixes-3.18/0001-USB-kobil_sct-Remove-unused-transfer-buffer-allocs.patch
 
ERROR: Please use 12 or more chars for the git commit ID like: 'Commit 
90419cfcb5d9 ("USB: kobil_sct: fix control requests without data stage")'
#6: 
Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,

total: 1 errors, 0 warnings, 51 lines checked


>> the bogus data buffer arguments, but still allocate transfer
>> buffers which are not used.
>>
>> Cc: Johan Hovold 
>> Signed-off-by: Peter Hurley 
> 
> Applied now.
> 
> Thanks,
> Johan

--
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: [PATCHv5 2/7] usb: dwc2: Move gadget probe function into platform code

2014-10-22 Thread Bartlomiej Zolnierkiewicz

Hi,

On Monday, October 20, 2014 01:52:01 PM dingu...@opensource.altera.com wrote:
> From: Dinh Nguyen 
> 
> This patch will aggregate the probing of gadget/hcd driver into platform.c.
> The gadget probe funtion is converted into gadget_init that is now only
> responsible for gadget only initialization. All the gadget resources is now
> handled by platform.c
> 
> Since the host workqueue will not get initialized if the driver is configured
> for peripheral mode only. Thus we need to check for wq_otg before calling
> queue_work().
> 
> Also, we move spin_lock_init to common location for both host and gadget that
> is either in platform.c or pci.c.
> 
> We also ove suspend/resume code to common platform code, and update it to use
> the new PM API (struct dev_pm_ops).
> 
> Lastly, move the "samsung,s3c6400-hsotg" binding into dwc2_of_match_table.

This patch seems to break bisectability.  It moves all the gadget probing
to platform.c but Kconfig/Makefile are not updated (platform.c will be
compiled only for CONFIG_USB_DWC2_PLATFORM=y which in turn depends on
CONFIG_USB_DWC2_HOST).  IMO patch #7 should be merged into this one (#2).

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

> Signed-off-by: Dinh Nguyen 
> Acked-by: Paul Zimmerman 
> ---
> v5: Reworked by squashing the following commits into this one:
> * [PATCHv4 02/12] usb: dwc2: move "samsung,s3c6400-hsotg" into common platform
> * [PATCHv4 03/12] usb: dwc2: Update the gadget driver to use common dwc2_hsotg
>   structure
> * [PATCHv4 09/12] usb: dwc2: initialize the spin_lock for both host and gadget
> * [PATCHv4 10/12] usb: dwc2: Add suspend/resume for gadget
> * [PATCHv4 11/12] usb: dwc2: check that the host work queue is valid
> Also use IS_ENABLED instead of #if defined
> ---
>  drivers/usb/dwc2/core.h  | 34 +++-
>  drivers/usb/dwc2/core_intr.c |  8 ++--
>  drivers/usb/dwc2/gadget.c| 97 
> +---
>  drivers/usb/dwc2/hcd.c   |  1 -
>  drivers/usb/dwc2/hcd.h   | 10 -
>  drivers/usb/dwc2/pci.c   |  1 +
>  drivers/usb/dwc2/platform.c  | 32 +++
>  7 files changed, 91 insertions(+), 92 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 5412f57..b21aace 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -667,7 +667,6 @@ struct dwc2_hsotg {
>   struct usb_phy *uphy;
>   struct s3c_hsotg_plat *plat;
>  
> - int irq;
>   struct clk *clk;
>  
>   struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
> @@ -961,4 +960,37 @@ extern void dwc2_dump_global_registers(struct dwc2_hsotg 
> *hsotg);
>   */
>  extern u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg);
>  
> +/* Gadget defines */
> +#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || 
> IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
> +extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
> +extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
> +extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
> +extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
> +#else
> +static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
> +{ return 0; }
> +static inline int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2)
> +{ return 0; }
> +static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
> +{ return 0; }
> +static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
> +{ return 0; }
> +#endif
> +
> +#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
> +extern int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg);
> +extern void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg);
> +extern void dwc2_hcd_start(struct dwc2_hsotg *hsotg);
> +#else
> +static inline void dwc2_set_all_params(struct dwc2_core_params *params, int 
> value) {}
> +static inline int dwc2_hcd_get_frame_number(struct dwc2_hsotg *hsotg)
> +{ return 0; }
> +static inline void dwc2_hcd_disconnect(struct dwc2_hsotg *hsotg) {}
> +static inline void dwc2_hcd_start(struct dwc2_hsotg *hsotg) {}
> +static inline void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) {}
> +static inline int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq,
> + const struct dwc2_core_params *params)
> +{ return 0; }
> +#endif
> +
>  #endif /* __DWC2_CORE_H__ */
> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
> index c93918b..b176c2f 100644
> --- a/drivers/usb/dwc2/core_intr.c
> +++ b/drivers/usb/dwc2/core_intr.c
> @@ -287,9 +287,11 @@ static void 
> dwc2_handle_conn_id_status_change_intr(struct dwc2_hsotg *hsotg)
>* Release lock before scheduling workq as it holds spinlock during
>* scheduling.
>*/
> - spin_unlock(&hsotg->lock);
> - queue_work(hsotg->wq_otg, &hsotg->wf_otg);
> - spin_lock(&hsotg->lock);
> + if (hsotg->wq_otg) {
> + spin_unlock(&hsotg->lock);
> + queue_work(hsotg->wq_otg, &

HP switch USB serial console

2014-10-22 Thread Andreas Sundstrom
Some newer switch models from HP has a usb2serial port in them.
I just got to try one out and it sort of works with the generic
usbserial driver.

The problem I am seeing is that it always use 9600 bps, even if I
specify 115200 or 19200.

Is it possible to troubleshoot this in any way, I can test patches if
needed.
This is on a vanilla 3.17.1 kernel.

Here are the details:
modprobe usbserial vendor=0x3f0 product=0x13f

[  188.018495] usbcore: registered new interface driver usbserial
[  188.018522] usbcore: registered new interface driver usbserial_generic
[  188.018547] usbserial: USB Serial support registered for generic
[  188.018575] usbserial_generic 3-2:1.0: Generic device with no bulk
out, not allowed.
[  188.018591] usbserial_generic: probe of 3-2:1.0 failed with error -5
[  188.018607] usbserial_generic 3-2:1.1: The "generic" usb-serial
driver is only for testing and one-off prototypes.
[  188.018612] usbserial_generic 3-2:1.1: Tell linux-usb@vger.kernel.org
to add your device to a proper driver.
[  188.018617] usbserial_generic 3-2:1.1: generic converter detected
[  188.018828] usb 3-2: generic converter now attached to ttyUSB0

root@computer:/tmp# lsusb -vvv -d 03f0:013f

Bus 003 Device 003: ID 03f0:013f Hewlett-Packard
Device Descriptor:
  bLength18
  bDescriptorType 1
  bcdUSB   2.00
  bDeviceClass  239 Miscellaneous Device
  bDeviceSubClass 2 ?
  bDeviceProtocol 1 Interface Association
  bMaxPacketSize064
  idVendor   0x03f0 Hewlett-Packard
  idProduct  0x013f
  bcdDevice0.01
  iManufacturer   1 HP
  iProduct2 HPN Serial Port
  iSerial 3 A7735230001
  bNumConfigurations  1
  Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength   75
bNumInterfaces  2
bConfigurationValue 1
iConfiguration  0
bmAttributes 0x20
  (Missing must-be-set bit!)
  (Bus Powered)
  Remote Wakeup
MaxPower  100mA
Interface Association:
  bLength 8
  bDescriptorType11
  bFirstInterface 0
  bInterfaceCount 2
  bFunctionClass  2 Communications
  bFunctionSubClass   2 Abstract (modem)
  bFunctionProtocol   0 None
  iFunction   0
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber0
  bAlternateSetting   0
  bNumEndpoints   1
  bInterfaceClass 2 Communications
  bInterfaceSubClass  2 Abstract (modem)
  bInterfaceProtocol  1 AT-commands (v.25ter)
  iInterface  0
  CDC Header:
bcdCDC   1.10
  CDC ACM:
bmCapabilities   0x06
  sends break
  line coding and serial state
  CDC Union:
bMasterInterface0
bSlaveInterface 1
  CDC Call Management:
bmCapabilities   0x01
  call management
bDataInterface  1
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x85  EP 5 IN
bmAttributes3
  Transfer TypeInterrupt
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   2
Interface Descriptor:
  bLength 9
  bDescriptorType 4
  bInterfaceNumber1
  bAlternateSetting   0
  bNumEndpoints   2
  bInterfaceClass10 CDC Data
  bInterfaceSubClass  0 Unused
  bInterfaceProtocol  0
  iInterface  0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x01  EP 1 OUT
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
  Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81  EP 1 IN
bmAttributes2
  Transfer TypeBulk
  Synch Type   None
  Usage Type   Data
wMaxPacketSize 0x0040  1x 64 bytes
bInterval   0
Device Status: 0x
  (Bus Powered)


Thanks for any help
/Andreas
--
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: kobil_sct: Remove unused transfer buffer allocs

2014-10-22 Thread Peter Hurley
On 10/19/2014 01:12 PM, Johan Hovold wrote:
> [ +CC: Jiri, Alan, linux-serial ]
> 
> On Thu, Oct 16, 2014 at 02:09:29PM -0400, Peter Hurley wrote:
>> On 10/16/2014 01:59 PM, Peter Hurley wrote:
>>> Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
>>> "USB: kobil_sct: fix control requests without data stage", removed
>>> the bogus data buffer arguments, but still allocate transfer
>>> buffers which are not used.
>>>
>>> Cc: Johan Hovold 
>>> Signed-off-by: Peter Hurley 
>>> ---
>>>  drivers/usb/serial/kobil_sct.c | 15 ---
>>>  1 file changed, 15 deletions(-)
>>>
>>> diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c
>>> index 078f9ed..3d2bd65 100644
>>> --- a/drivers/usb/serial/kobil_sct.c
>>> +++ b/drivers/usb/serial/kobil_sct.c
>>> @@ -414,8 +414,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
>>> int result;
>>> int dtr = 0;
>>> int rts = 0;
>>> -   unsigned char *transfer_buffer;
>>> -   int transfer_buffer_length = 8;
>>>  
>>> /* FIXME: locking ? */
>>> priv = usb_get_serial_port_data(port);
>>> @@ -425,11 +423,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
>>> return -EINVAL;
>>> }
>>>  
>>> -   /* allocate memory for transfer buffer */
>>> -   transfer_buffer = kzalloc(transfer_buffer_length, GFP_KERNEL);
>>> -   if (!transfer_buffer)
>>> -   return -ENOMEM;
>>> -
>>> if (set & TIOCM_RTS)
>>> rts = 1;
>>> if (set & TIOCM_DTR)
>>> @@ -469,7 +462,6 @@ static int kobil_tiocmset(struct tty_struct *tty,
>>> KOBIL_TIMEOUT);
>>> }
>>> dev_dbg(dev, "%s - Send set_status_line URB returns: %i\n", __func__, 
>>> result);
>>> -   kfree(transfer_buffer);
>>> return (result < 0) ? result : 0;
>>>  }
>>>  
>>> @@ -530,8 +522,6 @@ static int kobil_ioctl(struct tty_struct *tty,
>>>  {
>>> struct usb_serial_port *port = tty->driver_data;
>>> struct kobil_private *priv = usb_get_serial_port_data(port);
>>> -   unsigned char *transfer_buffer;
>>> -   int transfer_buffer_length = 8;
>>> int result;
>>>  
>>> if (priv->device_type == KOBIL_USBTWIN_PRODUCT_ID ||
>>> @@ -541,10 +531,6 @@ static int kobil_ioctl(struct tty_struct *tty,
>>>  
>>> switch (cmd) {
>>> case TCFLSH:
>>> -   transfer_buffer = kmalloc(transfer_buffer_length, GFP_KERNEL);
>>> -   if (!transfer_buffer)
>>> -   return -ENOBUFS;
>>> -
>>> result = usb_control_msg(port->serial->dev,
>>>   usb_sndctrlpipe(port->serial->dev, 0),
>>>   SUSBCRequest_Misc,
>>> @@ -559,7 +545,6 @@ static int kobil_ioctl(struct tty_struct *tty,
>>> dev_dbg(&port->dev,
>>> "%s - Send reset_all_queues (FLUSH) URB returns: %i\n",
>>> __func__, result);
>>> -   kfree(transfer_buffer);
>>> return (result < 0) ? -EIO: 0;
>>^^^
>> Returning 0 is almost certainly wrong; no further processing for
>> TCFLSH is performed.
> 
> Indeed.
> 
>> Only this driver returns 0 (of all the tty drivers in mainline).
>>
>> Returning -ENOIOCTLCMD allows further processing to continue;
>> especially the line discipline's input flushing, if TCIFLUSH/TCIOFLUSH.
> 
> That doesn't seem like a very good idea, and only two *staging* drivers
> try to play such games (i.e. pretending not to implement the ioctl) as
> far as I can see.

Well, returning EIONOCTLCMD is the standard method of ioctl passthrough
from driver to line discipline.

Since driver 'input buffer' flushing is not currently supported by the
core, this seems the only available workaround.

> The only non-staging tty driver which appears to implement TCFLSH,
> ipwireless, calls tty_perform_flush directly to flush the ldisc buffers.
> That doesn't seem right either.

I'm not sure why ipwireless does this; I can only guess that it's a
workaround for some line discipline that doesn't use n_tty_ioctl_helper().

> Shouldn't this be fixed by removing TCFLSH from these tty drivers'
> ioctl callbacks and implementing flush_buffer()?
>
> The staging drivers also flush a device input buffer, which could be
> done in a new callback if at all needed.

Yeah, that's why the Digi staging drivers are trapping TCFLSH; so they
can clear input buffers on TCIFLUSH/TCIOFLUSH.

I'd like to better understand the hardware and driver before extending
the core interface; this driver may not even run.

For example, this driver clears its 'input buffer' for
tcsetattr(TCSADRAIN or TCSAFLUSH). But that doesn't make sense considering
that the flip buffers could have data in them that isn't flushed; the tty
core doesn't dump the flip buffers because 'input processing' has not
happened on that data.

I think when/if these drivers are promoted is when/if the core interface
should address this. Just my opinion, though :)

>> Is it trying to avoid the tty_driver_flush_buffer() because it doesn't
>> have an output bu

Re: [PATCH v2 2/4] phy: exynos5-usbdrd: Add pipe-clk and utmi-clk support

2014-10-22 Thread Kishon Vijay Abraham I
Hi,

On Tuesday 07 October 2014 03:49 PM, Vivek Gautam wrote:
> Exynos7 SoC has now separate gate control for 125MHz pipe3 phy
> clock, as well as 60MHz utmi phy clock.
> So get the same and control in the phy-exynos5-usbdrd driver.
> 
> Signed-off-by: Vivek Gautam 
> ---
>  .../devicetree/bindings/phy/samsung-phy.txt|4 
>  drivers/phy/phy-exynos5-usbdrd.c   |   22 
> 
>  2 files changed, 26 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/phy/samsung-phy.txt 
> b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> index 15e0f2c..c2bc9dc 100644
> --- a/Documentation/devicetree/bindings/phy/samsung-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/samsung-phy.txt
> @@ -138,6 +138,10 @@ Required properties:
>  PHY operations, associated by phy name. It is used to
>  determine bit values for clock settings register.
>  For Exynos5420 this is given as 'sclk_usbphy30' in CMU.
> + - optional clocks: Exynos7 SoC has now following additional
> +gate clocks available:
> +- phy_pipe: for PIPE3 phy
> +- phy_utmi: for UTMI+ phy
>  - samsung,pmu-syscon: phandle for PMU system controller interface, used to
> control pmu registers for power isolation.
>  - #phy-cells : from the generic PHY bindings, must be 1;
> diff --git a/drivers/phy/phy-exynos5-usbdrd.c 
> b/drivers/phy/phy-exynos5-usbdrd.c
> index f756aca..013ee84 100644
> --- a/drivers/phy/phy-exynos5-usbdrd.c
> +++ b/drivers/phy/phy-exynos5-usbdrd.c
> @@ -148,6 +148,8 @@ struct exynos5_usbdrd_phy_drvdata {
>   * @dev: pointer to device instance of this platform device
>   * @reg_phy: usb phy controller register memory base
>   * @clk: phy clock for register access
> + * @pipeclk: clock for pipe3 phy
> + * @utmiclk: clock for utmi+ phy
>   * @drv_data: pointer to SoC level driver data structure
>   * @phys[]: array for 'EXYNOS5_DRDPHYS_NUM' number of PHY
>   *   instances each with its 'phy' and 'phy_cfg'.
> @@ -161,6 +163,8 @@ struct exynos5_usbdrd_phy {
>   struct device *dev;
>   void __iomem *reg_phy;
>   struct clk *clk;
> + struct clk *pipeclk;
> + struct clk *utmiclk;
>   const struct exynos5_usbdrd_phy_drvdata *drv_data;
>   struct phy_usb_instance {
>   struct phy *phy;
> @@ -446,6 +450,8 @@ static int exynos5_usbdrd_phy_power_on(struct phy *phy)
>  
>   dev_dbg(phy_drd->dev, "Request to power_on usbdrd_phy phy\n");
>  
> + clk_prepare_enable(phy_drd->utmiclk);
> + clk_prepare_enable(phy_drd->pipeclk);

We can have a separate function for powering on/off usb3 phy and usb2 phy
independently. That way if the USB controller is operating only on high speed
mode, the pipe clock need not be enabled at all.

I think we should create separate PHYs (phy_create) for usb2 phy and usb3 phy
here. Please refer how Lee Jones did that for miphy365x modelling each PHY as a
child node to the PHY provider and doing phy_create for each child node.

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


[PATCH 1/3] usb: chipidea: remove flag CI_HDRC_REQUIRE_TRANSCEIVER

2014-10-22 Thread Peter Chen
Now, USB PHY is mandatory for chipidea core, the flag
CI_HDRC_REQUIRE_TRANSCEIVER is useless.

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/ci_hdrc_imx.c |3 +--
 drivers/usb/chipidea/ci_hdrc_msm.c |1 -
 include/linux/usb/chipidea.h   |1 -
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index aa66199..5341fe7 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -106,8 +106,7 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev)
struct ci_hdrc_platform_data pdata = {
.name   = dev_name(&pdev->dev),
.capoffset  = DEF_CAPOFFSET,
-   .flags  = CI_HDRC_REQUIRE_TRANSCEIVER |
- CI_HDRC_DISABLE_STREAMING,
+   .flags  = CI_HDRC_DISABLE_STREAMING,
};
int ret;
const struct of_device_id *of_id =
diff --git a/drivers/usb/chipidea/ci_hdrc_msm.c 
b/drivers/usb/chipidea/ci_hdrc_msm.c
index 4935ac3..74dcb3d 100644
--- a/drivers/usb/chipidea/ci_hdrc_msm.c
+++ b/drivers/usb/chipidea/ci_hdrc_msm.c
@@ -46,7 +46,6 @@ static struct ci_hdrc_platform_data ci_hdrc_msm_platdata = {
.name   = "ci_hdrc_msm",
.capoffset  = DEF_CAPOFFSET,
.flags  = CI_HDRC_REGS_SHARED |
- CI_HDRC_REQUIRE_TRANSCEIVER |
  CI_HDRC_DISABLE_STREAMING,
 
.notify_event   = ci_hdrc_msm_notify_event,
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index e14c09a..f37781c 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -17,7 +17,6 @@ struct ci_hdrc_platform_data {
enum usb_phy_interface phy_mode;
unsigned longflags;
 #define CI_HDRC_REGS_SHAREDBIT(0)
-#define CI_HDRC_REQUIRE_TRANSCEIVERBIT(1)
 #define CI_HDRC_DISABLE_STREAMING  BIT(3)
/*
 * Only set it when DCCPARAMS.DC==1 and DCCPARAMS.HC==1,
-- 
1.7.9.5

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


[PATCH 2/3] usb: chipidea: add controller reset API

2014-10-22 Thread Peter Chen
Add controller reset API, it may be used for host/otg driver in future.

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |   26 +++---
 1 file changed, 23 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 466ddf4..1a6d8c9 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -341,6 +341,28 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
 }
 
 /**
+ * hw_controller_reset: do controller reset
+ * @ci: the controller
+  *
+ * This function returns an error code
+ */
+static int hw_controller_reset(struct ci_hdrc *ci)
+{
+   int count = 0;
+
+   hw_write(ci, OP_USBCMD, USBCMD_RST, USBCMD_RST);
+   while (hw_read(ci, OP_USBCMD, USBCMD_RST)) {
+   udelay(10);
+   if (count++ > 1000) {
+   dev_err(ci->dev, "timeout for reset\n");
+   return -ETIMEDOUT;
+   }
+   }
+
+   return 0;
+}
+
+/**
  * hw_device_reset: resets chip (execute without interruption)
  * @ci: the controller
   *
@@ -352,9 +374,7 @@ int hw_device_reset(struct ci_hdrc *ci, u32 mode)
hw_write(ci, OP_ENDPTFLUSH, ~0, ~0);
hw_write(ci, OP_USBCMD, USBCMD_RS, 0);
 
-   hw_write(ci, OP_USBCMD, USBCMD_RST, USBCMD_RST);
-   while (hw_read(ci, OP_USBCMD, USBCMD_RST))
-   udelay(10); /* not RTOS friendly */
+   hw_controller_reset(ci);
 
if (ci->platdata->notify_event)
ci->platdata->notify_event(ci,
-- 
1.7.9.5

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


[PATCH 3/3] usb: chipidea: parameter 'mode' isn't needed for hw_device_reset

2014-10-22 Thread Peter Chen
The hw_device_reset is dedicated to be used at device mode initializaiton,
so delete the parameter 'mode'. For host driver, the ehci driver will
all things.

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/ci.h  |2 +-
 drivers/usb/chipidea/core.c|8 
 drivers/usb/chipidea/otg_fsm.c |2 +-
 drivers/usb/chipidea/udc.c |4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index ea40626..0f56960 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -348,7 +348,7 @@ u32 hw_read_intr_enable(struct ci_hdrc *ci);
 
 u32 hw_read_intr_status(struct ci_hdrc *ci);
 
-int hw_device_reset(struct ci_hdrc *ci, u32 mode);
+int hw_device_reset(struct ci_hdrc *ci);
 
 int hw_port_test_set(struct ci_hdrc *ci, u8 mode);
 
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 1a6d8c9..6d5a691 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -368,7 +368,7 @@ static int hw_controller_reset(struct ci_hdrc *ci)
   *
  * This function returns an error code
  */
-int hw_device_reset(struct ci_hdrc *ci, u32 mode)
+int hw_device_reset(struct ci_hdrc *ci)
 {
/* should flush & stop before reset */
hw_write(ci, OP_ENDPTFLUSH, ~0, ~0);
@@ -392,12 +392,12 @@ int hw_device_reset(struct ci_hdrc *ci, u32 mode)
 
/* USBMODE should be configured step by step */
hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_IDLE);
-   hw_write(ci, OP_USBMODE, USBMODE_CM, mode);
+   hw_write(ci, OP_USBMODE, USBMODE_CM, USBMODE_CM_DC);
/* HW >= 2.3 */
hw_write(ci, OP_USBMODE, USBMODE_SLOM, USBMODE_SLOM);
 
-   if (hw_read(ci, OP_USBMODE, USBMODE_CM) != mode) {
-   pr_err("cannot enter in %s mode", ci_role(ci)->name);
+   if (hw_read(ci, OP_USBMODE, USBMODE_CM) != USBMODE_CM_DC) {
+   pr_err("cannot enter in %s device mode", ci_role(ci)->name);
pr_err("lpm = %i", ci->hw_bank.lpm);
return -ENODEV;
}
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index caaabc5..b0bba5a 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -543,7 +543,7 @@ static int ci_otg_start_host(struct otg_fsm *fsm, int on)
ci_role_start(ci, CI_ROLE_HOST);
} else {
ci_role_stop(ci);
-   hw_device_reset(ci, USBMODE_CM_DC);
+   hw_device_reset(ci);
ci_role_start(ci, CI_ROLE_GADGET);
}
mutex_lock(&fsm->lock);
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 0444d3f..ceebc6a 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1475,7 +1475,7 @@ static int ci_udc_vbus_session(struct usb_gadget 
*_gadget, int is_active)
if (gadget_ready) {
if (is_active) {
pm_runtime_get_sync(&_gadget->dev);
-   hw_device_reset(ci, USBMODE_CM_DC);
+   hw_device_reset(ci);
hw_device_state(ci, ci->ep0out->qh.dma);
usb_gadget_set_state(_gadget, USB_STATE_POWERED);
} else {
@@ -1665,7 +1665,7 @@ static int ci_udc_start(struct usb_gadget *gadget,
pm_runtime_get_sync(&ci->gadget.dev);
if (ci->vbus_active) {
spin_lock_irqsave(&ci->lock, flags);
-   hw_device_reset(ci, USBMODE_CM_DC);
+   hw_device_reset(ci);
} else {
pm_runtime_put_sync(&ci->gadget.dev);
return retval;
-- 
1.7.9.5

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


Re: [PATCH] USB: kobil_sct: Remove unused transfer buffer allocs

2014-10-22 Thread Joe Perches
On Wed, 2014-10-22 at 06:26 -0400, Peter Hurley wrote:
> On 10/22/2014 04:20 AM, Johan Hovold wrote:
> > On Thu, Oct 16, 2014 at 01:59:22PM -0400, Peter Hurley wrote:
> >> Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
> >> "USB: kobil_sct: fix control requests without data stage", removed
> > 
> > checkpatch.pl complains on your commit-reference style so you know.
> 
> Thanks for letting me know.
> 
> Joe,
> 
> Why is checkpatch complaining about the commit reference above?

> $ ./scripts/checkpatch.pl 
> ../patches/fixes-3.18/0001-USB-kobil_sct-Remove-unused-transfer-buffer-allocs.patch
>  
> ERROR: Please use 12 or more chars for the git commit ID like: 'Commit 
> 90419cfcb5d9 ("USB: kobil_sct: fix control requests without data stage")'
> #6: 
> Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,

It wants parentheses around the commit description.


--
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: kobil_sct: Remove unused transfer buffer allocs

2014-10-22 Thread Peter Hurley
On 10/22/2014 08:07 AM, Joe Perches wrote:
> On Wed, 2014-10-22 at 06:26 -0400, Peter Hurley wrote:
>> On 10/22/2014 04:20 AM, Johan Hovold wrote:
>>> On Thu, Oct 16, 2014 at 01:59:22PM -0400, Peter Hurley wrote:
 Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
 "USB: kobil_sct: fix control requests without data stage", removed
>>>
>>> checkpatch.pl complains on your commit-reference style so you know.
>>
>> Thanks for letting me know.
>>
>> Joe,
>>
>> Why is checkpatch complaining about the commit reference above?
> 
>> $ ./scripts/checkpatch.pl 
>> ../patches/fixes-3.18/0001-USB-kobil_sct-Remove-unused-transfer-buffer-allocs.patch
>>  
>> ERROR: Please use 12 or more chars for the git commit ID like: 'Commit 
>> 90419cfcb5d9 ("USB: kobil_sct: fix control requests without data stage")'
>> #6: 
>> Commit 90419cfcb5d9c889b10dc51363c56a4d394d670e,
> 
> It wants parentheses around the commit description.

Ah, ok.

--
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/4] usb: chipidea: remove the unnecessary delay after clear portsc.phcd

2014-10-22 Thread Peter Chen
The individual PHY driver should take this responsibility if it
needs to delay between clear portsc.phcd and let the phy leave
low power mode.

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 0d5e7b1..409aba3 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -195,18 +195,12 @@ static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool 
enable)
enum ci_hw_regs reg = ci->hw_bank.lpm ? OP_DEVLC : OP_PORTSC;
bool lpm = !!(hw_read(ci, reg, PORTSC_PHCD(ci->hw_bank.lpm)));
 
-   if (enable && !lpm) {
+   if (enable && !lpm)
hw_write(ci, reg, PORTSC_PHCD(ci->hw_bank.lpm),
PORTSC_PHCD(ci->hw_bank.lpm));
-   } else  if (!enable && lpm) {
+   else if (!enable && lpm)
hw_write(ci, reg, PORTSC_PHCD(ci->hw_bank.lpm),
0);
-   /* 
-* the PHY needs some time (less
-* than 1ms) to leave low power mode.
-*/
-   usleep_range(1000, 1100);
-   }
 }
 
 static int hw_device_init(struct ci_hdrc *ci, void __iomem *base)
-- 
1.7.9.5

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


[PATCH v2 3/4] usb: chipidea: add system power management support

2014-10-22 Thread Peter Chen
Add system power management support

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |   48 +++
 1 file changed, 48 insertions(+)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index ac7aa7e..466ddf4 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -745,11 +745,59 @@ static int ci_hdrc_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static void ci_controller_suspend(struct ci_hdrc *ci)
+{
+   ci_hdrc_enter_lpm(ci, true);
+
+   if (ci->transceiver)
+   usb_phy_set_suspend(ci->transceiver, 1);
+}
+
+static int ci_controller_resume(struct device *dev)
+{
+   struct ci_hdrc *ci = dev_get_drvdata(dev);
+
+   dev_dbg(dev, "at %s\n", __func__);
+
+   ci_hdrc_enter_lpm(ci, false);
+
+   if (ci->transceiver) {
+   usb_phy_set_suspend(ci->transceiver, 0);
+   usb_phy_set_wakeup(ci->transceiver, false);
+   hw_wait_phy_stable();
+   }
+
+   return 0;
+}
+
+static int ci_suspend(struct device *dev)
+{
+   struct ci_hdrc *ci = dev_get_drvdata(dev);
+
+   if (ci->wq)
+   flush_workqueue(ci->wq);
+
+   ci_controller_suspend(ci);
+
+   return 0;
+}
+
+static int ci_resume(struct device *dev)
+{
+   return ci_controller_resume(dev);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops ci_pm_ops = {
+   SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)
+};
 static struct platform_driver ci_hdrc_driver = {
.probe  = ci_hdrc_probe,
.remove = ci_hdrc_remove,
.driver = {
.name   = "ci_hdrc",
+   .pm = &ci_pm_ops,
.owner  = THIS_MODULE,
},
 };
-- 
1.7.9.5

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


[PATCH v2 0/4] chipidea: add basic system power management support

2014-10-22 Thread Peter Chen
Changes for v2:

Patch[2/4]: since we have already added hw_wait_phy_stable at ci_usb_phy_init,
the same delay after ci_usb_phy_init at probe is duplicated.

This patch set adds the basic system power management. For glue layer,
I only add it for imx which I am familar with it and have hardware for it.
For msm, it has pm management at its phy driver, zevio and pci has no
pm (clock & phy) information for its driver, so I leave these three
glue layer driver no change, I add these three glue layer users to
cc list, and will wait one month for comments.

Peter Chen (4):
  usb: chipidea: remove the unnecessary delay after clear portsc.phcd
  usb: chipidea: add hw_wait_phy_stable for getting stable status
  usb: chipidea: add system power management support
  usb: chipidea: imx: add system power management support

 drivers/usb/chipidea/ci_hdrc_imx.c |   36 
 drivers/usb/chipidea/core.c|   82 +---
 2 files changed, 102 insertions(+), 16 deletions(-)

-- 
1.7.9.5

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


[PATCH v2 4/4] usb: chipidea: imx: add system power management support

2014-10-22 Thread Peter Chen
Add basic system power management support

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/ci_hdrc_imx.c |   36 
 1 file changed, 36 insertions(+)

diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c 
b/drivers/usb/chipidea/ci_hdrc_imx.c
index 74b5b09..aa66199 100644
--- a/drivers/usb/chipidea/ci_hdrc_imx.c
+++ b/drivers/usb/chipidea/ci_hdrc_imx.c
@@ -208,6 +208,41 @@ static int ci_hdrc_imx_remove(struct platform_device *pdev)
return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int imx_controller_suspend(struct device *dev)
+{
+   struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
+
+   dev_dbg(dev, "at %s\n", __func__);
+
+   clk_disable_unprepare(data->clk);
+
+   return 0;
+}
+
+static int imx_controller_resume(struct device *dev)
+{
+   struct ci_hdrc_imx_data *data = dev_get_drvdata(dev);
+
+   dev_dbg(dev, "at %s\n", __func__);
+
+   return clk_prepare_enable(data->clk);
+}
+
+static int ci_hdrc_imx_suspend(struct device *dev)
+{
+   return imx_controller_suspend(dev);
+}
+
+static int ci_hdrc_imx_resume(struct device *dev)
+{
+   return imx_controller_resume(dev);
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops ci_hdrc_imx_pm_ops = {
+   SET_SYSTEM_SLEEP_PM_OPS(ci_hdrc_imx_suspend, ci_hdrc_imx_resume)
+};
 static struct platform_driver ci_hdrc_imx_driver = {
.probe = ci_hdrc_imx_probe,
.remove = ci_hdrc_imx_remove,
@@ -215,6 +250,7 @@ static struct platform_driver ci_hdrc_imx_driver = {
.name = "imx_usb",
.owner = THIS_MODULE,
.of_match_table = ci_hdrc_imx_dt_ids,
+   .pm = &ci_hdrc_imx_pm_ops,
 },
 };
 
-- 
1.7.9.5

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


[PATCH v2 2/4] usb: chipidea: add hw_wait_phy_stable for getting stable status

2014-10-22 Thread Peter Chen
The phy needs some delay to output the stable status from low
power mode. And for OTGSC, the status inputs are debounced
using a 1 ms time constant, so, delay 2ms for controller to get
the stable status(like vbus and id) when the phy leaves low power.

Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/core.c |   24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 409aba3..ac7aa7e 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -189,6 +189,17 @@ u8 hw_port_test_get(struct ci_hdrc *ci)
return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC);
 }
 
+static void hw_wait_phy_stable(void)
+{
+   /*
+* The phy needs some delay to output the stable status from low
+* power mode. And for OTGSC, the status inputs are debounced
+* using a 1 ms time constant, so, delay 2ms for controller to get
+* the stable status, like vbus and id when the phy leaves low power.
+*/
+   usleep_range(2000, 2500);
+}
+
 /* The PHY enters/leaves low power mode */
 static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool enable)
 {
@@ -307,7 +318,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
case USBPHY_INTERFACE_MODE_UTMIW:
case USBPHY_INTERFACE_MODE_HSIC:
ret = usb_phy_init(ci->transceiver);
-   if (ret)
+   if (!ret)
+   hw_wait_phy_stable();
+   else
return ret;
hw_phymode_configure(ci);
break;
@@ -320,6 +333,8 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
break;
default:
ret = usb_phy_init(ci->transceiver);
+   if (!ret)
+   hw_wait_phy_stable();
}
 
return ret;
@@ -620,13 +635,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "unable to init phy: %d\n", ret);
return ret;
-   } else {
-   /* 
-* The delay to sync PHY's status, the maximum delay is
-* 2ms since the otgsc uses 1ms timer to debounce the
-* PHY's input
-*/
-   usleep_range(2000, 2500);
}
 
ci->hw_bank.phys = res->start;
-- 
1.7.9.5

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


Re: [PATCH v2 3/4] usb: chipidea: add system power management support

2014-10-22 Thread Fabio Estevam
On Wed, Oct 22, 2014 at 10:18 AM, Peter Chen  wrote:


> +static const struct dev_pm_ops ci_pm_ops = {
> +   SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)
> +};

You could replace this with a single line:

static SIMPLE_DEV_PM_OPS(ci_pm_ops, ci_suspend, ci_resume);
--
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: [PATCHv5 7/7] usb: dwc2: Update Kconfig to support dual-role

2014-10-22 Thread Bartlomiej Zolnierkiewicz

Hi,

On Monday, October 20, 2014 01:52:06 PM dingu...@opensource.altera.com wrote:
> From: Dinh Nguyen 
> 
> Update DWC2 kconfig and makefile to support dual-role mode. The platform
> file will always get compiled for the case where the controller is directly
> connected to the CPU. So for loadable modules, dwc2.ko is built for host,
> peripheral, and dual-role mode. The PCI bus interface will be called
> dwc2_pci.ko and the platform interface module will be called dwc2_platform.ko.
> 
> Signed-off-by: Dinh Nguyen 
> Acked-by: Paul Zimmerman 
> ---
> v5: dwc2.ko for all modes along with dwc2_platform.ko and dwc2_pci.ko will
> get built for kernel modules.
> v3: Add USB_GADGET=y and USB_GADGET=USB_DWC2 for peripheral and dual-role
> config options.
> v2: Remove reference to dwc2_gadget
> ---
>  drivers/usb/dwc2/Kconfig  | 61 
> ---
>  drivers/usb/dwc2/Makefile | 32 -
>  2 files changed, 53 insertions(+), 40 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
> index f93807b..1ea702e 100644
> --- a/drivers/usb/dwc2/Kconfig
> +++ b/drivers/usb/dwc2/Kconfig
> @@ -1,5 +1,5 @@
>  config USB_DWC2
> - bool "DesignWare USB2 DRD Core Support"
> + tristate "DesignWare USB2 DRD Core Support"
>   depends on USB
>   help
> Say Y here if your system has a Dual Role Hi-Speed USB
> @@ -10,31 +10,53 @@ config USB_DWC2
> bus interface module (if you have a PCI bus system) will be
> called dwc2_pci.ko, and the platform interface module (for
> controllers directly connected to the CPU) will be called
> -   dwc2_platform.ko. For gadget mode, there will be a single
> -   module called dwc2_gadget.ko.
> -
> -   NOTE: The s3c-hsotg driver is now renamed to dwc2_gadget. The
> -   host and gadget drivers are still currently separate drivers.
> -   There are plans to merge the dwc2_gadget driver with the dwc2
> -   host driver in the near future to create a dual-role driver.
> +   dwc2_platform.ko. For all modes(host, gadget and dual-role), there
> +   will be a single module called dwc2.ko.
>  
>  if USB_DWC2
>  
> +choice
> + bool "DWC2 Mode Selection"
> + default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET)
> + default USB_DWC2_HOST if (USB && !USB_GADGET)
> + default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET)
> +
>  config USB_DWC2_HOST
> - tristate "Host only mode"
> + bool "Host only mode"
>   depends on USB
>   help
> The Designware USB2.0 high-speed host controller
> -   integrated into many SoCs.
> +   integrated into many SoCs. Select this option if you want the
> +   driver to operate in Host-only mode.
> +
> +comment "Gadget/Dual-role mode requires USB Gadget support to be enabled"
> +
> +config USB_DWC2_PERIPHERAL
> + bool "Gadget only mode"
> + depends on USB_GADGET=y || USB_GADGET=USB_DWC2
> + help
> +   The Designware USB2.0 high-speed gadget controller
> +   integrated into many SoCs. Select this option if you want the
> +   driver to operate in Peripheral-only mode. This option requires
> +   USB_GADGET=y.
> +
> +config USB_DWC2_DUAL_ROLE
> + bool "Dual Role mode"
> + depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || 
> USB_GADGET=USB_DWC2)
> + help
> +   Select this option if you want the driver to work in a dual-role
> +   mode. In this mode both host and gadget features are enabled, and
> +   the role will be determined by the cable that gets plugged-in. This
> +   option requires USB_GADGET=y.
> +endchoice
>  
>  config USB_DWC2_PLATFORM
>   bool "DWC2 Platform"
> - depends on USB_DWC2_HOST
>   default USB_DWC2_HOST

It should be "default USB_DWC2_HOST || USB_DWC2_PERIPHERAL" because
USB_DWC2_PLATFORM replaces current USB_DWC2_PERIPHERAL functionality.

Additionaly USB_DWC2_PLATFORM should be changed to tristate
(USB_DWC2_PERIPHERAL was a tristeate before your changes).

BTW It is a bit late but it would be great if you could split your
patchset on two.  First one merging gadget functionality into
core/platform code and the second one adding USB_DWC2_DUAL_ROLE
functionality.

> - help
> -   The Designware USB2.0 platform interface module for
> -   controllers directly connected to the CPU. This is only
> -   used for host mode.
> +default y
> +help
> +  The Designware USB2.0 platform interface module for
> +  controllers directly connected to the CPU.
>  
>  config USB_DWC2_PCI
>   bool "DWC2 PCI"
> @@ -44,15 +66,6 @@ config USB_DWC2_PCI
> The Designware USB2.0 PCI interface module for controllers
> connected to a PCI bus. This is only used for host mode.
>  
> -comment "Gadget mode requires USB Gadget support to be enabled"
> -
> -config USB_DWC2_PERIPHERAL
> - tristate "Gadget only mode"
> - depends on USB_GADGET
> - help
> - 

Re: [PATCHv5 7/7] usb: dwc2: Update Kconfig to support dual-role

2014-10-22 Thread Bartlomiej Zolnierkiewicz
On Wednesday, October 22, 2014 02:25:46 PM Bartlomiej Zolnierkiewicz wrote:

> BTW It is a bit late but it would be great if you could split your
> patchset on two.  First one merging gadget functionality into
> core/platform code and the second one adding USB_DWC2_DUAL_ROLE
> functionality.

On the second thought I think that the dual-role is needed to preserve
existing functionality (available through separate gadget and host
drivers) so please scrap the above comment.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

--
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: chipidea: add hw_wait_phy_stable for getting stable status

2014-10-22 Thread David Laight
From: Peter Chen
> The phy needs some delay to output the stable status from low
> power mode. And for OTGSC, the status inputs are debounced
> using a 1 ms time constant, so, delay 2ms for controller to get
> the stable status(like vbus and id) when the phy leaves low power.
> 
> Signed-off-by: Peter Chen 
> ---
>  drivers/usb/chipidea/core.c |   24 
>  1 file changed, 16 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 409aba3..ac7aa7e 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -189,6 +189,17 @@ u8 hw_port_test_get(struct ci_hdrc *ci)
>   return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC);
>  }
> 
> +static void hw_wait_phy_stable(void)
> +{
> + /*
> +  * The phy needs some delay to output the stable status from low
> +  * power mode. And for OTGSC, the status inputs are debounced
> +  * using a 1 ms time constant, so, delay 2ms for controller to get
> +  * the stable status, like vbus and id when the phy leaves low power.
> +  */
> + usleep_range(2000, 2500);
> +}
> +
>  /* The PHY enters/leaves low power mode */
>  static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool enable)
>  {
> @@ -307,7 +318,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
>   case USBPHY_INTERFACE_MODE_UTMIW:
>   case USBPHY_INTERFACE_MODE_HSIC:
>   ret = usb_phy_init(ci->transceiver);
> - if (ret)
> + if (!ret)
> + hw_wait_phy_stable();
> + else
>   return ret;

Why invert the condition.

>   hw_phymode_configure(ci);
>   break;
> @@ -320,6 +333,8 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
>   break;
>   default:
>   ret = usb_phy_init(ci->transceiver);
> + if (!ret)
> + hw_wait_phy_stable();
>   }
> 
>   return ret;
> @@ -620,13 +635,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
>   if (ret) {
>   dev_err(dev, "unable to init phy: %d\n", ret);
>   return ret;
> - } else {

You don't need else after return.

David

> - /*
> -  * The delay to sync PHY's status, the maximum delay is
> -  * 2ms since the otgsc uses 1ms timer to debounce the
> -  * PHY's input
> -  */
> - usleep_range(2000, 2500);
>   }
> 
>   ci->hw_bank.phys = res->start;
> --
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
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: HP switch USB serial console

2014-10-22 Thread Johan Hovold
On Wed, Oct 22, 2014 at 01:17:44PM +0200, Andreas Sundstrom wrote:
> Some newer switch models from HP has a usb2serial port in them.
> I just got to try one out and it sort of works with the generic
> usbserial driver.
> 
> The problem I am seeing is that it always use 9600 bps, even if I
> specify 115200 or 19200.
> 
> Is it possible to troubleshoot this in any way, I can test patches if
> needed.
> This is on a vanilla 3.17.1 kernel.
> 
> Here are the details:
> modprobe usbserial vendor=0x3f0 product=0x13f
> 
> [  188.018495] usbcore: registered new interface driver usbserial
> [  188.018522] usbcore: registered new interface driver usbserial_generic
> [  188.018547] usbserial: USB Serial support registered for generic
> [  188.018575] usbserial_generic 3-2:1.0: Generic device with no bulk
> out, not allowed.
> [  188.018591] usbserial_generic: probe of 3-2:1.0 failed with error -5
> [  188.018607] usbserial_generic 3-2:1.1: The "generic" usb-serial
> driver is only for testing and one-off prototypes.
> [  188.018612] usbserial_generic 3-2:1.1: Tell linux-usb@vger.kernel.org
> to add your device to a proper driver.
> [  188.018617] usbserial_generic 3-2:1.1: generic converter detected
> [  188.018828] usb 3-2: generic converter now attached to ttyUSB0
> 
> root@computer:/tmp# lsusb -vvv -d 03f0:013f
> 
> Bus 003 Device 003: ID 03f0:013f Hewlett-Packard
> Device Descriptor:
>   bLength18
>   bDescriptorType 1
>   bcdUSB   2.00
>   bDeviceClass  239 Miscellaneous Device
>   bDeviceSubClass 2 ?
>   bDeviceProtocol 1 Interface Association
>   bMaxPacketSize064
>   idVendor   0x03f0 Hewlett-Packard
>   idProduct  0x013f
>   bcdDevice0.01
>   iManufacturer   1 HP
>   iProduct2 HPN Serial Port
>   iSerial 3 A7735230001
>   bNumConfigurations  1
>   Configuration Descriptor:
> bLength 9
> bDescriptorType 2
> wTotalLength   75
> bNumInterfaces  2
> bConfigurationValue 1
> iConfiguration  0
> bmAttributes 0x20
>   (Missing must-be-set bit!)
>   (Bus Powered)
>   Remote Wakeup
> MaxPower  100mA
> Interface Association:
>   bLength 8
>   bDescriptorType11
>   bFirstInterface 0
>   bInterfaceCount 2
>   bFunctionClass  2 Communications
>   bFunctionSubClass   2 Abstract (modem)
>   bFunctionProtocol   0 None
>   iFunction   0
> Interface Descriptor:
>   bLength 9
>   bDescriptorType 4
>   bInterfaceNumber0
>   bAlternateSetting   0
>   bNumEndpoints   1
>   bInterfaceClass 2 Communications
>   bInterfaceSubClass  2 Abstract (modem)
>   bInterfaceProtocol  1 AT-commands (v.25ter)
>   iInterface  0
>   CDC Header:
> bcdCDC   1.10
>   CDC ACM:
> bmCapabilities   0x06
>   sends break
>   line coding and serial state
>   CDC Union:
> bMasterInterface0
> bSlaveInterface 1
>   CDC Call Management:
> bmCapabilities   0x01
>   call management
> bDataInterface  1
>   Endpoint Descriptor:
> bLength 7
> bDescriptorType 5
> bEndpointAddress 0x85  EP 5 IN
> bmAttributes3
>   Transfer TypeInterrupt
>   Synch Type   None
>   Usage Type   Data
> wMaxPacketSize 0x0040  1x 64 bytes
> bInterval   2
> Interface Descriptor:
>   bLength 9
>   bDescriptorType 4
>   bInterfaceNumber1
>   bAlternateSetting   0
>   bNumEndpoints   2
>   bInterfaceClass10 CDC Data
>   bInterfaceSubClass  0 Unused
>   bInterfaceProtocol  0
>   iInterface  0
>   Endpoint Descriptor:
> bLength 7
> bDescriptorType 5
> bEndpointAddress 0x01  EP 1 OUT
> bmAttributes2
>   Transfer TypeBulk
>   Synch Type   None
>   Usage Type   Data
> wMaxPacketSize 0x0040  1x 64 bytes
> bInterval   0
>   Endpoint Descriptor:
> bLength 7
> bDescriptorType 5
> bEndpointAddress 0x81  EP 1 IN
> bmAttributes2
>   Transfer TypeBulk
>   Synch Type   None
>   Usage Type   Data
> wMaxPacketSize 0x0040  1x 64 bytes
> bInterval   0
> Device Status: 0x
>   (Bus Powered)

Looks like this one

Re: External USB3 hard drive fails to connect (JMicron bridge 152d:0569)

2014-10-22 Thread Mathias Nyman
On 17.10.2014 20:59, Matej Kenda wrote:
>> I got one icybox from Heinz Diehl some time ago, I wasn't able to reproduce 
>> the problem back then, but now
>> with a new laptop I can see it randomly disconnecting.
>>
>> However my issue is a bit different, I see several short packet errors 
>> before disconnect, you got
>> a context error.
>>
>> can you add xhci debugging, it should print out the context data of the 
>> failing setup context command.
>>
>> echo -n 'module xhci_hcd =p' > /sys/kernel/debug/dynamic_debug/control
>>
>> before connecting the icybox
> 
> After enabling debugs I did the following:
> 
> * attached external IcyCox to USB 3 port
>   it was recognised and mounted automatically on Ubuntu Utopic
> * safely removed the disk from Ubuntu desktop
> * plugged out the disk
> * attached the disk again to the secons USB 3 port
>   disk was not recognised any more
> 
> Complete kernel log from boot is attached.
> 
> Regards,
> 
> Matej
> 

Thanks, the logs are just what I needed, they give several clues on what could 
be wrong.
I'm in the middle of debugging this, issues that I need to look closer on are:

* Device is recongnized as a USB3 SS device the first time, but as a USB2 HS 
device the second.

* the shorter than expected transfers (many of them), finally resetting port 
and device.
  
* Trying to reset device in already default (after reset) state

* failing enabling device (probably trying illegal state transition)  -> reset 
port and device 

* Tranfer error

* ending up in a loop resetting device:
 - Transfer error on endpoint
 - Cleaning up stalled endpoint ring
 - Giveback URB 880328a0db40, len = 0, expected = 4096, status = -71
 - set port reset, reset device (succesfully)
 - Setup ERROR: setup context command for slot 3.
 - disable port, try to reset device (fail, already in default state)
 - Setup ERROR: setup context command for slot 3.
 - disable port, try to deset device
 - Fail to reset device Can't reset device (slot ID 3) in default state
 - Successful setup address command
 - Successful Endpoint Configure command
 - Transfer error on endpoint (back to beginning)

Mathias



--
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] option: add Haier CE81B CDMA modem

2014-10-22 Thread Dan Williams
On Wed, 2014-10-22 at 10:18 +0200, Johan Hovold wrote:
> On Tue, Oct 14, 2014 at 11:10:41AM -0500, Dan Williams wrote:
> > Port layout:
> > 
> > 0: QCDM/DIAG
> > 1: NMEA
> > 2: AT
> > 3: AT/PPP
> > 
> > Signed-off-by: Dan Williams 
> > ---
> >  drivers/usb/serial/option.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > index d1a3f60..8d8764d 100644
> > --- a/drivers/usb/serial/option.c
> > +++ b/drivers/usb/serial/option.c
> > @@ -358,14 +358,15 @@ static void option_instat_callback(struct urb *urb);
> >  #define ZOOM_PRODUCT_4597  0x9607
> >  
> >  /* SpeedUp SU9800 usb 3g modem */
> >  #define SPEEDUP_PRODUCT_SU9800 0x9800
> >  
> >  /* Haier products */
> >  #define HAIER_VENDOR_ID0x201e
> > +#define HAIER_PRODUCT_CE81B0x10f8
> >  #define HAIER_PRODUCT_CE1000x2009
> >  
> >  /* Cinterion (formerly Siemens) products */
> >  #define SIEMENS_VENDOR_ID  0x0681
> >  #define CINTERION_VENDOR_ID0x1e2d
> >  #define CINTERION_PRODUCT_HC25_MDM 0x0047
> >  #define CINTERION_PRODUCT_HC25_MDMNET  0x0040
> > @@ -1616,14 +1617,15 @@ static const struct usb_device_id option_ids[] = {
> > { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
> > { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> >   .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
> > },
> > { USB_DEVICE_INTERFACE_CLASS(LONGCHEER_VENDOR_ID, 
> > SPEEDUP_PRODUCT_SU9800, 0xff) },
> > { USB_DEVICE(LONGCHEER_VENDOR_ID, ZOOM_PRODUCT_4597) },
> > { USB_DEVICE(LONGCHEER_VENDOR_ID, IBALL_3_5G_CONNECT) },
> > +   { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 
> > 0xff, 0xff, 0xff) },
> > { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
> 
> Please, try to keep the id-table entries sorted alphabetically by the
> define names (if possible). Fixed it up here and applied.

Do you mean CE81B after CE100?

Dan

> Thanks,
> Johan
> 
> > /* Pirelli  */
> > { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_1, 
> > 0xff) },
> > { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_C100_2, 
> > 0xff) },
> > { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1004, 
> > 0xff) },
> > { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1005, 
> > 0xff) },
> > { USB_DEVICE_INTERFACE_CLASS(PIRELLI_VENDOR_ID, PIRELLI_PRODUCT_1006, 
> > 0xff) },
> --
> 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


--
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] option: add Haier CE81B CDMA modem

2014-10-22 Thread Johan Hovold
On Wed, Oct 22, 2014 at 08:40:48AM -0500, Dan Williams wrote:
> On Wed, 2014-10-22 at 10:18 +0200, Johan Hovold wrote:
> > On Tue, Oct 14, 2014 at 11:10:41AM -0500, Dan Williams wrote:

> > > + { USB_DEVICE_AND_INTERFACE_INFO(HAIER_VENDOR_ID, HAIER_PRODUCT_CE81B, 
> > > 0xff, 0xff, 0xff) },
> > >   { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
> > 
> > Please, try to keep the id-table entries sorted alphabetically by the
> > define names (if possible). Fixed it up here and applied.
> 
> Do you mean CE81B after CE100?

Yep.

Johan
--
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: gadget: function: Remove redundant usb_free_all_descriptors

2014-10-22 Thread Pavitrakumar Managutte
Removed usb_free_all_descriptors in the bind functions, which
results in double-free corruption of the descriptors on error path.
The usb descriptors are allocated by usb_assign_descriptors.

Signed-off-by: Pavitrakumar Managutte 
Reviewed-by: Robert Baldyga 
Reviewed-by: Sebastian Andrzej Siewior 
---
 drivers/usb/gadget/function/f_eem.c|  1 -
 drivers/usb/gadget/function/f_hid.c|  5 +++--
 drivers/usb/gadget/function/f_ncm.c|  1 -
 drivers/usb/gadget/function/f_obex.c   |  1 -
 drivers/usb/gadget/function/f_phonet.c |  2 +-
 drivers/usb/gadget/function/f_rndis.c  |  5 +++--
 drivers/usb/gadget/function/f_subset.c |  1 -
 drivers/usb/gadget/function/f_uac2.c   | 10 ++
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/gadget/function/f_eem.c 
b/drivers/usb/gadget/function/f_eem.c
index 4d8b236..c9e90de 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -325,7 +325,6 @@ static int eem_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 fail:
-   usb_free_all_descriptors(f);
if (eem->port.out_ep)
eem->port.out_ep->driver_data = NULL;
if (eem->port.in_ep)
diff --git a/drivers/usb/gadget/function/f_hid.c 
b/drivers/usb/gadget/function/f_hid.c
index a95290a..59ab62c 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -621,12 +621,14 @@ static int __init hidg_bind(struct usb_configuration *c, 
struct usb_function *f)
dev = MKDEV(major, hidg->minor);
status = cdev_add(&hidg->cdev, dev, 1);
if (status)
-   goto fail;
+   goto fail_free_descs;
 
device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor);
 
return 0;
 
+fail_free_descs:
+   usb_free_all_descriptors(f);
 fail:
ERROR(f->config->cdev, "hidg_bind FAILED\n");
if (hidg->req != NULL) {
@@ -635,7 +637,6 @@ fail:
usb_ep_free_request(hidg->in_ep, hidg->req);
}
 
-   usb_free_all_descriptors(f);
return status;
 }
 
diff --git a/drivers/usb/gadget/function/f_ncm.c 
b/drivers/usb/gadget/function/f_ncm.c
index bcdc882..38a9279 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1453,7 +1453,6 @@ static int ncm_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 fail:
-   usb_free_all_descriptors(f);
if (ncm->notify_req) {
kfree(ncm->notify_req->buf);
usb_ep_free_request(ncm->notify, ncm->notify_req);
diff --git a/drivers/usb/gadget/function/f_obex.c 
b/drivers/usb/gadget/function/f_obex.c
index 5f40080..928f3e9 100644
--- a/drivers/usb/gadget/function/f_obex.c
+++ b/drivers/usb/gadget/function/f_obex.c
@@ -397,7 +397,6 @@ static int obex_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 fail:
-   usb_free_all_descriptors(f);
/* we might as well release our claims on endpoints */
if (obex->port.out)
obex->port.out->driver_data = NULL;
diff --git a/drivers/usb/gadget/function/f_phonet.c 
b/drivers/usb/gadget/function/f_phonet.c
index b9cfc15..1ec8b7f 100644
--- a/drivers/usb/gadget/function/f_phonet.c
+++ b/drivers/usb/gadget/function/f_phonet.c
@@ -570,8 +570,8 @@ static int pn_bind(struct usb_configuration *c, struct 
usb_function *f)
 err_req:
for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++)
usb_ep_free_request(fp->out_ep, fp->out_reqv[i]);
-err:
usb_free_all_descriptors(f);
+err:
if (fp->out_ep)
fp->out_ep->driver_data = NULL;
if (fp->in_ep)
diff --git a/drivers/usb/gadget/function/f_rndis.c 
b/drivers/usb/gadget/function/f_rndis.c
index ddb09dc..2f0517f 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -803,7 +803,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function 
*f)
if (rndis->manufacturer && rndis->vendorID &&
rndis_set_param_vendor(rndis->config, rndis->vendorID,
   rndis->manufacturer))
-   goto fail;
+   goto fail_free_descs;
 
/* NOTE:  all that is done without knowing or caring about
 * the network link ... which is unavailable to this code
@@ -817,10 +817,11 @@ rndis_bind(struct usb_configuration *c, struct 
usb_function *f)
rndis->notify->name);
return 0;
 
+fail_free_descs:
+   usb_free_all_descriptors(f);
 fail:
kfree(f->os_desc_table);
f->os_desc_n = 0;
-   usb_free_all_descriptors(f);
 
if (rndis->notify_req) {
kfree(rndis->notify_req->buf);
diff --git a/drivers/usb/gadget/function/f_subset.c 
b/drivers/usb/gadget/function/f_subset.c
index 1ea8baf..e3dfa67 100644
--- a/drivers/usb/gadget/function/f_subset.c
+++ b

[PATCH v3] usb: gadget: function: Remove redundant usb_free_all_descriptors

2014-10-22 Thread Pavitrakumar Managutte
Removed usb_free_all_descriptors in the bind functions, which
results in double-free corruption of the descriptors on error path.
The usb descriptors are allocated by usb_assign_descriptors.

Signed-off-by: Pavitrakumar Managutte 
Reviewed-by: Robert Baldyga 
Reviewed-by: Sebastian Andrzej Siewior 
---
 drivers/usb/gadget/function/f_eem.c|  1 -
 drivers/usb/gadget/function/f_hid.c|  5 +++--
 drivers/usb/gadget/function/f_ncm.c|  1 -
 drivers/usb/gadget/function/f_obex.c   |  1 -
 drivers/usb/gadget/function/f_phonet.c |  2 +-
 drivers/usb/gadget/function/f_rndis.c  |  5 +++--
 drivers/usb/gadget/function/f_subset.c |  1 -
 drivers/usb/gadget/function/f_uac2.c   | 10 ++
 8 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/gadget/function/f_eem.c 
b/drivers/usb/gadget/function/f_eem.c
index 4d8b236..c9e90de 100644
--- a/drivers/usb/gadget/function/f_eem.c
+++ b/drivers/usb/gadget/function/f_eem.c
@@ -325,7 +325,6 @@ static int eem_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 fail:
-   usb_free_all_descriptors(f);
if (eem->port.out_ep)
eem->port.out_ep->driver_data = NULL;
if (eem->port.in_ep)
diff --git a/drivers/usb/gadget/function/f_hid.c 
b/drivers/usb/gadget/function/f_hid.c
index a95290a..59ab62c 100644
--- a/drivers/usb/gadget/function/f_hid.c
+++ b/drivers/usb/gadget/function/f_hid.c
@@ -621,12 +621,14 @@ static int __init hidg_bind(struct usb_configuration *c, 
struct usb_function *f)
dev = MKDEV(major, hidg->minor);
status = cdev_add(&hidg->cdev, dev, 1);
if (status)
-   goto fail;
+   goto fail_free_descs;
 
device_create(hidg_class, NULL, dev, NULL, "%s%d", "hidg", hidg->minor);
 
return 0;
 
+fail_free_descs:
+   usb_free_all_descriptors(f);
 fail:
ERROR(f->config->cdev, "hidg_bind FAILED\n");
if (hidg->req != NULL) {
@@ -635,7 +637,6 @@ fail:
usb_ep_free_request(hidg->in_ep, hidg->req);
}
 
-   usb_free_all_descriptors(f);
return status;
 }
 
diff --git a/drivers/usb/gadget/function/f_ncm.c 
b/drivers/usb/gadget/function/f_ncm.c
index bcdc882..38a9279 100644
--- a/drivers/usb/gadget/function/f_ncm.c
+++ b/drivers/usb/gadget/function/f_ncm.c
@@ -1453,7 +1453,6 @@ static int ncm_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 fail:
-   usb_free_all_descriptors(f);
if (ncm->notify_req) {
kfree(ncm->notify_req->buf);
usb_ep_free_request(ncm->notify, ncm->notify_req);
diff --git a/drivers/usb/gadget/function/f_obex.c 
b/drivers/usb/gadget/function/f_obex.c
index 5f40080..928f3e9 100644
--- a/drivers/usb/gadget/function/f_obex.c
+++ b/drivers/usb/gadget/function/f_obex.c
@@ -397,7 +397,6 @@ static int obex_bind(struct usb_configuration *c, struct 
usb_function *f)
return 0;
 
 fail:
-   usb_free_all_descriptors(f);
/* we might as well release our claims on endpoints */
if (obex->port.out)
obex->port.out->driver_data = NULL;
diff --git a/drivers/usb/gadget/function/f_phonet.c 
b/drivers/usb/gadget/function/f_phonet.c
index b9cfc15..1ec8b7f 100644
--- a/drivers/usb/gadget/function/f_phonet.c
+++ b/drivers/usb/gadget/function/f_phonet.c
@@ -570,8 +570,8 @@ static int pn_bind(struct usb_configuration *c, struct 
usb_function *f)
 err_req:
for (i = 0; i < phonet_rxq_size && fp->out_reqv[i]; i++)
usb_ep_free_request(fp->out_ep, fp->out_reqv[i]);
-err:
usb_free_all_descriptors(f);
+err:
if (fp->out_ep)
fp->out_ep->driver_data = NULL;
if (fp->in_ep)
diff --git a/drivers/usb/gadget/function/f_rndis.c 
b/drivers/usb/gadget/function/f_rndis.c
index ddb09dc..2f0517f 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -803,7 +803,7 @@ rndis_bind(struct usb_configuration *c, struct usb_function 
*f)
if (rndis->manufacturer && rndis->vendorID &&
rndis_set_param_vendor(rndis->config, rndis->vendorID,
   rndis->manufacturer))
-   goto fail;
+   goto fail_free_descs;
 
/* NOTE:  all that is done without knowing or caring about
 * the network link ... which is unavailable to this code
@@ -817,10 +817,11 @@ rndis_bind(struct usb_configuration *c, struct 
usb_function *f)
rndis->notify->name);
return 0;
 
+fail_free_descs:
+   usb_free_all_descriptors(f);
 fail:
kfree(f->os_desc_table);
f->os_desc_n = 0;
-   usb_free_all_descriptors(f);
 
if (rndis->notify_req) {
kfree(rndis->notify_req->buf);
diff --git a/drivers/usb/gadget/function/f_subset.c 
b/drivers/usb/gadget/function/f_subset.c
index 1ea8baf..e3dfa67 100644
--- a/drivers/usb/gadget/function/f_subset.c
+++ b

Re: [resend PATCH 1/3] ACPI / platform: provide default DMA mask

2014-10-22 Thread Rafael J. Wysocki
On Wednesday, October 22, 2014 10:33:08 AM Adrian Hunter wrote:
> On 21/10/14 16:13, Adrian Hunter wrote:
> > On 21/10/14 16:08, Rafael J. Wysocki wrote:
> >> On Tuesday, October 21, 2014 03:27:45 PM Adrian Hunter wrote:
> >>> On 24/09/14 16:49, Rafael J. Wysocki wrote:
>  On Wednesday, September 24, 2014 11:00:37 AM Heikki Krogerus wrote:
> > Most devices are configured for 32-bit DMA addresses.
> > Setting the mask to 32-bit here removes the need for the
> > drivers to do it separately.
> >
> > Signed-off-by: Heikki Krogerus 
> > Cc: "Rafael J. Wysocki" 
> 
>  ACK
> >>>
> >>> Hi
> >>>
> >>> I need this for another driver.  Did this patch go anywhere?
> >>
> >> It's not in 3.18-rc1 as far as I can say.
> >>
> >>> Note Heikki is away at the moment.
> >>
> >> That's OK.  I guess I can queue up this one for you.
> >>
> >> When do you need this to get into the Linus' tree?
> > 
> > My patches are aiming for 3.19
> 
> Actually it would be easier for me if Heikki's patch is already in
> 3.18, but all I need to know is when it will hit?

I've applied the Heiki's patch and I'm going to push it for 3.18-rc2.

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
--
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: gadget: function: Fixed the return value on error path

2014-10-22 Thread Pavitrakumar Managutte
Fixed the return value on failure. status variable
is set to 0 at usb_assign_descriptors call and the same is
returned on error which is incorrect.

Signed-off-by: Pavitrakumar Managutte 
---
 drivers/usb/gadget/function/f_rndis.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_rndis.c 
b/drivers/usb/gadget/function/f_rndis.c
index ddb09dc..0cd2aba 100644
--- a/drivers/usb/gadget/function/f_rndis.c
+++ b/drivers/usb/gadget/function/f_rndis.c
@@ -802,8 +802,10 @@ rndis_bind(struct usb_configuration *c, struct 
usb_function *f)
 
if (rndis->manufacturer && rndis->vendorID &&
rndis_set_param_vendor(rndis->config, rndis->vendorID,
-  rndis->manufacturer))
+  rndis->manufacturer)) {
+   status = -EINVAL;
goto fail;
+   }
 
/* NOTE:  all that is done without knowing or caring about
 * the network link ... which is unavailable to this code
-- 
1.8.1.5

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


Re: HP switch USB serial console

2014-10-22 Thread Andreas Sundstrom
On 10/22/2014 03:00 PM, Johan Hovold wrote:
> On Wed, Oct 22, 2014 at 01:17:44PM +0200, Andreas Sundstrom wrote:
>> Some newer switch models from HP has a usb2serial port in them.
>> I just got to try one out and it sort of works with the generic
>> usbserial driver.
>>
>> The problem I am seeing is that it always use 9600 bps, even if I
>> specify 115200 or 19200.
>>
>> Is it possible to troubleshoot this in any way, I can test patches if
>> needed.
>> This is on a vanilla 3.17.1 kernel.
>>
>> Here are the details:
>> modprobe usbserial vendor=0x3f0 product=0x13f
>> [...]
>> Looks like this one should be handled by the cdc-acm driver, but the
>> device class (Misc) prevents it from being recognised.
>>
>> Can you try forcing it to bind through sysfs?
>>
>>  echo 03f0 013f >/sys/bus/usb/drivers/cdc_acm/new_id
>>
>> Thanks,
>> Johan

I don't know how it works, but after I compiled the cdc_acm driver it is
being loaded automatically when the USB port is plugged in.
And it looks like it's working as it should.

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


RE: [PATCH 18/28] usb: dwc3: ep0: fix Data Phase for transfer sizes aligned to wMaxPacketSize

2014-10-22 Thread Alan Stern
On Wed, 22 Oct 2014, Anton Tikhomirov wrote:

> > That's right, and it's true for USB-2 as well.  A ZLP is needed only in
> > cases where the host otherwise wouldn't know the transfer is over,
> > i.e., when the transfer length is a nonzero multiple of the maxpacket
> > size and is smaller than wLength.
> 
> Shall we use/check struct usb_request's zero flag for this?

Of course; we have to.  There's no other way for the UDC driver to know 
whether the transfer is shorter than the host expects.

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] usb: serial: Fix indentation style issue

2014-10-22 Thread Greg KH
On Wed, Oct 22, 2014 at 11:51:12AM +0200, Johan Hovold wrote:
> On Sat, Oct 11, 2014 at 07:20:49AM -0700, Greg Kroah-Hartman wrote:
> > On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
> > > Fix a style issue
> > > 
> > > Signed-off-by: Philip Munksgaard 
> > > ---
> > >  drivers/usb/serial/option.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > > index d1a3f60..d88998d 100644
> > > --- a/drivers/usb/serial/option.c
> > > +++ b/drivers/usb/serial/option.c
> > > @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = {
> > >   { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
> > >   { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> > > .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
> > > - },
> > > + },
> > 
> > Why not fix the same 'space' issue on the line before this at the same
> > time?
> 
> And what about the remaining white-space issues in this file? Do we
> really want to go down this path?

No, we don't, if you want to have patches be able to apply properly to
older kernels, as you point out.

Just don't add new whitespace issues please, that's all.

thanks,

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


Re: HP switch USB serial console

2014-10-22 Thread Johan Hovold
On Wed, Oct 22, 2014 at 04:13:36PM +0200, Andreas Sundstrom wrote:
> On 10/22/2014 03:00 PM, Johan Hovold wrote:
> > On Wed, Oct 22, 2014 at 01:17:44PM +0200, Andreas Sundstrom wrote:
> >> Some newer switch models from HP has a usb2serial port in them.
> >> I just got to try one out and it sort of works with the generic
> >> usbserial driver.
> >>
> >> The problem I am seeing is that it always use 9600 bps, even if I
> >> specify 115200 or 19200.
> >>
> >> Is it possible to troubleshoot this in any way, I can test patches if
> >> needed.
> >> This is on a vanilla 3.17.1 kernel.
> >>
> >> Here are the details:
> >> modprobe usbserial vendor=0x3f0 product=0x13f
> >> [...]
> >> Looks like this one should be handled by the cdc-acm driver, but the
> >> device class (Misc) prevents it from being recognised.
> >>
> >> Can you try forcing it to bind through sysfs?
> >>
> >>echo 03f0 013f >/sys/bus/usb/drivers/cdc_acm/new_id
> >>
> I don't know how it works, but after I compiled the cdc_acm driver it is
> being loaded automatically when the USB port is plugged in.
> And it looks like it's working as it should.

Even better. The driver is matching on the interface (as it should).

> Thanks for the help

You're welcome.

Johan
--
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: serial: Fix indentation style issue

2014-10-22 Thread Philip Munksgaard
On 22 October 2014 16:18, Greg KH  wrote:
> On Wed, Oct 22, 2014 at 11:51:12AM +0200, Johan Hovold wrote:
>> On Sat, Oct 11, 2014 at 07:20:49AM -0700, Greg Kroah-Hartman wrote:
>> > On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
>> > > Fix a style issue
>> > >
>> > > Signed-off-by: Philip Munksgaard 
>> > > ---
>> > >  drivers/usb/serial/option.c | 2 +-
>> > >  1 file changed, 1 insertion(+), 1 deletion(-)
>> > >
>> > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
>> > > index d1a3f60..d88998d 100644
>> > > --- a/drivers/usb/serial/option.c
>> > > +++ b/drivers/usb/serial/option.c
>> > > @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = {
>> > >   { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
>> > >   { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
>> > > .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
>> > > - },
>> > > + },
>> >
>> > Why not fix the same 'space' issue on the line before this at the same
>> > time?
>>
>> And what about the remaining white-space issues in this file? Do we
>> really want to go down this path?
>
> No, we don't, if you want to have patches be able to apply properly to
> older kernels, as you point out.
>
> Just don't add new whitespace issues please, that's all.
>

I'm a bit confused. I've already submitted a new patch that merges the
two lines and fixes the whitespace issues on both (if you can't find
it, let me know and I'll resend it), is there anything else I'm
supposed to do?
--
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: serial: Fix indentation style issue

2014-10-22 Thread Johan Hovold
On Wed, Oct 22, 2014 at 04:40:24PM +0200, Philip Munksgaard wrote:
> On 22 October 2014 16:18, Greg KH  wrote:
> > On Wed, Oct 22, 2014 at 11:51:12AM +0200, Johan Hovold wrote:
> >> On Sat, Oct 11, 2014 at 07:20:49AM -0700, Greg Kroah-Hartman wrote:
> >> > On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
> >> > > Fix a style issue
> >> > >
> >> > > Signed-off-by: Philip Munksgaard 
> >> > > ---
> >> > >  drivers/usb/serial/option.c | 2 +-
> >> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> >> > >
> >> > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> >> > > index d1a3f60..d88998d 100644
> >> > > --- a/drivers/usb/serial/option.c
> >> > > +++ b/drivers/usb/serial/option.c
> >> > > @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = 
> >> > > {
> >> > >   { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
> >> > >   { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> >> > > .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
> >> > > - },
> >> > > + },
> >> >
> >> > Why not fix the same 'space' issue on the line before this at the same
> >> > time?
> >>
> >> And what about the remaining white-space issues in this file? Do we
> >> really want to go down this path?
> >
> > No, we don't, if you want to have patches be able to apply properly to
> > older kernels, as you point out.
> >
> > Just don't add new whitespace issues please, that's all.
>
> I'm a bit confused. I've already submitted a new patch that merges the
> two lines and fixes the whitespace issues on both (if you can't find
> it, let me know and I'll resend it), is there anything else I'm
> supposed to do?

No, we're just not going to apply such fix-white-space patches, sorry.

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


Re: [PATCH 0/6] USB: OHCI: work with controllers that lose TDs

2014-10-22 Thread Matteo Fortini
I (partly) reopen this issue because it fixed the problem we had (lost 
TDs lead to random process lockups on FTDI serial), but we're now seeing 
another kind of lockup which is also USB-related on the same board, just 
at the time we close() the serial port.


We enabled USB debug to gather all available information.

Thank you for any comment

Here's some code that triggers the problem:
==
#include 
#include 

#include 
#include 
#include 

const unsigned char buf[] = "1234567890";

int main(int argc, char **argv)
{
if( argc < 2 ) {
fprintf(stderr, "Usage: %s \n", argv[0]);
return 1;
}

const char *s = argv[1];

fprintf(stderr, "Opening serial '%s'\n", s);

int fd = open(s, O_RDWR);
if( fd > 0 ) {
fprintf(stderr, "Writing buf\n");
write(fd, buf, sizeof(buf));

fprintf(stderr, "Closing serial\n");
close(fd);

fprintf(stderr, "Serial closed\n");
} else {
fprintf(stderr, "Unable to open '%s'\n", s);
return 1;
}

return 0;
}
==

Here's the (longish) debug output:
==
root@LCU.M3:~# /tmp/usbserial_err /dev/ttyUSB0
Opening serial '/dev/ttyUSB0'
Writing buf
Closing serial
Serial closed
root@LCU.M3:~# /tmp/usbserial_err /dev/ttyUSB0
Opening serial '/dev/ttyUSB0'
[..] DEADLOCK





root@LCU.M3:~# mount -t debugfs none /sys/kernel/debug/
root@LCU.M3:~# ls -l /sys/kernel/debug/usb/
-r--r--r--1 root root 0 Jan  1 06:14 devices
drwxr-xr-x3 root root 0 Jan  1 06:14 ohci
root@(none).M3:~#
root@(none).M3:~# cat /sys/kernel/debug/usb/devices

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12   MxCh= 4
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0001 Rev= 3.14
S:  Manufacturer=Linux 3.14.0 ohci_hcd
S:  Product=OHCI PCI host controller
S:  SerialNumber=:00:0f.4
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0403 ProdID=6015 Rev=10.00
S:  Manufacturer=Sadel S.p.A.
S:  Product=sdlaudioctrl
S:  SerialNumber=HSXO62L4
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 90mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=ftdi_sio
E:  Ad=81(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 4
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 3.14
S:  Manufacturer=Linux 3.14.0 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=:00:0f.5
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms
root@(none).M3:~# for file in 
/sys/kernel/debug/usb/ohci/\:00\:0f.4/*; do echo "== ${file} =="; 
cat "${file}"; echo; done

== /sys/kernel/debug/usb/ohci/:00:0f.4/async ==

== /sys/kernel/debug/usb/ohci/:00:0f.4/periodic ==
size = 32

== /sys/kernel/debug/usb/ohci/:00:0f.4/registers ==
bus pci, device :00:0f.4
OHCI PCI host controllerkillall ***
ohci_hcd
OHCI 1.0, NO legacy support registers, rh state running
control 0x283 RWC HCFS=operational CBSR=3
cmdstatus 0x2 SOC=0 CLF
intrstatus 0x0024 FNO SF
intrenable 0x805a MIE RHSC UE RD WDH
ed_controlhead 002c
ed_bulkhead 002c0050
hcca frame 0x543d
fmintvl 0xa7782edf FIT FSMPS=0xa778 FI=0x2edf
fmremaining 0x80002a17 FRT FR=0x2a17
periodicstart 0x2a2f
lsthresh 0x0628
hub poll timer off
roothub.a 03000204 POTPGT=3 NPS NDP=4(4)
roothub.b  PPCM= DR=
roothub.status 8000 DRWE
roothub.portstatus [0] 0x0103 PPS PES CCS
roothub.portstatus [1] 0x0100 PPS
roothub.portstatus [2] 0x0100 PPS
roothub.portstatus [3] 0x0100 PPS






root@LCU.M3:~# dmesg
[0.00] Linux version 3.14.0-x+ () (gcc version 4.9.1 
(Debian 4.9.1-16) ) #10 PREEMPT Wed Oct 22 11:49:42 CEST 2014

[0.00] e820: BIOS-provided physical RAM map:
[0.00] BIOS-e820: [mem 0x-0x0009e7ff] usable
[0.00] BIOS-e820: [mem 0x0009e800-0x0009] 
reserved
[0.00] BIOS-e820: [mem 0x000f-0x000f] 
reserved

[0.00] BIOS-e820: [mem 0x0010-0x1f7a] usable
[0.00] BIOS-e820: [mem 0x1f7b-0x1f7b2fff] 
ACPI NVS
[0.00] BIOS-e820: [mem 0x1f7b3000-0x1f7b] 
ACPI data
[0.00] BIOS-e820: [mem 0x-0x] 
reserved

[0.00] Notice: NX (Execute Disable) 

Re: [PATCH 0/6] USB: OHCI: work with controllers that lose TDs

2014-10-22 Thread Alan Stern
On Wed, 22 Oct 2014, Matteo Fortini wrote:

> I (partly) reopen this issue because it fixed the problem we had (lost 
> TDs lead to random process lockups on FTDI serial), but we're now seeing 
> another kind of lockup which is also USB-related on the same board, just 
> at the time we close() the serial port.
> 
> We enabled USB debug to gather all available information.
> 
> Thank you for any comment

> root@LCU.M3:~# dmesg
> [0.00] Linux version 3.14.0-x+ () (gcc version 4.9.1 
> (Debian 4.9.1-16) ) #10 PREEMPT Wed Oct 22 11:49:42 CEST 2014

Does it work any better if you use a 3.17 kernel?

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] usb: dwc2: allow dwc2 to get built when USB_GADGET=m

2014-10-22 Thread Paul Zimmerman
> From: dingu...@opensource.altera.com [mailto:dingu...@opensource.altera.com]
> Sent: Tuesday, October 21, 2014 1:32 PM
> 
> From: Dinh Nguyen 
> 
> This patch allows the gadget portion of the DWC2 driver to get built when
> (!USB && USB_GADGET) condition is encountered.
> 
> Signed-off-by: Dinh Nguyen 
> ---
>  drivers/usb/dwc2/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
> index f93807b..4d02718 100644
> --- a/drivers/usb/dwc2/Kconfig
> +++ b/drivers/usb/dwc2/Kconfig
> @@ -1,6 +1,6 @@
>  config USB_DWC2
>   bool "DesignWare USB2 DRD Core Support"
> - depends on USB
> + depends on USB || USB_GADGET
>   help
> Say Y here if your system has a Dual Role Hi-Speed USB
> controller based on the DesignWare HSOTG IP Core.

Acked-by: Paul Zimmerman 

--
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: [PATCHv5 7/7] usb: dwc2: Update Kconfig to support dual-role

2014-10-22 Thread Paul Zimmerman
> From: Dinh Nguyen [mailto:dingu...@opensource.altera.com]
> Sent: Tuesday, October 21, 2014 1:48 PM
>
> diff --git a/drivers/usb/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig
> index f93807b..1ea702e 100644
> --- a/drivers/usb/dwc2/Kconfig
> +++ b/drivers/usb/dwc2/Kconfig
> @@ -1,5 +1,5 @@
>  config USB_DWC2
> - bool "DesignWare USB2 DRD Core Support"
> + tristate "DesignWare USB2 DRD Core Support"
>   depends on USB
>   help
> Say Y here if your system has a Dual Role Hi-Speed USB
> @@ -10,31 +10,53 @@ config USB_DWC2
> bus interface module (if you have a PCI bus system) will be
> called dwc2_pci.ko, and the platform interface module (for
> controllers directly connected to the CPU) will be called
> -   dwc2_platform.ko. For gadget mode, there will be a single
> -   module called dwc2_gadget.ko.
> -
> -   NOTE: The s3c-hsotg driver is now renamed to dwc2_gadget. The
> -   host and gadget drivers are still currently separate drivers.
> -   There are plans to merge the dwc2_gadget driver with the dwc2
> -   host driver in the near future to create a dual-role driver.
> +   dwc2_platform.ko. For all modes(host, gadget and dual-role), there
> +   will be a single module called dwc2.ko.

Maybe "For all modes (host, gadget and dual-role), there will be an
additional module named dwc2.ko." That would be clearer.

>  if USB_DWC2
>  
> +choice
> + bool "DWC2 Mode Selection"
> + default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET)
> + default USB_DWC2_HOST if (USB && !USB_GADGET)
> + default USB_DWC2_PERIPHERAL if (!USB && USB_GADGET)
> +
>  config USB_DWC2_HOST
> - tristate "Host only mode"
> + bool "Host only mode"
>   depends on USB
>   help
> The Designware USB2.0 high-speed host controller
> -   integrated into many SoCs.
> +   integrated into many SoCs. Select this option if you want the
> +   driver to operate in Host-only mode.
> +
> +comment "Gadget/Dual-role mode requires USB Gadget support to be enabled"
> +
> +config USB_DWC2_PERIPHERAL
> + bool "Gadget only mode"
> + depends on USB_GADGET=y || USB_GADGET=USB_DWC2
> + help
> +   The Designware USB2.0 high-speed gadget controller
> +   integrated into many SoCs. Select this option if you want the
> +   driver to operate in Peripheral-only mode. This option requires
> +   USB_GADGET=y.

Shouldn't this be "This option requires USB_GADGET to be enabled"? It
doesn't have to be built-in.

> +config USB_DWC2_DUAL_ROLE
> + bool "Dual Role mode"
> + depends on (USB=y || USB=USB_DWC2) && (USB_GADGET=y || 
> USB_GADGET=USB_DWC2)
> + help
> +   Select this option if you want the driver to work in a dual-role
> +   mode. In this mode both host and gadget features are enabled, and
> +   the role will be determined by the cable that gets plugged-in. This
> +   option requires USB_GADGET=y.

Ditto.

Once you fix these, plus the extraneous "default y" that Paul Bolle
pointed out, you can add my acked-by.

-- 
Paul

N�r��yb�X��ǧv�^�)޺{.n�+{��^n�r���z���h�&���G���h�(�階�ݢj"���m��z�ޖ���f���h���~�m�

Re: [PATCHv5 7/7] usb: dwc2: Update Kconfig to support dual-role

2014-10-22 Thread Paul Bolle
On Tue, 2014-10-21 at 15:47 -0500, Dinh Nguyen wrote:
> On 10/20/2014 02:42 PM, Paul Bolle wrote:
> > (Side note: drivers/usb/dwc2/Kconfig is sourced (in drivers/usb/Kconfig)
> > even if USB is _not_ set. But USB_DCW2 still depends on USB. Why is
> > that?)
> 
> Because USB is for Host-Side support. DWC2 driver should only get built
> for when USB is enabled. I think you're getting USB and USB_SUPPORT
> mixed up.

No, I don't think I did. Because in drivers/usb/Kconfig we see  
if USB

[...]

endif

[...]

source "drivers/usb/dwc2/Kconfig"

[...]

> In addition, thanks to your comment, I realized that DWC2 should also be
> available to build when USB_GADGET is enabled. A patch has been sent:
> 
> http://marc.info/?l=linux-usb&m=141392377124818&w=2

I haven't checked, but doesn't this mean USB_DWC2 could just depend on
USB_SUPPORT?


Paul Bolle

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


[RFC PATCH] usb: musb: try a race-free wakeup

2014-10-22 Thread Sebastian Andrzej Siewior
Attaching a keyboard, using it as a wakeup via
|for f in $(find /sys/devices/ocp.3/4740.usb -name wakeup)
|do
|   echo enabled > $f
|done

going into standby
|  echo standby >  /sys/power/state

and now a wake up by a pressing a key.
What happens is that the system wakes up but the USB device is dead. The
USB stack tries to send a few control URBs but nothing comes back.
Eventually it gaves up and the device remains dead:
|[  632.559678] PM: Wakeup source USB1_PHY
|[  632.581074] PM: noirq resume of devices complete after 21.261 msecs
|[  632.607521] PM: early resume of devices complete after 10.360 msecs
|[  632.616854] net eth2: initializing cpsw version 1.12 (0)
|[  632.704126] net eth2: phy found : id is : 0x4dd074
|[  636.704048] libphy: 4a101000.mdio:00 - Link is Up - 1000/Full
|[  638.444620] usb 1-1: reset low-speed USB device number 2 using musb-hdrc
|[  653.713435] usb 1-1: device descriptor read/64, error -110
|[  669.093435] usb 1-1: device descriptor read/64, error -110
|[  669.473424] usb 1-1: reset low-speed USB device number 2 using musb-hdrc
|[  684.743436] usb 1-1: device descriptor read/64, error -110
|[  690.065097] PM: resume of devices complete after 57450.744 msecs
|[  690.076601] PM: Finishing wakeup.
|[  690.076627] Restarting tasks ...

It seems that since we got woken up via MUSB_INTR_RESUME the
musb_host_finish_resume() callback is executed before the
resume-callbacks of the PHY and glue layer are invoked. If I delay it
until the glue layer resumed then I don't see this problem.

I also move musb_host_resume_root_hub() into that callback since I don't
see any reason in doing anything resume-link if there are still pieces
not restored.

Signed-off-by: Sebastian Andrzej Siewior 
---

If this  what we are going to do then I would fixup other glue layer as well.

 drivers/usb/musb/musb_core.c| 5 +
 drivers/usb/musb/musb_core.h| 1 +
 drivers/usb/musb/musb_dsps.c| 5 +
 drivers/usb/musb/musb_virthub.c | 1 +
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index b841ee0bff06..8343bbc3985d 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -478,13 +478,10 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
| MUSB_PORT_STAT_RESUME;
musb->rh_timer = jiffies
 + msecs_to_jiffies(20);
-   schedule_delayed_work(
-   &musb->finish_resume_work,
-   msecs_to_jiffies(20));
+   musb->need_finish_resume = 1;
 
musb->xceiv->state = OTG_STATE_A_HOST;
musb->is_active = 1;
-   musb_host_resume_root_hub(musb);
break;
case OTG_STATE_B_WAIT_ACON:
musb->xceiv->state = OTG_STATE_B_PERIPHERAL;
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 414e57a984bb..803a997e56d2 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -390,6 +390,7 @@ struct musb {
 
/* is_suspended means USB B_PERIPHERAL suspend */
unsignedis_suspended:1;
+   unsignedneed_finish_resume :1;
 
/* may_wakeup means remote wakeup is enabled */
unsignedmay_wakeup:1;
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index a16a6449b668..14db5435e1cd 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -898,6 +898,11 @@ static int dsps_resume(struct device *dev)
dsps_writel(mbase, wrp->tx_mode, glue->context.tx_mode);
dsps_writel(mbase, wrp->rx_mode, glue->context.rx_mode);
setup_timer(&glue->timer, otg_timer, (unsigned long) musb);
+   if (musb->need_finish_resume) {
+   musb->need_finish_resume = 0;
+   schedule_delayed_work(&musb->finish_resume_work,
+ msecs_to_jiffies(20));
+   }
 
return 0;
 }
diff --git a/drivers/usb/musb/musb_virthub.c b/drivers/usb/musb/musb_virthub.c
index e2d2d8c9891b..66d2996e9ed0 100644
--- a/drivers/usb/musb/musb_virthub.c
+++ b/drivers/usb/musb/musb_virthub.c
@@ -72,6 +72,7 @@ void musb_host_finish_resume(struct work_struct *work)
musb->xceiv->state = OTG_STATE_A_HOST;
 
spin_unlock_irqrestore(&musb->lock, flags);
+   musb_host_resume_root_hub(musb);
 }
 
 void musb_port_suspend(struct musb *musb, bool do_suspend)
-- 
2.1.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: [PATCHv5 2/7] usb: dwc2: Move gadget probe function into platform code

2014-10-22 Thread Paul Zimmerman
> From: Bartlomiej Zolnierkiewicz [mailto:b.zolnier...@samsung.com]
> Sent: Wednesday, October 22, 2014 4:16 AM
> 
> On Monday, October 20, 2014 01:52:01 PM dingu...@opensource.altera.com wrote:
> > From: Dinh Nguyen 
> >
> > This patch will aggregate the probing of gadget/hcd driver into platform.c.
> > The gadget probe funtion is converted into gadget_init that is now only
> > responsible for gadget only initialization. All the gadget resources is now
> > handled by platform.c
> >
> > Since the host workqueue will not get initialized if the driver is 
> > configured
> > for peripheral mode only. Thus we need to check for wq_otg before calling
> > queue_work().
> >
> > Also, we move spin_lock_init to common location for both host and gadget 
> > that
> > is either in platform.c or pci.c.
> >
> > We also ove suspend/resume code to common platform code, and update it to 
> > use
> > the new PM API (struct dev_pm_ops).
> >
> > Lastly, move the "samsung,s3c6400-hsotg" binding into dwc2_of_match_table.
> 
> This patch seems to break bisectability.  It moves all the gadget probing
> to platform.c but Kconfig/Makefile are not updated (platform.c will be
> compiled only for CONFIG_USB_DWC2_PLATFORM=y which in turn depends on
> CONFIG_USB_DWC2_HOST).  IMO patch #7 should be merged into this one (#2).

It doesn't break the compile, I already tested it. It does break the
operation of the driver until patch #7 is applied, but I think that's
OK in the middle of a patch series. I think it's a bit much to expect
the driver to keep working at each step of a patch series like this.

-- 
Paul

--
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: serial: Fix indentation style issue

2014-10-22 Thread Paul Zimmerman
> From: linux-usb-ow...@vger.kernel.org 
> [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Greg KH
> Sent: Wednesday, October 22, 2014 7:19 AM
> 
> On Wed, Oct 22, 2014 at 11:51:12AM +0200, Johan Hovold wrote:
> > On Sat, Oct 11, 2014 at 07:20:49AM -0700, Greg Kroah-Hartman wrote:
> > > On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
> > > > Fix a style issue
> > > >
> > > > Signed-off-by: Philip Munksgaard 
> > > > ---
> > > >  drivers/usb/serial/option.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > > > index d1a3f60..d88998d 100644
> > > > --- a/drivers/usb/serial/option.c
> > > > +++ b/drivers/usb/serial/option.c
> > > > @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] = {
> > > > { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
> > > > { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> > > >   .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
> > > > -   },
> > > > +   },
> > >
> > > Why not fix the same 'space' issue on the line before this at the same
> > > time?
> >
> > And what about the remaining white-space issues in this file? Do we
> > really want to go down this path?
> 
> No, we don't, if you want to have patches be able to apply properly to
> older kernels, as you point out.

git-apply --ignore-whitespace ?

-- 
Paul

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


Re: [PATCH 0/6] USB: OHCI: work with controllers that lose TDs

2014-10-22 Thread Matteo Fortini
Good question,
I'll get back to you as soon as I get to build a 3.17 tree rebasing
the changes we need for our board to behave properly.

Thanks,
Matteo

2014-10-22 19:43 GMT+02:00 Alan Stern :
> On Wed, 22 Oct 2014, Matteo Fortini wrote:
>
>> I (partly) reopen this issue because it fixed the problem we had (lost
>> TDs lead to random process lockups on FTDI serial), but we're now seeing
>> another kind of lockup which is also USB-related on the same board, just
>> at the time we close() the serial port.
>>
>> We enabled USB debug to gather all available information.
>>
>> Thank you for any comment
>
>> root@LCU.M3:~# dmesg
>> [0.00] Linux version 3.14.0-x+ () (gcc version 4.9.1
>> (Debian 4.9.1-16) ) #10 PREEMPT Wed Oct 22 11:49:42 CEST 2014
>
> Does it work any better if you use a 3.17 kernel?
>
> 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] usb: serial: Fix indentation style issue

2014-10-22 Thread Greg KH
On Wed, Oct 22, 2014 at 09:14:14PM +, Paul Zimmerman wrote:
> > From: linux-usb-ow...@vger.kernel.org 
> > [mailto:linux-usb-ow...@vger.kernel.org] On Behalf Of Greg KH
> > Sent: Wednesday, October 22, 2014 7:19 AM
> > 
> > On Wed, Oct 22, 2014 at 11:51:12AM +0200, Johan Hovold wrote:
> > > On Sat, Oct 11, 2014 at 07:20:49AM -0700, Greg Kroah-Hartman wrote:
> > > > On Sat, Oct 11, 2014 at 03:49:43PM +0200, Philip Munksgaard wrote:
> > > > > Fix a style issue
> > > > >
> > > > > Signed-off-by: Philip Munksgaard 
> > > > > ---
> > > > >  drivers/usb/serial/option.c | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
> > > > > index d1a3f60..d88998d 100644
> > > > > --- a/drivers/usb/serial/option.c
> > > > > +++ b/drivers/usb/serial/option.c
> > > > > @@ -1616,7 +1616,7 @@ static const struct usb_device_id option_ids[] 
> > > > > = {
> > > > >   { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
> > > > >   { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
> > > > > .driver_info = (kernel_ulong_t)&four_g_w14_blacklist
> > > > > - },
> > > > > + },
> > > >
> > > > Why not fix the same 'space' issue on the line before this at the same
> > > > time?
> > >
> > > And what about the remaining white-space issues in this file? Do we
> > > really want to go down this path?
> > 
> > No, we don't, if you want to have patches be able to apply properly to
> > older kernels, as you point out.
> 
> git-apply --ignore-whitespace ?

Doesn't work with my code-flow for handling stable patches, sorry.

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


gadgetfs: fops change not preserved on return from dev_config()

2014-10-22 Thread Andre Wolokita
Hi Felipe,

I'm noticing some strange behaviour in the gadgetfs driver when running
gadgetfs-test; the program fails with the error "ep0 read after poll: Invalid 
argument".
As far as I understand, an inode is created upon an open() call in 
gadgetfs-test and 
an initial fops is assigned to the struct file that doesn't contain a .read 
member.
The .write member of this first fops points to dev_config() in 
usb/gadget/legacy/inode.c. 
When user-space write is called for the first time, dev_config() performs a 
bunch of 
configuration stuff before doing "fd->f_op = &ep0_io_operations;". This new
file_operations struct does contain a .read member, which points to ep0_read().

I'm confused as to why when an error occurs when a subsequent read() is called 
in 
gadgetfs-test. I thought that changes to an fops pointer is preserved upon 
returning to
the user-space caller. How can it be that "fd->f_op = &ep0_io_operations;" 
clearly changes
the fops pointer, yet these changes aren't reflected when returning to 
user-space?

Regards,

Andre.
--
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: Add "bricked" FTDI device PID

2014-10-22 Thread Perry Hung
An official recent Windows driver from FTDI detects counterfeit devices
and reprograms the internal EEPROM containing the USB PID to 0, effectively
bricking the device.

Add support for this VID/PID pair to correctly bind the driver on these
devices.

See:
http://hackaday.com/2014/10/22/watch-that-windows-update-ftdi-drivers-are-killing-fake-chips/

Signed-off-by: Perry Hung 
---
 drivers/usb/serial/ftdi_sio.c | 1 +
 drivers/usb/serial/ftdi_sio_ids.h | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index dc72b92..41d6642 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -942,6 +942,7 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE_INTERFACE_NUMBER(INFINEON_VID, INFINEON_TRIBOARD_PID, 1) },
/* GE Healthcare devices */
{ USB_DEVICE(GE_HEALTHCARE_VID, GE_HEALTHCARE_NEMO_TRACKER_PID) },
+   { USB_DEVICE(FTDI_VID, FTDI_BRICK_PID) },
{ } /* Terminating entry */
 };
 
diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
index 5937b2d..f9c3c49 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -1397,3 +1397,9 @@
  */
 #define GE_HEALTHCARE_VID  0x1901
 #define GE_HEALTHCARE_NEMO_TRACKER_PID 0x0015
+
+/*
+ * Certain versions of the official Windows FTDI driver reprogrammed
+ * counterfeit FTDI devices to PID 0. Support these devices anyway.
+ */
+#define FTDI_BRICK_PID  0x
-- 
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] usb: serial: Add "bricked" FTDI device PID

2014-10-22 Thread Greg KH
On Wed, Oct 22, 2014 at 11:31:34PM -0400, Perry Hung wrote:
> An official recent Windows driver from FTDI detects counterfeit devices
> and reprograms the internal EEPROM containing the USB PID to 0, effectively
> bricking the device.
> 
> Add support for this VID/PID pair to correctly bind the driver on these
> devices.
> 
> See:
> http://hackaday.com/2014/10/22/watch-that-windows-update-ftdi-drivers-are-killing-fake-chips/
> 
> Signed-off-by: Perry Hung 

Thanks for doing this, Johan, feel free to add:

Cc: stable 
Acked-by: Greg Kroah-Hartman 

to it when/if you apply it to your tree.

thanks,

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


Re: [PATCH v2 2/4] usb: chipidea: add hw_wait_phy_stable for getting stable status

2014-10-22 Thread Peter Chen
On Wed, Oct 22, 2014 at 12:56:04PM +, David Laight wrote:
> From: Peter Chen
> > The phy needs some delay to output the stable status from low
> > power mode. And for OTGSC, the status inputs are debounced
> > using a 1 ms time constant, so, delay 2ms for controller to get
> > the stable status(like vbus and id) when the phy leaves low power.
> > 
> > Signed-off-by: Peter Chen 
> > ---
> >  drivers/usb/chipidea/core.c |   24 
> >  1 file changed, 16 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index 409aba3..ac7aa7e 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -189,6 +189,17 @@ u8 hw_port_test_get(struct ci_hdrc *ci)
> > return hw_read(ci, OP_PORTSC, PORTSC_PTC) >> __ffs(PORTSC_PTC);
> >  }
> > 
> > +static void hw_wait_phy_stable(void)
> > +{
> > +   /*
> > +* The phy needs some delay to output the stable status from low
> > +* power mode. And for OTGSC, the status inputs are debounced
> > +* using a 1 ms time constant, so, delay 2ms for controller to get
> > +* the stable status, like vbus and id when the phy leaves low power.
> > +*/
> > +   usleep_range(2000, 2500);
> > +}
> > +
> >  /* The PHY enters/leaves low power mode */
> >  static void ci_hdrc_enter_lpm(struct ci_hdrc *ci, bool enable)
> >  {
> > @@ -307,7 +318,9 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> > case USBPHY_INTERFACE_MODE_UTMIW:
> > case USBPHY_INTERFACE_MODE_HSIC:
> > ret = usb_phy_init(ci->transceiver);
> > -   if (ret)
> > +   if (!ret)
> > +   hw_wait_phy_stable();
> > +   else
> > return ret;
> 
> Why invert the condition.
> 

If usb_phy_init fails, we want to return, and don't need to call
hw_wait_phy_stable.

> > hw_phymode_configure(ci);
> > break;
> > @@ -320,6 +333,8 @@ static int ci_usb_phy_init(struct ci_hdrc *ci)
> > break;
> > default:
> > ret = usb_phy_init(ci->transceiver);
> > +   if (!ret)
> > +   hw_wait_phy_stable();
> > }
> > 
> > return ret;
> > @@ -620,13 +635,6 @@ static int ci_hdrc_probe(struct platform_device *pdev)
> > if (ret) {
> > dev_err(dev, "unable to init phy: %d\n", ret);
> > return ret;
> > -   } else {
> 
> You don't need else after return.

Yes, isn't it?

> 
>   David
> 
> > -   /*
> > -* The delay to sync PHY's status, the maximum delay is
> > -* 2ms since the otgsc uses 1ms timer to debounce the
> > -* PHY's input
> > -*/
> > -   usleep_range(2000, 2500);
> > }
> > 
> > ci->hw_bank.phys = res->start;
> > --
> > 1.7.9.5
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> > the body of a message to majord...@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

-- 
Best Regards,
Peter Chen
--
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/4] usb: chipidea: add system power management support

2014-10-22 Thread Peter Chen
On Wed, Oct 22, 2014 at 10:26:16AM -0200, Fabio Estevam wrote:
> On Wed, Oct 22, 2014 at 10:18 AM, Peter Chen  wrote:
> 
> 
> > +static const struct dev_pm_ops ci_pm_ops = {
> > +   SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)
> > +};
> 
> You could replace this with a single line:
> 
> static SIMPLE_DEV_PM_OPS(ci_pm_ops, ci_suspend, ci_resume);

Since I plan to add runtime pm soon, don't want to change again at that time.

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


Re: [PATCH v8 3/4] gpiolib: add irq_not_threaded flag to gpio_chip

2014-10-22 Thread Alexandre Courbot
On Mon, Oct 20, 2014 at 7:19 PM, Octavian Purdila
 wrote:
> On Mon, Oct 20, 2014 at 8:08 AM, Alexandre Courbot  wrote:
>>
>> On Wed, Oct 15, 2014 at 11:48 PM, Octavian Purdila
>>  wrote:
>> > Some GPIO chips (e.g. the DLN2 USB adapter) have blocking get/set
>> > operation but do not need a threaded irq handler.
>>
>> Sorry if you already explained this (I have been a little bit late
>> with the GPIO reviews recently), but does this optimization bring a
>> significant benefit that justifies adding another field in struct
>> gpio_chip? If so it would be nice to have it in the commit message. If
>> not, do we need this at all?
>
> Hi Alexandre,
>
> In the case DLN2 USB GPIO adapter the GPIO interrupt is generated in
> the completion routine of a receive URB, which means that we are in
> interrupt context. If a threaded irq is used, we would have to
> schedule work instead of running to interrupt handler directly which
> is unnecessary and adds latency.
>
> BTW, AFAIC Linus W already merged this patch in his next tree, I am
> keeping it in this series because it was not pulled in the mfd-next
> tree.

You're right, it's all good then. Thanks for the explanation.
--
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