[PATCH 0/1] chipidea fix for v4.0-rc3

2015-03-08 Thread Peter Chen
Hi Greg,

This patch fixes the problem that the OTG B device can't be enumerated on
non-HNP port at OTG A device.

Li Jun (1):
  usb: chipidea: otg: add a_alt_hnp_support response for B device

 drivers/usb/chipidea/udc.c | 11 +++
 1 file changed, 11 insertions(+)

-- 
1.9.1

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


[PATCH 1/1] usb: chipidea: otg: add a_alt_hnp_support response for B device

2015-03-08 Thread Peter Chen
From: Li Jun 

This patch adds response to a_alt_hnp_support set feature request from legacy
A device, that is, B-device can provide a message to the user indicating that
the user needs to connect the B-device to an alternate port on the A-device.
A device sets this feature indicates to the B-device that it is connected
to an A-device port that is not capable of HNP, but that the A-device does have
an alternate port that is capable of HNP.

[Peter]
Without this patch, the OTG B device can't be enumerated on
non-HNP port at A device, see below log:
[2.287464] usb 1-1: Dual-Role OTG device on non-HNP port
[2.293105] usb 1-1: can't set HNP mode: -32
[2.417422] usb 1-1: new high-speed USB device number 4 using ci_hdrc
[2.460635] usb 1-1: Dual-Role OTG device on non-HNP port
[2.466424] usb 1-1: can't set HNP mode: -32
[2.587464] usb 1-1: new high-speed USB device number 5 using ci_hdrc
[2.630649] usb 1-1: Dual-Role OTG device on non-HNP port
[2.636436] usb 1-1: can't set HNP mode: -32
[2.641003] usb usb1-port1: unable to enumerate USB device

Cc: stable 
Acked-by: Peter Chen 
Signed-off-by: Li Jun 
Signed-off-by: Peter Chen 
---
 drivers/usb/chipidea/udc.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index ff45104..4bfb7ac 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -929,6 +929,13 @@ __acquires(hwep->lock)
return retval;
 }
 
+static int otg_a_alt_hnp_support(struct ci_hdrc *ci)
+{
+   dev_warn(&ci->gadget.dev,
+   "connect the device to an alternate port if you want HNP\n");
+   return isr_setup_status_phase(ci);
+}
+
 /**
  * isr_setup_packet_handler: setup packet handler
  * @ci: UDC descriptor
@@ -1061,6 +1068,10 @@ __acquires(ci->lock)
ci);
}
break;
+   case USB_DEVICE_A_ALT_HNP_SUPPORT:
+   if (ci_otg_is_fsm_mode(ci))
+   err = otg_a_alt_hnp_support(ci);
+   break;
default:
goto delegate;
}
-- 
1.9.1

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


Re: [PATCH 1/1] usb: xhci: handle Config Error Change (CEC) in xhci driver

2015-03-08 Thread Lu, Baolu

Hi Alan,

Do you have any comments for this patch?

Thanks,
 Baolu

On 03/06/2015 04:12 PM, Lu Baolu wrote:

Linux xHCI driver doesn't report and handle port cofig error change.
If Port Configure Error for root hub port occurs, CEC bit in PORTSC
would be set by xHC and remains 1. This happends when the root port
fails to configure its link partner, e.g. the port fails to exchange
port capabilities information using Port Capability LMPs.

Then the Port Status Change Events will be blocked until all status
change bits(CEC is one of the change bits) are cleared('0') (refer to
xHCI spec 4.19.2). Otherwise, the port status change event for this
root port will not be generated anymore, then root port would look
like dead for user and can't be recovered until a Host Controller
Reset(HCRST).

This patch is to check CEC bit in PORTSC in xhci_get_port_status()
and set a Config Error in the return status if CEC is set. This will
cause a ClearPortFeature request, where CEC bit is cleared in
xhci_clear_port_change_bit().

[Mathias Nyman contributed the idea. The commit log is based on patch
posted at http://marc.info/?l=linux-kernel&m=142323612321434&w=2]

Signed-off-by: Lu Baolu 
Cc: stable  # v3.2+
---
  drivers/usb/host/xhci-hub.c | 9 -
  1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index a7865c4..0827d7c 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -387,6 +387,10 @@ static void xhci_clear_port_change_bit(struct xhci_hcd 
*xhci, u16 wValue,
status = PORT_PLC;
port_change_bit = "link state";
break;
+   case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
+   status = PORT_CEC;
+   port_change_bit = "config error";
+   break;
default:
/* Should never happen */
return;
@@ -588,6 +592,8 @@ static u32 xhci_get_port_status(struct usb_hcd *hcd,
status |= USB_PORT_STAT_C_LINK_STATE << 16;
if ((raw_port_status & PORT_WRC))
status |= USB_PORT_STAT_C_BH_RESET << 16;
+   if ((raw_port_status & PORT_CEC))
+   status |= USB_PORT_STAT_C_CONFIG_ERROR << 16;
}
  
  	if (hcd->speed != HCD_USB3) {

@@ -1005,6 +1011,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, 
u16 wValue,
case USB_PORT_FEAT_C_OVER_CURRENT:
case USB_PORT_FEAT_C_ENABLE:
case USB_PORT_FEAT_C_PORT_LINK_STATE:
+   case USB_PORT_FEAT_C_PORT_CONFIG_ERROR:
xhci_clear_port_change_bit(xhci, wValue, wIndex,
port_array[wIndex], temp);
break;
@@ -1069,7 +1076,7 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
 */
status = bus_state->resuming_ports;
  
-	mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC;

+   mask = PORT_CSC | PORT_PEC | PORT_OCC | PORT_PLC | PORT_WRC | PORT_CEC;
  
  	spin_lock_irqsave(&xhci->lock, flags);

/* For each port, did anything change?  If so, set that bit in buf. */


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


[GIT PULL] USB driver fixes for 4.0-rc3

2015-03-08 Thread Greg KH
The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

  Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git/ tags/usb-4.0-rc3

for you to fetch changes up to b8cb91e058cd0c0f02059c1207293c5b31d350fa:

  xhci: Workaround for PME stuck issues in Intel xhci (2015-03-06 09:47:48 
-0800)


USB fixes for 4.0-rc3

Here's a round of USB fixes for 4.0-rc3.

Nothing major, the usual gadget, xhci and usb-serial fixes and a few new
device ids as well.

All have been in linux-next successfully.

Signed-off-by: Greg Kroah-Hartman 


Alan Stern (1):
  USB: usbfs: don't leak kernel data in siginfo

Aleksander Morgado (1):
  xhci: fix reporting of 0-sized URBs in control endpoint

Andrzej Pietrasiewicz (1):
  usb: gadget: configfs: don't NUL-terminate (sub)compatible ids

Arnd Bergmann (1):
  usb: renesas: fix extcon dependency

Björn Gerhart (1):
  cdc-acm: Add support for Denso cradle CU-321

Felipe Balbi (2):
  usb: gadget: function: phonet: balance usb_ep_disable calls
  usb: musb: core: add pm_runtime_irq_safe()

George Cherian (2):
  usb: musb: musb_host: Enable HCD_BH flag to handle urb return in bottom 
half
  usb: dwc3: dwc3-omap: Fix disable IRQ

Greg Kroah-Hartman (2):
  Merge tag 'fixes-for-v4.0-rc2' of git://git.kernel.org/.../balbi/usb into 
usb-linus
  Merge tag 'usb-serial-4.0-rc3' of 
git://git.kernel.org/.../johan/usb-serial into usb-linus

Hans de Goede (1):
  uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539

Johan Hovold (8):
  Revert "USB: serial: make bulk_out_size a lower limit"
  USB: console: add dummy __module_get
  USB: serial: fix potential use-after-free after failed probe
  USB: serial: fix tty-device error handling at probe
  USB: serial: fix port attribute-creation race
  USB: serial: clean up bus probe error handling
  USB: mxuport: fix null deref when used as a console
  USB: pl2303: disable break on shutdown

Lad, Prabhakar (6):
  usb: gadget: function: f_hid: fix sparse warning
  usb: gadget: function: f_uac2: fix sparse warnings
  usb: gadget: function: f_sourcesink: fix sparse warning
  usb: gadget: function: uvc: fix sparse warnings
  usb: gadget: gadgetfs: fix sparse warnings
  usb: gadget: function: uvc_v4l2.c: fix sparse warnings

Mark Glover (1):
  USB: ftdi_sio: add PIDs for Actisense USB devices

Mathias Nyman (3):
  xhci: Allocate correct amount of scratchpad buffers
  xhci: Clear the host side toggle manually when endpoint is 'soft reset'
  xhci: Workaround for PME stuck issues in Intel xhci

Max Mansfield (1):
  usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards

Maxime Ripard (1):
  usb: XHCI: platform: Move the Marvell quirks after the enabling the clocks

Michiel vd Garde (1):
  USB: serial: cp210x: Adding Seletek device id's

Nicholas Mc Guire (1):
  usb: isp1760: use msecs_to_jiffies for time conversion

Nicolas PLANEL (1):
  USB: ch341: set tty baud speed according to tty struct

Oliver Neukum (1):
  usb-storage: support for more than 8 LUNs

Tony Lindgren (2):
  usb: musb: Fix use for of_property_read_bool for disabled multipoint
  usb: musb: Fix getting a generic phy for musb_dsps

 drivers/usb/class/cdc-acm.c|   2 +
 drivers/usb/core/devio.c   |   2 +
 drivers/usb/dwc3/dwc3-omap.c   |  30 -
 drivers/usb/gadget/configfs.c  |   2 -
 drivers/usb/gadget/function/f_hid.c|   2 +-
 drivers/usb/gadget/function/f_phonet.c |   5 +-
 drivers/usb/gadget/function/f_sourcesink.c |   4 +-
 drivers/usb/gadget/function/f_uac2.c   |  34 +-
 drivers/usb/gadget/function/uvc_v4l2.c |   1 +
 drivers/usb/gadget/function/uvc_video.c|   1 +
 drivers/usb/gadget/legacy/g_ffs.c  |   6 +-
 drivers/usb/host/xhci-pci.c|  30 +
 drivers/usb/host/xhci-plat.c   |  19 +++---
 drivers/usb/host/xhci-ring.c   |  12 +++-
 drivers/usb/host/xhci.c| 100 ++---
 drivers/usb/host/xhci.h|  11 +++-
 drivers/usb/isp1760/isp1760-hcd.c  |   6 +-
 drivers/usb/musb/musb_core.c   |  10 +--
 drivers/usb/musb/musb_dsps.c   |  32 -
 drivers/usb/musb/musb_host.c   |   2 +-
 drivers/usb/musb/omap2430.c|   7 +-
 drivers/usb/renesas_usbhs/Kconfig  |   1 +
 drivers/usb/serial/bus.c   |  45 ++---
 drivers/usb/serial/ch341.c |  15 ++---
 drivers/usb/serial/console.c   |   2 +
 drivers/usb/serial/cp210x.c|   2 +
 drivers/usb/serial/ftdi_sio.c  |  19 ++
 

Re: [PATCH 0/1] chipidea fix for v4.0-rc3

2015-03-08 Thread Greg KH
On Sun, Mar 08, 2015 at 04:05:00PM +0800, Peter Chen wrote:
> Hi Greg,
> 
> This patch fixes the problem that the OTG B device can't be enumerated on
> non-HNP port at OTG A device.
> 
> Li Jun (1):
>   usb: chipidea: otg: add a_alt_hnp_support response for B device
> 
>  drivers/usb/chipidea/udc.c | 11 +++
>  1 file changed, 11 insertions(+)

It just missed my last round of usb fixes to go to Linus, I'll queue it
up after these go to him.

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: xhci: handle Config Error Change (CEC) in xhci driver

2015-03-08 Thread Alan Stern
On Sun, 8 Mar 2015, Lu, Baolu wrote:

> Hi Alan,
> 
> Do you have any comments for this patch?

No comments.

Alan Stern

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


Re: [PATCH] usb gadget: remove size limitation for storage cdrom

2015-03-08 Thread Alan Stern
On Sun, 8 Mar 2015, Dave Young wrote:

> I used usb cdrom emulation to play video dvd for my daughter, but I got below
> error:
> 
> [dave@darkstar tmp]$ cat /mnt/sr1/VIDEO_TS/VTS_01_5.VOB >/dev/null
> cat: /mnt/sr1/VIDEO_TS/VTS_01_5.VOB: Input/output error
> [dave@darkstar tmp]$ dmesg|tail -1
> [ 3349.371857] sr1: rw=0, want=8028824, limit=4607996
> 
> The assumption of cdrom size is not right, we can create data dvd large then
> 4G, also mkisofs can create an iso with only one blank directory, the size is
> less than 300 sectors. The size limit does not make sense, thus remove them. 
> 
> Signed-off-by: Dave Young 
> ---
>  drivers/usb/gadget/function/storage_common.c |9 -
>  1 file changed, 9 deletions(-)
> 
> --- linux.orig/drivers/usb/gadget/function/storage_common.c
> +++ linux/drivers/usb/gadget/function/storage_common.c
> @@ -247,15 +247,6 @@ int fsg_lun_open(struct fsg_lun *curlun,
>  
>   num_sectors = size >> blkbits; /* File size in logic-block-size blocks 
> */
>   min_sectors = 1;
> - if (curlun->cdrom) {
> - min_sectors = 300;  /* Smallest track is 300 frames */
> - if (num_sectors >= 256*60*75) {
> - num_sectors = 256*60*75 - 1;
> - LINFO(curlun, "file too big: %s\n", filename);
> - LINFO(curlun, "using only first %d blocks\n",
> - (int) num_sectors);
> - }
> - }
>   if (num_sectors < min_sectors) {
>   LINFO(curlun, "file too small: %s\n", filename);
>   rc = -ETOOSMALL;

NAK.  This patch is wrong, for a very simple reason.  You wrote:

> I used usb cdrom emulation to play video dvd for my daughter

and this demonstrates the error quite plainly.  You can't use _CD_ 
emulation to imitate a _DVD_ -- they are different sorts of media.  
Just think of what happens when you try playing a DVD on a CD player.

A more suitable approach would be to add DVD emulation to the driver.

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


[PATCH] Fixed a typo

2015-03-08 Thread Mickael Maison
Fixed a typo in drivers/usb/phy/phy-ab8500-usb.c

Signed-off-by: Mickael Maison 
---
 drivers/usb/phy/phy-ab8500-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 0b1bd23..59cccfa 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -893,7 +893,7 @@ static int abx500_usb_link_status_update(struct ab8500_usb 
*ab)
 
 /*
  * Disconnection Sequence:
- *   1. Disconect Interrupt
+ *   1. Disconnect Interrupt
  *   2. Disable regulators
  *   3. Disable AB clock
  *   4. Disable the Phy
-- 
1.9.1

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


[PATCH] Fixed a typo

2015-03-08 Thread Mickael Maison
Fixed a typo in drivers/usb/phy/of.c

Signed-off-by: Mickael Maison 
---
 drivers/usb/phy/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c
index 7ea0154..66ffa82 100644
--- a/drivers/usb/phy/of.c
+++ b/drivers/usb/phy/of.c
@@ -27,7 +27,7 @@ static const char *const usbphy_modes[] = {
  * @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
+ * and returns the corresponding enum usb_phy_interface
  */
 enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
 {
-- 
1.9.1

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


Re: XHCI, "brain-dead scanner", and microframe rounding

2015-03-08 Thread Hans-Peter Jansen
On Dienstag, 24. Februar 2015 17:53:21 Hans-Peter Jansen wrote:
> On Dienstag, 24. Februar 2015 17:53:25 Mathias Nyman wrote:
> > On 24.02.2015 12:41, Hans-Peter Jansen wrote:
> > > Also 3.19-stable is still dangling..
> > 
> > Just sent it to Greg, with stable CC tags.
> 
> Thanks a lot, will test through 3.19 stable, when it is released.

FYI: still missing in 3.19.1, released yesterday..!

Pete

--
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: gadgetfs broken since 7f7f25e8

2015-03-08 Thread Al Viro
On Sat, Mar 07, 2015 at 04:08:49PM -0500, Alan Stern wrote:
> On Sat, 7 Mar 2015, Alexander Holler wrote:
> 
> > Am 07.03.2015 um 12:23 schrieb Alexander Holler:
> > > Am 04.03.2015 um 16:31 schrieb Alan Stern:
> > > 
> > >> check to see what those values actually were.  It's easy enough to fix
> > >> up, though; revised patch below.
> > > 
> > > Thanks, in contrast to the patch from Al Viro that one applies.
> > 
> > And as I've just tested it, it isn't complete. ep_config_operations will
> > be switched to ep_io_operations and suffers under the same problem of
> > not having initially (aio_)read/(aio_)write since commit  7f7f25e8 (3.16).
> 
> Of course.  I stated in the email accompanying the original version of
> this patch that it contained some corrections that Al's patch left out.  
> You have to use the two of them together to fix all the issues.

FWIW, I've pushed those two fixes in vfs.git#gadget; could I have your
s-o-b on the ep0 part?  See 2b13438 in vfs.git...
--
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: gadgetfs broken since 7f7f25e8

2015-03-08 Thread Alan Stern
On Sun, 8 Mar 2015, Al Viro wrote:

> On Sat, Mar 07, 2015 at 04:08:49PM -0500, Alan Stern wrote:
> > On Sat, 7 Mar 2015, Alexander Holler wrote:
> > 
> > > Am 07.03.2015 um 12:23 schrieb Alexander Holler:
> > > > Am 04.03.2015 um 16:31 schrieb Alan Stern:
> > > > 
> > > >> check to see what those values actually were.  It's easy enough to fix
> > > >> up, though; revised patch below.
> > > > 
> > > > Thanks, in contrast to the patch from Al Viro that one applies.
> > > 
> > > And as I've just tested it, it isn't complete. ep_config_operations will
> > > be switched to ep_io_operations and suffers under the same problem of
> > > not having initially (aio_)read/(aio_)write since commit  7f7f25e8 (3.16).
> > 
> > Of course.  I stated in the email accompanying the original version of
> > this patch that it contained some corrections that Al's patch left out.  
> > You have to use the two of them together to fix all the issues.
> 
> FWIW, I've pushed those two fixes in vfs.git#gadget; could I have your
> s-o-b on the ep0 part?  See 2b13438 in vfs.git...

Certainly.

Signed-off-by: Alan Stern 

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] Fixed a typo

2015-03-08 Thread Greg KH
On Sun, Mar 08, 2015 at 04:58:51PM +, Mickael Maison wrote:
> Fixed a typo in drivers/usb/phy/phy-ab8500-usb.c

Please put the subsystem in the subject: otherwise we have no idea what
part of the kernel you are referring to.  So for this patch the subject
should look like:
Subject: [PATCH] USB: phy: ab8500: fix comment typo


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] Fixed a typo

2015-03-08 Thread Greg KH
On Sun, Mar 08, 2015 at 05:08:22PM +, Mickael Maison wrote:
> Fixed a typo in drivers/usb/phy/of.c
> 
> Signed-off-by: Mickael Maison 
> ---
>  drivers/usb/phy/of.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Same here for the subject:
--
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: gadgetfs broken since 7f7f25e8

2015-03-08 Thread Al Viro
On Sun, Mar 08, 2015 at 02:35:25PM -0400, Alan Stern wrote:

> > FWIW, I've pushed those two fixes in vfs.git#gadget; could I have your
> > s-o-b on the ep0 part?  See 2b13438 in vfs.git...
> 
> Certainly.
> 
> Signed-off-by: Alan Stern 

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


[PATCH] USB: phy: ab8500: Fixed comment typo

2015-03-08 Thread Mickael Maison
Fixed a comment typo in drivers/usb/phy/phy-ab8500-usb.c

Signed-off-by: Mickael Maison 
---
 drivers/usb/phy/phy-ab8500-usb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/phy-ab8500-usb.c b/drivers/usb/phy/phy-ab8500-usb.c
index 0b1bd23..59cccfa 100644
--- a/drivers/usb/phy/phy-ab8500-usb.c
+++ b/drivers/usb/phy/phy-ab8500-usb.c
@@ -893,7 +893,7 @@ static int abx500_usb_link_status_update(struct ab8500_usb 
*ab)
 
 /*
  * Disconnection Sequence:
- *   1. Disconect Interrupt
+ *   1. Disconnect Interrupt
  *   2. Disable regulators
  *   3. Disable AB clock
  *   4. Disable the Phy
-- 
1.9.1

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


[PATCH] USB: phy: Fixed comment typo

2015-03-08 Thread Mickael Maison
Fixed a comment typo in drivers/usb/phy/of.c

Signed-off-by: Mickael Maison 
---
 drivers/usb/phy/of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/phy/of.c b/drivers/usb/phy/of.c
index 7ea0154..66ffa82 100644
--- a/drivers/usb/phy/of.c
+++ b/drivers/usb/phy/of.c
@@ -27,7 +27,7 @@ static const char *const usbphy_modes[] = {
  * @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
+ * and returns the corresponding enum usb_phy_interface
  */
 enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
 {
-- 
1.9.1

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


[PATCH 1/7] usb: gadget: add host_requestf_flag in usb_gadget for OTG HNP

2015-03-08 Thread Li Jun
From: Li Jun 

Adds host_request_flag for gadget to store host request information from 
application, which can be used to response to HNP polling from host.

Signed-off-by: Li Jun 
---
 include/linux/usb/gadget.h |1 +
 1 file changed, 1 insertion(+)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index e2f00fd..5508c48 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -563,6 +563,7 @@ struct usb_gadget {
unsignedb_hnp_enable:1;
unsigneda_hnp_support:1;
unsigneda_alt_hnp_support:1;
+   unsignedhost_request_flag:1;
unsignedquirk_ep_out_aligned_size:1;
unsignedis_selfpowered:1;
 };
-- 
1.7.9.5

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


[PATCH 2/7] usb: common: otg-fsm: start HNP polling timer in host state

2015-03-08 Thread Li Jun
From: Li Jun 

Adds OTG HNP polling timer when otg fsm moves to host state.

Signed-off-by: Li Jun 
---
 drivers/usb/common/usb-otg-fsm.c |2 ++
 include/linux/usb/otg-fsm.h  |1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 61d538a..862eb04 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -169,6 +169,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum 
usb_otg_state new_state)
otg_set_protocol(fsm, PROTO_HOST);
usb_bus_start_enum(fsm->otg->host,
fsm->otg->host->otg_port);
+   otg_add_timer(fsm, HNP_POLLING);
break;
case OTG_STATE_A_IDLE:
otg_drv_vbus(fsm, 0);
@@ -203,6 +204,7 @@ static int otg_set_state(struct otg_fsm *fsm, enum 
usb_otg_state new_state)
 */
if (!fsm->a_bus_req || fsm->a_suspend_req_inf)
otg_add_timer(fsm, A_WAIT_ENUM);
+   otg_add_timer(fsm, HNP_POLLING);
break;
case OTG_STATE_A_SUSPEND:
otg_drv_vbus(fsm, 1);
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index f728f18..d1b3415 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -55,6 +55,7 @@ enum otg_fsm_timer {
A_WAIT_ENUM,
B_DATA_PLS,
B_SSEND_SRP,
+   HNP_POLLING,
 
NUM_OTG_FSM_TIMERS,
 };
-- 
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 6/7] usb: common: otg-fsm: clear host_request_flag when leaves peripheral state

2015-03-08 Thread Li Jun
From: Li Jun 

Cleare the flag after try to do role switch, no matter the role switch succeeds
or not.

Signed-off-by: Li Jun 
---
 drivers/usb/common/usb-otg-fsm.c |4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 1cd8995..e677b1e 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -78,6 +78,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum 
usb_otg_state old_state)
fsm->b_srp_done = 0;
break;
case OTG_STATE_B_PERIPHERAL:
+   if (fsm->otg->gadget)
+   fsm->otg->gadget->host_request_flag = 0;
break;
case OTG_STATE_B_WAIT_ACON:
otg_del_timer(fsm, B_ASE0_BRST);
@@ -107,6 +109,8 @@ static void otg_leave_state(struct otg_fsm *fsm, enum 
usb_otg_state old_state)
case OTG_STATE_A_PERIPHERAL:
otg_del_timer(fsm, A_BIDL_ADIS);
fsm->a_bidl_adis_tmout = 0;
+   if (fsm->otg->gadget)
+   fsm->otg->gadget->host_request_flag = 0;
break;
case OTG_STATE_A_WAIT_VFALL:
otg_del_timer(fsm, A_WAIT_VFALL);
-- 
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 5/7] usb: chipidea: otg_fsm: add HNP polling support

2015-03-08 Thread Li Jun
From: Li Jun 

Add a dedicataed normal timer for HNP polling since it's cyclical, while
in peripheral mode, change a/b_bus_req to be 1 will make it response
to host request flag with 1, then role switch will be started.

Signed-off-by: Li Jun 
---
 drivers/usb/chipidea/ci.h  |4 
 drivers/usb/chipidea/otg_fsm.c |   49 +---
 drivers/usb/chipidea/otg_fsm.h |2 ++
 3 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index aeec5f0..3192a44 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -166,6 +166,8 @@ struct hw_bank {
  * @hr_timeouts: time out list for active otg fsm timers
  * @enabled_otg_timer_bits: bits of enabled otg timers
  * @next_otg_timer: next nearest enabled timer to be expired
+ * @hnp_polling_timer: cyclical timer for hnp polling
+ * @hnp_polling_req: indicates there is hnp polling request
  * @work: work for role changing
  * @wq: workqueue thread
  * @qh_pool: allocation pool for queue heads
@@ -212,6 +214,8 @@ struct ci_hdrc {
ktime_t hr_timeouts[NUM_OTG_FSM_TIMERS];
unsignedenabled_otg_timer_bits;
enum otg_fsm_timer  next_otg_timer;
+   struct timer_list   hnp_polling_timer;
+   boolhnp_polling_req;
struct work_struct  work;
struct workqueue_struct *wq;
 
diff --git a/drivers/usb/chipidea/otg_fsm.c b/drivers/usb/chipidea/otg_fsm.c
index 083acf4..ed79ae7 100644
--- a/drivers/usb/chipidea/otg_fsm.c
+++ b/drivers/usb/chipidea/otg_fsm.c
@@ -66,6 +66,11 @@ set_a_bus_req(struct device *dev, struct device_attribute 
*attr,
return count;
}
ci->fsm.a_bus_req = 1;
+   if (ci->fsm.otg->state == OTG_STATE_A_PERIPHERAL) {
+   ci->gadget.host_request_flag = 1;
+   mutex_unlock(&ci->fsm.lock);
+   return count;
+   }
}
 
ci_otg_queue_work(ci);
@@ -144,8 +149,14 @@ set_b_bus_req(struct device *dev, struct device_attribute 
*attr,
mutex_lock(&ci->fsm.lock);
if (buf[0] == '0')
ci->fsm.b_bus_req = 0;
-   else if (buf[0] == '1')
+   else if (buf[0] == '1') {
ci->fsm.b_bus_req = 1;
+   if (ci->fsm.otg->state == OTG_STATE_B_PERIPHERAL) {
+   ci->gadget.host_request_flag = 1;
+   mutex_unlock(&ci->fsm.lock);
+   return count;
+   }
+   }
 
ci_otg_queue_work(ci);
mutex_unlock(&ci->fsm.lock);
@@ -203,6 +214,7 @@ static unsigned otg_timer_ms[] = {
0,
TB_DATA_PLS,
TB_SSEND_SRP,
+   0,
 };
 
 /*
@@ -358,6 +370,7 @@ static int (*otg_timer_handlers[])(struct ci_hdrc *) = {
NULL,   /* A_WAIT_ENUM */
b_data_pls_tmout,   /* B_DATA_PLS */
b_ssend_srp_tmout,  /* B_SSEND_SRP */
+   NULL,   /* HNP_POLLING */
 };
 
 /*
@@ -404,15 +417,32 @@ static enum hrtimer_restart ci_otg_hrtimer_func(struct 
hrtimer *t)
return HRTIMER_NORESTART;
 }
 
+static void hnp_polling_timer_work(unsigned long arg)
+{
+   struct ci_hdrc *ci = (struct ci_hdrc *)arg;
+
+   ci->hnp_polling_req = true;
+   ci_otg_queue_work(ci);
+}
+
 /* Initialize timers */
 static int ci_otg_init_timers(struct ci_hdrc *ci)
 {
hrtimer_init(&ci->otg_fsm_hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
ci->otg_fsm_hrtimer.function = ci_otg_hrtimer_func;
 
+   setup_timer(&ci->hnp_polling_timer, hnp_polling_timer_work,
+   (unsigned long)ci);
+
return 0;
 }
 
+static void ci_otg_add_hnp_polling_timer(struct ci_hdrc *ci)
+{
+   mod_timer(&ci->hnp_polling_timer,
+   jiffies + msecs_to_jiffies(T_HOST_REQ_POLL));
+}
+
 /* -*/
 /* Operations that will be called from OTG Finite State Machine */
 /* -*/
@@ -420,8 +450,12 @@ static void ci_otg_fsm_add_timer(struct otg_fsm *fsm, enum 
otg_fsm_timer t)
 {
struct ci_hdrc  *ci = container_of(fsm, struct ci_hdrc, fsm);
 
-   if (t < NUM_OTG_FSM_TIMERS)
-   ci_otg_add_timer(ci, t);
+   if (t < NUM_OTG_FSM_TIMERS) {
+   if (t == HNP_POLLING)
+   ci_otg_add_hnp_polling_timer(ci);
+   else
+   ci_otg_add_timer(ci, t);
+   }
return;
 }
 
@@ -569,6 +603,14 @@ int ci_otg_fsm_work(struct ci_hdrc *ci)
return 0;
 
pm_runtime_get_sync(ci->dev);
+   if (ci->hnp_polling_req) {
+   ci->hnp_polling_req = false;
+   if (otg_hnp_polling(&ci->fsm) != HOST_R

[PATCH 4/7] usb: chipidea: udc: add OTG status request handling

2015-03-08 Thread Li Jun
From: Li Jun 

Peripheral answers OTG status selector request from host according to
host_request_flag of gadget, length is 1.

Signed-off-by: Li Jun 
---
 drivers/usb/chipidea/udc.c |   28 +++-
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index 4254792..eed66bc 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -831,7 +831,17 @@ __acquires(hwep->lock)
return -ENOMEM;
 
req->complete = isr_get_status_complete;
-   req->length   = 2;
+   if (setup->wIndex == OTG_STS_SELECTOR) {
+   if (ci_otg_is_fsm_mode(ci)) {
+   req->length = 1;
+   } else {
+   retval = -ENOTSUPP;
+   goto err_free_req;
+   }
+   } else {
+   req->length = 2;
+   }
+
req->buf  = kzalloc(req->length, gfp_flags);
if (req->buf == NULL) {
retval = -ENOMEM;
@@ -839,8 +849,15 @@ __acquires(hwep->lock)
}
 
if ((setup->bRequestType & USB_RECIP_MASK) == USB_RECIP_DEVICE) {
-   *(u16 *)req->buf = (ci->remote_wakeup << 1) |
-   ci->gadget.is_selfpowered;
+   if (setup->wIndex == OTG_STS_SELECTOR) {
+   if (ci->gadget.host_request_flag)
+   *(u8 *)req->buf = HOST_REQUEST_FLAG;
+   else
+   *(u8 *)req->buf = 0;
+   } else {
+   *(u16 *)req->buf = (ci->remote_wakeup << 1) |
+   ci->gadget.is_selfpowered;
+   }
} else if ((setup->bRequestType & USB_RECIP_MASK) \
   == USB_RECIP_ENDPOINT) {
dir = (le16_to_cpu(setup->wIndex) & USB_ENDPOINT_DIR_MASK) ?
@@ -1018,8 +1035,9 @@ __acquires(ci->lock)
type != (USB_DIR_IN|USB_RECIP_ENDPOINT) &&
type != (USB_DIR_IN|USB_RECIP_INTERFACE))
goto delegate;
-   if (le16_to_cpu(req.wLength) != 2 ||
-   le16_to_cpu(req.wValue)  != 0)
+   if ((le16_to_cpu(req.wLength) != 2 &&
+   le16_to_cpu(req.wLength) != 1) ||
+   le16_to_cpu(req.wValue) != 0)
break;
err = isr_get_status_response(ci, &req);
break;
-- 
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 0/7] add HNP polling support for chipidea usb otg fsm driver

2015-03-08 Thread Li Jun
HNP polling is a mechanism which allows the OTG device currently acting as host
to determine when the other attached OTG device wishes to take the host role.
When an OTG host, which supports HNP, is connected to an OTG peripheral which
also supports HNP it shall poll the peripheral regularly to determine whether
it requires a role-swap and grant this at the earliest opportunity.

Li Jun (7):
  usb: gadget: add host_requestf_flag in usb_gadget for OTG HNP
  usb: common: otg-fsm: start HNP polling timer in host state
  usb: common: otg-fsm: add HNP polling implememtation
  usb: chipidea: udc: add OTG status request handling
  usb: chipidea: otg_fsm: add HNP polling support
  usb: common: otg-fsm: clear host_request_flag when leaves peripheral
state
  Documentation: usb: chipidea: Update test procedure for HNP polling

 Documentation/usb/chipidea.txt   |9 ++---
 drivers/usb/chipidea/ci.h|4 ++
 drivers/usb/chipidea/otg_fsm.c   |   49 +--
 drivers/usb/chipidea/otg_fsm.h   |2 +
 drivers/usb/chipidea/udc.c   |   28 ++---
 drivers/usb/common/usb-otg-fsm.c |   81 ++
 include/linux/usb/gadget.h   |1 +
 include/linux/usb/otg-fsm.h  |   11 ++
 8 files changed, 172 insertions(+), 13 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 7/7] Documentation: usb: chipidea: Update test procedure for HNP polling

2015-03-08 Thread Li Jun
From: Li Jun 

Update HNP test procedure as HNP polling is supported.

Signed-off-by: Li Jun 
---
 Documentation/usb/chipidea.txt |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Documentation/usb/chipidea.txt b/Documentation/usb/chipidea.txt
index 3f848c1..95d9170 100644
--- a/Documentation/usb/chipidea.txt
+++ b/Documentation/usb/chipidea.txt
@@ -26,14 +26,13 @@ cat /sys/kernel/debug/ci_hdrc.0/registers
On B-device:
echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
 
-   if HNP polling is not supported, also need:
-   On A-device:
-   echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
-
B-device should take host role and enumrate A-device.
 
 4) A-device switch back to host.
-   On B-device:
+   On A-device:
+   echo 1 > /sys/bus/platform/devices/ci_hdrc.0/inputs/a_bus_req
+
+   or, on B-device:
echo 0 > /sys/bus/platform/devices/ci_hdrc.0/inputs/b_bus_req
 
A-device should switch back to host and enumrate B-device.
-- 
1.7.9.5

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


[PATCH 3/7] usb: common: otg-fsm: add HNP polling implememtation

2015-03-08 Thread Li Jun
From: Li Jun 

OTG in host mode call this function to poll peripheral if it wants to be host
role.

Signed-off-by: Li Jun 
---
 drivers/usb/common/usb-otg-fsm.c |   75 ++
 include/linux/usb/otg-fsm.h  |   10 +
 2 files changed, 85 insertions(+)

diff --git a/drivers/usb/common/usb-otg-fsm.c b/drivers/usb/common/usb-otg-fsm.c
index 862eb04..1cd8995 100644
--- a/drivers/usb/common/usb-otg-fsm.c
+++ b/drivers/usb/common/usb-otg-fsm.c
@@ -367,3 +367,78 @@ int otg_statemachine(struct otg_fsm *fsm)
return state_changed;
 }
 EXPORT_SYMBOL_GPL(otg_statemachine);
+
+/*
+ * Called by host to poll if peripheral wants to be host
+ * Return value:
+ * - host request flag(1) if the device wants to be host;
+ * - host request flag(0) if the device keeps peripheral role;
+ * - otherwise, error code.
+ */
+int otg_hnp_polling(struct otg_fsm *fsm)
+{
+   struct usb_device *udev;
+   u8 host_req_flag;
+   int retval;
+   enum usb_otg_state state = fsm->otg->state;
+
+   if (state != OTG_STATE_A_HOST && state != OTG_STATE_B_HOST)
+   return -EINVAL;
+
+   udev = usb_hub_find_child(fsm->otg->host->root_hub, 1);
+   if (!udev) {
+   dev_err(fsm->otg->host->controller,
+   "no usb dev connected, can't start HNP polling\n");
+   return -ENODEV;
+   }
+
+   /* Get host request flag from connected USB device */
+   retval = usb_control_msg(udev,
+   usb_rcvctrlpipe(udev, 0),
+   USB_REQ_GET_STATUS,
+   USB_DIR_IN | USB_RECIP_DEVICE,
+   0,
+   OTG_STS_SELECTOR,
+   &host_req_flag,
+   1,
+   USB_CTRL_GET_TIMEOUT);
+   if (retval != 1) {
+   dev_err(&udev->dev, "Get one byte OTG status failed\n");
+   return -EIO;
+   }
+
+   if (host_req_flag == 0) {
+   /* Continue HNP polling */
+   otg_add_timer(fsm, HNP_POLLING);
+   return 0;
+   } else if (host_req_flag != HOST_REQUEST_FLAG) {
+   dev_err(&udev->dev, "host request flag is invalid\n");
+   return -EINVAL;
+   }
+
+   /* Host request flag is set */
+   if (state == OTG_STATE_A_HOST) {
+   /* Set b_hnp_enable */
+   if (!fsm->otg->host->b_hnp_enable) {
+   retval = usb_control_msg(udev,
+   usb_sndctrlpipe(udev, 0),
+   USB_REQ_SET_FEATURE, 0,
+   USB_DEVICE_B_HNP_ENABLE,
+   0, NULL, 0,
+   USB_CTRL_SET_TIMEOUT);
+   if (retval < 0) {
+   dev_err(&udev->dev,
+   "can't enable HNP %d\n", retval);
+   return -EINVAL;
+   }
+   fsm->otg->host->b_hnp_enable = 1;
+   }
+
+   fsm->a_bus_req = 0;
+   } else if (state == OTG_STATE_B_HOST) {
+   fsm->b_bus_req = 0;
+   }
+
+   return HOST_REQUEST_FLAG;
+}
+EXPORT_SYMBOL_GPL(otg_hnp_polling);
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
index d1b3415..562f35b 100644
--- a/include/linux/usb/otg-fsm.h
+++ b/include/linux/usb/otg-fsm.h
@@ -40,6 +40,15 @@
 #define PROTO_HOST (1)
 #define PROTO_GADGET   (2)
 
+#define OTG_STS_SELECTOR   0xF000  /* OTG status selector, according to
+* OTG and EH 2.0 Charpter 6.2.3
+* Table:6-4
+*/
+#define HOST_REQUEST_FLAG  1   /* Host request flag, according to
+* OTG and EH 2.0 Charpter 6.2.3
+* Table:6-5
+*/
+
 enum otg_fsm_timer {
/* Standard OTG timers */
A_WAIT_VRISE,
@@ -243,5 +252,6 @@ static inline int otg_start_gadget(struct otg_fsm *fsm, int 
on)
 }
 
 int otg_statemachine(struct otg_fsm *fsm);
+int otg_hnp_polling(struct otg_fsm *fsm);
 
 #endif /* __LINUX_USB_OTG_FSM_H */
-- 
1.7.9.5

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


Re: [PATCH] usb gadget: remove size limitation for storage cdrom

2015-03-08 Thread Dave Young
On 03/08/15 at 11:29am, Alan Stern wrote:
> On Sun, 8 Mar 2015, Dave Young wrote:
> 
> > I used usb cdrom emulation to play video dvd for my daughter, but I got 
> > below
> > error:
> > 
> > [dave@darkstar tmp]$ cat /mnt/sr1/VIDEO_TS/VTS_01_5.VOB >/dev/null
> > cat: /mnt/sr1/VIDEO_TS/VTS_01_5.VOB: Input/output error
> > [dave@darkstar tmp]$ dmesg|tail -1
> > [ 3349.371857] sr1: rw=0, want=8028824, limit=4607996
> > 
> > The assumption of cdrom size is not right, we can create data dvd large then
> > 4G, also mkisofs can create an iso with only one blank directory, the size 
> > is
> > less than 300 sectors. The size limit does not make sense, thus remove 
> > them. 
> > 
> > Signed-off-by: Dave Young 
> > ---
> >  drivers/usb/gadget/function/storage_common.c |9 -
> >  1 file changed, 9 deletions(-)
> > 
> > --- linux.orig/drivers/usb/gadget/function/storage_common.c
> > +++ linux/drivers/usb/gadget/function/storage_common.c
> > @@ -247,15 +247,6 @@ int fsg_lun_open(struct fsg_lun *curlun,
> >  
> > num_sectors = size >> blkbits; /* File size in logic-block-size blocks 
> > */
> > min_sectors = 1;
> > -   if (curlun->cdrom) {
> > -   min_sectors = 300;  /* Smallest track is 300 frames */
> > -   if (num_sectors >= 256*60*75) {
> > -   num_sectors = 256*60*75 - 1;
> > -   LINFO(curlun, "file too big: %s\n", filename);
> > -   LINFO(curlun, "using only first %d blocks\n",
> > -   (int) num_sectors);
> > -   }
> > -   }
> > if (num_sectors < min_sectors) {
> > LINFO(curlun, "file too small: %s\n", filename);
> > rc = -ETOOSMALL;
> 
> NAK.  This patch is wrong, for a very simple reason.  You wrote:
> 
> > I used usb cdrom emulation to play video dvd for my daughter
> 
> and this demonstrates the error quite plainly.  You can't use _CD_ 
> emulation to imitate a _DVD_ -- they are different sorts of media.  
> Just think of what happens when you try playing a DVD on a CD player.
> 
> A more suitable approach would be to add DVD emulation to the driver.
> 

They are both iso9660 images, aren't they? So from data image point
of view there's no difference, it is not worth to create another mode
for dvd data.

We should not emulate cd drive to support different cd media type,
it is far more better to support just iso9660 volume no matter how
large the size is as long as it is fit for iso9660 spec.

OTOH, the size limitation is a bug:
* isofs can be less than 300 sectors, the 300 sectors limitation is for
music cd I think. Try mkisofs a blank directory and burn it.

* There's 99 minutes dics even for cdrom, see:
http://en.wikipedia.org/wiki/CD-R 
If we code to support different size discs, it will looks like a wrong way.

Thanks
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: [PATCH 1/7] usb: gadget: add host_requestf_flag in usb_gadget for OTG HNP

2015-03-08 Thread Peter Chen
On Mon, Mar 09, 2015 at 10:09:17AM +0800, Li Jun wrote:
> From: Li Jun 
> 
> Adds host_request_flag for gadget to store host request information from 
> application, which can be used to response to HNP polling from host.
> 
> Signed-off-by: Li Jun 
> ---
>  include/linux/usb/gadget.h |1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
> index e2f00fd..5508c48 100644
> --- a/include/linux/usb/gadget.h
> +++ b/include/linux/usb/gadget.h
> @@ -563,6 +563,7 @@ struct usb_gadget {
>   unsignedb_hnp_enable:1;
>   unsigneda_hnp_support:1;
>   unsigneda_alt_hnp_support:1;
> + unsignedhost_request_flag:1;
>   unsignedquirk_ep_out_aligned_size:1;
>   unsignedis_selfpowered:1;
>  };
> -- 
> 1.7.9.5
> 

Add kernel-doc too.

-- 

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