[PATCH 0/2] USB: serial: fixes for v3.13-rc2

2013-11-09 Thread Johan Hovold
Here are two bug fixes for v3.13. The first one fixes a long-standing,
non-critical, race in the generic write implementation. The second fixes
a recent regression due to the wrong memory allocation flag being used
in write(), something which for example triggers a BUG (sleep in
invalid context) when using a usb-serial console.

Johan

Johan Hovold (2):
  USB: serial: fix race in generic write
  USB: serial: fix write memory-allocation flag

 drivers/usb/serial/generic.c | 12 ++--
 1 file changed, 2 insertions(+), 10 deletions(-)

-- 
1.8.4.2

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


[PATCH 1/2] USB: serial: fix race in generic write

2013-11-09 Thread Johan Hovold
Fix race in generic write implementation, which could lead to
temporarily degraded throughput.

The current generic write implementation introduced by commit
27c7acf22047 ("USB: serial: reimplement generic fifo-based writes") has
always had this bug, although it's fairly hard to trigger and the
consequences are not likely to be noticed.

Specifically, a write() on one CPU while the completion handler is
running on another could result in only one of the two write urbs being
utilised to empty the remainder of the write fifo (unless there is a
second write() that doesn't race during that time).

Cc: sta...@vger.kernel.org
Signed-off-by: Johan Hovold 
---
 drivers/usb/serial/generic.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 2b01ec8651c2..e36b25a2fa02 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -173,16 +173,8 @@ retry:
clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
return result;
}
-   /*
-* Try sending off another urb, unless called from completion handler
-* (in which case there will be no free urb or no data).
-*/
-   if (mem_flags != GFP_ATOMIC)
-   goto retry;
 
-   clear_bit_unlock(USB_SERIAL_WRITE_BUSY, &port->flags);
-
-   return 0;
+   goto retry; /* try sending off another urb */
 }
 EXPORT_SYMBOL_GPL(usb_serial_generic_write_start);
 
-- 
1.8.4.2

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


[PATCH 2/2] USB: serial: fix write memory-allocation flag

2013-11-09 Thread Johan Hovold
Fix regression introduced by commit 818f60365a29 ("USB: serial: add
memory flags to usb_serial_generic_write_start"), which incorrectly used
GFP_KERNEL in write(), which must not not sleep.

Reported-by: Dave Jones 
Tested-by: Dave Jones 
Cc: Dave Jones 
Signed-off-by: Johan Hovold 
---
 drivers/usb/serial/generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index e36b25a2fa02..b63ce023f96f 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -200,7 +200,7 @@ int usb_serial_generic_write(struct tty_struct *tty,
return 0;
 
count = kfifo_in_locked(&port->write_fifo, buf, count, &port->lock);
-   result = usb_serial_generic_write_start(port, GFP_KERNEL);
+   result = usb_serial_generic_write_start(port, GFP_ATOMIC);
if (result)
return result;
 
-- 
1.8.4.2

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


Re: [PATCH] USB: mos7840: correct handling of CS5 setting

2013-11-09 Thread Johan Hovold
On Fri, Nov 08, 2013 at 10:52:34PM +0100, Colin Leitner wrote:
> This patch removes an erroneous check of CSIZE, which made it impossible to 
> set
> CS5.
> 
> Compiles clean, but couldn't test against hardware.

The patch is obviously correct, but I've verified that CS5 actually
works using a MCS7820 as well.

> Signed-off-by: Colin Leitner 

Tested-by: Johan Hovold 
Cc: sta...@vger.kernel.org
Signed-off-by: Johan Hovold 

Thanks,
Johan

> ---
>  drivers/usb/serial/mos7840.c |   32 
>  1 file changed, 16 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
> index e5bdd98..a69da83 100644
> --- a/drivers/usb/serial/mos7840.c
> +++ b/drivers/usb/serial/mos7840.c
> @@ -1813,25 +1813,25 @@ static void mos7840_change_port_settings(struct 
> tty_struct *tty,
>   iflag = tty->termios.c_iflag;
> 
>   /* Change the number of bits */
> - if (cflag & CSIZE) {
> - switch (cflag & CSIZE) {
> - case CS5:
> - lData = LCR_BITS_5;
> - break;
> + switch (cflag & CSIZE) {
> + case CS5:
> + lData = LCR_BITS_5;
> + break;
> 
> - case CS6:
> - lData = LCR_BITS_6;
> - break;
> + case CS6:
> + lData = LCR_BITS_6;
> + break;
> 
> - case CS7:
> - lData = LCR_BITS_7;
> - break;
> - default:
> - case CS8:
> - lData = LCR_BITS_8;
> - break;
> - }
> + case CS7:
> + lData = LCR_BITS_7;
> + break;
> +
> + default:
> + case CS8:
> + lData = LCR_BITS_8;
> + break;
>   }
> +
>   /* Change the Parity bit */
>   if (cflag & PARENB) {
>   if (cflag & PARODD) {
> -- 
> 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] USB: spcp8x5: correct handling of CS5 setting

2013-11-09 Thread Johan Hovold
On Fri, Nov 08, 2013 at 10:53:11PM +0100, Colin Leitner wrote:
> This patch removes an erroneous check of CSIZE, which made it impossible to 
> set
> CS5.
> 
> Compiles clean, but couldn't test against hardware.
> 
> Signed-off-by: Colin Leitner 

Cc: sta...@vger.kernel.org
Signed-off-by: Johan Hovold 

> ---
>  drivers/usb/serial/spcp8x5.c |   30 ++
>  1 file changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/usb/serial/spcp8x5.c b/drivers/usb/serial/spcp8x5.c
> index 4abac28..5b793c3 100644
> --- a/drivers/usb/serial/spcp8x5.c
> +++ b/drivers/usb/serial/spcp8x5.c
> @@ -348,22 +348,20 @@ static void spcp8x5_set_termios(struct tty_struct *tty,
>   }
> 
>   /* Set Data Length : 00:5bit, 01:6bit, 10:7bit, 11:8bit */
> - if (cflag & CSIZE) {
> - switch (cflag & CSIZE) {
> - case CS5:
> - buf[1] |= SET_UART_FORMAT_SIZE_5;
> - break;
> - case CS6:
> - buf[1] |= SET_UART_FORMAT_SIZE_6;
> - break;
> - case CS7:
> - buf[1] |= SET_UART_FORMAT_SIZE_7;
> - break;
> - default:
> - case CS8:
> - buf[1] |= SET_UART_FORMAT_SIZE_8;
> - break;
> - }
> + switch (cflag & CSIZE) {
> + case CS5:
> + buf[1] |= SET_UART_FORMAT_SIZE_5;
> + break;
> + case CS6:
> + buf[1] |= SET_UART_FORMAT_SIZE_6;
> + break;
> + case CS7:
> + buf[1] |= SET_UART_FORMAT_SIZE_7;
> + break;
> + default:
> + case CS8:
> + buf[1] |= SET_UART_FORMAT_SIZE_8;
> + break;
>   }
> 
>   /* Set Stop bit2 : 0:1bit 1:2bit */
> -- 
> 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: [PATCHv2] USB: serial: option: blacklist intf1 for Huawei E173s-6

2013-11-09 Thread Johan Hovold
On Fri, Nov 08, 2013 at 08:44:35AM +0100, Bjørn Mork wrote:
> Johan Hovold  writes:
> 
> > Bjørn, do you want any more info for the commit message (e.g. interface
> > layout)?
> 
> I believe it's nice to document the layout of complex composite devices
> if known, but if not then I don't see any need to delay a patch like
> this.

Ok. Thanks.

Gustavo, could you fix up the commit message (the subject line) and
resend so we can apply this?

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


Re: [PATCH 09/12] usb: gadget: r8a66597-udc: Convert to clk_prepare/unprepare

2013-11-09 Thread Laurent Pinchart
Hi Felipe,

On Tuesday 29 October 2013 18:47:19 Shimoda, Yoshihiro wrote:
> Hi Laurent-san,
> 
> (2013/10/29 7:49), Laurent Pinchart wrote:
> > Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
> > clk_disable_unprepare() to get ready for the migration to the common
> > clock framework.
> > 
> > Cc: Felipe Balbi 
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Laurent Pinchart
> > 
> 
> Thank you for the patch.
> 
> Acked-by: Yoshihiro Shimoda 

Could you please pick this patch up ?

> > ---
> > 
> >  drivers/usb/gadget/r8a66597-udc.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/r8a66597-udc.c
> > b/drivers/usb/gadget/r8a66597-udc.c index 68be48d..4728751 100644
> > --- a/drivers/usb/gadget/r8a66597-udc.c
> > +++ b/drivers/usb/gadget/r8a66597-udc.c
> > @@ -1833,7 +1833,7 @@ static int __exit r8a66597_remove(struct
> > platform_device *pdev)> 
> > r8a66597_free_request(&r8a66597->ep[0].ep, r8a66597->ep0_req);
> > 
> > if (r8a66597->pdata->on_chip) {
> > 
> > -   clk_disable(r8a66597->clk);
> > +   clk_disable_unprepare(r8a66597->clk);
> > 
> > clk_put(r8a66597->clk);
> > 
> > }
> > 
> > @@ -1931,7 +1931,7 @@ static int __init r8a66597_probe(struct
> > platform_device *pdev)> 
> > ret = PTR_ERR(r8a66597->clk);
> > goto clean_up;
> > 
> > }
> > 
> > -   clk_enable(r8a66597->clk);
> > +   clk_prepare_enable(r8a66597->clk);
> > 
> > }
> > 
> > if (r8a66597->pdata->sudmac) {
> > 
> > @@ -1996,7 +1996,7 @@ clean_up3:
> > free_irq(irq, r8a66597);
> >  
> >  clean_up2:
> > if (r8a66597->pdata->on_chip) {
> > 
> > -   clk_disable(r8a66597->clk);
> > +   clk_disable_unprepare(r8a66597->clk);
> > 
> > clk_put(r8a66597->clk);
> > 
> > }
> >  
> >  clean_up:
-- 
Regards,

Laurent Pinchart

--
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 10/12] usb: r8a66597-hcd: Convert to clk_prepare/unprepare

2013-11-09 Thread Laurent Pinchart
Hi Greg,

On Tuesday 29 October 2013 18:47:26 Shimoda, Yoshihiro wrote:
> Hi Laurent-san,
> 
> (2013/10/29 7:49), Laurent Pinchart wrote:
> > Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
> > clk_disable_unprepare() to get ready for the migration to the common
> > clock framework.
> > 
> > Cc: Greg Kroah-Hartman 
> > Cc: Yoshihiro Shimoda 
> > Cc: linux-usb@vger.kernel.org
> > Signed-off-by: Laurent Pinchart
> > 
> 
> Thank you for the patch.
> 
> Acked-by: Yoshihiro Shimoda 

Could you please pick this patch up ?

> > ---
> > 
> >  drivers/usb/host/r8a66597-hcd.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/usb/host/r8a66597-hcd.c
> > b/drivers/usb/host/r8a66597-hcd.c index 2ad004a..a2fdd85 100644
> > --- a/drivers/usb/host/r8a66597-hcd.c
> > +++ b/drivers/usb/host/r8a66597-hcd.c
> > @@ -95,7 +95,7 @@ static int r8a66597_clock_enable(struct r8a66597
> > *r8a66597)> 
> > int i = 0;
> > 
> > if (r8a66597->pdata->on_chip) {
> > 
> > -   clk_enable(r8a66597->clk);
> > +   clk_prepare_enable(r8a66597->clk);
> > 
> > do {
> > 
> > r8a66597_write(r8a66597, SCKE, SYSCFG0);
> > tmp = r8a66597_read(r8a66597, SYSCFG0);
> > 
> > @@ -139,7 +139,7 @@ static void r8a66597_clock_disable(struct r8a66597
> > *r8a66597)> 
> > udelay(1);
> > 
> > if (r8a66597->pdata->on_chip) {
> > 
> > -   clk_disable(r8a66597->clk);
> > +   clk_disable_unprepare(r8a66597->clk);
> > 
> > } else {
> > 
> > r8a66597_bclr(r8a66597, PLLC, SYSCFG0);
> > r8a66597_bclr(r8a66597, XCKE, SYSCFG0);
-- 
Regards,

Laurent Pinchart

--
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 10/12] usb: r8a66597-hcd: Convert to clk_prepare/unprepare

2013-11-09 Thread Greg Kroah-Hartman
On Sat, Nov 09, 2013 at 03:12:05PM +0100, Laurent Pinchart wrote:
> Hi Greg,
> 
> On Tuesday 29 October 2013 18:47:26 Shimoda, Yoshihiro wrote:
> > Hi Laurent-san,
> > 
> > (2013/10/29 7:49), Laurent Pinchart wrote:
> > > Turn clk_enable() and clk_disable() calls into clk_prepare_enable() and
> > > clk_disable_unprepare() to get ready for the migration to the common
> > > clock framework.
> > > 
> > > Cc: Greg Kroah-Hartman 
> > > Cc: Yoshihiro Shimoda 
> > > Cc: linux-usb@vger.kernel.org
> > > Signed-off-by: Laurent Pinchart
> > > 
> > 
> > Thank you for the patch.
> > 
> > Acked-by: Yoshihiro Shimoda 
> 
> Could you please pick this patch up ?

I'll pick things up after 3.13-rc1 is out, I can't do anything until
then.

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


Native resolution of a webcam from the lsusb -v output

2013-11-09 Thread Gene Heskett
Greetings;

I am setting up a machine vision system, where the camera output is cropped 
to the point of a pixel in the camera is 20+ on the computer screen since 
we want .001" or .01mm accuracy in the final image presented to the machine 
operator.  Imagine if you will, a 2304xwhatever camera that we are using 
just the central 300 or so pixels in our application.

So we use a fairly high res camera, and crop the image down to the central 
portion of interest as the first step in making our processing chain faster 
by having less data to fiddle with.

It makes sense that we should, for speed reasons because our video 
processing chain is slow in frames per second, in some modes its even 
frames per minute, we should waste as little time as possible in the camera 
by running it in its native resolution with no compression.  Ideally, we 
should see it in real time, but when you add crosshair targets and such to 
the stream, real realtime isn't going to happen. But moving the machine 2 
thousandths of an inch, and waiting 3 seconds or more to actually see the 
movement on screen is, shall we say, frustrating to the operator.

So, in the interests of maintaining a square pixel, and a 1/1 pixel to 
pixel ratio so as not to throw away usable resolution by blending or 
interpolation effects in the camera, is there a returned value in the lsusb 
-v or -vv output that identifies the camera imagers native resolution and 
output byte color sequence format?

Thank you.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

I've always made it a solemn practice to never drink anything stronger
than tequila before breakfast.
-- R. Nesson
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
--
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: Native resolution of a webcam from the lsusb -v output

2013-11-09 Thread Greg KH
On Sat, Nov 09, 2013 at 11:06:56AM -0500, Gene Heskett wrote:
> So, in the interests of maintaining a square pixel, and a 1/1 pixel to 
> pixel ratio so as not to throw away usable resolution by blending or 
> interpolation effects in the camera, is there a returned value in the lsusb 
> -v or -vv output that identifies the camera imagers native resolution and 
> output byte color sequence format?

You don't say what camera you are using...
--
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: Native resolution of a webcam from the lsusb -v output

2013-11-09 Thread Gene Heskett
On Saturday 09 November 2013 11:48:14 Greg KH did opine:

> On Sat, Nov 09, 2013 at 11:06:56AM -0500, Gene Heskett wrote:
> > So, in the interests of maintaining a square pixel, and a 1/1 pixel to
> > pixel ratio so as not to throw away usable resolution by blending or
> > interpolation effects in the camera, is there a returned value in the
> > lsusb -v or -vv output that identifies the camera imagers native
> > resolution and output byte color sequence format?
> 
> You don't say what camera you are using...

ATM testing, and subject to change because it is not physically suitable, a 
Logitech C920.  A Microsoft HD5000 or HD6000 could follow me home yet today 
however, much more suitable mechanically as I have no use for the stereo 
mics that make the C920 almost 4" long, which is why I asked the question 
for a universal, camera independent method of determining that. :)

Thanks Greg.

Cheers, Gene
-- 
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

"I'd love to go out with you, but the last time I went out, I never came 
back."
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
 law-abiding citizens.
--
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: huawei_cdc_ncm driver

2013-11-09 Thread Thomas Schäfer

> > 
> > The second device with problems is  Huawei E3276 (Speedstick LTE III,
> > Telekom, no Hilink, but ipv6-cabable version) This device worked before
> > with SLAAC, now with -next-20131107 it doesn't.
> Ouch.  I noticed after submitting this driver that it probably has some
> flawed logic wrt carrier detection.  I wonder if this patch makes any
> difference (yes, just delete that line):
>

It didn't.

I will test again, from time to time linux-next. If the problem is still there 
while releasing RC-versions, I will cry out again.


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


(no subject)

2013-11-09 Thread Carolina Andrea Puentes Arriagada
Helló, van szüksége sürgős kölcsön néhány korai karácsonyi és hálaadás 
vásárlás a barátod, és szeretett egy, akkor is, azért vagyunk itt, hogy 
segítsen ki, a Jennifer pénzügyi cég is ad ki hitelt, a kamat, ami olyan 
alacsony, mint 3 százalék, így üzlet elején és a lehető legjobb ajándék 
a family.Contact minket ma: jenifer.financia...@gmail.com


Teljes neve:
ország:
Telefonszám:
Havi jövedelem:
Hitel összege:
Hitel Időtartam:

Kérjük, vegye fel Xmas Hitel és a Get Back To Me Oké.
Mrs.Jennifer.
--
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: chipidea: usbmisc: Add support for i.MX27/i.MX31 CPUs

2013-11-09 Thread Alexander Shiyan
This adds i.MX27 and i.MX31 as the next user of the usbmisc driver.

Signed-off-by: Alexander Shiyan 
---
 drivers/usb/chipidea/usbmisc_imx.c | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 8a1094b..4381c5a6 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -21,6 +21,10 @@
 #define MX25_USB_PHY_CTRL_OFFSET   0x08
 #define MX25_BM_EXTERNAL_VBUS_DIVIDER  BIT(23)
 
+#define MX27_H1_PM_BIT BIT(8)
+#define MX27_H2_PM_BIT BIT(16)
+#define MX27_OTG_PM_BITBIT(24)
+
 #define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08
 #define MX53_USB_UH2_CTRL_OFFSET   0x14
 #define MX53_USB_UH3_CTRL_OFFSET   0x18
@@ -68,6 +72,36 @@ static int usbmisc_imx25_post(struct imx_usbmisc_data *data)
return 0;
 }
 
+static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
+{
+   unsigned long flags;
+   u32 val;
+
+   switch (data->index) {
+   case 0:
+   val = MX27_OTG_PM_BIT;
+   break;
+   case 1:
+   val = MX27_H1_PM_BIT;
+   break;
+   case 2:
+   val = MX27_H2_PM_BIT;
+   break;
+   default:
+   return -EINVAL;
+   };
+
+   spin_lock_irqsave(&usbmisc->lock, flags);
+   if (data->disable_oc)
+   val = readl(usbmisc->base) | val;
+   else
+   val = readl(usbmisc->base) & ~val;
+   writel(val, usbmisc->base);
+   spin_unlock_irqrestore(&usbmisc->lock, flags);
+
+   return 0;
+}
+
 static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
 {
void __iomem *reg = NULL;
@@ -128,6 +162,10 @@ static const struct usbmisc_ops imx25_usbmisc_ops = {
.post = usbmisc_imx25_post,
 };
 
+static const struct usbmisc_ops imx27_usbmisc_ops = {
+   .init = usbmisc_imx27_init,
+};
+
 static const struct usbmisc_ops imx53_usbmisc_ops = {
.init = usbmisc_imx53_init,
 };
@@ -162,6 +200,10 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
.data = &imx25_usbmisc_ops,
},
{
+   .compatible = "fsl,imx27-usbmisc",
+   .data = &imx27_usbmisc_ops,
+   },
+   {
.compatible = "fsl,imx53-usbmisc",
.data = &imx53_usbmisc_ops,
},
-- 
1.8.1.5

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


[PATCH 2/2] usb: chipidea: usbmisc: Add support for i.MX51 CPU

2013-11-09 Thread Alexander Shiyan
This adds i.MX51 as the next user of the usbmisc driver.
Since the functional is similar i.MX53, we just rename the
definitions and add an alias for the new CPU.

Signed-off-by: Alexander Shiyan 
---
 drivers/usb/chipidea/usbmisc_imx.c | 40 +-
 1 file changed, 22 insertions(+), 18 deletions(-)

diff --git a/drivers/usb/chipidea/usbmisc_imx.c 
b/drivers/usb/chipidea/usbmisc_imx.c
index 4381c5a6..f348ebb 100644
--- a/drivers/usb/chipidea/usbmisc_imx.c
+++ b/drivers/usb/chipidea/usbmisc_imx.c
@@ -25,12 +25,12 @@
 #define MX27_H2_PM_BIT BIT(16)
 #define MX27_OTG_PM_BITBIT(24)
 
-#define MX53_USB_OTG_PHY_CTRL_0_OFFSET 0x08
-#define MX53_USB_UH2_CTRL_OFFSET   0x14
-#define MX53_USB_UH3_CTRL_OFFSET   0x18
-#define MX53_BM_OVER_CUR_DIS_H1BIT(5)
-#define MX53_BM_OVER_CUR_DIS_OTG   BIT(8)
-#define MX53_BM_OVER_CUR_DIS_UHx   BIT(30)
+#define MX5_USB_OTG_PHY_CTRL_0_OFFSET  0x08
+#define MX5_USB_UH2_CTRL_OFFSET0x14
+#define MX5_USB_UH3_CTRL_OFFSET0x18
+#define MX5_BM_OVER_CUR_DIS_H1 BIT(5)
+#define MX5_BM_OVER_CUR_DIS_OTGBIT(8)
+#define MX5_BM_OVER_CUR_DIS_UHxBIT(30)
 
 #define MX6_BM_OVER_CUR_DISBIT(7)
 
@@ -102,7 +102,7 @@ static int usbmisc_imx27_init(struct imx_usbmisc_data *data)
return 0;
 }
 
-static int usbmisc_imx53_init(struct imx_usbmisc_data *data)
+static int usbmisc_imx5_init(struct imx_usbmisc_data *data)
 {
void __iomem *reg = NULL;
unsigned long flags;
@@ -115,20 +115,20 @@ static int usbmisc_imx53_init(struct imx_usbmisc_data 
*data)
spin_lock_irqsave(&usbmisc->lock, flags);
switch (data->index) {
case 0:
-   reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
-   val = readl(reg) | MX53_BM_OVER_CUR_DIS_OTG;
+   reg = usbmisc->base + MX5_USB_OTG_PHY_CTRL_0_OFFSET;
+   val = readl(reg) | MX5_BM_OVER_CUR_DIS_OTG;
break;
case 1:
-   reg = usbmisc->base + MX53_USB_OTG_PHY_CTRL_0_OFFSET;
-   val = readl(reg) | MX53_BM_OVER_CUR_DIS_H1;
+   reg = usbmisc->base + MX5_USB_OTG_PHY_CTRL_0_OFFSET;
+   val = readl(reg) | MX5_BM_OVER_CUR_DIS_H1;
break;
case 2:
-   reg = usbmisc->base + MX53_USB_UH2_CTRL_OFFSET;
-   val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
+   reg = usbmisc->base + MX5_USB_UH2_CTRL_OFFSET;
+   val = readl(reg) | MX5_BM_OVER_CUR_DIS_UHx;
break;
case 3:
-   reg = usbmisc->base + MX53_USB_UH3_CTRL_OFFSET;
-   val = readl(reg) | MX53_BM_OVER_CUR_DIS_UHx;
+   reg = usbmisc->base + MX5_USB_UH3_CTRL_OFFSET;
+   val = readl(reg) | MX5_BM_OVER_CUR_DIS_UHx;
break;
}
if (reg && val)
@@ -166,8 +166,8 @@ static const struct usbmisc_ops imx27_usbmisc_ops = {
.init = usbmisc_imx27_init,
 };
 
-static const struct usbmisc_ops imx53_usbmisc_ops = {
-   .init = usbmisc_imx53_init,
+static const struct usbmisc_ops imx5_usbmisc_ops = {
+   .init = usbmisc_imx5_init,
 };
 
 static const struct usbmisc_ops imx6q_usbmisc_ops = {
@@ -204,8 +204,12 @@ static const struct of_device_id usbmisc_imx_dt_ids[] = {
.data = &imx27_usbmisc_ops,
},
{
+   .compatible = "fsl,imx51-usbmisc",
+   .data = &imx5_usbmisc_ops,
+   },
+   {
.compatible = "fsl,imx53-usbmisc",
-   .data = &imx53_usbmisc_ops,
+   .data = &imx5_usbmisc_ops,
},
{
.compatible = "fsl,imx6q-usbmisc",
-- 
1.8.1.5

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