[patch] usb: storage: debug: uninitialized var in usb_stor_show_sense()

2014-11-29 Thread Dan Carpenter
The fmt variable might be used uninitialized, it should be set to NULL
at the start.

Fixes: d811b848ebb7 ('scsi: use sdev as argument for sense code printing')
Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/usb/storage/debug.c b/drivers/usb/storage/debug.c
index 57bf3ad..fd00509 100644
--- a/drivers/usb/storage/debug.c
+++ b/drivers/usb/storage/debug.c
@@ -164,7 +164,8 @@ void usb_stor_show_sense(const struct us_data *us,
 unsigned char asc,
 unsigned char ascq)
 {
-   const char *what, *keystr, *fmt;
+   const char *fmt = NULL;
+   const char *what, *keystr;
 
keystr = scsi_sense_key_string(key);
what = scsi_extd_sense_format(asc, ascq, fmt);
--
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: udc: missing curly braces

2014-11-29 Thread Dan Carpenter
There were curly braces intended here.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/usb/gadget/udc/bdc/bdc_ep.c 
b/drivers/usb/gadget/udc/bdc/bdc_ep.c
index 15da5b1..ff67cea 100644
--- a/drivers/usb/gadget/udc/bdc/bdc_ep.c
+++ b/drivers/usb/gadget/udc/bdc/bdc_ep.c
@@ -457,10 +457,11 @@ static int setup_bd_list_xfr(struct bdc *bdc, struct 
bdc_req *req, int num_bds)
dword3 |= BD_SOT|BD_SBF|(tfsBD_TFS_SHIFT);
dword2 |= BD_LTF;
/* format of first bd for ep0 is different than other */
-   if (ep-ep_num == 1)
+   if (ep-ep_num == 1) {
ret = setup_first_bd_ep0(bdc, req, dword3);
if (ret)
return ret;
+   }
}
if (!req-ep-dir)
dword3 |= BD_ISP;
--
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: mos7720: delete some unneeded code

2014-11-29 Thread Dan Carpenter
The status is uninitialized so this creates a static checker warning.
But it's harmless, we can just delete it.

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 312b0fe..4f70df3 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -1299,8 +1299,6 @@ static void mos7720_throttle(struct tty_struct *tty)
mos7720_port-shadowMCR = ~UART_MCR_RTS;
write_mos_reg(port-serial, port-port_number, MCR,
  mos7720_port-shadowMCR);
-   if (status != 0)
-   return;
}
 }
 
@@ -1331,8 +1329,6 @@ static void mos7720_unthrottle(struct tty_struct *tty)
mos7720_port-shadowMCR |= UART_MCR_RTS;
write_mos_reg(port-serial, port-port_number, MCR,
  mos7720_port-shadowMCR);
-   if (status != 0)
-   return;
}
 }
 
--
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: USB OTG doesn't work in HOST mode on OMAP3 processor on 3.18-rc5

2014-11-29 Thread Felipe Balbi
Hi,

On Fri, Nov 28, 2014 at 11:35:53AM +0100, Yegor Yefremov wrote:
 On Wed, Nov 19, 2014 at 6:53 PM, Tony Lindgren t...@atomide.com wrote:
  * Enric Balletbo Serra eballe...@gmail.com [141119 03:14]:
  2014-11-18 16:42 GMT+01:00 Tony Lindgren t...@atomide.com:
 
  Checked again, and no luck. It's very weird because from the OTG point
  of view, OTG is exactly the same between Beagleboard-XM and IGEPv2.
 
  Can you confirm that you're using kernel 3.18-rc5 without other
  patches applied ? At this moment, I don't have a Beagleboard-XM to
  test, I'll try to get one because at this moment I'm a bit stuck with
  this problem.
 
  Yes it was with v3.18-rc5 and the defconfig patch I posted except
  I had to disable all the other MUSB platforms. Also tested it with
  built in modules.
 
  Maybe you need to check the .dts pinctrl entries for hsusb0_* lines?
 
 Just my 2 cents, My am335x based board shows similar symptoms
 (CONFIG_USB_MUSB_DUAL_ROLE enabled). Only if I specify  dr_mode =
 host; in my DTS I get device enumerated. 3.15, that I had before
 made no problems as OTG.

Are you sure your ID pin is properly routed ? If you set dr_mode to otg,
then you *must* have a properly routed ID pin and use a proper
micro-/mini-ab receptacle. That's not true for e.g. beagle bone black.

One USB port is using a Standard-A while the other uses mini-B. You
can't do any role swapping with those.

-- 
balbi


signature.asc
Description: Digital signature


Re: [patch] usb: storage: debug: uninitialized var in usb_stor_show_sense()

2014-11-29 Thread James Bottomley
On Sat, 2014-11-29 at 15:48 +0300, Dan Carpenter wrote:
 The fmt variable might be used uninitialized, it should be set to NULL
 at the start.
 
 Fixes: d811b848ebb7 ('scsi: use sdev as argument for sense code printing')
 Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

Hm, that' falls into the category of an interface that's hard to get
right if every caller has to remember to set fmt to NULL.

Could you instead set *fmt to NULL in scsi_extd_sense_format()?  That
way the interface is much easier.

Thanks,

James


--
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: [Update][PATCH] USB / PM: Drop CONFIG_PM_RUNTIME from the USB core

2014-11-29 Thread Alan Stern
On Sat, 29 Nov 2014, Rafael J. Wysocki wrote:

  There are also one or two places in Documentation/usb that mention 
  CONFIG_PM_RUNTIME.
 
 I found this in Documentation/usb/power-management.txt:
 
 Note: Dynamic PM support for USB is present only if the kernel was
  built with CONFIG_USB_SUSPEND enabled (which depends on
  CONFIG_PM_RUNTIME).  System PM support is present only if the kernel
  was built with CONFIG_SUSPEND or CONFIG_HIBERNATION enabled.
 
  (Starting with the 3.10 kernel release, dynamic PM support for USB is
  present whenever the kernel was built with CONFIG_PM_RUNTIME enabled.
  The CONFIG_USB_SUSPEND option has been eliminated.)
 
 but I'm quite unsure how to change it.  What about:
 
 System PM support is present only if the kernel was built with CONFIG_SUSPEND
  or CONFIG_HIBERNATION enabled.  Dynamic PM support for USB is present 
 whenever
  the kernel was built with CONFIG_PM enabled.
 
  [Historically, dynamic PM support for USB was present only if the kernel
  had been built with CONFIG_USB_SUSPEND enabled (which depended on
  CONFIG_PM_RUNTIME).  Starting with the 3.10 kernel release, dynamic PM 
 support
  for USB was present whenever the kernel was built with CONFIG_PM_RUNTIME
  enabled.  The CONFIG_USB_SUSPEND option had been eliminated.]

That sounds fine.  Thanks.

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: enable all functions remote wakeup for USB3 composite device

2014-11-29 Thread gre...@linuxfoundation.org
On Sat, Nov 29, 2014 at 04:22:41PM +, Li, Aixiong wrote:
 Hi USB maintainers,

Your email is sent in html format and rejected by the mailing list,
please fix up and try again.
--
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: Value Setting of hcd-self.controller-dma_mask in oxu210hp-hcd.c

2014-11-29 Thread Greg KH
On Sat, Nov 29, 2014 at 02:12:30PM -0500, nick wrote:
 I get your point. On the other hand, I am trying to help but it seems
 impossible with my ban to not do it this way.

You were told what to do to get the ban removed, but you for some reason
seem to ignore that request.  So we will continue to ignore you.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/3] ARM/usb: add PHY for Lubbock platform

2014-11-29 Thread Dmitry Eremin-Solenikov
This is the second iteration of a compile-tested-only PHY for the Lubbock
platform. Could you please take a look and test.

Changes since V1:
- Switched to using threaded IRQs in a phy
- This allowed me to drop workqueue scheduling
- Dropped mach/lubbock.h from pxa25x_udc.h header.

The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:

  Linux 3.18-rc1 (2014-10-19 18:08:38 -0700)

are available in the git repository at:

  git.infradead.org:public_git/zaurus.git lubbock

for you to fetch changes up to 3ef110afa33e9e5c2ab77a4ababd279f8bd4e95c:

  usb: gadget: drop lubbock-specific code from pxa25x_udc (2014-11-30 00:51:31 
+0300)


Dmitry Eremin-Solenikov (3):
  ARM: pxa: lubbock: add declaration of vbus tranceiver
  usb: phy: add lubbock phy driver
  usb: gadget: drop lubbock-specific code from pxa25x_udc

 arch/arm/mach-pxa/lubbock.c |   6 +
 drivers/usb/gadget/udc/pxa25x_udc.c |  61 --
 drivers/usb/gadget/udc/pxa25x_udc.h |   5 -
 drivers/usb/phy/Kconfig |  10 ++
 drivers/usb/phy/Makefile|   1 +
 drivers/usb/phy/phy-lubbock.c   | 220 
 6 files changed, 237 insertions(+), 66 deletions(-)
 create mode 100644 drivers/usb/phy/phy-lubbock.c

--
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/3] ARM: pxa: lubbock: add declaration of vbus tranceiver

2014-11-29 Thread Dmitry Eremin-Solenikov
Add a declaration of lubbock-vbus device, used as UDC transceiver on
Lubbock platform.

Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com
---
 arch/arm/mach-pxa/lubbock.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index d8a1be6..5e2dcf7 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -383,11 +383,17 @@ static struct platform_device lubbock_flash_device[2] = {
},
 };
 
+static struct platform_device lubbock_vbus = {
+   .name   = lubbock-vbus,
+   .id = -1,
+};
+
 static struct platform_device *devices[] __initdata = {
sa_device,
smc91x_device,
lubbock_flash_device[0],
lubbock_flash_device[1],
+   lubbock_vbus,
 };
 
 static struct pxafb_mode_info sharp_lm8v31_mode = {
-- 
2.1.3

--
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/3] usb: gadget: drop lubbock-specific code from pxa25x_udc

2014-11-29 Thread Dmitry Eremin-Solenikov
Now, as there is a special phy for lubbock platforms, drop all
lubbock-specific code from pxa25x udc driver. It should use phy instead.

Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com
---
 drivers/usb/gadget/udc/pxa25x_udc.c | 61 -
 drivers/usb/gadget/udc/pxa25x_udc.h |  5 ---
 2 files changed, 66 deletions(-)

diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c 
b/drivers/usb/gadget/udc/pxa25x_udc.c
index 42f7eeb..e3d0715 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -56,10 +56,6 @@
 #include mach/hardware.h
 #endif
 
-#ifdef CONFIG_ARCH_LUBBOCK
-#include mach/lubbock.h
-#endif
-
 /*
  * This driver handles the USB Device Controller (UDC) in Intel's PXA 25x
  * series processors.  The UDC for the IXP 4xx series is very similar.
@@ -1334,43 +1330,6 @@ static int pxa25x_udc_stop(struct usb_gadget*g,
 
 /*-*/
 
-#ifdef CONFIG_ARCH_LUBBOCK
-
-/* Lubbock has separate connect and disconnect irqs.  More typical designs
- * use one GPIO as the VBUS IRQ, and another to control the D+ pullup.
- */
-
-static irqreturn_t
-lubbock_vbus_irq(int irq, void *_dev)
-{
-   struct pxa25x_udc   *dev = _dev;
-   int vbus;
-
-   dev-stats.irqs++;
-   switch (irq) {
-   case LUBBOCK_USB_IRQ:
-   vbus = 1;
-   disable_irq(LUBBOCK_USB_IRQ);
-   enable_irq(LUBBOCK_USB_DISC_IRQ);
-   break;
-   case LUBBOCK_USB_DISC_IRQ:
-   vbus = 0;
-   disable_irq(LUBBOCK_USB_DISC_IRQ);
-   enable_irq(LUBBOCK_USB_IRQ);
-   break;
-   default:
-   return IRQ_NONE;
-   }
-
-   pxa25x_udc_vbus_session(dev-gadget, vbus);
-   return IRQ_HANDLED;
-}
-
-#endif
-
-
-/*-*/
-
 static inline void clear_ep_state (struct pxa25x_udc *dev)
 {
unsigned i;
@@ -2154,26 +2113,6 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
}
dev-got_irq = 1;
 
-#ifdef CONFIG_ARCH_LUBBOCK
-   if (machine_is_lubbock()) {
-   retval = devm_request_irq(pdev-dev, LUBBOCK_USB_DISC_IRQ,
- lubbock_vbus_irq, 0, driver_name,
- dev);
-   if (retval != 0) {
-   pr_err(%s: can't get irq %i, err %d\n,
-   driver_name, LUBBOCK_USB_DISC_IRQ, retval);
-   goto err;
-   }
-   retval = devm_request_irq(pdev-dev, LUBBOCK_USB_IRQ,
- lubbock_vbus_irq, 0, driver_name,
- dev);
-   if (retval != 0) {
-   pr_err(%s: can't get irq %i, err %d\n,
-   driver_name, LUBBOCK_USB_IRQ, retval);
-   goto err;
-   }
-   } else
-#endif
create_debug_files(dev);
 
retval = usb_add_gadget_udc(pdev-dev, dev-gadget);
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.h 
b/drivers/usb/gadget/udc/pxa25x_udc.h
index 3fe5931..59c6bbc 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.h
+++ b/drivers/usb/gadget/udc/pxa25x_udc.h
@@ -130,11 +130,6 @@ struct pxa25x_udc {
 
 /*-*/
 
-#ifdef CONFIG_ARCH_LUBBOCK
-#include mach/lubbock.h
-/* lubbock can also report usb connect/disconnect irqs */
-#endif
-
 static struct pxa25x_udc *the_controller;
 
 /*-*/
-- 
2.1.3

--
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/3] usb: phy: add lubbock phy driver

2014-11-29 Thread Dmitry Eremin-Solenikov
Extract lubbock-specific code from pxa25x_udc driver. As a bonus, phy
driver determines connector/VBUS status by reading CPLD register. Also
it uses a work to call into udc stack, instead of pinging vbus session
right from irq handler.

Signed-off-by: Dmitry Eremin-Solenikov dbarysh...@gmail.com
---
 drivers/usb/phy/Kconfig   |  10 ++
 drivers/usb/phy/Makefile  |   1 +
 drivers/usb/phy/phy-lubbock.c | 220 ++
 3 files changed, 231 insertions(+)
 create mode 100644 drivers/usb/phy/phy-lubbock.c

diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
index 0cd1f44..98b1682 100644
--- a/drivers/usb/phy/Kconfig
+++ b/drivers/usb/phy/Kconfig
@@ -137,6 +137,16 @@ config USB_ISP1301
  To compile this driver as a module, choose M here: the
  module will be called phy-isp1301.
 
+config USB_LUBBOCK
+   tristate USB VBUS PHY Driver for DBPXA250 Lubbock platform
+   depends on ARCH_LUBBOCK
+   help
+ Say Y here to add support for the USB Gadget VBUS tranceiver driver
+ for DBPXA250 (Lubbock) platform.
+
+ To compile this driver as a module, choose M here: the
+ module will be called phy-lubbock.
+
 config USB_MSM_OTG
tristate Qualcomm on-chip USB OTG controller support
depends on (USB || USB_GADGET)  (ARCH_MSM || ARCH_QCOM || 
COMPILE_TEST)
diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
index 75f2bba..0fe461c 100644
--- a/drivers/usb/phy/Makefile
+++ b/drivers/usb/phy/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_TWL6030_USB) += phy-twl6030-usb.o
 obj-$(CONFIG_USB_EHCI_TEGRA)   += phy-tegra-usb.o
 obj-$(CONFIG_USB_GPIO_VBUS)+= phy-gpio-vbus-usb.o
 obj-$(CONFIG_USB_ISP1301)  += phy-isp1301.o
+obj-$(CONFIG_USB_LUBBOCK)  += phy-lubbock.o
 obj-$(CONFIG_USB_MSM_OTG)  += phy-msm-usb.o
 obj-$(CONFIG_USB_MV_OTG)   += phy-mv-usb.o
 obj-$(CONFIG_USB_MXS_PHY)  += phy-mxs-usb.o
diff --git a/drivers/usb/phy/phy-lubbock.c b/drivers/usb/phy/phy-lubbock.c
new file mode 100644
index 000..f73c1a6
--- /dev/null
+++ b/drivers/usb/phy/phy-lubbock.c
@@ -0,0 +1,220 @@
+/*
+ * gpio-lubbock.c - VBUS handling code for DBPXA250 platform (lubbock)
+ *
+ * Based on lubbock-vbus.c:
+ * Copyright (c) 2008 Philipp Zabel philipp.za...@gmail.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/kernel.h
+#include linux/platform_device.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/interrupt.h
+#include linux/usb.h
+
+#include linux/usb/gadget.h
+#include linux/usb/otg.h
+
+#include mach/hardware.h
+#include mach/lubbock.h
+
+struct lubbock_vbus_data {
+   struct usb_phy  phy;
+   struct device  *dev;
+   int vbus;
+};
+
+static int is_vbus_powered(void)
+{
+   return !(LUB_MISC_RD  BIT(9));
+}
+
+static void lubbock_vbus_handle(struct lubbock_vbus_data *lubbock_vbus)
+{
+   int status, vbus;
+
+   if (!lubbock_vbus-phy.otg-gadget)
+   return;
+
+   vbus = is_vbus_powered();
+   if ((vbus ^ lubbock_vbus-vbus) == 0)
+   return;
+   lubbock_vbus-vbus = vbus;
+
+   if (vbus) {
+   status = USB_EVENT_VBUS;
+   lubbock_vbus-phy.state = OTG_STATE_B_PERIPHERAL;
+   lubbock_vbus-phy.last_event = status;
+   usb_gadget_vbus_connect(lubbock_vbus-phy.otg-gadget);
+
+   atomic_notifier_call_chain(lubbock_vbus-phy.notifier,
+  status, lubbock_vbus-phy.otg-gadget);
+   } else {
+   usb_gadget_vbus_disconnect(lubbock_vbus-phy.otg-gadget);
+   status = USB_EVENT_NONE;
+   lubbock_vbus-phy.state = OTG_STATE_B_IDLE;
+   lubbock_vbus-phy.last_event = status;
+
+   atomic_notifier_call_chain(lubbock_vbus-phy.notifier,
+  status, lubbock_vbus-phy.otg-gadget);
+   }
+}
+
+/* VBUS change IRQ handler */
+static irqreturn_t lubbock_vbus_irq(int irq, void *data)
+{
+   struct platform_device *pdev = data;
+   struct lubbock_vbus_data *lubbock_vbus = platform_get_drvdata(pdev);
+   struct usb_otg *otg = lubbock_vbus-phy.otg;
+
+   dev_dbg(pdev-dev, VBUS %s (gadget: %s)\n,
+   is_vbus_powered() ? supplied : inactive,
+   otg-gadget ? otg-gadget-name : none);
+
+   switch (irq) {
+   case LUBBOCK_USB_IRQ:
+   disable_irq(LUBBOCK_USB_IRQ);
+   enable_irq(LUBBOCK_USB_DISC_IRQ);
+   break;
+   case LUBBOCK_USB_DISC_IRQ:
+   disable_irq(LUBBOCK_USB_DISC_IRQ);
+   enable_irq(LUBBOCK_USB_IRQ);
+   break;
+   default:
+   return IRQ_NONE;
+  

Re: [PATCH 00/17] USB gadget functions testing, 3.19

2014-11-29 Thread Greg Kroah-Hartman
On Fri, Nov 28, 2014 at 02:57:33PM +0100, Andrzej Pietrasiewicz wrote:
 This series adds a documentation file whith a summary of how to do basic
 testing of functions provided by USB gadgets.
 
 @Greg: Felipe's tree is closed, so can you consider this series for 3.19?
 It does not add any code. It documents what is already in your tree.
 It is mostly a compilation of information from my cover letters sent
 together with all series which convert functions and gadgets to configfs.
 I think it could be useful to anyone whishing to use the gadgets.

If Felipe's tree is closed, why are you trying to go around him by
making me accept it?  That's a bit rude, don't you think?

Sorry, I'm not going to do that, work with Felipe.

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: [Update][PATCH] USB / PM: Drop CONFIG_PM_RUNTIME from the USB core

2014-11-29 Thread Rafael J. Wysocki
On Saturday, November 29, 2014 12:34:36 PM Alan Stern wrote:
 On Sat, 29 Nov 2014, Rafael J. Wysocki wrote:
 
   There are also one or two places in Documentation/usb that mention 
   CONFIG_PM_RUNTIME.
  
  I found this in Documentation/usb/power-management.txt:
  
  Note: Dynamic PM support for USB is present only if the kernel was
   built with CONFIG_USB_SUSPEND enabled (which depends on
   CONFIG_PM_RUNTIME).  System PM support is present only if the kernel
   was built with CONFIG_SUSPEND or CONFIG_HIBERNATION enabled.
  
   (Starting with the 3.10 kernel release, dynamic PM support for USB is
   present whenever the kernel was built with CONFIG_PM_RUNTIME enabled.
   The CONFIG_USB_SUSPEND option has been eliminated.)
  
  but I'm quite unsure how to change it.  What about:
  
  System PM support is present only if the kernel was built with 
  CONFIG_SUSPEND
   or CONFIG_HIBERNATION enabled.  Dynamic PM support for USB is present 
  whenever
   the kernel was built with CONFIG_PM enabled.
  
   [Historically, dynamic PM support for USB was present only if the kernel
   had been built with CONFIG_USB_SUSPEND enabled (which depended on
   CONFIG_PM_RUNTIME).  Starting with the 3.10 kernel release, dynamic PM 
  support
   for USB was present whenever the kernel was built with CONFIG_PM_RUNTIME
   enabled.  The CONFIG_USB_SUSPEND option had been eliminated.]
 
 That sounds fine.  Thanks.

OK, thanks.

I'll add that to the patch and resend it, then.

Rafael

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


[Update 2x][PATCH] USB / PM: Drop CONFIG_PM_RUNTIME from the USB core

2014-11-29 Thread Rafael J. Wysocki
From: Rafael J. Wysocki rafael.j.wyso...@intel.com

After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so quite a few
#ifdef blocks depending on CONFIG_PM_RUNTIME may now be changed to
depend on CONFIG_PM (or even dropped in some cases).

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the USB core code
and documentation.

Signed-off-by: Rafael J. Wysocki rafael.j.wyso...@intel.com
---

Added the Documentation/usb/power-management.txt changes.

Of course, this depends on commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME
if PM_SLEEP is selected) which is in linux-next only (via linux-pm) at the
moment.

---
 Documentation/ABI/stable/sysfs-bus-usb  |   14 ++
 Documentation/ABI/testing/sysfs-bus-usb |   19 +--
 Documentation/usb/power-management.txt  |   15 ---
 drivers/usb/core/driver.c   |6 +-
 drivers/usb/core/hcd-pci.c  |   11 ---
 drivers/usb/core/hcd.c  |   12 
 drivers/usb/core/hub.c  |6 +++---
 drivers/usb/core/port.c |4 ++--
 drivers/usb/core/sysfs.c|   13 -
 drivers/usb/core/usb.c  |4 +---
 drivers/usb/core/usb.h  |   23 +--
 drivers/usb/host/ehci-pci.c |2 +-
 drivers/usb/host/sl811-hcd.c|5 ++---
 drivers/usb/host/u132-hcd.c |3 +--
 drivers/usb/host/xhci-hub.c |2 +-
 drivers/usb/host/xhci.c |   29 -
 drivers/usb/phy/phy-msm-usb.c   |2 +-
 include/linux/usb.h |2 +-
 include/linux/usb/hcd.h |7 ++-
 19 files changed, 68 insertions(+), 111 deletions(-)

Index: linux-pm/drivers/usb/core/sysfs.c
===
--- linux-pm.orig/drivers/usb/core/sysfs.c
+++ linux-pm/drivers/usb/core/sysfs.c
@@ -334,14 +334,6 @@ static void remove_persist_attributes(st
dev_attr_persist.attr,
power_group_name);
 }
-#else
-
-#define add_persist_attributes(dev)0
-#define remove_persist_attributes(dev) do {} while (0)
-
-#endif /* CONFIG_PM */
-
-#ifdef CONFIG_PM_RUNTIME
 
 static ssize_t connected_duration_show(struct device *dev,
   struct device_attribute *attr, char *buf)
@@ -585,10 +577,13 @@ static void remove_power_attributes(stru
 
 #else
 
+#define add_persist_attributes(dev)0
+#define remove_persist_attributes(dev) do {} while (0)
+
 #define add_power_attributes(dev)  0
 #define remove_power_attributes(dev)   do {} while (0)
 
-#endif /* CONFIG_PM_RUNTIME */
+#endif /* CONFIG_PM */
 
 
 /* Descriptor fields */
Index: linux-pm/drivers/usb/core/driver.c
===
--- linux-pm.orig/drivers/usb/core/driver.c
+++ linux-pm/drivers/usb/core/driver.c
@@ -1493,10 +1493,6 @@ int usb_resume(struct device *dev, pm_me
return status;
 }
 
-#endif /* CONFIG_PM */
-
-#ifdef CONFIG_PM_RUNTIME
-
 /**
  * usb_enable_autosuspend - allow a USB device to be autosuspended
  * @udev: the USB device which may be autosuspended
@@ -1876,7 +1872,7 @@ int usb_set_usb2_hardware_lpm(struct usb
return ret;
 }
 
-#endif /* CONFIG_PM_RUNTIME */
+#endif /* CONFIG_PM */
 
 struct bus_type usb_bus_type = {
.name = usb,
Index: linux-pm/drivers/usb/core/hcd-pci.c
===
--- linux-pm.orig/drivers/usb/core/hcd-pci.c
+++ linux-pm/drivers/usb/core/hcd-pci.c
@@ -429,7 +429,6 @@ static int check_root_hub_suspended(stru
return 0;
 }
 
-#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME)
 static int suspend_common(struct device *dev, bool do_wakeup)
 {
struct pci_dev  *pci_dev = to_pci_dev(dev);
@@ -528,7 +527,6 @@ static int resume_common(struct device *
}
return retval;
 }
-#endif /* SLEEP || RUNTIME */
 
 #ifdef CONFIG_PM_SLEEP
 
@@ -607,8 +605,6 @@ static int hcd_pci_restore(struct device
 
 #endif /* CONFIG_PM_SLEEP */
 
-#ifdef CONFIG_PM_RUNTIME
-
 static int hcd_pci_runtime_suspend(struct device *dev)
 {
int retval;
@@ -630,13 +626,6 @@ static int hcd_pci_runtime_resume(struct
return retval;
 }
 
-#else
-
-#define hcd_pci_runtime_suspendNULL
-#define hcd_pci_runtime_resume NULL
-
-#endif /* CONFIG_PM_RUNTIME */
-
 const struct dev_pm_ops usb_hcd_pci_pm_ops = {
.suspend= hcd_pci_suspend,
.suspend_noirq  = hcd_pci_suspend_noirq,
Index: linux-pm/drivers/usb/core/port.c
===
--- linux-pm.orig/drivers/usb/core/port.c
+++ linux-pm/drivers/usb/core/port.c
@@ -72,7 +72,7 @@ static void usb_port_device_release(stru
kfree(port_dev);
 }
 
-#ifdef 

Re: [PATCH v2 2/3] usb: phy: add lubbock phy driver

2014-11-29 Thread Jeremiah Mahler
Dmitry,

On Sun, Nov 30, 2014 at 01:02:04AM +0300, Dmitry Eremin-Solenikov wrote:
 Extract lubbock-specific code from pxa25x_udc driver. As a bonus, phy
 
[]
 diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig
 index 0cd1f44..98b1682 100644
 --- a/drivers/usb/phy/Kconfig
 +++ b/drivers/usb/phy/Kconfig
 @@ -137,6 +137,16 @@ config USB_ISP1301
 To compile this driver as a module, choose M here: the
 module will be called phy-isp1301.
  
 +config USB_LUBBOCK
 + tristate USB VBUS PHY Driver for DBPXA250 Lubbock platform
 + depends on ARCH_LUBBOCK
 + help
 +   Say Y here to add support for the USB Gadget VBUS tranceiver driver
^^
transceiver
 +   for DBPXA250 (Lubbock) platform.
 +
 +   To compile this driver as a module, choose M here: the
 +   module will be called phy-lubbock.
 +
  config USB_MSM_OTG
   tristate Qualcomm on-chip USB OTG controller support
   depends on (USB || USB_GADGET)  (ARCH_MSM || ARCH_QCOM || 
 COMPILE_TEST)
 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 +};
[]
 +module_platform_driver(lubbock_vbus_driver);
 +
 +MODULE_DESCRIPTION(OTG transceiver driver for DBPXA250 Lubbock platform);
 +MODULE_AUTHOR(Dmitry Eremin-Solenikov);
 +MODULE_LICENSE(GPL v2);
 -- 
 2.1.3
 
 --
[]

-- 
- Jeremiah Mahler
--
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: Is this 32-bit NCM?

2014-11-29 Thread Enrico Mioso
Hi guys.
Sorry for the late our but ... I was trying to figure out something new about 
this dongle.
I also searched for it in my city shops without finding it actually.
But then I came back and ... tried to look at some things.

Alex, Kevin: in the Windows USB captures you sent me (and that I sent on the 
List), I can notiche something very strange.
with a shell on a computer connected to a test device I can see the following:
at+gmr
21.286.03.01.209
OK
and so why in the Windows sniff the dongle answers to the same question 
something like
23.128.00.00.00
?
Alex - was it the same dongle?
Kevin or anyone: can you use putty to interact with the dongle under Windows 
and type some commands, like:
at+gmr
and other similar commands?
If the dongle reports different firmware versions under Linux and Windows, then 
guys... we need to figure out the Windows switch message.
Overmore - in the device installation sh*t, you can see there is a firmware 
updater... Why?

Alex: I used the
at^reset
command to get the modem back to normal state once; and so it restored the 
nvram to default or something.
If you reconnect it to windows ... i hope it gets re-setup as before.
But - nothing harmful to the device, only to it's settings, sorry.
I restored the relevant settings and it connects again, but no dhcp. But - be 
peaceful: other modems out there seems to not get dhcp anyway.
this is the state the modem arrives when you buy it, so windows should know 
Wwhat To Say To The Modem (TM).
Another thing - note that:
[14170.048693] cdc_ncm 1-2:1.2: GET_MAX_DATAGRAM_SIZE failed

Any ideas, comments, suggestions are highly appreciated guys.
Of any type.

Bjorn - unfortunately it seems this problem is related to E3727 and E3276 
sticks; they can get IP from DHCP but not go ahead.

--
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: enable all functions remote wakeup for USB3 composite device

2014-11-29 Thread Li, Aixiong
Hi USB maintainers,

I found one problem for remote wakeup of USB3 composite device when I tested 
remote wakeup functionality for Intel LTE modem. This LTE modem is USB3 
composite device, it cannot generate remote wakeup except the 1st function. 
After check the USB 3.0 spec and current LINUX driver, I wrote the following 
patch. After I applied this patch, this LTE modem can generate remote wakeup 
for all functions. So please help to review it.

(Since my last email is rejected due to html format, I re-send it using plain 
text)

Regards.
Aixiong Li

From 636a5ed9fbdab1a90945b1555ae765fc8d0232e6 Mon Sep 17 00:00:00 2001
From: Li Aixiong aixiong...@intel.com
Date: Fri, 7 Nov 2014 12:53:01 +0800
Subject: [PATCH] USB: enable all functions remote wakeup for USB3 composite
device

In current usb driver, it only enable remote wakeup for the first
function of USB3 device. It is found some USB3 composite devices cannot
trigger remote wakeup in the 2nd function, 3rd function etc., since remote
wakeup not enabled for those functions.  This patch enable remote wakeup
for all functions.

The composite device may or may not use the associate interface.
If associated interface is used, enable remote wakeup for the first
interface of function is enough. For CDC device, only enable the CDC-control
interfaces. For other multi-interface device, enable every interface.

Change-Id: Ifa9c1783e807868cecd1c0978b6441ea360b8d55
Signed-off-by: Li Aixiong aixiong...@intel.com
---
drivers/usb/core/hub.c |  133 +---
1 file changed, 115 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 1dcf9a5..8efb1da 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2898,30 +2898,91 @@ void usb_enable_ltm(struct usb_device *udev)
}
EXPORT_SYMBOL_GPL(usb_enable_ltm);

+static struct usb_interface_assoc_descriptor *is_assoc_interface(
+  struct usb_device *dev,
+  struct usb_host_config 
*config,
+  u8 inum)
+{
+   struct usb_interface_assoc_descriptor *intf_assoc;
+   int first_intf;
+   int last_intf;
+   int i;
+
+   for (i = 0; (i  USB_MAXIADS  config-intf_assoc[i]); i++) {
+   intf_assoc = config-intf_assoc[i];
+   if (intf_assoc-bInterfaceCount == 0)
+continue;
+
+   first_intf = intf_assoc-bFirstInterface;
+   last_intf = first_intf + (intf_assoc-bInterfaceCount - 1);
+   if (inum = first_intf  inum = last_intf)
+return intf_assoc;
+   }
+
+   return NULL;
+}
+
+
/*
  * usb_enable_remote_wakeup - enable remote wakeup for a device
  * @udev: target device
  *
  * For USB-2 devices: Set the device's remote wakeup feature.
  *
- * For USB-3 devices: Assume there's only one function on the device and
- * enable remote wake for the first interface.  FIXME if the interface
- * association descriptor shows there's more than one function.
+ * For USB-3 devices: enable  remote wakeup for all  functions.
  */
static int usb_enable_remote_wakeup(struct usb_device *udev)
{
+   struct usb_host_config *config = udev-actconfig;
+   struct usb_interface_assoc_descriptor *intf_assoc;
+   struct usb_interface   *intf;
+   int intf_num;
+   int intf_class;
+   int i;
+   int ret = 0;
+
   if (udev-speed  USB_SPEED_SUPER)
   return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
 USB_REQ_SET_FEATURE, USB_RECIP_DEVICE,
 USB_DEVICE_REMOTE_WAKEUP, 0, NULL, 0,
 USB_CTRL_SET_TIMEOUT);
-   else
-return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-  USB_REQ_SET_FEATURE, USB_RECIP_INTERFACE,
-  USB_INTRF_FUNC_SUSPEND,
-  USB_INTRF_FUNC_SUSPEND_RW |
-  USB_INTRF_FUNC_SUSPEND_LP,
-  NULL, 0, USB_CTRL_SET_TIMEOUT);
+
+   for (i = 0; i  config-desc.bNumInterfaces; i++) {
+   intf = config-interface[i];
+   intf_class = intf-cur_altsetting-desc.bInterfaceClass;
+   intf_num = intf-cur_altsetting-desc.bInterfaceNumber;
+
+   if (intf_class == USB_CLASS_CDC_DATA)
+continue;
+
+   intf_assoc = is_assoc_interface(udev, config, intf_num);
+   if (intf_assoc  intf_num != intf_assoc-bFirstInterface)
+continue;
+
+   /* the lower byte of wIndex shall be set to the first
+   * interface that is part of that function (USB 3.0 spec
+   * section 9.4.9)
+   */
+   ret = 

RE: [PATCH] USB: enable all functions remote wakeup for USB3 composite device

2014-11-29 Thread Li, Aixiong
Hi all,

The patch format still have some problem since I copied it from the html mail. 
I fix it in this mail. :)

Aixiong.

From 636a5ed9fbdab1a90945b1555ae765fc8d0232e6 Mon Sep 17 00:00:00 2001
From: Li Aixiong aixiong...@intel.com
Date: Fri, 7 Nov 2014 12:53:01 +0800
Subject: [PATCH] USB: enable all functions remote wakeup for USB3 composite
 device

In current usb driver, it only enable remote wakeup for the first
function of USB3 device. It is found some USB3 composite devices cannot
trigger remote wakeup in the 2nd function, 3rd function etc. since remote
wakeup not enabled for those functions.  This patch enable remote wakeup
for all functions.

The composite device may or may not use the associate interface.
If associated interface is used, enable remote wakeup for the first
interface of function is enough. For CDC device, only enable the CDC-control
interfaces. For other multi-interface device, enable every interface.

Change-Id: Ifa9c1783e807868cecd1c0978b6441ea360b8d55
Signed-off-by: Li Aixiong aixiong...@intel.com
---
 drivers/usb/core/hub.c |  133 +---
 1 file changed, 115 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 1dcf9a5..8efb1da 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2898,30 +2898,91 @@ void usb_enable_ltm(struct usb_device *udev)
 }
 EXPORT_SYMBOL_GPL(usb_enable_ltm);
 
+static struct usb_interface_assoc_descriptor *is_assoc_interface(
+   struct usb_device *dev,
+   struct usb_host_config *config,
+   u8 inum)
+{
+   struct usb_interface_assoc_descriptor *intf_assoc;
+   int first_intf;
+   int last_intf;
+   int i;
+
+   for (i = 0; (i  USB_MAXIADS  config-intf_assoc[i]); i++) {
+   intf_assoc = config-intf_assoc[i];
+   if (intf_assoc-bInterfaceCount == 0)
+   continue;
+
+   first_intf = intf_assoc-bFirstInterface;
+   last_intf = first_intf + (intf_assoc-bInterfaceCount - 1);
+   if (inum = first_intf  inum = last_intf)
+   return intf_assoc;
+   }
+
+   return NULL;
+}
+
+
 /*
  * usb_enable_remote_wakeup - enable remote wakeup for a device
  * @udev: target device
  *
  * For USB-2 devices: Set the device's remote wakeup feature.
  *
- * For USB-3 devices: Assume there's only one function on the device and
- * enable remote wake for the first interface.  FIXME if the interface
- * association descriptor shows there's more than one function.
+ * For USB-3 devices: enable  remote wakeup for all  functions.
  */
 static int usb_enable_remote_wakeup(struct usb_device *udev)
 {
+   struct usb_host_config *config = udev-actconfig;
+   struct usb_interface_assoc_descriptor *intf_assoc;
+   struct usb_interface*intf;
+   int intf_num;
+   int intf_class;
+   int i;
+   int ret = 0;
+
if (udev-speed  USB_SPEED_SUPER)
return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
USB_REQ_SET_FEATURE, USB_RECIP_DEVICE,
USB_DEVICE_REMOTE_WAKEUP, 0, NULL, 0,
USB_CTRL_SET_TIMEOUT);
-   else
-   return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
-   USB_REQ_SET_FEATURE, USB_RECIP_INTERFACE,
-   USB_INTRF_FUNC_SUSPEND,
-   USB_INTRF_FUNC_SUSPEND_RW |
-   USB_INTRF_FUNC_SUSPEND_LP,
-   NULL, 0, USB_CTRL_SET_TIMEOUT);
+
+   for (i = 0; i  config-desc.bNumInterfaces; i++) {
+   intf = config-interface[i];
+   intf_class = intf-cur_altsetting-desc.bInterfaceClass;
+   intf_num = intf-cur_altsetting-desc.bInterfaceNumber;
+
+   if (intf_class == USB_CLASS_CDC_DATA)
+   continue;
+
+   intf_assoc = is_assoc_interface(udev, config, intf_num);
+   if (intf_assoc  intf_num != intf_assoc-bFirstInterface)
+   continue;
+
+   /* the lower byte of wIndex shall be set to the first
+* interface that is part of that function (USB 3.0 spec
+* section 9.4.9)
+*/
+   ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+   USB_REQ_SET_FEATURE, USB_RECIP_INTERFACE,
+   USB_INTRF_FUNC_SUSPEND,
+   USB_INTRF_FUNC_SUSPEND_RW |
+   USB_INTRF_FUNC_SUSPEND_LP |
+   intf_num,
+   NULL, 0, USB_CTRL_SET_TIMEOUT);
+
+   if (ret) {
+   dev_warn(udev-dev,
+   Can't enable