Re: [PATCH] USB: serial: cp210x: Adding IDs for CEL MeshConnect USB Stick

2014-11-10 Thread Johan Hovold
On Fri, Nov 07, 2014 at 11:26:11PM -0600, Preston Fick wrote:
 Signed-off-by: Preston Fick pff...@gmail.com
 ---
  drivers/usb/serial/cp210x.c | 1 +
  1 file changed, 1 insertion(+)
 
 diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c
 index cfd009d..6c4eb3c 100644
 --- a/drivers/usb/serial/cp210x.c
 +++ b/drivers/usb/serial/cp210x.c
 @@ -120,6 +120,7 @@ static const struct usb_device_id id_table[] = {
   { USB_DEVICE(0x10C4, 0x85F8) }, /* Virtenio Preon32 */
   { USB_DEVICE(0x10C4, 0x8664) }, /* AC-Services CAN-IF */
   { USB_DEVICE(0x10C4, 0x8665) }, /* AC-Services OBD-IF */
 + { USB_DEVICE(0x10C4, 0x8875) }, /* CEL MeshConnect USB Stick */
   { USB_DEVICE(0x10C4, 0x88A4) }, /* MMB Networks ZigBee USB Device */
   { USB_DEVICE(0x10C4, 0x88A5) }, /* Planet Innovation Ingeni ZigBee USB 
 Device */
   { USB_DEVICE(0x10C4, 0x8946) }, /* Ketra N1 Wireless Interface */

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: btusb_intr_complete returns -EPIPE

2014-11-10 Thread Naveen Kumar Parna
On Thu, Nov 6, 2014 at 10:14 PM, Alan Stern st...@rowland.harvard.edu wrote:
 On Thu, 6 Nov 2014, Naveen Kumar Parna wrote:

  Any idea why you see the CSPLITs now but didn't see them before?

 It looks like , I failed to locate the exact portion of the analyzer
 log that corresponds to one of those -32 events in the usbmon log.

 Well, I still don't understand that, but never mind...

 USB Analyzer records several megabytes of data very quickly, so it’s
 very hard to find the portion of the analyzer log that corresponds to
 one of those -32 events in the usbmon log. To avoid this difficulty I
 applied the attached patch
 (0002-btusb-clear-halt-if-intr-in-stalls.patch – got it from Oliver
 Neukum) to btusb driver and reloaded this driver.

 The applied patch calls usb_clear_halt() on receiving the stall
 response, so now I can easily search for ClearFeature(ENDPOINT_HALT)
 request in the analyzer log. It can be found at 2.304 252 217 
 2.316 264 600 time instance in the attached log.

 Re ran the Analyzer again and attached it’s exported text
 log([2014-11-06 session 125138] Trace_only_ep0_ep1.txt). Here
 filtered out the BulkIN transactions.

 usbmon log:
 8800b7670a80 506095728 C Ii:1:108:1 -32:1 0
 8800affdccc0 506107757 C Ii:1:108:1 -32:1 0

 Here is the portion of the log that corresponds to “8800b7670a80
 506095728 C Ii:1:108:1 -32:1 0”:

 Start of Frame (6) HS 553.2 - 553.7 2.302 964 717
 SSPLIT IN transaction 105 1 HS No data 2.303 590 367
 SSPLIT IN transaction 106 1 HS No data 2.303 591 283
 SSPLIT IN transaction 107 1 HS No data 2.303 600 283
 SSPLIT IN transaction 108 1 HS No data 2.303 601 350
 Start of Frame (2) HS 554.0 - 554.1 2.303 714 817
 CSPLIT IN transaction 105 1 NAK HS No data 2.303 840 400
 CSPLIT IN transaction 106 1 NAK HS No data 2.303 842 033
 CSPLIT IN transaction 107 1 NAK HS No data 2.303 855 317
 Start of Frame (3) HS 554.2 - 554.4 2.303 964 850

 Obviously, there aren't any CSPLITs for device 108 ep 1.

 Here is the portion of the log that corresponds to “8800affdccc0
 506107757 C Ii:1:108:1 -32:1 0:

 Start of Frame (6) HS 565.2 - 565.7 2.314 966 383
 SSPLIT IN transaction 105 1 HS No data 2.315 592 033
 SSPLIT IN transaction 106 1 HS No data 2.315 592 967
 SSPLIT IN transaction 107 1 HS No data 2.315 612 800
 SSPLIT IN transaction 108 1 HS No data 2.315 613 850
 Start of Frame (2) HS 566.0 - 566.1 2.315 716 483
 CSPLIT IN transaction 105 1 NAK HS No data 2.315 842 067
 CSPLIT IN transaction 106 1 NAK HS No data 2.315 843 683
 CSPLIT IN transaction 107 1 NAK HS No data 2.315 928 750
 Start of Frame (3) HS 566.2 - 566.4 2.315 966 517

 In both the cases, CSPLIT of Dev-108 is missing in this portion of the log.

 So, Does this test log gives some conclusion?

 It indicates that the EHCI host controller hardware isn't working
 right.  Every now and then it skips sending CSPLIT packets when it
 should send them.

 I suppose it's possible that the host controller is okay and the
 problem is a bad memory chip.  That could also cause this sort of
 error.  Regardless, it has to be a hardware problem.

Is there any test I can run to prove that memory chip is bad?



 Now, this doesn't explain why you get the -32 status code.  Maybe the
 patch below will provide more information.  Try running your test with
 this patch installed and see what shows up in the dmesg log.

 Alan Stern



 Index: usb-3.18/drivers/usb/host/ehci-q.c
 ===
 --- usb-3.18.orig/drivers/usb/host/ehci-q.c
 +++ usb-3.18/drivers/usb/host/ehci-q.c
 @@ -346,6 +346,12 @@ qh_completions (struct ehci_hcd *ehci, s
 /* always clean up qtds the hc de-activated */
   retry_xacterr:
 if ((token  QTD_STS_ACTIVE) == 0) {
 +   u32 info2 = hc32_to_cpu(ehci, hw-hw_info2);
 +
 +   if ((info2  QH_SMASK)  (token  0x7e))
 +   ehci_info(ehci, split intr info2 %x token %x 
 overlay token %x\n,
 +   info2, token, 
 hc32_to_cpu(ehci,
 +   hw-hw_token));

 /* Report Data Buffer Error: non-fatal but useful */
 if (token  QTD_STS_DBE)


Here is the dmesg log:

[  713.125709] ehci-pci :00:1a.0: split intr info2 42821c01 token
80108d46 overlay token 80108d46
[  713.125796] ehci-pci :00:1a.0: split intr info2 42821c01 token
80108d46 overlay token 80108d46
[  713.125853] hci4 urb 8800b89a7c00 status -32 count 0
[  713.125857] hci3 urb 8800b7399c00 status -32 count 0
[  713.126801] hci4
[  713.127003] hci3
[ 3046.032153] ehci-pci :00:1a.0: split intr info2 42821c01 token
108d46 overlay token 108d46
[ 3046.032227] ehci-pci :00:1a.0: split intr info2 42821c01 token
108d46 overlay token 108d46
[ 3046.032272] hci3 urb 8800b30f5a80 status -32 count 0
[ 3046.032278] hci4 urb 8800b30f53c0 status 

Reminder

2014-11-10 Thread Thaung Lin Yan

Your partnership is needed for a profitable business transaction involving huge 
amounts of fund please contact me for more details.

---
Uw partnerschap is nodig voor een winstgevende business transactie waarbij 
enorme hoeveelheden fonds kunt u contact met mij op voor meer details.


Ihre Partnerschaft ist für ein profitables Geschäft Transaktion mit riesigen 
Mengen von Fonds kontaktieren Sie mich bitte für weitere Einzelheiten benötig
--
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: renesas_usbhs: change d{0,1}fifo to dfifo array

2014-11-10 Thread Yoshihiro Shimoda
To extend DnFIFOs in the future, this patch changes d{0,1}fifo of
usbhs_fifo_info to dfifo array.

Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 drivers/usb/renesas_usbhs/fifo.c |4 ++--
 drivers/usb/renesas_usbhs/fifo.h |4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 9b48384..341508a 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -21,8 +21,8 @@
 #include pipe.h
 
 #define usbhsf_get_cfifo(p)(((p)-fifo_info.cfifo))
-#define usbhsf_get_d0fifo(p)   (((p)-fifo_info.d0fifo))
-#define usbhsf_get_d1fifo(p)   (((p)-fifo_info.d1fifo))
+#define usbhsf_get_d0fifo(p)   (((p)-fifo_info.dfifo[0]))
+#define usbhsf_get_d1fifo(p)   (((p)-fifo_info.dfifo[1]))
 #define usbhsf_is_cfifo(p, f)  (usbhsf_get_cfifo(p) == f)
 
 #define usbhsf_fifo_is_busy(f) ((f)-pipe) /* see usbhs_pipe_select_fifo */
diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h
index 79ad5f9..e1e51c6 100644
--- a/drivers/usb/renesas_usbhs/fifo.h
+++ b/drivers/usb/renesas_usbhs/fifo.h
@@ -38,10 +38,10 @@ struct usbhs_fifo {
struct sh_dmae_slaverx_slave;
 };
 
+#define USBHS_MAX_NUM_DFIFO2
 struct usbhs_fifo_info {
struct usbhs_fifo cfifo;
-   struct usbhs_fifo d0fifo;
-   struct usbhs_fifo d1fifo;
+   struct usbhs_fifo dfifo[USBHS_MAX_NUM_DFIFO];
 };
 
 struct usbhs_pkt_handle;
-- 
1.7.9.5

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


[PATCH 4/4] usb: renesas_usbhs: expand USB-DMAC channels for R-Car Gen2

2014-11-10 Thread Yoshihiro Shimoda
This patch expands USB-DMAC channels for R-Car Gen2 SoCs. The SoCs
have 4 channels. If d{2,3}_{t,x}x_id are not set, this driver never
uses the expanded USB-DMAC channels.

Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 drivers/usb/renesas_usbhs/common.h |4 
 drivers/usb/renesas_usbhs/fifo.c   |2 ++
 drivers/usb/renesas_usbhs/fifo.h   |2 +-
 include/linux/usb/renesas_usbhs.h  |4 
 4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/common.h 
b/drivers/usb/renesas_usbhs/common.h
index c45667f..0427cdd 100644
--- a/drivers/usb/renesas_usbhs/common.h
+++ b/drivers/usb/renesas_usbhs/common.h
@@ -102,6 +102,10 @@ struct usbhs_priv;
 #define DEVADD80x00E0
 #define DEVADD90x00E2
 #define DEVADDA0x00E4
+#define D2FIFOSEL  0x00F0  /* for R-Car Gen2 */
+#define D2FIFOCTR  0x00F2  /* for R-Car Gen2 */
+#define D3FIFOSEL  0x00F4  /* for R-Car Gen2 */
+#define D3FIFOCTR  0x00F6  /* for R-Car Gen2 */
 
 /* SYSCFG */
 #define SCKE   (1  10)   /* USB Module Clock Enable */
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index bc9a050..f46271c 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -1234,6 +1234,8 @@ int usbhs_fifo_probe(struct usbhs_priv *priv)
/* DFIFO */
USBHS_DFIFO_INIT(priv, fifo, 0);
USBHS_DFIFO_INIT(priv, fifo, 1);
+   USBHS_DFIFO_INIT_NO_PORT(priv, fifo, 2);
+   USBHS_DFIFO_INIT_NO_PORT(priv, fifo, 3);
 
return 0;
 }
diff --git a/drivers/usb/renesas_usbhs/fifo.h b/drivers/usb/renesas_usbhs/fifo.h
index 899729a..f07037c1 100644
--- a/drivers/usb/renesas_usbhs/fifo.h
+++ b/drivers/usb/renesas_usbhs/fifo.h
@@ -38,7 +38,7 @@ struct usbhs_fifo {
struct sh_dmae_slaverx_slave;
 };
 
-#define USBHS_MAX_NUM_DFIFO2
+#define USBHS_MAX_NUM_DFIFO4
 struct usbhs_fifo_info {
struct usbhs_fifo cfifo;
struct usbhs_fifo dfifo[USBHS_MAX_NUM_DFIFO];
diff --git a/include/linux/usb/renesas_usbhs.h 
b/include/linux/usb/renesas_usbhs.h
index d5952bb..9fd9e48 100644
--- a/include/linux/usb/renesas_usbhs.h
+++ b/include/linux/usb/renesas_usbhs.h
@@ -145,6 +145,10 @@ struct renesas_usbhs_driver_param {
int d0_rx_id;
int d1_tx_id;
int d1_rx_id;
+   int d2_tx_id;
+   int d2_rx_id;
+   int d3_tx_id;
+   int d3_rx_id;
 
/*
 * option:
-- 
1.7.9.5

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


[PATCH 0/4] usb: renesas_usbhs: expand USB-DMAC channels for R-Car Gen2

2014-11-10 Thread Yoshihiro Shimoda
This patch serias expands USB-DMAC channels for R-Car Gen2 SoCs.
 - First 3 patches are clean-up source codes.
 - Last patch is expanded the channels.

This patch serias is based on Felipe's usb.git / testing/next branch.
(commit id: 83ef5086ad00ac5d9068d6b574bc660659e1f135)

Yoshihiro Shimoda (4):
  usb: renesas_usbhs: change d{0,1}fifo to dfifo array
  usb: renesas_usbhs: standardize d{0,1}fifo control
  usb: renesas_usbhs: add a new macro for extending DnFIFOs
  usb: renesas_usbhs: expand USB-DMAC channels for R-Car Gen2

 drivers/usb/renesas_usbhs/common.h |4 ++
 drivers/usb/renesas_usbhs/fifo.c   |   77 ++--
 drivers/usb/renesas_usbhs/fifo.h   |9 -
 include/linux/usb/renesas_usbhs.h  |4 ++
 4 files changed, 54 insertions(+), 40 deletions(-)

-- 
1.7.9.5

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


[PATCH 3/4] usb: renesas_usbhs: add a new macro for extending DnFIFOs

2014-11-10 Thread Yoshihiro Shimoda
To extend DnFIFOs in the future, this patch adds a new macro because
some SoCs don't the port address for DnFIFOs.

Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 drivers/usb/renesas_usbhs/fifo.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 6c775b7..bc9a050 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -1201,11 +1201,11 @@ void usbhs_fifo_quit(struct usbhs_priv *priv)
mod-irq_brdysts= 0;
 }
 
-#define USBHS_DFIFO_INIT(priv, fifo, channel)  \
+#define __USBHS_DFIFO_INIT(priv, fifo, channel, fifo_port) \
 do {   \
fifo = usbhsf_get_dnfifo(priv, channel);\
fifo-name  = D#channelFIFO;\
-   fifo-port  = D##channel##FIFO; \
+   fifo-port  = fifo_port;\
fifo-sel   = D##channel##FIFOSEL;  \
fifo-ctr   = D##channel##FIFOCTR;  \
fifo-tx_slave.shdma_slave.slave_id =   \
@@ -1215,6 +1215,11 @@ do { 
\
usbhsf_dma_init(priv, fifo);\
 } while (0)
 
+#define USBHS_DFIFO_INIT(priv, fifo, channel)  \
+   __USBHS_DFIFO_INIT(priv, fifo, channel, D##channel##FIFO)
+#define USBHS_DFIFO_INIT_NO_PORT(priv, fifo, channel)  \
+   __USBHS_DFIFO_INIT(priv, fifo, channel, 0)
+
 int usbhs_fifo_probe(struct usbhs_priv *priv)
 {
struct usbhs_fifo *fifo;
-- 
1.7.9.5

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


[PATCH 2/4] usb: renesas_usbhs: standardize d{0,1}fifo control

2014-11-10 Thread Yoshihiro Shimoda
To expand DnFIFOs in the future, this patch standardizes the d{0,1}fifo
control using new macros.

Signed-off-by: Yoshihiro Shimoda yoshihiro.shimoda...@renesas.com
---
 drivers/usb/renesas_usbhs/fifo.c |   70 +-
 drivers/usb/renesas_usbhs/fifo.h |5 +++
 2 files changed, 37 insertions(+), 38 deletions(-)

diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 341508a..6c775b7 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -21,8 +21,6 @@
 #include pipe.h
 
 #define usbhsf_get_cfifo(p)(((p)-fifo_info.cfifo))
-#define usbhsf_get_d0fifo(p)   (((p)-fifo_info.dfifo[0]))
-#define usbhsf_get_d1fifo(p)   (((p)-fifo_info.dfifo[1]))
 #define usbhsf_is_cfifo(p, f)  (usbhsf_get_cfifo(p) == f)
 
 #define usbhsf_fifo_is_busy(f) ((f)-pipe) /* see usbhs_pipe_select_fifo */
@@ -761,18 +759,13 @@ static struct usbhs_fifo *usbhsf_get_dma_fifo(struct 
usbhs_priv *priv,
  struct usbhs_pkt *pkt)
 {
struct usbhs_fifo *fifo;
+   int i;
 
-   /* DMA :: D0FIFO */
-   fifo = usbhsf_get_d0fifo(priv);
-   if (usbhsf_dma_chan_get(fifo, pkt) 
-   !usbhsf_fifo_is_busy(fifo))
-   return fifo;
-
-   /* DMA :: D1FIFO */
-   fifo = usbhsf_get_d1fifo(priv);
-   if (usbhsf_dma_chan_get(fifo, pkt) 
-   !usbhsf_fifo_is_busy(fifo))
-   return fifo;
+   usbhs_for_each_dfifo(priv, fifo, i) {
+   if (usbhsf_dma_chan_get(fifo, pkt) 
+   !usbhsf_fifo_is_busy(fifo))
+   return fifo;
+   }
 
return NULL;
 }
@@ -1185,8 +1178,8 @@ void usbhs_fifo_init(struct usbhs_priv *priv)
 {
struct usbhs_mod *mod = usbhs_mod_get_current(priv);
struct usbhs_fifo *cfifo = usbhsf_get_cfifo(priv);
-   struct usbhs_fifo *d0fifo = usbhsf_get_d0fifo(priv);
-   struct usbhs_fifo *d1fifo = usbhsf_get_d1fifo(priv);
+   struct usbhs_fifo *dfifo;
+   int i;
 
mod-irq_empty  = usbhsf_irq_empty;
mod-irq_ready  = usbhsf_irq_ready;
@@ -1194,8 +1187,8 @@ void usbhs_fifo_init(struct usbhs_priv *priv)
mod-irq_brdysts= 0;
 
cfifo-pipe = NULL;
-   d0fifo-pipe= NULL;
-   d1fifo-pipe= NULL;
+   usbhs_for_each_dfifo(priv, dfifo, i)
+   dfifo-pipe = NULL;
 }
 
 void usbhs_fifo_quit(struct usbhs_priv *priv)
@@ -1208,6 +1201,20 @@ void usbhs_fifo_quit(struct usbhs_priv *priv)
mod-irq_brdysts= 0;
 }
 
+#define USBHS_DFIFO_INIT(priv, fifo, channel)  \
+do {   \
+   fifo = usbhsf_get_dnfifo(priv, channel);\
+   fifo-name  = D#channelFIFO;\
+   fifo-port  = D##channel##FIFO; \
+   fifo-sel   = D##channel##FIFOSEL;  \
+   fifo-ctr   = D##channel##FIFOCTR;  \
+   fifo-tx_slave.shdma_slave.slave_id =   \
+   usbhs_get_dparam(priv, d##channel##_tx_id); \
+   fifo-rx_slave.shdma_slave.slave_id =   \
+   usbhs_get_dparam(priv, d##channel##_rx_id); \
+   usbhsf_dma_init(priv, fifo);\
+} while (0)
+
 int usbhs_fifo_probe(struct usbhs_priv *priv)
 {
struct usbhs_fifo *fifo;
@@ -1219,31 +1226,18 @@ int usbhs_fifo_probe(struct usbhs_priv *priv)
fifo-sel   = CFIFOSEL;
fifo-ctr   = CFIFOCTR;
 
-   /* D0FIFO */
-   fifo = usbhsf_get_d0fifo(priv);
-   fifo-name  = D0FIFO;
-   fifo-port  = D0FIFO;
-   fifo-sel   = D0FIFOSEL;
-   fifo-ctr   = D0FIFOCTR;
-   fifo-tx_slave.shdma_slave.slave_id = usbhs_get_dparam(priv, 
d0_tx_id);
-   fifo-rx_slave.shdma_slave.slave_id = usbhs_get_dparam(priv, 
d0_rx_id);
-   usbhsf_dma_init(priv, fifo);
-
-   /* D1FIFO */
-   fifo = usbhsf_get_d1fifo(priv);
-   fifo-name  = D1FIFO;
-   fifo-port  = D1FIFO;
-   fifo-sel   = D1FIFOSEL;
-   fifo-ctr   = D1FIFOCTR;
-   fifo-tx_slave.shdma_slave.slave_id = usbhs_get_dparam(priv, 
d1_tx_id);
-   fifo-rx_slave.shdma_slave.slave_id = usbhs_get_dparam(priv, 
d1_rx_id);
-   usbhsf_dma_init(priv, fifo);
+   /* DFIFO */
+   USBHS_DFIFO_INIT(priv, fifo, 0);
+   USBHS_DFIFO_INIT(priv, fifo, 1);
 
return 0;
 }
 
 void usbhs_fifo_remove(struct usbhs_priv *priv)
 {
-   usbhsf_dma_quit(priv, usbhsf_get_d0fifo(priv));
-   usbhsf_dma_quit(priv, usbhsf_get_d1fifo(priv));
+   struct usbhs_fifo *fifo;
+   int i;
+
+   usbhs_for_each_dfifo(priv, fifo, i)
+   usbhsf_dma_quit(priv, fifo);
 }
diff --git 

xhci_hcd : Not enough bandwidth on HS bus for newly activated TT.

2014-11-10 Thread Kenneth Johansson
So I have a problem that happens with 1-2 weeks interval in that the 
xhci driver confuses itself and thinks that the usb bus is overused or 
something.


The thing is that this is an external usb 2 hub with 7 ports and all 7 
is used for different devices. I do a suspend/resume once a day and 
thats it.
its the same devices on the hub but the USB driver for some reason 
decides that it no longer can allow the devices on the bus.


1. is there any way to reset the entire usb stack without rebooting??  I 
run 3.16 ubuntu kernel and I think usb is built in I at least can see 
any module named xhci.


2. what can be done to solve this ?? there must be some type of resource 
leak here as a reboot solves the problem and I have exactly the same usb 
devices that I use.


3. I also notice that we max out at about 30 devices and I think usb 
should be able to handle 127.


4. I noticed on a different computer that a usb sound card (5.1) was 
also getting the bandwidth error if I attached it to a usb3 hub that had 
only that device, it works if I remove the hub.


5. overall usb3 looks to be a bit unpredictable and if you google for 
this type of errors the advice is to downgrade to usb2. that do sound 
like the wrong thing to do unless the xhci hardware is that broken. is 
it ? or is this the driver that needs fixing.




-
[65633.315419] usb 3-1.4.1: Product: USB Transfer Cable
[65633.315422] usb 3-1.4.1: Manufacturer: Prolific Technology Inc.
[65633.315607] xhci_hcd :00:14.0: Not enough bandwidth on HS bus for 
newly activated TT.

[65633.315612] xhci_hcd :00:14.0: Not enough bandwidth
[65633.315619] usb 3-1.4.1: can't set config #1, error -12
---
[65653.367865] xhci_hcd :00:14.0: Not enough bandwidth on HS bus for 
newly activated TT.

[65653.367867] xhci_hcd :00:14.0: Not enough bandwidth
[65653.367872] usb 3-1.2: can't set config #1, error -12

and so on.
--
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: dwc2: add bus suspend/resume for dwc2

2014-11-10 Thread Kever Yang

Hi Julius,

On 11/07/2014 06:11 AM, Julius Werner wrote:

On Wed, Nov 5, 2014 at 5:30 PM, Kever Yang kever.y...@rock-chips.com wrote:

Hcd controller needs bus_suspend/resume, dwc2 controller make
root hub generate suspend/resume signal with hprt0 register
when work in host mode.
After the root hub enter suspend, we can make controller enter
low power state with PCGCTL register.

You say you do this, but I don't actually see you doing it (for the
not-connected case)?

Agree to add PCGCTL operation for the not-connected case.



We also update the lx_state for hsotg state.

This patch has tested on rk3288 with suspend/resume.

Signed-off-by: Kever Yang kever.y...@rock-chips.com
---

Changes in v2:
- update commit message
- make dwc2 suspend/resume sourcecode work

  drivers/usb/dwc2/hcd.c | 78 +++---
  1 file changed, 67 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 0a0e6f0..01a415b 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -1471,6 +1471,30 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, 
u16 windex)
 }
  }

+static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
+{
+   u32 hprt0;
+
+   /* After clear the Stop PHY clock bit, we should wait for a moment
+* for PLL work stable with clock output.
+*/
+   writel(0, hsotg-regs + PCGCTL);
+   usleep_range(2000, 4000);
+
+   hprt0 = dwc2_read_hprt0(hsotg);
+   hprt0 |= HPRT0_RES;
+   writel(hprt0, hsotg-regs + HPRT0);
+   hprt0 = ~HPRT0_SUSP;
+   /* according to USB2.0 Spec 7.1.7.7, the host must send the resume
+* signal for at least 20ms
+*/
+   usleep_range(2, 25000);
+
+   hprt0 = ~HPRT0_RES;
+   writel(hprt0, hsotg-regs + HPRT0);
+   hsotg-lx_state = DWC2_L0;
+}
+
  /* Handles hub class-specific requests */
  static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
 u16 wvalue, u16 windex, char *buf, u16 wlength)
@@ -1516,17 +1540,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg 
*hsotg, u16 typereq,
 case USB_PORT_FEAT_SUSPEND:
 dev_dbg(hsotg-dev,
 ClearPortFeature USB_PORT_FEAT_SUSPEND\n);
-   writel(0, hsotg-regs + PCGCTL);
-   usleep_range(2, 4);
-
-   hprt0 = dwc2_read_hprt0(hsotg);
-   hprt0 |= HPRT0_RES;
-   writel(hprt0, hsotg-regs + HPRT0);
-   hprt0 = ~HPRT0_SUSP;
-   usleep_range(10, 15);
-
-   hprt0 = ~HPRT0_RES;
-   writel(hprt0, hsotg-regs + HPRT0);

I'm curious why this didn't change lx_state back to DWC2_L0 before...
Paul, do you know?


+   dwc2_port_resume(hsotg);
 break;

 case USB_PORT_FEAT_POWER:
@@ -2299,6 +2313,44 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd)
 usleep_range(1000, 3000);
  }

+static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
+{
+   struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
+   u32 hprt0;
+
+   if (!((hsotg-op_state == OTG_STATE_B_HOST) ||
+   (hsotg-op_state == OTG_STATE_A_HOST)))
+   return 0;
+
+   if (hsotg-lx_state != DWC2_L0)

What if the port is in L1 state? I don't think the driver supports LPM
right now, but the DWC2_L1 enum is defined so it may one day in the
future. Let's maybe at least add a TODO.

Added



+   return 0;

In your original ChromiumOS version of this patch, you also set
PCGCTL_STOPPCLK here if the port was not connected. Is there a reason
that changed (does it not actually save power or something)?


+
+   hprt0 = dwc2_read_hprt0(hsotg);
+   if (hprt0  HPRT0_CONNSTS)
+   dwc2_port_suspend(hsotg, 1);

The contract for bus_suspend() is that it will suspend all ports not
yet suspended, keep track of those ports and then only resume those in
bus_resume() (compare, for example, how XHCI keeps track of that with
xhci_bus_state.bus_suspended in xhci_bus_suspend/resume()). So you
need something here to remember whether this function suspended the
port or whether it had already been suspended, and then only resume
the port in bus_resume() in the former case.

In fact, the dwc2 controller only support one port, so the hprt0
is the only one port we need to care.

Note that
dwc2_port_suspend() changes lx_state to DWC_L2 (at least in the
version I'm looking at right now), so you can't just rely on that
unless you explicitly set it back to something else here.


+
+   return 0;
+}
+
+static int _dwc2_hcd_resume(struct usb_hcd *hcd)
+{
+   struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
+   u32 hprt0;
+
+   if (!((hsotg-op_state == OTG_STATE_B_HOST) ||
+   (hsotg-op_state == 

Re: [PATCH v11 1/3] mfd: add support for Diolan DLN-2 devices

2014-11-10 Thread Lee Jones
On Thu, 06 Nov 2014, Octavian Purdila wrote:

 This patch implements the USB part of the Diolan USB-I2C/SPI/GPIO
 Master Adapter DLN-2. Details about the device can be found here:
 
 https://www.diolan.com/i2c/i2c_interface.html.
 
 Information about the USB protocol can be found in the Programmer's
 Reference Manual [1], see section 1.7.
 
 Because the hardware has a single transmit endpoint and a single
 receive endpoint the communication between the various DLN2 drivers
 and the hardware will be muxed/demuxed by this driver.
 
 Each DLN2 module will be identified by the handle field within the DLN2
 message header. If a DLN2 module issues multiple commands in parallel
 they will be identified by the echo counter field in the message header.
 
 The DLN2 modules can use the dln2_transfer() function to issue a
 command and wait for its response. They can also register a callback
 that is going to be called when a specific event id is generated by
 the device (e.g. GPIO interrupts). The device uses handle 0 for
 sending events.
 
 [1] https://www.diolan.com/downloads/dln-api-manual.pdf
 
 Signed-off-by: Octavian Purdila octavian.purd...@intel.com
 Reviewed-by: Johan Hovold jo...@kernel.org

Great!  Thanks Johan.

 ---
  drivers/mfd/Kconfig  |  11 +
  drivers/mfd/Makefile |   1 +
  drivers/mfd/dln2.c   | 763 
 +++
  include/linux/mfd/dln2.h | 103 +++
  4 files changed, 878 insertions(+)
  create mode 100644 drivers/mfd/dln2.c
  create mode 100644 include/linux/mfd/dln2.h
 
 diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
 index cbdb109..32d7cab 100644
 --- a/drivers/mfd/Kconfig
 +++ b/drivers/mfd/Kconfig
 @@ -189,6 +189,17 @@ config MFD_DA9063
 Additional drivers must be enabled in order to use the functionality
 of the device.
  
 +config MFD_DLN2
 + tristate Diolan DLN2 support
 + select MFD_CORE
 + depends on USB
 + help
 +

I've removed this line and applied the set.

I will send out a pull-request to the other Maintainers shortly.

[...]

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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: Bug 87941 - usb warning messages on 3.18 prerelease kernels

2014-11-10 Thread Bruno Wolff III

On Sat, Nov 08, 2014 at 08:01:09 -0500,
 Alan Stern st...@rowland.harvard.edu wrote:


I'm not aware of any changes to ohci-hcd which would cause this to
happen.  In fact, I'm not aware of any changes at all to the PCI
version of ohci-hcd in this development cycle.


I now believe this is a hardware problem. The specific device was powered 
down (and right now it has dead batteries) and I was not used to seeing 
errors with powered down USB devices. However this device had other flakey 
behavior in the past where I had to unplug and replug the USB connection 
to get it working on occasion. 

I also went back to 3.13 and was still seeing the problem when I don't 
remember seeing it when I was actually using 3.13.


Sorry for the false alarm.
--
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] usb: dwc2: add bus suspend/resume for dwc2

2014-11-10 Thread Kever Yang
Hcd controller needs bus_suspend/resume, dwc2 controller make
root hub generate suspend/resume signal with hprt0 register
when work in host mode.
After the root hub enter suspend, we can make controller enter
low power state with PCGCTL register.

We also update the lx_state for hsotg state.

This patch has tested on rk3288 with suspend/resume.

Signed-off-by: Kever Yang kever.y...@rock-chips.com
Acked-by: Paul Zimmerman pa...@synopsys.com
---

Changes in v3:
- remove CONFIG_PM macro for bus_suspend/resume
- add PCGCTL operation for no device connect case

Changes in v2:
- update commit message
- make dwc2 suspend/resume sourcecode work

 drivers/usb/dwc2/hcd.c | 88 +++---
 1 file changed, 77 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index 0a0e6f0..7480078 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -1471,6 +1471,30 @@ static void dwc2_port_suspend(struct dwc2_hsotg *hsotg, 
u16 windex)
}
 }
 
+static void dwc2_port_resume(struct dwc2_hsotg *hsotg)
+{
+   u32 hprt0;
+
+   /* After clear the Stop PHY clock bit, we should wait for a moment
+* for PLL work stable with clock output.
+*/
+   writel(0, hsotg-regs + PCGCTL);
+   usleep_range(2000, 4000);
+
+   hprt0 = dwc2_read_hprt0(hsotg);
+   hprt0 |= HPRT0_RES;
+   writel(hprt0, hsotg-regs + HPRT0);
+   hprt0 = ~HPRT0_SUSP;
+   /* according to USB2.0 Spec 7.1.7.7, the host must send the resume
+* signal for at least 20ms
+*/
+   usleep_range(2, 25000);
+
+   hprt0 = ~HPRT0_RES;
+   writel(hprt0, hsotg-regs + HPRT0);
+   hsotg-lx_state = DWC2_L0;
+}
+
 /* Handles hub class-specific requests */
 static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
u16 wvalue, u16 windex, char *buf, u16 wlength)
@@ -1516,17 +1540,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg 
*hsotg, u16 typereq,
case USB_PORT_FEAT_SUSPEND:
dev_dbg(hsotg-dev,
ClearPortFeature USB_PORT_FEAT_SUSPEND\n);
-   writel(0, hsotg-regs + PCGCTL);
-   usleep_range(2, 4);
-
-   hprt0 = dwc2_read_hprt0(hsotg);
-   hprt0 |= HPRT0_RES;
-   writel(hprt0, hsotg-regs + HPRT0);
-   hprt0 = ~HPRT0_SUSP;
-   usleep_range(10, 15);
-
-   hprt0 = ~HPRT0_RES;
-   writel(hprt0, hsotg-regs + HPRT0);
+   dwc2_port_resume(hsotg);
break;
 
case USB_PORT_FEAT_POWER:
@@ -2299,6 +2313,55 @@ static void _dwc2_hcd_stop(struct usb_hcd *hcd)
usleep_range(1000, 3000);
 }
 
+static int _dwc2_hcd_suspend(struct usb_hcd *hcd)
+{
+   struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
+   u32 hprt0;
+
+   if (!((hsotg-op_state == OTG_STATE_B_HOST) ||
+   (hsotg-op_state == OTG_STATE_A_HOST)))
+   return 0;
+
+   /* TODO: We get into suspend from 'on' state, maybe we need to do
+* something if we get here from DWC2_L1(LPM sleep) state one day.
+*/
+   if (hsotg-lx_state != DWC2_L0)
+   return 0;
+
+   hprt0 = dwc2_read_hprt0(hsotg);
+   if (hprt0  HPRT0_CONNSTS) {
+   dwc2_port_suspend(hsotg, 1);
+   } else {
+   u32 pcgctl = readl(hsotg-regs + PCGCTL);
+
+   pcgctl |= PCGCTL_STOPPCLK;
+   writel(pcgctl, hsotg-regs + PCGCTL);
+   }
+
+   return 0;
+}
+
+static int _dwc2_hcd_resume(struct usb_hcd *hcd)
+{
+   struct dwc2_hsotg *hsotg = dwc2_hcd_to_hsotg(hcd);
+   u32 hprt0;
+
+   if (!((hsotg-op_state == OTG_STATE_B_HOST) ||
+   (hsotg-op_state == OTG_STATE_A_HOST)))
+   return 0;
+
+   if (hsotg-lx_state != DWC2_L2)
+   return 0;
+
+   hprt0 = dwc2_read_hprt0(hsotg);
+   if ((hprt0  HPRT0_CONNSTS)  (hprt0  HPRT0_SUSP))
+   dwc2_port_resume(hsotg);
+   else
+   writel(0, hsotg-regs + PCGCTL);
+
+   return 0;
+}
+
 /* Returns the current frame number */
 static int _dwc2_hcd_get_frame_number(struct usb_hcd *hcd)
 {
@@ -2669,6 +2732,9 @@ static struct hc_driver dwc2_hc_driver = {
.hub_status_data = _dwc2_hcd_hub_status_data,
.hub_control = _dwc2_hcd_hub_control,
.clear_tt_buffer_complete = _dwc2_hcd_clear_tt_buffer_complete,
+
+   .bus_suspend = _dwc2_hcd_suspend,
+   .bus_resume = _dwc2_hcd_resume,
 };
 
 /*
-- 
1.9.1

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


Re: xhci_hcd : Not enough bandwidth on HS bus for newly activated TT.

2014-11-10 Thread Mathias Nyman
On 10.11.2014 12:47, Kenneth Johansson wrote:
 So I have a problem that happens with 1-2 weeks interval in that the xhci 
 driver confuses itself and thinks that the usb bus is overused or something.
 
 The thing is that this is an external usb 2 hub with 7 ports and all 7 is 
 used for different devices. I do a suspend/resume once a day and thats it.
 its the same devices on the hub but the USB driver for some reason decides 
 that it no longer can allow the devices on the bus.
 
 1. is there any way to reset the entire usb stack without rebooting??  I run 
 3.16 ubuntu kernel and I think usb is built in I at least can see any module 
 named xhci.
 
 2. what can be done to solve this ?? there must be some type of resource leak 
 here as a reboot solves the problem and I have exactly the same usb devices 
 that I use.
 
 3. I also notice that we max out at about 30 devices and I think usb should 
 be able to handle 127.
 
 4. I noticed on a different computer that a usb sound card (5.1) was also 
 getting the bandwidth error if I attached it to a usb3 hub that had only that 
 device, it works if I remove the hub.
 
 5. overall usb3 looks to be a bit unpredictable and if you google for this 
 type of errors the advice is to downgrade to usb2. that do sound like the 
 wrong thing to do unless the xhci hardware is that broken. is it ? or is this 
 the driver that needs fixing.
 
 
 
 -
 [65633.315419] usb 3-1.4.1: Product: USB Transfer Cable
 [65633.315422] usb 3-1.4.1: Manufacturer: Prolific Technology Inc.
 [65633.315607] xhci_hcd :00:14.0: Not enough bandwidth on HS bus for 
 newly activated TT.
 [65633.315612] xhci_hcd :00:14.0: Not enough bandwidth
 [65633.315619] usb 3-1.4.1: can't set config #1, error -12
 ---
 [65653.367865] xhci_hcd :00:14.0: Not enough bandwidth on HS bus for 
 newly activated TT.
 [65653.367867] xhci_hcd :00:14.0: Not enough bandwidth
 [65653.367872] usb 3-1.2: can't set config #1, error -12
 
 and so on.
 -- 


The xhci controller has a limit for max devices it can support, usually less 
than 127.
 3.16 kernel and later should report Max number of devices this xHCI host 
supports is %u.\n when you reach the limit.

I've got reports about bandwidth errors before, so far two different kinds, one 
is a context error which happends
while allocating bandwith, and is not really a bandwidth issue. Then we also 
got real bandwith errors in cases
when we really shouldn't ave them. 

This is one of the many issues I need to address after resolving other current 
issues (race in reset endpoint, reset device and stop endoint).
Might be that it's just the driver that needs fixing, need to get my hands on 
it. Probably start with displaying more debug output when we hit bandwidth 
limits.

-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 v11 0/3] add support for Diolan DLN-2

2014-11-10 Thread Lee Jones
Linus, Wolfram,

Enjoy!

The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:

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

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
tags/ib-mfd-gpio-i2c-v3.19

for you to fetch changes up to e7d146b11a8a33b6033220b0f4fc4de2ab29218a:

  gpio: add support for the Diolan DLN-2 USB GPIO driver (2014-11-10 15:05:49 
+)


Immutable branch between MFD, GPIO and I2C


Daniel Baluta (1):
  gpio: add support for the Diolan DLN-2 USB GPIO driver

Laurentiu Palcu (1):
  i2c: add support for Diolan DLN-2 USB-I2C adapter

Octavian Purdila (1):
  mfd: Add support for Diolan DLN-2 devices

 drivers/gpio/Kconfig  |  12 +
 drivers/gpio/Makefile |   1 +
 drivers/gpio/gpio-dln2.c  | 553 ++
 drivers/i2c/busses/Kconfig|  10 +
 drivers/i2c/busses/Makefile   |   1 +
 drivers/i2c/busses/i2c-dln2.c | 267 +++
 drivers/mfd/Kconfig   |  10 +
 drivers/mfd/Makefile  |   1 +
 drivers/mfd/dln2.c| 763 ++
 include/linux/mfd/dln2.h  | 103 ++
 10 files changed, 1721 insertions(+)
 create mode 100644 drivers/gpio/gpio-dln2.c
 create mode 100644 drivers/i2c/busses/i2c-dln2.c
 create mode 100644 drivers/mfd/dln2.c
 create mode 100644 include/linux/mfd/dln2.h

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[GIT PULL] Immutable branch between MFD, GPIO and I2C

2014-11-10 Thread Lee Jones
[Subject change -- in case you miss it]

Linus, Wolfram,

Enjoy!

The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:

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

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
tags/ib-mfd-gpio-i2c-v3.19

for you to fetch changes up to e7d146b11a8a33b6033220b0f4fc4de2ab29218a:

  gpio: add support for the Diolan DLN-2 USB GPIO driver (2014-11-10 15:05:49 
+)


Immutable branch between MFD, GPIO and I2C


Daniel Baluta (1):
  gpio: add support for the Diolan DLN-2 USB GPIO driver

Laurentiu Palcu (1):
  i2c: add support for Diolan DLN-2 USB-I2C adapter

Octavian Purdila (1):
  mfd: Add support for Diolan DLN-2 devices

 drivers/gpio/Kconfig  |  12 +
 drivers/gpio/Makefile |   1 +
 drivers/gpio/gpio-dln2.c  | 553 ++
 drivers/i2c/busses/Kconfig|  10 +
 drivers/i2c/busses/Makefile   |   1 +
 drivers/i2c/busses/i2c-dln2.c | 267 +++
 drivers/mfd/Kconfig   |  10 +
 drivers/mfd/Makefile  |   1 +
 drivers/mfd/dln2.c| 763 ++
 include/linux/mfd/dln2.h  | 103 ++
 10 files changed, 1721 insertions(+)
 create mode 100644 drivers/gpio/gpio-dln2.c
 create mode 100644 drivers/i2c/busses/i2c-dln2.c
 create mode 100644 drivers/mfd/dln2.c
 create mode 100644 include/linux/mfd/dln2.h

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: xHCI bug

2014-11-10 Thread Felipe Balbi
Hi,

On Fri, Nov 07, 2014 at 03:40:01PM +0200, Mathias Nyman wrote:
 On 07.11.2014 00:25, Felipe Balbi wrote:
  On Thu, Nov 06, 2014 at 10:36:30AM -0600, Felipe Balbi wrote:
  On Thu, Nov 06, 2014 at 06:31:20PM +0200, Mathias Nyman wrote:
  On 05.11.2014 21:28, Felipe Balbi wrote:
  Hi,
 
  On Tue, Oct 14, 2014 at 04:34:00PM +0300, Mathias Nyman wrote:
  Could you try with xhci debugging enabled? (will probably produce a
  lot of output)
 
  echo -n 'module xhci_hcd =p'  
  /sys/kernel/debug/dynamic_debug/control
 
  I'll try, sure.
 
  I used tracing otherwise the problem wouldn't show up. Attached you can
  find output:
 
  0b7e070de7b65de9f70805f4639b3e58  xhci-timeout-testusb.txt.gz
 
 
  Thanks, looks like we end up calling cleanup_halted_endpoint()  a lot.
  This will (try to) reset the endpoint and move to handle the next TD 
  (URB).
 
  This is called when we're processing contorl transfers and something 
  out of the ordinary happends (returned STALL, BABBLE, and some other 
  reasons)
 
  I need to dig a bit deeper to know what actually is going on. 
 
  any news here ? It's been almost a month.
 
 
  While looking at this and other bugs I found races between reset 
  endpoint, reset device, and set dequeue pointer commands. 
  I suspect the loop in your logs is due to starting the endpoint ring too 
  early after reset. It restarts before we move
  past the problematic TD, and start executing it again.
 
  The logs don't show why the TD fails in the first place, but I got 
  another patch fixing other race issues which might help.
 
  Both patches are now in a reset-rework topic branch at:
 
  git://git.kernel.org/pub/scm/linux/kernel/git/mnyman/xhci.git reset-rework
 
  Its based on 3.18-rc2.
  I haven't still got or set up a usb device with gadget zero to test it 
  out myself
 
  I'll try to run it today or tomorrow.
  
  seems to be working so far. It has been running for at least a couple
  hours. I'll leave it running until Monday or Tuesday before giving you a
  Tested-by, though.
  
 
 Thanks, much appreciated. 
 Sounds promising so far, hope it lasts over the weekend

Alright, it has been running for almost 4 days and failures so far:

[1]+ ./test.sh 
# uptime 
 15:20:15 up 3 days, 20:08,  1 user,  load average: 1.63, 1.84, 1.86

So, for both commits on reset-rework (see below), you can have my:

Tested-by: Felipe Balbi ba...@ti.com


8---

commit d0a6a31173ccc49625c3e6e9e8a86e4a6e885ea6
Author: Mathias Nyman mathias.ny...@linux.intel.com
Date:   Thu Nov 6 18:06:09 2014 +0200

xhci: don't start a halted endpoint before its new dequeue is set

A halted endpoint ring must first be reset, then move the ring
dequeue pointer past the problematic TRB. If we start the ring too
early after reset, but before moving the dequeue pointer we
will end up executing the same problematic TRB again.

As we always issue a set tranfer dequeue command after a reset
endpoint command we can skip starting endpoint rings at reset endpoint
command completion.

Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com

commit 117e8a66b8665a78a1eef1344c05901b1d94
Author: Mathias Nyman mathias.ny...@linux.intel.com
Date:   Tue Nov 4 19:00:47 2014 +0200

xhci: Don't set freed transfer dq pointers after device reset

If an endpoint halts, or we want to cancel a URB, we need to modify
TRBs on the endpoint ring. Before editing the trbs we need to stop
the ring, and after editing, then restart the ring from a working place.
Usually the next TD after the failed or cancelled one.

If a reset device command is queued in the middle of this it will
disable all endpoints and and free the rings. The Set transfer dequeue
command queued after device reset will try to set invalid pointers.

To avoid this we check if a unhandled device reset is queued before
queuing a set transfer dequeue command, and make sure we clear
endpoint state and stopped_td pointers after device reset.

Also give back all the cancelled URBs from the old ring after
device reset.

Signed-off-by: Mathias Nyman mathias.ny...@linux.intel.com

-- 
balbi


signature.asc
Description: Digital signature


Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode

2014-11-10 Thread Felipe Balbi
Hi,

On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote:
 @@ -1469,6 +1484,7 @@ static int ab8500_usb_probe(struct platform_device 
 *pdev)
  
   abx500_usb_link_status_update(ab);
  
 + usb_phy_wsource_init(ab-phy);

instead of adding this to all drivers, you can just it to
usb_add_phy_dev() and conversely, to usb_remove_phy().

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH v11 0/3] add support for Diolan DLN-2

2014-11-10 Thread Octavian Purdila
On Mon, Nov 10, 2014 at 5:10 PM, Lee Jones lee.jo...@linaro.org wrote:
 Linus, Wolfram,

 Enjoy!

 The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:

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

 are available in the git repository at:

   git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
 tags/ib-mfd-gpio-i2c-v3.19

Hi Lee,

Not sure if this matter, but this tree seems to miss the
mfd_add_hotplug_devices patches from Johan, which are needed by the
patches below.


 for you to fetch changes up to e7d146b11a8a33b6033220b0f4fc4de2ab29218a:

   gpio: add support for the Diolan DLN-2 USB GPIO driver (2014-11-10 15:05:49 
 +)

 
 Immutable branch between MFD, GPIO and I2C

 
 Daniel Baluta (1):
   gpio: add support for the Diolan DLN-2 USB GPIO driver

 Laurentiu Palcu (1):
   i2c: add support for Diolan DLN-2 USB-I2C adapter

 Octavian Purdila (1):
   mfd: Add support for Diolan DLN-2 devices

  drivers/gpio/Kconfig  |  12 +
  drivers/gpio/Makefile |   1 +
  drivers/gpio/gpio-dln2.c  | 553 ++
  drivers/i2c/busses/Kconfig|  10 +
  drivers/i2c/busses/Makefile   |   1 +
  drivers/i2c/busses/i2c-dln2.c | 267 +++
  drivers/mfd/Kconfig   |  10 +
  drivers/mfd/Makefile  |   1 +
  drivers/mfd/dln2.c| 763 
 ++
  include/linux/mfd/dln2.h  | 103 ++
  10 files changed, 1721 insertions(+)
  create mode 100644 drivers/gpio/gpio-dln2.c
  create mode 100644 drivers/i2c/busses/i2c-dln2.c
  create mode 100644 drivers/mfd/dln2.c
  create mode 100644 include/linux/mfd/dln2.h

 --
 Lee Jones
 Linaro STMicroelectronics Landing Team Lead
 Linaro.org │ Open source software for ARM SoCs
 Follow Linaro: Facebook | Twitter | Blog
--
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 v11 0/3] add support for Diolan DLN-2

2014-11-10 Thread Lee Jones
On Mon, 10 Nov 2014, Octavian Purdila wrote:

 On Mon, Nov 10, 2014 at 5:10 PM, Lee Jones lee.jo...@linaro.org wrote:
  Linus, Wolfram,
 
  Enjoy!
 
  The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:
 
Linux 3.18-rc1 (2014-10-19 18:08:38 -0700)
 
  are available in the git repository at:
 
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
  tags/ib-mfd-gpio-i2c-v3.19
 
 Hi Lee,
 
 Not sure if this matter, but this tree seems to miss the
 mfd_add_hotplug_devices patches from Johan, which are needed by the
 patches below.

Yes, that will definitely matter.

  for you to fetch changes up to e7d146b11a8a33b6033220b0f4fc4de2ab29218a:
 
gpio: add support for the Diolan DLN-2 USB GPIO driver (2014-11-10 
  15:05:49 +)
 
  
  Immutable branch between MFD, GPIO and I2C
 
  
  Daniel Baluta (1):
gpio: add support for the Diolan DLN-2 USB GPIO driver
 
  Laurentiu Palcu (1):
i2c: add support for Diolan DLN-2 USB-I2C adapter
 
  Octavian Purdila (1):
mfd: Add support for Diolan DLN-2 devices
 
   drivers/gpio/Kconfig  |  12 +
   drivers/gpio/Makefile |   1 +
   drivers/gpio/gpio-dln2.c  | 553 ++
   drivers/i2c/busses/Kconfig|  10 +
   drivers/i2c/busses/Makefile   |   1 +
   drivers/i2c/busses/i2c-dln2.c | 267 +++
   drivers/mfd/Kconfig   |  10 +
   drivers/mfd/Makefile  |   1 +
   drivers/mfd/dln2.c| 763 
  ++
   include/linux/mfd/dln2.h  | 103 ++
   10 files changed, 1721 insertions(+)
   create mode 100644 drivers/gpio/gpio-dln2.c
   create mode 100644 drivers/i2c/busses/i2c-dln2.c
   create mode 100644 drivers/mfd/dln2.c
   create mode 100644 include/linux/mfd/dln2.h
 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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: [GIT PULL] Immutable branch between MFD, GPIO and I2C

2014-11-10 Thread Lee Jones
Please don't pull this -- it is missing a patch.

Will fix.

 [Subject change -- in case you miss it]
 
 Linus, Wolfram,
 
 Enjoy!
 
 The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:
 
   Linux 3.18-rc1 (2014-10-19 18:08:38 -0700)
 
 are available in the git repository at:
 
   git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
 tags/ib-mfd-gpio-i2c-v3.19
 
 for you to fetch changes up to e7d146b11a8a33b6033220b0f4fc4de2ab29218a:
 
   gpio: add support for the Diolan DLN-2 USB GPIO driver (2014-11-10 15:05:49 
 +)
 
 
 Immutable branch between MFD, GPIO and I2C
 
 
 Daniel Baluta (1):
   gpio: add support for the Diolan DLN-2 USB GPIO driver
 
 Laurentiu Palcu (1):
   i2c: add support for Diolan DLN-2 USB-I2C adapter
 
 Octavian Purdila (1):
   mfd: Add support for Diolan DLN-2 devices
 
  drivers/gpio/Kconfig  |  12 +
  drivers/gpio/Makefile |   1 +
  drivers/gpio/gpio-dln2.c  | 553 ++
  drivers/i2c/busses/Kconfig|  10 +
  drivers/i2c/busses/Makefile   |   1 +
  drivers/i2c/busses/i2c-dln2.c | 267 +++
  drivers/mfd/Kconfig   |  10 +
  drivers/mfd/Makefile  |   1 +
  drivers/mfd/dln2.c| 763 
 ++
  include/linux/mfd/dln2.h  | 103 ++
  10 files changed, 1721 insertions(+)
  create mode 100644 drivers/gpio/gpio-dln2.c
  create mode 100644 drivers/i2c/busses/i2c-dln2.c
  create mode 100644 drivers/mfd/dln2.c
  create mode 100644 include/linux/mfd/dln2.h
 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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: btusb_intr_complete returns -EPIPE

2014-11-10 Thread Alan Stern
On Mon, 10 Nov 2014, Naveen Kumar Parna wrote:

 I am sorry for the late response.
 
 I applied the patch and here is the dmesg log:
 
 [  713.125709] ehci-pci :00:1a.0: split intr info2 42821c01 token
 80108d46 overlay token 80108d46
 [  713.125796] ehci-pci :00:1a.0: split intr info2 42821c01 token
 80108d46 overlay token 80108d46
 [  713.125853] hci4 urb 8800b89a7c00 status -32 count 0
 [  713.125857] hci3 urb 8800b7399c00 status -32 count 0

 Does it gives the reason for -32 status code?

More or less.  The last (status) byte in the token values is 0x46,
and the 0x04 status bit is documented in the EHCI spec as follows:

Missed Micro-Frame. This bit is ignored unless the QH.EPS field 
indicates a full- or low-speed endpoint and the queue head is 
in the periodic list. This bit is set when the host controller 
detected that a host-induced hold-off caused the host 
controller to miss a required complete-split transaction. If the 
host controller sets this bit to a one, then it remains a one 
for the duration of thetransfer.

This means the host controller is telling you it was unable to carry 
out the CSPLIT part of the transaction, which means it really is a 
hardware problem (and not a bad memory chip).  Either the controller 
isn't working right or else your system is somehow overloaded.

The 0x42 bits indicate that the Queue Head was halted and a CSPLIT is
pending (which we already knew).  The halted status bit is the reason
why you got a -32 status code.

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: [GIT PULL] Immutable branch between MFD, GPIO and I2C

2014-11-10 Thread Lee Jones
 Please don't pull this -- it is missing a patch.
 
 Will fix.

Okay, dependency fixed.  Sorry for the fuss.  Pull when ready.

  [Subject change -- in case you miss it]
  
  Linus, Wolfram,
  
  Enjoy!
  
  The following changes since commit f114040e3ea6e07372334ade75d1ee0775c355e1:
  
Linux 3.18-rc1 (2014-10-19 18:08:38 -0700)
  
  are available in the git repository at:
  
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git 
  tags/ib-mfd-gpio-i2c-v3.19
  
  for you to fetch changes up to e7d146b11a8a33b6033220b0f4fc4de2ab29218a:
  
gpio: add support for the Diolan DLN-2 USB GPIO driver (2014-11-10 
  15:05:49 +)
  
  
  Immutable branch between MFD, GPIO and I2C
  
  
  Daniel Baluta (1):
gpio: add support for the Diolan DLN-2 USB GPIO driver
  
  Laurentiu Palcu (1):
i2c: add support for Diolan DLN-2 USB-I2C adapter
  
  Octavian Purdila (1):
mfd: Add support for Diolan DLN-2 devices
  
   drivers/gpio/Kconfig  |  12 +
   drivers/gpio/Makefile |   1 +
   drivers/gpio/gpio-dln2.c  | 553 ++
   drivers/i2c/busses/Kconfig|  10 +
   drivers/i2c/busses/Makefile   |   1 +
   drivers/i2c/busses/i2c-dln2.c | 267 +++
   drivers/mfd/Kconfig   |  10 +
   drivers/mfd/Makefile  |   1 +
   drivers/mfd/dln2.c| 763 
  ++
   include/linux/mfd/dln2.h  | 103 ++
   10 files changed, 1721 insertions(+)
   create mode 100644 drivers/gpio/gpio-dln2.c
   create mode 100644 drivers/i2c/busses/i2c-dln2.c
   create mode 100644 drivers/mfd/dln2.c
   create mode 100644 include/linux/mfd/dln2.h
  
 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
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: dwc2: add bus suspend/resume for dwc2

2014-11-10 Thread Julius Werner
 The contract for bus_suspend() is that it will suspend all ports not
 yet suspended, keep track of those ports and then only resume those in
 bus_resume() (compare, for example, how XHCI keeps track of that with
 xhci_bus_state.bus_suspended in xhci_bus_suspend/resume()). So you
 need something here to remember whether this function suspended the
 port or whether it had already been suspended, and then only resume
 the port in bus_resume() in the former case.

 In fact, the dwc2 controller only support one port, so the hprt0
 is the only one port we need to care.

Yes, I know, but that one port still needs to play by the rules the
USB core expects. All I'm saying is: if the port was already suspended
during bus_suspend(), then the next bus_resume() should not resume it.

The rest looks good to me now. But in order to get it really working,
I think we'll still need the actual driver.pm suspend/resume methods,
at least for the HCD_FLAG_HW_ACCESSIBLE and the
usb_root_hub_lost_power() handling (probably better in a separate
patch).
--
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: musb: replace hard coded registers with defines

2014-11-10 Thread Roman Byshko
musb registers can be dumped using the file regdump
which is created in debugfs. Up to now  hard coded
register addresses are used for that. Different glue
layers however have different register addresses. The
patch addresses this issue by substituting bare register
addresses with defines.

Signed-off-by: Roman Byshko rbys...@gmail.com
---
 drivers/usb/musb/musb_debugfs.c | 57 ++---
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 4c21679..ad3701a 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -49,33 +49,36 @@ struct musb_register_map {
 };

 static const struct musb_register_map musb_regmap[] = {
-{ FAddr,0x00,8 },
-{ Power,0x01,8 },
-{ Frame,0x0c,16 },
-{ Index,0x0e,8 },
-{ Testmode,0x0f,8 },
-{ TxMaxPp,0x10,16 },
-{ TxCSRp,0x12,16 },
-{ RxMaxPp,0x14,16 },
-{ RxCSR,0x16,16 },
-{ RxCount,0x18,16 },
-{ ConfigData,0x1f,8 },
-{ DevCtl,0x60,8 },
-{ MISC,0x61,8 },
-{ TxFIFOsz,0x62,8 },
-{ RxFIFOsz,0x63,8 },
-{ TxFIFOadd,0x64,16 },
-{ RxFIFOadd,0x66,16 },
-{ VControl,0x68,32 },
-{ HWVers,0x6C,16 },
-{ EPInfo,0x78,8 },
-{ RAMInfo,0x79,8 },
-{ LinkInfo,0x7A,8 },
-{ VPLen,0x7B,8 },
-{ HS_EOF1,0x7C,8 },
-{ FS_EOF1,0x7D,8 },
-{ LS_EOF1,0x7E,8 },
-{ SOFT_RST,0x7F,8 },
+{ FAddr,MUSB_FADDR,8 },
+{ Power,MUSB_POWER,8 },
+{ Frame,MUSB_FRAME,16 },
+{ Index,MUSB_INDEX,8 },
+{ Testmode,MUSB_TESTMODE,8 },
+{ TxMaxPp,MUSB_TXMAXP,16 },
+{ TxCSRp,MUSB_TXCSR,16 },
+{ RxMaxPp,MUSB_RXMAXP,16 },
+{ RxCSR,MUSB_RXCSR,16 },
+{ RxCount,MUSB_RXCOUNT,16 },
+{ ConfigData,MUSB_CONFIGDATA,8 },
+{ IntrRxE,MUSB_INTRRXE,16 },
+{ IntrTxE,MUSB_INTRTXE,16 },
+{ IntrUsbE,MUSB_INTRUSBE,8 },
+{ DevCtl,MUSB_DEVCTL,8 },
+{ BabbleCtl,MUSB_BABBLE_CTL,8 },
+{ TxFIFOsz,MUSB_TXFIFOSZ,8 },
+{ RxFIFOsz,MUSB_RXFIFOSZ,8 },
+{ TxFIFOadd,MUSB_TXFIFOADD,16 },
+{ RxFIFOadd,MUSB_RXFIFOADD,16 },
+{ VControl,0x68,32 },
+{ HWVers,0x69,16 },
+{ EPInfo,MUSB_EPINFO,8 },
+{ RAMInfo,MUSB_RAMINFO,8 },
+{ LinkInfo,MUSB_LINKINFO,8 },
+{ VPLen,MUSB_VPLEN,8 },
+{ HS_EOF1,MUSB_HS_EOF1,8 },
+{ FS_EOF1,MUSB_FS_EOF1,8 },
+{ LS_EOF1,MUSB_LS_EOF1,8 },
+{ SOFT_RST,0x7F,8 },
 { DMA_CNTLch0,0x204,16 },
 { DMA_ADDRch0,0x208,32 },
 { DMA_COUNTch0,0x20C,32 },
-- 
2.1.2
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next 1/2] seq_puts: Convert to return void and convert uses too.

2014-11-10 Thread Joe Perches
Using the return value of seq_puts is error-prone, so
make it return void instead.

Use seq_has_overflowed where appropriate instead of the
old return value.

Signed-off-by: Joe Perches j...@perches.com
---
 drivers/parisc/ccio-dma.c |  7 ++--
 drivers/regulator/dbx500-prcmu.c  | 21 --
 drivers/usb/gadget/udc/goku_udc.c | 81 ---
 drivers/watchdog/bcm_kona_wdt.c   | 43 -
 fs/seq_file.c | 15 
 include/linux/seq_file.h  |  2 +-
 ipc/util.c|  6 ++-
 7 files changed, 89 insertions(+), 86 deletions(-)

diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index 8b490d7..c40cc98 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1101,7 +1101,6 @@ static const struct file_operations ccio_proc_info_fops = 
{
 
 static int ccio_proc_bitmap_info(struct seq_file *m, void *p)
 {
-   int len = 0;
struct ioc *ioc = ioc_list;
 
while (ioc != NULL) {
@@ -1110,11 +1109,11 @@ static int ccio_proc_bitmap_info(struct seq_file *m, 
void *p)
 
for (j = 0; j  (ioc-res_size / sizeof(u32)); j++) {
if ((j  7) == 0)
-   len += seq_puts(m, \n   );
-   len += seq_printf(m, %08x, *res_ptr);
+   seq_puts(m, \n   );
+   seq_printf(m, %08x, *res_ptr);
res_ptr++;
}
-   len += seq_puts(m, \n\n);
+   seq_puts(m, \n\n);
ioc = ioc-next;
break; /* XXX - remove me */
}
diff --git a/drivers/regulator/dbx500-prcmu.c b/drivers/regulator/dbx500-prcmu.c
index 2d16b9f..b778ca9 100644
--- a/drivers/regulator/dbx500-prcmu.c
+++ b/drivers/regulator/dbx500-prcmu.c
@@ -129,14 +129,8 @@ static int ux500_regulator_status_print(struct seq_file 
*s, void *p)
int i;
 
/* print dump header */
-   err = seq_puts(s, ux500-regulator status:\n);
-   if (err  0)
-   dev_err(dev, seq_puts overflow\n);
-
-   err = seq_printf(s, %31s : %8s : %8s\n, current,
-   before, after);
-   if (err  0)
-   dev_err(dev, seq_printf overflow\n);
+   seq_puts(s, ux500-regulator status:\n);
+   seq_printf(s, %31s : %8s : %8s\n, current, before, after);
 
for (i = 0; i  rdebug.num_regulators; i++) {
struct dbx500_regulator_info *info;
@@ -144,12 +138,11 @@ static int ux500_regulator_status_print(struct seq_file 
*s, void *p)
info = rdebug.regulator_array[i];
 
/* print status */
-   err = seq_printf(s, %20s : %8s : %8s : %8s\n, info-desc.name,
-   info-is_enabled ? enabled : disabled,
-   rdebug.state_before_suspend[i] ? enabled : disabled,
-   rdebug.state_after_suspend[i] ? enabled : disabled);
-   if (err  0)
-   dev_err(dev, seq_printf overflow\n);
+   seq_printf(s, %20s : %8s : %8s : %8s\n,
+  info-desc.name,
+  info-is_enabled ? enabled : disabled,
+  rdebug.state_before_suspend[i] ? enabled : 
disabled,
+  rdebug.state_after_suspend[i] ? enabled : 
disabled);
}
 
return 0;
diff --git a/drivers/usb/gadget/udc/goku_udc.c 
b/drivers/usb/gadget/udc/goku_udc.c
index 5b9176e..c16b4d9 100644
--- a/drivers/usb/gadget/udc/goku_udc.c
+++ b/drivers/usb/gadget/udc/goku_udc.c
@@ -1135,44 +1135,47 @@ static int udc_proc_read(struct seq_file *m, void *v)
continue;
 
tmp = readl(ep-reg_status);
-   if (seq_printf(m,
-   %s %s max %u %s, irqs %lu, 
-   status %02x (%s)  FOURBITS \n,
-   ep-ep.name,
-   ep-is_in ? in : out,
-   ep-ep.maxpacket,
-   ep-dma ? dma : pio,
-   ep-irqs,
-   tmp, ({ char *s;
-   switch (tmp  EPxSTATUS_EP_MASK) {
-   case EPxSTATUS_EP_READY:
-   s = ready; break;
-   case EPxSTATUS_EP_DATAIN:
-   s = packet; break;
-   case EPxSTATUS_EP_FULL:
-   s = full; break;
-   case EPxSTATUS_EP_TX_ERR:   // host will retry
-   s = tx_err; break;
-   case EPxSTATUS_EP_RX_ERR:
-   s = rx_err; break;
-   case EPxSTATUS_EP_BUSY: /* ep0 only */
-   s = busy; break;
-   case EPxSTATUS_EP_STALL:
-   s = stall; break;
-   case 

[PATCH -next 0/2] seq: Convert seq_puts and seq_putc to return void

2014-11-10 Thread Joe Perches
These are error prone, so return void adn use seq_has_overflowed instead

Joe Perches (2):
  seq_puts: Convert to return void and convert uses too.
  seq_putc: Convert to return void and convert uses too.

 drivers/char/ipmi/ipmi_msghandler.c|  4 +-
 drivers/parisc/ccio-dma.c  |  7 +-
 drivers/regulator/dbx500-prcmu.c   | 21 ++
 drivers/usb/gadget/udc/goku_udc.c  | 81 +++---
 drivers/watchdog/bcm_kona_wdt.c| 43 +++-
 fs/seq_file.c  | 26 +++
 include/linux/seq_file.h   |  4 +-
 ipc/util.c |  6 +-
 .../netfilter/nf_conntrack_l3proto_ipv4_compat.c   |  4 +-
 net/netfilter/nf_conntrack_expect.c|  4 +-
 10 files changed, 105 insertions(+), 95 deletions(-)

-- 
2.1.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] usbnet: smsc95xx: dereferencing NULL pointer

2014-11-10 Thread David Miller
From: Sudip Mukherjee sudipm.mukher...@gmail.com
Date: Fri,  7 Nov 2014 18:52:40 +0530

 we were dereferencing dev to initialize pdata. but just after that we
 have a BUG_ON(!dev). so we were basically dereferencing the pointer
 first and then tesing it for NULL.
 
 Signed-off-by: Sudip Mukherjee su...@vectorindia.org

You didn't even compile test this.

Do not even bother fixing theoretical issues if you're going to be
introducing a _REAL_ serious regression into the code with your fix:

drivers/net/usb/smsc95xx.c: In function ‘smsc95xx_resume’:
drivers/net/usb/smsc95xx.c:1674:5: warning: ‘pdata’ is used uninitialized in 
this function [-Wuninitialized]
  u8 suspend_flags = pdata-suspend_flags;
 ^

So, instead of a theoretical issue, we now have a real guaranteed
crash.

You did not compile test this change, and you definitely did not
functionally test this change either.

Please do not do this ever again, thanks.


Re: [PATCH] usb: musb: replace hard coded registers with defines

2014-11-10 Thread Felipe Balbi
On Mon, Nov 10, 2014 at 07:31:23PM +0100, Roman Byshko wrote:
 musb registers can be dumped using the file regdump
 which is created in debugfs. Up to now  hard coded
 register addresses are used for that. Different glue
 layers however have different register addresses. The
 patch addresses this issue by substituting bare register
 addresses with defines.
 
 Signed-off-by: Roman Byshko rbys...@gmail.com

TABs were converted into spaces, please fix and rebase on my
testing/next. Make sure TABs remain as TABs.

-- 
balbi


signature.asc
Description: Digital signature


[net-next PATCH 3/5] phonet: Replace calls to __skb_alloc_page with __netdev_alloc_page

2014-11-10 Thread Alexander Duyck
Replace the calls to __skb_alloc_page that are passed NULL with calls to
__netdev_alloc_page.

Cc: Oliver Neukum oli...@neukum.org
Cc: Felipe Balbi ba...@ti.com
Signed-off-by: Alexander Duyck alexander.h.du...@redhat.com
---
 drivers/net/usb/cdc-phonet.c   |2 +-
 drivers/usb/gadget/function/f_phonet.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 2ec1500..fd88da8 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -130,7 +130,7 @@ static int rx_submit(struct usbpn_dev *pnd, struct urb 
*req, gfp_t gfp_flags)
struct page *page;
int err;
 
-   page = __skb_alloc_page(gfp_flags | __GFP_NOMEMALLOC, NULL);
+   page = __netdev_alloc_page(gfp_flags | __GFP_NOMEMALLOC);
if (!page)
return -ENOMEM;
 
diff --git a/drivers/usb/gadget/function/f_phonet.c 
b/drivers/usb/gadget/function/f_phonet.c
index b9cfc15..1a5be3a 100644
--- a/drivers/usb/gadget/function/f_phonet.c
+++ b/drivers/usb/gadget/function/f_phonet.c
@@ -303,7 +303,7 @@ pn_rx_submit(struct f_phonet *fp, struct usb_request *req, 
gfp_t gfp_flags)
struct page *page;
int err;
 
-   page = __skb_alloc_page(gfp_flags | __GFP_NOMEMALLOC, NULL);
+   page = __netdev_alloc_page(gfp_flags | __GFP_NOMEMALLOC);
if (!page)
return -ENOMEM;
 

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


[net-next PATCH 4/5] fm10k/igb/ixgbe: Replace __skb_alloc_page with netdev_alloc_page

2014-11-10 Thread Alexander Duyck
The Intel drivers were pretty much just using the plain vanilla GFP flags
in their calls to __skb_alloc_page so this change makes it so that they use
netdev_alloc_page which just uses GFP_ATOMIC for the gfp_flags value.

Cc: Jeff Kirsher jeffrey.t.kirs...@intel.com
Cc: Matthew Vick matthew.v...@intel.com
Cc: Don Skidmore donald.c.skidm...@intel.com
Signed-off-by: Alexander Duyck alexander.h.du...@redhat.com
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c |2 +-
 drivers/net/ethernet/intel/igb/igb_main.c |2 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |3 +--
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c 
b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index e645af4..64d82c5 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -83,7 +83,7 @@ static bool fm10k_alloc_mapped_page(struct fm10k_ring 
*rx_ring,
return true;
 
/* alloc new page for storage */
-   page = alloc_page(GFP_ATOMIC | __GFP_COLD);
+   page = netdev_alloc_page();
if (unlikely(!page)) {
rx_ring-rx_stats.alloc_failed++;
return false;
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c 
b/drivers/net/ethernet/intel/igb/igb_main.c
index a2d72a8..1245a86 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6988,7 +6988,7 @@ static bool igb_alloc_mapped_page(struct igb_ring 
*rx_ring,
return true;
 
/* alloc new page for storage */
-   page = __skb_alloc_page(GFP_ATOMIC | __GFP_COLD, NULL);
+   page = netdev_alloc_page();
if (unlikely(!page)) {
rx_ring-rx_stats.alloc_failed++;
return false;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c 
b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index d2df4e3..8e4ba8c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -1440,8 +1440,7 @@ static bool ixgbe_alloc_mapped_page(struct ixgbe_ring 
*rx_ring,
 
/* alloc new page for storage */
if (likely(!page)) {
-   page = __skb_alloc_pages(GFP_ATOMIC | __GFP_COLD | __GFP_COMP,
-bi-skb, ixgbe_rx_pg_order(rx_ring));
+   page = netdev_alloc_pages(ixgbe_rx_pg_order(rx_ring));
if (unlikely(!page)) {
rx_ring-rx_stats.alloc_rx_page_failed++;
return false;

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


[net-next PATCH 1/5] net: Add netdev Rx page allocation function

2014-11-10 Thread Alexander Duyck
This patch implements __netdev_alloc_pages and __netdev_alloc_page.  These
are meant to replace the __skb_alloc_pages and __skb_alloc_page functions.
The reason for doing this is that it occurred to me that __skb_alloc_page is
supposed to be passed an sk_buff pointer, but it is NULL in all cases where
it is used.  Worse is that in the case of ixgbe it is passed NULL via the
sk_buff pointer in the rx_buffer info structure which means the compiler is
not correctly stripping it out.

In the case of anything greater than order 0 it is assumed that we want a
compound page so __GFP_COMP is set for all allocations as we expect a
compound page when assigning a page frag.

The other change in this patch is to exploit the behaviors of the page
allocator in how it handles flags.  So for example we can always set
__GFP_COMP and __GFP_MEMALLOC since they are ignored if they are not
applicable or are overridden by another flag.

Signed-off-by: Alexander Duyck alexander.h.du...@redhat.com
---
 include/linux/skbuff.h |   48 
 1 file changed, 48 insertions(+)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 103fbe8..f196628 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2185,6 +2185,54 @@ static inline struct sk_buff 
*netdev_alloc_skb_ip_align(struct net_device *dev,
 }
 
 /**
+ * __netdev_alloc_pages - allocate page for ps-rx
+ * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx
+ * @order: size of the allocation
+ *
+ * Allocate a new page.
+ *
+ * %NULL is returned if there is no free memory.
+*/
+static inline struct page *__netdev_alloc_pages(gfp_t gfp_mask,
+   unsigned int order)
+{
+   /* This piece of code contains several assumptions.
+* 1.  This is for device Rx, therefor a cold page is preferred.
+* 2.  The expectation is the user wants a compound page.
+* 3.  If requesting a order 0 page it will not be compound
+* due to the check to see if order has a value in prep_new_page
+* 4.  __GFP_MEMALLOC is ignored if __GFP_NOMEMALLOC is due to
+* code in gfp_to_alloc_flags that should be enforcing this.
+*/
+   gfp_mask |= __GFP_COLD | __GFP_COMP | __GFP_MEMALLOC;
+
+   return alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
+}
+
+static inline struct page *netdev_alloc_pages(unsigned int order)
+{
+   return __netdev_alloc_pages(GFP_ATOMIC, order);
+}
+
+/**
+ * __netdev_alloc_page - allocate a page for ps-rx
+ * @gfp_mask: allocation priority. Set __GFP_NOMEMALLOC if not for network Rx
+ *
+ * Allocate a new page.
+ *
+ * %NULL is returned if there is no free memory.
+ */
+static inline struct page *__netdev_alloc_page(gfp_t gfp_mask)
+{
+   return __netdev_alloc_pages(gfp_mask, 0);
+}
+
+static inline struct page *netdev_alloc_page(void)
+{
+   return __netdev_alloc_page(GFP_ATOMIC);
+}
+
+/**
  * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve 
pfmemalloc data
  * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for 
network packet RX
  * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used

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


[net-next PATCH 5/5] net: Remove __skb_alloc_page and __skb_alloc_pages

2014-11-10 Thread Alexander Duyck
Remove the two functions which are now dead code.

Signed-off-by: Alexander Duyck alexander.h.du...@redhat.com
---
 include/linux/skbuff.h |   43 ---
 1 file changed, 43 deletions(-)

diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index f196628..e4acbca 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2233,49 +2233,6 @@ static inline struct page *netdev_alloc_page(void)
 }
 
 /**
- * __skb_alloc_pages - allocate pages for ps-rx on a skb and preserve 
pfmemalloc data
- * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for 
network packet RX
- * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
- * @order: size of the allocation
- *
- * Allocate a new page.
- *
- * %NULL is returned if there is no free memory.
-*/
-static inline struct page *__skb_alloc_pages(gfp_t gfp_mask,
- struct sk_buff *skb,
- unsigned int order)
-{
-   struct page *page;
-
-   gfp_mask |= __GFP_COLD;
-
-   if (!(gfp_mask  __GFP_NOMEMALLOC))
-   gfp_mask |= __GFP_MEMALLOC;
-
-   page = alloc_pages_node(NUMA_NO_NODE, gfp_mask, order);
-   if (skb  page  page-pfmemalloc)
-   skb-pfmemalloc = true;
-
-   return page;
-}
-
-/**
- * __skb_alloc_page - allocate a page for ps-rx for a given skb and 
preserve pfmemalloc data
- * @gfp_mask: alloc_pages_node mask. Set __GFP_NOMEMALLOC if not for 
network packet RX
- * @skb: skb to set pfmemalloc on if __GFP_MEMALLOC is used
- *
- * Allocate a new page.
- *
- * %NULL is returned if there is no free memory.
- */
-static inline struct page *__skb_alloc_page(gfp_t gfp_mask,
-struct sk_buff *skb)
-{
-   return __skb_alloc_pages(gfp_mask, skb, 0);
-}
-
-/**
  * skb_propagate_pfmemalloc - Propagate pfmemalloc if skb is allocated 
after RX page
  * @page: The page that was allocated from skb_alloc_page
  * @skb: The skb that may need pfmemalloc set

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


[net-next PATCH 2/5] cxgb4/cxgb4vf: Replace __skb_alloc_page with __netdev_alloc_page

2014-11-10 Thread Alexander Duyck
Drop the bloated use of __skb_alloc_page and replace it with
__netdev_alloc_page.  In addition update the one other spot that is
allocating a page so that it allocates with the correct flags.

Cc: Hariprasad S haripra...@chelsio.com
Cc: Casey Leedom lee...@chelsio.com
Signed-off-by: Alexander Duyck alexander.h.du...@redhat.com
---
 drivers/net/ethernet/chelsio/cxgb4/sge.c   |6 +++---
 drivers/net/ethernet/chelsio/cxgb4vf/sge.c |7 ---
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/sge.c 
b/drivers/net/ethernet/chelsio/cxgb4/sge.c
index 5e1b314..f7dd6e3 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4/sge.c
@@ -576,7 +576,7 @@ static unsigned int refill_fl(struct adapter *adap, struct 
sge_fl *q, int n,
__be64 *d = q-desc[q-pidx];
struct rx_sw_desc *sd = q-sdesc[q-pidx];
 
-   gfp |= __GFP_NOWARN | __GFP_COLD;
+   gfp |= __GFP_NOWARN;
 
if (s-fl_pg_order == 0)
goto alloc_small_pages;
@@ -585,7 +585,7 @@ static unsigned int refill_fl(struct adapter *adap, struct 
sge_fl *q, int n,
 * Prefer large buffers
 */
while (n) {
-   pg = alloc_pages(gfp | __GFP_COMP, s-fl_pg_order);
+   pg = __netdev_alloc_pages(gfp, s-fl_pg_order);
if (unlikely(!pg)) {
q-large_alloc_failed++;
break;   /* fall back to single pages */
@@ -615,7 +615,7 @@ static unsigned int refill_fl(struct adapter *adap, struct 
sge_fl *q, int n,
 
 alloc_small_pages:
while (n--) {
-   pg = __skb_alloc_page(gfp, NULL);
+   pg = __netdev_alloc_page(gfp);
if (unlikely(!pg)) {
q-alloc_failed++;
break;
diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c 
b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index 85036e6..ad5df49 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -602,6 +602,8 @@ static unsigned int refill_fl(struct adapter *adapter, 
struct sge_fl *fl,
 */
BUG_ON(fl-avail + n  fl-size - FL_PER_EQ_UNIT);
 
+   gfp |= __GFP_NOWARN;
+
/*
 * If we support large pages, prefer large buffers and fail over to
 * small pages if we can't allocate large pages to satisfy the refill.
@@ -612,8 +614,7 @@ static unsigned int refill_fl(struct adapter *adapter, 
struct sge_fl *fl,
goto alloc_small_pages;
 
while (n) {
-   page = alloc_pages(gfp | __GFP_COMP | __GFP_NOWARN,
-  FL_PG_ORDER);
+   page = __netdev_alloc_pages(gfp, FL_PG_ORDER);
if (unlikely(!page)) {
/*
 * We've failed inour attempt to allocate a large
@@ -657,7 +658,7 @@ static unsigned int refill_fl(struct adapter *adapter, 
struct sge_fl *fl,
 
 alloc_small_pages:
while (n--) {
-   page = __skb_alloc_page(gfp | __GFP_NOWARN, NULL);
+   page = __netdev_alloc_page(gfp);
if (unlikely(!page)) {
fl-alloc_failed++;
break;

--
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: musb: replace hard coded registers with defines

2014-11-10 Thread Roman Byshko
musb registers can be dumped using the file regdump
which is created in debugfs. Up to now  hard coded
register addresses are used for that. Different glue
layers however have different register addresses. The
patch addresses this issue by substituting bare register
addresses with defines.

Signed-off-by: Roman Byshko rbys...@gmail.com
---
 drivers/usb/musb/musb_debugfs.c | 57 ++---
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c
index 4c21679..ad3701a 100644
--- a/drivers/usb/musb/musb_debugfs.c
+++ b/drivers/usb/musb/musb_debugfs.c
@@ -49,33 +49,36 @@ struct musb_register_map {
 };
 
 static const struct musb_register_map musb_regmap[] = {
-   { FAddr,  0x00,   8 },
-   { Power,  0x01,   8 },
-   { Frame,  0x0c,   16 },
-   { Index,  0x0e,   8 },
-   { Testmode,   0x0f,   8 },
-   { TxMaxPp,0x10,   16 },
-   { TxCSRp, 0x12,   16 },
-   { RxMaxPp,0x14,   16 },
-   { RxCSR,  0x16,   16 },
-   { RxCount,0x18,   16 },
-   { ConfigData, 0x1f,   8 },
-   { DevCtl, 0x60,   8 },
-   { MISC,   0x61,   8 },
-   { TxFIFOsz,   0x62,   8 },
-   { RxFIFOsz,   0x63,   8 },
-   { TxFIFOadd,  0x64,   16 },
-   { RxFIFOadd,  0x66,   16 },
-   { VControl,   0x68,   32 },
-   { HWVers, 0x6C,   16 },
-   { EPInfo, 0x78,   8 },
-   { RAMInfo,0x79,   8 },
-   { LinkInfo,   0x7A,   8 },
-   { VPLen,  0x7B,   8 },
-   { HS_EOF1,0x7C,   8 },
-   { FS_EOF1,0x7D,   8 },
-   { LS_EOF1,0x7E,   8 },
-   { SOFT_RST,   0x7F,   8 },
+   { FAddr,  MUSB_FADDR, 8 },
+   { Power,  MUSB_POWER, 8 },
+   { Frame,  MUSB_FRAME, 16 },
+   { Index,  MUSB_INDEX, 8 },
+   { Testmode,   MUSB_TESTMODE,  8 },
+   { TxMaxPp,MUSB_TXMAXP,16 },
+   { TxCSRp, MUSB_TXCSR, 16 },
+   { RxMaxPp,MUSB_RXMAXP,16 },
+   { RxCSR,  MUSB_RXCSR, 16 },
+   { RxCount,MUSB_RXCOUNT,   16 },
+   { ConfigData, MUSB_CONFIGDATA,8 },
+   { IntrRxE,MUSB_INTRRXE,   16 },
+   { IntrTxE,MUSB_INTRTXE,   16 },
+   { IntrUsbE,   MUSB_INTRUSBE,  8 },
+   { DevCtl, MUSB_DEVCTL,8 },
+   { BabbleCtl,  MUSB_BABBLE_CTL,8 },
+   { TxFIFOsz,   MUSB_TXFIFOSZ,  8 },
+   { RxFIFOsz,   MUSB_RXFIFOSZ,  8 },
+   { TxFIFOadd,  MUSB_TXFIFOADD, 16 },
+   { RxFIFOadd,  MUSB_RXFIFOADD, 16 },
+   { VControl,   0x68,   32 },
+   { HWVers, 0x69,   16 },
+   { EPInfo, MUSB_EPINFO,8 },
+   { RAMInfo,MUSB_RAMINFO,   8 },
+   { LinkInfo,   MUSB_LINKINFO,  8 },
+   { VPLen,  MUSB_VPLEN, 8 },
+   { HS_EOF1,MUSB_HS_EOF1,   8 },
+   { FS_EOF1,MUSB_FS_EOF1,   8 },
+   { LS_EOF1,MUSB_LS_EOF1,   8 },
+   { SOFT_RST,   0x7F,   8 },
{ DMA_CNTLch0,0x204,  16 },
{ DMA_ADDRch0,0x208,  32 },
{ DMA_COUNTch0,   0x20C,  32 },
-- 
2.1.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 2/2] arm: boot: dts: am4372: enable dwc3 suspend PHY quirk

2014-11-10 Thread Tony Lindgren
* Felipe Balbi ba...@ti.com [141106 09:40]:
 Whenever Suspend PHY bit is set on AM437x devices,
 USB will not work due to Set EP Configuration command
 always failing.
 
 This was only found after a recent commit 2164a47 (usb:
 dwc3: set SUSPHY bit for all cores, which will be merged
 for v3.19) added a missing *required* step to dwc3
 initialization. Synopsys Databook requires that we enable
 Suspend PHY bit after initialization but that, unfortunately,
 breaks AM437x.
 
 Signed-off-by: Felipe Balbi ba...@ti.com

This should be safe to queue along with the related USB
changes:

Acked-by: Tony Lindgren t...@atomide.com

 ---
  arch/arm/boot/dts/am4372.dtsi | 4 
  1 file changed, 4 insertions(+)
 
 diff --git a/arch/arm/boot/dts/am4372.dtsi b/arch/arm/boot/dts/am4372.dtsi
 index 46660ff..e19068d 100644
 --- a/arch/arm/boot/dts/am4372.dtsi
 +++ b/arch/arm/boot/dts/am4372.dtsi
 @@ -817,6 +817,8 @@
   maximum-speed = high-speed;
   dr_mode = otg;
   status = disabled;
 + snps,dis_u3_susphy_quirk;
 + snps,dis_u2_susphy_quirk;
   };
   };
  
 @@ -839,6 +841,8 @@
   maximum-speed = high-speed;
   dr_mode = otg;
   status = disabled;
 + snps,dis_u3_susphy_quirk;
 + snps,dis_u2_susphy_quirk;
   };
   };
  
 -- 
 2.1.0.GIT
 
 
 ___
 linux-arm-kernel mailing list
 linux-arm-ker...@lists.infradead.org
 http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
 
--
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: [net-next PATCH 1/5] net: Add netdev Rx page allocation function

2014-11-10 Thread Cong Wang
On Mon, Nov 10, 2014 at 11:51 AM, Alexander Duyck
alexander.h.du...@redhat.com wrote:
 This patch implements __netdev_alloc_pages and __netdev_alloc_page.  These
 are meant to replace the __skb_alloc_pages and __skb_alloc_page functions.
 The reason for doing this is that it occurred to me that __skb_alloc_page is
 supposed to be passed an sk_buff pointer, but it is NULL in all cases where
 it is used.  Worse is that in the case of ixgbe it is passed NULL via the
 sk_buff pointer in the rx_buffer info structure which means the compiler is
 not correctly stripping it out.

These netdev_*() have nothing related with struct net_device, please
find a better prefix. Also, they are in skbuff.h, you perhaps want to move them
to netdevice.h.
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH -next 1/2] seq_puts: Convert to return void and convert uses too.

2014-11-10 Thread Mark Brown
On Mon, Nov 10, 2014 at 10:58:56AM -0800, Joe Perches wrote:
 Using the return value of seq_puts is error-prone, so
 make it return void instead.

Acked-by: Mark Brown broo...@kernel.org


signature.asc
Description: Digital signature


Re: [net-next PATCH 1/5] net: Add netdev Rx page allocation function

2014-11-10 Thread Alexander Duyck


On 11/10/2014 04:26 PM, Cong Wang wrote:

On Mon, Nov 10, 2014 at 11:51 AM, Alexander Duyck
alexander.h.du...@redhat.com wrote:

This patch implements __netdev_alloc_pages and __netdev_alloc_page.  These
are meant to replace the __skb_alloc_pages and __skb_alloc_page functions.
The reason for doing this is that it occurred to me that __skb_alloc_page is
supposed to be passed an sk_buff pointer, but it is NULL in all cases where
it is used.  Worse is that in the case of ixgbe it is passed NULL via the
sk_buff pointer in the rx_buffer info structure which means the compiler is
not correctly stripping it out.

These netdev_*() have nothing related with struct net_device, please
find a better prefix. Also, they are in skbuff.h, you perhaps want to move them
to netdevice.h.


The netdev_ prefix is really meant indicate where they are supposed to 
be used, not so much the arguments being passed, and the fact that 
historically this is what we had back in the kernel a couple years ago.  
I suppose I could rename them to __dev_alloc_page(s) and 
dev_alloc_page(s) since that seems to be the precedent for how this is 
handled for skb's.  I'll submit something tomorrow if there aren't any 
other name requests.


I would prefer to keep them in skbuff.h since this is buffer allocation 
that will later be handed off via either build_skb or skb_add_rx_frag to 
an sk_buff.


Thanks,

Alex


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


[V2 PATCH 04/10] added media agnostic (MA) USB packet handling

2014-11-10 Thread Stephanie Wallick
This is where we handle MA USB packets. The structure and types of MA USB
packets are defined in the MA USB specification. When an MA USB driver
receives a USB packet, it translates it into a MA USB packet (or packets
if urb exceeds maximum USB packet size). When an MA USB packet is received,
the data from that packet is given to the waiting USB packet and the USB
packet is released.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_pkt.c | 1038 +
 drivers/staging/mausb/drivers/mausb_pkt.h |  914 +
 2 files changed, 1952 insertions(+)
 create mode 100644 drivers/staging/mausb/drivers/mausb_pkt.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_pkt.h

diff --git a/drivers/staging/mausb/drivers/mausb_pkt.c 
b/drivers/staging/mausb/drivers/mausb_pkt.c
new file mode 100644
index 000..c78cfc2
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_pkt.c
@@ -0,0 +1,1038 @@
+/* name:   mausb_pkt.c
+ * description: MA USB packet helper functions
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include linux/slab.h
+#include linux/usb/ch9.h
+#include linux/usb.h
+
+#include mausb_mem.h
+#include mausb_pkt.h
+#include mausb_const.h
+
+/**
+ * Translates numerical packet type into corresponding string (for printing).
+ */
+const char *mausb_type_to_string(enum mausb_pkt_type type)
+{
+   switch (type) {
+   case CapReq:
+   return CapReq;
+   case CapResp:
+   return CapResp;
+   case USBDevHandleReq:
+   return USBDevHandleReq;
+   case USBDevHandleResp:
+   return USBDevHandleResp;
+   case EPHandleReq:
+   return EPHandleReq;
+   case EPHandleResp:
+   return EPHandleResp;
+   case EPActivateReq:
+   return EPActivateReq;
+   case EPActivateResp:
+   return EPActivateResp;
+   case EPInactivateReq:
+   return EPInactivateReq;
+   case EPInactivateResp:
+   return EPInactivateResp;
+   case EPResetReq:
+   return EPResetReq;
+   case EPResetResp:
+   return EPResetResp;
+   case EPClearTransferReq:
+   return EPClearTransferReq;
+   case EPClearTransferResp:
+   return EPClearTransferResp;
+   case EPHandleDeleteReq:
+   return EPHandleDeleteReq;
+   case EPHandleDeleteResp:
+   return EPHandleDeleteResp;
+   case 

[V2 PATCH 03/10] added media agnostic (MA) data structures and handling

2014-11-10 Thread Stephanie Wallick
This is where we create, store and handle endpoint and device structures
that are specific to the MA USB drivers. Each MA USB structure maps 1:1
with it's corresponding USB structure (e.g. there is one MA USB endpoint
per USB endpoint).

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_const.h| 109 
 drivers/staging/mausb/drivers/mausb_mem-host.c | 402 
 drivers/staging/mausb/drivers/mausb_mem-host.h |  74 +++
 drivers/staging/mausb/drivers/mausb_mem.c  | 842 +
 drivers/staging/mausb/drivers/mausb_mem.h  | 509 +++
 drivers/staging/mausb/drivers/mausb_state.h| 184 ++
 6 files changed, 2120 insertions(+)
 create mode 100755 drivers/staging/mausb/drivers/mausb_const.h
 create mode 100644 drivers/staging/mausb/drivers/mausb_mem-host.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_mem-host.h
 create mode 100644 drivers/staging/mausb/drivers/mausb_mem.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_mem.h
 create mode 100644 drivers/staging/mausb/drivers/mausb_state.h

diff --git a/drivers/staging/mausb/drivers/mausb_const.h 
b/drivers/staging/mausb/drivers/mausb_const.h
new file mode 100755
index 000..1089f81
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_const.h
@@ -0,0 +1,109 @@
+/* Name:   mausb_const.h
+ * Description: This header describes the Media Agnostic USB constants
+ *  that must be known by the both the host and device side 
drivers.
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __MAUSB_CONST_H
+#define __MAUSB_CONST_H
+
+/* MA USB protocol constants per Table 68 of the MA USB Spec */
+#define MAUSB_DATA_CHANNEL_DELAY   400 /* temp value */
+#define MAUSB_MGMT_CHANNEL_DELAY   ((100 * HZ)/1000 + 1)
+#define MAUSB_MGMT_RESPONSE_DELAY  ((5 * HZ)/1000 + 1) /* 5 msec */
+#define MAUSB_MGMT_RT_DELAY \
+   ((MAUSB_MGMT_RESPONSE_DELAY + (2 * MAUSB_MGMT_CHANNEL_DELAY)))
+#define MAUSB_TRANSFER_RESPONSE_TIME   10  /* 10 msec */
+#define MAUSB_TRANSFER_TIMEOUT \
+   (MAUSB_TRANSFER_RESPONSE_TIME + (2 * MAUSB_DATA_CHANNEL_DELAY))
+#define MAUSB_TRANSFER_KEEP_ALIVE \
+   (MAUSB_TRANSFER_RESPONSE_TIME + MAUSB_DATA_CHANNEL_DELAY)
+#define MAUSB_DEFAULT_KEEP_ALIVE0
+#define MAUSB_MAX_TRANSFER_LIFETIME 1000   /* 1 sec */
+#define MAUSB_TRANSFER_REPEAT_TIME  10 /* 10 msec */
+
+#define MAUSB_MAX_REQ_ID((1  8) - 1)
+#define MAUSB_MAX_SEQ_NUM   

[V2 PATCH 09/10] added tools for building/loading media agnostic (MA) USB drivers

2014-11-10 Thread Stephanie Wallick
Adds various scripts for building, loading and unloading the MA USB
drivers and a utility that can be used for connecting and disconnecting
the host and device drivers.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/mausb-util/AUTHORS   |   2 +
 drivers/staging/mausb/mausb-util/Android.mk|   3 +
 drivers/staging/mausb/mausb-util/ChangeLog |   0
 drivers/staging/mausb/mausb-util/INSTALL   |   0
 drivers/staging/mausb/mausb-util/LICENCE   |   0
 drivers/staging/mausb/mausb-util/Makefile  |  14 ++
 drivers/staging/mausb/mausb-util/README|  68 +++
 drivers/staging/mausb/mausb-util/config.mk |  17 ++
 drivers/staging/mausb/mausb-util/src/Android.mk|  13 ++
 drivers/staging/mausb/mausb-util/src/Makefile  |  18 ++
 drivers/staging/mausb/mausb-util/src/connect.c |  69 +++
 drivers/staging/mausb/mausb-util/src/connect.h |  22 +++
 drivers/staging/mausb/mausb-util/src/mausb.c   | 201 +
 drivers/staging/mausb/mausb-util/src/mausb.h   |  64 +++
 drivers/staging/mausb/mausb-util/src/mausb_ioctl.h |  24 +++
 drivers/staging/mausb/mausb-util/src/utils.c   |  94 ++
 drivers/staging/mausb/scripts/Android.mk   |  38 
 .../staging/mausb/scripts/build_load_connect.sh|  69 +++
 drivers/staging/mausb/scripts/load_gzero.sh|   5 +
 .../mausb/scripts/load_mausb_android-dev.sh|  31 
 .../mausb/scripts/load_mausb_android-host.sh   |  31 
 .../staging/mausb/scripts/load_mausb_android.sh|  33 
 drivers/staging/mausb/scripts/load_script.sh   | 125 +
 drivers/staging/mausb/scripts/modprobify.sh|  10 +
 drivers/staging/mausb/scripts/unload_gzero.sh  |   5 +
 25 files changed, 956 insertions(+)
 create mode 100644 drivers/staging/mausb/mausb-util/AUTHORS
 create mode 100644 drivers/staging/mausb/mausb-util/Android.mk
 create mode 100644 drivers/staging/mausb/mausb-util/ChangeLog
 create mode 100644 drivers/staging/mausb/mausb-util/INSTALL
 create mode 100644 drivers/staging/mausb/mausb-util/LICENCE
 create mode 100644 drivers/staging/mausb/mausb-util/Makefile
 create mode 100644 drivers/staging/mausb/mausb-util/README
 create mode 100644 drivers/staging/mausb/mausb-util/config.mk
 create mode 100644 drivers/staging/mausb/mausb-util/src/Android.mk
 create mode 100644 drivers/staging/mausb/mausb-util/src/Makefile
 create mode 100644 drivers/staging/mausb/mausb-util/src/connect.c
 create mode 100644 drivers/staging/mausb/mausb-util/src/connect.h
 create mode 100644 drivers/staging/mausb/mausb-util/src/mausb.c
 create mode 100644 drivers/staging/mausb/mausb-util/src/mausb.h
 create mode 100644 drivers/staging/mausb/mausb-util/src/mausb_ioctl.h
 create mode 100644 drivers/staging/mausb/mausb-util/src/utils.c
 create mode 100644 drivers/staging/mausb/scripts/Android.mk
 create mode 100755 drivers/staging/mausb/scripts/build_load_connect.sh
 create mode 100755 drivers/staging/mausb/scripts/load_gzero.sh
 create mode 100755 drivers/staging/mausb/scripts/load_mausb_android-dev.sh
 create mode 100755 drivers/staging/mausb/scripts/load_mausb_android-host.sh
 create mode 100755 drivers/staging/mausb/scripts/load_mausb_android.sh
 create mode 100755 drivers/staging/mausb/scripts/load_script.sh
 create mode 100755 drivers/staging/mausb/scripts/modprobify.sh
 create mode 100755 drivers/staging/mausb/scripts/unload_gzero.sh

diff --git a/drivers/staging/mausb/mausb-util/AUTHORS 
b/drivers/staging/mausb/mausb-util/AUTHORS
new file mode 100644
index 000..6312e6a
--- /dev/null
+++ b/drivers/staging/mausb/mausb-util/AUTHORS
@@ -0,0 +1,2 @@
+Sean O. Stalley sean.stal...@intel.com
+Aymen Zayet aymen.za...@intel.com
diff --git a/drivers/staging/mausb/mausb-util/Android.mk 
b/drivers/staging/mausb/mausb-util/Android.mk
new file mode 100644
index 000..c455f97
--- /dev/null
+++ b/drivers/staging/mausb/mausb-util/Android.mk
@@ -0,0 +1,3 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(call all-subdir-makefiles)
diff --git a/drivers/staging/mausb/mausb-util/ChangeLog 
b/drivers/staging/mausb/mausb-util/ChangeLog
new file mode 100644
index 000..e69de29
diff --git a/drivers/staging/mausb/mausb-util/INSTALL 
b/drivers/staging/mausb/mausb-util/INSTALL
new file mode 100644
index 000..e69de29
diff --git a/drivers/staging/mausb/mausb-util/LICENCE 
b/drivers/staging/mausb/mausb-util/LICENCE
new file mode 100644
index 000..e69de29
diff --git a/drivers/staging/mausb/mausb-util/Makefile 
b/drivers/staging/mausb/mausb-util/Makefile
new file mode 100644
index 000..abd5fe0
--- /dev/null
+++ b/drivers/staging/mausb/mausb-util/Makefile
@@ -0,0 +1,14 @@
+include config.mk
+
+.PHONY: $(BINARY_NAME) all clean
+
+all: $(BINARY_NAME)
+
+$(BINARY_NAME):
+   $(MAKE) -C src/
+   cp -rf src/$(BINARY_NAME) .
+
+
+clean:
+   $(MAKE) -C src/ clean

[V2 PATCH 10/10] added kernel build, configuration, and TODO files

2014-11-10 Thread Stephanie Wallick
Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 MAINTAINERS|  7 +++
 drivers/staging/Kconfig|  2 ++
 drivers/staging/Makefile   |  1 +
 drivers/staging/mausb/Kconfig  | 16 
 drivers/staging/mausb/Makefile |  2 ++
 drivers/staging/mausb/TODO |  5 +
 drivers/staging/mausb/drivers/Kconfig  | 34 ++
 drivers/staging/mausb/drivers/Makefile | 18 ++
 8 files changed, 85 insertions(+)
 create mode 100644 drivers/staging/mausb/Kconfig
 create mode 100644 drivers/staging/mausb/Makefile
 create mode 100644 drivers/staging/mausb/TODO
 create mode 100644 drivers/staging/mausb/drivers/Kconfig
 create mode 100644 drivers/staging/mausb/drivers/Makefile

diff --git a/MAINTAINERS b/MAINTAINERS
index c3cfa1b..bd52ec2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8721,6 +8721,13 @@ W:   http://www.lirc.org/
 S: Odd Fixes
 F: drivers/staging/media/lirc/
 
+STAGING - MEDIA AGNOSTIC USB DRIVERS
+M: Sean O. Stalley sean.stal...@intel.com
+M: Stephanie Wallick stephanie.s.wall...@intel.com
+L: linux-usb@vger.kernel.org
+S: Maintained
+F: drivers/staging/mausb
+
 STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec)
 M: Julian Andres Klode j...@jak-linux.org
 M: Marc Dietrich marvi...@gmx.de
diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 35b494f..f57621b 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -24,6 +24,8 @@ menuconfig STAGING
 
 if STAGING
 
+source drivers/staging/mausb/Kconfig
+
 source drivers/staging/et131x/Kconfig
 
 source drivers/staging/slicoss/Kconfig
diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
index e66a5db..7615c85 100644
--- a/drivers/staging/Makefile
+++ b/drivers/staging/Makefile
@@ -51,3 +51,4 @@ obj-$(CONFIG_GS_FPGABOOT) += gs_fpgaboot/
 obj-$(CONFIG_BT_NOKIA_H4P) += nokia_h4p/
 obj-$(CONFIG_CRYPTO_SKEIN) += skein/
 obj-$(CONFIG_UNISYSSPAR)   += unisys/
+obj-$(CONFIG_MAUSB)+= mausb/
diff --git a/drivers/staging/mausb/Kconfig b/drivers/staging/mausb/Kconfig
new file mode 100644
index 000..095c08b
--- /dev/null
+++ b/drivers/staging/mausb/Kconfig
@@ -0,0 +1,16 @@
+
+menuconfig MAUSB
+   bool MA USB drivers
+   depends on USB
+   ---help---
+ This option allows you to select from the various MA USB
+ drivers. Note that a media-specific driver (e.g. tcp or SNAP)
+ is needed in addition to the media agnostic host or device driver.
+
+
+if MAUSB
+
+source drivers/staging/mausb/drivers/Kconfig
+
+endif
+
diff --git a/drivers/staging/mausb/Makefile b/drivers/staging/mausb/Makefile
new file mode 100644
index 000..fc09fb5
--- /dev/null
+++ b/drivers/staging/mausb/Makefile
@@ -0,0 +1,2 @@
+obj-y += drivers/
+
diff --git a/drivers/staging/mausb/TODO b/drivers/staging/mausb/TODO
new file mode 100644
index 000..710ee936
--- /dev/null
+++ b/drivers/staging/mausb/TODO
@@ -0,0 +1,5 @@
+TODO:
+   - checkpatch.pl cleanups
+   - address miscellaneous TODO statements in code
+   - add support for multiple media agnostic (MA) devices
+   - add/improve support for unimplemented packet types
diff --git a/drivers/staging/mausb/drivers/Kconfig 
b/drivers/staging/mausb/drivers/Kconfig
new file mode 100644
index 000..9e12e22
--- /dev/null
+++ b/drivers/staging/mausb/drivers/Kconfig
@@ -0,0 +1,34 @@
+config MA_CORE
+   tristate MA USB core
+   ---help---
+ This builds ma_core module.
+
+config MAUSB_HOST
+   tristate MA USB host
+   depends on MA_CORE
+   ---help---
+ This builds MA USB host driver module.
+
+config MAUSB_DEVICE
+   tristate MA USB device
+   depends on MA_CORE  USB_GADGET
+   ---help---
+ This builds MA USB device driver module.
+
+config MATCP_CORE
+   tristate MA USB tcp core
+   ---help---
+ This builds tcp_core module.
+
+config MATCP_HOST
+   tristate MA USB host tcp
+   depends on MATCP_CORE
+   ---help---
+ This builds tcp_host module.
+
+config MATCP_DEVICE
+   tristate MA USB device tcp
+   depends on MATCP_CORE
+   ---help---
+ This builds tcp_dev module.
+
diff --git a/drivers/staging/mausb/drivers/Makefile 
b/drivers/staging/mausb/drivers/Makefile
new file mode 100644
index 000..47f3222
--- /dev/null
+++ b/drivers/staging/mausb/drivers/Makefile
@@ -0,0 +1,18 @@
+obj-$(CONFIG_MA_CORE) += ma_core.o
+ma_core-y := mausb_pkt.o mausb_tx.o mausb_msapi.o mausb_mem.o mausb_mgmt.o
+
+obj-$(CONFIG_MAUSB_HOST) += mausb.o
+mausb-y := mausb_hcd.o mausb_hub.o mausb_tx-host.o mausb_mem-host.o
+
+obj-$(CONFIG_MAUSB_DEVICE) += maudc.o
+maudc-y := mausb_udc.o mausb_tx-device.o
+
+obj-$(CONFIG_MATCP_HOST) += matcp_host.o
+matcp_host-y := mausb_tcp-host.o
+

[V2 PATCH 08/10] added media agnostic (MA) USB data packet handling

2014-11-10 Thread Stephanie Wallick
The MA USB Specification outlines packet types and a protocol for
bulk and interrupt transfers. This is where we implement that protocol.
MA USB transfers are initiated by the host via a TransferRequest packet.
The host then either sends data to the device via subsequent
TransferRequest packets (OUT transfer) or receives data from the device
via TransferResponse packets (IN transfer). Each data transfer is
identified by a Request ID number that increments up for each new transfer.
One URB maps to one MA USB transfer. A transfer can consist of one or
more MA USB packets depending on total transfer size. Each MA USB packet
is assigned a Sequence Number with sequence numbers incrementing up for
each new packet. The host sends a TransferAck packet to acknowledge the
end of a transfer or when requested to do so by the device.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_tx-device.c |  845 
 drivers/staging/mausb/drivers/mausb_tx-host.c   | 1209 +++
 drivers/staging/mausb/drivers/mausb_tx.c|  316 ++
 drivers/staging/mausb/drivers/mausb_tx.h|  127 +++
 4 files changed, 2497 insertions(+)
 create mode 100644 drivers/staging/mausb/drivers/mausb_tx-device.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_tx-host.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_tx.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_tx.h

diff --git a/drivers/staging/mausb/drivers/mausb_tx-device.c 
b/drivers/staging/mausb/drivers/mausb_tx-device.c
new file mode 100644
index 000..7d1cab2
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_tx-device.c
@@ -0,0 +1,845 @@
+/* Name:mausb_tx_device.c
+ * Description: implements MA USB transfers on device side
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+   * Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include mausb_hcd.h
+#include mausb_udc.h
+#include mausb_pkt.h
+#include mausb_tx.h
+
+#include linux/kthread.h
+
+int device_transfer_timeout(void *data)
+{
+   struct mausb_host_ep*ep = (struct mausb_host_ep *) data;
+   struct mausb_udc*udc = mausb_host_ep_to_maudc(ep);
+
+   while (!kthread_should_stop()) {
+   /*
+* make sure actual transfer timeout (i.e. not thread
+* setup)
+*/
+   if (ep-tx_timed_out) {
+   if (ep-state.retry_counter  0) {
+   maudc_dbg(udc, %s: device timed out,
+ 

[V2 PATCH 07/10] added media agnostic (MA) USB management packet handling

2014-11-10 Thread Stephanie Wallick
The Media Agnostic USB Specification outlines a number of managment
packet types for management and control functions. Each function is
initiated with a particular type of managment request packet and
completed with the corresponding management response packet. This
is where we fill the fields for outgoing management packets and parse
and handle incoming management packets.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_mgmt.c | 888 +
 drivers/staging/mausb/drivers/mausb_mgmt.h |  88 +++
 2 files changed, 976 insertions(+)
 create mode 100755 drivers/staging/mausb/drivers/mausb_mgmt.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_mgmt.h

diff --git a/drivers/staging/mausb/drivers/mausb_mgmt.c 
b/drivers/staging/mausb/drivers/mausb_mgmt.c
new file mode 100755
index 000..7301ae3
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_mgmt.c
@@ -0,0 +1,888 @@
+/* name:   mausb_mgmt.c
+ * description: Handles management packet operations common to both
+ *  hosts and devices. This includes parsing incoming packets,
+ *  as well as creating outgoing packets.
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include linux/usb.h
+#include linux/slab.h
+
+#include mausb_pkt.h
+#include mausb_mgmt.h
+#include mausb_mem.h
+#include mausb_msapi.h
+#include mausb_const.h
+
+/**
+ * Returns the ma_dev structure for a given device.
+ */
+struct ma_dev *mausb_mgmt_to_ma_dev(struct mausb_mgmt *mgmt)
+{
+   return container_of(mgmt, struct ma_dev, mgmt);
+}
+EXPORT_SYMBOL(mausb_mgmt_to_ma_dev);
+
+/**
+ * Opens a connection to the Media Specific driver to pass management packets
+ * to a particular MA device.
+ *
+ * The caller should be holding the lock protecting the MA device's data.
+ *
+ * Returns 0 on success, or a negative errno on failure.
+ *
+ * @mgmt:  The struct for the management channel to the MA device.
+ * after this function
+ * @drv:   The specific medium we are communicating with
+ * @transfer_pkt:  A pointer to the function that should be called by the
+ * MS driver to pass incoming management packets to the
+ * MA driver.
+ * @pkt_sent:  Completion callback for outgoing management packets.
+ * This function will be called by the MS driver once a
+ * packet has been sent to the medium to indicate that
+ * it 

[V2 PATCH 05/10] added media specific (MS) TCP drivers

2014-11-10 Thread Stephanie Wallick
This is where we handle media specific packets and transport. The MS driver
interfaces with a media agnostic (MA) driver via a series of transfer pairs.
Transfer pairs consist of a set of functions to pass MA USB packets back
and forth between MA and MS drivers. There is one transfer pair per device
endpoint and one transfer pair for control/management traffic. When the MA
driver needs to send an MA USB packet, it hands the packet off to the MS
layer where the packet is converted into an MS form and sent via TCP over
the underlying ethernet or wireless medium. When the MS driver receives a
packet, it converts it into an MA USB packet and hands it off the the MA
driver for handling.

In addition, the MS driver provides an interface to inititate connection events.
Because there are no physical MA USB ports in an MA USB host, the host must be
notified via software when a device is connected.

Lastly, the MS driver contains a number of ioctl functions that are used by a
utility to adjust medium-related driver parameters and connect or disconnect the
MA USB host and device drivers.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_ioctl.c  | 256 +
 drivers/staging/mausb/drivers/mausb_ioctl.h  | 101 ++
 drivers/staging/mausb/drivers/mausb_msapi.c  | 108 ++
 drivers/staging/mausb/drivers/mausb_msapi.h  | 232 
 drivers/staging/mausb/drivers/mausb_tcp-device.c | 147 
 drivers/staging/mausb/drivers/mausb_tcp-host.c   | 142 
 drivers/staging/mausb/drivers/mausb_tcp.c| 435 +++
 drivers/staging/mausb/drivers/mausb_tcp.h| 129 +++
 8 files changed, 1550 insertions(+)
 create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_ioctl.h
 create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_msapi.h
 create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-device.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_tcp-host.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_tcp.h

diff --git a/drivers/staging/mausb/drivers/mausb_ioctl.c 
b/drivers/staging/mausb/drivers/mausb_ioctl.c
new file mode 100644
index 000..07d2425
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_ioctl.c
@@ -0,0 +1,256 @@
+/* Name: mausb_ioctl.c
+ * Description:  ioctl functions for MA USB media specific driver
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 

[V2 PATCH 06/10] added media agnostic (MA) UDC

2014-11-10 Thread Stephanie Wallick
This is where we implement the behavior of a USB device controller for
the MA USB device-side driver. The MA UDC interfaces with a gadget driver
and appears to the driver as a regular UDC. However, instead of sending
USB packets over a wired USB bus, the MA UDC hands MA USB packets off to
a media specific layer for transport.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_udc.c | 1486 +
 drivers/staging/mausb/drivers/mausb_udc.h |  147 +++
 2 files changed, 1633 insertions(+)
 create mode 100644 drivers/staging/mausb/drivers/mausb_udc.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_udc.h

diff --git a/drivers/staging/mausb/drivers/mausb_udc.c 
b/drivers/staging/mausb/drivers/mausb_udc.c
new file mode 100644
index 000..af00786
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_udc.c
@@ -0,0 +1,1486 @@
+/* name:   mausb_udc.c
+ * description: Implements a USB device controller(UDC) for interfacing with
+ * gadget drivers. The gadget driver uses this interface to return
+ * descriptors and to implement configuration and data transfer
+ * protocols with the pHCD. The UDC also allocates and initializes
+ * endpoints to support gadget/pHCD interfacing.
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.o.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+#include linux/platform_device.h
+#include linux/usb/ch11.h
+#include linux/usb/gadget.h
+#include linux/device.h
+#include linux/usb/composite.h
+#include linux/spinlock.h
+
+#include mausb_udc.h
+#include mausb_mgmt.h
+#include mausb_mem.h
+#include mausb_msapi.h
+#include mausb_tx.h
+
+static const char   ep0[] = ep0;
+static const char *const ep_name[] = {ep0, ep1, ep2};
+
+static struct platform_device udc_pdev;
+
+void udc_dev_release(struct device *dev)
+{
+   /* free any dynamically allocated structures here */
+}
+
+static inline struct mausb_udc *gadget_to_udc(struct usb_gadget *gadget)
+{
+   return container_of(gadget, struct mausb_udc, gadget);
+}
+
+static inline struct mausb_udc *gadget_dev_to_mausb_udc(struct device *dev)
+{
+   return container_of(dev, struct mausb_udc, gadget.dev);
+}
+
+static inline struct mausb_request *usb_req_to_mausb_req(
+   struct usb_request *req)
+{
+   return container_of(req, struct mausb_request, req);
+}
+
+static inline struct mausb_udc *mausb_ma_dev_to_udc(struct ma_dev 

[V2 PATCH 02/10] added media agnostic (MA) USB HCD roothubs

2014-11-10 Thread Stephanie Wallick
This is where we implement USB 2.0 and 3.0 roothubs. From the host's
perspective, hub state is set and tracked just like any other USB roothub.
Likewise, requests to the roothub appear to be handled like any other wired
USB request.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_hub.c | 849 ++
 drivers/staging/mausb/drivers/mausb_hub.h | 128 +
 2 files changed, 977 insertions(+)
 create mode 100644 drivers/staging/mausb/drivers/mausb_hub.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_hub.h

diff --git a/drivers/staging/mausb/drivers/mausb_hub.c 
b/drivers/staging/mausb/drivers/mausb_hub.c
new file mode 100644
index 000..63c0fe4
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_hub.c
@@ -0,0 +1,849 @@
+/* Name: mausb_hub.c
+ * Description:  mausb hub structures and functions
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+#include linux/platform_device.h
+#include linux/usb/ch11.h
+#include linux/usb/ch9.h
+
+#include mausb_hub.h
+#include mausb_hcd.h
+
+/**
+ * Returns MA USB roothub data structure for a USB HCD.
+ */
+struct mausb_root_hub *usb_hcd_to_roothub(struct usb_hcd *hcd)
+{
+   struct mausb_hcd *mhcd = usb_hcd_to_mausb_hcd(hcd);
+
+   if (usb_hcd_is_primary_hcd(hcd))
+   return mhcd-root_hub;
+   else
+   return mhcd-shared_root_hub;
+}
+
+/**
+ * Returns true if the given is the superspeed HCD. Note: The primary HCD is
+ * High Speed and the shared HCD is SuperSpeed.
+ */
+bool mausb_is_ss_hcd(struct usb_hcd *hcd)
+{
+   if (usb_hcd_is_primary_hcd(hcd))
+   return false;
+   else
+   return true;
+}
+
+/**
+ * Sets downstream port link state.
+ *
+ * @mhcd:  MA USB hcd that owns port.
+ * @state: Link state to be set (see USB 3.0 spec for link state values).
+ * @portnum:   Port number of link state to be set.
+ */
+void set_link_state(struct mausb_root_hub *roothub, int state, int portnum)
+{
+   struct usb_port_status   *port_stat;
+
+   port_stat = roothub-port_status[portnum];
+
+   port_stat-wPortStatus = LINK_STATE_MASK;
+   port_stat-wPortStatus |= state;
+}
+
+/**
+ * Generates connect or disconnect event for a roothub.
+ *
+ * @hcd:   HCD associated with roothub.
+ * @do_connect: 1 for connect, 0 for disconnect.
+ * @_portnum:  Port number of connected 

[V2 PATCH 01/10] added media agnostic (MA) USB HCD driver

2014-11-10 Thread Stephanie Wallick
This is where we interface with the existing USB stack and implement the
functionality of a USB host controller driver. From the host's perspective,
we appear as just another USB host controller. However, instead of passing
traffic along a wired USB bus, the driver hands USB packets off for transport
per Media Agnostic USB protocol.

Signed-off-by: Sean O. Stalley sean.stal...@intel.com
Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com
---
 drivers/staging/mausb/drivers/mausb_hcd.c | 981 ++
 drivers/staging/mausb/drivers/mausb_hcd.h | 184 ++
 2 files changed, 1165 insertions(+)
 create mode 100755 drivers/staging/mausb/drivers/mausb_hcd.c
 create mode 100644 drivers/staging/mausb/drivers/mausb_hcd.h

diff --git a/drivers/staging/mausb/drivers/mausb_hcd.c 
b/drivers/staging/mausb/drivers/mausb_hcd.c
new file mode 100755
index 000..b35a62b
--- /dev/null
+++ b/drivers/staging/mausb/drivers/mausb_hcd.c
@@ -0,0 +1,981 @@
+/* Name:   mausb_hcd.c
+ * Description: Creates and initializes a virtual USB host controller driver
+ * for the Media Agnostic USB host driver.
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * 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.
+ *
+ * Contact Information:
+ * Sean Stalley, sean.stal...@intel.com
+ * Stephanie Wallick, stephanie.s.wall...@intel.com
+ * 2111 NE 25th Avenue
+ * Hillsboro, Oregon 97124
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+* Redistributions of source code must retain the above copyright
+  notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+  notice, this list of conditions and the following disclaimer in
+  the documentation and/or other materials provided with the
+  distribution.
+* Neither the name of Intel Corporation nor the names of its
+  contributors may be used to endorse or promote products derived
+  from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include linux/init.h
+#include linux/wait.h
+#include linux/module.h
+#include linux/usb.h
+#include linux/usb/hcd.h
+#include linux/usb/ch11.h
+#include linux/pm_runtime.h
+#include linux/usb/gadget.h
+#include linux/kthread.h
+#include linux/random.h
+
+#include mausb_hcd.h
+#include mausb_hub.h
+#include mausb_pkt.h
+#include mausb_mem-host.h
+#include mausb_msapi.h
+#include mausb_mgmt.h
+#include mausb_state.h
+#include mausb_tx.h
+
+static int mausb_bus_match(struct device *dev, struct device_driver *drv)
+{
+   if (strncmp(dev-bus-name, drv-name, strlen(drv-name)))
+   return 0;   /* no match */
+   else
+   return 1;   /* match */
+}
+
+static int mausb_bus_probe(struct device *dev)
+{
+   return mausb_probe(dev);
+}
+
+static int mausb_bus_remove(struct device *dev)
+{
+   return mausb_remove(dev);
+}
+
+static void mausb_dev_release(struct device *dev)
+{
+   /* TODO: if we dynamically allocate anything, free it here */
+}
+
+static struct class*mausb_class;
+
+static struct bus_type mausb_bus_type = {
+   .name   = MAUSB_NAME,
+   .match  = mausb_bus_match,
+   .probe  = mausb_bus_probe,
+   .remove = mausb_bus_remove,
+};
+
+static struct device_driver mhcd_driver = {
+   .name   = MAUSB_NAME,
+   .bus= mausb_bus_type,
+   .owner   

Re: [RFC v5] usb: phy: Hold wakeupsource when USB is enumerated in peripheral mode

2014-11-10 Thread Kiran Raparthy
Hi Felipe,

On 10 November 2014 20:56, Felipe Balbi ba...@ti.com wrote:
 Hi,

 On Tue, Nov 04, 2014 at 03:30:54PM +0530, Kiran Kumar Raparthy wrote:
 @@ -1469,6 +1484,7 @@ static int ab8500_usb_probe(struct platform_device 
 *pdev)

   abx500_usb_link_status_update(ab);

 + usb_phy_wsource_init(ab-phy);

 instead of adding this to all drivers, you can just it to
 usb_add_phy_dev() and conversely, to usb_remove_phy().
Definitely,Thanks for your input.
Regards,
Kiran

 --
 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: [V2 PATCH 01/10] added media agnostic (MA) USB HCD driver

2014-11-10 Thread Greg KH
On Mon, Nov 10, 2014 at 06:09:32PM -0800, Stephanie Wallick wrote:
 +static int mausb_bus_probe(struct device *dev)
 +{
 + return mausb_probe(dev);
 +}
 +
 +static int mausb_bus_remove(struct device *dev)
 +{
 + return mausb_remove(dev);
 +}

Wrapper functions that just call another function?  Why?

 +static void mausb_dev_release(struct device *dev)
 +{
 + /* TODO: if we dynamically allocate anything, free it here */
 +}

As per the documentation in the kernel source tree[1], I am now allowed
to mock you mercilessly for thinking that you know more than the kernel,
and are just providing an empty function just to shut it up from
complaining about no release function at all.  Did you stop to think
about _why_ the kernel was warning you about this, and how would an
empty function solve anything?

Sorry, I can never accept code that does this in the kernel, even in
staging, which says a lot...

thanks,

greg k-h

[1] Documentation/kobject.txt, line 270
--
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: [V2 PATCH 05/10] added media specific (MS) TCP drivers

2014-11-10 Thread Greg KH
On Mon, Nov 10, 2014 at 06:09:36PM -0800, Stephanie Wallick wrote:
 +static int ma_open;

Why do you need this variable?

 +/**
 + * This function is used to open the device file in order to read/write
 + * from/to it.
 + *
 + * @inode:   Struct with various information that is passed in when this
 + *   function is called. We don't need to use it for our purposes.
 + * @file:The file to be opened.
 + */
 +static int mausb_open(struct inode *inode, struct file *file)
 +{
 + if (ma_open)
 + return -EBUSY;
 + ma_open++;

Racy :(

 + try_module_get(THIS_MODULE);

Even more racy, _NEVER_ make this type of call, it's _ALWAYS_ wrong.

And totally not even needed at all, if you set up your file structure
properly.

 +
 + return 0;
 +}
 +
 +/**
 + * This function is used to close the device file.
 + *
 + * @inode:   Struct with various information that is passed in when this
 + *   function is called. We don't need to use it for our purposes.
 + * @file:The file to be closed.
 + */
 +static int mausb_release(struct inode *inode, struct file *file)
 +{
 + ma_open--;

Again, racy, and pointless, why are you doing this?

 + module_put(THIS_MODULE);

And again, broken and racy :(

 + return 0;
 +}
 +
 +
 +/**
 + * This function is used to execute ioctl commands, determined by ioctl_func.
 + *
 + * @file:  The device file. We don't use it directly, but it's passed in.
 + * @ioctl_func:This value determines which ioctl function will be 
 used.
 + * @ioctl_buffer: This buffer is used to transfer data to/from the device.
 + */
 +long mausb_ioctl(struct file *file, unsigned int ioctl_func,
 + unsigned long ioctl_buffer)
 +{
 + char message[BUFFER];
 + int ret, value;
 + unsigned long int long_value;
 + char __user *msg = (char *)ioctl_buffer;
 + char *response;
 +
 + switch (ioctl_func) {
 + case IOCTL_GET_VRSN:
 + ret = copy_to_user(msg, DRIVER_VERSION, strlen(DRIVER_VERSION));
 + break;

This should be a sysfs file.  Why even care about the version?


 + case IOCTL_GET_NAME:
 + ret = copy_to_user(msg, MAUSB_NAME, strlen(MAUSB_NAME));
 + break;

Why?

 + case IOCTL_GADGET_C:
 + ret = gadget_connection(1);
 + if (ret = 0)
 + response = MAUSB_GADGET_C_SUCCESS;
 + else
 + response = MAUSB_GADGET_C_FAIL;
 +
 + ret = copy_to_user(msg, response, strlen(response));
 + break;

Can't this be a sysfs file?

 + case IOCTL_GADGET_D:
 + ret = gadget_connection(0);
 + if (ret = 0)
 + response = MAUSB_GADGET_D_SUCCESS;
 + else
 + response = MAUSB_GADGET_D_FAIL;
 +
 + ret = copy_to_user(msg, response, strlen(response));
 + break;

Same here.


 + case IOCTL_SET_PORT:
 + ret = strncpy_from_user(message, msg, BUFFER);
 + if (ret  0)
 + break;
 + ret = kstrtoint(msg, 0, value);
 + if (ret != 0)
 + break;
 +
 + ret = set_port_no(value);
 + sprintf(message, PORT NUMBER:%d, Returned %i\n, value,
 + ret);

That looks like a debug message.

 + ret = copy_to_user(msg, message, strlen(message));
 + break;

That really looks like a sysfs file.


 + case IOCTL_SET_IP:
 + ret = strncpy_from_user(message, msg, BUFFER);
 + if (ret  0)
 + break;
 + ret = kstrtoul(message, 0, long_value);
 + if (ret != 0)
 + break;
 +
 + ret = set_ip_addr(long_value);
 + sprintf(message, IP ADDRESS:%lx, returned %i\n,
 + long_value, ret);

That looks like a debug message :(

 + ret = copy_to_user(msg, message, strlen(message));
 + break;

again sysfs file?


 + case IOCTL_SET_MAC:
 + {
 + u8 mac[6];
 + int i;
 + ret = copy_from_user(mac, msg, 6);
 + if (ret) {
 + pr_err(copy_from_user failed\n);
 + break;
 + }
 + for (i = 0; i  ETH_ALEN; i++)
 + pr_info(mac[%d]=0x%x\n, i, mac[i]);
 + ret = set_mac_addr(mac);
 + if (ret)
 + pr_err(unable to set MAC addr\n);
 +
 + break;
 + }

And again, sysfs file.

What about any other ioctl?  You forgot to return an invalid number.

 + }
 +
 + /* failure */
 + if (ret  0)
 + return ret;

You could have just returned a stack value here :(


 +
 + /* success */
 + return 0;

No need for the comments, this is a 

Re: [V2 PATCH 10/10] added kernel build, configuration, and TODO files

2014-11-10 Thread Greg KH
On Mon, Nov 10, 2014 at 06:09:41PM -0800, Stephanie Wallick wrote:
 Signed-off-by: Sean O. Stalley sean.stal...@intel.com
 Signed-off-by: Stephanie Wallick stephanie.s.wall...@intel.com

No changelog entry?


 ---
  MAINTAINERS|  7 +++
  drivers/staging/Kconfig|  2 ++
  drivers/staging/Makefile   |  1 +
  drivers/staging/mausb/Kconfig  | 16 
  drivers/staging/mausb/Makefile |  2 ++
  drivers/staging/mausb/TODO |  5 +
  drivers/staging/mausb/drivers/Kconfig  | 34 
 ++
  drivers/staging/mausb/drivers/Makefile | 18 ++
  8 files changed, 85 insertions(+)
  create mode 100644 drivers/staging/mausb/Kconfig
  create mode 100644 drivers/staging/mausb/Makefile
  create mode 100644 drivers/staging/mausb/TODO
  create mode 100644 drivers/staging/mausb/drivers/Kconfig
  create mode 100644 drivers/staging/mausb/drivers/Makefile
 
 diff --git a/MAINTAINERS b/MAINTAINERS
 index c3cfa1b..bd52ec2 100644
 --- a/MAINTAINERS
 +++ b/MAINTAINERS
 @@ -8721,6 +8721,13 @@ W: http://www.lirc.org/
  S:   Odd Fixes
  F:   drivers/staging/media/lirc/
  
 +STAGING - MEDIA AGNOSTIC USB DRIVERS
 +M:   Sean O. Stalley sean.stal...@intel.com
 +M:   Stephanie Wallick stephanie.s.wall...@intel.com
 +L:   linux-usb@vger.kernel.org
 +S:   Maintained
 +F:   drivers/staging/mausb
 +
  STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec)
  M:   Julian Andres Klode j...@jak-linux.org
  M:   Marc Dietrich marvi...@gmx.de
 diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
 index 35b494f..f57621b 100644
 --- a/drivers/staging/Kconfig
 +++ b/drivers/staging/Kconfig
 @@ -24,6 +24,8 @@ menuconfig STAGING
  
  if STAGING
  
 +source drivers/staging/mausb/Kconfig
 +
  source drivers/staging/et131x/Kconfig
  
  source drivers/staging/slicoss/Kconfig

Please put yourself at the end, not the top of this file.
 --- /dev/null
 +++ b/drivers/staging/mausb/TODO
 @@ -0,0 +1,5 @@
 +TODO:
 + - checkpatch.pl cleanups
 + - address miscellaneous TODO statements in code
 + - add support for multiple media agnostic (MA) devices
 + - add/improve support for unimplemented packet types

What about the other comments you already received such as:
- unify with usbip



 diff --git a/drivers/staging/mausb/drivers/Kconfig 
 b/drivers/staging/mausb/drivers/Kconfig
 new file mode 100644
 index 000..9e12e22
 --- /dev/null
 +++ b/drivers/staging/mausb/drivers/Kconfig
 @@ -0,0 +1,34 @@
 +config MA_CORE
 + tristate MA USB core
 + ---help---
 +   This builds ma_core module.
 +
 +config MAUSB_HOST
 + tristate MA USB host
 + depends on MA_CORE
 + ---help---
 +   This builds MA USB host driver module.
 +
 +config MAUSB_DEVICE
 + tristate MA USB device
 + depends on MA_CORE  USB_GADGET
 + ---help---
 +   This builds MA USB device driver module.
 +
 +config MATCP_CORE
 + tristate MA USB tcp core
 + ---help---
 +   This builds tcp_core module.
 +
 +config MATCP_HOST
 + tristate MA USB host tcp
 + depends on MATCP_CORE
 + ---help---
 +   This builds tcp_host module.
 +
 +config MATCP_DEVICE
 + tristate MA USB device tcp
 + depends on MATCP_CORE
 + ---help---
 +   This builds tcp_dev module.
 +
 diff --git a/drivers/staging/mausb/drivers/Makefile 
 b/drivers/staging/mausb/drivers/Makefile
 new file mode 100644
 index 000..47f3222
 --- /dev/null
 +++ b/drivers/staging/mausb/drivers/Makefile
 @@ -0,0 +1,18 @@
 +obj-$(CONFIG_MA_CORE) += ma_core.o
 +ma_core-y := mausb_pkt.o mausb_tx.o mausb_msapi.o mausb_mem.o mausb_mgmt.o
 +
 +obj-$(CONFIG_MAUSB_HOST) += mausb.o
 +mausb-y := mausb_hcd.o mausb_hub.o mausb_tx-host.o mausb_mem-host.o
 +
 +obj-$(CONFIG_MAUSB_DEVICE) += maudc.o
 +maudc-y := mausb_udc.o mausb_tx-device.o
 +
 +obj-$(CONFIG_MATCP_HOST) += matcp_host.o
 +matcp_host-y := mausb_tcp-host.o
 +
 +obj-$(CONFIG_MATCP_DEVICE) += matcp_dev.o
 +matcp_dev-y := mausb_tcp-device.o
 +
 +obj-$(CONFIG_MATCP_CORE) += matcp_core.o
 +matcp_core-y := mausb_tcp.o mausb_ioctl.o

Why so many different modules?  Can't you merge most of these together
as you can't do anything with just a few of them alone.

thanks,

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


Re: [V2 PATCH 03/10] added media agnostic (MA) data structures and handling

2014-11-10 Thread Greg KH
On Mon, Nov 10, 2014 at 06:09:34PM -0800, Stephanie Wallick wrote:
 +/**
 + * Returns the number of urbs currently in the MA USB HCD. Will return 0 if 
 the
 + * MA USB HCD is empty or a negative errno if an error occurs.

How can this function return a negative number?  I don't see that
codepath here, can you show it to me?

 + */
 +int mausb_hcd_urb_count(struct mausb_hcd *mhcd)
 +{
 + int count = 0;
 + struct mausb_host_ep*ma_ep;
 + struct mausb_dev*mausb_dev;
 + struct mausb_urb*maurb;
 + unsigned long   irq_flags;
 +
 + /* for every device */
 + spin_lock_irqsave(mhcd-hcd_lock, irq_flags);
 + list_for_each_entry(mausb_dev, mhcd-ma_dev.dev_list, dev_list) {
 + spin_unlock_irqrestore(mhcd-hcd_lock, irq_flags);
 +
 + /* for every endpoint */
 + spin_lock_irqsave(mausb_dev-dev_lock, irq_flags);
 + list_for_each_entry(ma_ep, mausb_dev-ep_list, ep_list) {
 + spin_unlock_irqrestore(mausb_dev-dev_lock, irq_flags);
 +
 + /* for every urb */
 + spin_lock_irqsave(ma_ep-ep_lock, irq_flags);
 + list_for_each_entry(maurb, ma_ep-urb_list, urb_list) {
 + ++count;
 + }
 +
 + spin_unlock_irqrestore(ma_ep-ep_lock, irq_flags);
 + spin_lock_irqsave(mausb_dev-dev_lock, irq_flags);
 + }
 +
 + spin_unlock_irqrestore(mausb_dev-dev_lock, irq_flags);
 + spin_lock_irqsave(mhcd-hcd_lock, irq_flags);
 + }
 +
 + spin_unlock_irqrestore(mhcd-hcd_lock, irq_flags);
 +
 + return count;
 +}

There honestly is too many things wrong with this function to even know
where to start.  So how about I just ask why you would ever want to know
this number, and what good it would do to even care about it?  You do
realize that this number is almost always guaranteed to be wrong once
the function returns, so you better not be doing something with it that
matters.

Intel has a whole group of very experienced Linux kernel developers who
will review code before you sent it out publicly.  Please take advantage
of them and run this all through them before resending this out again.

If you did run this code through that group, please let me know who it
was specifically that allowed this stuff to get through, and why they
didn't want their name on this code submission.  I need to have a strong
word with them...

Yes, I am holding you to a higher standard than staging code normally
is, and yes, it is purely because of the company you work for.  But I
only do that because your company knows how to do this stuff right, and
you have access to the resources and talent to help make this code
right.  Other people and companies do not have the kind of advantage
that you do.

Wasting community member's time (i.e. mine) by forcing _them_ to review
stuff like this, is something that your company knows better than to do,
as should you as well.

I want to see some more senior Intel kernel developer's signed-off-by
lines on this code before I will ever consider accepting it for the
kernel.  Please do not resend this code until that happens.

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


Re: [PATCH] usbnet: smsc95xx: dereferencing NULL pointer

2014-11-10 Thread Sudip Mukherjee
On Mon, Nov 10, 2014 at 02:22:23PM -0500, David Miller wrote:
 From: Sudip Mukherjee sudipm.mukher...@gmail.com
 Date: Fri,  7 Nov 2014 18:52:40 +0530
 
  we were dereferencing dev to initialize pdata. but just after that we
  have a BUG_ON(!dev). so we were basically dereferencing the pointer
  first and then tesing it for NULL.
  
  Signed-off-by: Sudip Mukherjee su...@vectorindia.org
 
 You didn't even compile test this.
 
 Do not even bother fixing theoretical issues if you're going to be
 introducing a _REAL_ serious regression into the code with your fix:
 
 drivers/net/usb/smsc95xx.c: In function ‘smsc95xx_resume’:
 drivers/net/usb/smsc95xx.c:1674:5: warning: ‘pdata’ is used uninitialized in 
 this function [-Wuninitialized]
   u8 suspend_flags = pdata-suspend_flags;
  ^
 
 So, instead of a theoretical issue, we now have a real guaranteed
 crash.
 
 You did not compile test this change, and you definitely did not
 functionally test this change either.
 
 Please do not do this ever again, thanks.

extremely sorry for this.
i have compile tested but don't know how i missed the new warning message.
for any of my patch,if for some reason i am not able to compile test it, i 
mention that in the comments.
sorry again.

thanks
sudip
--
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: [PATCHv4 2/6] phy: improved lookup method

2014-11-10 Thread Kishon Vijay Abraham I
Hi,

On Friday 31 October 2014 06:03 PM, Vivek Gautam wrote:
 Hi Heikki,
 
 
 On Fri, Oct 17, 2014 at 8:09 PM, Heikki Krogerus
 heikki.kroge...@linux.intel.com wrote:
 Removes the need for the phys to be aware of their users
 even when not using DT. The method is copied from clkdev.c.

 Signed-off-by: Heikki Krogerus heikki.kroge...@linux.intel.com
 Tested-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  Documentation/phy.txt   |  66 ---
  drivers/phy/phy-core.c  | 135 
 +++-
  include/linux/phy/phy.h |  27 ++
  3 files changed, 183 insertions(+), 45 deletions(-)

 diff --git a/Documentation/phy.txt b/Documentation/phy.txt
 index c6594af..8add515 100644
 --- a/Documentation/phy.txt
 +++ b/Documentation/phy.txt
 @@ -54,18 +54,14 @@ The PHY driver should create the PHY in order for other 
 peripheral controllers
  to make use of it. The PHY framework provides 2 APIs to create the PHY.

  struct phy *phy_create(struct device *dev, struct device_node *node,
 -  const struct phy_ops *ops,
 -  struct phy_init_data *init_data);
 +  const struct phy_ops *ops);
  struct phy *devm_phy_create(struct device *dev, struct device_node *node,
 -   const struct phy_ops *ops,
 -   struct phy_init_data *init_data);
 +   const struct phy_ops *ops);

  The PHY drivers can use one of the above 2 APIs to create the PHY by passing
 -the device pointer, phy ops and init_data.
 +the device pointer and phy ops.
  phy_ops is a set of function pointers for performing PHY operations such as
 -init, exit, power_on and power_off. *init_data* is mandatory to get a 
 reference
 -to the PHY in the case of non-dt boot. See section *Board File 
 Initialization*
 -on how init_data should be used.
 +init, exit, power_on and power_off.

  Inorder to dereference the private data (in phy_ops), the phy provider 
 driver
  can use phy_set_drvdata() after creating the PHY and use phy_get_drvdata() 
 in
 @@ -137,42 +133,24 @@ There are exported APIs like phy_pm_runtime_get, 
 phy_pm_runtime_get_sync,
  phy_pm_runtime_put, phy_pm_runtime_put_sync, phy_pm_runtime_allow and
  phy_pm_runtime_forbid for performing PM operations.

 -8. Board File Initialization
 -
 -Certain board file initialization is necessary in order to get a reference
 -to the PHY in the case of non-dt boot.
 -Say we have a single device that implements 3 PHYs that of USB, SATA and 
 PCIe,
 -then in the board file the following initialization should be done.
 -
 -struct phy_consumer consumers[] = {
 -   PHY_CONSUMER(dwc3.0, usb),
 -   PHY_CONSUMER(pcie.0, pcie),
 -   PHY_CONSUMER(sata.0, sata),
 -};
 -PHY_CONSUMER takes 2 parameters, first is the device name of the controller
 -(PHY consumer) and second is the port name.
 -
 -struct phy_init_data init_data = {
 -   .consumers = consumers,
 -   .num_consumers = ARRAY_SIZE(consumers),
 -};
 -
 -static const struct platform_device pipe3_phy_dev = {
 -   .name = pipe3-phy,
 -   .id = -1,
 -   .dev = {
 -   .platform_data = {
 -   .init_data = init_data,
 -   },
 -   },
 -};
 -
 -then, while doing phy_create, the PHY driver should pass this init_data
 -   phy_create(dev, ops, pdata-init_data);
 -
 -and the controller driver (phy consumer) should pass the port name along 
 with
 -the device to get a reference to the PHY
 -   phy_get(dev, pcie);
 +8. PHY Mappings
 +
 +In order to get reference to a PHY without help from DeviceTree, the 
 framework
 +offers lookups which can be compared to clkdev that allow clk structures to 
 be
 +bound to devices. A lookup can be made statically by directly registering
 +phy_lookup structure which contains the name of the PHY device, the name of 
 the
 +device which the PHY will be bind to and Connection ID string. 
 Alternatively a
 +lookup can be made during runtime when a handle to the struct phy already
 +exists.
 +
 +The framework offers the following APIs for registering and unregistering 
 the
 +lookups.
 +
 +void phy_register_lookup(struct phy_lookup *pl);
 +int phy_create_lookup(struct phy *phy, const char *con_id, const char 
 *dev_id);
 +
 +void phy_unregister_lookup(struct phy_lookup *pl);
 +void phy_remove_lookup(struct phy *phy, const char *con_id, const char 
 *dev_id);

  9. DeviceTree Binding

 diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
 index ff5eec5..c8d0f66 100644
 --- a/drivers/phy/phy-core.c
 +++ b/drivers/phy/phy-core.c
 @@ -26,6 +26,7 @@
  static struct class *phy_class;
  static DEFINE_MUTEX(phy_provider_mutex);
  static LIST_HEAD(phy_provider_list);
 +static LIST_HEAD(phys);
  static DEFINE_IDA(phy_ida);

  static void devm_phy_release(struct device *dev, void *res)
 @@ -84,6 +85,138 @@ static struct phy *phy_lookup(struct device *device, 
 const char *port)
 return 

[PATCH] usb: misc: Add driver for ALVA Nanoface

2014-11-10 Thread Lauri Niskanen
ALVA Nanoface is a USB audio interface device that only works after
receiving an initialization command. This driver does not handle any
actual audio features, but only initializes the device enabling its
audio I/O and physical controls. There are some additional USB audio
features on the device that are currently not supported. The support
for these features may be added later.

Signed-off-by: Lauri Niskanen a...@ape3000.com
---
 drivers/usb/misc/Kconfig|  9 +
 drivers/usb/misc/Makefile   |  1 +
 drivers/usb/misc/nanoface.c | 95 +
 3 files changed, 105 insertions(+)
 create mode 100644 drivers/usb/misc/nanoface.c

diff --git a/drivers/usb/misc/Kconfig b/drivers/usb/misc/Kconfig
index 76d7720..d01d5c0 100644
--- a/drivers/usb/misc/Kconfig
+++ b/drivers/usb/misc/Kconfig
@@ -249,6 +249,15 @@ config USB_HSIC_USB3503
help
  This option enables support for SMSC USB3503 HSIC to USB 2.0 Driver.
 
+config USB_NANOFACE
+   tristate ALVA Nanoface USB driver
+   help
+ Say Y here if you need ALVA Nanoface device support. ALVA
+ Nanoface is a USB audio interface device. See
+ http://www.alva-audio.de/nanoface/ for further information.
+ This driver does not support USB audio features, but enables basic
+ audio I/O connections and physical controls.
+
 config USB_LINK_LAYER_TEST
tristate USB Link Layer Test driver
help
diff --git a/drivers/usb/misc/Makefile b/drivers/usb/misc/Makefile
index 65b0402..2ee5b73 100644
--- a/drivers/usb/misc/Makefile
+++ b/drivers/usb/misc/Makefile
@@ -25,6 +25,7 @@ obj-$(CONFIG_USB_USS720)  += uss720.o
 obj-$(CONFIG_USB_SEVSEG)   += usbsevseg.o
 obj-$(CONFIG_USB_YUREX)+= yurex.o
 obj-$(CONFIG_USB_HSIC_USB3503) += usb3503.o
+obj-$(CONFIG_USB_NANOFACE) += nanoface.o
 
 obj-$(CONFIG_USB_SISUSBVGA)+= sisusbvga/
 obj-$(CONFIG_USB_LINK_LAYER_TEST)  += lvstest.o
diff --git a/drivers/usb/misc/nanoface.c b/drivers/usb/misc/nanoface.c
new file mode 100644
index 000..1201240
--- /dev/null
+++ b/drivers/usb/misc/nanoface.c
@@ -0,0 +1,95 @@
+/*
+ * Minimal driver for ALVA Nanoface USB audio interface. This driver does not
+ * support USB audio, but enables other audio I/O connections on the device.
+ *
+ * Copyright (C) 2014 Lauri Niskanen (a...@ape3000.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.
+ */
+
+#include linux/module.h
+#include linux/kernel.h
+#include linux/usb.h
+
+static unsigned char init_setup[] = {0x01, 0x0b, 0x00, 0x00,
+0x01, 0x00, 0x00, 0x00};
+static unsigned char init_data[] = {};
+
+static void init_complete_callback(struct urb *request)
+{
+   dev_info(request-dev-dev, ALVA Nanoface initialized\n);
+   usb_free_urb(request);
+}
+
+static int nanoface_probe(struct usb_interface *interface,
+ const struct usb_device_id *id)
+{
+   int status;
+   struct usb_device *dev;
+   struct urb *init_request;
+
+   dev = interface_to_usbdev(interface);
+
+   init_request = usb_alloc_urb(0, 0);
+   if (init_request == 0) {
+   dev_err(dev-dev, ALVA Nanoface initialization failed: Cannot 
allocate memory for URB request\n);
+   return -ENOMEM;
+   }
+
+   dev_info(dev-dev, ALVA Nanoface (%04X:%04X) connected\n,
+id-idVendor, id-idProduct);
+
+   usb_fill_control_urb(init_request, dev,
+usb_sndctrlpipe(dev, 0), init_setup,
+init_data, sizeof(init_data),
+init_complete_callback, 0);
+
+   status = usb_submit_urb(init_request, 0);
+   if (status != 0) {
+   dev_err(dev-dev, ALVA Nanoface initialization failed: Error 
%d when submitting URB\n,
+  status);
+   return status;
+   }
+
+   /* do not manage the device */
+   return -ENODEV;
+}
+
+static void nanoface_disconnect(struct usb_interface *interface)
+{
+   dev_info(interface-dev, ALVA Nanoface disconnected\n);
+}
+
+static struct usb_device_id nanoface_table[] = {
+   { USB_DEVICE(0x0a4a, 0xaffe) },
+   { /* Terminating entry */ }
+};
+
+MODULE_DEVICE_TABLE(usb, nanoface_table);
+
+static struct usb_driver nanoface_driver = {
+   .name = nanoface,
+   .id_table = nanoface_table,
+   .probe = nanoface_probe,
+   .disconnect = nanoface_disconnect,
+};
+
+static int __init nanoface_init(void)
+{
+   return usb_register(nanoface_driver);
+}
+
+static void __exit nanoface_exit(void)
+{
+   usb_deregister(nanoface_driver);
+}
+
+module_init(nanoface_init);
+module_exit(nanoface_exit);
+

Re: [PATCH] usb: misc: Add driver for ALVA Nanoface

2014-11-10 Thread Greg Kroah-Hartman
On Tue, Nov 11, 2014 at 09:05:06AM +0200, Lauri Niskanen wrote:
 ALVA Nanoface is a USB audio interface device that only works after
 receiving an initialization command. This driver does not handle any
 actual audio features, but only initializes the device enabling its
 audio I/O and physical controls. There are some additional USB audio
 features on the device that are currently not supported. The support
 for these features may be added later.
 
 Signed-off-by: Lauri Niskanen a...@ape3000.com
 ---
  drivers/usb/misc/Kconfig|  9 +
  drivers/usb/misc/Makefile   |  1 +
  drivers/usb/misc/nanoface.c | 95 
 +
  3 files changed, 105 insertions(+)
  create mode 100644 drivers/usb/misc/nanoface.c

Any reason this can't be a simple userspace program that writes the
needed command to the device using libusb instead of being a kernel
driver?  This seems like overkill for a kernel driver to me.

thanks,

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


Re: [PATCH] usb: misc: Add driver for ALVA Nanoface

2014-11-10 Thread Lauri Niskanen

On 11/11/14 09:07, Greg Kroah-Hartman wrote:

Any reason this can't be a simple userspace program that writes the
needed command to the device using libusb instead of being a kernel
driver?  This seems like overkill for a kernel driver to me.


You are probably right. It indeed should be possible to do this in 
userspace. I thought that having a kernel driver would still be 
benefical since it adds plug-and-play availability for all Linux users 
without having to deal with userspace driver programs.


You are far more experienced with these things than me, so I am happy to 
let you make the decision about whether to have a kernel driver or not.


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