Re: Linux USB file storage gadget with new UDC

2013-06-03 Thread victor yeo
Hi,

 When i run USB 2.0 Command Verifier on file gadget and UDC driver, an
 error in Command Verifier says Device must support being set to
 Addressed/Configured state.  Does it mean the gadget cannot support
 putting device in addressed state or configured state, as in
 supporting the Set Address and Set Configuration requests?

 I don't know what it means.  The gadget _does_ support being set to the
 Addressed and Configured states.  If it didn't support these things,
 you would not have been able to test it at all.

 Alan Stern


The gadget log when Command Verifier says Device must support being
set to Addressed/Configured state is attached. The log shows get
device descriptor, get configuration descriptor, and set configuration
requests are received. I see nothing wrong in gadget log. Does the log
indicate any problem that corresponds to the error message in Command
Verifier?

Thanks,
victor
# dmesg
g_file_storage gadget: disconnect or port reset
after kagen2_ep_queue
kagen2_ep_queue 31 512 31
[kagen2_ep_queue] 43425355 8a47aaf8
g_file_storage gadget: bulk-out, length 31:
: 55 53 42 43 f8 aa 47 8a 00 00 00 00 00 00 0a 35
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
g_file_storage gadget: SCSI command: SYNCHRONIZE CACHE;  Dc=10, Dn=0;  Hc=10, 
Hn=0
attention condition
g_file_storage gadget: after calling do_scsi_command
g_file_storage gadget: reset config
g_file_storage gadget: reset interface
g_file_storage gadget: in handle_exception loop
g_file_storage gadget: in fsg-running loop
g_file_storage gadget: in fsg-running loop
g_file_storage gadget: disconnect or port reset
g_file_storage gadget: in handle_exception loop
g_file_storage gadget: in fsg-running loop
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 01 00 00 12 00
g_file_storage gadget: get device descriptor
ept0 in queue len 0x12, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 18:
: 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02
0010: 00 01
USB_RECIP_DEVICE
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 01 00 00 12 00
g_file_storage gadget: get device descriptor
ept0 in queue len 0x12, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 18:
: 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02
0010: 00 01
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 02 00 00 09 00
g_file_storage gadget: get configuration descriptor
ept0 in queue len 0x9, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 9:
: 09 02 20 00 01 01 04 c0 01
g_file_storage gadget: ep0-setup, length 8:
: 00 09 01 00 00 00 00 00
g_file_storage gadget: set configuration
g_file_storage gadget: set interface 0
g_file_storage gadget: high-speed config #1
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 02 00 00 09 00
g_file_storage gadget: get configuration descriptor
ept0 in queue len 0x9, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 9:
: 09 02 20 00 01 01 04 c0 01
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 02 00 00 20 00
g_file_storage gadget: get configuration descriptor
ept0 in queue len 0x20, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 32:
: 09 02 20 00 01 01 04 c0 01 09 04 00 00 02 08 06
0010: 50 05 07 05 81 02 00 02 00 07 05 01 02 00 02 01
g_file_storage gadget: in handle_exception loop
[start_transfer] 43425355 8a47aaf8
ept1 out queue len 0x200, buffer 0xc0c44000
before kagen2_ep_queue
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 01 00 00 12 00
g_file_storage gadget: get device descriptor
ept0 in queue len 0x12, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 18:
: 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02
0010: 00 01
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 06 00 00 0a 00
g_file_storage gadget: get device qualifier
ept0 in queue len 0xa, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 10:
: 0a 06 00 02 00 00 00 40 01 00
g_file_storage gadget: ep0-setup, length 8:
: 80 06 00 02 00 00 09 00
g_file_storage gadget: get configuration descriptor
ept0 in queue len 0x9, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 9:
: 09 02 20 00 01 01 04 c0 01
g_file_storage gadget: ep0-setup, length 8:
: 80 08 00 00 00 00 01 00
g_file_storage gadget: get configuration
ept0 in queue len 0x1, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 1:
: 01
g_file_storage gadget: ep0-setup, length 8:
: 80 08 00 00 00 00 01 00
g_file_storage gadget: get configuration
ept0 in queue len 0x1, buffer 0xc1289800
g_file_storage gadget: ep0-in, length 1:
: 01
# 

Re: [PATCH v8 2/3] ARM: shmobile: r8a7778: add USB support

2013-06-03 Thread Sergei Shtylyov

Hello.

On 03-06-2013 4:24, Kuninori Morimoto wrote:


Add USB clock and EHCI, OHCI, and USB PHY platform devices for R8A7778 SoC;  add
a function to register PHY device with board-specific platform data and register
EHCI and OHCI platfrom devices from the init_late() board method.



Also,  don't forget to enable CONFIG_ARCH_HAS_[EO]HCI options for R8A7778 SoC in
Kconfig...



The patch has been tested on the BOCK-W board.



Signed-off-by: Sergei Shtylyov sergei.shtyl...@cogentembedded.com
---

(snip)

+void __init r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata)
+{
+   platform_device_register_resndata(platform_bus, rcar_usb_phy, -1,
+ usb_phy_resources,
+ ARRAY_SIZE(usb_phy_resources),
+ pdata, sizeof(*pdata));
+}

(snip)

+void __init r8a7778_init_late(void)
+{
+   phy = usb_get_phy(USB_PHY_TYPE_USB2);
+
+   platform_device_register_full(ehci_info);
+   platform_device_register_full(ohci_info);
+}



This means ehci/ohci device registration happened compulsorily if Soc/platform 
calls r8a7778_init_late().
but, usb phy isn't registered without r8a7778_add_usb_phy_device().



The ohci/ehci resource will be  used vainly if platform doesn't have USB


   The platform device resources are never used vainly. And remember 
that if PHY doesn't get registered, OHCI/EHCI won't get probed 
successfully either -- mind the usb_power_on() platform method.



ohci/ehci and phy should be registered in same time/function.


   I just copied your approach from the R8A7779 code.


Best regards
---
Kuninori Morimoto


WBR, Sergei

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


[PATCH v1 1/1] mpc512x: silence a USB Kconfig dependency warning

2013-06-03 Thread Gerhard Sittig
the PPC_MPC512x config automatically selected USB_EHCI_BIG_ENDIAN_*
switches, which made Kconfig warn about unmet direct dependencies:

  scripts/kconfig/conf --silentoldconfig Kconfig
  warning: (PPC_MPC512x  440EPX) selects USB_EHCI_BIG_ENDIAN_DESC which has 
unmet direct dependencies (USB_SUPPORT  USB  USB_EHCI_HCD)
  warning: (PPC_MPC512x  PPC_PS3  PPC_CELLEB  440EPX) selects 
USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT  
USB  USB_EHCI_HCD)
  warning: (PPC_MPC512x  440EPX) selects USB_EHCI_BIG_ENDIAN_DESC which has 
unmet direct dependencies (USB_SUPPORT  USB  USB_EHCI_HCD)
  warning: (PPC_MPC512x  PPC_PS3  PPC_CELLEB  440EPX) selects 
USB_EHCI_BIG_ENDIAN_MMIO which has unmet direct dependencies (USB_SUPPORT  
USB  USB_EHCI_HCD)

make the selected entries additionally depend on USB_EHCI_HCD which
silences the warning

Signed-off-by: Gerhard Sittig g...@denx.de
---
 arch/powerpc/platforms/512x/Kconfig |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/512x/Kconfig 
b/arch/powerpc/platforms/512x/Kconfig
index aaf1edb..049fb7b 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -17,8 +17,8 @@ config PPC_MPC512x
select PPC_PCI_CHOICE
select FSL_PCI if PCI
select ARCH_WANT_OPTIONAL_GPIOLIB
-   select USB_EHCI_BIG_ENDIAN_MMIO
-   select USB_EHCI_BIG_ENDIAN_DESC
+   select USB_EHCI_BIG_ENDIAN_MMIO if USB_EHCI_HCD
+   select USB_EHCI_BIG_ENDIAN_DESC if USB_EHCI_HCD
 
 config MPC5121_ADS
bool Freescale MPC5121E ADS
-- 
1.7.10.4

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


[PATCH] chipidea: move to pcim_* functions

2013-06-03 Thread Andy Shevchenko
This patch makes error path cleaner and probe function tidier.

Signed-off-by: Andy Shevchenko andriy.shevche...@linux.intel.com
---
 It assumes that removal of PCI_D0 and drvdata(NULL) were done previously.

 drivers/usb/chipidea/ci13xxx_pci.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/usb/chipidea/ci13xxx_pci.c 
b/drivers/usb/chipidea/ci13xxx_pci.c
index 59fab90..c9e9cb3 100644
--- a/drivers/usb/chipidea/ci13xxx_pci.c
+++ b/drivers/usb/chipidea/ci13xxx_pci.c
@@ -49,7 +49,7 @@ static struct ci13xxx_platform_data penwell_pci_platdata = {
  * invokes the udc_probe() method to start the UDC associated with it
  */
 static int ci13xxx_pci_probe(struct pci_dev *pdev,
-  const struct pci_device_id *id)
+const struct pci_device_id *id)
 {
struct ci13xxx_platform_data *platdata = (void *)id-driver_data;
struct platform_device *plat_ci;
@@ -61,14 +61,13 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
return -ENODEV;
}
 
-   retval = pci_enable_device(pdev);
+   retval = pcim_enable_device(pdev);
if (retval)
-   goto done;
+   return retval;
 
if (!pdev-irq) {
dev_err(pdev-dev, No IRQ, check BIOS/PCI setup!);
-   retval = -ENODEV;
-   goto disable_device;
+   return -ENODEV;
}
 
pci_set_master(pdev);
@@ -84,18 +83,12 @@ static int ci13xxx_pci_probe(struct pci_dev *pdev,
plat_ci = ci13xxx_add_device(pdev-dev, res, nres, platdata);
if (IS_ERR(plat_ci)) {
dev_err(pdev-dev, ci13xxx_add_device failed!\n);
-   retval = PTR_ERR(plat_ci);
-   goto disable_device;
+   return PTR_ERR(plat_ci);
}
 
pci_set_drvdata(pdev, plat_ci);
 
return 0;
-
- disable_device:
-   pci_disable_device(pdev);
- done:
-   return retval;
 }
 
 /**
@@ -111,7 +104,6 @@ static void ci13xxx_pci_remove(struct pci_dev *pdev)
struct platform_device *plat_ci = pci_get_drvdata(pdev);
 
ci13xxx_remove_device(plat_ci);
-   pci_disable_device(pdev);
 }
 
 /**
-- 
1.8.2.rc0.22.gb3600c3

--
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: xhci: Disable runtime PM suspend for quirky controllers.

2013-06-03 Thread Oliver Neukum
On Wednesday 29 May 2013 16:32:38 Don Zickus wrote:
 On Wed, May 29, 2013 at 12:38:28PM -0700, Sarah Sharp wrote:
  On Tue, May 28, 2013 at 02:41:18PM -0700, Julius Werner wrote:
   The policy we want to achieve is to disable runtime PM iff there is a
   device connected that doesn't have persist_enabled or a reset_resume()
   handler and whose parent/root hub resets on resume, right?
  
  Makes sense.  However, not all distros may want that policy, so there
  should be a way to change that policy via sysfs.  Some distros may
  choose to take the power savings over having a particular USB device
  work, especially in the server market.
  
  Don, Oliver, what do you think of this patch:
  http://marc.info/?l=linux-usbm=136941922715772w=2
 
 That is limited only to certain controllers right?  RHEL6 doesn't support
 runtime suspend, so we don't hear to many complaints.  Most of our server
 customers don't have much plugged into USB, so I don't expect much
 problems there.  Our laptop customers prefer the power savings, but I
 don't know how many of them have chipsets with XHCI_RESET_ON_RESUME.

Power savings are good, but reliability is better. For what it's worth,ior
I like the patch. It is a logical extension of the current behavior.

Regards
Oliver

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


Re: [PATCH] usb: dwc3: Addition of dr_mode dt property.

2013-06-03 Thread Michael Grzeschik
Hi Felipe,

On Thu, May 30, 2013 at 03:31:21PM -0500, Ruchika Kharwar wrote:
 This patch adds an optional parameter dr_mode to the dwc3 core device node.
 In the case the compile flag for the DWC3 controller is set to
 USB_DWC3_DUAL_ROLE a device tree could restrain to either functionality of
 host or gadget. In the case the device tree does not use this optional flag or
 specifies it superfluously to drd the functionality will be that
 of a dual role device.
 
 Signed-off-by: Ruchika Kharwar ruch...@ti.com
 ---
  Documentation/devicetree/bindings/usb/dwc3.txt |3 ++-
  drivers/usb/dwc3/core.c|   20 +---
  2 files changed, 19 insertions(+), 4 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/usb/dwc3.txt 
 b/Documentation/devicetree/bindings/usb/dwc3.txt
 index 7a95c65..2f5d584 100644
 --- a/Documentation/devicetree/bindings/usb/dwc3.txt
 +++ b/Documentation/devicetree/bindings/usb/dwc3.txt
 @@ -10,7 +10,8 @@ Required properties:
  
  Optional properties:
   - tx-fifo-resize: determines if the FIFO *has* to be reallocated.
 -
 + - dr_mode: determines the mode of core. Supported modes are gadget, host
 +   and drd.
  This is usually a subnode to DWC3 glue to which it is connected.
  
  dwc3@4a03 {
 diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
 index c35d49d..05c0c8b 100644
 --- a/drivers/usb/dwc3/core.c
 +++ b/drivers/usb/dwc3/core.c
 @@ -378,6 +378,7 @@ static int dwc3_probe(struct platform_device *pdev)
   void*mem;
  
   u8  mode;
 + char*dr_mode;
  
   mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
   if (!mem) {
 @@ -520,9 +521,22 @@ static int dwc3_probe(struct platform_device *pdev)
   mode = DWC3_MODE_HOST;
   else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
   mode = DWC3_MODE_DEVICE;
 - else
 - mode = DWC3_MODE_DRD;
 -
 + else {
 + if (of_property_read_string(node, dr_mode, dr_mode))
 + mode = DWC3_MODE_DRD;
 + else {
 + if (strcmp(dr_mode, host) == 0)
 + mode = DWC3_MODE_HOST;
 + else if (strcmp(dr_mode, gadget) == 0)
 + mode = DWC3_MODE_DEVICE;
 + else if (strcmp(dr_mode, drd) == 0)
 + mode = DWC3_MODE_DRD;
 + else {
 + dev_err(dev, invalid dr_mode property 
 value\n);
 + goto err2;
 + }
 + }
 + }
   switch (mode) {
   case DWC3_MODE_DEVICE:
   dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
 -- 
 1.7.5.4

this is more likely to be solved with a common property description for
the gadget layer. We have some prepared parts in the latest patch series:

[PATCH 1/7] USB: add devicetree helpers for determining dr_mode and phy_type
http://www.spinics.net/lists/linux-usb/msg86829.html

What do you think?

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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 1/7] USB: add devicetree helpers for determining dr_mode and phy_type

2013-06-03 Thread Alexander Shishkin
Michael Grzeschik m...@pengutronix.de writes:

 From: Michael Grzeschik m.grzesc...@pengutronix.de

 This adds two little devicetree helper functions for determining the
 dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
 the devicetree.

This one needs an ack from Felipe.


 Signed-off-by: Michael Grzeschik m.grzesc...@pengutronix.de
 Signed-off-by: Marc Kleine-Budde m...@pengutronix.de
 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---
  drivers/usb/phy/Makefile |  1 +
  drivers/usb/phy/of.c | 47 +++
  drivers/usb/usb-common.c | 35 +++
  include/linux/usb/of.h   | 28 
  include/linux/usb/otg.h  |  7 +++
  include/linux/usb/phy.h  |  9 +
  6 files changed, 127 insertions(+)
  create mode 100644 drivers/usb/phy/of.c
  create mode 100644 include/linux/usb/of.h

 diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile
 index a9169cb..070eca3 100644
 --- a/drivers/usb/phy/Makefile
 +++ b/drivers/usb/phy/Makefile
 @@ -5,6 +5,7 @@
  ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
  
  obj-$(CONFIG_USB_PHY)+= phy.o
 +obj-$(CONFIG_OF) += of.o
  
  # transceiver drivers, keep the list sorted
  
 diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c
 new file mode 100644
 index 000..e6f3b74
 --- /dev/null
 +++ b/drivers/usb/phy/of.c
 @@ -0,0 +1,47 @@
 +/*
 + * USB of helper code
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
 + * (at your option) any later version.
 + */
 +
 +#include linux/kernel.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/usb/of.h
 +#include linux/usb/otg.h
 +
 +static const char *usbphy_modes[] = {
 + [USBPHY_INTERFACE_MODE_UNKNOWN] = ,
 + [USBPHY_INTERFACE_MODE_UTMI]= utmi,
 + [USBPHY_INTERFACE_MODE_UTMIW]   = utmi_wide,
 + [USBPHY_INTERFACE_MODE_ULPI]= ulpi,
 + [USBPHY_INTERFACE_MODE_SERIAL]  = serial,
 + [USBPHY_INTERFACE_MODE_HSIC]= hsic,
 +};
 +
 +/**
 + * of_usb_get_phy_mode - Get phy mode for given device_node
 + * @np:  Pointer to the given device_node
 + *
 + * The function gets phy interface string from property 'phy_type',
 + * and returns the correspondig enum usb_phy_interface
 + */
 +enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
 +{
 + const char *phy_type;
 + int err, i;
 +
 + err = of_property_read_string(np, phy_type, phy_type);
 + if (err  0)
 + return USBPHY_INTERFACE_MODE_UNKNOWN;
 +
 + for (i = 0; i  ARRAY_SIZE(usbphy_modes); i++)
 + if (!strcmp(phy_type, usbphy_modes[i]))
 + return i;
 +
 + return USBPHY_INTERFACE_MODE_UNKNOWN;
 +}
 +EXPORT_SYMBOL_GPL(of_usb_get_phy_mode);
 diff --git a/drivers/usb/usb-common.c b/drivers/usb/usb-common.c
 index 0db0a91..027582d 100644
 --- a/drivers/usb/usb-common.c
 +++ b/drivers/usb/usb-common.c
 @@ -13,7 +13,9 @@
  
  #include linux/kernel.h
  #include linux/module.h
 +#include linux/of.h
  #include linux/usb/ch9.h
 +#include linux/usb/of.h
  #include linux/usb/otg.h
  
  const char *usb_otg_state_string(enum usb_otg_state state)
 @@ -79,4 +81,37 @@ const char *usb_state_string(enum usb_device_state state)
  }
  EXPORT_SYMBOL_GPL(usb_state_string);
  
 +#ifdef CONFIG_OF
 +static const char *usb_dr_modes[] = {
 + [USB_DR_MODE_UNKNOWN]   = ,
 + [USB_DR_MODE_HOST]  = host,
 + [USB_DR_MODE_PERIPHERAL]= peripheral,
 + [USB_DR_MODE_OTG]   = otg,
 +};
 +
 +/**
 + * of_usb_get_dr_mode - Get dual role mode for given device_node
 + * @np:  Pointer to the given device_node
 + *
 + * The function gets phy interface string from property 'dr_mode',
 + * and returns the correspondig enum usb_dr_mode
 + */
 +enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np)
 +{
 + const char *dr_mode;
 + int err, i;
 +
 + err = of_property_read_string(np, dr_mode, dr_mode);
 + if (err  0)
 + return USB_DR_MODE_UNKNOWN;
 +
 + for (i = 0; i  ARRAY_SIZE(usb_dr_modes); i++)
 + if (!strcmp(dr_mode, usb_dr_modes[i]))
 + return i;
 +
 + return USB_DR_MODE_UNKNOWN;
 +}
 +EXPORT_SYMBOL_GPL(of_usb_get_dr_mode);
 +#endif
 +
  MODULE_LICENSE(GPL);
 diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h
 new file mode 100644
 index 000..e460a24
 --- /dev/null
 +++ b/include/linux/usb/of.h
 @@ -0,0 +1,28 @@
 +/*
 + * OF helpers for usb devices.
 + *
 + * This file is released under the GPLv2
 + */
 +
 +#ifndef __LINUX_USB_OF_H
 +#define __LINUX_USB_OF_H
 +
 +#include linux/usb/otg.h
 +#include linux/usb/phy.h
 +
 +#ifdef CONFIG_OF
 +enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
 +enum usb_dr_mode 

Re: [PATCH 3/7] USB: chipidea: add PTW, PTS and STS handling

2013-06-03 Thread Alexander Shishkin
Michael Grzeschik m...@pengutronix.de writes:

 From: Michael Grzeschik m.grzesc...@pengutronix.de

 This patch makes it possible to configure the PTW, PTS and STS bits
 inside the portsc register for host and device mode before the driver
 starts and the phy can be addressed as hardware implementation is
 designed.

The bulk of this patch is good, but the OF part should still go to
ci13xxx_imx along with the dt bindings description.

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


Re: [PATCH 4/7] USB chipidea: introduce dual role mode pdata flags

2013-06-03 Thread Alexander Shishkin
Michael Grzeschik m...@pengutronix.de writes:

 From: Sascha Hauer s.ha...@pengutronix.de

 Even if a chipidea core is otg capable the board may not. This allows

may not be

 to explicitly set the core to host/peripheral mode. Without these
 flags the driver falls back to the old behaviour.

 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---

[snip]

 + if (!ci-platdata-dr_mode)
 + ci-platdata-dr_mode = of_usb_get_dr_mode(dev-of_node);

same as previous one, let's keep it in the platform.

Regards,
--
Alex
--
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 5/7] USB chipidea i.MX: use devm_usb_get_phy_by_phandle to get phy

2013-06-03 Thread Alexander Shishkin
Michael Grzeschik m...@pengutronix.de writes:

 From: Sascha Hauer s.ha...@pengutronix.de

 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de

Also please add a description.

Regards,
--
Alex
--
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 6/7] usb: chipidea: udc: add force-full-speed option

2013-06-03 Thread Alexander Shishkin
Sascha Hauer s.ha...@pengutronix.de writes:

 On Sat, Jun 01, 2013 at 10:19:32AM +0200, Michael Grzeschik wrote:
 On Sat, Jun 01, 2013 at 09:39:33AM +0200, Sascha Hauer wrote:
  On Fri, May 31, 2013 at 08:38:48PM +0200, Michael Grzeschik wrote:
   From: Michael Grzeschik m.grzesc...@pengutronix.de
   
   This patch makes it possible to set the chipidea udc
   into full-speed only mode. It can be set by the oftree
   property force-full-speed.
  
  [...]
  
   +/* force full-speed operation */
   +static bool full_speed;
   +module_param(full_speed, bool, 0444);
   +MODULE_PARM_DESC(full_speed, force full-speed mode);
   +
  
  ???
 
 Right, i reworked that one to get rid of yet another of property.
 But i forgot to change the description. I will fix that, thanks.

 But a module parameter limits all instances to full speed. Is that what
 you want? I like a devicetree property better.

+1

Regards,
--
Alex
--
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 7/7] usb: chipidea: usbmisc: use module_platform_driver

2013-06-03 Thread Alexander Shishkin
Michael Grzeschik m...@pengutronix.de writes:

 From: Philipp Zabel p.za...@pengutronix.de


Please say something in the description.

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


Re: [PATCH 2/4] chipidea: ci13xxx_imx: Remove reg_vbus

2013-06-03 Thread Fabio Estevam
Hi Shawn,

On Tue, May 28, 2013 at 11:32 PM, Shawn Guo shawn@linaro.org wrote:

 Do you actually see the issue in real?  While I'm fine with the change,
 I do not think the current code will cause the issue you are describing
 here, since the devm_kzalloc() of data ensures that data-reg_vbus is NULL
 initially.

No, I don't see the issue, but it is not good to keep  data-reg_vbus
and  reg_vbus out of sync.
--
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 05/11] usb: chipidea: register debugging sysfs on our device

2013-06-03 Thread Alexander Shishkin
Felipe Balbi ba...@ti.com writes:

 Don't register anything non-generic under
 the gadget's device as we don't really *own*
 it.

I've just found that this patch makes chipidea with
CONFIG_CHIPIDEA_DEBUG broken on v3.9. Reason being, dbg_create_files()
creates sysfs entries like driver, gadget etc, which conflicts with
entries created by the driver core and gadget code. This is why I wanted
this patch to go in with the rest of debug rework in v3.10-rc1.

OTOH, nobody complained so far. Should we do something about this?

Regards,
--
Alex
--
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: Linux USB file storage gadget with new UDC

2013-06-03 Thread Alan Stern
On Mon, 3 Jun 2013, victor yeo wrote:

 The gadget log when Command Verifier says Device must support being
 set to Addressed/Configured state is attached. The log shows get
 device descriptor, get configuration descriptor, and set configuration
 requests are received. I see nothing wrong in gadget log. Does the log
 indicate any problem that corresponds to the error message in Command
 Verifier?

I have no idea what the CV test is doing.  If you can get a log from 
the CV program, that would help.

There is one strange thing in the middle of the gadget log:

 g_file_storage gadget: ep0-setup, length 8:
 : 80 06 00 02 00 00 20 00
 g_file_storage gadget: get configuration descriptor
 ept0 in queue len 0x20, buffer 0xc1289800
 g_file_storage gadget: ep0-in, length 32:
 : 09 02 20 00 01 01 04 c0 01 09 04 00 00 02 08 06
 0010: 50 05 07 05 81 02 00 02 00 07 05 01 02 00 02 01
 g_file_storage gadget: in handle_exception loop
 [start_transfer] 43425355 8a47aaf8
 ept1 out queue len 0x200, buffer 0xc0c44000
 before kagen2_ep_queue
 g_file_storage gadget: ep0-setup, length 8:
 : 80 06 00 01 00 00 12 00
 g_file_storage gadget: get device descriptor
 ept0 in queue len 0x12, buffer 0xc1289800
 g_file_storage gadget: ep0-in, length 18:
 : 12 01 00 02 00 00 00 40 25 05 a5 a4 33 03 01 02
 0010: 00 01

This shows a Get-Config-Descriptor request followed by a 
Get-Device-Descriptor request.  What is the reason for the line saying 
g_file_storage gadget: in handle_exception loop?  There should not 
have been any exceptions.

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


[Bug 59241] can't set 5bit data length on usbserial chip mos7840

2013-06-03 Thread Кекало Андрей
 --- Comment #1 from Greg Kroah-Hartman  g...@kroah.com  2013-06-03 14:30:11 
 ---
On Mon, Jun 03, 2013 at 01:44:08PM +,  bugzilla-dae...@bugzilla.kernel.org
wrote:
 Kernel Version: 3.2.0-46

patch for 3.8.0



--- mos7840.c.orig	2013-06-03 18:52:04.407415365 +0400
+++ mos7840.c	2013-06-03 18:52:16.119344479 +0400
@@ -1910,7 +1910,6 @@
 	iflag = tty-termios.c_iflag;
 
 	/* Change the number of bits */
-	if (cflag  CSIZE) {
 		switch (cflag  CSIZE) {
 		case CS5:
 			lData = LCR_BITS_5;
@@ -1928,7 +1927,6 @@
 			lData = LCR_BITS_8;
 			break;
 		}
-	}
 	/* Change the Parity bit */
 	if (cflag  PARENB) {
 		if (cflag  PARODD) {


[PATCH V3 0/2] USB: OHCI: Splitting ohci-platform into independent driver

2013-06-03 Thread Manjunath Goudar
This series patch begins the process of splitting ohci-platform up
into independent driver modules and add a name for the platform-private field.

Patch 1/2 separate ohci-platform into independent driver modules.

V2 to V3:
Directly Passed hcd argument without calling ohci_to_hcd() function.

Patch 2/2 adds an ohci-priv field for private use by OHCI platform drivers.
V2 to V3:
No changes.
 
Manjunath Goudar (2):
  USB: OHCI: make ohci-platform a separate driver
  USB: OHCI: add a name for the platform-private field

 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ohci-hcd.c  |6 +--
 drivers/usb/host/ohci-platform.c |   88 ++
 drivers/usb/host/ohci.h  |3 ++
 5 files changed, 47 insertions(+), 53 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 2/2] USB: OHCI: add a name for the platform-private field

2013-06-03 Thread Manjunath Goudar
This patch adds an ohci-priv field for private use by OHCI
platform drivers.

Until now none of the platform drivers has used this private space,
but that's about to change in the next patch of this series.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
Cc: Arnd Bergmann a...@arndb.de
Cc: Greg KH g...@kroah.com
Cc: Alan Stern st...@rowland.harvard.edu
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/ohci.h |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 3b58482..e2e5faa 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -421,6 +421,9 @@ struct ohci_hcd {
struct dentry   *debug_periodic;
struct dentry   *debug_registers;
 #endif
+   /* platform-specific data -- must come last */
+   unsigned long   priv[0] __aligned(sizeof(s64));
+
 };
 
 #ifdef CONFIG_PCI
-- 
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 1/2] USB: OHCI: make ohci-platform a separate driver

2013-06-03 Thread Manjunath Goudar
This patch splits the ohci-platform code from ohci-hcd out
into its own separate driver module.This work is part of enabling
multi-platform kernels on ARM.

In V2:
  -Passed hcd argument instead of ohci in ohci_setup() because it is
   using struct usb_hcd argument.
In V3:
  -Directly passed hcd argument not required to call ohci_to_hcd() function.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
Acked-by: Alan Stern st...@rowland.harvard.edu
Cc: Arnd Bergmann a...@arndb.de
Cc: Greg KH g...@kroah.com
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ohci-hcd.c  |6 +--
 drivers/usb/host/ohci-platform.c |   88 ++
 4 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index a0a2f3a..5391a38 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -501,7 +501,7 @@ config USB_CNS3XXX_OHCI
  It is needed for low-speed USB 1.0 device support.
 
 config USB_OHCI_HCD_PLATFORM
-   bool Generic OHCI driver for a platform device
+   tristate Generic OHCI driver for a platform device
default n
---help---
  Adds an OHCI host driver for a generic platform device, which
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 2214ded..8a89c3d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o
 
 obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
 obj-$(CONFIG_USB_OHCI_HCD_PCI) += ohci-pci.o
+obj-$(CONFIG_USB_OHCI_HCD_PLATFORM)+= ohci-platform.o
 
 obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o
 obj-$(CONFIG_USB_FHCI_HCD) += fhci.o
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 237be7c..39c7624 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1258,12 +1258,8 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERohci_hcd_tilegx_driver
 #endif
 
-#ifdef CONFIG_USB_OHCI_HCD_PLATFORM
-#include ohci-platform.c
-#define PLATFORM_DRIVERohci_platform_driver
-#endif
-
 #if!IS_ENABLED(CONFIG_USB_OHCI_HCD_PCI)  \
+   !IS_ENABLED(CONFIG_USB_OHCI_HCD_PLATFORM)  \
!defined(PLATFORM_DRIVER) \
!defined(OMAP1_PLATFORM_DRIVER)   \
!defined(OMAP3_PLATFORM_DRIVER)   \
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 76a3531..bc30475 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -13,16 +13,28 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+
+#include linux/hrtimer.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
 #include linux/err.h
 #include linux/platform_device.h
 #include linux/usb/ohci_pdriver.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+
+#include ohci.h
+
+#define DRIVER_DESC OHCI generic platform driver
+
+static const char hcd_name[] = ohci-platform;
 
 static int ohci_platform_reset(struct usb_hcd *hcd)
 {
struct platform_device *pdev = to_platform_device(hcd-self.controller);
struct usb_ohci_pdata *pdata = pdev-dev.platform_data;
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int err;
 
if (pdata-big_endian_desc)
ohci-flags |= OHCI_QUIRK_BE_DESC;
@@ -30,58 +42,17 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
ohci-flags |= OHCI_QUIRK_BE_MMIO;
if (pdata-no_big_frame_no)
ohci-flags |= OHCI_QUIRK_FRAME_NO;
-
-   ohci_hcd_init(ohci);
-
if (pdata-num_ports)
ohci-num_ports = pdata-num_ports;
 
-   err = ohci_init(ohci);
-
-   return err;
-}
-
-static int ohci_platform_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int err;
-
-   err = ohci_run(ohci);
-   if (err  0) {
-   ohci_err(ohci, can't start\n);
-   ohci_stop(hcd);
-   }
-
-   return err;
+   return ohci_setup(hcd);
 }
 
-static const struct hc_driver ohci_platform_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = Generic Platform OHCI Controller,
-   .hcd_priv_size  = sizeof(struct ohci_hcd),
+static struct hc_driver __read_mostly ohci_platform_hc_driver;
 
-   .irq= ohci_irq,
-   .flags  = HCD_MEMORY | HCD_USB11,
-
-   .reset  = ohci_platform_reset,
-   .start  = ohci_platform_start,
-   .stop   = ohci_stop,
-   .shutdown   = ohci_shutdown,
-
-   .urb_enqueue= ohci_urb_enqueue,
-   .urb_dequeue= ohci_urb_dequeue,
-   .endpoint_disable   = ohci_endpoint_disable,
-
-   .get_frame_number   = ohci_get_frame,
-
-   

[PATCH V3 0/2] USB: OHCI: Splitting ohci-platform into independent driver

2013-06-03 Thread Manjunath Goudar
This series patch begins the process of splitting ohci-platform up
into independent driver modules and add a name for the platform-private field.

Patch 1/2 separate ohci-platform into independent driver modules.

V2 to V3:
Directly Passed hcd argument without calling ohci_to_hcd() function.

Patch 2/2 adds an ohci-priv field for private use by OHCI platform drivers.
V2 to V3:
No changes.
 
Manjunath Goudar (2):
  USB: OHCI: make ohci-platform a separate driver
  USB: OHCI: add a name for the platform-private field

 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ohci-hcd.c  |6 +--
 drivers/usb/host/ohci-platform.c |   88 ++
 drivers/usb/host/ohci.h  |3 ++
 5 files changed, 47 insertions(+), 53 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 V3 2/2] USB: OHCI: add a name for the platform-private field

2013-06-03 Thread Manjunath Goudar
This patch adds an ohci-priv field for private use by OHCI
platform drivers.

Until now none of the platform drivers has used this private space,
but that's about to change in the next patch of this series.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
Cc: Arnd Bergmann a...@arndb.de
Cc: Greg KH g...@kroah.com
Cc: Alan Stern st...@rowland.harvard.edu
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/ohci.h |3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h
index 3b58482..e2e5faa 100644
--- a/drivers/usb/host/ohci.h
+++ b/drivers/usb/host/ohci.h
@@ -421,6 +421,9 @@ struct ohci_hcd {
struct dentry   *debug_periodic;
struct dentry   *debug_registers;
 #endif
+   /* platform-specific data -- must come last */
+   unsigned long   priv[0] __aligned(sizeof(s64));
+
 };
 
 #ifdef CONFIG_PCI
-- 
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 V3 1/2] USB: OHCI: make ohci-platform a separate driver

2013-06-03 Thread Manjunath Goudar
This patch splits the ohci-platform code from ohci-hcd out
into its own separate driver module.This work is part of enabling
multi-platform kernels on ARM.

In V2:
  -Passed hcd argument instead of ohci in ohci_setup() because it is
   using struct usb_hcd argument.
In V3:
  -Directly passed hcd argument not required to call ohci_to_hcd() function.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
Acked-by: Alan Stern st...@rowland.harvard.edu
Cc: Arnd Bergmann a...@arndb.de
Cc: Greg KH g...@kroah.com
Cc: linux-usb@vger.kernel.org
---
 drivers/usb/host/Kconfig |2 +-
 drivers/usb/host/Makefile|1 +
 drivers/usb/host/ohci-hcd.c  |6 +--
 drivers/usb/host/ohci-platform.c |   88 ++
 4 files changed, 44 insertions(+), 53 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index a0a2f3a..5391a38 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -501,7 +501,7 @@ config USB_CNS3XXX_OHCI
  It is needed for low-speed USB 1.0 device support.
 
 config USB_OHCI_HCD_PLATFORM
-   bool Generic OHCI driver for a platform device
+   tristate Generic OHCI driver for a platform device
default n
---help---
  Adds an OHCI host driver for a generic platform device, which
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 2214ded..8a89c3d 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -45,6 +45,7 @@ obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o
 
 obj-$(CONFIG_USB_OHCI_HCD) += ohci-hcd.o
 obj-$(CONFIG_USB_OHCI_HCD_PCI) += ohci-pci.o
+obj-$(CONFIG_USB_OHCI_HCD_PLATFORM)+= ohci-platform.o
 
 obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o
 obj-$(CONFIG_USB_FHCI_HCD) += fhci.o
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 237be7c..39c7624 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1258,12 +1258,8 @@ MODULE_LICENSE (GPL);
 #define PLATFORM_DRIVERohci_hcd_tilegx_driver
 #endif
 
-#ifdef CONFIG_USB_OHCI_HCD_PLATFORM
-#include ohci-platform.c
-#define PLATFORM_DRIVERohci_platform_driver
-#endif
-
 #if!IS_ENABLED(CONFIG_USB_OHCI_HCD_PCI)  \
+   !IS_ENABLED(CONFIG_USB_OHCI_HCD_PLATFORM)  \
!defined(PLATFORM_DRIVER) \
!defined(OMAP1_PLATFORM_DRIVER)   \
!defined(OMAP3_PLATFORM_DRIVER)   \
diff --git a/drivers/usb/host/ohci-platform.c b/drivers/usb/host/ohci-platform.c
index 76a3531..bc30475 100644
--- a/drivers/usb/host/ohci-platform.c
+++ b/drivers/usb/host/ohci-platform.c
@@ -13,16 +13,28 @@
  *
  * Licensed under the GNU/GPL. See COPYING for details.
  */
+
+#include linux/hrtimer.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
 #include linux/err.h
 #include linux/platform_device.h
 #include linux/usb/ohci_pdriver.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+
+#include ohci.h
+
+#define DRIVER_DESC OHCI generic platform driver
+
+static const char hcd_name[] = ohci-platform;
 
 static int ohci_platform_reset(struct usb_hcd *hcd)
 {
struct platform_device *pdev = to_platform_device(hcd-self.controller);
struct usb_ohci_pdata *pdata = pdev-dev.platform_data;
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int err;
 
if (pdata-big_endian_desc)
ohci-flags |= OHCI_QUIRK_BE_DESC;
@@ -30,58 +42,17 @@ static int ohci_platform_reset(struct usb_hcd *hcd)
ohci-flags |= OHCI_QUIRK_BE_MMIO;
if (pdata-no_big_frame_no)
ohci-flags |= OHCI_QUIRK_FRAME_NO;
-
-   ohci_hcd_init(ohci);
-
if (pdata-num_ports)
ohci-num_ports = pdata-num_ports;
 
-   err = ohci_init(ohci);
-
-   return err;
-}
-
-static int ohci_platform_start(struct usb_hcd *hcd)
-{
-   struct ohci_hcd *ohci = hcd_to_ohci(hcd);
-   int err;
-
-   err = ohci_run(ohci);
-   if (err  0) {
-   ohci_err(ohci, can't start\n);
-   ohci_stop(hcd);
-   }
-
-   return err;
+   return ohci_setup(hcd);
 }
 
-static const struct hc_driver ohci_platform_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = Generic Platform OHCI Controller,
-   .hcd_priv_size  = sizeof(struct ohci_hcd),
+static struct hc_driver __read_mostly ohci_platform_hc_driver;
 
-   .irq= ohci_irq,
-   .flags  = HCD_MEMORY | HCD_USB11,
-
-   .reset  = ohci_platform_reset,
-   .start  = ohci_platform_start,
-   .stop   = ohci_stop,
-   .shutdown   = ohci_shutdown,
-
-   .urb_enqueue= ohci_urb_enqueue,
-   .urb_dequeue= ohci_urb_dequeue,
-   .endpoint_disable   = ohci_endpoint_disable,
-
-   .get_frame_number   = ohci_get_frame,
-
-   

Re: [Bug 59241] can't set 5bit data length on usbserial chip mos7840

2013-06-03 Thread Greg KH
On Mon, Jun 03, 2013 at 07:08:23PM +0400, Кекало Андрей wrote:
  --- Comment #1 from Greg Kroah-Hartman  g...@kroah.com  2013-06-03 
 14:30:11 ---
 On Mon, Jun 03, 2013 at 01:44:08PM +,  
 bugzilla-dae...@bugzilla.kernel.org
 wrote:
  Kernel Version: 3.2.0-46
 
 patch for 3.8.0

Interesting, but 3.10-rc4 is the latest version, and I need some more
information, as described in the Documentation/SubmittingPatches file,
before I can apply this.

Also, you are just removing two lines, that need to be there, in this
driver, are you sure you didn't just break something else?

Did this work on older kernel versions and now does not?  Or is this
something you have never tested before?

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 3/7] USB: chipidea: add PTW, PTS and STS handling

2013-06-03 Thread Michael Grzeschik
Hey Alex,

On Mon, Jun 03, 2013 at 03:35:37PM +0300, Alexander Shishkin wrote:
 Michael Grzeschik m...@pengutronix.de writes:
 
  From: Michael Grzeschik m.grzesc...@pengutronix.de
 
  This patch makes it possible to configure the PTW, PTS and STS bits
  inside the portsc register for host and device mode before the driver
  starts and the phy can be addressed as hardware implementation is
  designed.
 
 The bulk of this patch is good, but the OF part should still go to
 ci13xxx_imx along with the dt bindings description.

referring to the last discussion [¹] about what should be handled
where, your last statement is pretty confusing. We might say we
somehow stuck in a loop if i would repost this patch again
and somebody (probably you :]) is telling me to do the opposite again!

If you have a closer look, you can see that we are checking for
valid pdata:

@@ -408,6 +452,9 @@ static int ci_hdrc_probe(struct platform_device *pdev)
return -ENODEV;
}

+   if (!ci-platdata-phy_mode)
+   ci-platdata-phy_mode = of_usb_get_phy_mode(dev-of_node);
+

This way we can ensure that platforms without OF still
can use the pdata. _But_ we always fall back to OF in the
core _if_ nobody cared. This should be done with all properties
that are not SoC, but _common_ device specific settings.

[¹] https://patchwork.kernel.org/patch/2196981/

Thanks,
Michael

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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/5] extcon: add EXPORT_SYMBOL_GPL for exported functions

2013-06-03 Thread Kishon Vijay Abraham I
Added EXPORT_SYMBOL_GPL() for extcon_register_interest and
extcon_register_notifier in order to avoid undefined reference
error when building the consumer modules of extcon as _modules_.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Signed-off-by: Lokesh Vutla lokeshvu...@ti.com
---
 drivers/extcon/extcon-class.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 265d549..51a5f5f 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -541,6 +541,7 @@ int extcon_register_interest(struct 
extcon_specific_cable_nb *obj,
return -ENODEV;
}
 }
+EXPORT_SYMBOL_GPL(extcon_register_interest);
 
 /**
  * extcon_unregister_interest() - Unregister the notifier registered by
@@ -555,6 +556,7 @@ int extcon_unregister_interest(struct 
extcon_specific_cable_nb *obj)
 
return raw_notifier_chain_unregister(obj-edev-nh, obj-internal_nb);
 }
+EXPORT_SYMBOL_GPL(extcon_unregister_interest);
 
 /**
  * extcon_register_notifier() - Register a notifiee to get notified by
-- 
1.7.10.4

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


[PATCH 1/5] extcon: Add an API to get extcon device from dt node

2013-06-03 Thread Kishon Vijay Abraham I
Added an API of_extcon_get_extcon_dev() to be used by drivers to get
extcon device in the case of dt boot (this can be used instead of
extcon_get_extcon_dev()).

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 drivers/extcon/extcon-class.c |   40 
 include/linux/extcon.h|8 
 2 files changed, 48 insertions(+)

diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index 60adc04..265d549 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -31,6 +31,7 @@
 #include linux/extcon.h
 #include linux/slab.h
 #include linux/sysfs.h
+#include linux/of_platform.h
 
 /*
  * extcon_cable_name suggests the standard cable names for commonly used
@@ -392,6 +393,45 @@ int extcon_set_cable_state(struct extcon_dev *edev,
 }
 EXPORT_SYMBOL_GPL(extcon_set_cable_state);
 
+struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev, int index)
+{
+   struct class_dev_iter iter;
+   struct device *extcon_dev;
+   struct device_node *node;
+   struct platform_device *extcon_parent_dev;
+
+   if (!dev-of_node) {
+   dev_dbg(dev, device does not have a device node entry\n);
+   return ERR_PTR(-EINVAL);
+   }
+
+   node = of_parse_phandle(dev-of_node, extcon, index);
+   if (!node) {
+   dev_dbg(dev, failed to get phandle in %s node\n,
+   dev-of_node-full_name);
+   return ERR_PTR(-ENODEV);
+   }
+
+   extcon_parent_dev = of_find_device_by_node(node);
+   if (!extcon_parent_dev) {
+   dev_dbg(dev, unable to find device by node\n);
+   return ERR_PTR(-EPROBE_DEFER);
+   }
+
+   class_dev_iter_init(iter, extcon_class, NULL, NULL);
+   while ((extcon_dev = class_dev_iter_next(iter))) {
+   if (extcon_dev-parent != extcon_parent_dev-dev)
+   continue;
+
+   class_dev_iter_exit(iter);
+   return dev_get_drvdata(extcon_dev);
+   }
+
+   class_dev_iter_exit(iter);
+   return ERR_PTR(-ENODEV);
+}
+EXPORT_SYMBOL_GPL(of_extcon_get_extcon_dev);
+
 /**
  * extcon_get_extcon_dev() - Get the extcon device instance from the name
  * @extcon_name:   The extcon name provided with extcon_dev_register()
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index fcb51c8..3858bb9 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -182,6 +182,8 @@ struct extcon_specific_cable_nb {
  */
 extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev);
 extern void extcon_dev_unregister(struct extcon_dev *edev);
+extern struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev,
+   int index);
 extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
 
 /*
@@ -292,6 +294,12 @@ static inline int extcon_set_cable_state(struct extcon_dev 
*edev,
return 0;
 }
 
+static inline struct extcon_dev *of_extcon_get_extcon_dev(struct device *dev,
+   int index)
+{
+   return NULL;
+}
+
 static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
 {
return NULL;
-- 
1.7.10.4

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


[PATCH 2/5] extcon: Kconfig: Make extcon config type as bool

2013-06-03 Thread Kishon Vijay Abraham I
Changed the extcon config type to bool from module. Having extcon
config type as module leads to some undefined reference to errors
if the modules that uses these APIs are made as built-in and extcon
as module.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 drivers/extcon/Kconfig |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/extcon/Kconfig b/drivers/extcon/Kconfig
index 63f454e..ee9b7d4 100644
--- a/drivers/extcon/Kconfig
+++ b/drivers/extcon/Kconfig
@@ -1,5 +1,5 @@
 menuconfig EXTCON
-   tristate External Connector Class (extcon) support
+   bool External Connector Class (extcon) support
help
  Say Y here to enable external connector class (extcon) support.
  This allows monitoring external connectors by userspace
-- 
1.7.10.4

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


[PATCH 4/5] usb: dwc3: omap: improve error handling of dwc3_omap_probe

2013-06-03 Thread Kishon Vijay Abraham I
Improved the error handling of dwc3_omap_probe so that on error
conditions dwc3_omap is left in the original state.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
---
 drivers/usb/dwc3/dwc3-omap.c |   17 ++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 34638b9..f8f76e6 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -347,7 +347,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
ret = pm_runtime_get_sync(dev);
if (ret  0) {
dev_err(dev, get_sync failed with err %d\n, ret);
-   return ret;
+   goto err0;
}
 
reg = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS);
@@ -376,7 +376,7 @@ static int dwc3_omap_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, failed to request IRQ #%d -- %d\n,
omap-irq, ret);
-   return ret;
+   goto err1;
}
 
dwc3_omap_enable_irqs(omap);
@@ -384,10 +384,21 @@ static int dwc3_omap_probe(struct platform_device *pdev)
ret = of_platform_populate(node, NULL, NULL, dev);
if (ret) {
dev_err(pdev-dev, failed to create dwc3 core\n);
-   return ret;
+   goto err2;
}
 
return 0;
+
+err2:
+   dwc3_omap_disable_irqs(omap);
+
+err1:
+   pm_runtime_put_sync(dev);
+
+err0:
+   pm_runtime_disable(dev);
+
+   return ret;
 }
 
 static int dwc3_omap_remove(struct platform_device *pdev)
-- 
1.7.10.4

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


Re: [PATCH] staging: MIPS: add Octeon USB HCD support

2013-06-03 Thread David Daney

On 06/01/2013 11:42 AM, Aaro Koskinen wrote:

Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
mass storage.

The driver has been extracted from GPL sources of EdgeRouter Lite firmware
(based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
to make it work with 3.10-rc3.

$ uname -a
Linux (none) 3.10.0-rc3-edge-5-g86cb5bc #41 SMP PREEMPT Sat Jun 1 20:41:46 
EEST 2013 mips64 GNU/Linux
$ modprobe octeon-usb
[   37.971683] octeon_usb: module is from the staging directory, the quality is 
unknown, you have been warned.
[   37.983649] OcteonUSB: Detected 1 ports
[   37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
[   38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus 
number 1
[   38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x
[   38.019970] hub 1-0:1.0: USB hub found
[   38.023851] hub 1-0:1.0: 1 port detected
[   38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
[   38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
[   38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
[   38.597375] scsi0 : usb-storage 1-1:1.0
[   39.604111] scsi 0:0:0:0: Direct-Access  USB DISK 2.0 PMAP 
PQ: 0 ANSI: 4
[   39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 GB/3.61 
GiB)
[   39.630696] sd 0:0:0:0: [sda] Write Protect is off
[   39.635945] sd 0:0:0:0: [sda] No Caching mode page present
[   39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.651341] sd 0:0:0:0: [sda] No Caching mode page present
[   39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.664296]  sda: sda1 sda2
[   39.675574] sd 0:0:0:0: [sda] No Caching mode page present
[   39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk

Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi
---
  drivers/staging/Kconfig  |2 +
  drivers/staging/Makefile |1 +
  drivers/staging/octeon-usb/Kconfig   |   10 +
  drivers/staging/octeon-usb/Makefile  |3 +
  drivers/staging/octeon-usb/TODO  |   11 +
  drivers/staging/octeon-usb/cvmx-usb.c| 3344 ++
  drivers/staging/octeon-usb/cvmx-usb.h| 1085 +
  drivers/staging/octeon-usb/cvmx-usbcx-defs.h | 3086 
  drivers/staging/octeon-usb/cvmx-usbnx-defs.h | 1596 
  drivers/staging/octeon-usb/octeon-hcd.c  |  854 +++
  10 files changed, 9992 insertions(+)
  create mode 100644 drivers/staging/octeon-usb/Kconfig
  create mode 100644 drivers/staging/octeon-usb/Makefile
  create mode 100644 drivers/staging/octeon-usb/TODO
  create mode 100644 drivers/staging/octeon-usb/cvmx-usb.c
  create mode 100644 drivers/staging/octeon-usb/cvmx-usb.h
  create mode 100644 drivers/staging/octeon-usb/cvmx-usbcx-defs.h
  create mode 100644 drivers/staging/octeon-usb/cvmx-usbnx-defs.h
  create mode 100644 drivers/staging/octeon-usb/octeon-hcd.c




FYI: This is an alternate, host only, driver for the DesignWare USB2 
controller as found on some OCTEON SoCs.  drivers/staging/dwc2 contains 
the code supplied by Synopsys for the same controller.


One might ask why an alternate driver was ever written.  The answer to 
this question is:  The octeon-hcd driver is much better than the dwc2 
driver when running the hardware in host mode.



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


[v3 PATCH 5/5] usb: dwc3: use extcon fwrk to receive connect/disconnect

2013-06-03 Thread Kishon Vijay Abraham I
Modified dwc3-omap to receive connect and disconnect notification using
extcon framework. Also did the necessary cleanups required after
adapting to extcon framework.

Signed-off-by: Kishon Vijay Abraham I kis...@ti.com
Acked-by: Felipe Balbi ba...@ti.com
---
Changes from v2:
* updated the Documentation with dwc3 dt binding information.
* used of_extcon_get_extcon_dev to get extcon device from device tree data.
Changes from v1:
* regulator enable/disable is now done here instead of palmas-usb as some users
of palmas-usb wont need regulator.
 Documentation/devicetree/bindings/usb/omap-usb.txt |5 +
 drivers/usb/dwc3/dwc3-omap.c   |  118 
 include/linux/usb/dwc3-omap.h  |   30 -
 3 files changed, 104 insertions(+), 49 deletions(-)
 delete mode 100644 include/linux/usb/dwc3-omap.h

diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt 
b/Documentation/devicetree/bindings/usb/omap-usb.txt
index d4769f3..f1c15f3 100644
--- a/Documentation/devicetree/bindings/usb/omap-usb.txt
+++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
@@ -53,6 +53,11 @@ OMAP DWC3 GLUE
It should be set to 1 for HW mode and 2 for SW mode.
  - ranges: the child address space are mapped 1:1 onto the parent address space
 
+Optional Properties:
+ - extcon : phandle for the extcon device omap dwc3 uses to detect
+   connect/disconnect events.
+ - vbus-supply : phandle to the regulator device tree node if needed.
+
 Sub-nodes:
 The dwc3 core should be added as subnode to omap dwc3 glue.
 - dwc3 :
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index f8f76e6..e1aac90 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -43,13 +43,14 @@
 #include linux/spinlock.h
 #include linux/platform_device.h
 #include linux/platform_data/dwc3-omap.h
-#include linux/usb/dwc3-omap.h
 #include linux/pm_runtime.h
 #include linux/dma-mapping.h
 #include linux/ioport.h
 #include linux/io.h
 #include linux/of.h
 #include linux/of_platform.h
+#include linux/extcon.h
+#include linux/regulator/consumer.h
 
 #include linux/usb/otg.h
 
@@ -124,9 +125,21 @@ struct dwc3_omap {
u32 utmi_otg_status;
 
u32 dma_status:1;
+
+   struct extcon_specific_cable_nb extcon_vbus_dev;
+   struct extcon_specific_cable_nb extcon_id_dev;
+   struct notifier_block   vbus_nb;
+   struct notifier_block   id_nb;
+
+   struct regulator*vbus_reg;
 };
 
-static struct dwc3_omap*_omap;
+enum omap_dwc3_vbus_id_status {
+   OMAP_DWC3_ID_FLOAT,
+   OMAP_DWC3_ID_GROUND,
+   OMAP_DWC3_VBUS_OFF,
+   OMAP_DWC3_VBUS_VALID,
+};
 
 static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
 {
@@ -138,18 +151,23 @@ static inline void dwc3_omap_writel(void __iomem *base, 
u32 offset, u32 value)
writel(value, base + offset);
 }
 
-int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
+   enum omap_dwc3_vbus_id_status status)
 {
-   u32 val;
-   struct dwc3_omap*omap = _omap;
-
-   if (!omap)
-   return -EPROBE_DEFER;
+   int ret;
+   u32 val;
 
switch (status) {
case OMAP_DWC3_ID_GROUND:
dev_dbg(omap-dev, ID GND\n);
 
+   if (omap-vbus_reg) {
+   ret = regulator_enable(omap-vbus_reg);
+   if (ret) {
+   dev_dbg(omap-dev, regulator enable failed\n);
+   return;
+   }
+   }
val = dwc3_omap_readl(omap-base, USBOTGSS_UTMI_OTG_STATUS);
val = ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG
| USBOTGSS_UTMI_OTG_STATUS_VBUSVALID
@@ -172,6 +190,9 @@ int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
break;
 
case OMAP_DWC3_ID_FLOAT:
+   if (omap-vbus_reg)
+   regulator_disable(omap-vbus_reg);
+
case OMAP_DWC3_VBUS_OFF:
dev_dbg(omap-dev, VBUS Disconnect\n);
 
@@ -185,12 +206,9 @@ int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
break;
 
default:
-   dev_dbg(omap-dev, ID float\n);
+   dev_dbg(omap-dev, invalid state\n);
}
-
-   return 0;
 }
-EXPORT_SYMBOL_GPL(dwc3_omap_mailbox);
 
 static irqreturn_t dwc3_omap_interrupt(int irq, void *_omap)
 {
@@ -282,6 +300,32 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 
 static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
 
+static int dwc3_omap_id_notifier(struct notifier_block *nb,
+   unsigned long event, void *ptr)
+{
+   struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, id_nb);
+
+   if (event)
+   dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
+   

[PATCH 0/5] dwc3: omap: adapt dwc3 to use extcon framework

2013-06-03 Thread Kishon Vijay Abraham I
The first three patches deals with cleanup of extcon inorder to get
through compilation without any issues. It also adds an API to get
extcon device from dt node which I felt was missing.

The next two patches deals with adapt dwc3 to use extcon framework.
The 4th patch (usb: dwc3: omap: improve error handling of dwc3_omap_probe)
should have ideally been sent to Felipe, however since
there will be merge conflicts with the 5th patch
(usb: dwc3: use extcon fwrk to receive connect/disconnect)
in this series, I've sent in the same series.

Once this patch series get merged, dwc3 in omap would be functional
in device mode. However there is still some discussion on modelling
SMPS10 regulator. Once that gets finalized, dwc3 should be functional
in host mode as well.

Kishon Vijay Abraham I (5):
  extcon: Add an API to get extcon device from dt node
  extcon: Kconfig: Make extcon config type as bool
  extcon: add EXPORT_SYMBOL_GPL for exported functions
  usb: dwc3: omap: improve error handling of dwc3_omap_probe
  usb: dwc3: use extcon fwrk to receive connect/disconnect

 Documentation/devicetree/bindings/usb/omap-usb.txt |5 +
 drivers/extcon/Kconfig |2 +-
 drivers/extcon/extcon-class.c  |   42 +++
 drivers/usb/dwc3/dwc3-omap.c   |  133 
 include/linux/extcon.h |8 ++
 include/linux/usb/dwc3-omap.h  |   30 -
 6 files changed, 168 insertions(+), 52 deletions(-)
 delete mode 100644 include/linux/usb/dwc3-omap.h

-- 
1.7.10.4

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


Re: [PATCH] staging: MIPS: add Octeon USB HCD support

2013-06-03 Thread Greg Kroah-Hartman
On Mon, Jun 03, 2013 at 09:35:45AM -0700, David Daney wrote:
 On 06/01/2013 11:42 AM, Aaro Koskinen wrote:
 Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
 mass storage.
 
 The driver has been extracted from GPL sources of EdgeRouter Lite firmware
 (based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
 to make it work with 3.10-rc3.
 
 $ uname -a
 Linux (none) 3.10.0-rc3-edge-5-g86cb5bc #41 SMP PREEMPT Sat Jun 1 
 20:41:46 EEST 2013 mips64 GNU/Linux
 $ modprobe octeon-usb
 [   37.971683] octeon_usb: module is from the staging directory, the quality 
 is unknown, you have been warned.
 [   37.983649] OcteonUSB: Detected 1 ports
 [   37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
 [   38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus 
 number 1
 [   38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x
 [   38.019970] hub 1-0:1.0: USB hub found
 [   38.023851] hub 1-0:1.0: 1 port detected
 [   38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
 [   38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
 [   38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
 [   38.597375] scsi0 : usb-storage 1-1:1.0
 [   39.604111] scsi 0:0:0:0: Direct-Access  USB DISK 2.0 
 PMAP PQ: 0 ANSI: 4
 [   39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 
 GB/3.61 GiB)
 [   39.630696] sd 0:0:0:0: [sda] Write Protect is off
 [   39.635945] sd 0:0:0:0: [sda] No Caching mode page present
 [   39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
 [   39.651341] sd 0:0:0:0: [sda] No Caching mode page present
 [   39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
 [   39.664296]  sda: sda1 sda2
 [   39.675574] sd 0:0:0:0: [sda] No Caching mode page present
 [   39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
 [   39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk
 
 Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi
 ---
   drivers/staging/Kconfig  |2 +
   drivers/staging/Makefile |1 +
   drivers/staging/octeon-usb/Kconfig   |   10 +
   drivers/staging/octeon-usb/Makefile  |3 +
   drivers/staging/octeon-usb/TODO  |   11 +
   drivers/staging/octeon-usb/cvmx-usb.c| 3344 
  ++
   drivers/staging/octeon-usb/cvmx-usb.h| 1085 +
   drivers/staging/octeon-usb/cvmx-usbcx-defs.h | 3086 
  
   drivers/staging/octeon-usb/cvmx-usbnx-defs.h | 1596 
   drivers/staging/octeon-usb/octeon-hcd.c  |  854 +++
   10 files changed, 9992 insertions(+)
   create mode 100644 drivers/staging/octeon-usb/Kconfig
   create mode 100644 drivers/staging/octeon-usb/Makefile
   create mode 100644 drivers/staging/octeon-usb/TODO
   create mode 100644 drivers/staging/octeon-usb/cvmx-usb.c
   create mode 100644 drivers/staging/octeon-usb/cvmx-usb.h
   create mode 100644 drivers/staging/octeon-usb/cvmx-usbcx-defs.h
   create mode 100644 drivers/staging/octeon-usb/cvmx-usbnx-defs.h
   create mode 100644 drivers/staging/octeon-usb/octeon-hcd.c
 
 
 
 FYI: This is an alternate, host only, driver for the DesignWare USB2
 controller as found on some OCTEON SoCs.  drivers/staging/dwc2
 contains the code supplied by Synopsys for the same controller.
 
 One might ask why an alternate driver was ever written.  The answer
 to this question is:  The octeon-hcd driver is much better than the
 dwc2 driver when running the hardware in host mode.

So, should we not accept this driver because dwc2 is in the tree now and
we will have two conflicting drivers for the same hardware?  Or accept
this, and blacklist dwc2 for this hardware?

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] staging: MIPS: add Octeon USB HCD support

2013-06-03 Thread David Daney

On 06/03/2013 09:52 AM, Greg Kroah-Hartman wrote:

On Mon, Jun 03, 2013 at 09:35:45AM -0700, David Daney wrote:

On 06/01/2013 11:42 AM, Aaro Koskinen wrote:

Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
mass storage.

The driver has been extracted from GPL sources of EdgeRouter Lite firmware
(based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
to make it work with 3.10-rc3.

$ uname -a
Linux (none) 3.10.0-rc3-edge-5-g86cb5bc #41 SMP PREEMPT Sat Jun 1 20:41:46 
EEST 2013 mips64 GNU/Linux
$ modprobe octeon-usb
[   37.971683] octeon_usb: module is from the staging directory, the quality is 
unknown, you have been warned.
[   37.983649] OcteonUSB: Detected 1 ports
[   37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
[   38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus 
number 1
[   38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x
[   38.019970] hub 1-0:1.0: USB hub found
[   38.023851] hub 1-0:1.0: 1 port detected
[   38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
[   38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
[   38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
[   38.597375] scsi0 : usb-storage 1-1:1.0
[   39.604111] scsi 0:0:0:0: Direct-Access  USB DISK 2.0 PMAP 
PQ: 0 ANSI: 4
[   39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 GB/3.61 
GiB)
[   39.630696] sd 0:0:0:0: [sda] Write Protect is off
[   39.635945] sd 0:0:0:0: [sda] No Caching mode page present
[   39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.651341] sd 0:0:0:0: [sda] No Caching mode page present
[   39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.664296]  sda: sda1 sda2
[   39.675574] sd 0:0:0:0: [sda] No Caching mode page present
[   39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
[   39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk

Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi
---
  drivers/staging/Kconfig  |2 +
  drivers/staging/Makefile |1 +
  drivers/staging/octeon-usb/Kconfig   |   10 +
  drivers/staging/octeon-usb/Makefile  |3 +
  drivers/staging/octeon-usb/TODO  |   11 +
  drivers/staging/octeon-usb/cvmx-usb.c| 3344 ++
  drivers/staging/octeon-usb/cvmx-usb.h| 1085 +
  drivers/staging/octeon-usb/cvmx-usbcx-defs.h | 3086 
  drivers/staging/octeon-usb/cvmx-usbnx-defs.h | 1596 
  drivers/staging/octeon-usb/octeon-hcd.c  |  854 +++
  10 files changed, 9992 insertions(+)
  create mode 100644 drivers/staging/octeon-usb/Kconfig
  create mode 100644 drivers/staging/octeon-usb/Makefile
  create mode 100644 drivers/staging/octeon-usb/TODO
  create mode 100644 drivers/staging/octeon-usb/cvmx-usb.c
  create mode 100644 drivers/staging/octeon-usb/cvmx-usb.h
  create mode 100644 drivers/staging/octeon-usb/cvmx-usbcx-defs.h
  create mode 100644 drivers/staging/octeon-usb/cvmx-usbnx-defs.h
  create mode 100644 drivers/staging/octeon-usb/octeon-hcd.c




FYI: This is an alternate, host only, driver for the DesignWare USB2
controller as found on some OCTEON SoCs.  drivers/staging/dwc2
contains the code supplied by Synopsys for the same controller.

One might ask why an alternate driver was ever written.  The answer
to this question is:  The octeon-hcd driver is much better than the
dwc2 driver when running the hardware in host mode.


So, should we not accept this driver because dwc2 is in the tree now and
we will have two conflicting drivers for the same hardware?  Or accept
this, and blacklist dwc2 for this hardware?



I don't know the answer to these questions.  I will say this though:

o In USB2 mode, the octeon-hcd driver generates far fewer interrupts 
than dwc2.


o octeon-hcd was written because we couldn't figure out how to fix the 
dwc2 driver so that it wouldn't crash.


o I think Raspberry Pi uses the DWC2 block, and there are said to be 
many complaints about the dwc2 driver crashing there.


I would defer to the judgment of the USB maintainers and other users of 
the DWC2 block.  If you think the code is useful, take it.  If it is 
merged, we will probably supply some bug fixes and cleanups we have 
accumulated.


David Daney


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


Re: [PATCH v2 0/2] USB: PHY: Improve PHY selection logic

2013-06-03 Thread Greg KH
On Fri, May 31, 2013 at 02:29:01PM +0300, Roger Quadros wrote:
 Hi,
 
 Improve Kconfig so that the relevant PHY driver can be explicitely
 selected by the controller driver instead of relying on the user
 to do so.
 
 Detailed description in patch 1.

Felipe needs to take these, not I.

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 1/1] USB: ehci-omap: Reset dma_mask pointer on probe

2013-06-03 Thread Greg KH
On Thu, May 23, 2013 at 05:46:44PM +0300, Roger Quadros wrote:
 On 05/23/2013 05:11 PM, Alan Stern wrote:
  On Thu, 23 May 2013, Roger Quadros wrote:
  
  Device tree probed devices don't get dma_mask set. Previously
  we were setting the dma_mask pointer only if it was NULL.
  However, the address of 'omap_ehci_dma_mask' would change
  each time the module is unloaded and loaded back thus causing
  the devices dma_mask pointer to be invalid on the next load.
 
  This will cause page faults if any driver tries to access the
  old dma_mask pointer.
 
  Unconditionally re-setting the dma_mask pointer fixes this problem.
  
  diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
  index 3d1491b..b33e306 100644
  --- a/drivers/usb/host/ehci-omap.c
  +++ b/drivers/usb/host/ehci-omap.c
  @@ -146,8 +146,7 @@ static int ehci_hcd_omap_probe(struct platform_device 
  *pdev)
  * Since shared usb code relies on it, set it here for now.
  * Once we have dma capability bindings this can go away.
  */
  -  if (!pdev-dev.dma_mask)
  -  pdev-dev.dma_mask = omap_ehci_dma_mask;
  +  pdev-dev.dma_mask = omap_ehci_dma_mask;
  
  Is this the solution that people have agreed on?  There has been a lot 
  of discussion on this topic.  In particular, there has been talk about 
  fixing it in the DT core.
 
 Fixing it in DT core would be best.

Then please do that.

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: [RFC 0/6] xHCI and USB security bug fixes

2013-06-03 Thread Sarah Sharp
On Thu, May 30, 2013 at 07:04:03AM +0900, Greg Kroah-Hartman wrote:
 On Wed, May 29, 2013 at 10:45:04AM -0700, Sarah Sharp wrote:
  On Wed, May 29, 2013 at 10:27:50AM +0900, Greg Kroah-Hartman wrote:
   On Fri, May 24, 2013 at 05:42:52PM -0700, Sarah Sharp wrote:
This patchset address some (but not all) of the security issues found
with the Klockwork static analysis tool.  I have not reviewed these in
detail to see if these could be used by attackers, so someone with more
security experience may want to look these over.
   
   A lot of these changes are just to add checks to functions that you are
   calling yourself.  How can those pointers be not valid when you
   control what you pass to them?
  
  It's purely paranoia.  It's entirely possible we'll add new code later
  that would accidentally trigger these checks.  That's especially true
  of, say, the device speeds, since USB 3.1 (10Gbps) is in the works.
 
 Then let's worry about it at that point in time :)

All right.  Most of these patches are defensive coding, but you've had
more experience with kernel coding, so I'll leave it up to you.

   Those seems over-eager, and not really needed.  Or am I missing
   somewhere that could change the pointer without the driver knowing it?
  
  In all honesty, these patches are the result of a bureaucratic push for
  code quality.  We switched static analysis tools from Coverity to
  Klockwork, and the QA folks pushed us to fix the issues that Klockwork
  discovered.
  
  If you don't think they're appropriate, let me know, and I'll push back.
 
 It is great to get rid of the BUG_ON() calls.  But to be over-eager in
 checking parameters that we have full control of is not needed at all.
 
 So if you rework the patches to just clean up the BUG_ON() calls, I'll
 be glad to accept them, but they aren't security issues at all.

Ok, so your opinion is that most of these patches shouldn't go into
stable?  I can certainly rework the patch descriptions to remove the
stable references, and send them as a usb-next pull request instead.

If you're ok with taking BUG() removal patches, it seems like:

 - Patch 1 is fine, since it removes a BUG() call.
   
https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=d63f9bd7a0a3b5a6993cacf5a26e5f10a784ebbb

 - Patch 2 is defensive coding against adding a new xHCI context type,
   mixed with some changes to functions to make them accept
   xhci_input_control_ctx structures instead of xhci_container_ctx
   structures, so that xhci_get_input_control_ctx() doesn't need to be
   called as often.  Do you want to take the former part?  If not, I
   feel at least the latter part would be a good candidate for usb-next.
   
https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=9edeae7ac97d63d68ebb2ae008edc4ede93855db

 - Patch 3 seems fine to me for usb-next, since it removes a BUG() and
   condenses two switch statements into one.
   
https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=168faa7f1cb2170784671a2acc6cfee981b9936c

 - Patch 4 is defensive coding against adding a new endpoint type, but it
   also removes a BUG() call.  How would you like to see this patch
   reworked?
   
https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=35c5e886fc18dc43447be0a2f47f0bbd6b2ef9a4

 - Patch 5 seems fine to me, since it catches the case where the kernel
   is out of memory and DMA pool allocation fails.
   
https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=6aaa3a3315eb15fb36e49055db4019587063a1ee

 - Patch 6 needs to be reworked with Alan's suggestions.
   
https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=c3a0a3ea1c2ece9596b6e3ae3fcb4540fc9b6e31

Do you agree with this assessment?  What do you suggest we do with
patches 2 and 4?

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


Re: [RFC 0/6] xHCI and USB security bug fixes

2013-06-03 Thread Greg Kroah-Hartman
On Mon, Jun 03, 2013 at 12:10:19PM -0700, Sarah Sharp wrote:
 On Thu, May 30, 2013 at 07:04:03AM +0900, Greg Kroah-Hartman wrote:
  On Wed, May 29, 2013 at 10:45:04AM -0700, Sarah Sharp wrote:
   On Wed, May 29, 2013 at 10:27:50AM +0900, Greg Kroah-Hartman wrote:
On Fri, May 24, 2013 at 05:42:52PM -0700, Sarah Sharp wrote:
 This patchset address some (but not all) of the security issues found
 with the Klockwork static analysis tool.  I have not reviewed these in
 detail to see if these could be used by attackers, so someone with 
 more
 security experience may want to look these over.

A lot of these changes are just to add checks to functions that you are
calling yourself.  How can those pointers be not valid when you
control what you pass to them?
   
   It's purely paranoia.  It's entirely possible we'll add new code later
   that would accidentally trigger these checks.  That's especially true
   of, say, the device speeds, since USB 3.1 (10Gbps) is in the works.
  
  Then let's worry about it at that point in time :)
 
 All right.  Most of these patches are defensive coding, but you've had
 more experience with kernel coding, so I'll leave it up to you.

defensive coding in the kernel is only to be done when you are taking
data from an untrusted place, like userspace, or if the pointer or
value could have changed due to others doing things with it that this
function doesn't know about.

For internal function calls, where we control all of the callers, it
doesn't make sense to validate all paramaters passed to us, otherwise
the size of the kernel would grow to be huge with unneeded checks on
almost every function call.

That's how we stay lean, or at least attempt to stay lean :)

Those seems over-eager, and not really needed.  Or am I missing
somewhere that could change the pointer without the driver knowing it?
   
   In all honesty, these patches are the result of a bureaucratic push for
   code quality.  We switched static analysis tools from Coverity to
   Klockwork, and the QA folks pushed us to fix the issues that Klockwork
   discovered.
   
   If you don't think they're appropriate, let me know, and I'll push back.
  
  It is great to get rid of the BUG_ON() calls.  But to be over-eager in
  checking parameters that we have full control of is not needed at all.
  
  So if you rework the patches to just clean up the BUG_ON() calls, I'll
  be glad to accept them, but they aren't security issues at all.
 
 Ok, so your opinion is that most of these patches shouldn't go into
 stable?

As they don't fix a bug, or a problem that anyone can ever hit, why
would they go into stable?

 I can certainly rework the patch descriptions to remove the
 stable references, and send them as a usb-next pull request instead.
 
 If you're ok with taking BUG() removal patches, it seems like:
 
  - Patch 1 is fine, since it removes a BUG() call.

 https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=d63f9bd7a0a3b5a6993cacf5a26e5f10a784ebbb
 
  - Patch 2 is defensive coding against adding a new xHCI context type,
mixed with some changes to functions to make them accept
xhci_input_control_ctx structures instead of xhci_container_ctx
structures, so that xhci_get_input_control_ctx() doesn't need to be
called as often.  Do you want to take the former part?  If not, I
feel at least the latter part would be a good candidate for usb-next.

 https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=9edeae7ac97d63d68ebb2ae008edc4ede93855db
 
  - Patch 3 seems fine to me for usb-next, since it removes a BUG() and
condenses two switch statements into one.

 https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=168faa7f1cb2170784671a2acc6cfee981b9936c
 
  - Patch 4 is defensive coding against adding a new endpoint type, but it
also removes a BUG() call.  How would you like to see this patch
reworked?

 https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=35c5e886fc18dc43447be0a2f47f0bbd6b2ef9a4
 
  - Patch 5 seems fine to me, since it catches the case where the kernel
is out of memory and DMA pool allocation fails.

 https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=6aaa3a3315eb15fb36e49055db4019587063a1ee
 
  - Patch 6 needs to be reworked with Alan's suggestions.

 https://git.kernel.org/cgit/linux/kernel/git/sarah/xhci.git/commit/?id=c3a0a3ea1c2ece9596b6e3ae3fcb4540fc9b6e31
 
 Do you agree with this assessment?  What do you suggest we do with
 patches 2 and 4?

I don't remember them exactly, how about you rework them how you feel
they should be done, and resend and I'll be glad to review them again?

thanks,

greg drowning in patches 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


[PATCH 0/6] USB: make ehci-tegra its own module

2013-06-03 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

ehci-tegra is currently built into the main ehci-hcd driver, rather than
being a separate module. This causes issues with multi-platform ARM
kernels. This series separates ehci-tegra into its own module to avoid
those problems.

Manjunath Goudar originally wrote most of this series. I've since cleaned
it up, rebased it on Venu's recent changes to the Tegra USB driver, and
tested it.

Note that I expect this series will need to go through the USB PHY tree,
since it builds upon Venu's recent changes to the Tegra USB driver, which
were applied there.

Manjunath Goudar (4):
  usb: phy: export ulpi_viewport_access_ops
  USB: EHCI: expand struct ehci_driver_overrides
  USB: EHCI: export symbols for ehci-hcd sub-drivers
  USB: EHCI: make ehci-tegra a separate driver

Stephen Warren (2):
  usb: phy: add MODULE_LICENSE to phy-tegra-usb.c
  USB: EHCI: fix circular dependency in Tegra modules

 drivers/usb/host/Kconfig|2 +-
 drivers/usb/host/Makefile   |1 +
 drivers/usb/host/ehci-hcd.c |   39 
 drivers/usb/host/ehci-hub.c |9 +-
 drivers/usb/host/ehci-tegra.c   |  173 ++-
 drivers/usb/host/ehci.h |   14 +++
 drivers/usb/phy/phy-tegra-usb.c |   43 -
 drivers/usb/phy/phy-ulpi-viewport.c |2 +
 include/linux/usb/tegra_usb_phy.h   |4 -
 9 files changed, 153 insertions(+), 134 deletions(-)

-- 
1.7.10.4

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


[PATCH 2/6] usb: phy: add MODULE_LICENSE to phy-tegra-usb.c

2013-06-03 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

When this file is built as a module, it needs a MODULE_LICENSE in order
to access many exported symbols.

Signed-off-by: Stephen Warren swar...@nvidia.com
---
 drivers/usb/phy/phy-tegra-usb.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index 5d9af11..f0727f2 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -23,6 +23,7 @@
 #include linux/slab.h
 #include linux/err.h
 #include linux/export.h
+#include linux/module.h
 #include linux/platform_device.h
 #include linux/io.h
 #include linux/gpio.h
@@ -869,3 +870,6 @@ struct usb_phy *tegra_usb_get_phy(struct device_node *dn)
return tegra_phy-u_phy;
 }
 EXPORT_SYMBOL_GPL(tegra_usb_get_phy);
+
+MODULE_DESCRIPTION(Tegra USB PHY driver);
+MODULE_LICENSE(GPL v2);
-- 
1.7.10.4

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


[PATCH 1/6] usb: phy: export ulpi_viewport_access_ops

2013-06-03 Thread Stephen Warren
From: Manjunath Goudar manjunath.gou...@linaro.org

In order to build a ULPI PHY driver as a module, this symbol needs to
be exported.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
[swarren, reworked Manjunath's patches to split them more logically]
Signed-off-by: Stephen Warren swar...@nvidia.com
---
 drivers/usb/phy/phy-ulpi-viewport.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/phy/phy-ulpi-viewport.c 
b/drivers/usb/phy/phy-ulpi-viewport.c
index c5ba7e5..4442425 100644
--- a/drivers/usb/phy/phy-ulpi-viewport.c
+++ b/drivers/usb/phy/phy-ulpi-viewport.c
@@ -13,6 +13,7 @@
  */
 
 #include linux/kernel.h
+#include linux/module.h
 #include linux/usb.h
 #include linux/io.h
 #include linux/usb/otg.h
@@ -78,3 +79,4 @@ struct usb_phy_io_ops ulpi_viewport_access_ops = {
.read   = ulpi_viewport_read,
.write  = ulpi_viewport_write,
 };
+EXPORT_SYMBOL_GPL(ulpi_viewport_access_ops);
-- 
1.7.10.4

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


[PATCH 5/6] USB: EHCI: fix circular dependency in Tegra modules

2013-06-03 Thread Stephen Warren
From: Stephen Warren swar...@nvidia.com

The Tegra EHCI driver directly calls various functions in the Tegra USB
PHY driver. The reverse is also true; the PHY driver calls into the EHCI
driver. This is problematic when the two are built as modules.

The calls from the PHY to EHCI driver were originally added in commit
bbdabdb usb: add APIs to access host registers from Tegra PHY, for the
following reasons:

1) The register being touched is an EHCI register, so logically only the
   EHCI driver should touch it.
2) (1) implies that some locking may be needed to correctly implement the
   r/m/w access to this shared register.
3) We were expecting to pass only the PHY register space to the Tegra PHY
   driver, and hence it would not have access to touch the shared
   registers.

To solve this, that commit added functions in the EHCI driver to touch the
shared register on behalf of the PHY driver.

In practice, we ended up not having any locking in the implementaiton of
those functions, and I've been led to believe this is safe. Equally, (3)
did not happen either. Hence, it is possible for the PHY driver to touch
the shared register directly.

Given that, this patch moves the code to touch the shared register back
into the PHY driver, to eliminate the module problems. If we actually
need locking or co-ordination in the future, I propose we put the lock
support into some pre-existing core module, or into a third separate
module, in order to avoid the circular dependencies.

I apologize for my contribution to code churn here.

Signed-off-by: Stephen Warren swar...@nvidia.com
---
 drivers/usb/host/ehci-tegra.c |   36 --
 drivers/usb/phy/phy-tegra-usb.c   |   39 ++---
 include/linux/usb/tegra_usb_phy.h |4 
 3 files changed, 36 insertions(+), 43 deletions(-)

diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 29d4643..edf7d36 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -34,11 +34,6 @@
 #define TEGRA_USB2_BASE0xC5004000
 #define TEGRA_USB3_BASE0xC5008000
 
-/* PORTSC registers */
-#define TEGRA_USB_PORTSC1  0x184
-#define TEGRA_USB_PORTSC1_PTS(x)   (((x)  0x3)  30)
-#define TEGRA_USB_PORTSC1_PHCD (1  23)
-
 #define TEGRA_USB_DMA_ALIGN 32
 
 struct tegra_ehci_hcd {
@@ -608,37 +603,6 @@ static const struct dev_pm_ops tegra_ehci_pm_ops = {
 
 #endif
 
-/* Bits of PORTSC1, which will get cleared by writing 1 into them */
-#define TEGRA_PORTSC1_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
-
-void tegra_ehci_set_pts(struct usb_phy *x, u8 pts_val)
-{
-   unsigned long val;
-   struct usb_hcd *hcd = bus_to_hcd(x-otg-host);
-   void __iomem *base = hcd-regs;
-
-   val = readl(base + TEGRA_USB_PORTSC1)  ~TEGRA_PORTSC1_RWC_BITS;
-   val = ~TEGRA_USB_PORTSC1_PTS(3);
-   val |= TEGRA_USB_PORTSC1_PTS(pts_val  3);
-   writel(val, base + TEGRA_USB_PORTSC1);
-}
-EXPORT_SYMBOL_GPL(tegra_ehci_set_pts);
-
-void tegra_ehci_set_phcd(struct usb_phy *x, bool enable)
-{
-   unsigned long val;
-   struct usb_hcd *hcd = bus_to_hcd(x-otg-host);
-   void __iomem *base = hcd-regs;
-
-   val = readl(base + TEGRA_USB_PORTSC1)  ~TEGRA_PORTSC1_RWC_BITS;
-   if (enable)
-   val |= TEGRA_USB_PORTSC1_PHCD;
-   else
-   val = ~TEGRA_USB_PORTSC1_PHCD;
-   writel(val, base + TEGRA_USB_PORTSC1);
-}
-EXPORT_SYMBOL_GPL(tegra_ehci_set_phcd);
-
 static int tegra_ehci_probe(struct platform_device *pdev)
 {
struct resource *res;
diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-usb.c
index f0727f2..3446245 100644
--- a/drivers/usb/phy/phy-tegra-usb.c
+++ b/drivers/usb/phy/phy-tegra-usb.c
@@ -32,11 +32,20 @@
 #include linux/usb/otg.h
 #include linux/usb/ulpi.h
 #include asm/mach-types.h
+#include linux/usb/ehci_def.h
 #include linux/usb/tegra_usb_phy.h
 #include linux/module.h
 
 #define ULPI_VIEWPORT  0x170
 
+/* PORTSC registers */
+#define TEGRA_USB_PORTSC1  0x184
+#define TEGRA_USB_PORTSC1_PTS(x)   (((x)  0x3)  30)
+#define TEGRA_USB_PORTSC1_PHCD (1  23)
+
+/* Bits of PORTSC1, which will get cleared by writing 1 into them */
+#define TEGRA_PORTSC1_RWC_BITS (PORT_CSC | PORT_PEC | PORT_OCC)
+
 #define USB_SUSP_CTRL  0x400
 #define   USB_WAKE_ON_CNNT_EN_DEV  (1  3)
 #define   USB_WAKE_ON_DISCON_EN_DEV(1  4)
@@ -197,6 +206,30 @@ static struct tegra_utmip_config utmip_default[] = {
},
 };
 
+static void set_pts(struct tegra_usb_phy *phy, u8 pts_val)
+{
+   void __iomem *base = phy-regs;
+   unsigned long val;
+
+   val = readl(base + TEGRA_USB_PORTSC1)  ~TEGRA_PORTSC1_RWC_BITS;
+   val = ~TEGRA_USB_PORTSC1_PTS(3);
+   val |= TEGRA_USB_PORTSC1_PTS(pts_val  3);
+   writel(val, base + TEGRA_USB_PORTSC1);
+}
+
+static void 

[PATCH 3/6] USB: EHCI: expand struct ehci_driver_overrides

2013-06-03 Thread Stephen Warren
From: Manjunath Goudar manjunath.gou...@linaro.org

Some EHCI HCD drivers may need to override additional fields in struct
hc_driver, such as map_urb_for_dma, unmap_urb_for_dma, hub_control. Add
fields to struct ehci_driver_overrides to allow them to do so.

These new overrides will be used at least by the Tegra EHCI driver.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
[swarren, reworked Manjunath's patches to split them more logically]
Signed-off-by: Stephen Warren swar...@nvidia.com
---
 drivers/usb/host/ehci-hcd.c |6 ++
 drivers/usb/host/ehci.h |6 ++
 2 files changed, 12 insertions(+)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 246e124..da1c224 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1211,6 +1211,12 @@ void ehci_init_driver(struct hc_driver *drv,
drv-hcd_priv_size += over-extra_priv_size;
if (over-reset)
drv-reset = over-reset;
+   if (over-map_urb_for_dma)
+   drv-map_urb_for_dma = over-map_urb_for_dma;
+   if (over-unmap_urb_for_dma)
+   drv-unmap_urb_for_dma = over-unmap_urb_for_dma;
+   if (over-hub_control)
+   drv-hub_control = over-hub_control;
}
 }
 EXPORT_SYMBOL_GPL(ehci_init_driver);
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 7c978b2..918008a 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -795,6 +795,12 @@ static inline u32 hc32_to_cpup (const struct ehci_hcd 
*ehci, const __hc32 *x)
 struct ehci_driver_overrides {
size_t  extra_priv_size;
int (*reset)(struct usb_hcd *hcd);
+   int (*map_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb,
+  gfp_t mem_flags);
+   void(*unmap_urb_for_dma)(struct usb_hcd *hcd, struct urb *urb);
+   int (*hub_control)(struct usb_hcd *hcd,
+   u16 typeReq, u16 wValue, u16 wIndex,
+   char *buf, u16 wLength);
 };
 
 extern voidehci_init_driver(struct hc_driver *drv,
-- 
1.7.10.4

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


[PATCH 4/6] USB: EHCI: export symbols for ehci-hcd sub-drivers

2013-06-03 Thread Stephen Warren
From: Manjunath Goudar manjunath.gou...@linaro.org

In order to split ehci-hcd.c into separate modules, various symbols must
be exported. Also, rename the symbols to add an ehci_ prefix, to avoid
any naming clashes.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
[swarren, reworked Manjunath's patches to split them more logically]
Signed-off-by: Stephen Warren swar...@nvidia.com
---
 drivers/usb/host/ehci-hcd.c   |   28 +---
 drivers/usb/host/ehci-hub.c   |9 +
 drivers/usb/host/ehci-tegra.c |   14 +++---
 drivers/usb/host/ehci.h   |8 
 4 files changed, 37 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index da1c224..75cf500 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -139,7 +139,7 @@ static inline unsigned ehci_read_frame_index(struct 
ehci_hcd *ehci)
 /*-*/
 
 /*
- * handshake - spin reading hc until handshake completes or fails
+ * ehci_handshake - spin reading hc until handshake completes or fails
  * @ptr: address of hc register to be read
  * @mask: bits to look at in result of read
  * @done: value of those bits when handshake succeeds
@@ -155,8 +155,8 @@ static inline unsigned ehci_read_frame_index(struct 
ehci_hcd *ehci)
  * before driver shutdown. But it also seems to be caused by bugs in cardbus
  * bridge shutdown:  shutting down the bridge before the devices using it.
  */
-static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
- u32 mask, u32 done, int usec)
+int ehci_handshake(struct ehci_hcd *ehci, void __iomem *ptr,
+  u32 mask, u32 done, int usec)
 {
u32 result;
 
@@ -172,6 +172,7 @@ static int handshake (struct ehci_hcd *ehci, void __iomem 
*ptr,
} while (usec  0);
return -ETIMEDOUT;
 }
+EXPORT_SYMBOL_GPL(ehci_handshake);
 
 /* check TDI/ARC silicon is in host mode */
 static int tdi_in_host_mode (struct ehci_hcd *ehci)
@@ -186,7 +187,7 @@ static int tdi_in_host_mode (struct ehci_hcd *ehci)
  * Force HC to halt state from unknown (EHCI spec section 2.3).
  * Must be called with interrupts enabled and the lock not held.
  */
-static int ehci_halt (struct ehci_hcd *ehci)
+int ehci_halt(struct ehci_hcd *ehci)
 {
u32 temp;
 
@@ -212,12 +213,13 @@ static int ehci_halt (struct ehci_hcd *ehci)
spin_unlock_irq(ehci-lock);
synchronize_irq(ehci_to_hcd(ehci)-irq);
 
-   return handshake(ehci, ehci-regs-status,
+   return ehci_handshake(ehci, ehci-regs-status,
  STS_HALT, STS_HALT, 16 * 125);
 }
+EXPORT_SYMBOL_GPL(ehci_halt);
 
 /* put TDI/ARC silicon into EHCI mode */
-static void tdi_reset (struct ehci_hcd *ehci)
+void ehci_tdi_reset(struct ehci_hcd *ehci)
 {
u32 tmp;
 
@@ -231,12 +233,13 @@ static void tdi_reset (struct ehci_hcd *ehci)
tmp |= USBMODE_BE;
ehci_writel(ehci, tmp, ehci-regs-usbmode);
 }
+EXPORT_SYMBOL_GPL(ehci_tdi_reset);
 
 /*
  * Reset a non-running (STS_HALT == 1) controller.
  * Must be called with interrupts enabled and the lock not held.
  */
-static int ehci_reset (struct ehci_hcd *ehci)
+int ehci_reset(struct ehci_hcd *ehci)
 {
int retval;
u32 command = ehci_readl(ehci, ehci-regs-command);
@@ -251,7 +254,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
ehci_writel(ehci, command, ehci-regs-command);
ehci-rh_state = EHCI_RH_HALTED;
ehci-next_statechange = jiffies;
-   retval = handshake (ehci, ehci-regs-command,
+   retval = ehci_handshake(ehci, ehci-regs-command,
CMD_RESET, 0, 250 * 1000);
 
if (ehci-has_hostpc) {
@@ -263,7 +266,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
return retval;
 
if (ehci_is_TDI(ehci))
-   tdi_reset (ehci);
+   ehci_tdi_reset(ehci);
 
if (ehci-debug)
dbgp_external_startup(ehci_to_hcd(ehci));
@@ -272,6 +275,7 @@ static int ehci_reset (struct ehci_hcd *ehci)
ehci-resuming_ports = 0;
return retval;
 }
+EXPORT_SYMBOL_GPL(ehci_reset);
 
 /*
  * Idle the controller (turn off the schedules).
@@ -286,7 +290,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
 
/* wait for any schedule enables/disables to take effect */
temp = (ehci-command  10)  (STS_ASS | STS_PSS);
-   handshake(ehci, ehci-regs-status, STS_ASS | STS_PSS, temp, 16 * 125);
+   ehci_handshake(ehci, ehci-regs-status, STS_ASS | STS_PSS, temp,
+   16 * 125);
 
/* then disable anything that's still active */
spin_lock_irq(ehci-lock);
@@ -295,7 +300,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
spin_unlock_irq(ehci-lock);
 
/* hardware can take 16 microframes to turn off ... */
-   handshake(ehci, 

[PATCH 6/6] USB: EHCI: make ehci-tegra a separate driver

2013-06-03 Thread Stephen Warren
From: Manjunath Goudar manjunath.gou...@linaro.org

Separate the Tegra on-chip host controller driver from
ehci-hcd host code so that it can be built as a separate driver module.
This work is part of enabling multi-platform kernels on ARM.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
[swarren, reworked Manjunath's patches to split them more logically,
minor re-order of added lines to better match layout of other split-up
HCD drivers and existing code, add MODULE_DEVICE_TABLE, fix
MODULE_LICENSE.]
Signed-off-by: Stephen Warren swar...@nvidia.com
---
 drivers/usb/host/Kconfig  |2 +-
 drivers/usb/host/Makefile |1 +
 drivers/usb/host/ehci-hcd.c   |5 --
 drivers/usb/host/ehci-tegra.c |  125 -
 4 files changed, 63 insertions(+), 70 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index fcb20fd..6c9347c 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -200,7 +200,7 @@ config USB_EHCI_MSM
  has an external PHY.
 
 config USB_EHCI_TEGRA
-   boolean NVIDIA Tegra HCD support
+   tristate NVIDIA Tegra HCD support
depends on ARCH_TEGRA
select USB_EHCI_ROOT_HUB_TT
select USB_PHY
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index dbc785d..c170383 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_USB_EHCI_HCD_SPEAR)  += ehci-spear.o
 obj-$(CONFIG_USB_EHCI_S5P) += ehci-s5p.o
 obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
 obj-$(CONFIG_USB_EHCI_MSM) += ehci-msm.o
+obj-$(CONFIG_USB_EHCI_TEGRA)   += ehci-tegra.o
 
 obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o
 obj-$(CONFIG_USB_ISP116X_HCD)  += isp116x-hcd.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 75cf500..2eab6f0 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1278,11 +1278,6 @@ MODULE_LICENSE (GPL);
 #definePLATFORM_DRIVER ehci_hcd_msp_driver
 #endif
 
-#ifdef CONFIG_USB_EHCI_TEGRA
-#include ehci-tegra.c
-#define PLATFORM_DRIVERtegra_ehci_driver
-#endif
-
 #ifdef CONFIG_SPARC_LEON
 #include ehci-grlib.c
 #define PLATFORM_DRIVERehci_grlib_driver
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index edf7d36..d12bc83 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -17,25 +17,38 @@
  */
 
 #include linux/clk.h
+#include linux/clk/tegra.h
+#include linux/dma-mapping.h
 #include linux/err.h
-#include linux/platform_device.h
-#include linux/platform_data/tegra_usb.h
-#include linux/irq.h
-#include linux/usb/otg.h
 #include linux/gpio.h
+#include linux/io.h
+#include linux/irq.h
+#include linux/module.h
 #include linux/of.h
 #include linux/of_gpio.h
+#include linux/platform_device.h
+#include linux/platform_data/tegra_usb.h
 #include linux/pm_runtime.h
+#include linux/slab.h
 #include linux/usb/ehci_def.h
 #include linux/usb/tegra_usb_phy.h
-#include linux/clk/tegra.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+#include linux/usb/otg.h
+
+#include ehci.h
 
 #define TEGRA_USB_BASE 0xC500
 #define TEGRA_USB2_BASE0xC5004000
 #define TEGRA_USB3_BASE0xC5008000
 
+#define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E)
+
 #define TEGRA_USB_DMA_ALIGN 32
 
+#define DRIVER_DESC Tegra EHCI driver
+#define DRV_NAME tegra-ehci
+
 struct tegra_ehci_hcd {
struct ehci_hcd *ehci;
struct tegra_usb_phy *phy;
@@ -47,6 +60,8 @@ struct tegra_ehci_hcd {
enum tegra_usb_phy_port_speed port_speed;
 };
 
+static struct hc_driver __read_mostly tegra_ehci_hc_driver;
+
 static void tegra_ehci_power_up(struct usb_hcd *hcd)
 {
struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd-self.controller);
@@ -264,31 +279,6 @@ static void tegra_ehci_restart(struct usb_hcd *hcd)
up_write(ehci_cf_port_reset_rwsem);
 }
 
-static void tegra_ehci_shutdown(struct usb_hcd *hcd)
-{
-   struct tegra_ehci_hcd *tegra = dev_get_drvdata(hcd-self.controller);
-
-   /* ehci_shutdown touches the USB controller registers, make sure
-* controller has clocks to it */
-   if (!tegra-host_resumed)
-   tegra_ehci_power_up(hcd);
-
-   ehci_shutdown(hcd);
-}
-
-static int tegra_ehci_setup(struct usb_hcd *hcd)
-{
-   struct ehci_hcd *ehci = hcd_to_ehci(hcd);
-
-   /* EHCI registers start at offset 0x100 */
-   ehci-caps = hcd-regs + 0x100;
-
-   /* switch to host mode */
-   hcd-has_tt = 1;
-
-   return ehci_setup(hcd);
-}
-
 struct dma_aligned_buffer {
void *kmalloc_ptr;
void *old_xfer_buffer;
@@ -368,38 +358,6 @@ static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd 
*hcd, struct urb *urb)
free_dma_aligned_buffer(urb);
 }
 
-static const struct hc_driver tegra_ehci_hc_driver = {
-   .description= 

Re: [PATCH] staging: MIPS: add Octeon USB HCD support

2013-06-03 Thread Greg Kroah-Hartman
On Sat, Jun 01, 2013 at 09:42:58PM +0300, Aaro Koskinen wrote:
 Add support for Octeon USB HCD. Tested on EdgeRouter Lite with USB
 mass storage.
 
 The driver has been extracted from GPL sources of EdgeRouter Lite firmware
 (based on Linux 2.6.32.13). Some minor fixes and cleanups have been done
 to make it work with 3.10-rc3.
 
 $ uname -a
 Linux (none) 3.10.0-rc3-edge-5-g86cb5bc #41 SMP PREEMPT Sat Jun 1 
 20:41:46 EEST 2013 mips64 GNU/Linux
 $ modprobe octeon-usb
 [   37.971683] octeon_usb: module is from the staging directory, the quality 
 is unknown, you have been warned.
 [   37.983649] OcteonUSB: Detected 1 ports
 [   37.999360] OcteonUSB OcteonUSB.0: Octeon Host Controller
 [   38.004847] OcteonUSB OcteonUSB.0: new USB bus registered, assigned bus 
 number 1
 [   38.012332] OcteonUSB OcteonUSB.0: irq 122, io mem 0x
 [   38.019970] hub 1-0:1.0: USB hub found
 [   38.023851] hub 1-0:1.0: 1 port detected
 [   38.028101] OcteonUSB: Registered HCD for port 0 on irq 122
 [   38.391443] usb 1-1: new high-speed USB device number 2 using OcteonUSB
 [   38.586922] usb-storage 1-1:1.0: USB Mass Storage device detected
 [   38.597375] scsi0 : usb-storage 1-1:1.0
 [   39.604111] scsi 0:0:0:0: Direct-Access  USB DISK 2.0 PMAP 
 PQ: 0 ANSI: 4
 [   39.619113] sd 0:0:0:0: [sda] 7579008 512-byte logical blocks: (3.88 
 GB/3.61 GiB)
 [   39.630696] sd 0:0:0:0: [sda] Write Protect is off
 [   39.635945] sd 0:0:0:0: [sda] No Caching mode page present
 [   39.641464] sd 0:0:0:0: [sda] Assuming drive cache: write through
 [   39.651341] sd 0:0:0:0: [sda] No Caching mode page present
 [   39.656917] sd 0:0:0:0: [sda] Assuming drive cache: write through
 [   39.664296]  sda: sda1 sda2
 [   39.675574] sd 0:0:0:0: [sda] No Caching mode page present
 [   39.681093] sd 0:0:0:0: [sda] Assuming drive cache: write through
 [   39.687223] sd 0:0:0:0: [sda] Attached SCSI removable disk
 
 Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi

checkpatch.pl output:
total: 4870 errors, 4611 warnings, 10004 lines checked

You have almost one error/warning per line of code you added.  That
means you will end up replacing all of the driver by the time you are
done.

Are you really going to do that?  It's fine with me, but I better start
get cleanup patches from you and others real soon, or I will drop this
driver from the 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 1/6] usb: phy: export ulpi_viewport_access_ops

2013-06-03 Thread Sergei Shtylyov

Hello.

On 06/03/2013 11:21 PM, Stephen Warren wrote:


From: Manjunath Goudar manjunath.gou...@linaro.org

In order to build a ULPI PHY driver as a module, this symbol needs to
be exported.

Signed-off-by: Manjunath Goudar manjunath.gou...@linaro.org
[swarren, reworked Manjunath's patches to split them more logically]
Signed-off-by: Stephen Warren swar...@nvidia.com
---
  drivers/usb/phy/phy-ulpi-viewport.c |2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/usb/phy/phy-ulpi-viewport.c 
b/drivers/usb/phy/phy-ulpi-viewport.c
index c5ba7e5..4442425 100644
--- a/drivers/usb/phy/phy-ulpi-viewport.c
+++ b/drivers/usb/phy/phy-ulpi-viewport.c
@@ -13,6 +13,7 @@
   */
  
  #include linux/kernel.h

+#include linux/module.h


Rather export.h...


  #include linux/usb.h
  #include linux/io.h
  #include linux/usb/otg.h
@@ -78,3 +79,4 @@ struct usb_phy_io_ops ulpi_viewport_access_ops = {
.read   = ulpi_viewport_read,
.write  = ulpi_viewport_write,
  };
+EXPORT_SYMBOL_GPL(ulpi_viewport_access_ops);


WBR, Sergei

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


Re: [PATCH 3/6] USB: EHCI: expand struct ehci_driver_overrides

2013-06-03 Thread Alan Stern
On Mon, 3 Jun 2013, Stephen Warren wrote:

 From: Manjunath Goudar manjunath.gou...@linaro.org
 
 Some EHCI HCD drivers may need to override additional fields in struct
 hc_driver, such as map_urb_for_dma, unmap_urb_for_dma, hub_control. Add
 fields to struct ehci_driver_overrides to allow them to do so.
 
 These new overrides will be used at least by the Tegra EHCI driver.

This is not a good approach.  ehci-tegra is the only driver that needs 
to muck around with these things, so they should not be part of a 
standardized override structure.

Indeed, so strong is my feeling that platforms shouldn't have to do 
this sort of thing that I want to make it difficult, not easy.

Instead of adding extra fields to ehci_driver_overrides, let's force 
ehci-tegra to manually insert its own values into the 
tegra_ehci_hc_driver structure.  Then this patch won't be necessary at 
all.

Alan Stern

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


Re: [PATCH 4/6] USB: EHCI: export symbols for ehci-hcd sub-drivers

2013-06-03 Thread Alan Stern
On Mon, 3 Jun 2013, Stephen Warren wrote:

 From: Manjunath Goudar manjunath.gou...@linaro.org
 
 In order to split ehci-hcd.c into separate modules, various symbols must
 be exported. Also, rename the symbols to add an ehci_ prefix, to avoid
 any naming clashes.

I have my doubts about this.  Some of the exports are okay, but not 
others.  Renaming and exporting ehci_handshake is fine.  ehci_tdi_reset 
maybe; I'm not sure.  ehci_reset and ehci_halt are rather doubtful, and 
ehci_hub_control is definitely wrong.

A better idea is to export ehci_hc_driver.  Then the tegra module could 
call ehci_hc_driver-hub_control rather than directly accessing 
ehci_hub_control (this is another example of something which should be 
difficult, not easy).

As for ehci_reset and ehci_halt (and possible ehci_tdi_reset), I rather
suspect that ehci-tegra shouldn't be calling them at all.  In fact, the
whole implementation of suspend/resume in ehci-tegra (which is where
these things get used) looks pretty dodgy.  If the controller can't be
suspended without invoking these private routines, then ... well, maybe
it shouldn't be suspended, period.

Alan Stern

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


Re: [PATCH 4/7] USB chipidea: introduce dual role mode pdata flags

2013-06-03 Thread Peter Chen
On Mon, Jun 3, 2013 at 8:37 PM, Alexander Shishkin
alexander.shish...@linux.intel.com wrote:
 Michael Grzeschik m...@pengutronix.de writes:

 From: Sascha Hauer s.ha...@pengutronix.de

 Even if a chipidea core is otg capable the board may not. This allows

 may not be

 to explicitly set the core to host/peripheral mode. Without these
 flags the driver falls back to the old behaviour.

 Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
 ---

 [snip]

 + if (!ci-platdata-dr_mode)
 + ci-platdata-dr_mode = of_usb_get_dr_mode(dev-of_node);

 same as previous one, let's keep it in the platform.

Alex, have you made the conclusion with Felipe, whether we need DT support
at core driver to handle such kinds of things or use platform data is ok?
Last time, I remember he disagreed the way this patch uses.

--
BR,
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 1/1] usb: chipidea: Improve kconfig

2013-06-03 Thread Peter Chen
On Thu, May 9, 2013 at 3:51 AM, Randy Dunlap rdun...@infradead.org wrote:
 On 05/08/13 03:02, Peter Chen wrote:
 Randy Dunlap rdun...@infradead.org reported below problem
 at i386:
 drivers/built-in.o: In function `ci_hdrc_host_init':
 (.text+0x2ce75c): undefined reference to `ehci_init_driver'

 When USB_EHCI_HCD=m and USB_CHIPIDEA=y.

 In fact, this problem is existed at all platforms which are using
 chipidea driver. The root cause of this problem is the chipidea host
 uses symbol exported from ehci-hcd, but chipidea core
 does not depends on USB_EHCI_HCD. So, chipidea driver
 will not be compiled as module if USB_EHCI_HCD=m.

 It is very hard to give a perfect solution since chipidea core
 depends on USB || USB_GADGET, and chipdiea host depends on
 both USB_EHCI_HCD and USB_CHIPIDEA, the same problem exists for
 gadget.

 To fix this problem, we had to have below assumptions:

 - If USB_EHCI_HCD=y  USB_GADGET=y, USB_CHIPIDEA can be 'y'.

 - If USB_EHCI_HCD=m  USB_GADGET=y, USB_CHIPIDEA=m
 or USB_CHIPIDEA_HOST can't be seen if USB_CHIPIDEA=y.
 It will cause compile error as no glue layer for ehci.
 error: #error missing bus glue for ehci-hcd
 So, we had to compile USB_CHIPIDEA=m if USB_EHCI_HCD=m,
 current ehci hcd core guarantee it.

 - If USB_EHCI_HCD=y  USB_GADGET=m, USB_CHIPIDEA=m
 or USB_CHIPIDEA_UDC can't be seen if USB_CHIPIDEA=y.
 Of cos, the gadget will out of working at this situation,
 so the user had to compile USB_CHIPIDEA=m.

 - USB_EHCI_HCD=m  USB_GADGET=m, we can't see
 USB_CHIPIDEA_HOST and USB_CHIPIDEA_UDC unless
 USB_CHIPIDEA=m.

 The reason why it has abvoe assumptions:
 - If both ehci core and gadget core build as module,
 the chipidea has to build as module.
 - If one of ehci core or gadget core is built in, another
 is built as module, we can only enable the function which
 is built in, or enable both roles as modules (USB_CHIPIDEA=m),
 since chipidea driver is unify core driver, the host or udc
 is not a individual driver.

 Signed-off-by: Peter Chen peter.c...@freescale.com

 Acked-by: Randy Dunlap rdun...@infradead.org

 Thanks.


 ---
  drivers/usb/chipidea/Kconfig |6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

 diff --git a/drivers/usb/chipidea/Kconfig b/drivers/usb/chipidea/Kconfig
 index 608a2ae..eb2aa2e 100644
 --- a/drivers/usb/chipidea/Kconfig
 +++ b/drivers/usb/chipidea/Kconfig
 @@ -12,15 +12,15 @@ if USB_CHIPIDEA

  config USB_CHIPIDEA_UDC
   bool ChipIdea device controller
 - depends on USB_GADGET=y || USB_GADGET=USB_CHIPIDEA
 + depends on USB_GADGET=y || USB_CHIPIDEA=m
   help
 Say Y here to enable device controller functionality of the
 ChipIdea driver.

  config USB_CHIPIDEA_HOST
   bool ChipIdea host controller
 - depends on USB=y || USB=USB_CHIPIDEA
 - depends on USB_EHCI_HCD
 + depends on USB=y
 + depends on USB_EHCI_HCD=y || USB_CHIPIDEA=m
   select USB_EHCI_ROOT_HUB_TT
   help
 Say Y here to enable host controller functionality of the




Alex, will you queue this one?


--
BR,
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: [RFC] raise the maximum number of usb-serial devices to 512

2013-06-03 Thread Greg KH
On Mon, May 27, 2013 at 02:28:51PM +0200, Bjørn Mork wrote:
 But, IMHO, a nicer approach would be to make the allocation completely
 dynamic, using e.g. the idr subsystem. Static tables are always feel
 like straight jackets to me, no matter how big they are :)

You are right, I didn't change the code to use idr (it predates idr by
about a decade or so), because I thought we needed the rage logic that
the usb-serial minor reservation does.

But I'm not so sure anymore, so here's a patch to change to use the idr
code, and should remove all minor number limitations (well 65k is the
limit the tty core should be setting I think.)

Tobias, can you test this patch out?  Note, I only compiled it, did not
get the chance to actually run it, so it might not work at all.

thanks,

greg k-h

Subject: [PATCH] usb: serial: remove minor number limitation of 255


Signed-off-by: Greg Kroah-Hartman gre...@linuxfoundation.org

 drivers/usb/serial/usb-serial.c |   86 +---
 1 file changed, 38 insertions(+), 48 deletions(-)

diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 4753c00..74b6f08 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -37,6 +37,7 @@
 #include linux/usb.h
 #include linux/usb/serial.h
 #include linux/kfifo.h
+#include linux/idr.h
 #include pl2303.h
 
 #define DRIVER_AUTHOR Greg Kroah-Hartman gre...@linuxfoundation.org
@@ -49,7 +50,7 @@
drivers depend on it.
 */
 
-static struct usb_serial *serial_table[SERIAL_TTY_MINORS];
+static DEFINE_IDR(serial_minors);
 static DEFINE_MUTEX(table_lock);
 static LIST_HEAD(usb_serial_driver_list);
 
@@ -61,59 +62,52 @@ static LIST_HEAD(usb_serial_driver_list);
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
struct usb_serial *serial;
+   struct usb_serial_port *port;
 
mutex_lock(table_lock);
-   serial = serial_table[index];
-
-   if (serial) {
-   mutex_lock(serial-disc_mutex);
-   if (serial-disconnected) {
-   mutex_unlock(serial-disc_mutex);
-   serial = NULL;
-   } else {
-   kref_get(serial-kref);
-   }
-   }
+   port = idr_find(serial_minors, index);
mutex_unlock(table_lock);
+   if (!port)
+   return NULL;
+
+   serial = port-serial;
+   kref_get(serial-kref);
return serial;
 }
 
-static struct usb_serial *get_free_serial(struct usb_serial *serial,
-   int num_ports, unsigned int *minor)
+static int get_free_port(struct usb_serial_port *port)
 {
-   unsigned int i, j;
-   int good_spot;
-
-   dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports);
+   int i;
 
-   *minor = 0;
mutex_lock(table_lock);
-   for (i = 0; i  SERIAL_TTY_MINORS; ++i) {
-   if (serial_table[i])
-   continue;
+   i = idr_alloc(serial_minors, port, 0, 0, GFP_KERNEL);
+   if (i  0)
+   return -EEXIST;
+   port-number = i;
+   mutex_unlock(table_lock);
+   return i;
+}
 
-   good_spot = 1;
-   for (j = 1; j = num_ports-1; ++j)
-   if ((i+j = SERIAL_TTY_MINORS) || (serial_table[i+j])) {
-   good_spot = 0;
-   i += j;
-   break;
-   }
-   if (good_spot == 0)
-   continue;
+static int get_free_serial(struct usb_serial *serial, int num_ports,
+  unsigned int *minor)
+{
+   unsigned int i;
+   unsigned int x;
 
-   *minor = i;
-   j = 0;
-   dev_dbg(serial-interface-dev, %s - minor base = %d\n, 
__func__, *minor);
-   for (i = *minor; (i  (*minor + num_ports))  (i  
SERIAL_TTY_MINORS); ++i) {
-   serial_table[i] = serial;
-   serial-port[j++]-number = i;
-   }
-   mutex_unlock(table_lock);
-   return serial;
+   dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports);
+
+   *minor = 0x;
+   for (i = 0; i  num_ports; ++i) {
+   x = get_free_port(serial-port[i]);
+   if (x  0)
+   goto error;
+   if (*minor == 0x)
+   *minor = x;
}
-   mutex_unlock(table_lock);
-   return NULL;
+   return 0;
+error:
+   // FIXME unwind the already allocated minors
+   return -ENODEV;
 }
 
 static void return_serial(struct usb_serial *serial)
@@ -122,7 +116,7 @@ static void return_serial(struct usb_serial *serial)
 
mutex_lock(table_lock);
for (i = 0; i  serial-num_ports; ++i)
-   serial_table[serial-minor + i] = NULL;
+   idr_remove(serial_minors, serial-port[i]-number);
  

Re: [RFC] raise the maximum number of usb-serial devices to 512

2013-06-03 Thread Dave Jones
On Mon, Jun 03, 2013 at 07:49:59PM -0700, Greg Kroah-Hartman wrote:
  On Mon, May 27, 2013 at 02:28:51PM +0200, Bjørn Mork wrote:
   But, IMHO, a nicer approach would be to make the allocation completely
   dynamic, using e.g. the idr subsystem. Static tables are always feel
   like straight jackets to me, no matter how big they are :)
  
  You are right, I didn't change the code to use idr (it predates idr by
  about a decade or so), because I thought we needed the rage logic that
  the usb-serial minor reservation does.

Rage logic sounds like my kinda code.


  +static int get_free_port(struct usb_serial_port *port)
   {
  -unsigned int i, j;
  -int good_spot;
  -
  -dev_dbg(serial-interface-dev, %s %d\n, __func__, num_ports);
  +int i;
   
  -*minor = 0;
   mutex_lock(table_lock);
  -for (i = 0; i  SERIAL_TTY_MINORS; ++i) {
  -if (serial_table[i])
  -continue;
  +i = idr_alloc(serial_minors, port, 0, 0, GFP_KERNEL);
  +if (i  0)
  +return -EEXIST;
  +port-number = i;
  +mutex_unlock(table_lock);
  +return i;
  +}

-EEXIST case misses the mutex unlock.

Dave

--
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: gdm_usb.c:undefined reference to `usb_autopm_get_interface'

2013-06-03 Thread Greg Kroah-Hartman
On Mon, Jun 03, 2013 at 09:50:40PM -0700, Ben Chan wrote:
 Thanks Alan!  I revised the patch to enforce the dependency as follows:
 
   depends on (USB = y || USB = WIMAX_GDM72XX)
 
   depends on (MMC = y || MMC = WIMAX_GDM72XX)

I can't accept attached patches, please resend them, in the email body,
in two emails, so we can read and review, and hopefully, apply them.

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 v8 2/3] ARM: shmobile: r8a7778: add USB support

2013-06-03 Thread Kuninori Morimoto

Hi

  The ohci/ehci resource will be  used vainly if platform doesn't have USB
 
 The platform device resources are never used vainly. And remember 
 that if PHY doesn't get registered, OHCI/EHCI won't get probed 
 successfully either -- mind the usb_power_on() platform method.

?
Could you please teach me who/how/when free resource memory
which was kmemdup'ed by platform_device_add_xxx()
(and kmalloc'ed dma_mask) on platform_device_register_full() ??

 ohci/ehci and phy should be registered in same time/function.

I just copied your approach from the R8A7779 code.

Ahh, yes, indeed


Best regards
---
Kuninori Morimoto
--
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