Re: [PATCH 3/3] usb: chipidea: use hrtimer for otg fsm timers

2015-02-26 Thread Li Jun
On Thu, Feb 26, 2015 at 07:25:56PM +0800, Peter Chen wrote:
 On Mon, Feb 09, 2015 at 02:54:48PM +0800, Li Jun wrote:
  From: Li Jun b47...@freescale.com
  
  Current otg fsm timers are using controller 1ms irq and count it, this patch
  is to replace it with hrtimer solution, use one hrtimer for all otg timers.
  
  Signed-off-by: Li Jun jun...@freescale.com
  ---
   drivers/usb/chipidea/ci.h  |   10 +-
   drivers/usb/chipidea/otg_fsm.c |  365 
  
   2 files changed, 191 insertions(+), 184 deletions(-)
  
  diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
  index c09381d..6256f04 100644
  --- a/drivers/usb/chipidea/ci.h
  +++ b/drivers/usb/chipidea/ci.h
  @@ -162,7 +162,10 @@ struct hw_bank {
* @role: current role
* @is_otg: if the device is otg-capable
* @fsm: otg finite state machine
  - * @fsm_timer: pointer to timer list of otg fsm
  + * @otg_fsm_hrtimer: hrtimer for otg fsm timers
  + * @hr_timeouts: time out during lists with msec
 
 It is ktime_t, any relationship with msec?
 %s/lists/list

My wrong comments, I will correct it to be time out list of active timers

 
  + * @enabled_otg_timers: bits of enabled otg timers
 
 How about enabled_otg_timer_bits?
 
sounds better, I will change

  + * @next_otg_timer: next nearest enabled timer to be expired
* @work: work for role changing
* @wq: workqueue thread
* @qh_pool: allocation pool for queue heads
  @@ -205,7 +208,10 @@ struct ci_hdrc {
  boolis_otg;
  struct usb_otg  otg;
  struct otg_fsm  fsm;
  -   struct ci_otg_fsm_timer_list*fsm_timer;
  +   struct hrtimer  otg_fsm_hrtimer;
  +   ktime_t hr_timeouts[NUM_OTG_FSM_TIMERS];
  +   unsignedenabled_otg_timers;
 
 Why you use unsigned, but not unsigned int or unsigned long?

unsigned is equal to unsigned int, currently only 13 timers are defined, so
unsigned is okay, for possible future extension, I will change it to be
unsigned long

Li Jun
 
  +   enum otg_fsm_timer  next_otg_timer;
  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 ba2cb91..0af7ff0 100644
  --- a/drivers/usb/chipidea/otg_fsm.c
  +++ b/drivers/usb/chipidea/otg_fsm.c
  @@ -30,22 +30,6 @@
   #include otg.h
   #include otg_fsm.h
   
  -static struct ci_otg_fsm_timer *otg_timer_initializer
  -(struct ci_hdrc *ci, void (*function)(void *, unsigned long),
  -   unsigned long expires, unsigned long data)
  -{
  -   struct ci_otg_fsm_timer *timer;
  -
  -   timer = devm_kzalloc(ci-dev, sizeof(struct ci_otg_fsm_timer),
  -   GFP_KERNEL);
  -   if (!timer)
  -   return NULL;
  -   timer-function = function;
  -   timer-expires = expires;
  -   timer-data = data;
  -   return timer;
  -}
  -
   /* Add for otg: interact with user space app */
   static ssize_t
   get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf)
  @@ -204,36 +188,48 @@ static struct attribute_group inputs_attr_group = {
   };
   
   /*
  + * Keep this list in the same order as timers indexed
  + * by enum otg_fsm_timer in include/linux/usb/otg-fsm.h
  + */
  +static unsigned otg_timer_ms[] = {
  +   TA_WAIT_VRISE,
  +   TA_WAIT_VFALL,
  +   TA_WAIT_BCON,
  +   TA_AIDL_BDIS,
  +   TB_ASE0_BRST,
  +   TA_BIDL_ADIS,
  +   TB_SE0_SRP,
  +   TB_SRP_FAIL,
  +   0,
 
 0? No timer for it?

Means this timer(A_WAIT_ENUM) is not used, so 0 delay time is defined here.

 
  +   TB_DATA_PLS,
  +   TB_SSEND_SRP,
  +};
  +
  +/*
* Add timer to active timer list
*/
   static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
   {
  -   struct ci_otg_fsm_timer *tmp_timer;
  -   struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t];
  -   struct list_head *active_timers = ci-fsm_timer-active_timers;
  +   unsigned long flags, timer_sec, timer_nsec;
   
  if (t = NUM_OTG_FSM_TIMERS)
  return;
   
  -   /*
  -* Check if the timer is already in the active list,
  -* if so update timer count
  -*/
  -   list_for_each_entry(tmp_timer, active_timers, list)
  -   if (tmp_timer == timer) {
  -   timer-count = timer-expires;
  -   return;
  -   }
  -
  -   if (list_empty(active_timers))
  -   pm_runtime_get(ci-dev);
  -
  -   timer-count = timer-expires;
  -   list_add_tail(timer-list, active_timers);
  -
  -   /* Enable 1ms irq */
  -   if (!(hw_read_otgsc(ci, OTGSC_1MSIE)))
  -   hw_write_otgsc(ci, OTGSC_1MSIE, OTGSC_1MSIE);
  +   spin_lock_irqsave(ci-lock, flags);
  +   timer_sec = otg_timer_ms[t] / MSEC_PER_SEC;
  +   timer_nsec = (otg_timer_ms[t] % MSEC_PER_SEC) * NSEC_PER_MSEC;
  +   ci-hr_timeouts[t] = 

Re: [PATCH v3] USB: serial: cp210x: Adding Seletek device id's

2015-02-26 Thread Johan Hovold
On Fri, Feb 27, 2015 at 02:08:29AM +0100, Michiel vd Garde wrote:
 These device ID's are not associated with the cp210x module currently,
 but should be. This patch allows the devices to operate upon
 connecting them to the usb bus as intended.
 
 Signed-off-by: Michiel van de Garde mgpar...@gmail.com

Now applied, 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 v3 1/1] USB: ch341: set tty baud speed according to tty struct

2015-02-26 Thread Johan Hovold
On Thu, Feb 26, 2015 at 10:02:41AM -0500, Nicolas PLANEL wrote:
 The ch341_set_baudrate() function initialize the device baud speed according
 to the value on priv-baud_rate. By default the ch341_open() set it to a
 hardcoded value (DEFAULT_BAUD_RATE 9600). Unfortunately, the tty_struct is
 not initialized with the same default value. (usually 56700)
 
 This means that the tty_struct and the device baud rate generator are not
 synchronized after opening the port.
 
 Fixup is done by calling ch341_set_termios() if tty exist.
 Remove unnecessary variable priv-baud_rate setup as it's already done by 
 ch341_port_probe().

Please try to break your commit message lines at about 72 cols or so.

 Signed-off-by: Nicolas PLANEL nicolas.pla...@enovance.com
 ---
  drivers/usb/serial/ch341.c | 9 +++--
  1 file changed, 7 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
 index 2d72aa3564a3..5d28ca165fdf 100644
 --- a/drivers/usb/serial/ch341.c
 +++ b/drivers/usb/serial/ch341.c
 @@ -84,6 +84,10 @@ struct ch341_private {
   u8 line_status; /* active status of modem control inputs */
  };
  
 +static void ch341_set_termios(struct tty_struct *tty,
 +   struct usb_serial_port *port,
 +   struct ktermios *old_termios);
 +
  static int ch341_control_out(struct usb_device *dev, u8 request,
u16 value, u16 index)
  {
 @@ -309,8 +313,6 @@ static int ch341_open(struct tty_struct *tty, struct 
 usb_serial_port *port)
   struct ch341_private *priv = usb_get_serial_port_data(port);
   int r;
  
 - priv-baud_rate = DEFAULT_BAUD_RATE;
 -
   r = ch341_configure(serial-dev, priv);
   if (r)
   goto out;
 @@ -323,6 +325,9 @@ static int ch341_open(struct tty_struct *tty, struct 
 usb_serial_port *port)
   if (r)
   goto out;
  
 + if (tty)
 + ch341_set_termios(tty, port, NULL);
 +

Thanks for the v3. Looking at the code now, I see that the calls to
set baudrate and handshake in open are still there. I think you should
remove those now that you call set_termios.

Care to fix that up and resend?

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


keyboard/trackpad combo unusable on MacBookPro4,1 with bcm5974.ko

2015-02-26 Thread Christian Böhme
Hello all,

this is a response to

https://bugzilla.kernel.org/show_bug.cgi?id=14987#c6

whose main thread more or less merely rehashes what was
already said in other (bug) reports before it elsewhere.

I'd like for this to be a reminder that the issue never
really was resolved but left lingering beginning with
kernel version 2.6.28 (yes, that long ago).

Specifically, HID_QUIRK_IGNORE_MOUSE existed in 2.6.27
and was dealt with in drivers/hid/usbhid/hid-core.c:730,
thereby somehow fixing things.  But those lines (and
the symbol) disappeared after 2.6.27.  Why were they
removed?

Is there any chance for this problem to be fixed or
am I really expected to downgrade that far just to
have a working keyboard and trackpad?


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


[RFC PATCH] xhci: fix reporting of 0-sized URBs in control endpoints

2015-02-26 Thread Mathias Nyman
When a control transfer has a short data stage, the xHCI controller generates
two transfer events: a COMP_SHORT_TX event that specifies the untransferred
amount, and a COMP_SUCCESS event. But when the data stage is not short, only
the COMP_SUCCESS event occurs. Therefore, xhci-hcd sets urb-actual_length
to urb-transfer_buffer_length while processing the COMP_SUCCESS event,
unless urb-actual_length was set already by a previous COMP_SHORT_TX event.

The driver checks this by seeing whether urb-actual_length == 0, but this
alone is the wrong test, as it is entirely possible for a short transfer to
have an urb-actual_length = 0.

This patch changes the xhci driver to set the urb-actual_length in advance
to the expected value of a successful control transfer.
The urb-actual_length is then only adjusted in case of short transfers or
other special events, but not on COMP_SUCCESS events.

This fixes a bug which affected the HSO plugin, which relies on URBs with
urb-actual_length == 0 to halt re-submitting the RX URB in the control
endpoint.

Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com
---
 drivers/usb/host/xhci-ring.c | 73 ++--
 1 file changed, 37 insertions(+), 36 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index b46b5b9..0e02e79 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -732,7 +732,11 @@ remove_finished_td:
/* Clean up the cancelled URB */
/* Doesn't matter what we pass for status, since the core will
 * just overwrite it (because the URB has been unlinked).
+* Control urbs have the urb-actual_length pre-set, clear it
+* as well
 */
+   if (usb_endpoint_xfer_control(cur_td-urb-ep-desc))
+   cur_td-urb-actual_length = 0;
xhci_giveback_urb_in_irq(xhci, cur_td, 0);
 
/* Stop processing the cancelled list if the watchdog timer is
@@ -755,6 +759,7 @@ static void xhci_kill_ring_urbs(struct xhci_hcd *xhci, 
struct xhci_ring *ring)
list_del_init(cur_td-td_list);
if (!list_empty(cur_td-cancelled_td_list))
list_del_init(cur_td-cancelled_td_list);
+   cur_td-urb-actual_length = 0;
xhci_giveback_urb_in_irq(xhci, cur_td, -ESHUTDOWN);
}
 }
@@ -792,6 +797,7 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,
cur_td = list_first_entry(ep-cancelled_td_list,
struct xhci_td, cancelled_td_list);
list_del_init(cur_td-cancelled_td_list);
+   cur_td-urb-actual_length = 0;
xhci_giveback_urb_in_irq(xhci, cur_td, -ESHUTDOWN);
}
 }
@@ -1888,6 +1894,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct 
xhci_td *td,
int ep_index;
struct xhci_ep_ctx *ep_ctx;
u32 trb_comp_code;
+   bool force_finish_td = false;
 
slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event-flags));
xdev = xhci-devs[slot_id];
@@ -1906,7 +1913,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct 
xhci_td *td,
xhci_warn(xhci, WARN: Success on ctrl data TRB 
without IOC set??\n);
*status = -ESHUTDOWN;
-   } else {
+   } else if (*status == -EINPROGRESS) {
+   /* only set to 0 if no previous event set it earlier */
*status = 0;
}
break;
@@ -1918,6 +1926,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct 
xhci_td *td,
break;
case COMP_STOP_INVAL:
case COMP_STOP:
+   /* we don't continue stopped TDs, so length can be set to 0 */
+   td-urb-actual_length = 0;
return finish_td(xhci, td, event_trb, event, ep, status, false);
default:
if (!xhci_requires_manual_halt_cleanup(xhci,
@@ -1928,44 +1938,26 @@ static int process_ctrl_td(struct xhci_hcd *xhci, 
struct xhci_td *td,
trb_comp_code, ep_index);
/* else fall through */
case COMP_STALL:
-   /* Did we transfer part of the data (middle) phase? */
-   if (event_trb != ep_ring-dequeue 
-   event_trb != td-last_trb)
-   td-urb-actual_length =
-   td-urb-transfer_buffer_length -
-   EVENT_TRB_LEN(le32_to_cpu(event-transfer_len));
-   else
-   td-urb-actual_length = 0;
-
-   return finish_td(xhci, td, event_trb, event, ep, status, false);
+   /* length will be set later below if we stall on data stage */
+   td-urb-actual_length = 0;
+   

Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 10:44:15AM -0600, Felipe Balbi wrote:
 On Thu, Feb 26, 2015 at 10:37:50AM -0600, Bin Liu wrote:
  Felipe,
  
  On Thu, Feb 26, 2015 at 10:31 AM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 10:21:38AM -0600, Bin Liu wrote:
   Felipe,
  
   On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
There was already a proper place where we were
checking for babble interrupts, move babble
recovery there.
   
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)
   
diff --git a/drivers/usb/musb/musb_core.c 
b/drivers/usb/musb/musb_core.c
index 2767ce1bf016..0569b24719e6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -892,6 +892,12 @@ b_host:
} else {
ERR(Stopping host session -- 
babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 
0);
+
+   if (is_host_active(musb)) {
+   musb_generic_disable(musb);
+   
schedule_delayed_work(musb-recover_work,
+   
msecs_to_jiffies(100));
+   }
  
   This change breaks babble recovery, because the following lines above 
   here
  
   873 if (devctl  (MUSB_DEVCTL_FSDEV |
   MUSB_DEVCTL_LSDEV)) {
   874 dev_dbg(musb-controller, BABBLE
   devctl: %02x\n, devctl);
  
   have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
   'if' traps babble handling for all cases, never hit on 'else'.
  
   We might as well drop that check altogether. Let me see what happens
   here.
  
  It is good to clean it up, but I guess the babble storm you see is
  caused by something else. I debugged the storm last year in an older
  kernel, it was due to the babble recovery routine does not maintain a
  bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
  at this part in the upstream kernel right now.
 
 alright, I'll have a look, let's see.

I'll split below into two patches, but here you go:

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index e23eb3e517de..c3c5a6462600 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -862,16 +862,23 @@ b_host:
if (int_usb  MUSB_INTR_RESET) {
handled = IRQ_HANDLED;
if (devctl  MUSB_DEVCTL_HM) {
+   u8 power = musb_readl(musb-mregs, MUSB_POWER);
+
/*
 * Looks like non-HS BABBLE can be ignored, but
-* HS BABBLE is an error condition. For HS the solution
-* is to avoid babble in the first place and fix what
-* caused BABBLE. When HS BABBLE happens we can only
-* stop the session.
+* HS BABBLE is an error condition.
+*
+* For HS the solution is to avoid babble in the first
+* place and fix what caused BABBLE.
+*
+* When HS BABBLE happens what we can depends on which
+* platform MUSB is running, because some platforms
+* implemented proprietary means for 'recovering' from
+* Babble conditions. One such platform is AM335x. In
+* most cases, however, the only thing we can do is drop
+* the session.
 */
-   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV)) {
-   dev_dbg(musb-controller, BABBLE devctl: 
%02x\n, devctl);
-   } else {
+   if (power  MUSB_POWER_HSMODE) {
ERR(Stopping host session -- babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
 
diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 5965ed69e457..b79202c3dd65 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -607,7 +607,7 @@ static int dsps_musb_reset(struct musb *musb)
session_restart = 1;
}
 
-   return !session_restart;
+   return session_restart ? 0 : -EPIPE;
 }
 
 static struct musb_platform_ops dsps_ops = {

When I look at this with g_zero, BABBLE_CTL always reads as 0x44
(SW_SESSION_CTRL | RCV_DISABLE), I see a reset happening and g_zero
renumerating. Still no IRQ storm.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
 There was already a proper place where we were
 checking for babble interrupts, move babble
 recovery there.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_core.c | 13 ++---
  1 file changed, 6 insertions(+), 7 deletions(-)

 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index 2767ce1bf016..0569b24719e6 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -892,6 +892,12 @@ b_host:
 } else {
 ERR(Stopping host session -- babble\n);
 musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
 +
 +   if (is_host_active(musb)) {
 +   musb_generic_disable(musb);
 +   
 schedule_delayed_work(musb-recover_work,
 +   
 msecs_to_jiffies(100));
 +   }

This change breaks babble recovery, because the following lines above here

873 if (devctl  (MUSB_DEVCTL_FSDEV |
MUSB_DEVCTL_LSDEV)) {
874 dev_dbg(musb-controller, BABBLE
devctl: %02x\n, devctl);

have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
'if' traps babble handling for all cases, never hit on 'else'.

 }
 } else {
 dev_dbg(musb-controller, BUS RESET as %s\n,
 @@ -931,13 +937,6 @@ b_host:
 }
 }

 -   /* handle babble condition */
 -   if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb)) {
 -   musb_generic_disable(musb);
 -   schedule_delayed_work(musb-recover_work,
 - msecs_to_jiffies(100));
 -   }
 -
  #if 0
  /* REVISIT ... this would be for multiplexing periodic endpoints, or
   * supporting transfer phasing to prevent exceeding ISO bandwidth
 --
 2.3.0

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


Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 10:21:38AM -0600, Bin Liu wrote:
 Felipe,
 
 On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
  There was already a proper place where we were
  checking for babble interrupts, move babble
  recovery there.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
  ---
   drivers/usb/musb/musb_core.c | 13 ++---
   1 file changed, 6 insertions(+), 7 deletions(-)
 
  diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
  index 2767ce1bf016..0569b24719e6 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -892,6 +892,12 @@ b_host:
  } else {
  ERR(Stopping host session -- babble\n);
  musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
  +
  +   if (is_host_active(musb)) {
  +   musb_generic_disable(musb);
  +   
  schedule_delayed_work(musb-recover_work,
  +   
  msecs_to_jiffies(100));
  +   }
 
 This change breaks babble recovery, because the following lines above here
 
 873 if (devctl  (MUSB_DEVCTL_FSDEV |
 MUSB_DEVCTL_LSDEV)) {
 874 dev_dbg(musb-controller, BABBLE
 devctl: %02x\n, devctl);
 
 have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
 'if' traps babble handling for all cases, never hit on 'else'.

We might as well drop that check altogether. Let me see what happens
here.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 10:31 AM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 10:21:38AM -0600, Bin Liu wrote:
 Felipe,

 On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
  There was already a proper place where we were
  checking for babble interrupts, move babble
  recovery there.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
  ---
   drivers/usb/musb/musb_core.c | 13 ++---
   1 file changed, 6 insertions(+), 7 deletions(-)
 
  diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
  index 2767ce1bf016..0569b24719e6 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -892,6 +892,12 @@ b_host:
  } else {
  ERR(Stopping host session -- babble\n);
  musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
  +
  +   if (is_host_active(musb)) {
  +   musb_generic_disable(musb);
  +   
  schedule_delayed_work(musb-recover_work,
  +   
  msecs_to_jiffies(100));
  +   }

 This change breaks babble recovery, because the following lines above here

 873 if (devctl  (MUSB_DEVCTL_FSDEV |
 MUSB_DEVCTL_LSDEV)) {
 874 dev_dbg(musb-controller, BABBLE
 devctl: %02x\n, devctl);

 have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
 'if' traps babble handling for all cases, never hit on 'else'.

 We might as well drop that check altogether. Let me see what happens
 here.

It is good to clean it up, but I guess the babble storm you see is
caused by something else. I debugged the storm last year in an older
kernel, it was due to the babble recovery routine does not maintain a
bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
at this part in the upstream kernel right now.


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


Re: [PATCH v2 1/1] USB: ch341: set tty baud speed according to tty struct

2015-02-26 Thread Johan Hovold
On Thu, Feb 19, 2015 at 11:43:27AM +0700, Johan Hovold wrote:
 On Wed, Feb 18, 2015 at 03:22:30PM -0500, Nicolas PLANEL wrote:
  The ch341_set_baudrate() function initialize the device baud speed according
  to the value on priv-baud_rate. By default the ch341_open() set it to a
  hardcoded value (DEFAULT_BAUD_RATE 9600). Unfortunately, the tty_struct is
  not initialized with the same default value. (usually 56700)
  
  This means that the tty_struct and the device baud rate generator are not
  synchronized after opening the port.
  
  Fixup is done by calling ch341_set_termios() if tty exist.
  Remove unnecessary variable priv-baud_rate setup as it's already done by 
  ch341_port_probe().
  
  Signed-off-by: Nicolas PLANEL nicolas.pla...@enovance.com
 
 Thanks for the updated patch. I'll queue it up for 3.20 next week.

Hmm, this one doesn't even build. Did you not test your patch before
submitting it?

Please send a v3.

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 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 10:37:50AM -0600, Bin Liu wrote:
 Felipe,
 
 On Thu, Feb 26, 2015 at 10:31 AM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 10:21:38AM -0600, Bin Liu wrote:
  Felipe,
 
  On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
   There was already a proper place where we were
   checking for babble interrupts, move babble
   recovery there.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
   ---
drivers/usb/musb/musb_core.c | 13 ++---
1 file changed, 6 insertions(+), 7 deletions(-)
  
   diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
   index 2767ce1bf016..0569b24719e6 100644
   --- a/drivers/usb/musb/musb_core.c
   +++ b/drivers/usb/musb/musb_core.c
   @@ -892,6 +892,12 @@ b_host:
   } else {
   ERR(Stopping host session -- babble\n);
   musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
   +
   +   if (is_host_active(musb)) {
   +   musb_generic_disable(musb);
   +   
   schedule_delayed_work(musb-recover_work,
   +   
   msecs_to_jiffies(100));
   +   }
 
  This change breaks babble recovery, because the following lines above here
 
  873 if (devctl  (MUSB_DEVCTL_FSDEV |
  MUSB_DEVCTL_LSDEV)) {
  874 dev_dbg(musb-controller, BABBLE
  devctl: %02x\n, devctl);
 
  have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
  'if' traps babble handling for all cases, never hit on 'else'.
 
  We might as well drop that check altogether. Let me see what happens
  here.
 
 It is good to clean it up, but I guess the babble storm you see is
 caused by something else. I debugged the storm last year in an older
 kernel, it was due to the babble recovery routine does not maintain a
 bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
 at this part in the upstream kernel right now.

alright, I'll have a look, let's see.

-- 
balbi


signature.asc
Description: Digital signature


Re: [RFC PATCH] xhci: fix reporting of 0-sized URBs in control endpoints

2015-02-26 Thread Mathias Nyman
On 26.02.2015 18:12, Mathias Nyman wrote:
 When a control transfer has a short data stage, the xHCI controller generates
 two transfer events: a COMP_SHORT_TX event that specifies the untransferred
 amount, and a COMP_SUCCESS event. But when the data stage is not short, only
 the COMP_SUCCESS event occurs. Therefore, xhci-hcd sets urb-actual_length
 to urb-transfer_buffer_length while processing the COMP_SUCCESS event,
 unless urb-actual_length was set already by a previous COMP_SHORT_TX event.
 
 The driver checks this by seeing whether urb-actual_length == 0, but this
 alone is the wrong test, as it is entirely possible for a short transfer to
 have an urb-actual_length = 0.
 
 This patch changes the xhci driver to set the urb-actual_length in advance
 to the expected value of a successful control transfer.
 The urb-actual_length is then only adjusted in case of short transfers or
 other special events, but not on COMP_SUCCESS events.
 
 This fixes a bug which affected the HSO plugin, which relies on URBs with
 urb-actual_length == 0 to halt re-submitting the RX URB in the control
 endpoint.
 
 Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com
 ---
  drivers/usb/host/xhci-ring.c | 73 
 ++--
  1 file changed, 37 insertions(+), 36 deletions(-)
 
 diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
 index b46b5b9..0e02e79 100644
 --- a/drivers/usb/host/xhci-ring.c
 +++ b/drivers/usb/host/xhci-ring.c
 @@ -732,7 +732,11 @@ remove_finished_td:
   /* Clean up the cancelled URB */
   /* Doesn't matter what we pass for status, since the core will
* just overwrite it (because the URB has been unlinked).
 +  * Control urbs have the urb-actual_length pre-set, clear it
 +  * as well
*/
 + if (usb_endpoint_xfer_control(cur_td-urb-ep-desc))
 + cur_td-urb-actual_length = 0;
   xhci_giveback_urb_in_irq(xhci, cur_td, 0);
  
   /* Stop processing the cancelled list if the watchdog timer is
 @@ -755,6 +759,7 @@ static void xhci_kill_ring_urbs(struct xhci_hcd *xhci, 
 struct xhci_ring *ring)
   list_del_init(cur_td-td_list);
   if (!list_empty(cur_td-cancelled_td_list))
   list_del_init(cur_td-cancelled_td_list);
 + cur_td-urb-actual_length = 0;
   xhci_giveback_urb_in_irq(xhci, cur_td, -ESHUTDOWN);
   }
  }
 @@ -792,6 +797,7 @@ static void xhci_kill_endpoint_urbs(struct xhci_hcd *xhci,
   cur_td = list_first_entry(ep-cancelled_td_list,
   struct xhci_td, cancelled_td_list);
   list_del_init(cur_td-cancelled_td_list);
 + cur_td-urb-actual_length = 0;
   xhci_giveback_urb_in_irq(xhci, cur_td, -ESHUTDOWN);
   }
  }
 @@ -1888,6 +1894,7 @@ static int process_ctrl_td(struct xhci_hcd *xhci, 
 struct xhci_td *td,
   int ep_index;
   struct xhci_ep_ctx *ep_ctx;
   u32 trb_comp_code;
 + bool force_finish_td = false;
  
   slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event-flags));
   xdev = xhci-devs[slot_id];
 @@ -1906,7 +1913,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, 
 struct xhci_td *td,
   xhci_warn(xhci, WARN: Success on ctrl data TRB 
   without IOC set??\n);
   *status = -ESHUTDOWN;
 - } else {
 + } else if (*status == -EINPROGRESS) {
 + /* only set to 0 if no previous event set it earlier */
   *status = 0;
   }
   break;
 @@ -1918,6 +1926,8 @@ static int process_ctrl_td(struct xhci_hcd *xhci, 
 struct xhci_td *td,
   break;
   case COMP_STOP_INVAL:
   case COMP_STOP:
 + /* we don't continue stopped TDs, so length can be set to 0 */
 + td-urb-actual_length = 0;
   return finish_td(xhci, td, event_trb, event, ep, status, false);
   default:
   if (!xhci_requires_manual_halt_cleanup(xhci,
 @@ -1928,44 +1938,26 @@ static int process_ctrl_td(struct xhci_hcd *xhci, 
 struct xhci_td *td,
   trb_comp_code, ep_index);
   /* else fall through */
   case COMP_STALL:
 - /* Did we transfer part of the data (middle) phase? */
 - if (event_trb != ep_ring-dequeue 
 - event_trb != td-last_trb)
 - td-urb-actual_length =
 - td-urb-transfer_buffer_length -
 - EVENT_TRB_LEN(le32_to_cpu(event-transfer_len));
 - else
 - td-urb-actual_length = 0;
 -
 - return finish_td(xhci, td, event_trb, event, ep, status, false);
 + /* length will be set later below if we stall on data stage */
 + 

Re: [PATCH 4/8] ARM OMAP2+ GPMC: change get_gpmc_timing_reg output for DTS

2015-02-26 Thread Sergei Shtylyov

Hello.

On 02/26/2015 05:45 PM, Robert ABEL wrote:


DTS output was formatted to require additional work when copy-pasting into DTS.
Nano-second timings were replaced with interval of values that produce the same
number of clock ticks.



Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
  drivers/memory/omap-gpmc.c | 35 ++-
  1 file changed, 26 insertions(+), 9 deletions(-)



diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index dbb6753..9340e7a 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -337,32 +337,49 @@ static void gpmc_cs_bool_timings(int cs, const struct 
gpmc_bool_timings *p)
  }

  #ifdef DEBUG
+/**
+ * get_gpmc_timing_reg - read a timing parameter and print DTS settings for it.
+ * @cs  Chip Select Region


   Documentation/kernel-doc-nano-HOWTO.txt requires colons after the 
parameter names, doesn't it?



+ * @reg GPMC_CS_CONFIGn register offset.
+ * @st_bit  Start Bit
+ * @end_bit End Bit. Must be = @st_bit.
+ * @nameDTS node name, w/o gpmc,
+ * @raw Raw Format Option.
+ *  raw format:  gpmc,name = value
+ *  tick format: gpmc,name = value /zwj;*(x ns -- y ns]; x ticks 
*zwj;/
+ *  Where (x ns -- y ns] is the half-open interval from x ns to y ns 
that
+ *  result in the same tick value.
+ * @noval   Parameter values equal to 0 are not printed.
+ * @shift   Parameter value left shifts @shift, which is then printed instead 
of value.
+ *


   You should also describe the meaning of the function's result in a 
Return: section.



+ */
  static int get_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
   bool raw, bool noval, int shift,
   const char *name)
  {
u32 l;
-   int nr_bits, max_value, mask;
+   int nr_bits;
+   int mask;

l = gpmc_cs_read_reg(cs, reg);
nr_bits = end_bit - st_bit + 1;
-   max_value = (1  nr_bits) - 1;
-   mask = max_value  st_bit;
-   l = (l  mask)  st_bit;
+   mask = (1  nr_bits) - 1;


   BIT(nr_bits) - 1, perhaps?

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 7/7] usb: musb: dsps: remove babble check from dsps irq handler

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
 musb-int_usb already contains the correct
 information for musb-core to handle babble.

 In fact, this very check was just causing a
 nonsensical babble interrupt storm because.

because of what?


 With this I can get test.sh to run and, even though
 all tests fail with timeout, that's still better
 than locking up the system due to IRQ storm.

 Also, if I remove g_zero and load g_mass_storage,
 then everything works fine again.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_dsps.c | 22 --
  1 file changed, 22 deletions(-)

 diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
 index 53bd0e71d19f..5965ed69e457 100644
 --- a/drivers/usb/musb/musb_dsps.c
 +++ b/drivers/usb/musb/musb_dsps.c
 @@ -330,28 +330,6 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)

 dev_dbg(musb-controller, usbintr (%x) epintr(%x)\n,
 usbintr, epintr);
 -   /*
 -* DRVVBUS IRQs are the only proxy we have (a very poor one!) for
 -* DSPS IP's missing ID change IRQ.  We need an ID change IRQ to
 -* switch appropriately between halves of the OTG state machine.
 -* Managing DEVCTL.SESSION per Mentor docs requires that we know its
 -* value but DEVCTL.BDEVICE is invalid without DEVCTL.SESSION set.
 -* Also, DRVVBUS pulses for SRP (but not at 5V) ...
 -*/
 -   if (is_host_active(musb)  usbintr  MUSB_INTR_BABBLE) {
 -   pr_info(CAUTION: musb: Babble Interrupt Occurred\n);
 -
 -   /*
 -* When a babble condition occurs, the musb controller removes
 -* the session and is no longer in host mode. Hence, all
 -* devices connected to its root hub get disconnected.
 -*
 -* Hand this error down to the musb core isr, so it can
 -* recover.
 -*/
 -   musb-int_usb = MUSB_INTR_BABBLE | MUSB_INTR_DISCONNECT;
 -   musb-int_tx = musb-int_rx = 0;
 -   }

 if (usbintr  ((1  wrp-drvvbus)  wrp-usb_shift)) {
 int drvvbus = dsps_readl(reg_base, wrp-status);
 --
 2.3.0

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


[PATCH] USB: pl2303: disable break on shutdown

2015-02-26 Thread Johan Hovold
Currently an enabled break state is not disabled on final close nor on
re-open and has to be disabled manually.

Fix this by disabling break on port shutdown.

Reported-by: Jari Ruusu jariru...@users.sourceforge.net
Tested-by: Jari Ruusu jariru...@users.sourceforge.net
Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/usb/serial/pl2303.c | 18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c
index 0f872e6b2c87..829604d11f3f 100644
--- a/drivers/usb/serial/pl2303.c
+++ b/drivers/usb/serial/pl2303.c
@@ -132,6 +132,7 @@ MODULE_DEVICE_TABLE(usb, id_table);
 #define UART_OVERRUN_ERROR 0x40
 #define UART_CTS   0x80
 
+static void pl2303_set_break(struct usb_serial_port *port, bool enable);
 
 enum pl2303_type {
TYPE_01,/* Type 0 and 1 (difference unknown) */
@@ -615,6 +616,7 @@ static void pl2303_close(struct usb_serial_port *port)
 {
usb_serial_generic_close(port);
usb_kill_urb(port-interrupt_in_urb);
+   pl2303_set_break(port, false);
 }
 
 static int pl2303_open(struct tty_struct *tty, struct usb_serial_port *port)
@@ -741,17 +743,16 @@ static int pl2303_ioctl(struct tty_struct *tty,
return -ENOIOCTLCMD;
 }
 
-static void pl2303_break_ctl(struct tty_struct *tty, int break_state)
+static void pl2303_set_break(struct usb_serial_port *port, bool enable)
 {
-   struct usb_serial_port *port = tty-driver_data;
struct usb_serial *serial = port-serial;
u16 state;
int result;
 
-   if (break_state == 0)
-   state = BREAK_OFF;
-   else
+   if (enable)
state = BREAK_ON;
+   else
+   state = BREAK_OFF;
 
dev_dbg(port-dev, %s - turning break %s\n, __func__,
state == BREAK_OFF ? off : on);
@@ -763,6 +764,13 @@ static void pl2303_break_ctl(struct tty_struct *tty, int 
break_state)
dev_err(port-dev, error sending break = %d\n, result);
 }
 
+static void pl2303_break_ctl(struct tty_struct *tty, int state)
+{
+   struct usb_serial_port *port = tty-driver_data;
+
+   pl2303_set_break(port, state);
+}
+
 static void pl2303_update_line_status(struct usb_serial_port *port,
  unsigned char *data,
  unsigned int actual_length)
-- 
2.0.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 7/7] usb: musb: dsps: remove babble check from dsps irq handler

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 09:18:04AM -0600, Bin Liu wrote:
 Felipe,
 
 On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
  musb-int_usb already contains the correct
  information for musb-core to handle babble.
 
  In fact, this very check was just causing a
  nonsensical babble interrupt storm because.
 
 because of what?

because of that extra disconnect interrupt. As soon as I removed this,
the irq storm and unhandled disconnect stopped. Plus, the bit shifts
match exactly what we see on original musb registers, so we might as
well leave musb core handle it by just passing around int_usb to it.

Remember that the only thing that's am335x-specific is the ability to
reset the IP :-) MUSB core already had knowledge of babble.

-- 
balbi


signature.asc
Description: Digital signature


[PATCH 6/7] usb: musb: core: there is no connect interrupt in peripheral mode

2015-02-26 Thread Felipe Balbi
MUSB does not generate a connect IRQ when working
in peripheral mode.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 9beb724a586a..e23eb3e517de 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -761,10 +761,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
 
musb-ep0_stage = MUSB_EP0_START;
 
-   /* flush endpoints when transitioning from Device Mode */
-   if (is_peripheral_active(musb)) {
-   /* REVISIT HNP; just force disconnect */
-   }
musb-intrtxe = musb-epmask;
musb_writew(musb-mregs, MUSB_INTRTXE, musb-intrtxe);
musb-intrrxe = musb-epmask  0xfffe;
-- 
2.3.0

--
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: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
There was already a proper place where we were
checking for babble interrupts, move babble
recovery there.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2767ce1bf016..0569b24719e6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -892,6 +892,12 @@ b_host:
} else {
ERR(Stopping host session -- babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
+
+   if (is_host_active(musb)) {
+   musb_generic_disable(musb);
+   
schedule_delayed_work(musb-recover_work,
+   msecs_to_jiffies(100));
+   }
}
} else {
dev_dbg(musb-controller, BUS RESET as %s\n,
@@ -931,13 +937,6 @@ b_host:
}
}
 
-   /* handle babble condition */
-   if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb)) {
-   musb_generic_disable(musb);
-   schedule_delayed_work(musb-recover_work,
- msecs_to_jiffies(100));
-   }
-
 #if 0
 /* REVISIT ... this would be for multiplexing periodic endpoints, or
  * supporting transfer phasing to prevent exceeding ISO bandwidth
-- 
2.3.0

--
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] usb: musb: dsps: remove babble check from dsps irq handler

2015-02-26 Thread Felipe Balbi
musb-int_usb already contains the correct
information for musb-core to handle babble.

In fact, this very check was just causing a
nonsensical babble interrupt storm because.

With this I can get test.sh to run and, even though
all tests fail with timeout, that's still better
than locking up the system due to IRQ storm.

Also, if I remove g_zero and load g_mass_storage,
then everything works fine again.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 22 --
 1 file changed, 22 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 53bd0e71d19f..5965ed69e457 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -330,28 +330,6 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
 
dev_dbg(musb-controller, usbintr (%x) epintr(%x)\n,
usbintr, epintr);
-   /*
-* DRVVBUS IRQs are the only proxy we have (a very poor one!) for
-* DSPS IP's missing ID change IRQ.  We need an ID change IRQ to
-* switch appropriately between halves of the OTG state machine.
-* Managing DEVCTL.SESSION per Mentor docs requires that we know its
-* value but DEVCTL.BDEVICE is invalid without DEVCTL.SESSION set.
-* Also, DRVVBUS pulses for SRP (but not at 5V) ...
-*/
-   if (is_host_active(musb)  usbintr  MUSB_INTR_BABBLE) {
-   pr_info(CAUTION: musb: Babble Interrupt Occurred\n);
-
-   /*
-* When a babble condition occurs, the musb controller removes
-* the session and is no longer in host mode. Hence, all
-* devices connected to its root hub get disconnected.
-*
-* Hand this error down to the musb core isr, so it can
-* recover.
-*/
-   musb-int_usb = MUSB_INTR_BABBLE | MUSB_INTR_DISCONNECT;
-   musb-int_tx = musb-int_rx = 0;
-   }
 
if (usbintr  ((1  wrp-drvvbus)  wrp-usb_shift)) {
int drvvbus = dsps_readl(reg_base, wrp-status);
-- 
2.3.0

--
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: musb: core: remove unnecessary reg access from resume IRQ

2015-02-26 Thread Felipe Balbi
when musb is operating as host and a remote wakeup
fires up, a resume interrupt will be raised. At that
point SUSPENDM bit is automatically cleared and
RESUME bit is automatically set.

Remove those two from IRQ handler.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index ad895da33047..9beb724a586a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -538,27 +538,12 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
usb_otg_state_string(musb-xceiv-otg-state));
 
if (devctl  MUSB_DEVCTL_HM) {
-   void __iomem *mbase = musb-mregs;
-   u8 power;
-
switch (musb-xceiv-otg-state) {
case OTG_STATE_A_SUSPEND:
/* remote wakeup?  later, GetPortStatus
 * will stop RESUME signaling
 */
 
-   power = musb_readb(musb-mregs, MUSB_POWER);
-   if (power  MUSB_POWER_SUSPENDM) {
-   /* spurious */
-   musb-int_usb = ~MUSB_INTR_SUSPEND;
-   dev_dbg(musb-controller, Spurious 
SUSPENDM\n);
-   break;
-   }
-
-   power = ~MUSB_POWER_SUSPENDM;
-   musb_writeb(mbase, MUSB_POWER,
-   power | MUSB_POWER_RESUME);
-
musb-port1_status |=
(USB_PORT_STAT_C_SUSPEND  16)
| MUSB_PORT_STAT_RESUME;
-- 
2.3.0

--
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] can: kvaser_usb: Read all messages in a bulk-in URB buffer

2015-02-26 Thread Ahmed S. Darwish
From: Ahmed S. Darwish ahmed.darw...@valeo.com

The Kvaser firmware can only read and write messages that are
not crossing the USB endpoint's wMaxPacketSize boundary. While
receiving commands from the CAN device, if the next command in
the same URB buffer crossed that max packet size boundary, the
firmware puts a zero-length placeholder command in its place
then moves the real command to the next boundary mark.

The driver did not recognize such behavior, leading to missing
a good number of rx events during a heavy rx load session.

Moreover, a tx URB context only gets freed upon receiving its
respective tx ACK event. Over time, the free tx URB contexts
pool gets depleted due to the missing ACK events. Consequently,
the netif transmission queue gets __permanently__ stopped; no
frames could be sent again except after restarting the CAN
newtwork interface.

Signed-off-by: Ahmed S. Darwish ahmed.darw...@valeo.com
---
 drivers/net/can/usb/kvaser_usb.c | 28 +++-
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index d986fe8..a316fa4 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -14,6 +14,7 @@
  * Copyright (C) 2015 Valeo S.A.
  */
 
+#include linux/kernel.h
 #include linux/completion.h
 #include linux/module.h
 #include linux/netdevice.h
@@ -584,8 +585,15 @@ static int kvaser_usb_wait_msg(const struct kvaser_usb 
*dev, u8 id,
while (pos = actual_len - MSG_HEADER_LEN) {
tmp = buf + pos;
 
-   if (!tmp-len)
-   break;
+   /* Handle messages crossing the USB endpoint max packet
+* size boundary. Check kvaser_usb_read_bulk_callback()
+* for further details.
+*/
+   if (tmp-len == 0) {
+   pos = round_up(pos,
+  dev-bulk_in-wMaxPacketSize);
+   continue;
+   }
 
if (pos + tmp-len  actual_len) {
dev_err(dev-udev-dev.parent,
@@ -1316,8 +1324,19 @@ static void kvaser_usb_read_bulk_callback(struct urb 
*urb)
while (pos = urb-actual_length - MSG_HEADER_LEN) {
msg = urb-transfer_buffer + pos;
 
-   if (!msg-len)
-   break;
+   /* The Kvaser firmware can only read and write messages that
+* does not cross the USB's endpoint wMaxPacketSize boundary.
+* If a follow-up command crosses such boundary, firmware puts
+* a placeholder zero-length command in its place then aligns
+* the real command to the next max packet size.
+*
+* Handle such cases or we're going to miss a significant
+* number of events in case of a heavy rx load on the bus.
+*/
+   if (msg-len == 0) {
+   pos = round_up(pos, dev-bulk_in-wMaxPacketSize);
+   continue;
+   }
 
if (pos + msg-len  urb-actual_length) {
dev_err(dev-udev-dev.parent, Format error\n);
@@ -1325,7 +1344,6 @@ static void kvaser_usb_read_bulk_callback(struct urb *urb)
}
 
kvaser_usb_handle_message(dev, msg);
-
pos += msg-len;
}
 
-- 
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 4/7] usb: musb: core: break long line

2015-02-26 Thread Felipe Balbi
no functional changes, clean up only.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 0569b24719e6..ad895da33047 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -534,7 +534,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
 */
if (int_usb  MUSB_INTR_RESUME) {
handled = IRQ_HANDLED;
-   dev_dbg(musb-controller, RESUME (%s)\n, 
usb_otg_state_string(musb-xceiv-otg-state));
+   dev_dbg(musb-controller, RESUME (%s)\n,
+   usb_otg_state_string(musb-xceiv-otg-state));
 
if (devctl  MUSB_DEVCTL_HM) {
void __iomem *mbase = musb-mregs;
-- 
2.3.0

--
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] can: kvaser_usb: Utilize all possible tx URBs

2015-02-26 Thread Ahmed S. Darwish
From: Ahmed S. Darwish ahmed.darw...@valeo.com

The driver currently limits the number of outstanding, not yet
ACKed, transfers to 16 URBs. Meanwhile, the Kvaser firmware
provides its actual max supported number of outstanding
transmissions in its reply to the CMD_GET_SOFTWARE_INFO message.

One example is the UsbCan-II HS/LS device which reports support
of up to 48 tx URBs instead of just 16, increasing the driver
throughput by two-fold and reducing the possibility of -ENOBUFs.

Dynamically set the max tx URBs value according to firmware
replies.

Signed-off-by: Ahmed S. Darwish ahmed.darw...@valeo.com
---
 drivers/net/can/usb/kvaser_usb.c | 62 ++--
 1 file changed, 40 insertions(+), 22 deletions(-)

diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index a316fa4..8f835a1 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -24,7 +24,6 @@
 #include linux/can/dev.h
 #include linux/can/error.h
 
-#define MAX_TX_URBS16
 #define MAX_RX_URBS4
 #define START_TIMEOUT  1000 /* msecs */
 #define STOP_TIMEOUT   1000 /* msecs */
@@ -455,8 +454,13 @@ struct kvaser_usb {
struct usb_endpoint_descriptor *bulk_in, *bulk_out;
struct usb_anchor rx_submitted;
 
+   /* @max_tx_urbs: Firmware-reported maximum number of possible
+* outstanding transmissions on this specific Kvaser hardware. The
+* value is also used as a sentinel for marking free URB contexts.
+*/
u32 fw_version;
unsigned int nchannels;
+   unsigned int max_tx_urbs;
enum kvaser_usb_family family;
 
bool rxinitdone;
@@ -469,7 +473,7 @@ struct kvaser_usb_net_priv {
 
atomic_t active_tx_urbs;
struct usb_anchor tx_submitted;
-   struct kvaser_usb_tx_urb_context tx_contexts[MAX_TX_URBS];
+   struct kvaser_usb_tx_urb_context *tx_contexts;
 
struct completion start_comp, stop_comp;
 
@@ -655,9 +659,13 @@ static int kvaser_usb_get_software_info(struct kvaser_usb 
*dev)
switch (dev-family) {
case KVASER_LEAF:
dev-fw_version = le32_to_cpu(msg.u.leaf.softinfo.fw_version);
+   dev-max_tx_urbs =
+   le16_to_cpu(msg.u.leaf.softinfo.max_outstanding_tx);
break;
case KVASER_USBCAN:
dev-fw_version = le32_to_cpu(msg.u.usbcan.softinfo.fw_version);
+   dev-max_tx_urbs =
+   le16_to_cpu(msg.u.usbcan.softinfo.max_outstanding_tx);
break;
}
 
@@ -712,7 +720,7 @@ static void kvaser_usb_tx_acknowledge(const struct 
kvaser_usb *dev,
 
stats = priv-netdev-stats;
 
-   context = priv-tx_contexts[tid % MAX_TX_URBS];
+   context = priv-tx_contexts[tid % dev-max_tx_urbs];
 
/* Sometimes the state change doesn't come after a bus-off event */
if (priv-can.restart_ms 
@@ -739,7 +747,7 @@ static void kvaser_usb_tx_acknowledge(const struct 
kvaser_usb *dev,
stats-tx_bytes += context-dlc;
can_get_echo_skb(priv-netdev, context-echo_index);
 
-   context-echo_index = MAX_TX_URBS;
+   context-echo_index = dev-max_tx_urbs;
atomic_dec(priv-active_tx_urbs);
 
netif_wake_queue(priv-netdev);
@@ -805,13 +813,14 @@ static int kvaser_usb_simple_msg_async(struct 
kvaser_usb_net_priv *priv,
 
 static void kvaser_usb_unlink_tx_urbs(struct kvaser_usb_net_priv *priv)
 {
+   struct kvaser_usb *dev = priv-dev;
int i;
 
usb_kill_anchored_urbs(priv-tx_submitted);
atomic_set(priv-active_tx_urbs, 0);
 
-   for (i = 0; i  MAX_TX_URBS; i++)
-   priv-tx_contexts[i].echo_index = MAX_TX_URBS;
+   for (i = 0; i  dev-max_tx_urbs; i++)
+   priv-tx_contexts[i].echo_index = dev-max_tx_urbs;
 }
 
 static void kvaser_usb_rx_error_update_can_state(struct kvaser_usb_net_priv 
*priv,
@@ -1687,8 +1696,8 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff 
*skb,
if (cf-can_id  CAN_RTR_FLAG)
*msg_tx_can_flags |= MSG_FLAG_REMOTE_FRAME;
 
-   for (i = 0; i  ARRAY_SIZE(priv-tx_contexts); i++) {
-   if (priv-tx_contexts[i].echo_index == MAX_TX_URBS) {
+   for (i = 0; i  dev-max_tx_urbs; i++) {
+   if (priv-tx_contexts[i].echo_index ==  dev-max_tx_urbs) {
context = priv-tx_contexts[i];
break;
}
@@ -1720,7 +1729,7 @@ static netdev_tx_t kvaser_usb_start_xmit(struct sk_buff 
*skb,
 
atomic_inc(priv-active_tx_urbs);
 
-   if (atomic_read(priv-active_tx_urbs) = MAX_TX_URBS)
+   if (atomic_read(priv-active_tx_urbs) = dev-max_tx_urbs)
netif_stop_queue(netdev);
 
err = usb_submit_urb(urb, GFP_ATOMIC);
@@ -1860,7 +1869,7 @@ static int kvaser_usb_init_one(struct usb_interface *intf,
if (err)

[PATCH 4/8] ARM OMAP2+ GPMC: change get_gpmc_timing_reg output for DTS

2015-02-26 Thread Robert ABEL
DTS output was formatted to require additional work when copy-pasting into DTS.
Nano-second timings were replaced with interval of values that produce the same
number of clock ticks.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 35 ++-
 1 file changed, 26 insertions(+), 9 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index dbb6753..9340e7a 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -337,32 +337,49 @@ static void gpmc_cs_bool_timings(int cs, const struct 
gpmc_bool_timings *p)
 }
 
 #ifdef DEBUG
+/**
+ * get_gpmc_timing_reg - read a timing parameter and print DTS settings for it.
+ * @cs  Chip Select Region
+ * @reg GPMC_CS_CONFIGn register offset.
+ * @st_bit  Start Bit
+ * @end_bit End Bit. Must be = @st_bit.
+ * @nameDTS node name, w/o gpmc,
+ * @raw Raw Format Option.
+ *  raw format:  gpmc,name = value
+ *  tick format: gpmc,name = value /zwj;*(x ns -- y ns]; x ticks 
*zwj;/
+ *  Where (x ns -- y ns] is the half-open interval from x ns to y ns 
that
+ *  result in the same tick value.
+ * @noval   Parameter values equal to 0 are not printed.
+ * @shift   Parameter value left shifts @shift, which is then printed instead 
of value.
+ *
+ */
 static int get_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
   bool raw, bool noval, int shift,
   const char *name)
 {
u32 l;
-   int nr_bits, max_value, mask;
+   int nr_bits;
+   int mask;
 
l = gpmc_cs_read_reg(cs, reg);
nr_bits = end_bit - st_bit + 1;
-   max_value = (1  nr_bits) - 1;
-   mask = max_value  st_bit;
-   l = (l  mask)  st_bit;
+   mask = (1  nr_bits) - 1;
+   l = (l  st_bit)  mask;
if (shift)
l = (shift  l);
if (noval  (l == 0))
return 0;
if (!raw) {
-   unsigned int time_ns_min, time_ns, time_ns_max;
+   /* DTS tick format for timings in ns */
+   unsigned int time_ns;
+   unsigned int time_ns_min;
 
time_ns_min = gpmc_ticks_to_ns(l ? l - 1 : 0);
time_ns = gpmc_ticks_to_ns(l);
-   time_ns_max = gpmc_ticks_to_ns(l + 1  max_value ?
-  max_value : l + 1);
-   pr_info(gpmc,%s = %u (%u - %u ns, %i ticks)\n,
-   name, time_ns, time_ns_min, time_ns_max, l);
+   pr_info(gpmc,%s = %u /* (%u ns - %u ns]; %i ticks */\n,
+   name, time_ns, time_ns_min, time_ns, l);
} else {
+   /* raw format */
pr_info(gpmc,%s = %u\n, name, l);
}
 
-- 
2.3.0

--
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/8] ARM OMAP2+ GPMC: add bus children

2015-02-26 Thread Robert ABEL
This patch adds support for spawning buses as children of the GPMC.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 5cabac8..74a8c52 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -27,6 +27,7 @@
 #include linux/of_address.h
 #include linux/of_mtd.h
 #include linux/of_device.h
+#include linux/of_platform.h
 #include linux/omap-gpmc.h
 #include linux/mtd/nand.h
 #include linux/pm_runtime.h
@@ -1800,8 +1801,20 @@ static int gpmc_probe_generic_child(struct 
platform_device *pdev,
gpmc_cs_enable_mem(cs);
 
 no_timings:
-   if (of_platform_device_create(child, NULL, pdev-dev))
-   return 0;
+
+   /* create platform device, NULL on error or when disabled */
+   if (!of_platform_device_create(child, NULL, pdev-dev))
+   goto err_child_fail;
+
+   /* is child a common bus? */
+   if (of_match_node(of_default_bus_match_table, child))
+   /* create children and other common bus children */
+   if (of_platform_populate(child, of_default_bus_match_table, 
NULL, pdev-dev))
+   goto err_child_fail;
+
+   return 0;
+
+err_child_fail:
 
dev_err(pdev-dev, failed to create gpmc child %s\n, child-name);
ret = -ENODEV;
-- 
2.3.0

--
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/8] ARM OMAP2+ GPMC: fixes and bus children

2015-02-26 Thread Robert ABEL
These are the changes I proposed in three separate patchsets
#([1], [2], [3]) rebased to 3.19 as well as new changes for little bugs
I noticed while preparing this patchset.

1. DEBUG was undefined in source code -- remove offending lines
2. add capability to have busses as children of the GPMC and multiple
   devices on a bus. See [2] for an example DTS syntax.
3. debug output was unaligned -- align it
4. output for copy-pasting to DTS had erroneous timing outputs and
   made it hard to copy-paste -- correct timing values, add comments
   as DTS comments.
5. WAITMONITORINGTIME is expressed as GPMC_CLK cycles for all accesses.
   GPMCFCLKDIVIDER is used as a divider, so it must always be programmed.
6. GPMCFCLKDIVIDER is calculated according to WAITMONITORINGTIME for
   asynchronous accesses inside the driver -- asynchronous accesses now
   completely decoupled from gpmc,sync-clk-ps.
7. WAITMONITORINGTIME was being programmed/shown in GPMC_FCLK cycles instead
   of GPMC_CLK cycles -- add clock domain information where necessary.
8. Calculated values for WAITMONITORINGTIME and CLKACTIVATIONTIME that were
   outside the defined range would not raise an error.
   DEVICESIZE, ATTACHEDDEVICEPAGELENGTH, WAITMONITORINGTIME and
   CLKACTIVATIONTIME would not be marked as incorrect on DTS output.
   -- Fix all of these.

[1]: https://lkml.org/lkml/2015/2/12/495
[2]: https://lkml.org/lkml/2015/2/16/337
[3]: https://lkml.org/lkml/2015/2/24/609

Robert ABEL (9):
  ARM OMAP2+ GPMC: don't undef DEBUG
  ARM OMAP2+ GPMC: add bus children
  ARM OMAP2+ GPMC: fix debug output alignment
  ARM OMAP2+ GPMC: change get_gpmc_timing_reg output for DTS
  ARM OMAP2+ GPMC: always program GPMCFCLKDIVIDER
  ARM OMAP2+ GPMC: calculate GPMCFCLKDIVIDER based on WAITMONITORINGTIME
  ARM OMAP2+ GPMC: fix WAITMONITORINGTIME divider bug
  ARM OMAP2+ GPMC: fix programming/showing reserved timing parameters

 arch/arm/mach-omap2/gpmc-nand.c|  17 +-
 arch/arm/mach-omap2/gpmc-onenand.c |   4 +-
 arch/arm/mach-omap2/usb-tusb6010.c |   4 +-
 drivers/memory/Makefile|   2 +
 drivers/memory/omap-gpmc.c | 313 +
 include/linux/omap-gpmc.h  |   2 +-
 6 files changed, 265 insertions(+), 77 deletions(-)

-- 
2.3.0

--
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/8] ARM OMAP2+ GPMC: fix debug output alignment

2015-02-26 Thread Robert ABEL
GPMC debug output is aligned to 10 characters for field names.
However, some fields have bigger names, screwing up the alignment.
Consequently, alignment was changed to longest field name (17 chars) for now.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 74a8c52..dbb6753 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -482,7 +482,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, 
int end_bit,
l = gpmc_cs_read_reg(cs, reg);
 #ifdef DEBUG
printk(KERN_INFO
-   GPMC CS%d: %-10s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n,
+   GPMC CS%d: %-17s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n,
   cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000,
(l  st_bit)  mask, time);
 #endif
-- 
2.3.0

--
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/8] ARM OMAP2+ GPMC: don't undef DEBUG

2015-02-26 Thread Robert ABEL
OMAP2+ GPMC driver undefines DEBUG, which makes it unnecessarily
hard to turn DEBUG on. Remove the offending lines.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 24696f5..5cabac8 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -12,8 +12,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-#undef DEBUG
-
 #include linux/irq.h
 #include linux/kernel.h
 #include linux/init.h
-- 
2.3.0

--
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 8/8] ARM OMAP2+ GPMC: fix programming/showing reserved timing parameters

2015-02-26 Thread Robert ABEL
GPMC_CONFIG1_i parameters CLKACTIVATIONTIME and WAITMONITORINGTIME
have reserved values.
Raise an error if calculated timings try to program reserved values.

GPMC_CONFIG1_i ATTACHEDDEVICEPAGELENGTH and DEVICESIZE were already checked
when parsing the DT.

Explicitly comment invalid values on gpmc_cs_show_timings for
-CLKACTIVATIONTIME
-WAITMONITORINGTIME
-DEVICESIZE
-ATTACHEDDEVICEPAGELENGTH

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 68 ++
 1 file changed, 45 insertions(+), 23 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 400b0a6..7e5300d 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -135,7 +135,11 @@
 #define GPMC_CONFIG1_WRITETYPE_ASYNC(0  27)
 #define GPMC_CONFIG1_WRITETYPE_SYNC (1  27)
 #define GPMC_CONFIG1_CLKACTIVATIONTIME(val) ((val  3)  25)
+/** CLKACTIVATIONTIME Max Ticks */
+#define GPMC_CONFIG1_CLKACTIVATIONTIME_MAX 2
 #define GPMC_CONFIG1_PAGE_LEN(val)  ((val  3)  23)
+/** ATTACHEDDEVICEPAGELENGTH Max Value */
+#define GPMC_CONFIG1_ATTACHEDDEVICEPAGELENGTH_MAX 2
 #define GPMC_CONFIG1_WAIT_READ_MON  (1  22)
 #define GPMC_CONFIG1_WAIT_WRITE_MON (1  21)
 #define GPMC_CONFIG1_WAIT_MON_TIME(val) ((val  3)  18)
@@ -144,6 +148,8 @@
 #define GPMC_CONFIG1_WAIT_PIN_SEL(val)  ((val  3)  16)
 #define GPMC_CONFIG1_DEVICESIZE(val)((val  3)  12)
 #define GPMC_CONFIG1_DEVICESIZE_16  GPMC_CONFIG1_DEVICESIZE(1)
+/** DEVICESIZE Max Value */
+#define GPMC_CONFIG1_DEVICESIZE_MAX 1
 #define GPMC_CONFIG1_DEVICETYPE(val)((val  3)  10)
 #define GPMC_CONFIG1_DEVICETYPE_NOR GPMC_CONFIG1_DEVICETYPE(0)
 #define GPMC_CONFIG1_MUXTYPE(val)   ((val  3)  8)
@@ -393,6 +399,8 @@ static void gpmc_cs_bool_timings(int cs, const struct 
gpmc_bool_timings *p)
  * @reg GPMC_CS_CONFIGn register offset.
  * @st_bit  Start Bit
  * @end_bit End Bit. Must be = @st_bit.
+ * @max Maximum parameter value (before optional @shift).
+ *  If 0, maximum is as high as @st_bit and @end_bit allow.
  * @nameDTS node name, w/o gpmc,
  * @cd  Clock Domain of timing parameter.
  * @shift   Parameter value left shifts @shift, which is then printed instead 
of value.
@@ -401,12 +409,13 @@ static void gpmc_cs_bool_timings(int cs, const struct 
gpmc_bool_timings *p)
  *  tick format: gpmc,name = value /zwj;*(x ns -- y ns]; x ticks 
*zwj;/
  *  Where (x ns -- y ns] is the half-open interval from x ns to y ns 
that
  *  result in the same tick value.
+ *  When @max is exceeded, invalid is printed inside comment.
  * @noval   Parameter values equal to 0 are not printed.
  *
  */
 static int get_gpmc_timing_reg(
/* timing specifiers */
-   int cs, int reg, int st_bit, int end_bit,
+   int cs, int reg, int st_bit, int end_bit, int max,
const char *name, const enum gpmc_clk_domain cd,
/* value transform */
int shift,
@@ -416,11 +425,15 @@ static int get_gpmc_timing_reg(
u32 l;
int nr_bits;
int mask;
+   bool invalid;
 
l = gpmc_cs_read_reg(cs, reg);
nr_bits = end_bit - st_bit + 1;
mask = (1  nr_bits) - 1;
l = (l  st_bit)  mask;
+   if (!max)
+   max = mask;
+   invalid = l  max;
if (shift)
l = (shift  l);
if (noval  (l == 0))
@@ -432,11 +445,11 @@ static int get_gpmc_timing_reg(
 
time_ns_min = gpmc_clk_ticks_to_ns(l ? l - 1 : 0, cs, cd);
time_ns = gpmc_clk_ticks_to_ns(l, cs, cd);
-   pr_info(gpmc,%s = %u /* (%u ns - %u ns]; %i ticks */\n,
-   name, time_ns, time_ns_min, time_ns, l);
+   pr_info(gpmc,%s = %u /* (%u ns - %u ns]; %i ticks %s*/\n,
+   name, time_ns, time_ns_min, time_ns, l, invalid ? ; 
invalid  : );
} else {
/* raw format */
-   pr_info(gpmc,%s = %u\n, name, l);
+   pr_info(gpmc,%s = %u%s\n, name, l, invalid ?  /* invalid 
*/ : );
}
 
return l;
@@ -446,15 +459,19 @@ static int get_gpmc_timing_reg(
pr_info(cs%i %s: 0x%08x\n, cs, #config, \
gpmc_cs_read_reg(cs, config))
 #define GPMC_GET_RAW(reg, st, end, field) \
-   get_gpmc_timing_reg(cs, (reg), (st), (end), field, GPMC_CD_FCLK, 0, 1, 
0)
+   get_gpmc_timing_reg(cs, (reg), (st), (end), 0, field, GPMC_CD_FCLK, 0, 
1, 0)
+#define GPMC_GET_RAW_MAX(reg, st, end, max, field) \
+   get_gpmc_timing_reg(cs, (reg), (st), (end), (max), field, GPMC_CD_FCLK, 
0, 1, 0)
 #define GPMC_GET_RAW_BOOL(reg, st, end, field) \
-   get_gpmc_timing_reg(cs, (reg), (st), (end), field, GPMC_CD_FCLK, 0, 1, 
1)
-#define GPMC_GET_RAW_SHIFT(reg, st, end, shift, field) \
-   get_gpmc_timing_reg(cs, (reg), (st), (end), field, GPMC_CD_FCLK, 
(shift), 1, 1)
+   get_gpmc_timing_reg(cs, (reg), (st), (end), 0, field, 

Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
 There was already a proper place where we were
 checking for babble interrupts, move babble
 recovery there.

I commented on the same before, discussed in [1].

[1]: http://marc.info/?l=linux-usbm=140109400304196w=2



 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_core.c | 13 ++---
  1 file changed, 6 insertions(+), 7 deletions(-)

 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index 2767ce1bf016..0569b24719e6 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -892,6 +892,12 @@ b_host:
 } else {
 ERR(Stopping host session -- babble\n);
 musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
 +
 +   if (is_host_active(musb)) {
 +   musb_generic_disable(musb);
 +   
 schedule_delayed_work(musb-recover_work,
 +   
 msecs_to_jiffies(100));
 +   }
 }
 } else {
 dev_dbg(musb-controller, BUS RESET as %s\n,
 @@ -931,13 +937,6 @@ b_host:
 }
 }

 -   /* handle babble condition */
 -   if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb)) {
 -   musb_generic_disable(musb);
 -   schedule_delayed_work(musb-recover_work,
 - msecs_to_jiffies(100));
 -   }
 -
  #if 0
  /* REVISIT ... this would be for multiplexing periodic endpoints, or
   * supporting transfer phasing to prevent exceeding ISO bandwidth
 --
 2.3.0

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


[PATCH 1/7] usb: musb: core: remove unnecessary logical comparison

2015-02-26 Thread Felipe Balbi
devctl  MUSB_DEVCTL_HM represents a single bit,
just check for the bit, there's really no need
to compare the result against 0.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2b018cf11106..625ff4321505 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -879,7 +879,7 @@ b_host:
 */
if (int_usb  MUSB_INTR_RESET) {
handled = IRQ_HANDLED;
-   if ((devctl  MUSB_DEVCTL_HM) != 0) {
+   if (devctl  MUSB_DEVCTL_HM) {
/*
 * Looks like non-HS BABBLE can be ignored, but
 * HS BABBLE is an error condition. For HS the solution
-- 
2.3.0

--
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/8] ARM OMAP2+ GPMC: fix WAITMONITORINGTIME divider bug

2015-02-26 Thread Robert ABEL
The WAITMONITORINGTIME is expressed as a number of GPMC_CLK clock cycles,
even though the access is defined as asynchronous, and no GPMC_CLK clock
is provided to the external device. Still, GPMCFCLKDIVIDER is used as a divider
for the GPMC clock, so it must be programmed to define the
correct WAITMONITORINGTIME delay.

This patch correctly computes WAITMONITORINGTIME in GPMC_CLK cycles instead of 
GPMC_FCLK cycles,
both during programming (gpmc_cs_set_timings) and during retrieval 
(gpmc_cs_show_timings).

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 126 +++--
 1 file changed, 99 insertions(+), 27 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index d71ea05..400b0a6 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -170,6 +170,11 @@
  */
 #defineGPMC_NR_IRQ 2
 
+enum gpmc_clk_domain {
+   GPMC_CD_FCLK,
+   GPMC_CD_CLK
+};
+
 struct gpmc_cs_data {
const char *name;
 
@@ -268,16 +273,54 @@ static unsigned long gpmc_get_fclk_period(void)
return rate;
 }
 
-static unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
+/**
+ * gpmc_get_clk_period - get period of selected clock domain in ps
+ * @cs Chip Select Region.
+ * @cd Clock Domain.
+ *
+ * GPMC_CS_CONFIG1 GPMCFCLKDIVIDER for cs has to be setup
+ * prior to calling this function with GPMC_CD_CLK.
+ */
+static unsigned long gpmc_get_clk_period(int cs, enum gpmc_clk_domain cd)
+{
+
+   unsigned long tick_ps = gpmc_get_fclk_period();
+   u32 l;
+   int div;
+
+   switch (cd) {
+   case GPMC_CD_CLK:
+   /* get current clk divider */
+   l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
+   div = (l  0x03) + 1;
+   /* get GPMC_CLK period */
+   tick_ps *= div;
+   break;
+   case GPMC_CD_FCLK:
+   /* FALL-THROUGH */
+   default:
+   break;
+   }
+
+   return tick_ps;
+
+}
+
+static unsigned int gpmc_ns_to_clk_ticks(unsigned int time_ns, int cs, enum 
gpmc_clk_domain cd)
 {
unsigned long tick_ps;
 
/* Calculate in picosecs to yield more exact results */
-   tick_ps = gpmc_get_fclk_period();
+   tick_ps = gpmc_get_clk_period(cs, cd);
 
return (time_ns * 1000 + tick_ps - 1) / tick_ps;
 }
 
+static unsigned int gpmc_ns_to_ticks(unsigned int time_ns)
+{
+   return gpmc_ns_to_clk_ticks(time_ns, /* any CS */ 0, GPMC_CD_FCLK);
+}
+
 static unsigned int gpmc_ps_to_ticks(unsigned int time_ps)
 {
unsigned long tick_ps;
@@ -288,9 +331,14 @@ static unsigned int gpmc_ps_to_ticks(unsigned int time_ps)
return (time_ps + tick_ps - 1) / tick_ps;
 }
 
+unsigned int gpmc_clk_ticks_to_ns(unsigned ticks, int cs, enum gpmc_clk_domain 
cd)
+{
+   return ticks * gpmc_get_clk_period(cs, cd) / 1000;
+}
+
 unsigned int gpmc_ticks_to_ns(unsigned int ticks)
 {
-   return ticks * gpmc_get_fclk_period() / 1000;
+   return gpmc_clk_ticks_to_ns(ticks, /* any CS */ 0, GPMC_CD_FCLK);
 }
 
 static unsigned int gpmc_ticks_to_ps(unsigned int ticks)
@@ -346,18 +394,24 @@ static void gpmc_cs_bool_timings(int cs, const struct 
gpmc_bool_timings *p)
  * @st_bit  Start Bit
  * @end_bit End Bit. Must be = @st_bit.
  * @nameDTS node name, w/o gpmc,
+ * @cd  Clock Domain of timing parameter.
+ * @shift   Parameter value left shifts @shift, which is then printed instead 
of value.
  * @raw Raw Format Option.
  *  raw format:  gpmc,name = value
  *  tick format: gpmc,name = value /zwj;*(x ns -- y ns]; x ticks 
*zwj;/
  *  Where (x ns -- y ns] is the half-open interval from x ns to y ns 
that
  *  result in the same tick value.
  * @noval   Parameter values equal to 0 are not printed.
- * @shift   Parameter value left shifts @shift, which is then printed instead 
of value.
  *
  */
-static int get_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
-  bool raw, bool noval, int shift,
-  const char *name)
+static int get_gpmc_timing_reg(
+   /* timing specifiers */
+   int cs, int reg, int st_bit, int end_bit,
+   const char *name, const enum gpmc_clk_domain cd,
+   /* value transform */
+   int shift,
+   /* format specifiers */
+   bool raw, bool noval)
 {
u32 l;
int nr_bits;
@@ -376,8 +430,8 @@ static int get_gpmc_timing_reg(int cs, int reg, int st_bit, 
int end_bit,
unsigned int time_ns;
unsigned int time_ns_min;
 
-   time_ns_min = gpmc_ticks_to_ns(l ? l - 1 : 0);
-   time_ns = gpmc_ticks_to_ns(l);
+   time_ns_min = gpmc_clk_ticks_to_ns(l ? l - 1 : 0, cs, cd);
+   time_ns = gpmc_clk_ticks_to_ns(l, cs, cd);
pr_info(gpmc,%s = %u /* (%u ns - %u ns]; %i ticks */\n,
name, 

Re: [PATCH v3] xhci: fix reporting of 0-sized URBs in control endpoint

2015-02-26 Thread Alan Stern
On Thu, 26 Feb 2015, Mathias Nyman wrote:

 I'm starting to like your idea of setting the urb-actual_length in advance,
 It may actually simplify things.

But it will make unlinking more difficult.  Also, what will you do if 
there is more than one TRB?

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 5/8] ARM OMAP2+ GPMC: always program GPMCFCLKDIVIDER

2015-02-26 Thread Robert ABEL
The WAITMONITORINGTIME is expressed as a number of GPMC_CLK clock cycles,
even though the access is defined as asynchronous, and no GPMC_CLK clock
is provided to the external device. Still, GPMCFCLKDIVIDER is used as a divider
for the GPMC clock, so it must be programmed to define the
correct WAITMONITORINGTIME delay.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 drivers/memory/omap-gpmc.c | 17 ++---
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 9340e7a..4139f0d 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -498,7 +498,7 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, 
int end_bit,
 
l = gpmc_cs_read_reg(cs, reg);
 #ifdef DEBUG
-   printk(KERN_INFO
+   pr_info(
GPMC CS%d: %-17s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n,
   cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000,
(l  st_bit)  mask, time);
@@ -570,19 +570,14 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings 
*t)
if (gpmc_capability  GPMC_HAS_WR_ACCESS)
GPMC_SET_ONE(GPMC_CS_CONFIG6, 24, 28, wr_access);
 
-   /* caller is expected to have initialized CONFIG1 to cover
-* at least sync vs async
-*/
l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1);
-   if (l  (GPMC_CONFIG1_READTYPE_SYNC | GPMC_CONFIG1_WRITETYPE_SYNC)) {
 #ifdef DEBUG
-   printk(KERN_INFO GPMC CS%d CLK period is %lu ns (div %d)\n,
-   cs, (div * gpmc_get_fclk_period()) / 1000, div);
+   pr_info(GPMC CS%d CLK period is %lu ns (div %d)\n,
+   cs, (div * gpmc_get_fclk_period()) / 1000, div);
 #endif
-   l = ~0x03;
-   l |= (div - 1);
-   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
-   }
+   l = ~0x03;
+   l |= (div - 1);
+   gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l);
 
gpmc_cs_bool_timings(cs, t-bool_timings);
gpmc_cs_show_timings(cs, after gpmc_cs_set_timings);
-- 
2.3.0

--
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/8] ARM OMAP2+ GPMC: calculate GPMCFCLKDIVIDER based on WAITMONITORINGTIME

2015-02-26 Thread Robert ABEL
The WAITMONITORINGTIME is expressed as a number of GPMC_CLK clock cycles,
even though the access is defined as asynchronous, and no GPMC_CLK clock
is provided to the external device. Still, GPMCFCLKDIVIDER is used as a divider
for the GPMC clock, so it must be programmed to define the
correct WAITMONITORINGTIME delay.

Calculate GPMCFCLKDIVIDER independent of gpmc,sync-clk-ps in DT for
pure asynchronous accesses, i.e. both read and write asynchronous.

Signed-off-by: Robert ABEL ra...@cit-ec.uni-bielefeld.de
---
 arch/arm/mach-omap2/gpmc-nand.c| 17 
 arch/arm/mach-omap2/gpmc-onenand.c |  4 +-
 arch/arm/mach-omap2/usb-tusb6010.c |  4 +-
 drivers/memory/omap-gpmc.c | 82 ++
 include/linux/omap-gpmc.h  |  2 +-
 5 files changed, 89 insertions(+), 20 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc-nand.c b/arch/arm/mach-omap2/gpmc-nand.c
index d5951b1..e863a59 100644
--- a/arch/arm/mach-omap2/gpmc-nand.c
+++ b/arch/arm/mach-omap2/gpmc-nand.c
@@ -96,14 +96,6 @@ int gpmc_nand_init(struct omap_nand_platform_data 
*gpmc_nand_data,
gpmc_nand_res[1].start = gpmc_get_client_irq(GPMC_IRQ_FIFOEVENTENABLE);
gpmc_nand_res[2].start = gpmc_get_client_irq(GPMC_IRQ_COUNT_EVENT);
 
-   if (gpmc_t) {
-   err = gpmc_cs_set_timings(gpmc_nand_data-cs, gpmc_t);
-   if (err  0) {
-   pr_err(omap2-gpmc: Unable to set gpmc timings: %d\n, 
err);
-   return err;
-   }
-   }
-
memset(s, 0, sizeof(struct gpmc_settings));
if (gpmc_nand_data-of_node)
gpmc_read_settings_dt(gpmc_nand_data-of_node, s);
@@ -111,6 +103,15 @@ int gpmc_nand_init(struct omap_nand_platform_data 
*gpmc_nand_data,
gpmc_set_legacy(gpmc_nand_data, s);
 
s.device_nand = true;
+
+   if (gpmc_t) {
+   err = gpmc_cs_set_timings(gpmc_nand_data-cs, gpmc_t, s);
+   if (err  0) {
+   pr_err(omap2-gpmc: Unable to set gpmc timings: %d\n, 
err);
+   return err;
+   }
+   }
+
err = gpmc_cs_program_settings(gpmc_nand_data-cs, s);
if (err  0)
goto out_free_cs;
diff --git a/arch/arm/mach-omap2/gpmc-onenand.c 
b/arch/arm/mach-omap2/gpmc-onenand.c
index 53d197e..f899e77 100644
--- a/arch/arm/mach-omap2/gpmc-onenand.c
+++ b/arch/arm/mach-omap2/gpmc-onenand.c
@@ -293,7 +293,7 @@ static int omap2_onenand_setup_async(void __iomem 
*onenand_base)
if (ret  0)
return ret;
 
-   ret = gpmc_cs_set_timings(gpmc_onenand_data-cs, t);
+   ret = gpmc_cs_set_timings(gpmc_onenand_data-cs, t, onenand_async);
if (ret  0)
return ret;
 
@@ -331,7 +331,7 @@ static int omap2_onenand_setup_sync(void __iomem 
*onenand_base, int *freq_ptr)
if (ret  0)
return ret;
 
-   ret = gpmc_cs_set_timings(gpmc_onenand_data-cs, t);
+   ret = gpmc_cs_set_timings(gpmc_onenand_data-cs, t, onenand_sync);
if (ret  0)
return ret;
 
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c 
b/arch/arm/mach-omap2/usb-tusb6010.c
index 8333400..e554d9e 100644
--- a/arch/arm/mach-omap2/usb-tusb6010.c
+++ b/arch/arm/mach-omap2/usb-tusb6010.c
@@ -71,7 +71,7 @@ static int tusb_set_async_mode(unsigned sysclk_ps)
 
gpmc_calc_timings(t, tusb_async, dev_t);
 
-   return gpmc_cs_set_timings(async_cs, t);
+   return gpmc_cs_set_timings(async_cs, t, tusb_async);
 }
 
 static int tusb_set_sync_mode(unsigned sysclk_ps)
@@ -98,7 +98,7 @@ static int tusb_set_sync_mode(unsigned sysclk_ps)
 
gpmc_calc_timings(t, tusb_sync, dev_t);
 
-   return gpmc_cs_set_timings(sync_cs, t);
+   return gpmc_cs_set_timings(sync_cs, t, tusb_sync);
 }
 
 /* tusb driver calls this when it changes the chip's clocking */
diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
index 4139f0d..d71ea05 100644
--- a/drivers/memory/omap-gpmc.c
+++ b/drivers/memory/omap-gpmc.c
@@ -138,7 +138,9 @@
 #define GPMC_CONFIG1_PAGE_LEN(val)  ((val  3)  23)
 #define GPMC_CONFIG1_WAIT_READ_MON  (1  22)
 #define GPMC_CONFIG1_WAIT_WRITE_MON (1  21)
-#define GPMC_CONFIG1_WAIT_MON_IIME(val) ((val  3)  18)
+#define GPMC_CONFIG1_WAIT_MON_TIME(val) ((val  3)  18)
+/** WAITMONITORINGTIME Max Ticks */
+#define GPMC_CONFIG1_WAITMONITORINGTIME_MAX  2
 #define GPMC_CONFIG1_WAIT_PIN_SEL(val)  ((val  3)  16)
 #define GPMC_CONFIG1_DEVICESIZE(val)((val  3)  12)
 #define GPMC_CONFIG1_DEVICESIZE_16  GPMC_CONFIG1_DEVICESIZE(1)
@@ -515,13 +517,46 @@ static int set_gpmc_timing_reg(int cs, int reg, int 
st_bit, int end_bit,
t-field, #field)  0)  \
return -1
 
+/**
+ * gpmc_calc_waitmonitoring_divider - calculate proper GPMCFCLKDIVIDER based 
on WAITMONITORINGTIME
+ * @wait_monitoring WAITMONITORINGTIME in ns.
+ * @return  -1 on failure to scale, else 

[PATCH 2/7] usb: musb: core: add missing curly braces

2015-02-26 Thread Felipe Balbi
no functional changes, clean up only.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 625ff4321505..2767ce1bf016 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -887,9 +887,9 @@ b_host:
 * caused BABBLE. When HS BABBLE happens we can only
 * stop the session.
 */
-   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV))
+   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV)) {
dev_dbg(musb-controller, BABBLE devctl: 
%02x\n, devctl);
-   else {
+   } else {
ERR(Stopping host session -- babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
}
-- 
2.3.0

--
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 v3] xhci: fix reporting of 0-sized URBs in control endpoint

2015-02-26 Thread Mathias Nyman
On 26.02.2015 16:57, Alan Stern wrote:
 On Thu, 26 Feb 2015, Mathias Nyman wrote:
 
 I'm starting to like your idea of setting the urb-actual_length in advance,
 It may actually simplify things.
 
 But it will make unlinking more difficult.  Also, what will you do if 
 there is more than one TRB?
 

current xhci driver can't handle more than one data trb in control tranfers:
xhci-ring.c,

int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
struct urb *urb, int slot_id, unsigned int ep_index)
...
  /* 1 TRB for setup, 1 for status */
num_trbs = 2;
/*  

 * Don't need to check if we need additional event data and normal 
TRBs,
 * since data in control transfers will never get bigger than 16MB  

 * XXX: can we get a buffer that crosses 64KB boundaries?   

 */
if (urb-transfer_buffer_length  0)
num_trbs++;


Shouldn't control urbs only be given back when they finish (SUCCESS, STALL, 
SHORT etc),
are dequeued, or some major host failure causes us to empty the rings?

I thought it would be enough to set urb-actual_length = 0 for the ctrl URBs in 
all other
cases than short or successful completion?

I'll send a RFC so you can see if it makes sense to try out this path, or If Im 
only shooting
myself in the foot.

-Mathias

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


[PATCH 1/4] usb: Add Xen pvUSB protocol description

2015-02-26 Thread Juergen Gross
Add the definition of pvUSB protocol used between the pvUSB frontend in
a Xen domU and the pvUSB backend in a Xen driver domain (usually Dom0).

This header was originally provided by Fujitsu for Xen based on Linux
2.6.18.

Changes are:
- adapt to Linux style guide

Signed-off-by: Juergen Gross jgr...@suse.com
---
 include/xen/interface/io/usbif.h | 220 +++
 1 file changed, 220 insertions(+)
 create mode 100644 include/xen/interface/io/usbif.h

diff --git a/include/xen/interface/io/usbif.h b/include/xen/interface/io/usbif.h
new file mode 100644
index 000..29815e2
--- /dev/null
+++ b/include/xen/interface/io/usbif.h
@@ -0,0 +1,220 @@
+/*
+ * usbif.h
+ *
+ * USB I/O interface for Xen guest OSes.
+ *
+ * Copyright (C) 2009, FUJITSU LABORATORIES LTD.
+ * Author: Noboru Iwamatsu n_iwama...@jp.fujitsu.com
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __XEN_PUBLIC_IO_USBIF_H__
+#define __XEN_PUBLIC_IO_USBIF_H__
+
+#include ring.h
+#include ../grant_table.h
+
+/*
+ * Feature and Parameter Negotiation
+ * =
+ * The two halves of a Xen pvUSB driver utilize nodes within the XenStore to
+ * communicate capabilities and to negotiate operating parameters. This
+ * section enumerates these nodes which reside in the respective front and
+ * backend portions of the XenStore, following the XenBus convention.
+ *
+ * Any specified default value is in effect if the corresponding XenBus node
+ * is not present in the XenStore.
+ *
+ * XenStore nodes in sections marked PRIVATE are solely for use by the
+ * driver side whose XenBus tree contains them.
+ *
+ *
+ *Backend XenBus Nodes
+ *
+ *
+ *-- Backend Device Identification (PRIVATE) --
+ *
+ * num-ports
+ *  Values: unsigned [1...31]
+ *
+ *  Number of ports for this (virtual) USB host connector.
+ *
+ * usb-ver
+ *  Values: unsigned [1...2]
+ *
+ *  USB version of this host connector: 1 = USB 1.1, 2 = USB 2.0.
+ *
+ * port/[1...31]
+ *  Values: string
+ *
+ *  Physical USB device connected to the given port, e.g. 3-1.5.
+ *
+ *
+ *Frontend XenBus Nodes
+ *
+ *
+ *--- Request Transport Parameters ---
+ *
+ * event-channel
+ *  Values: unsigned
+ *
+ *  The identifier of the Xen event channel used to signal activity
+ *  in the ring buffer.
+ *
+ * urb-ring-ref
+ *  Values: unsigned
+ *
+ *  The Xen grant reference granting permission for the backend to map
+ *  the sole page in a single page sized ring buffer. This is the ring
+ *  buffer for urb requests.
+ *
+ * conn-ring-ref
+ *  Values: unsigned
+ *
+ *  The Xen grant reference granting permission for the backend to map
+ *  the sole page in a single page sized ring buffer. This is the ring
+ *  buffer for connection/disconnection requests.
+ *
+ * protocol
+ *  Values: string (XEN_IO_PROTO_ABI_*)
+ *  Default Value:  XEN_IO_PROTO_ABI_NATIVE
+ *
+ *  The machine ABI rules governing the format of all ring request and
+ *  response structures.
+ *
+ */
+
+enum usb_spec_version {
+   USB_VER_UNKNOWN = 0,
+   USB_VER_USB11,
+   USB_VER_USB20,
+   USB_VER_USB30,  /* not supported yet */
+};
+
+/*
+ *  USB pipe in usbif_request
+ *
+ *  bits 0-5 are specific bits for virtual USB driver.
+ *  bits 7-31 are standard urb pipe.
+ *
+ *  - port number(NEW):bits 0-4
+ * (USB_MAXCHILDREN is 31)
+ *
+ *  - 

[PATCH 0/4] xen, usb: support pvUSB drivers

2015-02-26 Thread Juergen Gross
This series adds XEN pvUSB support. With pvUSB it is possible to use physical
USB devices from a XEN domain.

The support consists of a backend in the privileged Domain-0 doing the real
I/O and a frontend in the unprivileged domU passing I/O-requests to the backend.

The code is taken (and adapted) from the original pvUSB implementation done
for Linux 2.6 in 2008 by Fujitsu.

Normal operation of USB devices by adding and removing them dynamically to/from
a domain has been tested using various USB devices (USB 1.1, 2.0 and 3.0).
Assignment of a USB device at domain creation via config file has been tested
as well.

Tests have been performed with the xm toolset and with xl using patches
from Chun Yan Liu which are not upstream yet.

Juergen Gross (4):
  usb: Add Xen pvUSB protocol description
  usb: Introduce Xen pvUSB frontend
  usb: Introduce Xen pvUSB backend
  xen: add Xen pvUSB maintainer

 MAINTAINERS  |8 +
 drivers/usb/Kconfig  |2 +
 drivers/usb/Makefile |3 +
 drivers/usb/xen/Kconfig  |   20 +
 drivers/usb/xen/Makefile |6 +
 drivers/usb/xen/xen-usbback.c| 1845 ++
 drivers/usb/xen/xen-usbfront.c   | 1634 +
 include/xen/interface/io/usbif.h |  220 +
 8 files changed, 3738 insertions(+)
 create mode 100644 drivers/usb/xen/Kconfig
 create mode 100644 drivers/usb/xen/Makefile
 create mode 100644 drivers/usb/xen/xen-usbback.c
 create mode 100644 drivers/usb/xen/xen-usbfront.c
 create mode 100644 include/xen/interface/io/usbif.h

-- 
2.1.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 3/3] usb: chipidea: use hrtimer for otg fsm timers

2015-02-26 Thread Peter Chen
On Mon, Feb 09, 2015 at 02:54:48PM +0800, Li Jun wrote:
 From: Li Jun b47...@freescale.com
 
 Current otg fsm timers are using controller 1ms irq and count it, this patch
 is to replace it with hrtimer solution, use one hrtimer for all otg timers.
 
 Signed-off-by: Li Jun jun...@freescale.com
 ---
  drivers/usb/chipidea/ci.h  |   10 +-
  drivers/usb/chipidea/otg_fsm.c |  365 
 
  2 files changed, 191 insertions(+), 184 deletions(-)
 
 diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
 index c09381d..6256f04 100644
 --- a/drivers/usb/chipidea/ci.h
 +++ b/drivers/usb/chipidea/ci.h
 @@ -162,7 +162,10 @@ struct hw_bank {
   * @role: current role
   * @is_otg: if the device is otg-capable
   * @fsm: otg finite state machine
 - * @fsm_timer: pointer to timer list of otg fsm
 + * @otg_fsm_hrtimer: hrtimer for otg fsm timers
 + * @hr_timeouts: time out during lists with msec

It is ktime_t, any relationship with msec?
%s/lists/list

 + * @enabled_otg_timers: bits of enabled otg timers

How about enabled_otg_timer_bits?

 + * @next_otg_timer: next nearest enabled timer to be expired
   * @work: work for role changing
   * @wq: workqueue thread
   * @qh_pool: allocation pool for queue heads
 @@ -205,7 +208,10 @@ struct ci_hdrc {
   boolis_otg;
   struct usb_otg  otg;
   struct otg_fsm  fsm;
 - struct ci_otg_fsm_timer_list*fsm_timer;
 + struct hrtimer  otg_fsm_hrtimer;
 + ktime_t hr_timeouts[NUM_OTG_FSM_TIMERS];
 + unsignedenabled_otg_timers;

Why you use unsigned, but not unsigned int or unsigned long?

 + enum otg_fsm_timer  next_otg_timer;
   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 ba2cb91..0af7ff0 100644
 --- a/drivers/usb/chipidea/otg_fsm.c
 +++ b/drivers/usb/chipidea/otg_fsm.c
 @@ -30,22 +30,6 @@
  #include otg.h
  #include otg_fsm.h
  
 -static struct ci_otg_fsm_timer *otg_timer_initializer
 -(struct ci_hdrc *ci, void (*function)(void *, unsigned long),
 - unsigned long expires, unsigned long data)
 -{
 - struct ci_otg_fsm_timer *timer;
 -
 - timer = devm_kzalloc(ci-dev, sizeof(struct ci_otg_fsm_timer),
 - GFP_KERNEL);
 - if (!timer)
 - return NULL;
 - timer-function = function;
 - timer-expires = expires;
 - timer-data = data;
 - return timer;
 -}
 -
  /* Add for otg: interact with user space app */
  static ssize_t
  get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf)
 @@ -204,36 +188,48 @@ static struct attribute_group inputs_attr_group = {
  };
  
  /*
 + * Keep this list in the same order as timers indexed
 + * by enum otg_fsm_timer in include/linux/usb/otg-fsm.h
 + */
 +static unsigned otg_timer_ms[] = {
 + TA_WAIT_VRISE,
 + TA_WAIT_VFALL,
 + TA_WAIT_BCON,
 + TA_AIDL_BDIS,
 + TB_ASE0_BRST,
 + TA_BIDL_ADIS,
 + TB_SE0_SRP,
 + TB_SRP_FAIL,
 + 0,

0? No timer for it?

 + TB_DATA_PLS,
 + TB_SSEND_SRP,
 +};
 +
 +/*
   * Add timer to active timer list
   */
  static void ci_otg_add_timer(struct ci_hdrc *ci, enum otg_fsm_timer t)
  {
 - struct ci_otg_fsm_timer *tmp_timer;
 - struct ci_otg_fsm_timer *timer = ci-fsm_timer-timer_list[t];
 - struct list_head *active_timers = ci-fsm_timer-active_timers;
 + unsigned long flags, timer_sec, timer_nsec;
  
   if (t = NUM_OTG_FSM_TIMERS)
   return;
  
 - /*
 -  * Check if the timer is already in the active list,
 -  * if so update timer count
 -  */
 - list_for_each_entry(tmp_timer, active_timers, list)
 - if (tmp_timer == timer) {
 - timer-count = timer-expires;
 - return;
 - }
 -
 - if (list_empty(active_timers))
 - pm_runtime_get(ci-dev);
 -
 - timer-count = timer-expires;
 - list_add_tail(timer-list, active_timers);
 -
 - /* Enable 1ms irq */
 - if (!(hw_read_otgsc(ci, OTGSC_1MSIE)))
 - hw_write_otgsc(ci, OTGSC_1MSIE, OTGSC_1MSIE);
 + spin_lock_irqsave(ci-lock, flags);
 + timer_sec = otg_timer_ms[t] / MSEC_PER_SEC;
 + timer_nsec = (otg_timer_ms[t] % MSEC_PER_SEC) * NSEC_PER_MSEC;
 + ci-hr_timeouts[t] = ktime_add(ktime_get(),
 + ktime_set(timer_sec, timer_nsec));
 + ci-enabled_otg_timers |= (1  t);
 + if ((ci-next_otg_timer == NUM_OTG_FSM_TIMERS) ||
 + (ci-hr_timeouts[ci-next_otg_timer].tv64 
 + ci-hr_timeouts[t].tv64)) {
 + ci-next_otg_timer = t;
 + hrtimer_start_range_ns(ci-otg_fsm_hrtimer,
 +

Re: Additional device id's for cp210x

2015-02-26 Thread Johan Hovold
[ Adding the linux-usb list as CC. ]

On Thu, Feb 26, 2015 at 02:04:46PM +0100, Michiel vdG wrote:
 Hi!
 
 I'm contacting you for Lunatico Astronomia S. L. in Spain, they produce
 among other things USB devices for astronomy hobbyists and professionals.
 One such device should trigger the cp210 module to be loaded on
 usb-connect, but that never happens. My role, or stake, is that of a
 consumer who uses the product, hence I'm reaching out to you.
 
 In my testing, I added this line:
 
 { USB_DEVICE(0x16C0, 0x09B1) }, /* Seletek */
 
 To the device ID list in drivers/usb/serial/cp210x.c.
 
 And on compiling and booting with this change, the kernel loaded the cp210
 module as the usb cable was connected and the device then funtions as
 expected.
 
 You can verify Lunatico is registered as the owner of this ID if needed
 here:
 http://www.voti.nl/pids/index.html
 And I can put you in touch with an engineer at Lunatico if that helps with
 anything?
 
 Hope this was useful to you, please let me know what i can do to help
 resolve this issue.
 (while figuring out how to report this, i learned about
 /sys/bus/usb/drivers/.../new_id, that's awesome! :P)

Could you submit this change as a patch so I can include it in the
kernel? Here's an example of what such a patch could look like:

https://marc.info/?l=linux-usbm=141235211613182w=2

and there's more information in Documentation/SubmittingPatches in the
kernel tree.

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


[PATCH 3/4] usb: Introduce Xen pvUSB backend

2015-02-26 Thread Juergen Gross
Introduces the Xen pvUSB backend. With pvUSB it is possible for a Xen
domU to communicate with a USB device assigned to that domU. The
communication is all done via the pvUSB backend in a driver domain
(usually Dom0) which is owner of the physical device.

The code is taken from the pvUSB implementation in Xen done by Fujitsu
based on Linux kernel 2.6.18.

Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- move module to appropriate location in kernel tree
- adapt to Linux style guide
- allocate resources dynamically
- use threaded irq
- correct sequence of state changes when assigning a device

Signed-off-by: Juergen Gross jgr...@suse.com
---
 drivers/usb/Makefile  |1 +
 drivers/usb/xen/Kconfig   |   10 +
 drivers/usb/xen/Makefile  |1 +
 drivers/usb/xen/xen-usbback.c | 1845 +
 4 files changed, 1857 insertions(+)
 create mode 100644 drivers/usb/xen/xen-usbback.c

diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 2676ef6..41f7398 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -64,3 +64,4 @@ obj-$(CONFIG_USB_COMMON)  += common/
 obj-$(CONFIG_USBIP_CORE)   += usbip/
 
 obj-$(CONFIG_XEN_USB_FRONTEND) += xen/
+obj-$(CONFIG_XEN_USB_BACKEND)  += xen/
diff --git a/drivers/usb/xen/Kconfig b/drivers/usb/xen/Kconfig
index 5d995477..3414617 100644
--- a/drivers/usb/xen/Kconfig
+++ b/drivers/usb/xen/Kconfig
@@ -8,3 +8,13 @@ config XEN_USB_FRONTEND
  within another guest OS (usually Dom0).
  Only needed if the kernel is running in a Xen guest and generic
  access to a USB device is needed.
+
+config XEN_USB_BACKEND
+   tristate Xen USB backend driver
+   depends on XEN_BACKEND
+   default m
+   help
+ The USB backend driver allows the kernel to export its USB Devices
+ to other guests via a high-performance shared-memory interface.
+ Only needed for systems running as Xen driver domains (e.g. Dom0) and
+ if guests need generic access to USB devices.
diff --git a/drivers/usb/xen/Makefile b/drivers/usb/xen/Makefile
index 4568c26..c1a571065 100644
--- a/drivers/usb/xen/Makefile
+++ b/drivers/usb/xen/Makefile
@@ -3,3 +3,4 @@
 #
 
 obj-$(CONFIG_XEN_USB_FRONTEND) += xen-usbfront.o
+obj-$(CONFIG_XEN_USB_BACKEND)  += xen-usbback.o
diff --git a/drivers/usb/xen/xen-usbback.c b/drivers/usb/xen/xen-usbback.c
new file mode 100644
index 000..56a600e
--- /dev/null
+++ b/drivers/usb/xen/xen-usbback.c
@@ -0,0 +1,1845 @@
+/*
+ * xen-usbback.c
+ *
+ * Xen USB backend driver.
+ *
+ * Copyright (C) 2009, FUJITSU LABORATORIES LTD.
+ * Author: Noboru Iwamatsu n_iwama...@jp.fujitsu.com
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see http://www.gnu.org/licenses/.
+ *
+ * or, by your choice,
+ *
+ * When distributed separately from the Linux kernel or incorporated into
+ * other software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include linux/module.h
+#include linux/interrupt.h
+#include linux/slab.h
+#include linux/usb.h
+#include linux/wait.h
+#include linux/list.h
+#include linux/kref.h
+
+#include linux/usb/ch11.h
+
+#include xen/xen.h
+#include xen/balloon.h
+#include xen/events.h
+#include xen/xenbus.h
+#include xen/grant_table.h
+#include 

[PATCH 2/4] usb: Introduce Xen pvUSB frontend

2015-02-26 Thread Juergen Gross
Introduces the Xen pvUSB frontend. With pvUSB it is possible for a Xen
domU to communicate with a USB device assigned to that domU. The
communication is all done via the pvUSB backend in a driver domain
(usually Dom0) which is owner of the physical device.

The code is taken from the pvUSB implementation in Xen done by Fujitsu
based on Linux kernel 2.6.18.

Changes from the original version are:
- port to upstream kernel
- put all code in just one source file
- move module to appropriate location in kernel tree
- adapt to Linux style guide
- minor code modifications to increase readability

Signed-off-by: Juergen Gross jgr...@suse.com
---
 drivers/usb/Kconfig|2 +
 drivers/usb/Makefile   |2 +
 drivers/usb/xen/Kconfig|   10 +
 drivers/usb/xen/Makefile   |5 +
 drivers/usb/xen/xen-usbfront.c | 1634 
 5 files changed, 1653 insertions(+)
 create mode 100644 drivers/usb/xen/Kconfig
 create mode 100644 drivers/usb/xen/Makefile
 create mode 100644 drivers/usb/xen/xen-usbfront.c

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 8ed451d..de998f1 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -94,6 +94,8 @@ source drivers/usb/image/Kconfig
 
 source drivers/usb/usbip/Kconfig
 
+source drivers/usb/xen/Kconfig
+
 endif
 
 source drivers/usb/musb/Kconfig
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile
index 2f1e2aa..2676ef6 100644
--- a/drivers/usb/Makefile
+++ b/drivers/usb/Makefile
@@ -62,3 +62,5 @@ obj-$(CONFIG_USB_GADGET)  += gadget/
 obj-$(CONFIG_USB_COMMON)   += common/
 
 obj-$(CONFIG_USBIP_CORE)   += usbip/
+
+obj-$(CONFIG_XEN_USB_FRONTEND) += xen/
diff --git a/drivers/usb/xen/Kconfig b/drivers/usb/xen/Kconfig
new file mode 100644
index 000..5d995477
--- /dev/null
+++ b/drivers/usb/xen/Kconfig
@@ -0,0 +1,10 @@
+config XEN_USB_FRONTEND
+   tristate Xen USB frontend driver
+   depends on XEN
+   default m
+   select XEN_XENBUS_FRONTEND
+   help
+ The Xen USB frontend driver allows the kernel to access USB Devices
+ within another guest OS (usually Dom0).
+ Only needed if the kernel is running in a Xen guest and generic
+ access to a USB device is needed.
diff --git a/drivers/usb/xen/Makefile b/drivers/usb/xen/Makefile
new file mode 100644
index 000..4568c26
--- /dev/null
+++ b/drivers/usb/xen/Makefile
@@ -0,0 +1,5 @@
+#
+# Makefile for Xen pvUSB drivers
+#
+
+obj-$(CONFIG_XEN_USB_FRONTEND) += xen-usbfront.o
diff --git a/drivers/usb/xen/xen-usbfront.c b/drivers/usb/xen/xen-usbfront.c
new file mode 100644
index 000..f49e8e9
--- /dev/null
+++ b/drivers/usb/xen/xen-usbfront.c
@@ -0,0 +1,1634 @@
+/*
+ * xen-usbfront.c
+ *
+ * Xen USB Virtual Host Controller driver
+ *
+ * Copyright (C) 2009, FUJITSU LABORATORIES LTD.
+ * Author: Noboru Iwamatsu n_iwama...@jp.fujitsu.com
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see http://www.gnu.org/licenses/.
+ *
+ * or, by your choice,
+ *
+ * When distributed separately from the Linux kernel or incorporated into
+ * other software packages, subject to the following license:
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the Software), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include linux/module.h
+#include linux/usb.h
+#include linux/list.h
+#include linux/usb/hcd.h
+#include linux/io.h
+
+#include xen/xen.h
+#include xen/xenbus.h

[PATCH 4/4] xen: add Xen pvUSB maintainer

2015-02-26 Thread Juergen Gross
Add myself as maintainer for the Xen pvUSB stuff.

Signed-off-by: Juergen Gross jgr...@suse.com
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8c..8ec1e1f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10787,6 +10787,14 @@ F: drivers/scsi/xen-scsifront.c
 F: drivers/xen/xen-scsiback.c
 F: include/xen/interface/io/vscsiif.h
 
+XEN PVUSB DRIVERS
+M: Juergen Gross jgr...@suse.com
+L: xen-de...@lists.xenproject.org (moderated for non-subscribers)
+L: linux-usb@vger.kernel.org
+S: Supported
+F: divers/usb/xen/
+F: include/xen/interface/io/usbif.h
+
 XEN SWIOTLB SUBSYSTEM
 M: Konrad Rzeszutek Wilk konrad.w...@oracle.com
 L: xen-de...@lists.xenproject.org (moderated for non-subscribers)
-- 
2.1.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 2/4] usb: Introduce Xen pvUSB frontend

2015-02-26 Thread Oliver Neukum
On Thu, 2015-02-26 at 14:35 +0100, Juergen Gross wrote:
 +
 +   /* reset completion */
 +   if ((info-ports[wIndex].status 
 USB_PORT_STAT_RESET) != 0 
 +   time_after_eq(jiffies,
 info-ports[wIndex].timeout)) {
 +   info-ports[wIndex].status |=
 +   USB_PORT_STAT_C_RESET  16;
 +   info-ports[wIndex].status =
 ~USB_PORT_STAT_RESET;
 +
 +   if (info-devices[wIndex].status !=
 +   USB_STATE_NOTATTACHED) {
 +   info-ports[wIndex].status |=
 +   USB_PORT_STAT_ENABLE;
 +   info-devices[wIndex].status =
 +   USB_STATE_DEFAULT;
 +   }
 +
 +   switch (info-devices[wIndex].speed) {
 +   case USB_SPEED_LOW:
 +   info-ports[wIndex].status |=
 +   USB_PORT_STAT_LOW_SPEED;
 +   break;
 +   case USB_SPEED_HIGH:
 +   info-ports[wIndex].status |=
 +   USB_PORT_STAT_HIGH_SPEED;
 +   break;
 +   default:
 +   break;
 +   }
 +   }
 +
 +   ((u16 *)buf)[0] =
 cpu_to_le16(info-ports[wIndex].status);
 +   ((u16 *)buf)[1] =
 cpu_to_le16(info-ports[wIndex].status  16);

Why in two chunks?
Regards
Oliver
 +   break;


-- 
Oliver Neukum oneu...@suse.de

--
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 v3] xhci: fix reporting of 0-sized URBs in control endpoint

2015-02-26 Thread Mathias Nyman
...
 
 The second event is always COMP_SUCCESS and the event-transfer_len is
 always set to 0 in that one. The 3 cases I've seen are:
 
 case 1: 1 event on last TRB
   COMP_SUCCESS, event-len=0
 
 case 2:  short event but with data
   COMP_SHORT_TX, event-len  urb-transfer_buffer_len
   COMP_SUCCESS, event-len=0
 
 case 3: short event with no data
   COMP_SHORT_TX, event-len = urb-transfer_buffer_len
   COMP_SUCCESS, event-len=0
 

Ok, I was hoping COMP_SUCCESS event-len in case 2 and 3 would
show the same value as the previous COMP_SHORT_TX event-len


 The other thing I thought of was to somehow always initialize the URB
 actual length to the transfer buffer length from the very beginning,
 and only update it if a COMP_SHORT_TX event is received. Not sure if
 that would be much more complex to handle, though.


 This could be an option, need to look into it.
 

I'm starting to like your idea of setting the urb-actual_length in advance,
It may actually simplify things.

I already started implementing a testpatch, will send it shortly If you'd like 
to
test it with your device and hso driver. 

-Mathias 

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


Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 10:54 AM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 10:44:15AM -0600, Felipe Balbi wrote:
 On Thu, Feb 26, 2015 at 10:37:50AM -0600, Bin Liu wrote:
  Felipe,
 
  On Thu, Feb 26, 2015 at 10:31 AM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 10:21:38AM -0600, Bin Liu wrote:
   Felipe,
  
   On Thu, Feb 26, 2015 at 9:07 AM, Felipe Balbi ba...@ti.com wrote:
There was already a proper place where we were
checking for babble interrupts, move babble
recovery there.
   
Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)
   
diff --git a/drivers/usb/musb/musb_core.c 
b/drivers/usb/musb/musb_core.c
index 2767ce1bf016..0569b24719e6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -892,6 +892,12 @@ b_host:
} else {
ERR(Stopping host session -- 
babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 
0);
+
+   if (is_host_active(musb)) {
+   musb_generic_disable(musb);
+   
schedule_delayed_work(musb-recover_work,
+   
msecs_to_jiffies(100));
+   }
  
   This change breaks babble recovery, because the following lines above 
   here
  
   873 if (devctl  (MUSB_DEVCTL_FSDEV |
   MUSB_DEVCTL_LSDEV)) {
   874 dev_dbg(musb-controller, BABBLE
   devctl: %02x\n, devctl);
  
   have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
   'if' traps babble handling for all cases, never hit on 'else'.
  
   We might as well drop that check altogether. Let me see what happens
   here.
 
  It is good to clean it up, but I guess the babble storm you see is
  caused by something else. I debugged the storm last year in an older
  kernel, it was due to the babble recovery routine does not maintain a
  bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
  at this part in the upstream kernel right now.

I am unable to recall why this bug causes the storm, but here is the
bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
know if I need to send an seperate patch email.

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 5965ed6..b4a92e2 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -607,6 +607,14 @@ static int dsps_musb_reset(struct musb *musb)
session_restart = 1;
}

+   if (glue-sw_babble_enabled) {
+   u32 val;
+
+   val = dsps_readb(musb-mregs, MUSB_BABBLE_CTL);
+   val |= MUSB_BABBLE_SW_SESSION_CTRL;
+   dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, val);
+   }
+
return !session_restart;
 }



 alright, I'll have a look, let's see.

 I'll split below into two patches, but here you go:

 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index e23eb3e517de..c3c5a6462600 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -862,16 +862,23 @@ b_host:
 if (int_usb  MUSB_INTR_RESET) {
 handled = IRQ_HANDLED;
 if (devctl  MUSB_DEVCTL_HM) {
 +   u8 power = musb_readl(musb-mregs, MUSB_POWER);
 +
 /*
  * Looks like non-HS BABBLE can be ignored, but
 -* HS BABBLE is an error condition. For HS the 
 solution
 -* is to avoid babble in the first place and fix what
 -* caused BABBLE. When HS BABBLE happens we can only
 -* stop the session.
 +* HS BABBLE is an error condition.
 +*
 +* For HS the solution is to avoid babble in the first
 +* place and fix what caused BABBLE.
 +*
 +* When HS BABBLE happens what we can depends on which
 +* platform MUSB is running, because some platforms
 +* implemented proprietary means for 'recovering' from
 +* Babble conditions. One such platform is AM335x. In
 +* most cases, however, the only thing we can do is 
 drop
 +* the session.
  */
 -   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV)) 
 {
 -   dev_dbg(musb-controller, BABBLE devctl: 
 %02x\n, devctl);
 -   } else {
 +   if (power  

Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
Hi,

On Thu, Feb 26, 2015 at 11:20:29AM -0600, Bin Liu wrote:
 There was already a proper place where we were
 checking for babble interrupts, move babble
 recovery there.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_core.c | 13 ++---
  1 file changed, 6 insertions(+), 7 deletions(-)

 diff --git a/drivers/usb/musb/musb_core.c 
 b/drivers/usb/musb/musb_core.c
 index 2767ce1bf016..0569b24719e6 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -892,6 +892,12 @@ b_host:
 } else {
 ERR(Stopping host session -- 
 babble\n);
 musb_writeb(musb-mregs, 
 MUSB_DEVCTL, 0);
 +
 +   if (is_host_active(musb)) {
 +   musb_generic_disable(musb);
 +   
 schedule_delayed_work(musb-recover_work,
 +   
 msecs_to_jiffies(100));
 +   }
   
This change breaks babble recovery, because the following lines above 
here
   
873 if (devctl  (MUSB_DEVCTL_FSDEV |
MUSB_DEVCTL_LSDEV)) {
874 dev_dbg(musb-controller, BABBLE
devctl: %02x\n, devctl);
   
have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
'if' traps babble handling for all cases, never hit on 'else'.
   
We might as well drop that check altogether. Let me see what happens
here.
  
   It is good to clean it up, but I guess the babble storm you see is
   caused by something else. I debugged the storm last year in an older
   kernel, it was due to the babble recovery routine does not maintain a
   bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
   at this part in the upstream kernel right now.
 
 I am unable to recall why this bug causes the storm, but here is the
 bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
 know if I need to send an seperate patch email.

please send it as a patch, but please rebase on top of my testing/next.
I've just pushed quite a few patches fixing a bunch of weird
inconsistencies with babble recovery.

Basically, even though we set SW_SESSION_CONTROL, we were still writing
0 to devctl which was dropping the session anyway!

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] USB: serial: cp210x: Adding Seletek device id's

2015-02-26 Thread Johan Hovold
On Thu, Feb 26, 2015 at 06:37:17PM +0100, Michiel vdG wrote:
 These device ID's are not associated with the cp210x module currently,
 but should be. This patch allows the devices to operate upon
 connecting them to the usb bus as intended.
 
 Tested personally, reviewed by manufacturer

Thanks for the patch. Looks good, but there are a few minor issues:

The patch is line-wrapped and there are some leading spaces (instead of
tabs). Perhaps you need to fix your mailer or you could consider using
git send-email to send it. Have a look at git format-patch as well.

You need to add a Signed-off-by tag too.

There's more info in Documentation/SubmittingPatches.

Try sending the patch to yourself first and run scripts/checkpatch on it
before sending it to the list.

 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
 index f40c856..cf372f0 100644
 --- a/drivers/usb/serial/cp210x.c
 +++ b/drivers/usb/serial/cp210x.c
 @@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = {
 { USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus
 Spectrum Colour Touchscreen */
 { USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus
 Architectural Dimmer */
 { USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus
 Multi-room Audio Matrix Switcher */
 +   { USB_DEVICE(0x16C0, 0x09B0) }, /* Seletek */
 +   { USB_DEVICE(0x16C0, 0x09B1) }, /* Seletek */

Please include the vendor name as well in the comment.

 { USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
 { USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein  Baus GmbH
 PL512 Power Supply */
 { USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein  Baus GmbH
 RCM Remote Control for MARATON Power Supply */

Care to fix this up and send a v2?

Don't hesitate to ask if you have any questions.

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 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 11:51:11AM -0600, Bin Liu wrote:
 Felipe,
 
 On Thu, Feb 26, 2015 at 11:40 AM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Thu, Feb 26, 2015 at 11:20:29AM -0600, Bin Liu wrote:
  There was already a proper place where we were
  checking for babble interrupts, move babble
  recovery there.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
  ---
   drivers/usb/musb/musb_core.c | 13 ++---
   1 file changed, 6 insertions(+), 7 deletions(-)
 
  diff --git a/drivers/usb/musb/musb_core.c 
  b/drivers/usb/musb/musb_core.c
  index 2767ce1bf016..0569b24719e6 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -892,6 +892,12 @@ b_host:
  } else {
  ERR(Stopping host session -- 
  babble\n);
  musb_writeb(musb-mregs, 
  MUSB_DEVCTL, 0);
  +
  +   if (is_host_active(musb)) {
  +   
  musb_generic_disable(musb);
  +   
  schedule_delayed_work(musb-recover_work,
  +   
  msecs_to_jiffies(100));
  +   }

 This change breaks babble recovery, because the following lines 
 above here

 873 if (devctl  (MUSB_DEVCTL_FSDEV |
 MUSB_DEVCTL_LSDEV)) {
 874 dev_dbg(musb-controller, 
 BABBLE
 devctl: %02x\n, devctl);

 have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so 
 this
 'if' traps babble handling for all cases, never hit on 'else'.

 We might as well drop that check altogether. Let me see what happens
 here.
   
It is good to clean it up, but I guess the babble storm you see is
caused by something else. I debugged the storm last year in an older
kernel, it was due to the babble recovery routine does not maintain a
bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
at this part in the upstream kernel right now.
 
  I am unable to recall why this bug causes the storm, but here is the
  bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
  know if I need to send an seperate patch email.
 
  please send it as a patch, but please rebase on top of my testing/next.
  I've just pushed quite a few patches fixing a bunch of weird
  inconsistencies with babble recovery.
 
 I can do that. But the hw reset is unnecessary for babble recover, it
 is also a problem due to AM335x Errata Adversary 1.0.34. If not reset,
 SW_SESSION_CTRL bit will not be cleared.
 
 Do you want me to send this patch or a new patch to not reset hw in recovery?

I would rather not reset the IP if we don't have to :-s

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 4/4] xen: add Xen pvUSB maintainer

2015-02-26 Thread Konrad Rzeszutek Wilk
On February 26, 2015 8:35:17 AM EST, Juergen Gross jgr...@suse.com wrote:
Add myself as maintainer for the Xen pvUSB stuff.

Signed-off-by: Juergen Gross jgr...@suse.com
---
 MAINTAINERS | 8 
 1 file changed, 8 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index ddc5a8c..8ec1e1f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -10787,6 +10787,14 @@ F:drivers/scsi/xen-scsifront.c
 F:drivers/xen/xen-scsiback.c
 F:include/xen/interface/io/vscsiif.h
 
+XEN PVUSB DRIVERS
+M:Juergen Gross jgr...@suse.com
+L:xen-de...@lists.xenproject.org (moderated for non-subscribers)
+L:linux-usb@vger.kernel.org
+S:Supported
+F:divers/usb/xen/
+F:include/xen/interface/io/usbif.h

Acked-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com

On the include/Xen/... part.
+
 XEN SWIOTLB SUBSYSTEM
 M:Konrad Rzeszutek Wilk konrad.w...@oracle.com
 L:xen-de...@lists.xenproject.org (moderated for non-subscribers)


--
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: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 11:54 AM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 11:51:11AM -0600, Bin Liu wrote:
 Felipe,

 On Thu, Feb 26, 2015 at 11:40 AM, Felipe Balbi ba...@ti.com wrote:
  Hi,
 
  On Thu, Feb 26, 2015 at 11:20:29AM -0600, Bin Liu wrote:
  There was already a proper place where we were
  checking for babble interrupts, move babble
  recovery there.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
  ---
   drivers/usb/musb/musb_core.c | 13 ++---
   1 file changed, 6 insertions(+), 7 deletions(-)
 
  diff --git a/drivers/usb/musb/musb_core.c 
  b/drivers/usb/musb/musb_core.c
  index 2767ce1bf016..0569b24719e6 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -892,6 +892,12 @@ b_host:
  } else {
  ERR(Stopping host session -- 
  babble\n);
  musb_writeb(musb-mregs, 
  MUSB_DEVCTL, 0);
  +
  +   if (is_host_active(musb)) {
  +   
  musb_generic_disable(musb);
  +   
  schedule_delayed_work(musb-recover_work,
  +   
  msecs_to_jiffies(100));
  +   }

 This change breaks babble recovery, because the following lines 
 above here

 873 if (devctl  (MUSB_DEVCTL_FSDEV |
 MUSB_DEVCTL_LSDEV)) {
 874 dev_dbg(musb-controller, 
 BABBLE
 devctl: %02x\n, devctl);

 have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so 
 this
 'if' traps babble handling for all cases, never hit on 'else'.

 We might as well drop that check altogether. Let me see what 
 happens
 here.
   
It is good to clean it up, but I guess the babble storm you see is
caused by something else. I debugged the storm last year in an older
kernel, it was due to the babble recovery routine does not maintain a
bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
at this part in the upstream kernel right now.
 
  I am unable to recall why this bug causes the storm, but here is the
  bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
  know if I need to send an seperate patch email.
 
  please send it as a patch, but please rebase on top of my testing/next.
  I've just pushed quite a few patches fixing a bunch of weird
  inconsistencies with babble recovery.

 I can do that. But the hw reset is unnecessary for babble recover, it
 is also a problem due to AM335x Errata Adversary 1.0.34. If not reset,
 SW_SESSION_CTRL bit will not be cleared.

 Do you want me to send this patch or a new patch to not reset hw in recovery?

 I would rather not reset the IP if we don't have to :-s

Me too. I will make a patch for it.


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


[PATCH] USB: serial: cp210x: Adding Seletek device id's

2015-02-26 Thread Michiel vdG
These device ID's are not associated with the cp210x module currently,
but should be. This patch allows the devices to operate upon
connecting them to the usb bus as intended.

Tested personally, reviewed by manufacturer

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index f40c856..cf372f0 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus
Spectrum Colour Touchscreen */
{ USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus
Architectural Dimmer */
{ USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus
Multi-room Audio Matrix Switcher */
+   { USB_DEVICE(0x16C0, 0x09B0) }, /* Seletek */
+   { USB_DEVICE(0x16C0, 0x09B1) }, /* Seletek */
{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
{ USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein  Baus GmbH
PL512 Power Supply */
{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein  Baus GmbH
RCM Remote Control for MARATON Power Supply */


-- 
 Michiel van de Garde
--
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 PATCH] xhci: fix reporting of 0-sized URBs in control endpoints

2015-02-26 Thread Alan Stern
On Thu, 26 Feb 2015, Mathias Nyman wrote:

 On 26.02.2015 18:12, Mathias Nyman wrote:
  When a control transfer has a short data stage, the xHCI controller 
  generates
  two transfer events: a COMP_SHORT_TX event that specifies the untransferred
  amount, and a COMP_SUCCESS event. But when the data stage is not short, only
  the COMP_SUCCESS event occurs. Therefore, xhci-hcd sets urb-actual_length
  to urb-transfer_buffer_length while processing the COMP_SUCCESS event,
  unless urb-actual_length was set already by a previous COMP_SHORT_TX event.
  
  The driver checks this by seeing whether urb-actual_length == 0, but this
  alone is the wrong test, as it is entirely possible for a short transfer to
  have an urb-actual_length = 0.
  
  This patch changes the xhci driver to set the urb-actual_length in advance
  to the expected value of a successful control transfer.
  The urb-actual_length is then only adjusted in case of short transfers or
  other special events, but not on COMP_SUCCESS events.
  
  This fixes a bug which affected the HSO plugin, which relies on URBs with
  urb-actual_length == 0 to halt re-submitting the RX URB in the control
  endpoint.
  
  Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com
  ---
   drivers/usb/host/xhci-ring.c | 73 
  ++--
   1 file changed, 37 insertions(+), 36 deletions(-)
  
  diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
  index b46b5b9..0e02e79 100644
  --- a/drivers/usb/host/xhci-ring.c
  +++ b/drivers/usb/host/xhci-ring.c
  @@ -732,7 +732,11 @@ remove_finished_td:
  /* Clean up the cancelled URB */
  /* Doesn't matter what we pass for status, since the core will
   * just overwrite it (because the URB has been unlinked).
  +* Control urbs have the urb-actual_length pre-set, clear it
  +* as well
   */
  +   if (usb_endpoint_xfer_control(cur_td-urb-ep-desc))
  +   cur_td-urb-actual_length = 0;

Now this would do the wrong thing if some data had been sent or 
received before the URB was cancelled.

Does the controller write back information about the number of bytes to
the data TRB?  Maybe it would be easier to get the values from there
instead of trying to use the event structures.

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 v3] xhci: fix reporting of 0-sized URBs in control endpoint

2015-02-26 Thread Alan Stern
On Thu, 26 Feb 2015, Mathias Nyman wrote:

 On 26.02.2015 16:57, Alan Stern wrote:
  On Thu, 26 Feb 2015, Mathias Nyman wrote:
  
  I'm starting to like your idea of setting the urb-actual_length in 
  advance,
  It may actually simplify things.
  
  But it will make unlinking more difficult.  Also, what will you do if 
  there is more than one TRB?
  
 
 current xhci driver can't handle more than one data trb in control tranfers:
 xhci-ring.c,

Yes, that's right.  I was thinking about bulk transfers.  I guess they 
don't suffer from this problem, though.

 Shouldn't control urbs only be given back when they finish (SUCCESS, STALL, 
 SHORT etc),
 are dequeued, or some major host failure causes us to empty the rings?

Yes.  In fact, that's true for every URB, not just control.

 I thought it would be enough to set urb-actual_length = 0 for the ctrl URBs 
 in all other
 cases than short or successful completion?

urb-actual_length should always be set to the number of bytes actually
transferred, as closely as you can tell.  For example, suppose you have
a 1500-byte transfer.  If the first packet successfully sends 1024
bytes but the second packet fails (so the entire URB fails),
actual_length should be set to 1024.

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 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 11:40 AM, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Thu, Feb 26, 2015 at 11:20:29AM -0600, Bin Liu wrote:
 There was already a proper place where we were
 checking for babble interrupts, move babble
 recovery there.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_core.c | 13 ++---
  1 file changed, 6 insertions(+), 7 deletions(-)

 diff --git a/drivers/usb/musb/musb_core.c 
 b/drivers/usb/musb/musb_core.c
 index 2767ce1bf016..0569b24719e6 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -892,6 +892,12 @@ b_host:
 } else {
 ERR(Stopping host session -- 
 babble\n);
 musb_writeb(musb-mregs, 
 MUSB_DEVCTL, 0);
 +
 +   if (is_host_active(musb)) {
 +   musb_generic_disable(musb);
 +   
 schedule_delayed_work(musb-recover_work,
 +   
 msecs_to_jiffies(100));
 +   }
   
This change breaks babble recovery, because the following lines 
above here
   
873 if (devctl  (MUSB_DEVCTL_FSDEV |
MUSB_DEVCTL_LSDEV)) {
874 dev_dbg(musb-controller, BABBLE
devctl: %02x\n, devctl);
   
have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so this
'if' traps babble handling for all cases, never hit on 'else'.
   
We might as well drop that check altogether. Let me see what happens
here.
  
   It is good to clean it up, but I guess the babble storm you see is
   caused by something else. I debugged the storm last year in an older
   kernel, it was due to the babble recovery routine does not maintain a
   bit in MUSB_BABBLE_CTL, though I forgot the details now. I am looking
   at this part in the upstream kernel right now.

 I am unable to recall why this bug causes the storm, but here is the
 bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
 know if I need to send an seperate patch email.

 please send it as a patch, but please rebase on top of my testing/next.
 I've just pushed quite a few patches fixing a bunch of weird
 inconsistencies with babble recovery.

I can do that. But the hw reset is unnecessary for babble recover, it
is also a problem due to AM335x Errata Adversary 1.0.34. If not reset,
SW_SESSION_CTRL bit will not be cleared.

Do you want me to send this patch or a new patch to not reset hw in recovery?


 Basically, even though we set SW_SESSION_CONTROL, we were still writing
 0 to devctl which was dropping the session anyway!

 --
 balbi
--
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: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
Hi again,

On Thu, Feb 26, 2015 at 11:54:43AM -0600, Felipe Balbi wrote:
   There was already a proper place where we were
   checking for babble interrupts, move babble
   recovery there.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
   ---
drivers/usb/musb/musb_core.c | 13 ++---
1 file changed, 6 insertions(+), 7 deletions(-)
  
   diff --git a/drivers/usb/musb/musb_core.c 
   b/drivers/usb/musb/musb_core.c
   index 2767ce1bf016..0569b24719e6 100644
   --- a/drivers/usb/musb/musb_core.c
   +++ b/drivers/usb/musb/musb_core.c
   @@ -892,6 +892,12 @@ b_host:
   } else {
   ERR(Stopping host session -- 
   babble\n);
   musb_writeb(musb-mregs, 
   MUSB_DEVCTL, 0);
   +
   +   if (is_host_active(musb)) {
   +   
   musb_generic_disable(musb);
   +   
   schedule_delayed_work(musb-recover_work,
   +   
   msecs_to_jiffies(100));
   +   }
 
  This change breaks babble recovery, because the following lines 
  above here
 
  873 if (devctl  (MUSB_DEVCTL_FSDEV |
  MUSB_DEVCTL_LSDEV)) {
  874 dev_dbg(musb-controller, 
  BABBLE
  devctl: %02x\n, devctl);
 
  have a bug - DEVCTL_FSDEV bit will be set for high-speed too, so 
  this
  'if' traps babble handling for all cases, never hit on 'else'.
 
  We might as well drop that check altogether. Let me see what 
  happens
  here.

 It is good to clean it up, but I guess the babble storm you see is
 caused by something else. I debugged the storm last year in an older
 kernel, it was due to the babble recovery routine does not maintain 
 a
 bit in MUSB_BABBLE_CTL, though I forgot the details now. I am 
 looking
 at this part in the upstream kernel right now.
  
   I am unable to recall why this bug causes the storm, but here is the
   bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
   know if I need to send an seperate patch email.
  
   please send it as a patch, but please rebase on top of my testing/next.
   I've just pushed quite a few patches fixing a bunch of weird
   inconsistencies with babble recovery.
  
  I can do that. But the hw reset is unnecessary for babble recover, it
  is also a problem due to AM335x Errata Adversary 1.0.34. If not reset,
  SW_SESSION_CTRL bit will not be cleared.
  
  Do you want me to send this patch or a new patch to not reset hw in 
  recovery?
 
 I would rather not reset the IP if we don't have to :-s

what I see though, is that we're only resetting if sw_babble_control()
decided taht we need a session to be restarted, if we managed to recover
from babble, then we're not resetting, right ? here's the relevant piece
of code:

593 if (glue-sw_babble_enabled)
594 session_restart = dsps_sw_babble_control(musb);
595 /*
596  * In case of new silicon version babble condition can be recovered
597  * without resetting the MUSB. But for older silicon versions, MUSB
598  * reset is needed
599  */
600 if (session_restart || !glue-sw_babble_enabled) {
601 dev_info(musb-controller, Restarting MUSB to recover from 
Babble\n);
602 dsps_writel(musb-ctrl_base, wrp-control, (1  
wrp-reset));
603 usleep_range(100, 200);
604 usb_phy_shutdown(musb-xceiv);
605 usleep_range(100, 200);
606 usb_phy_init(musb-xceiv);
607 session_restart = 1;
608 }

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 3/7] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Bin Liu
On Thu, Feb 26, 2015 at 11:56 AM, Felipe Balbi ba...@ti.com wrote:
 Hi again,

 On Thu, Feb 26, 2015 at 11:54:43AM -0600, Felipe Balbi wrote:
   There was already a proper place where we were
   checking for babble interrupts, move babble
   recovery there.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
   ---
drivers/usb/musb/musb_core.c | 13 ++---
1 file changed, 6 insertions(+), 7 deletions(-)
  
   diff --git a/drivers/usb/musb/musb_core.c 
   b/drivers/usb/musb/musb_core.c
   index 2767ce1bf016..0569b24719e6 100644
   --- a/drivers/usb/musb/musb_core.c
   +++ b/drivers/usb/musb/musb_core.c
   @@ -892,6 +892,12 @@ b_host:
   } else {
   ERR(Stopping host session -- 
   babble\n);
   musb_writeb(musb-mregs, 
   MUSB_DEVCTL, 0);
   +
   +   if (is_host_active(musb)) {
   +   
   musb_generic_disable(musb);
   +   
   schedule_delayed_work(musb-recover_work,
   +   
   msecs_to_jiffies(100));
   +   }
 
  This change breaks babble recovery, because the following lines 
  above here
 
  873 if (devctl  (MUSB_DEVCTL_FSDEV |
  MUSB_DEVCTL_LSDEV)) {
  874 dev_dbg(musb-controller, 
  BABBLE
  devctl: %02x\n, devctl);
 
  have a bug - DEVCTL_FSDEV bit will be set for high-speed too, 
  so this
  'if' traps babble handling for all cases, never hit on 'else'.
 
  We might as well drop that check altogether. Let me see what 
  happens
  here.

 It is good to clean it up, but I guess the babble storm you see is
 caused by something else. I debugged the storm last year in an 
 older
 kernel, it was due to the babble recovery routine does not 
 maintain a
 bit in MUSB_BABBLE_CTL, though I forgot the details now. I am 
 looking
 at this part in the upstream kernel right now.
  
   I am unable to recall why this bug causes the storm, but here is the
   bug fix - SW_SESSION_CTRL bit gets cleared after reset. Please let me
   know if I need to send an seperate patch email.
  
   please send it as a patch, but please rebase on top of my testing/next.
   I've just pushed quite a few patches fixing a bunch of weird
   inconsistencies with babble recovery.
 
  I can do that. But the hw reset is unnecessary for babble recover, it
  is also a problem due to AM335x Errata Adversary 1.0.34. If not reset,
  SW_SESSION_CTRL bit will not be cleared.
 
  Do you want me to send this patch or a new patch to not reset hw in 
  recovery?

 I would rather not reset the IP if we don't have to :-s

 what I see though, is that we're only resetting if sw_babble_control()
 decided taht we need a session to be restarted, if we managed to recover
 from babble, then we're not resetting, right ? here's the relevant piece
 of code:

That is correct.


 593 if (glue-sw_babble_enabled)
 594 session_restart = dsps_sw_babble_control(musb);
 595 /*
 596  * In case of new silicon version babble condition can be 
 recovered
 597  * without resetting the MUSB. But for older silicon versions, 
 MUSB
 598  * reset is needed
 599  */
 600 if (session_restart || !glue-sw_babble_enabled) {
 601 dev_info(musb-controller, Restarting MUSB to recover 
 from Babble\n);
 602 dsps_writel(musb-ctrl_base, wrp-control, (1  
 wrp-reset));
 603 usleep_range(100, 200);
 604 usb_phy_shutdown(musb-xceiv);
 605 usleep_range(100, 200);
 606 usb_phy_init(musb-xceiv);
 607 session_restart = 1;
 608 }

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


[PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
FSDEV is set for both HIGH and FULL speeds,
the correct HIGHSPEED check is done through
power register's HSMODE bit.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2767ce1bf016..a252194fd9b1 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -880,16 +880,23 @@ b_host:
if (int_usb  MUSB_INTR_RESET) {
handled = IRQ_HANDLED;
if (devctl  MUSB_DEVCTL_HM) {
+   u8 power = musb_readl(musb-mregs, MUSB_POWER);
+
/*
 * Looks like non-HS BABBLE can be ignored, but
-* HS BABBLE is an error condition. For HS the solution
-* is to avoid babble in the first place and fix what
-* caused BABBLE. When HS BABBLE happens we can only
-* stop the session.
+* HS BABBLE is an error condition.
+*
+* For HS the solution is to avoid babble in the first
+* place and fix what caused BABBLE.
+*
+* When HS BABBLE happens what we can depends on which
+* platform MUSB is running, because some platforms
+* implemented proprietary means for 'recovering' from
+* Babble conditions. One such platform is AM335x. In
+* most cases, however, the only thing we can do is drop
+* the session.
 */
-   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV)) {
-   dev_dbg(musb-controller, BABBLE devctl: 
%02x\n, devctl);
-   } else {
+   if (power  MUSB_POWER_HSMODE) {
ERR(Stopping host session -- babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
}
-- 
2.3.0

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


[PATCH v2 04/15] usb: musb: dsps: return error code if reset fails

2015-02-26 Thread Felipe Balbi
if reset fails, we should return a *negative*
error code, not a positive value.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 53bd0e71d19f..7584601c96f3 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -629,7 +629,7 @@ static int dsps_musb_reset(struct musb *musb)
session_restart = 1;
}
 
-   return !session_restart;
+   return session_restart ? 0 : -EPIPE;
 }
 
 static struct musb_platform_ops dsps_ops = {
-- 
2.3.0

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


[PATCH v2 07/15] usb: musb: core: remove unnecessary reg access from resume IRQ

2015-02-26 Thread Felipe Balbi
when musb is operating as host and a remote wakeup
fires up, a resume interrupt will be raised. At that
point SUSPENDM bit is automatically cleared and
RESUME bit is automatically set.

Remove those two from IRQ handler.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 15 ---
 1 file changed, 15 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 10d3f10ba728..81909ea74353 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -538,27 +538,12 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
usb_otg_state_string(musb-xceiv-otg-state));
 
if (devctl  MUSB_DEVCTL_HM) {
-   void __iomem *mbase = musb-mregs;
-   u8 power;
-
switch (musb-xceiv-otg-state) {
case OTG_STATE_A_SUSPEND:
/* remote wakeup?  later, GetPortStatus
 * will stop RESUME signaling
 */
 
-   power = musb_readb(musb-mregs, MUSB_POWER);
-   if (power  MUSB_POWER_SUSPENDM) {
-   /* spurious */
-   musb-int_usb = ~MUSB_INTR_SUSPEND;
-   dev_dbg(musb-controller, Spurious 
SUSPENDM\n);
-   break;
-   }
-
-   power = ~MUSB_POWER_SUSPENDM;
-   musb_writeb(mbase, MUSB_POWER,
-   power | MUSB_POWER_RESUME);
-
musb-port1_status |=
(USB_PORT_STAT_C_SUSPEND  16)
| MUSB_PORT_STAT_RESUME;
-- 
2.3.0

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


[PATCH v2 06/15] usb: musb: core: break long line

2015-02-26 Thread Felipe Balbi
no functional changes, clean up only.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index f63599368645..10d3f10ba728 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -534,7 +534,8 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
 */
if (int_usb  MUSB_INTR_RESUME) {
handled = IRQ_HANDLED;
-   dev_dbg(musb-controller, RESUME (%s)\n, 
usb_otg_state_string(musb-xceiv-otg-state));
+   dev_dbg(musb-controller, RESUME (%s)\n,
+   usb_otg_state_string(musb-xceiv-otg-state));
 
if (devctl  MUSB_DEVCTL_HM) {
void __iomem *mbase = musb-mregs;
-- 
2.3.0

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


[PATCH v2 01/15] usb: musb: core: remove unnecessary logical comparison

2015-02-26 Thread Felipe Balbi
devctl  MUSB_DEVCTL_HM represents a single bit,
just check for the bit, there's really no need
to compare the result against 0.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 2b018cf11106..625ff4321505 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -879,7 +879,7 @@ b_host:
 */
if (int_usb  MUSB_INTR_RESET) {
handled = IRQ_HANDLED;
-   if ((devctl  MUSB_DEVCTL_HM) != 0) {
+   if (devctl  MUSB_DEVCTL_HM) {
/*
 * Looks like non-HS BABBLE can be ignored, but
 * HS BABBLE is an error condition. For HS the solution
-- 
2.3.0

--
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 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
 FSDEV is set for both HIGH and FULL speeds,
 the correct HIGHSPEED check is done through
 power register's HSMODE bit.
 
 Signed-off-by: Felipe Balbi ba...@ti.com

I'm still unsure if we should really ignore babble on FS/LS. It seems to
me we should never ignore it, but I really don't have a way to prove
this statement. For the sake of reducing impact, we will just fix HS
check here.

-- 
balbi


signature.asc
Description: Digital signature


[RFC][PATCH] usbnet: Fix tx_bytes statistic running backward in cdc_ncm

2015-02-26 Thread Ben Hutchings
cdc_ncm disagrees with usbnet about how much framing overhead should
be counted in the tx_bytes statistics, and tries 'fix' this by
decrementing tx_bytes on the transmit path.  But statistics must never
be decremented except due to roll-over; this will thoroughly confuse
user-space.  Also, tx_bytes is only incremented by usbnet in the
completion path.

Fix this by requiring drivers that set FLAG_MULTI_FRAME to set a
tx_bytes delta along with the tx_packets count.

Signed-off-by: Ben Hutchings ben.hutchi...@codethink.co.uk
---
I noticed this bug while trying to fix the tx_packets statistic in asix.
It depends on the patch I just sent for that.  I don't have any hardware
to test this with, or any need to make it work.  If you want this fix,
please test and re-submit it yoursef.

Ben.

 drivers/net/usb/asix_common.c |2 +-
 drivers/net/usb/cdc_ncm.c |7 +++
 drivers/net/usb/sr9800.c  |2 +-
 drivers/net/usb/usbnet.c  |   16 +---
 include/linux/usb/usbnet.h|6 --
 5 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 724a9b50df7a..75d6f26729a3 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -189,7 +189,7 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct 
sk_buff *skb,
skb_put(skb, sizeof(padbytes));
}
 
-   usbnet_set_skb_tx_stats(skb, 1);
+   usbnet_set_skb_tx_stats(skb, 1, 0);
return skb;
 }
 
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 70cbea551139..c3e4da9e79ca 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1177,13 +1177,12 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct 
sk_buff *skb, __le32 sign)
ctx-tx_overhead += skb_out-len - ctx-tx_curr_frame_payload;
ctx-tx_ntbs++;
 
-   /* usbnet has already counted all the framing overhead.
+   /* usbnet will count all the framing overhead by default.
 * Adjust the stats so that the tx_bytes counter show real
 * payload data instead.
 */
-   dev-net-stats.tx_bytes -= skb_out-len - ctx-tx_curr_frame_payload;
-
-   usbnet_set_skb_tx_stats(skb_out, n);
+   usbnet_set_skb_tx_stats(skb_out, n,
+   ctx-tx_curr_frame_payload - skb_out-len);
 
return skb_out;
 
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index 7650cdc8fe6b..953de13267df 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -144,7 +144,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, 
struct sk_buff *skb,
skb_put(skb, sizeof(padbytes));
}
 
-   usbnet_set_skb_tx_stats(skb, 1);
+   usbnet_set_skb_tx_stats(skb, 1, 0);
return skb;
 }
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 0f3ff285f6a1..57ae1973 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1346,9 +1346,19 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
} else
urb-transfer_flags |= URB_ZERO_PACKET;
}
-   entry-length = urb-transfer_buffer_length = length;
-   if (!(info-flags  FLAG_MULTI_PACKET))
-   usbnet_set_skb_tx_stats(skb, 1);
+   urb-transfer_buffer_length = length;
+
+   if (info-flags  FLAG_MULTI_PACKET) {
+   /* Driver has set number of packets and a length delta.
+* Calculate the complete length and ensure that it's
+* positive.
+*/
+   entry-length += length;
+   if (WARN_ON_ONCE(entry-length = 0))
+   entry-length = length;
+   } else {
+   usbnet_set_skb_tx_stats(skb, 1, length);
+   }
 
spin_lock_irqsave(dev-txq.lock, flags);
retval = usb_autopm_get_interface_async(dev-intf);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index ff3fb2bd0e90..6e0ce8c7b8cb 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -227,7 +227,7 @@ struct skb_data {   /* skb-cb is one of these */
struct urb  *urb;
struct usbnet   *dev;
enum skb_state  state;
-   size_t  length;
+   longlength;
unsigned long   packets;
 };
 
@@ -235,11 +235,13 @@ struct skb_data { /* skb-cb is one of these */
  * tx_fixup method before returning an skb.
  */
 static inline void
-usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets)
+usbnet_set_skb_tx_stats(struct sk_buff *skb,
+   unsigned long packets, long bytes_delta)
 {
struct skb_data *entry = (struct skb_data *) skb-cb;
 
entry-packets = packets;
+   entry-length = bytes_delta;
 }
 
 extern int usbnet_open(struct net_device *net);
-- 
1.7.10.4



--
To unsubscribe from this list: send the line 

Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Bin Liu
On Thu, Feb 26, 2015 at 1:48 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
 Felipe,

 On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
  FSDEV is set for both HIGH and FULL speeds,
  the correct HIGHSPEED check is done through
  power register's HSMODE bit.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
 
  I'm still unsure if we should really ignore babble on FS/LS. It seems to
  me we should never ignore it, but I really don't have a way to prove
  this statement. For the sake of reducing impact, we will just fix HS
  check here.
 

 I believe we should drop speed check in here and not ignore babble
 regardless. We have seen many cases that full-speed babble causes MUSB
 stop working.

 I'll make that as a separate patch then, just to make sure we can revert
 it later if something goes wrong ;-)

Agreed.


 --
 balbi
--
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 09/15] usb: musb: dsps: remove babble check from dsps irq handler

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 01:34:03PM -0600, Bin Liu wrote:
 Felipe,
 
 On Thu, Feb 26, 2015 at 12:25 PM, Felipe Balbi ba...@ti.com wrote:
  musb-int_usb already contains the correct
  information for musb-core to handle babble.
 
  In fact, this very check was just causing a
  nonsensical babble interrupt storm because.
 
 I guess this is my English problem. I thought you miss the reason
 after 'because'? That was the intention of my quesiton in v1.

hehe, yeah it doesn't parse correctly :-) I'll finish the sentence,
thanks.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 01:49:51PM -0600, Bin Liu wrote:
 On Thu, Feb 26, 2015 at 1:48 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
  Felipe,
 
  On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
   FSDEV is set for both HIGH and FULL speeds,
   the correct HIGHSPEED check is done through
   power register's HSMODE bit.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
  
   I'm still unsure if we should really ignore babble on FS/LS. It seems to
   me we should never ignore it, but I really don't have a way to prove
   this statement. For the sake of reducing impact, we will just fix HS
   check here.
  
 
  I believe we should drop speed check in here and not ignore babble
  regardless. We have seen many cases that full-speed babble causes MUSB
  stop working.
 
  I'll make that as a separate patch then, just to make sure we can revert
  it later if something goes wrong ;-)
 
 Agreed.

I noticed something else. If we really don't need to reset musb in case
of babble, then we can drop that recover_work completely which
simplifies babble handling quite a bit.

I'll fiddle with that, if you don't mind.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Bin Liu
On Thu, Feb 26, 2015 at 1:59 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 01:49:51PM -0600, Bin Liu wrote:
 On Thu, Feb 26, 2015 at 1:48 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
  Felipe,
 
  On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
   FSDEV is set for both HIGH and FULL speeds,
   the correct HIGHSPEED check is done through
   power register's HSMODE bit.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
  
   I'm still unsure if we should really ignore babble on FS/LS. It seems to
   me we should never ignore it, but I really don't have a way to prove
   this statement. For the sake of reducing impact, we will just fix HS
   check here.
  
 
  I believe we should drop speed check in here and not ignore babble
  regardless. We have seen many cases that full-speed babble causes MUSB
  stop working.
 
  I'll make that as a separate patch then, just to make sure we can revert
  it later if something goes wrong ;-)

 Agreed.

 I noticed something else. If we really don't need to reset musb in case
 of babble, then we can drop that recover_work completely which
 simplifies babble handling quite a bit.

 I'll fiddle with that, if you don't mind.

That is fine with me. I am writing the comments for the dropping reset
patch right now ;)

We only need the following in musb_recover_work() for the recovery.

1852 /*
1853  * When a babble condition occurs, the musb controller
1854  * removes the session bit and the endpoint config is lost.
1855  */
1856 if (musb-dyn_fifo)
1857 status = ep_config_from_table(musb);
1858 else
1859 status = ep_config_from_hw(musb);
1860
1861 /* start the session again */
1862 if (status == 0)
1863 musb_start(musb);


 --
 balbi
--
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 0/1] USB: ch341: set tty baud speed according to tty struct

2015-02-26 Thread Nicolas PLANEL
Nicolas PLANEL (1):
  USB: ch341: set tty baud speed according to tty struct

 drivers/usb/serial/ch341.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.3.0

--
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/1] USB: ch341: set tty baud speed according to tty struct

2015-02-26 Thread Nicolas PLANEL
The ch341_set_baudrate() function initialize the device baud speed according
to the value on priv-baud_rate. By default the ch341_open() set it to a
hardcoded value (DEFAULT_BAUD_RATE 9600). Unfortunately, the tty_struct is
not initialized with the same default value. (usually 56700)

This means that the tty_struct and the device baud rate generator are not
synchronized after opening the port.

Fixup is done by calling ch341_set_termios() if tty exist.
Remove unnecessary variable priv-baud_rate setup as it's already done by 
ch341_port_probe().

Signed-off-by: Nicolas PLANEL nicolas.pla...@enovance.com
---
 drivers/usb/serial/ch341.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c
index 2d72aa3564a3..5d28ca165fdf 100644
--- a/drivers/usb/serial/ch341.c
+++ b/drivers/usb/serial/ch341.c
@@ -84,6 +84,10 @@ struct ch341_private {
u8 line_status; /* active status of modem control inputs */
 };
 
+static void ch341_set_termios(struct tty_struct *tty,
+ struct usb_serial_port *port,
+ struct ktermios *old_termios);
+
 static int ch341_control_out(struct usb_device *dev, u8 request,
 u16 value, u16 index)
 {
@@ -309,8 +313,6 @@ static int ch341_open(struct tty_struct *tty, struct 
usb_serial_port *port)
struct ch341_private *priv = usb_get_serial_port_data(port);
int r;
 
-   priv-baud_rate = DEFAULT_BAUD_RATE;
-
r = ch341_configure(serial-dev, priv);
if (r)
goto out;
@@ -323,6 +325,9 @@ static int ch341_open(struct tty_struct *tty, struct 
usb_serial_port *port)
if (r)
goto out;
 
+   if (tty)
+   ch341_set_termios(tty, port, NULL);
+
dev_dbg(port-dev, %s - submitting interrupt urb\n, __func__);
r = usb_submit_urb(port-interrupt_in_urb, GFP_KERNEL);
if (r) {
-- 
2.3.0

--
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 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 02:04:37PM -0600, Bin Liu wrote:
 On Thu, Feb 26, 2015 at 1:59 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 01:49:51PM -0600, Bin Liu wrote:
  On Thu, Feb 26, 2015 at 1:48 PM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
   Felipe,
  
   On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
FSDEV is set for both HIGH and FULL speeds,
the correct HIGHSPEED check is done through
power register's HSMODE bit.
   
Signed-off-by: Felipe Balbi ba...@ti.com
   
I'm still unsure if we should really ignore babble on FS/LS. It seems 
to
me we should never ignore it, but I really don't have a way to prove
this statement. For the sake of reducing impact, we will just fix HS
check here.
   
  
   I believe we should drop speed check in here and not ignore babble
   regardless. We have seen many cases that full-speed babble causes MUSB
   stop working.
  
   I'll make that as a separate patch then, just to make sure we can revert
   it later if something goes wrong ;-)
 
  Agreed.
 
  I noticed something else. If we really don't need to reset musb in case
  of babble, then we can drop that recover_work completely which
  simplifies babble handling quite a bit.
 
  I'll fiddle with that, if you don't mind.
 
 That is fine with me. I am writing the comments for the dropping reset
 patch right now ;)
 
 We only need the following in musb_recover_work() for the recovery.
 
 1852 /*
 1853  * When a babble condition occurs, the musb controller
 1854  * removes the session bit and the endpoint config is lost.
 1855  */
 1856 if (musb-dyn_fifo)
 1857 status = ep_config_from_table(musb);
 1858 else
 1859 status = ep_config_from_hw(musb);
 1860
 1861 /* start the session again */
 1862 if (status == 0)
 1863 musb_start(musb);

the statement that musb looses ep configuration seems bogus to me. I
dropped that too:

commit 4a07d415bf5894c66f61827c30053a65d6dfce26
Author: Felipe Balbi ba...@ti.com
Date:   Thu Feb 26 14:02:35 2015 -0600

usb: musb: core: simplify musb_recover_work()

we're not resetting musb at all, just restarting
the session. This means we don't need to touch PHYs
or VBUS or anything like that. Just make sure session
bit is reenabled after MUSB dropped it.

Signed-off-by: Felipe Balbi ba...@ti.com

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index d9c627d54db6..219636c1b020 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data)
 static void musb_recover_work(struct work_struct *data)
 {
struct musb *musb = container_of(data, struct musb, recover_work.work);
-   int status, ret;
+   int ret;
+   u8 devctl;
 
ret  = musb_platform_reset(musb);
if (ret) {
@@ -1843,24 +1844,17 @@ static void musb_recover_work(struct work_struct *data)
return;
}
 
-   usb_phy_vbus_off(musb-xceiv);
-   usleep_range(100, 200);
-
-   usb_phy_vbus_on(musb-xceiv);
-   usleep_range(100, 200);
+   /* drop session bit */
+   devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
+   devctl = ~MUSB_DEVCTL_SESSION;
+   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
 
-   /*
-* When a babble condition occurs, the musb controller
-* removes the session bit and the endpoint config is lost.
-*/
-   if (musb-dyn_fifo)
-   status = ep_config_from_table(musb);
-   else
-   status = ep_config_from_hw(musb);
+   /* wait for session to really drop */
+   udelay(100);
 
-   /* start the session again */
-   if (status == 0)
-   musb_start(musb);
+   /* restart session */
+   devctl |= MUSB_DEVCTL_SESSION;
+   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
 }
 
 /* --


the only thing that we're still missing is a notification to usbcore
that we have a port being disabled, that's the only way to have testusb
know that it has been disconnected by the host.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
Hi again,

On Thu, Feb 26, 2015 at 02:15:40PM -0600, Felipe Balbi wrote:
  On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
  FSDEV is set for both HIGH and FULL speeds,
  the correct HIGHSPEED check is done through
  power register's HSMODE bit.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
 
  I'm still unsure if we should really ignore babble on FS/LS. It 
  seems to
  me we should never ignore it, but I really don't have a way to 
  prove
  this statement. For the sake of reducing impact, we will just fix 
  HS
  check here.
 

 I believe we should drop speed check in here and not ignore babble
 regardless. We have seen many cases that full-speed babble causes 
 MUSB
 stop working.

 I'll make that as a separate patch then, just to make sure we can 
 revert
 it later if something goes wrong ;-)
   
Agreed.
   
I noticed something else. If we really don't need to reset musb in case
of babble, then we can drop that recover_work completely which
simplifies babble handling quite a bit.
   
I'll fiddle with that, if you don't mind.
   
   That is fine with me. I am writing the comments for the dropping reset
   patch right now ;)
   
   We only need the following in musb_recover_work() for the recovery.
   
   1852 /*
   1853  * When a babble condition occurs, the musb controller
   1854  * removes the session bit and the endpoint config is lost.
   1855  */
   1856 if (musb-dyn_fifo)
   1857 status = ep_config_from_table(musb);
   1858 else
   1859 status = ep_config_from_hw(musb);
   1860
   1861 /* start the session again */
   1862 if (status == 0)
   1863 musb_start(musb);
  
  the statement that musb looses ep configuration seems bogus to me. I
  dropped that too:
  
  commit 4a07d415bf5894c66f61827c30053a65d6dfce26
  Author: Felipe Balbi ba...@ti.com
  Date:   Thu Feb 26 14:02:35 2015 -0600
  
  usb: musb: core: simplify musb_recover_work()
  
  we're not resetting musb at all, just restarting
  the session. This means we don't need to touch PHYs
  or VBUS or anything like that. Just make sure session
  bit is reenabled after MUSB dropped it.
  
  Signed-off-by: Felipe Balbi ba...@ti.com
  
  diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
  index d9c627d54db6..219636c1b020 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data)
   static void musb_recover_work(struct work_struct *data)
   {
  struct musb *musb = container_of(data, struct musb, recover_work.work);
  -   int status, ret;
  +   int ret;
  +   u8 devctl;
   
  ret  = musb_platform_reset(musb);
  if (ret) {
  @@ -1843,24 +1844,17 @@ static void musb_recover_work(struct work_struct 
  *data)
  return;
  }
   
  -   usb_phy_vbus_off(musb-xceiv);
  -   usleep_range(100, 200);
  -
  -   usb_phy_vbus_on(musb-xceiv);
  -   usleep_range(100, 200);
  +   /* drop session bit */
  +   devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
  +   devctl = ~MUSB_DEVCTL_SESSION;
  +   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
   
  -   /*
  -* When a babble condition occurs, the musb controller
  -* removes the session bit and the endpoint config is lost.
  -*/
  -   if (musb-dyn_fifo)
  -   status = ep_config_from_table(musb);
  -   else
  -   status = ep_config_from_hw(musb);
  +   /* wait for session to really drop */
  +   udelay(100);
   
  -   /* start the session again */
  -   if (status == 0)
  -   musb_start(musb);
  +   /* restart session */
  +   devctl |= MUSB_DEVCTL_SESSION;
  +   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
   }
   
   /* 
  --
  
  
  the only thing that we're still missing is a notification to usbcore
  that we have a port being disabled, that's the only way to have testusb
  know that it has been disconnected by the host.
 
 here's the final version:
 
 commit 3db11e7da5938bbd955410355194625f699a424c
 Author: Felipe Balbi ba...@ti.com
 Date:   Thu Feb 26 14:02:35 2015 -0600
 
 usb: musb: core: simplify musb_recover_work()
 
 we're not resetting musb at all, just restarting
 the session. This means we don't need to touch PHYs
 or VBUS or anything like that. Just make sure session
 bit is reenabled after MUSB dropped it.
 
 while at that, make sure to tell usbcore that we're
 dropping the session and, thus, disconnecting the
 device.
 
 Signed-off-by: Felipe Balbi ba...@ti.com
 
 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index d9c627d54db6..64cb242d92f7 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ 

Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 02:25:20PM -0600, Bin Liu wrote:
 On Thu, Feb 26, 2015 at 2:19 PM, Felipe Balbi ba...@ti.com wrote:
  Hi again,
 
  On Thu, Feb 26, 2015 at 02:15:40PM -0600, Felipe Balbi wrote:
   On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
   FSDEV is set for both HIGH and FULL speeds,
   the correct HIGHSPEED check is done through
   power register's HSMODE bit.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
  
   I'm still unsure if we should really ignore babble on FS/LS. 
   It seems to
   me we should never ignore it, but I really don't have a way to 
   prove
   this statement. For the sake of reducing impact, we will just 
   fix HS
   check here.
  
 
  I believe we should drop speed check in here and not ignore 
  babble
  regardless. We have seen many cases that full-speed babble 
  causes MUSB
  stop working.
 
  I'll make that as a separate patch then, just to make sure we can 
  revert
  it later if something goes wrong ;-)

 Agreed.

 I noticed something else. If we really don't need to reset musb in 
 case
 of babble, then we can drop that recover_work completely which
 simplifies babble handling quite a bit.

 I'll fiddle with that, if you don't mind.
   
That is fine with me. I am writing the comments for the dropping reset
patch right now ;)
   
We only need the following in musb_recover_work() for the recovery.
   
1852 /*
1853  * When a babble condition occurs, the musb controller
1854  * removes the session bit and the endpoint config is 
lost.
1855  */
1856 if (musb-dyn_fifo)
1857 status = ep_config_from_table(musb);
1858 else
1859 status = ep_config_from_hw(musb);
1860
1861 /* start the session again */
1862 if (status == 0)
1863 musb_start(musb);
  
   the statement that musb looses ep configuration seems bogus to me. I
   dropped that too:
  
   commit 4a07d415bf5894c66f61827c30053a65d6dfce26
   Author: Felipe Balbi ba...@ti.com
   Date:   Thu Feb 26 14:02:35 2015 -0600
  
   usb: musb: core: simplify musb_recover_work()
  
   we're not resetting musb at all, just restarting
   the session. This means we don't need to touch PHYs
   or VBUS or anything like that. Just make sure session
   bit is reenabled after MUSB dropped it.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
  
   diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
   index d9c627d54db6..219636c1b020 100644
   --- a/drivers/usb/musb/musb_core.c
   +++ b/drivers/usb/musb/musb_core.c
   @@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data)
static void musb_recover_work(struct work_struct *data)
{
   struct musb *musb = container_of(data, struct musb, 
   recover_work.work);
   -   int status, ret;
   +   int ret;
   +   u8 devctl;
  
   ret  = musb_platform_reset(musb);
   if (ret) {
   @@ -1843,24 +1844,17 @@ static void musb_recover_work(struct work_struct 
   *data)
   return;
   }
  
   -   usb_phy_vbus_off(musb-xceiv);
   -   usleep_range(100, 200);
   -
   -   usb_phy_vbus_on(musb-xceiv);
   -   usleep_range(100, 200);
   +   /* drop session bit */
   +   devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
   +   devctl = ~MUSB_DEVCTL_SESSION;
   +   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
  
   -   /*
   -* When a babble condition occurs, the musb controller
   -* removes the session bit and the endpoint config is lost.
   -*/
   -   if (musb-dyn_fifo)
   -   status = ep_config_from_table(musb);
   -   else
   -   status = ep_config_from_hw(musb);
   +   /* wait for session to really drop */
   +   udelay(100);
  
   -   /* start the session again */
   -   if (status == 0)
   -   musb_start(musb);
   +   /* restart session */
   +   devctl |= MUSB_DEVCTL_SESSION;
   +   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
}
  
/* 
   --
  
  
   the only thing that we're still missing is a notification to usbcore
   that we have a port being disabled, that's the only way to have testusb
   know that it has been disconnected by the host.
 
  here's the final version:
 
  commit 3db11e7da5938bbd955410355194625f699a424c
  Author: Felipe Balbi ba...@ti.com
  Date:   Thu Feb 26 14:02:35 2015 -0600
 
  usb: musb: core: simplify musb_recover_work()
 
  we're not resetting musb at all, just restarting
  the session. This means we don't need to touch PHYs
  or VBUS or anything like that. Just make sure session
  bit is reenabled after MUSB dropped it.
 
  while at that, make sure to tell usbcore that we're
  dropping the session and, thus, disconnecting 

Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
 Felipe,
 
 On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
  FSDEV is set for both HIGH and FULL speeds,
  the correct HIGHSPEED check is done through
  power register's HSMODE bit.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
 
  I'm still unsure if we should really ignore babble on FS/LS. It seems to
  me we should never ignore it, but I really don't have a way to prove
  this statement. For the sake of reducing impact, we will just fix HS
  check here.
 
 
 I believe we should drop speed check in here and not ignore babble
 regardless. We have seen many cases that full-speed babble causes MUSB
 stop working.

I'll make that as a separate patch then, just to make sure we can revert
it later if something goes wrong ;-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH 24/29] usb: gadget: printer: factor out f_printer

2015-02-26 Thread Felipe Balbi
On Mon, Feb 23, 2015 at 04:02:13PM +0100, Andrzej Pietrasiewicz wrote:
 The legacy printer gadget now contains both a reusable printer function
 and legacy gadget proper implementations interwoven, but logically
 separate. This patch factors out a reusable f_printer.
 
 Signed-off-by: Andrzej Pietrasiewicz andrze...@samsung.com

I've applied up to this patch. Note that I fixed a few sparse errors
along the way and now the rest of the series doesn't apply. Please
rebase on my testing/next so I can take the rest of your patches.

Make sure each and every patch builds without errors or warnings
(including sparse).

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Bin Liu
On Thu, Feb 26, 2015 at 2:04 PM, Bin Liu binml...@gmail.com wrote:
 On Thu, Feb 26, 2015 at 1:59 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 01:49:51PM -0600, Bin Liu wrote:
 On Thu, Feb 26, 2015 at 1:48 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
  Felipe,
 
  On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
   FSDEV is set for both HIGH and FULL speeds,
   the correct HIGHSPEED check is done through
   power register's HSMODE bit.
  
   Signed-off-by: Felipe Balbi ba...@ti.com
  
   I'm still unsure if we should really ignore babble on FS/LS. It seems 
   to
   me we should never ignore it, but I really don't have a way to prove
   this statement. For the sake of reducing impact, we will just fix HS
   check here.
  
 
  I believe we should drop speed check in here and not ignore babble
  regardless. We have seen many cases that full-speed babble causes MUSB
  stop working.
 
  I'll make that as a separate patch then, just to make sure we can revert
  it later if something goes wrong ;-)

 Agreed.

 I noticed something else. If we really don't need to reset musb in case
 of babble, then we can drop that recover_work completely which
 simplifies babble handling quite a bit.

 I'll fiddle with that, if you don't mind.

 That is fine with me. I am writing the comments for the dropping reset
 patch right now ;)

I meant your idea is better. I will drop my patch.


 We only need the following in musb_recover_work() for the recovery.

 1852 /*
 1853  * When a babble condition occurs, the musb controller
 1854  * removes the session bit and the endpoint config is lost.
 1855  */
 1856 if (musb-dyn_fifo)
 1857 status = ep_config_from_table(musb);
 1858 else
 1859 status = ep_config_from_hw(musb);
 1860
 1861 /* start the session again */
 1862 if (status == 0)
 1863 musb_start(musb);


 --
 balbi
--
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 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
Hi,

On Thu, Feb 26, 2015 at 02:11:15PM -0600, Felipe Balbi wrote:
 On Thu, Feb 26, 2015 at 02:04:37PM -0600, Bin Liu wrote:
  On Thu, Feb 26, 2015 at 1:59 PM, Felipe Balbi ba...@ti.com wrote:
   On Thu, Feb 26, 2015 at 01:49:51PM -0600, Bin Liu wrote:
   On Thu, Feb 26, 2015 at 1:48 PM, Felipe Balbi ba...@ti.com wrote:
On Thu, Feb 26, 2015 at 01:30:21PM -0600, Bin Liu wrote:
Felipe,
   
On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
 FSDEV is set for both HIGH and FULL speeds,
 the correct HIGHSPEED check is done through
 power register's HSMODE bit.

 Signed-off-by: Felipe Balbi ba...@ti.com

 I'm still unsure if we should really ignore babble on FS/LS. It 
 seems to
 me we should never ignore it, but I really don't have a way to prove
 this statement. For the sake of reducing impact, we will just fix HS
 check here.

   
I believe we should drop speed check in here and not ignore babble
regardless. We have seen many cases that full-speed babble causes MUSB
stop working.
   
I'll make that as a separate patch then, just to make sure we can 
revert
it later if something goes wrong ;-)
  
   Agreed.
  
   I noticed something else. If we really don't need to reset musb in case
   of babble, then we can drop that recover_work completely which
   simplifies babble handling quite a bit.
  
   I'll fiddle with that, if you don't mind.
  
  That is fine with me. I am writing the comments for the dropping reset
  patch right now ;)
  
  We only need the following in musb_recover_work() for the recovery.
  
  1852 /*
  1853  * When a babble condition occurs, the musb controller
  1854  * removes the session bit and the endpoint config is lost.
  1855  */
  1856 if (musb-dyn_fifo)
  1857 status = ep_config_from_table(musb);
  1858 else
  1859 status = ep_config_from_hw(musb);
  1860
  1861 /* start the session again */
  1862 if (status == 0)
  1863 musb_start(musb);
 
 the statement that musb looses ep configuration seems bogus to me. I
 dropped that too:
 
 commit 4a07d415bf5894c66f61827c30053a65d6dfce26
 Author: Felipe Balbi ba...@ti.com
 Date:   Thu Feb 26 14:02:35 2015 -0600
 
 usb: musb: core: simplify musb_recover_work()
 
 we're not resetting musb at all, just restarting
 the session. This means we don't need to touch PHYs
 or VBUS or anything like that. Just make sure session
 bit is reenabled after MUSB dropped it.
 
 Signed-off-by: Felipe Balbi ba...@ti.com
 
 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index d9c627d54db6..219636c1b020 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data)
  static void musb_recover_work(struct work_struct *data)
  {
   struct musb *musb = container_of(data, struct musb, recover_work.work);
 - int status, ret;
 + int ret;
 + u8 devctl;
  
   ret  = musb_platform_reset(musb);
   if (ret) {
 @@ -1843,24 +1844,17 @@ static void musb_recover_work(struct work_struct 
 *data)
   return;
   }
  
 - usb_phy_vbus_off(musb-xceiv);
 - usleep_range(100, 200);
 -
 - usb_phy_vbus_on(musb-xceiv);
 - usleep_range(100, 200);
 + /* drop session bit */
 + devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
 + devctl = ~MUSB_DEVCTL_SESSION;
 + musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
  
 - /*
 -  * When a babble condition occurs, the musb controller
 -  * removes the session bit and the endpoint config is lost.
 -  */
 - if (musb-dyn_fifo)
 - status = ep_config_from_table(musb);
 - else
 - status = ep_config_from_hw(musb);
 + /* wait for session to really drop */
 + udelay(100);
  
 - /* start the session again */
 - if (status == 0)
 - musb_start(musb);
 + /* restart session */
 + devctl |= MUSB_DEVCTL_SESSION;
 + musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
  }
  
  /* --
 
 
 the only thing that we're still missing is a notification to usbcore
 that we have a port being disabled, that's the only way to have testusb
 know that it has been disconnected by the host.

here's the final version:

commit 3db11e7da5938bbd955410355194625f699a424c
Author: Felipe Balbi ba...@ti.com
Date:   Thu Feb 26 14:02:35 2015 -0600

usb: musb: core: simplify musb_recover_work()

we're not resetting musb at all, just restarting
the session. This means we don't need to touch PHYs
or VBUS or anything like that. Just make sure session
bit is reenabled after MUSB dropped it.

while at that, make sure to tell usbcore 

Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Bin Liu
On Thu, Feb 26, 2015 at 2:19 PM, Felipe Balbi ba...@ti.com wrote:
 Hi again,

 On Thu, Feb 26, 2015 at 02:15:40PM -0600, Felipe Balbi wrote:
  On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
  FSDEV is set for both HIGH and FULL speeds,
  the correct HIGHSPEED check is done through
  power register's HSMODE bit.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
 
  I'm still unsure if we should really ignore babble on FS/LS. It 
  seems to
  me we should never ignore it, but I really don't have a way to 
  prove
  this statement. For the sake of reducing impact, we will just 
  fix HS
  check here.
 

 I believe we should drop speed check in here and not ignore babble
 regardless. We have seen many cases that full-speed babble causes 
 MUSB
 stop working.

 I'll make that as a separate patch then, just to make sure we can 
 revert
 it later if something goes wrong ;-)
   
Agreed.
   
I noticed something else. If we really don't need to reset musb in case
of babble, then we can drop that recover_work completely which
simplifies babble handling quite a bit.
   
I'll fiddle with that, if you don't mind.
  
   That is fine with me. I am writing the comments for the dropping reset
   patch right now ;)
  
   We only need the following in musb_recover_work() for the recovery.
  
   1852 /*
   1853  * When a babble condition occurs, the musb controller
   1854  * removes the session bit and the endpoint config is lost.
   1855  */
   1856 if (musb-dyn_fifo)
   1857 status = ep_config_from_table(musb);
   1858 else
   1859 status = ep_config_from_hw(musb);
   1860
   1861 /* start the session again */
   1862 if (status == 0)
   1863 musb_start(musb);
 
  the statement that musb looses ep configuration seems bogus to me. I
  dropped that too:
 
  commit 4a07d415bf5894c66f61827c30053a65d6dfce26
  Author: Felipe Balbi ba...@ti.com
  Date:   Thu Feb 26 14:02:35 2015 -0600
 
  usb: musb: core: simplify musb_recover_work()
 
  we're not resetting musb at all, just restarting
  the session. This means we don't need to touch PHYs
  or VBUS or anything like that. Just make sure session
  bit is reenabled after MUSB dropped it.
 
  Signed-off-by: Felipe Balbi ba...@ti.com
 
  diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
  index d9c627d54db6..219636c1b020 100644
  --- a/drivers/usb/musb/musb_core.c
  +++ b/drivers/usb/musb/musb_core.c
  @@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct *data)
   static void musb_recover_work(struct work_struct *data)
   {
  struct musb *musb = container_of(data, struct musb, recover_work.work);
  -   int status, ret;
  +   int ret;
  +   u8 devctl;
 
  ret  = musb_platform_reset(musb);
  if (ret) {
  @@ -1843,24 +1844,17 @@ static void musb_recover_work(struct work_struct 
  *data)
  return;
  }
 
  -   usb_phy_vbus_off(musb-xceiv);
  -   usleep_range(100, 200);
  -
  -   usb_phy_vbus_on(musb-xceiv);
  -   usleep_range(100, 200);
  +   /* drop session bit */
  +   devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
  +   devctl = ~MUSB_DEVCTL_SESSION;
  +   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
 
  -   /*
  -* When a babble condition occurs, the musb controller
  -* removes the session bit and the endpoint config is lost.
  -*/
  -   if (musb-dyn_fifo)
  -   status = ep_config_from_table(musb);
  -   else
  -   status = ep_config_from_hw(musb);
  +   /* wait for session to really drop */
  +   udelay(100);
 
  -   /* start the session again */
  -   if (status == 0)
  -   musb_start(musb);
  +   /* restart session */
  +   devctl |= MUSB_DEVCTL_SESSION;
  +   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
   }
 
   /* 
  --
 
 
  the only thing that we're still missing is a notification to usbcore
  that we have a port being disabled, that's the only way to have testusb
  know that it has been disconnected by the host.

 here's the final version:

 commit 3db11e7da5938bbd955410355194625f699a424c
 Author: Felipe Balbi ba...@ti.com
 Date:   Thu Feb 26 14:02:35 2015 -0600

 usb: musb: core: simplify musb_recover_work()

 we're not resetting musb at all, just restarting
 the session. This means we don't need to touch PHYs
 or VBUS or anything like that. Just make sure session
 bit is reenabled after MUSB dropped it.

 while at that, make sure to tell usbcore that we're
 dropping the session and, thus, disconnecting the
 device.

 Signed-off-by: Felipe Balbi ba...@ti.com

 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index d9c627d54db6..64cb242d92f7 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ 

[PATCH v2 09/15] usb: musb: dsps: remove babble check from dsps irq handler

2015-02-26 Thread Felipe Balbi
musb-int_usb already contains the correct
information for musb-core to handle babble.

In fact, this very check was just causing a
nonsensical babble interrupt storm because.

With this I can get test.sh to run and, even though
all tests fail with timeout, that's still better
than locking up the system due to IRQ storm.

Also, if I remove g_zero and load g_mass_storage,
then everything works fine again.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 22 --
 1 file changed, 22 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 7584601c96f3..b79202c3dd65 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -330,28 +330,6 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)
 
dev_dbg(musb-controller, usbintr (%x) epintr(%x)\n,
usbintr, epintr);
-   /*
-* DRVVBUS IRQs are the only proxy we have (a very poor one!) for
-* DSPS IP's missing ID change IRQ.  We need an ID change IRQ to
-* switch appropriately between halves of the OTG state machine.
-* Managing DEVCTL.SESSION per Mentor docs requires that we know its
-* value but DEVCTL.BDEVICE is invalid without DEVCTL.SESSION set.
-* Also, DRVVBUS pulses for SRP (but not at 5V) ...
-*/
-   if (is_host_active(musb)  usbintr  MUSB_INTR_BABBLE) {
-   pr_info(CAUTION: musb: Babble Interrupt Occurred\n);
-
-   /*
-* When a babble condition occurs, the musb controller removes
-* the session and is no longer in host mode. Hence, all
-* devices connected to its root hub get disconnected.
-*
-* Hand this error down to the musb core isr, so it can
-* recover.
-*/
-   musb-int_usb = MUSB_INTR_BABBLE | MUSB_INTR_DISCONNECT;
-   musb-int_tx = musb-int_rx = 0;
-   }
 
if (usbintr  ((1  wrp-drvvbus)  wrp-usb_shift)) {
int drvvbus = dsps_readl(reg_base, wrp-status);
-- 
2.3.0

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


[PATCH v2 13/15] usb: musb: core: refactor IRQ enable/disable to separate functions

2015-02-26 Thread Felipe Balbi
sometimes we want to just mask/unmask interrupts
without touching devctl register. For those
cases, let's introduce musb_enable_interrupts and
musb_disable_interrupts()

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 37 ++---
 1 file changed, 26 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 70b2612205f8..ff34ef2654ab 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -507,7 +507,9 @@ void musb_hnp_stop(struct musb *musb)
musb-port1_status = ~(USB_PORT_STAT_C_CONNECTION  16);
 }
 
+static void musb_disable_interrupts(struct musb *musb);
 static void musb_generic_disable(struct musb *musb);
+
 /*
  * Interrupt Service Routine to record USB global interrupts.
  * Since these do not happen often and signify things of
@@ -977,7 +979,7 @@ b_host:
 
 /*-*/
 
-static void musb_generic_disable(struct musb *musb)
+static void musb_disable_interrupts(struct musb *musb)
 {
void __iomem*mbase = musb-mregs;
u16 temp;
@@ -989,16 +991,35 @@ static void musb_generic_disable(struct musb *musb)
musb-intrrxe = 0;
musb_writew(mbase, MUSB_INTRRXE, 0);
 
-   /* off */
-   musb_writeb(mbase, MUSB_DEVCTL, 0);
-
/*  flush pending interrupts */
temp = musb_readb(mbase, MUSB_INTRUSB);
temp = musb_readw(mbase, MUSB_INTRTX);
temp = musb_readw(mbase, MUSB_INTRRX);
+}
+
+static void musb_enable_interrupts(struct musb *musb)
+{
+   void __iomem*regs = musb-mregs;
+
+   /*  Set INT enable registers, enable interrupts */
+   musb-intrtxe = musb-epmask;
+   musb_writew(regs, MUSB_INTRTXE, musb-intrtxe);
+   musb-intrrxe = musb-epmask  0xfffe;
+   musb_writew(regs, MUSB_INTRRXE, musb-intrrxe);
+   musb_writeb(regs, MUSB_INTRUSBE, 0xf7);
 
 }
 
+static void musb_generic_disable(struct musb *musb)
+{
+   void __iomem*mbase = musb-mregs;
+
+   musb_disable_interrupts(musb);
+
+   /* off */
+   musb_writeb(mbase, MUSB_DEVCTL, 0);
+}
+
 /*
  * Program the HDRC to start (enable interrupts, dma, etc.).
  */
@@ -1009,13 +1030,7 @@ void musb_start(struct musb *musb)
 
dev_dbg(musb-controller, == devctl %02x\n, devctl);
 
-   /*  Set INT enable registers, enable interrupts */
-   musb-intrtxe = musb-epmask;
-   musb_writew(regs, MUSB_INTRTXE, musb-intrtxe);
-   musb-intrrxe = musb-epmask  0xfffe;
-   musb_writew(regs, MUSB_INTRRXE, musb-intrrxe);
-   musb_writeb(regs, MUSB_INTRUSBE, 0xf7);
-
+   musb_enable_interrupts(musb);
musb_writeb(regs, MUSB_TESTMODE, 0);
 
/* put into basic highspeed mode and start session */
-- 
2.3.0

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


[PATCH v2 12/15] usb: musb: dsps: add dsps_ prefix to sw_babble_control

2015-02-26 Thread Felipe Balbi
this makes it easier to filter function traces.
No functional changes.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 285f0e4b083d..b52eecaf11a4 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -532,7 +532,7 @@ static int dsps_musb_set_mode(struct musb *musb, u8 mode)
return 0;
 }
 
-static bool  sw_babble_control(struct musb *musb)
+static bool dsps_sw_babble_control(struct musb *musb)
 {
u8 babble_ctl;
bool session_restart =  false;
@@ -591,7 +591,7 @@ static int dsps_musb_reset(struct musb *musb)
int session_restart = 0;
 
if (glue-sw_babble_enabled)
-   session_restart = sw_babble_control(musb);
+   session_restart = dsps_sw_babble_control(musb);
/*
 * In case of new silicon version babble condition can be recovered
 * without resetting the MUSB. But for older silicon versions, MUSB
-- 
2.3.0

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


[PATCH v2 08/15] usb: musb: core: there is no connect interrupt in peripheral mode

2015-02-26 Thread Felipe Balbi
MUSB does not generate a connect IRQ when working
in peripheral mode.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 81909ea74353..c3c5a6462600 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -761,10 +761,6 @@ static irqreturn_t musb_stage0_irq(struct musb *musb, u8 
int_usb,
 
musb-ep0_stage = MUSB_EP0_START;
 
-   /* flush endpoints when transitioning from Device Mode */
-   if (is_peripheral_active(musb)) {
-   /* REVISIT HNP; just force disconnect */
-   }
musb-intrtxe = musb-epmask;
musb_writew(musb-mregs, MUSB_INTRTXE, musb-intrtxe);
musb-intrrxe = musb-epmask  0xfffe;
-- 
2.3.0

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


[PATCH v2 05/15] usb: musb: core: move babble recovery inside babble check

2015-02-26 Thread Felipe Balbi
There was already a proper place where we were
checking for babble interrupts, move babble
recovery there.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 13 ++---
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index a252194fd9b1..f63599368645 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -899,6 +899,12 @@ b_host:
if (power  MUSB_POWER_HSMODE) {
ERR(Stopping host session -- babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
+
+   if (is_host_active(musb)) {
+   musb_generic_disable(musb);
+   
schedule_delayed_work(musb-recover_work,
+   msecs_to_jiffies(100));
+   }
}
} else {
dev_dbg(musb-controller, BUS RESET as %s\n,
@@ -938,13 +944,6 @@ b_host:
}
}
 
-   /* handle babble condition */
-   if (int_usb  MUSB_INTR_BABBLE  is_host_active(musb)) {
-   musb_generic_disable(musb);
-   schedule_delayed_work(musb-recover_work,
- msecs_to_jiffies(100));
-   }
-
 #if 0
 /* REVISIT ... this would be for multiplexing periodic endpoints, or
  * supporting transfer phasing to prevent exceeding ISO bandwidth
-- 
2.3.0

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


[PATCH v2 15/15] usb: musb: core: decrease delayed_work time

2015-02-26 Thread Felipe Balbi
When babble IRQ happens, we need to wait only
5.3us (320 cycles of 60MHz clock), we will give
it some slack and schedule our work a 10 usecs into
the future.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 8d016ba30c5f..e77dfab8205a 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -886,7 +886,7 @@ b_host:
if (is_host_active(musb)) {
musb_disable_interrupts(musb);

schedule_delayed_work(musb-recover_work,
-   msecs_to_jiffies(100));
+   usecs_to_jiffies(10));
}
}
} else {
-- 
2.3.0

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


[PATCH v2 14/15] usb: musb: don't touch devctl from babble recovery

2015-02-26 Thread Felipe Balbi
We do *not* want to touch devctl at all when
trying to recover from babble. All we want to
do is mask IRQs until we're done without our
babble recovery, at which point we will unmask
IRQs.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index ff34ef2654ab..8d016ba30c5f 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -884,7 +884,7 @@ b_host:
ERR(Babble - session will be dropped\n);
 
if (is_host_active(musb)) {
-   musb_generic_disable(musb);
+   musb_disable_interrupts(musb);

schedule_delayed_work(musb-recover_work,
msecs_to_jiffies(100));
}
@@ -1838,8 +1838,10 @@ static void musb_recover_work(struct work_struct *data)
int status, ret;
 
ret  = musb_platform_reset(musb);
-   if (ret)
+   if (ret) {
+   musb_enable_interrupts(musb);
return;
+   }
 
usb_phy_vbus_off(musb-xceiv);
usleep_range(100, 200);
-- 
2.3.0

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


[PATCH v2 11/15] usb: musb: core: controller drops session automatically

2015-02-26 Thread Felipe Balbi
Whenever babble happens, MUSB controller will
drop session automatically.

The only case where it won't drop the session,
is when we're running on AM335x and SW_SESSION_CTRL
bit has been set. In that case, controller will
not touch session bit so SW has a chance to recover
from babble condition.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c3c5a6462600..70b2612205f8 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -879,8 +879,7 @@ b_host:
 * the session.
 */
if (power  MUSB_POWER_HSMODE) {
-   ERR(Stopping host session -- babble\n);
-   musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
+   ERR(Babble - session will be dropped\n);
 
if (is_host_active(musb)) {
musb_generic_disable(musb);
-- 
2.3.0

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


[PATCH v2 02/15] usb: musb: core: add missing curly braces

2015-02-26 Thread Felipe Balbi
no functional changes, clean up only.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 625ff4321505..2767ce1bf016 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -887,9 +887,9 @@ b_host:
 * caused BABBLE. When HS BABBLE happens we can only
 * stop the session.
 */
-   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV))
+   if (devctl  (MUSB_DEVCTL_FSDEV | MUSB_DEVCTL_LSDEV)) {
dev_dbg(musb-controller, BABBLE devctl: 
%02x\n, devctl);
-   else {
+   } else {
ERR(Stopping host session -- babble\n);
musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
}
-- 
2.3.0

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


[PATCH v2 10/15] usb: musb: dsps: check for the single bit

2015-02-26 Thread Felipe Balbi
We want to check if that particular bit is
set. It could very well be that bootloader
(or romcode) has fiddled with MUSB before
us which could leave other bits set in this
register.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_dsps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index b79202c3dd65..285f0e4b083d 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -460,7 +460,7 @@ static int dsps_musb_init(struct musb *musb)
 * logic enabled.
 */
val = dsps_readb(musb-mregs, MUSB_BABBLE_CTL);
-   if (val == MUSB_BABBLE_RCV_DISABLE) {
+   if (val  MUSB_BABBLE_RCV_DISABLE) {
glue-sw_babble_enabled = true;
val |= MUSB_BABBLE_SW_SESSION_CTRL;
dsps_writeb(musb-mregs, MUSB_BABBLE_CTL, val);
-- 
2.3.0

--
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] usb: isp1760: add peripheral/device controller chip id

2015-02-26 Thread Laurent Pinchart
Hi Sudeep,

Thank you for the patch.

On Thursday 26 February 2015 11:47:57 Sudeep Holla wrote:
 As per the SAF1761 data sheet[0], the DcChipID register represents
 the hardware version number (0001h) and the chip ID (1582h) for the
 Peripheral Controller.
 
 However as per the ISP1761 data sheet[1], the DcChipID register
 represents the hardware version number (0015h) and the chip ID (8210h)
 for the Peripheral Controller.
 
 This patch adds support for both the chip ID values.
 
 [0] http://www.nxp.com/documents/data_sheet/SAF1761.pdf
 [1] http://pdf.datasheetcatalog.com/datasheets2/74/742102_1.pdf
 
 Cc: Felipe Balbi ba...@ti.com
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Signed-off-by: Sudeep Holla sudeep.ho...@arm.com

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

 ---
  drivers/usb/isp1760/isp1760-udc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 Changes v1-v2:
  - Updated to support both chip IDs: 0x00011582 and 0x00158210 instead of
just 0x00158210 as suggested by Laurent
 
 diff --git a/drivers/usb/isp1760/isp1760-udc.c
 b/drivers/usb/isp1760/isp1760-udc.c index 9612d7990565..6d618b3fab07 100644
 --- a/drivers/usb/isp1760/isp1760-udc.c
 +++ b/drivers/usb/isp1760/isp1760-udc.c
 @@ -1411,7 +1411,7 @@ static int isp1760_udc_init(struct isp1760_udc *udc)
   return -ENODEV;
   }
 
 - if (chipid != 0x00011582) {
 + if (chipid != 0x00011582  chipid != 0x00158210) {
   dev_err(udc-isp-dev, udc: invalid chip ID 0x%08x\n, chipid);
   return -ENODEV;
   }

-- 
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] USB: serial: cp210x: Adding Seletek device id's

2015-02-26 Thread Michiel
On 26-02-15 18:54, Johan Hovold wrote:
 Thanks for the patch. Looks good, but there are a few minor issues:
Oh webmail... :/ version 2 here:

These device ID's are not associated with the cp210x module currently,
but should be. This patch allows the devices to operate upon
connecting them to the usb bus as intended.
Tested personally, reviewed by manufacturer.

Signed-off-by: Michiel van de Garde mgpar...@gmail.com

diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
index f40c856..84ce2d7 100644
--- a/drivers/usb/serial/cp210x.c
+++ b/drivers/usb/serial/cp210x.c
@@ -147,6 +147,8 @@ static const struct usb_device_id id_table[] = {
{ USB_DEVICE(0x166A, 0x0305) }, /* Clipsal C-5000CT2 C-Bus Spectrum 
Colour Touchscreen */
{ USB_DEVICE(0x166A, 0x0401) }, /* Clipsal L51xx C-Bus Architectural 
Dimmer */
{ USB_DEVICE(0x166A, 0x0101) }, /* Clipsal 5560884 C-Bus Multi-room 
Audio Matrix Switcher */
+   { USB_DEVICE(0x16C0, 0x09B0) }, /* Lunatico Seletek */
+   { USB_DEVICE(0x16C0, 0x09B1) }, /* Lunatico Seletek */
{ USB_DEVICE(0x16D6, 0x0001) }, /* Jablotron serial interface */
{ USB_DEVICE(0x16DC, 0x0010) }, /* W-IE-NE-R Plein  Baus GmbH PL512 
Power Supply */
{ USB_DEVICE(0x16DC, 0x0011) }, /* W-IE-NE-R Plein  Baus GmbH RCM 
Remote Control for MARATON Power Supply */

-- 
 Michiel van de Garde 

--
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 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 12:27 PM, Felipe Balbi ba...@ti.com wrote:
 On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi wrote:
 FSDEV is set for both HIGH and FULL speeds,
 the correct HIGHSPEED check is done through
 power register's HSMODE bit.

 Signed-off-by: Felipe Balbi ba...@ti.com

 I'm still unsure if we should really ignore babble on FS/LS. It seems to
 me we should never ignore it, but I really don't have a way to prove
 this statement. For the sake of reducing impact, we will just fix HS
 check here.


I believe we should drop speed check in here and not ignore babble
regardless. We have seen many cases that full-speed babble causes MUSB
stop working.

 --
 balbi
--
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: URB IRQ fires on URB after usb_kill_urb() already completed

2015-02-26 Thread Alan Stern
On Wed, 25 Feb 2015, Devin Heitmueller wrote:

 Hi Alan,
 
 I think I see what's going on.  Permit me to comment on your
 explanation of urb-use_count first, since it's relevant later on.

I won't go over this in great detail, because I think your proposed 
explanation is wrong.  My impression is that we aren't looking in the 
right place.

 1.  A task calls usb_kill_urb() against a URB with use count of 1 (or
 sometimes 2).
 2.  usb_kill_urb() increments urb-reject so any attempt to resubmit
 the URB fails
 3.  usb_kill_urb() calls usb_hcd_unlink_urb()
 ***
 4.  usb_kill_urb() spins on usb_kill_urb_queue waiting for use_count
 to reach zero.
 5.  usb_kill_urb() returns to the caller, which typically then calls
 usb_free_urb(urb).
 
 Between steps 3 and 4, the following things occur:
 3a.  usb_hcd_unlink_urb() sees urb-use_count is nonzero and calls
 unlink1() against the URB
 3b.  unlink1() calls ehci_urb_dequeue(), which calls
 usb_hcd_check_unlink_urb, which sets the urb-unlinked field to
 -ENOENT
 3c.  ehci_urb_dequeue() calls start_unlink_async() for the QH tied to the URB
 
 Sometime while usb_kill_urb() is spinning on urb-use_count, the IRQ
 handler eventually fires:
 3d.  ehci_irq() calls end_unlink_async()
 3e.  end_unlink_async() calls qh_completions()
 3f.  qh_completions() calls ehci_urb_done()
 3g.  ehci_urb_done() calls __usb_hcd_giveback_urb
 3h.   __usb_hcd_giveback_urb calls the completion handler for the URB
 3i. Because the URB isn't resubmitted, use_count drops to zero and
 wake_up(usb_kill_urb_queue) is called.
 
 ===
 
 For the failure case, I see the completion handler firing for the URB,
 but the URB isn't being resubmitted because of the flag in the
 completion handler.  Then when the kill comes around, the
 urb-use_count is zero and thus it returns immediately rather than
 blocking on the wait queue.  But this doesn't change the fact that the
 end_unlink_async() hasn't necessarily been invoked yet for the URB.
 When the end_unlink_async() does finally do its housekeeping and call
 ehci_urb_done(), it's being called against a URB that has already been
 freed.

This misses a crucial point: the completion handler is called 
(indirectly) by end_unlink_async().  Therefore end_unlink_async() _has_ 
necessarily already been invoked by the time usb_kill_urb() runs.

 Below is a trace which shows the crash, and how during the completion
 handler the use count is good for URB ebc54410, but because the URB
 won't be resubmitted it drops to zero by the time the usb_kill_urb()
 is called (note, URB ebc54410 is the second to last URB killed before
 the crash).  You can also see at the time the completion handler is
 called for URB ebc54410 that while I've set the flag that the
 completion handler looks for to return without resubmitting, I haven't
 actually issued the usb_kill_urb() call, which is why the status is 0
 instead of -2.

The log doesn't show submissions, so I'll take your word for it that
the ebc54410 URB was never resubmitted.

Then here's what we see: The URB is given back and the completion
handler doesn't resubmit it.  Sometime later we crash because
usb_hcd_unlink_urb_from_ep() was called for that URB (which was freed
in the meantime).

 There's clearly a reference counting problem if the IRQ handler is
 still referring to qh-urb entries in its list, but the underlying URB
 is no longer in a submitted state.  That said, I don't really know
 enough about the internals of the EHCI controller model to know what
 the right fix is.

It may not be a reference counting problem at all.  The scenario I 
outlined above should not be possible because after the URB is given 
back, ehci-hcd should not have any pointers to it in any data 
structures.

This is something you may be able to check.  First, a brief explanation 
of how things are supposed to work:

qh_completions() primarily consists of a big loop:

list_for_each_safe (entry, tmp, qh-qtd_list) {
struct ehci_qtd *qtd;
struct urb  *urb;
u32 token = 0;

qtd = list_entry (entry, struct ehci_qtd, qtd_list);
urb = qtd-urb;
...

This iterates through the qTDs on qh-qtd_list, and it uses the URB
pointer stored in the qTD.

The code calls ehci_urb_done() whenever it reaches a boundary between
two URBs (note that each URB can have multiple qTDs).  Thus, near the
top of the loop it checks to see if the current URB is different from
the one on the last iteration, and it does something similar just after
the loop ends.

When ehci_urb_done() is called, _all_ the qTDs for that URB are 
supposed to have been removed from qh-qtd_list.  There should be 
nothing left that points to the URB being given back.  The only way to 
get another qTD pointing to that URB is if the URB is resubmitted.

Evidently this invariant isn't holding in your situation.  You can test
for it easily enough.  Just before the two places where

[PATCH] usb: gadget: f_mass_storage: use defined constant instead of numeric value

2015-02-26 Thread Tal Shorer
Signed-off-by: Tal Shorer tal.sho...@gmail.com
---
 drivers/usb/gadget/function/f_mass_storage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/function/f_mass_storage.c 
b/drivers/usb/gadget/function/f_mass_storage.c
index 811929c..6d5ca2b 100644
--- a/drivers/usb/gadget/function/f_mass_storage.c
+++ b/drivers/usb/gadget/function/f_mass_storage.c
@@ -1085,7 +1085,7 @@ static int do_inquiry(struct fsg_common *common, struct 
fsg_buffhd *bh)
if (!curlun) {  /* Unsupported LUNs are okay */
common-bad_lun_okay = 1;
memset(buf, 0, 36);
-   buf[0] = 0x7f;  /* Unsupported, no device-type */
+   buf[0] = TYPE_NO_LUN;   /* Unsupported, no device-type */
buf[4] = 31;/* Additional length */
return 36;
}
-- 
2.2.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 v2 09/15] usb: musb: dsps: remove babble check from dsps irq handler

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 12:25 PM, Felipe Balbi ba...@ti.com wrote:
 musb-int_usb already contains the correct
 information for musb-core to handle babble.

 In fact, this very check was just causing a
 nonsensical babble interrupt storm because.

I guess this is my English problem. I thought you miss the reason
after 'because'? That was the intention of my quesiton in v1.


 With this I can get test.sh to run and, even though
 all tests fail with timeout, that's still better
 than locking up the system due to IRQ storm.

 Also, if I remove g_zero and load g_mass_storage,
 then everything works fine again.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_dsps.c | 22 --
  1 file changed, 22 deletions(-)

 diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
 index 7584601c96f3..b79202c3dd65 100644
 --- a/drivers/usb/musb/musb_dsps.c
 +++ b/drivers/usb/musb/musb_dsps.c
 @@ -330,28 +330,6 @@ static irqreturn_t dsps_interrupt(int irq, void *hci)

 dev_dbg(musb-controller, usbintr (%x) epintr(%x)\n,
 usbintr, epintr);
 -   /*
 -* DRVVBUS IRQs are the only proxy we have (a very poor one!) for
 -* DSPS IP's missing ID change IRQ.  We need an ID change IRQ to
 -* switch appropriately between halves of the OTG state machine.
 -* Managing DEVCTL.SESSION per Mentor docs requires that we know its
 -* value but DEVCTL.BDEVICE is invalid without DEVCTL.SESSION set.
 -* Also, DRVVBUS pulses for SRP (but not at 5V) ...
 -*/
 -   if (is_host_active(musb)  usbintr  MUSB_INTR_BABBLE) {
 -   pr_info(CAUTION: musb: Babble Interrupt Occurred\n);
 -
 -   /*
 -* When a babble condition occurs, the musb controller removes
 -* the session and is no longer in host mode. Hence, all
 -* devices connected to its root hub get disconnected.
 -*
 -* Hand this error down to the musb core isr, so it can
 -* recover.
 -*/
 -   musb-int_usb = MUSB_INTR_BABBLE | MUSB_INTR_DISCONNECT;
 -   musb-int_tx = musb-int_rx = 0;
 -   }

 if (usbintr  ((1  wrp-drvvbus)  wrp-usb_shift)) {
 int drvvbus = dsps_readl(reg_base, wrp-status);
 --
 2.3.0

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


[PATCH net-next] usbnet: Fix tx_packets stat for FLAG_MULTI_FRAME drivers

2015-02-26 Thread Ben Hutchings
Currently the usbnet core does not update the tx_packets statistic for
drivers with FLAG_MULTI_PACKET and there is no hook in the TX
completion path where they could do this.

cdc_ncm and dependent drivers are bumping tx_packets stat on the
transmit path while asix and sr9800 aren't updating it at all.

Add a packet count in struct skb_data so these drivers can fill it
in, initialise it to 1 for other drivers, and add the packet count
to the tx_packets statistic on completion.

Signed-off-by: Ben Hutchings ben.hutchi...@codethink.co.uk
---
I have only tested the asix driver after this change; I think cdc_ncm
and one of the non-multi-packet drivers should also be tested before
it's applied.

Ben.

 drivers/net/usb/asix_common.c |2 ++
 drivers/net/usb/cdc_ncm.c |3 ++-
 drivers/net/usb/sr9800.c  |1 +
 drivers/net/usb/usbnet.c  |5 +++--
 include/linux/usb/usbnet.h|   12 
 5 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index 5c55f11572ba..724a9b50df7a 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -188,6 +188,8 @@ struct sk_buff *asix_tx_fixup(struct usbnet *dev, struct 
sk_buff *skb,
memcpy(skb_tail_pointer(skb), padbytes, sizeof(padbytes));
skb_put(skb, sizeof(padbytes));
}
+
+   usbnet_set_skb_tx_stats(skb, 1);
return skb;
 }
 
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 80a844e0ae03..70cbea551139 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -1172,7 +1172,6 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff 
*skb, __le32 sign)
 
/* return skb */
ctx-tx_curr_skb = NULL;
-   dev-net-stats.tx_packets += ctx-tx_curr_frame_num;
 
/* keep private stats: framing overhead and number of NTBs */
ctx-tx_overhead += skb_out-len - ctx-tx_curr_frame_payload;
@@ -1184,6 +1183,8 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff 
*skb, __le32 sign)
 */
dev-net-stats.tx_bytes -= skb_out-len - ctx-tx_curr_frame_payload;
 
+   usbnet_set_skb_tx_stats(skb_out, n);
+
return skb_out;
 
 exit_no_skb:
diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c
index b94a0fbb8b3b..7650cdc8fe6b 100644
--- a/drivers/net/usb/sr9800.c
+++ b/drivers/net/usb/sr9800.c
@@ -144,6 +144,7 @@ static struct sk_buff *sr_tx_fixup(struct usbnet *dev, 
struct sk_buff *skb,
skb_put(skb, sizeof(padbytes));
}
 
+   usbnet_set_skb_tx_stats(skb, 1);
return skb;
 }
 
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 449835f4331e..0f3ff285f6a1 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1188,8 +1188,7 @@ static void tx_complete (struct urb *urb)
struct usbnet   *dev = entry-dev;
 
if (urb-status == 0) {
-   if (!(dev-driver_info-flags  FLAG_MULTI_PACKET))
-   dev-net-stats.tx_packets++;
+   dev-net-stats.tx_packets += entry-packets;
dev-net-stats.tx_bytes += entry-length;
} else {
dev-net-stats.tx_errors++;
@@ -1348,6 +1347,8 @@ netdev_tx_t usbnet_start_xmit (struct sk_buff *skb,
urb-transfer_flags |= URB_ZERO_PACKET;
}
entry-length = urb-transfer_buffer_length = length;
+   if (!(info-flags  FLAG_MULTI_PACKET))
+   usbnet_set_skb_tx_stats(skb, 1);
 
spin_lock_irqsave(dev-txq.lock, flags);
retval = usb_autopm_get_interface_async(dev-intf);
diff --git a/include/linux/usb/usbnet.h b/include/linux/usb/usbnet.h
index d9a4905e01d0..ff3fb2bd0e90 100644
--- a/include/linux/usb/usbnet.h
+++ b/include/linux/usb/usbnet.h
@@ -228,8 +228,20 @@ struct skb_data {  /* skb-cb is one of these */
struct usbnet   *dev;
enum skb_state  state;
size_t  length;
+   unsigned long   packets;
 };
 
+/* Drivers that set FLAG_MULTI_PACKET must call this in their
+ * tx_fixup method before returning an skb.
+ */
+static inline void
+usbnet_set_skb_tx_stats(struct sk_buff *skb, unsigned long packets)
+{
+   struct skb_data *entry = (struct skb_data *) skb-cb;
+
+   entry-packets = packets;
+}
+
 extern int usbnet_open(struct net_device *net);
 extern int usbnet_stop(struct net_device *net);
 extern netdev_tx_t usbnet_start_xmit(struct sk_buff *skb,
-- 
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 v2 11/15] usb: musb: core: controller drops session automatically

2015-02-26 Thread Bin Liu
Felipe,

On Thu, Feb 26, 2015 at 12:25 PM, Felipe Balbi ba...@ti.com wrote:
 Whenever babble happens, MUSB controller will
 drop session automatically.

 The only case where it won't drop the session,
 is when we're running on AM335x and SW_SESSION_CTRL
 bit has been set. In that case, controller will
 not touch session bit so SW has a chance to recover
 from babble condition.

 Signed-off-by: Felipe Balbi ba...@ti.com
 ---
  drivers/usb/musb/musb_core.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

 diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
 index c3c5a6462600..70b2612205f8 100644
 --- a/drivers/usb/musb/musb_core.c
 +++ b/drivers/usb/musb/musb_core.c
 @@ -879,8 +879,7 @@ b_host:
  * the session.
  */
 if (power  MUSB_POWER_HSMODE) {
 -   ERR(Stopping host session -- babble\n);
 -   musb_writeb(musb-mregs, MUSB_DEVCTL, 0);
 +   ERR(Babble - session will be dropped\n);

Do you want to take this chance to change it to dev_err()?


 if (is_host_active(musb)) {
 musb_generic_disable(musb);
 --
 2.3.0

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


Re: [PATCH v2 03/15] usb: musb: core: fix highspeed check

2015-02-26 Thread Felipe Balbi
On Thu, Feb 26, 2015 at 02:38:07PM -0600, Bin Liu wrote:
 On Thu, Feb 26, 2015 at 2:31 PM, Felipe Balbi ba...@ti.com wrote:
  On Thu, Feb 26, 2015 at 02:25:20PM -0600, Bin Liu wrote:
  On Thu, Feb 26, 2015 at 2:19 PM, Felipe Balbi ba...@ti.com wrote:
   Hi again,
  
   On Thu, Feb 26, 2015 at 02:15:40PM -0600, Felipe Balbi wrote:
On Thu, Feb 26, 2015 at 12:25:16PM -0600, Felipe Balbi 
wrote:
FSDEV is set for both HIGH and FULL speeds,
the correct HIGHSPEED check is done through
power register's HSMODE bit.
   
Signed-off-by: Felipe Balbi ba...@ti.com
   
I'm still unsure if we should really ignore babble on 
FS/LS. It seems to
me we should never ignore it, but I really don't have a way 
to prove
this statement. For the sake of reducing impact, we will 
just fix HS
check here.
   
  
   I believe we should drop speed check in here and not ignore 
   babble
   regardless. We have seen many cases that full-speed babble 
   causes MUSB
   stop working.
  
   I'll make that as a separate patch then, just to make sure we 
   can revert
   it later if something goes wrong ;-)
 
  Agreed.
 
  I noticed something else. If we really don't need to reset musb 
  in case
  of babble, then we can drop that recover_work completely which
  simplifies babble handling quite a bit.
 
  I'll fiddle with that, if you don't mind.

 That is fine with me. I am writing the comments for the dropping 
 reset
 patch right now ;)

 We only need the following in musb_recover_work() for the recovery.

 1852 /*
 1853  * When a babble condition occurs, the musb controller
 1854  * removes the session bit and the endpoint config is 
 lost.
 1855  */
 1856 if (musb-dyn_fifo)
 1857 status = ep_config_from_table(musb);
 1858 else
 1859 status = ep_config_from_hw(musb);
 1860
 1861 /* start the session again */
 1862 if (status == 0)
 1863 musb_start(musb);
   
the statement that musb looses ep configuration seems bogus to me. I
dropped that too:
   
commit 4a07d415bf5894c66f61827c30053a65d6dfce26
Author: Felipe Balbi ba...@ti.com
Date:   Thu Feb 26 14:02:35 2015 -0600
   
usb: musb: core: simplify musb_recover_work()
   
we're not resetting musb at all, just restarting
the session. This means we don't need to touch PHYs
or VBUS or anything like that. Just make sure session
bit is reenabled after MUSB dropped it.
   
Signed-off-by: Felipe Balbi ba...@ti.com
   
diff --git a/drivers/usb/musb/musb_core.c 
b/drivers/usb/musb/musb_core.c
index d9c627d54db6..219636c1b020 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -1835,7 +1835,8 @@ static void musb_irq_work(struct work_struct 
*data)
 static void musb_recover_work(struct work_struct *data)
 {
struct musb *musb = container_of(data, struct musb, 
recover_work.work);
-   int status, ret;
+   int ret;
+   u8 devctl;
   
ret  = musb_platform_reset(musb);
if (ret) {
@@ -1843,24 +1844,17 @@ static void musb_recover_work(struct 
work_struct *data)
return;
}
   
-   usb_phy_vbus_off(musb-xceiv);
-   usleep_range(100, 200);
-
-   usb_phy_vbus_on(musb-xceiv);
-   usleep_range(100, 200);
+   /* drop session bit */
+   devctl = musb_readb(musb-mregs, MUSB_DEVCTL);
+   devctl = ~MUSB_DEVCTL_SESSION;
+   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
   
-   /*
-* When a babble condition occurs, the musb controller
-* removes the session bit and the endpoint config is lost.
-*/
-   if (musb-dyn_fifo)
-   status = ep_config_from_table(musb);
-   else
-   status = ep_config_from_hw(musb);
+   /* wait for session to really drop */
+   udelay(100);
   
-   /* start the session again */
-   if (status == 0)
-   musb_start(musb);
+   /* restart session */
+   devctl |= MUSB_DEVCTL_SESSION;
+   musb_writeb(musb-mregs, MUSB_DEVCTL, devctl);
 }
   
 /* 
--
   
   
the only thing that we're still missing is a notification to usbcore
that we have a port being disabled, that's the only way to have 
testusb
know that it has been disconnected by the host.
  
   here's the final version:
  
   commit 3db11e7da5938bbd955410355194625f699a424c
   Author: Felipe Balbi ba...@ti.com
   Date:   Thu Feb 26 14:02:35 2015 -0600
  
   usb: musb: core: simplify musb_recover_work()
  
   we're not resetting musb at 

[PATCH v3 19/22] usb: musb: core: drop recover_work

2015-02-26 Thread Felipe Balbi
that's not needed anymore. Everything that we
call is irq-safe, so we might as well not
have a delayed work for babble recovery.

Signed-off-by: Felipe Balbi ba...@ti.com
---
 drivers/usb/musb/musb_core.c | 17 +
 drivers/usb/musb/musb_core.h |  1 -
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index 62319a1e2531..191f02ee4ec6 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -509,6 +509,7 @@ void musb_hnp_stop(struct musb *musb)
 
 static void musb_disable_interrupts(struct musb *musb);
 static void musb_generic_disable(struct musb *musb);
+static void musb_recover_from_babble(struct musb *musb);
 
 /*
  * Interrupt Service Routine to record USB global interrupts.
@@ -885,8 +886,7 @@ b_host:
 
if (is_host_active(musb)) {
musb_disable_interrupts(musb);
-   
schedule_delayed_work(musb-recover_work,
-   usecs_to_jiffies(10));
+   musb_recover_from_babble(musb);
}
}
} else {
@@ -1831,13 +1831,17 @@ static void musb_irq_work(struct work_struct *data)
}
 }
 
-/* Recover from babble interrupt conditions */
-static void musb_recover_work(struct work_struct *data)
+static void musb_recover_from_babble(struct musb *musb)
 {
-   struct musb *musb = container_of(data, struct musb, recover_work.work);
int ret;
u8 devctl;
 
+   /*
+* wait at least 320 cycles of 60MHz clock. That's 5.3us, we will give
+* it some slack and wait for 10us.
+*/
+   udelay(10);
+
ret  = musb_platform_recover(musb);
if (ret) {
musb_enable_interrupts(musb);
@@ -2096,7 +2100,6 @@ musb_init_controller(struct device *dev, int nIrq, void 
__iomem *ctrl)
 
/* Init IRQ workqueue before request_irq */
INIT_WORK(musb-irq_work, musb_irq_work);
-   INIT_DELAYED_WORK(musb-recover_work, musb_recover_work);
INIT_DELAYED_WORK(musb-deassert_reset_work, musb_deassert_reset);
INIT_DELAYED_WORK(musb-finish_resume_work, musb_host_finish_resume);
 
@@ -2192,7 +2195,6 @@ fail4:
 
 fail3:
cancel_work_sync(musb-irq_work);
-   cancel_delayed_work_sync(musb-recover_work);
cancel_delayed_work_sync(musb-finish_resume_work);
cancel_delayed_work_sync(musb-deassert_reset_work);
if (musb-dma_controller)
@@ -2258,7 +2260,6 @@ static int musb_remove(struct platform_device *pdev)
dma_controller_destroy(musb-dma_controller);
 
cancel_work_sync(musb-irq_work);
-   cancel_delayed_work_sync(musb-recover_work);
cancel_delayed_work_sync(musb-finish_resume_work);
cancel_delayed_work_sync(musb-deassert_reset_work);
musb_free(musb);
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h
index 1e03c7ec82e4..3877249a8b2d 100644
--- a/drivers/usb/musb/musb_core.h
+++ b/drivers/usb/musb/musb_core.h
@@ -301,7 +301,6 @@ struct musb {
 
irqreturn_t (*isr)(int, void *);
struct work_struct  irq_work;
-   struct delayed_work recover_work;
struct delayed_work deassert_reset_work;
struct delayed_work finish_resume_work;
u16 hwvers;
-- 
2.3.0

--
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 00/22] usb: musb: the big MUSB patch bomb

2015-02-26 Thread Felipe Balbi
Hi folks,

this is v3 of my patchset which has been in discussion with
Bin Liu (hey, thanks).

patches have been tested with AM335x BBB using g_zero and
g_mass_storage.

My BBB, for whatever reason, always causes babble when I
connect the peripheral port to the host port on the same
board. So that was a great platform for testing this patchset.

I can see that after babble recovery runs, we drop the session,
tell usbcore about it and restart the session, which causes
g_zero to enumerate. If, after that, I drop g_zero and plug
a mass storage pendrive or load g_mass_storage on the peripheral
port, everything works fine.

cheers

Felipe Balbi (22):
  usb: musb: core: remove unnecessary logical comparison
  usb: musb: core: add missing curly braces
  usb: musb: core: fix highspeed check
  usb: musb: dsps: return error code if reset fails
  usb: musb: core: move babble recovery inside babble check
  usb: musb: core: break long line
  usb: musb: core: remove unnecessary reg access from resume IRQ
  usb: musb: core: there is no connect interrupt in peripheral mode
  usb: musb: dsps: remove babble check from dsps irq handler
  usb: musb: dsps: check for the single bit
  usb: musb: core: controller drops session automatically
  usb: musb: dsps: add dsps_ prefix to sw_babble_control
  usb: musb: core: refactor IRQ enable/disable to separate functions
  usb: musb: don't touch devctl from babble recovery
  usb: musb: core: decrease delayed_work time
  usb: musb: dsps: do not reset musb on babble
  usb: musb: core: simplify musb_recover_work()
  usb: musb: rename -reset() to -recover()
  usb: musb: core: drop recover_work
  usb: musb: core: remove unnecessary forward declaration
  usb: musb: core: disable irqs inside babble recovery
  usb: musb: core: always try to recover from babble

 drivers/usb/musb/musb_core.c | 132 +--
 drivers/usb/musb/musb_core.h |  14 ++---
 drivers/usb/musb/musb_dsps.c |  49 +++-
 3 files changed, 78 insertions(+), 117 deletions(-)

-- 
2.3.0

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


  1   2   >