[PATCH] usb: gadget: u_serial: fix typo which cause build warning

2013-03-12 Thread Bo Shen
fix typo which cause following build warning

warning: "pr_vdebug" redefined

Signed-off-by: Bo Shen 
---
 drivers/usb/gadget/u_serial.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index c5034d9..b369292 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -136,7 +136,7 @@ static struct portmaster {
pr_debug(fmt, ##arg)
 #endif /* pr_vdebug */
 #else
-#ifndef pr_vdebig
+#ifndef pr_vdebug
 #define pr_vdebug(fmt, arg...) \
({ if (0) pr_debug(fmt, ##arg); })
 #endif /* pr_vdebug */
-- 
1.7.9.5

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


Re: [PATCH] usb: gadget: u_serial: fix typo which cause build warning

2013-03-13 Thread Bo Shen

Hi Felipe,

On 3/13/2013 15:42, Felipe Balbi wrote:

On Wed, Mar 13, 2013 at 11:37:21AM +0800, Bo Shen wrote:

fix typo which cause following build warning

warning: "pr_vdebug" redefined


make sure to note which commit has introduced the problem.


I will resend this patch and add this info.


hint: it was commit ea0e6276


Thanks.

Best Regards,
Bo Shen


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


[Resend] usb: gadget: u_serial: fix typo which cause build warning

2013-03-13 Thread Bo Shen
fix typo error in commit ea0e6276 cause the following build warning

  warning: "pr_vdebug" redefined

Signed-off-by: Bo Shen 
---
Resend:
  Add which commit let this slip in
---
 drivers/usb/gadget/u_serial.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index c5034d9..b369292 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -136,7 +136,7 @@ static struct portmaster {
pr_debug(fmt, ##arg)
 #endif /* pr_vdebug */
 #else
-#ifndef pr_vdebig
+#ifndef pr_vdebug
 #define pr_vdebug(fmt, arg...) \
({ if (0) pr_debug(fmt, ##arg); })
 #endif /* pr_vdebug */
-- 
1.7.9.5

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


Re: [Resend] usb: gadget: u_serial: fix typo which cause build warning

2013-03-13 Thread Bo Shen

Hi Felipe,

On 3/13/2013 16:19, Felipe Balbi wrote:

On Wed, Mar 13, 2013 at 03:57:59PM +0800, Bo Shen wrote:

fix typo error in commit ea0e6276 cause the following build warning


maybe I should've been more explicit, but when you 'blame' a commit you
also add the commit subject is parentheses:

"fix typo error introduced by commit ea0e6276 (usb: gadget: add multiple
definition guards) which causes the following build warning:


Thanks.

I will send the patch with this again.


   warning: "pr_vdebug" redefined

Signed-off-by: Bo Shen 
---
Resend:
   Add which commit let this slip in
---
  drivers/usb/gadget/u_serial.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index c5034d9..b369292 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -136,7 +136,7 @@ static struct portmaster {
pr_debug(fmt, ##arg)
  #endif /* pr_vdebug */
  #else
-#ifndef pr_vdebig
+#ifndef pr_vdebug
  #define pr_vdebug(fmt, arg...) \
({ if (0) pr_debug(fmt, ##arg); })
  #endif /* pr_vdebug */
--
1.7.9.5



Best Regards,
Bo Shen

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


[Patch v2] usb: gadget: u_serial: fix typo which cause build warning

2013-03-13 Thread Bo Shen
fix typo error introduced by commit ea0e6276 (usb: gadget: add
multiple definition guards) which causes the following build warning:

  warning: "pr_vdebug" redefined

Signed-off-by: Bo Shen 
---
Change in v2:
  reword commit message which make it more explicitly with commit id and subject
---
 drivers/usb/gadget/u_serial.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/u_serial.c b/drivers/usb/gadget/u_serial.c
index c5034d9..b369292 100644
--- a/drivers/usb/gadget/u_serial.c
+++ b/drivers/usb/gadget/u_serial.c
@@ -136,7 +136,7 @@ static struct portmaster {
pr_debug(fmt, ##arg)
 #endif /* pr_vdebug */
 #else
-#ifndef pr_vdebig
+#ifndef pr_vdebug
 #define pr_vdebug(fmt, arg...) \
({ if (0) pr_debug(fmt, ##arg); })
 #endif /* pr_vdebug */
-- 
1.7.9.5

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


Re: [Resend] usb: gadget: u_serial: fix typo which cause build warning

2013-03-13 Thread Bo Shen

Hi Sergei,

On 3/13/2013 21:35, Sergei Shtylyov wrote:

Hello.

On 13-03-2013 11:57, Bo Shen wrote:


fix typo error in commit ea0e6276 cause the following build warning


Pleas ealso specify that commit's summary line in parens (or however
you like).


Thanks for you information.

With Felipe's hint, I have sent out v2 version 
(http://article.gmane.org/gmane.linux.usb.general/82260) with commit id 
and subject. Please check it, if any other suggestion will appreciate.



   warning: "pr_vdebug" redefined



Signed-off-by: Bo Shen 


WBR, Sergei




Best Regards,
Bo Shen

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


Re: [PATCH 1/5] usb: add Atmel USBA UDC DT support

2013-05-19 Thread Bo Shen
a_udc")) {
ret = request_irq(gpio_to_irq(udc->vbus_pin),
usba_vbus_irq, 0,
"atmel_usba_udc", udc);
if (ret) {
-   gpio_free(udc->vbus_pin);
udc->vbus_pin = -ENODEV;
dev_warn(&udc->pdev->dev,
 "failed to request vbus irq; "
@@ -1969,16 +2069,14 @@ static int __init usba_udc_probe(struct platform_device 
*pdev)
goto err_add_udc;

usba_init_debugfs(udc);
-   for (i = 1; i < pdata->num_ep; i++)
+   for (i = 1; i < udc->num_ep; i++)
usba_ep_init_debugfs(udc, &usba_ep[i]);

return 0;

  err_add_udc:
-   if (gpio_is_valid(pdata->vbus_pin)) {
+   if (gpio_is_valid(udc->vbus_pin))
free_irq(gpio_to_irq(udc->vbus_pin), udc);
-   gpio_free(udc->vbus_pin);
-   }

free_irq(irq, udc);
  err_request_irq:
@@ -2001,19 +2099,17 @@ static int __exit usba_udc_remove(struct 
platform_device *pdev)
  {
struct usba_udc *udc;
int i;
-   struct usba_platform_data *pdata = pdev->dev.platform_data;

udc = platform_get_drvdata(pdev);

usb_del_gadget_udc(&udc->gadget);

-   for (i = 1; i < pdata->num_ep; i++)
+   for (i = 1; i < udc->num_ep; i++)
usba_ep_cleanup_debugfs(&usba_ep[i]);
usba_cleanup_debugfs(udc);

if (gpio_is_valid(udc->vbus_pin)) {
free_irq(gpio_to_irq(udc->vbus_pin), udc);
-   gpio_free(udc->vbus_pin);
}

free_irq(udc->irq, udc);
@@ -2026,11 +2122,21 @@ static int __exit usba_udc_remove(struct 
platform_device *pdev)
    return 0;
  }

+#if defined(CONFIG_OF)
+static const struct of_device_id atmel_udc_dt_ids[] = {
+   { .compatible = "atmel,at91sam9rl-udc" },
+   { /* sentinel */ }
+};
+
+MODULE_DEVICE_TABLE(of, atmel_udc_dt_ids);
+#endif
+
  static struct platform_driver udc_driver = {
.remove = __exit_p(usba_udc_remove),
.driver = {
.name   = "atmel_usba_udc",
.owner  = THIS_MODULE,
+   .of_match_table = of_match_ptr(atmel_udc_dt_ids),
},
  };

diff --git a/drivers/usb/gadget/atmel_usba_udc.h 
b/drivers/usb/gadget/atmel_usba_udc.h
index d65a618..6999a26 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -317,6 +317,7 @@ struct usba_udc {
int irq;
int vbus_pin;
int vbus_pin_inverted;
+   int num_ep;
struct clk *pclk;
struct clk *hclk;




Best Regards,
Bo Shen

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


Re: [PATCH 1/7] USB: gadget: atmel_usba: move global struct usba_ep usba_ep to struct usba_udc

2013-05-22 Thread Bo Shen

Hi J,

On 5/21/2013 00:25, Jean-Christophe PLAGNIOL-VILLARD wrote:

so we can have multiple usb gadget instance

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD 
Cc: Nicolas Ferre 
Cc: linux-usb@vger.kernel.org


For this series, test OK on at91sam9m10g45ek and at91sam9x5ek board
Tested-by: Bo Shen 

PS: When do testing, we need build in or choose as module: "Device 
Drivers ---> Generic Target Core Mod (TCM) and ConfigFS infrastructure"


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


Re: [PATCH 05/10] USB: EHCI: make ehci-atmel a separate driver

2013-02-07 Thread Bo Shen

Hi Manjunath Goudar,
  I test this patch based on linux master branch, the commit id is: 
6bacaa9ddacb71c691d32c678d37bc59ffc71fac. (I am not sure this is the 
right place for testing).
  First, it has an compile error as following. After fix it, and 
tested, the EHCI doesn't work.

---<8---
drivers/usb/host/ehci-atmel.c: In function 'ehci_atmel_drv_remove':
drivers/usb/host/ehci-atmel.c:167: error: implicit declaration of 
function 'ehci_shutdown'

--->8---

And a little code style comments as following.

On 2/8/2013 1:34, manjunath.gou...@linaro.org wrote:

From: Manjunath Goudar 

Separate the Atmel host controller driver from ehci-hcd host code
into its own driver module.

Signed-off-by: Manjunath Goudar 
Cc: Alan Stern 
Cc: Greg KH 
Cc: Grant Likely 
Cc: Rob Herring 
Cc: Andrew Victor 
Cc: Nicolas Ferre 
Cc: Jean-Christophe Plagniol-Villard 
Cc: linux-usb@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
---
  drivers/usb/host/Kconfig  |7 
  drivers/usb/host/Makefile |1 +
  drivers/usb/host/ehci-atmel.c |   78 ++---
  drivers/usb/host/ehci-hcd.c   |6 +---
  4 files changed, 51 insertions(+), 41 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 3689b7b..5a13f9d 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -176,6 +176,13 @@ config USB_EHCI_HCD_ORION
  ---help---
Enables support for the on-chip EHCI controller on
Morvell Orion chips.


Need blank line here.


+config USB_EHCI_HCD_AT91
+tristate  "Support for Atmel on-chip EHCI USB controller"
+depends on USB_EHCI_HCD && ARCH_AT91
+default y
+---help---
+  Enables support for the on-chip EHCI controller on
+  Atmel chips.

  config USB_EHCI_MSM
bool "Support for MSM on-chip EHCI USB controller"


[snip]


+static void __exit ehci_atmel_cleanup(void)
+{
+   platform_driver_unregister(&ehci_atmel_driver);
+}
+module_exit(ehci_atmel_cleanup);
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+
+MODULE_ALIAS("platform:ehci-atmel");
+MODULE_AUTHOR("Nicolas Ferre");
+MODULE_LICENSE("GPL");
+


Remove the blank line here. As to it is the EOF.

Best Regards,
Bo Shen
--
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 2/8] USB: EHCI: make ehci-atmel a separate driver

2013-02-18 Thread Bo Shen

On 02/15/2013 06:24 PM, Manjunath Goudar wrote:

Separate the Atmel host controller driver from ehci-hcd host code
into its own driver module.

In V2:
Resolved below compiler error.
drivers/usb/host/ehci-atmel.c: In function 'ehci_atmel_drv_remove':
drivers/usb/host/ehci-atmel.c:167: error: implicit declaration of function 
'ehci_shutdown'

Signed-off-by: Manjunath Goudar
Cc: Alan Stern
Cc: Greg KH
Cc: Grant Likely
Cc: Rob Herring
Cc: Andrew Victor
Cc: Nicolas Ferre
Cc: Jean-Christophe Plagniol-Villard
Cc: linux-usb@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
---
  drivers/usb/host/Kconfig  |8 +
  drivers/usb/host/Makefile |1 +
  drivers/usb/host/ehci-atmel.c |   76 ++---
  drivers/usb/host/ehci-hcd.c   |   10 ++
  drivers/usb/host/ehci.h   |2 +-
  5 files changed, 53 insertions(+), 44 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 15e8032..1ef37d7 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -170,6 +170,14 @@ config USB_EHCI_HCD_SPEAR
Enables support for the on-chip EHCI controller on
ST SPEAr chips.

+config USB_EHCI_HCD_AT91
+tristate  "Support for Atmel on-chip EHCI USB controller"
+depends on USB_EHCI_HCD&&  ARCH_AT91
+default y
+---help---
+  Enables support for the on-chip EHCI controller on
+  Atmel chips.
+
  config USB_EHCI_MSM
bool "Support for MSM on-chip EHCI USB controller"
depends on USB_EHCI_HCD&&  ARCH_MSM
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index c8fcde9..b301243 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_USB_EHCI_HCD_PLATFORM)   += ehci-platform.o
  obj-$(CONFIG_USB_EHCI_MXC)+= ehci-mxc.o
  obj-$(CONFIG_USB_EHCI_HCD_SPEAR)+= ehci-spear.o
  obj-$(CONFIG_USB_OXU210HP_HCD)+= oxu210hp-hcd.o
+obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
  obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o
  obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o
  obj-$(CONFIG_USB_OHCI_HCD)+= ohci-hcd.o
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 27639487..3cd0dd4 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -15,6 +15,19 @@
  #include
  #include
  #include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include "ehci.h"
+
+#define DRIVER_DESC "EHCI atmel driver"
+
+static const char hcd_name[] = "ehci-atmel";
+static struct hc_driver __read_mostly ehci_atmel_hc_driver;

  /* interface and function clocks */
  static struct clk *iclk, *fclk;
@@ -60,41 +73,6 @@ static int ehci_atmel_setup(struct usb_hcd *hcd)
return ehci_setup(hcd);
  }

-static const struct hc_driver ehci_atmel_hc_driver = {
-   .description= hcd_name,
-   .product_desc   = "Atmel EHCI UHP HS",
-   .hcd_priv_size  = sizeof(struct ehci_hcd),
-
-   /* generic hardware linkage */
-   .irq= ehci_irq,
-   .flags  = HCD_MEMORY | HCD_USB2,
-
-   /* basic lifecycle operations */
-   .reset  = ehci_atmel_setup,
-   .start  = ehci_run,
-   .stop   = ehci_stop,
-   .shutdown   = ehci_shutdown,
-
-   /* managing i/o requests and associated device resources */
-   .urb_enqueue= ehci_urb_enqueue,
-   .urb_dequeue= ehci_urb_dequeue,
-   .endpoint_disable   = ehci_endpoint_disable,
-   .endpoint_reset = ehci_endpoint_reset,
-
-   /* scheduling support */
-   .get_frame_number   = ehci_get_frame,
-
-   /* root hub support */
-   .hub_status_data= ehci_hub_status_data,
-   .hub_control= ehci_hub_control,
-   .bus_suspend= ehci_bus_suspend,
-   .bus_resume = ehci_bus_resume,
-   .relinquish_port= ehci_relinquish_port,
-   .port_handed_over   = ehci_port_handed_over,
-
-   .clear_tt_buffer_complete   = ehci_clear_tt_buffer_complete,
-};
-
  static u64 at91_ehci_dma_mask = DMA_BIT_MASK(32);

  static int ehci_atmel_drv_probe(struct platform_device *pdev)
@@ -210,7 +188,33 @@ static struct platform_driver ehci_atmel_driver = {
.remove = ehci_atmel_drv_remove,
.shutdown   = usb_hcd_platform_shutdown,
.driver = {
-   .name   = "atmel-ehci",
+   .name   = hcd_name,


This change will cause atmel ehci won't work with the none device tree 
kernel.


it can be fixed with replace other places using "atmel-ehci" with 
, that means replace "atmel-ehci" with "ehci-atmel" at other 
places.


Best Regards,
Bo Shen


--
To unsubsc

Re: Testing for hardware bug in EHCI controllers

2013-03-03 Thread Bo Shen

Hi Alan,

On 02/26/2013 04:54 AM, Alan Stern wrote:

Sarah (and anyone else who's interested):

A while ago I wrote about a hardware bug in my Intel ICH5 and ICH8 EHCI
controllers.  You pointed out that these are rather old components, not
being used in current systems, which is quite true.


I test this on Atmel at91sam9x5ek board with Linux-3.8. And get the 
similar information. So please indicate me more detail information about 
the bug. (Sorry for not catch the hardware bug e-mail)


Thanks.

Best Regards,
Bo Shen
--
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: Testing for hardware bug in EHCI controllers

2013-03-04 Thread Bo Shen

Hi Alan,

On 3/4/2013 23:16, Alan Stern wrote:

On Mon, 4 Mar 2013, Bo Shen wrote:


Hi Alan,

On 02/26/2013 04:54 AM, Alan Stern wrote:

Sarah (and anyone else who's interested):

A while ago I wrote about a hardware bug in my Intel ICH5 and ICH8 EHCI
controllers.  You pointed out that these are rather old components, not
being used in current systems, which is quite true.


I test this on Atmel at91sam9x5ek board with Linux-3.8. And get the
similar information. So please indicate me more detail information about
the bug. (Sorry for not catch the hardware bug e-mail)


The problem is explained in more detail here:

http://marc.info/?l=linux-usb&m=135492071812265&w=2

Note that the test program itself requires a small fix, which was
posted here:

http://marc.info/?l=linux-usb&m=136226443502631&w=2



Thanks.


If you don't mind, I'd like to see the kernel log from your test run.


The dmesg log information as following:

root@at91sam9x5ek:~# ./ehci-test /dev/bus/usb/001/003
atmel-ehci 70.ehci: EHCI hardware bug detected: 82008d80 8d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 02008d80 80008d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 02008d80 80008d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 82008d80 8d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 82008d80 8d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 02008d80 80008d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 82008d80 8d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 02008d80 80008d00
atmel-ehci 70.ehci: EHCI hardware bug detected: 82008d80 9d00

Best Regards,
Bo Shen
--
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: Testing for hardware bug in EHCI controllers

2013-03-06 Thread Bo Shen

Hi Matthieu,

On 3/5/2013 16:52, Matthieu CASTET wrote:


Do you know which vendor did the ehci IP that is in your atmel SOC.


I am sorry, I don't know the vendor of the ehci IP.

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


[PATCH 1/2] USB: at91: fix the number of endpoint parameter

2014-01-16 Thread Bo Shen
In sama5d3 SoC, there are 16 endpoints. As the USBA_NR_ENDPOINTS
is only 7. So, fix it for sama5d3 SoC using the udc->num_ep.

Signed-off-by: Bo Shen 
---

 drivers/usb/gadget/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 2cb52e0..7e67a81 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1670,7 +1670,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (ep_status) {
int i;
 
-   for (i = 0; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 0; i < udc->num_ep; i++)
if (ep_status & (1 << i)) {
if (ep_is_control(&udc->usba_ep[i]))
usba_control_irq(udc, &udc->usba_ep[i]);
-- 
1.8.5.2

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


[PATCH 2/2] USB: at91: using USBA_NR_DMAS for DMA channels

2014-01-16 Thread Bo Shen
When the SoC is earlier than sama5d3 SoC, which have the same number
endpoints and DMAs. However for sama5d3 SoC, it has different number
for endpoints and DMAs. So, define USBA_NR_DMAs for DMA channels

Signed-off-by: Bo Shen 
---

 drivers/usb/gadget/atmel_usba_udc.c | 2 +-
 drivers/usb/gadget/atmel_usba_udc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 7e67a81..5cded1c 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (dma_status) {
int i;
 
-   for (i = 1; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 1; i < USBA_NR_DMAS; i++)
if (dma_status & (1 << i))
usba_dma_irq(udc, &udc->usba_ep[i]);
}
diff --git a/drivers/usb/gadget/atmel_usba_udc.h 
b/drivers/usb/gadget/atmel_usba_udc.h
index 2922db5..a70706e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -210,7 +210,7 @@
 #define USBA_FIFO_BASE(x)  ((x) << 16)
 
 /* Synth parameters */
-#define USBA_NR_ENDPOINTS  7
+#define USBA_NR_DMAS   7
 
 #define EP0_FIFO_SIZE  64
 #define EP0_EPT_SIZE   USBA_EPT_SIZE_64
-- 
1.8.5.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 1/2] USB: at91: fix the number of endpoint parameter

2014-01-19 Thread Bo Shen

Hi J,

On 01/18/2014 01:20 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:

On 10:59 Fri 17 Jan , Bo Shen wrote:

In sama5d3 SoC, there are 16 endpoints. As the USBA_NR_ENDPOINTS
is only 7. So, fix it for sama5d3 SoC using the udc->num_ep.

Signed-off-by: Bo Shen 
---

  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 2cb52e0..7e67a81 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1670,7 +1670,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (ep_status) {
int i;

-   for (i = 0; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 0; i < udc->num_ep; i++)


no the limit need to specified in the driver as a checkpoint by the compatible
or platform driver id


You mean, we should not trust the data passed from dt node or platform 
data? Or do you think we should do double confirm?



Best Regards,
J.

if (ep_status & (1 << i)) {
if (ep_is_control(&udc->usba_ep[i]))
usba_control_irq(udc, &udc->usba_ep[i]);
--
1.8.5.2



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


Re: [PATCH 1/2] USB: at91: fix the number of endpoint parameter

2014-01-21 Thread Bo Shen

Hi J,

On 01/21/2014 01:49 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:

On 11:39 Mon 20 Jan , Bo Shen wrote:

Hi J,

On 01/18/2014 01:20 PM, Jean-Christophe PLAGNIOL-VILLARD wrote:

On 10:59 Fri 17 Jan , Bo Shen wrote:

In sama5d3 SoC, there are 16 endpoints. As the USBA_NR_ENDPOINTS
is only 7. So, fix it for sama5d3 SoC using the udc->num_ep.

Signed-off-by: Bo Shen 
---

  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 2cb52e0..7e67a81 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1670,7 +1670,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (ep_status) {
int i;

-   for (i = 0; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 0; i < udc->num_ep; i++)


no the limit need to specified in the driver as a checkpoint by the compatible
or platform driver id


You mean, we should not trust the data passed from dt node or
platform data? Or do you think we should do double confirm?


no base on the driver name or the compatible you will known the MAX EP

not based on the dt ep description

as we do on pinctrl-at91


I am sorry, I am not fully get it after reading the code of 
pinctrl-at91.c, can you give the example code in pinctrl-at91.c?


Btw, the udc->num_ep is get from the following code.
for dt
--->8---
while ((pp = of_get_next_child(np, pp)))
udc->num_ep++;
---<8---

for non-dt
--->8---
udc->num_ep = pdata->num_ep;
---8<---


Best Regards,
J.

if (ep_status & (1 << i)) {
if (ep_is_control(&udc->usba_ep[i]))
usba_control_irq(udc, &udc->usba_ep[i]);
--
1.8.5.2



Best Regards,
Bo Shen


Best Regards,
Bo Shen
--
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] USB: at91: using USBA_NR_DMAS for DMA channels

2014-02-18 Thread Bo Shen

Hi Felipe Balbi,

On 02/19/2014 12:19 AM, Felipe Balbi wrote:

On Fri, Jan 17, 2014 at 10:59:25AM +0800, Bo Shen wrote:

When the SoC is earlier than sama5d3 SoC, which have the same number
endpoints and DMAs. However for sama5d3 SoC, it has different number
for endpoints and DMAs. So, define USBA_NR_DMAs for DMA channels

Signed-off-by: Bo Shen 
---

  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
  drivers/usb/gadget/atmel_usba_udc.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 7e67a81..5cded1c 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (dma_status) {
int i;

-   for (i = 1; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 1; i < USBA_NR_DMAS; i++)
if (dma_status & (1 << i))
usba_dma_irq(udc, &udc->usba_ep[i]);
}
diff --git a/drivers/usb/gadget/atmel_usba_udc.h 
b/drivers/usb/gadget/atmel_usba_udc.h
index 2922db5..a70706e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -210,7 +210,7 @@
  #define USBA_FIFO_BASE(x) ((x) << 16)

  /* Synth parameters */
-#define USBA_NR_ENDPOINTS  7
+#define USBA_NR_DMAS   7


what's the difference ? You just renamed this macro. Also, please
clarify a bit your commit log.


As commit message said, the SoC before sama5d3, the endpoint number is 
the same as DMA channel number, so use endpoints definition for DMA 
channel number, however after sama5d3, the endpoints is not the same as 
DMA channel, so use DMA micro for DMA channels.


Best Regards,
Bo Shen


--
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] USB: at91: using USBA_NR_DMAS for DMA channels

2014-02-18 Thread Bo Shen

On 02/19/2014 09:22 AM, Felipe Balbi wrote:

On Wed, Feb 19, 2014 at 09:14:58AM +0800, Bo Shen wrote:

Hi Felipe Balbi,

On 02/19/2014 12:19 AM, Felipe Balbi wrote:

On Fri, Jan 17, 2014 at 10:59:25AM +0800, Bo Shen wrote:

When the SoC is earlier than sama5d3 SoC, which have the same number
endpoints and DMAs. However for sama5d3 SoC, it has different number
for endpoints and DMAs. So, define USBA_NR_DMAs for DMA channels

Signed-off-by: Bo Shen 
---

  drivers/usb/gadget/atmel_usba_udc.c | 2 +-
  drivers/usb/gadget/atmel_usba_udc.h | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 7e67a81..5cded1c 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (dma_status) {
int i;

-   for (i = 1; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 1; i < USBA_NR_DMAS; i++)
if (dma_status & (1 << i))
usba_dma_irq(udc, &udc->usba_ep[i]);
}
diff --git a/drivers/usb/gadget/atmel_usba_udc.h 
b/drivers/usb/gadget/atmel_usba_udc.h
index 2922db5..a70706e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -210,7 +210,7 @@
  #define USBA_FIFO_BASE(x) ((x) << 16)

  /* Synth parameters */
-#define USBA_NR_ENDPOINTS  7
+#define USBA_NR_DMAS   7


what's the difference ? You just renamed this macro. Also, please
clarify a bit your commit log.


As commit message said, the SoC before sama5d3, the endpoint number
is the same as DMA channel number, so use endpoints definition for
DMA channel number, however after sama5d3, the endpoints is not the
same as DMA channel, so use DMA micro for DMA channels.


which means you're just renaming the macro for the sake of clarity.
That's fine, just needs to be clearer in commit message.


Thanks, I will send v2 to make the commit message more clearer.

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


[PATCH v2 2/2] USB: at91: using USBA_NR_DMAS for DMA channels

2014-02-18 Thread Bo Shen
The SoCs earlier than sama5d3, they have the same number endpoints
and DMA channels. In driver code, they use the same definition
USBA_NR_ENDPOINTS for both endpoints and dma channels. However,
in sama5d3, it has different number for endpoints and DMA channels.
So, define a new micro USBA_NR_DMAs for DMA channels. And the
USBA_NR_ENDPOINS is not used anymore, remove it at the same time.

Signed-off-by: Bo Shen 
---
Changes in v2:
  - Make the commit message more clearer.

 drivers/usb/gadget/atmel_usba_udc.c | 2 +-
 drivers/usb/gadget/atmel_usba_udc.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 7e67a81..5cded1c 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (dma_status) {
int i;
 
-   for (i = 1; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 1; i < USBA_NR_DMAS; i++)
if (dma_status & (1 << i))
usba_dma_irq(udc, &udc->usba_ep[i]);
}
diff --git a/drivers/usb/gadget/atmel_usba_udc.h 
b/drivers/usb/gadget/atmel_usba_udc.h
index 2922db5..a70706e 100644
--- a/drivers/usb/gadget/atmel_usba_udc.h
+++ b/drivers/usb/gadget/atmel_usba_udc.h
@@ -210,7 +210,7 @@
 #define USBA_FIFO_BASE(x)  ((x) << 16)
 
 /* Synth parameters */
-#define USBA_NR_ENDPOINTS  7
+#define USBA_NR_DMAS   7
 
 #define EP0_FIFO_SIZE  64
 #define EP0_EPT_SIZE   USBA_EPT_SIZE_64
-- 
1.8.5.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 v2 1/2] USB: at91: fix the number of endpoint parameter

2014-02-18 Thread Bo Shen
In sama5d3 SoC, there are 16 endpoints, which is different with
earlier SoCs (only have 7 endpoints). The USBA_NR_ENDPOINTS micro
is not suitable for sama5d3. So, get the endpoints number through
the udc->num_ep, which get from platform data for non-dt kernel,
or parse from dt node.

Signed-off-by: Bo Shen 
---
Changes in v2:
  - Make the commit message more clearer.

 drivers/usb/gadget/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index 2cb52e0..7e67a81 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1670,7 +1670,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (ep_status) {
int i;
 
-   for (i = 0; i < USBA_NR_ENDPOINTS; i++)
+   for (i = 0; i < udc->num_ep; i++)
if (ep_status & (1 << i)) {
if (ep_is_control(&udc->usba_ep[i]))
usba_control_irq(udc, &udc->usba_ep[i]);
-- 
1.8.5.2

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


[PATCH 2/2] usb: gadget: atmel_usba_udc: remove release function

2014-11-19 Thread Bo Shen
As the driver call usb_add_gadget_udc --> usb_add_gadget_udc_release
with NULL as release parameter, so it will use usb_udc_no_release.
So, the release in driver won't used, remove it.

And at the same time, in the usb_add_gadget_udc_release will set the
gadget name, so remove it also in driver.

Signed-off-by: Bo Shen 
---
 drivers/usb/gadget/udc/atmel_usba_udc.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 1529926..8c29d09 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1007,19 +1007,10 @@ static struct usb_endpoint_descriptor usba_ep0_desc = {
.bInterval = 1,
 };
 
-static void nop_release(struct device *dev)
-{
-
-}
-
 static struct usb_gadget usba_gadget_template = {
.ops= &usba_udc_ops,
.max_speed  = USB_SPEED_HIGH,
.name   = "atmel_usba_udc",
-   .dev= {
-   .init_name  = "gadget",
-   .release= nop_release,
-   },
 };
 
 /*
-- 
2.1.0.24.g4109c28

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


[PATCH 1/2] usb: gadget: at91_udc: remove unused release function

2014-11-19 Thread Bo Shen
As the driver call usb_add_gadget_udc --> usb_add_gadget_udc_release
with NULL as release parameter, so it will use usb_udc_no_release.
So, the release in driver won't used, remove it.

And at the same time, in the usb_add_gadget_udc_release will set the
gadget name, so remove it also in driver.

Signed-off-by: Bo Shen 
---
 drivers/usb/gadget/udc/at91_udc.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/usb/gadget/udc/at91_udc.c 
b/drivers/usb/gadget/udc/at91_udc.c
index 9968f53..b179ab1 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -1512,20 +1512,11 @@ static irqreturn_t at91_udc_irq (int irq, void *_udc)
 
 /*-*/
 
-static void nop_release(struct device *dev)
-{
-   /* nothing to free */
-}
-
 static struct at91_udc controller = {
.gadget = {
.ops= &at91_udc_ops,
.ep0= &controller.ep[0].ep,
.name   = driver_name,
-   .dev= {
-   .init_name = "gadget",
-   .release = nop_release,
-   }
},
.ep[0] = {
.ep = {
-- 
2.1.0.24.g4109c28

--
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: atmel_usba_udc: fix it to deal with final DMA channel

2014-08-06 Thread Bo Shen
As, the interrupt for DMA is counted from 1, so need to checked
the USBA_NR_DMAS, in old way, it only check (USBA_NR_DMAS - 1),
so fix it.

Reported-by: Max Liao 
Signed-off-by: Bo Shen 
---

 drivers/usb/gadget/udc/atmel_usba_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 906e65f..c9fe67e 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1661,7 +1661,7 @@ static irqreturn_t usba_udc_irq(int irq, void *devid)
if (dma_status) {
int i;
 
-   for (i = 1; i < USBA_NR_DMAS; i++)
+   for (i = 1; i <= USBA_NR_DMAS; i++)
if (dma_status & (1 << i))
usba_dma_irq(udc, &udc->usba_ep[i]);
}
-- 
1.8.5.2

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


[PATCH 1/2] USB: gadget: udc: atmel: change setting for DMA

2014-12-17 Thread Bo Shen
According to the datasheet, when transfer using DMA, the control
setting for IN packet only need END_BUF_EN, END_BUF_IE, CH_EN,
while for OUT packet, need more two bits END_TR_EN and END_TR_IE
to be configured.

Signed-off-by: Bo Shen 
---

 drivers/usb/gadget/udc/atmel_usba_udc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index ce88237..63e90f5 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -716,10 +716,10 @@ static int queue_dma(struct usba_udc *udc, struct usba_ep 
*ep,
req->using_dma = 1;
req->ctrl = USBA_BF(DMA_BUF_LEN, req->req.length)
| USBA_DMA_CH_EN | USBA_DMA_END_BUF_IE
-   | USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
+   | USBA_DMA_END_BUF_EN;
 
-   if (ep->is_in)
-   req->ctrl |= USBA_DMA_END_BUF_EN;
+   if (!ep->is_in)
+   req->ctrl |= USBA_DMA_END_TR_EN | USBA_DMA_END_TR_IE;
 
/*
 * Add this request to the queue and submit for DMA if
-- 
2.1.0.24.g4109c28

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


[PATCH 2/2] USB: gadget: udc: atmel: fix possible IN hang issue

2014-12-17 Thread Bo Shen
When receive data, the RXRDY in status register set by hardware
after a new packet has been stored in the endpoint FIFO. When it
is copied from FIFO, this bit is cleared which make the FIFO can
be accessed again.

In the receive_data() function, this bit RXRDY has been cleared.
So, after the receive_data() function return, this bit should
not be cleared again, or else it may cause the accessing FIFO
corrupt, which will make the data loss.

Signed-off-by: Bo Shen 
---

 drivers/usb/gadget/udc/atmel_usba_udc.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 63e90f5..93328ea 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1563,7 +1563,6 @@ static void usba_ep_irq(struct usba_udc *udc, struct 
usba_ep *ep)
if ((epstatus & epctrl) & USBA_RX_BK_RDY) {
DBG(DBG_BUS, "%s: RX data ready\n", ep->ep.name);
receive_data(ep);
-   usba_ep_writel(ep, CLR_STA, USBA_RX_BK_RDY);
}
 }
 
-- 
2.1.0.24.g4109c28

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


Re: [PATCH v3 0/5] usb: atmel_usba_udc: Rework errata handling

2015-01-12 Thread Bo Shen

Hi Boris,

On 01/12/2015 06:57 PM, Boris Brezillon wrote:

Hello,

Here is a set of patches porting existing at91sam9rl erratum handling to
DT and adding new code to handle at91sam9g45/9x5 erratum.
It also adds several compatible strings to differentiate those errata.

These patches should be backported to 3.17 and 3.18 stable releases but
they do not apply cleanly on those stable branches.
I'll send a backport of this series once it is merged in mainline.

Regards,

Boris

Changes since v2:
- remove UTF8 character in commit message of patch 2

Changes since v1:
- cache INT_ENB value to speedup INT_ENB read operations


For the whole series, test OK on at91sam9m10g45ek board with mass 
storage gadget, test OK on sama5d36ek with serial gadget.


Tested-by: Bo Shen 


Boris Brezillon (5):
   usb: atmel_usba_udc: Rework at91sam9rl errata handling
   usb: atmel_usba_udc: Add at91sam9g45 and at91sam9x5 errata handling
   ARM: at91/dt: update udc compatible strings
   usb: atmel_usba_udc: Mask status with enabled irqs
   usb: gadget: atmel_usba: Cache INT_ENB register value

  .../devicetree/bindings/usb/atmel-usb.txt  |   5 +-
  arch/arm/boot/dts/at91sam9g45.dtsi |   2 +-
  arch/arm/boot/dts/at91sam9x5.dtsi  |   2 +-
  arch/arm/boot/dts/sama5d3.dtsi |   2 +-
  arch/arm/boot/dts/sama5d4.dtsi |   2 +-
  drivers/usb/gadget/udc/atmel_usba_udc.c| 146 +
  drivers/usb/gadget/udc/atmel_usba_udc.h|   9 ++
  7 files changed, 111 insertions(+), 57 deletions(-)



Best Regards,
Bo Shen
--
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/3] ARM: at91: at91sam9n12ek: enable usb gadget support

2015-02-09 Thread Bo Shen
This patch series enable the usb gadget support on at91sam9n12ek
board. On at91sam9n12 SoC which integrate the full speed udc device.


Bo Shen (3):
  USB: gadget: at91_udc: add at91sam9n12 support
  ARM: at91: dt: at91sam9n12: add udp device node
  ARM: at91: dt: at91sam9n12ek: enable udp

 arch/arm/boot/dts/at91sam9n12.dtsi  | 9 +
 arch/arm/boot/dts/at91sam9n12ek.dts | 5 +
 drivers/usb/gadget/udc/at91_udc.c   | 9 ++---
 3 files changed, 20 insertions(+), 3 deletions(-)

-- 
2.3.0.rc0

--
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/3] ARM: at91: dt: at91sam9n12ek: enable udp

2015-02-09 Thread Bo Shen
Enable usb device port on at91sam9n12ek board.

Signed-off-by: Bo Shen 
---

 arch/arm/boot/dts/at91sam9n12ek.dts | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts 
b/arch/arm/boot/dts/at91sam9n12ek.dts
index 13bb24e..3e572e5 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -120,6 +120,11 @@
};
};
 
+   usb1: gadget@f803c000 {
+   atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+   };
+
watchdog@fe40 {
status = "okay";
};
-- 
2.3.0.rc0

--
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/3] ARM: at91: dt: at91sam9n12: add udp device node

2015-02-09 Thread Bo Shen
Add usb device node for at91sam9n12.

Signed-off-by: Bo Shen 
---

 arch/arm/boot/dts/at91sam9n12.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi 
b/arch/arm/boot/dts/at91sam9n12.dtsi
index 68eb9ad..6120e03 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -901,6 +901,15 @@
clocks = <&pwm_clk>;
status = "disabled";
};
+
+   usb1: gadget@f803c000 {
+   compatible = "atmel,at91rm9200-udc";
+   reg = <0xf803c000 0x4000>;
+   interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>;
+   clocks = <&usb>, <&udphs_clk>, <&udpck>;
+   clock-names = "usb_clk", "udc_clk", "udpck";
+   status = "disabled";
+   };
};
 
nand0: nand@4000 {
-- 
2.3.0.rc0

--
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/3] USB: gadget: at91_udc: add at91sam9n12 support

2015-02-09 Thread Bo Shen
Add at91sam9n12 SoC support.

Signed-off-by: Bo Shen 
---

 drivers/usb/gadget/udc/at91_udc.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/at91_udc.c 
b/drivers/usb/gadget/udc/at91_udc.c
index c862656..f4c785f 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -931,7 +931,8 @@ static void pullup(struct at91_udc *udc, int is_on)
at91_udp_write(udc, AT91_UDP_TXVC, 0);
if (cpu_is_at91rm9200())
gpio_set_value(udc->board.pullup_pin, active);
-   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || 
cpu_is_at91sam9g20()) {
+   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() ||
+cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) {
u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);
 
txvc |= AT91_UDP_TXVC_PUON;
@@ -949,7 +950,8 @@ static void pullup(struct at91_udc *udc, int is_on)
at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
if (cpu_is_at91rm9200())
gpio_set_value(udc->board.pullup_pin, !active);
-   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || 
cpu_is_at91sam9g20()) {
+   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() ||
+cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) {
u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);
 
txvc &= ~AT91_UDP_TXVC_PUON;
@@ -1758,7 +1760,8 @@ static int at91udc_probe(struct platform_device *pdev)
}
 
/* newer chips have more FIFO memory than rm9200 */
-   if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) {
+   if (cpu_is_at91sam9260() || cpu_is_at91sam9g20() ||
+   cpu_is_at91sam9n12()) {
udc->ep[0].maxpacket = 64;
udc->ep[3].maxpacket = 64;
udc->ep[4].maxpacket = 512;
-- 
2.3.0.rc0

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


Re: [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp

2015-02-09 Thread Bo Shen

Hi Sylvain,

On 02/09/2015 06:04 PM, Sylvain Rochet wrote:

Hello Bo,

On Mon, Feb 09, 2015 at 05:02:52PM +0800, Bo Shen wrote:

Enable usb device port on at91sam9n12ek board.

Signed-off-by: Bo Shen 
---

  arch/arm/boot/dts/at91sam9n12ek.dts | 5 +
  1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts 
b/arch/arm/boot/dts/at91sam9n12ek.dts
index 13bb24e..3e572e5 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -120,6 +120,11 @@
};
};

+   usb1: gadget@f803c000 {
+   atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+   };
+


There is an external resistor divider on PB16, acting like a pull-down
(R22+R23). PB16 reset state is input, pull-up, schmitt trigger, you need
to disable the pull-up in pinctrl this way:

usb1: gadget@f803c000 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_board_usb1>;
…
}

pinctrl … {
usb1 {
pinctrl_board_usb1: usb1-board {
atmel,pins = ;/* PB16, no pull up and deglitch */
};
};
};


Thanks.

I will add it in next version.



Sylvain



Best Regards,
Bo Shen

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


Re: [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support

2015-02-09 Thread Bo Shen

Hi Alexandre,

On 02/09/2015 07:14 PM, Alexandre Belloni wrote:

Hi Bo,

On 09/02/2015 at 17:02:50 +0800, Bo Shen wrote :

Add at91sam9n12 SoC support.

Signed-off-by: Bo Shen 
---

  drivers/usb/gadget/udc/at91_udc.c | 9 ++---
  1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/gadget/udc/at91_udc.c 
b/drivers/usb/gadget/udc/at91_udc.c
index c862656..f4c785f 100644
--- a/drivers/usb/gadget/udc/at91_udc.c
+++ b/drivers/usb/gadget/udc/at91_udc.c
@@ -931,7 +931,8 @@ static void pullup(struct at91_udc *udc, int is_on)
at91_udp_write(udc, AT91_UDP_TXVC, 0);
if (cpu_is_at91rm9200())
gpio_set_value(udc->board.pullup_pin, active);
-   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || 
cpu_is_at91sam9g20()) {
+   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() ||
+cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) {


cpu_is_at91xx have been removed from the kernel, using the correct
compatible should be enough, see
http://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/drivers/usb/gadget/udc/at91_udc.c?id=f0bceab4e3b528e799aba8fda8d2936fcfd41f1f


Thanks for you information. Missing this patch, check the next-20150209, 
it is here. I will base on next-20150209, so this patch no need anymore, 
only need to change the dts(i) file now.


Thanks again.




u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);

txvc |= AT91_UDP_TXVC_PUON;
@@ -949,7 +950,8 @@ static void pullup(struct at91_udc *udc, int is_on)
at91_udp_write(udc, AT91_UDP_TXVC, AT91_UDP_TXVC_TXVDIS);
if (cpu_is_at91rm9200())
gpio_set_value(udc->board.pullup_pin, !active);
-   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() || 
cpu_is_at91sam9g20()) {
+   else if (cpu_is_at91sam9260() || cpu_is_at91sam9263() ||
+cpu_is_at91sam9g20() || cpu_is_at91sam9n12()) {
u32 txvc = at91_udp_read(udc, AT91_UDP_TXVC);

txvc &= ~AT91_UDP_TXVC_PUON;
@@ -1758,7 +1760,8 @@ static int at91udc_probe(struct platform_device *pdev)
}

/* newer chips have more FIFO memory than rm9200 */
-   if (cpu_is_at91sam9260() || cpu_is_at91sam9g20()) {
+   if (cpu_is_at91sam9260() || cpu_is_at91sam9g20() ||
+   cpu_is_at91sam9n12()) {
udc->ep[0].maxpacket = 64;
udc->ep[3].maxpacket = 64;
udc->ep[4].maxpacket = 512;
--
2.3.0.rc0


Best Regards,
Bo Shen

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


[PATCH v2 1/2] ARM: at91: dt: at91sam9n12: add udp device node

2015-02-09 Thread Bo Shen
Add usb device node for at91sam9n12.

Signed-off-by: Bo Shen 
---

Changes in v2: None

 arch/arm/boot/dts/at91sam9n12.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9n12.dtsi 
b/arch/arm/boot/dts/at91sam9n12.dtsi
index c2666a7..e1b6f0b 100644
--- a/arch/arm/boot/dts/at91sam9n12.dtsi
+++ b/arch/arm/boot/dts/at91sam9n12.dtsi
@@ -913,6 +913,15 @@
clocks = <&pwm_clk>;
status = "disabled";
};
+
+   usb1: gadget@f803c000 {
+   compatible = "atmel,at91sam9260-udc";
+   reg = <0xf803c000 0x4000>;
+   interrupts = <23 IRQ_TYPE_LEVEL_HIGH 2>;
+   clocks = <&udphs_clk>, <&udpck>;
+   clock-names = "pclk", "hclk";
+   status = "disabled";
+   };
};
 
nand0: nand@4000 {
-- 
2.3.0.rc0

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


[PATCH v2 2/2] ARM: at91: dt: at91sam9n12ek: enable udp

2015-02-09 Thread Bo Shen
Enable usb device port on at91sam9n12ek board.

Signed-off-by: Bo Shen 
---

Changes in v2:
  - Add pinctrl for usb1 vbus sense.

 arch/arm/boot/dts/at91sam9n12ek.dts | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/at91sam9n12ek.dts 
b/arch/arm/boot/dts/at91sam9n12ek.dts
index 9575c0d..6123109 100644
--- a/arch/arm/boot/dts/at91sam9n12ek.dts
+++ b/arch/arm/boot/dts/at91sam9n12ek.dts
@@ -108,6 +108,13 @@
;
};
};
+
+   usb1 {
+   pinctrl_usb1_vbus_sense: 
usb1_vbus_sense {
+   atmel,pins =
+   ;  /* PB16 gpio usb vbus sense, no pull 
up and deglitch */
+   };
+   };
};
 
spi0: spi@f000 {
@@ -120,6 +127,13 @@
};
};
 
+   usb1: gadget@f803c000 {
+   pinctrl-names = "default";
+   pinctrl-0 = <&pinctrl_usb1_vbus_sense>;
+   atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
+   status = "okay";
+   };
+
watchdog@fe40 {
status = "okay";
};
-- 
2.3.0.rc0

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


[PATCH v2 0/2] ARM: at91: dt: at91sam9n12ek: enable udp device

2015-02-09 Thread Bo Shen
This patch series enable usb device support on at91sam9n12ek board.

Changes in v2:
  - Base on next-20150209 (so, remove the modification of udc driver).
  - Add pinctrl for usb1 vbus sense.

Bo Shen (2):
  ARM: at91: dt: at91sam9n12: add udp device node
  ARM: at91: dt: at91sam9n12ek: enable udp

 arch/arm/boot/dts/at91sam9n12.dtsi  |  9 +
 arch/arm/boot/dts/at91sam9n12ek.dts | 14 ++
 2 files changed, 23 insertions(+)

-- 
2.3.0.rc0

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


Re: [PATCH v2 0/2] ARM: at91: dt: at91sam9n12ek: enable udp device

2015-03-02 Thread Bo Shen

Hi Nicolas,

On 02/10/2015 09:55 AM, Bo Shen wrote:

This patch series enable usb device support on at91sam9n12ek board.

Changes in v2:
   - Base on next-20150209 (so, remove the modification of udc driver).
   - Add pinctrl for usb1 vbus sense.

Bo Shen (2):
   ARM: at91: dt: at91sam9n12: add udp device node
   ARM: at91: dt: at91sam9n12ek: enable udp


Any comments for this patch series? (aka ping?)


  arch/arm/boot/dts/at91sam9n12.dtsi  |  9 +
  arch/arm/boot/dts/at91sam9n12ek.dts | 14 ++
  2 files changed, 23 insertions(+)



Best Regards,
Bo Shen
--
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