mbox

[0/7,v4] ARM: at91: dt: add USBA support

Message ID 20130520162149.GC9937@game.jcrosoft.org
State New
Headers show

Pull-request

git://github.com/at91linux/linux-at91.git j/for-3.11-usba

Message

Jean-Christophe PLAGNIOL-VILLARD May 20, 2013, 4:21 p.m. UTC
HI,

	v4:
	fix multi instance support

	v3:
	rebase againt 3.10-rc1 + dt macro cleanup

	This patch serie finish to add the usb device support to dt for at91
	with the usba support present on the last at91 generation since sam9g45

The following changes since commit b3f442b0eedbc20b5ce3f4a96530588d14901199:

  ARM: at91: udpate defconfigs (2013-05-17 15:05:08 +0200)

are available in the git repository at:

  git://github.com/at91linux/linux-at91.git j/for-3.11-usba

for you to fetch changes up to 910026a08e2c2205953f2507cc11f4822998989b:

  ARM: at91: sam9m10g45ek add udc DT support (2013-05-20 23:52:17 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (7):
      USB: gadget: atmel_usba: move global struct usba_ep usba_ep to struct usba_udc
      USB: gadget: atmel_usba: allow multi instance
      USB: gadget: atmel_usba: add DT support
      ARM: at91: sam9x5 add udc DT support
      ARM: at91: sam9x5ek add udc DT support
      ARM: at91: sam9g45 add udc DT support
      ARM: at91: sam9m10g45ek add udc DT support

 Documentation/devicetree/bindings/usb/atmel-usb.txt |   82 ++++++++++++++++++++++++++++++
 arch/arm/boot/dts/at91sam9g45.dtsi                  |   62 +++++++++++++++++++++++
 arch/arm/boot/dts/at91sam9m10g45ek.dts              |    5 ++
 arch/arm/boot/dts/at91sam9x5.dtsi                   |   62 +++++++++++++++++++++++
 arch/arm/boot/dts/at91sam9x5ek.dtsi                 |    5 ++
 arch/arm/mach-at91/at91sam9g45.c                    |    2 +
 arch/arm/mach-at91/at91sam9x5.c                     |    2 +
 drivers/usb/gadget/Kconfig                          |    2 +-
 drivers/usb/gadget/atmel_usba_udc.c                 |  264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
 drivers/usb/gadget/atmel_usba_udc.h                 |    2 +
 10 files changed, 407 insertions(+), 81 deletions(-)

Best Regards,
J.

Comments

Bo Shen May 23, 2013, 2:23 a.m. UTC | #1
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 <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: linux-usb@vger.kernel.org

For this series, test OK on at91sam9m10g45ek and at91sam9x5ek board
Tested-by: Bo Shen <voice.shen@atmel.com>

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
Jean-Christophe PLAGNIOL-VILLARD May 23, 2013, 8:45 a.m. UTC | #2
Hi Felipe,

	if it's ok with you I send the patch series via at91
	with the DT

Best Regards,
J.
On 18:21 Mon 20 May     , Jean-Christophe PLAGNIOL-VILLARD wrote:
> HI,
> 
> 	v4:
> 	fix multi instance support
> 
> 	v3:
> 	rebase againt 3.10-rc1 + dt macro cleanup
> 
> 	This patch serie finish to add the usb device support to dt for at91
> 	with the usba support present on the last at91 generation since sam9g45
> 
> The following changes since commit b3f442b0eedbc20b5ce3f4a96530588d14901199:
> 
>   ARM: at91: udpate defconfigs (2013-05-17 15:05:08 +0200)
> 
> are available in the git repository at:
> 
>   git://github.com/at91linux/linux-at91.git j/for-3.11-usba
> 
> for you to fetch changes up to 910026a08e2c2205953f2507cc11f4822998989b:
> 
>   ARM: at91: sam9m10g45ek add udc DT support (2013-05-20 23:52:17 +0800)
> 
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (7):
>       USB: gadget: atmel_usba: move global struct usba_ep usba_ep to struct usba_udc
>       USB: gadget: atmel_usba: allow multi instance
>       USB: gadget: atmel_usba: add DT support
>       ARM: at91: sam9x5 add udc DT support
>       ARM: at91: sam9x5ek add udc DT support
>       ARM: at91: sam9g45 add udc DT support
>       ARM: at91: sam9m10g45ek add udc DT support
> 
>  Documentation/devicetree/bindings/usb/atmel-usb.txt |   82 ++++++++++++++++++++++++++++++
>  arch/arm/boot/dts/at91sam9g45.dtsi                  |   62 +++++++++++++++++++++++
>  arch/arm/boot/dts/at91sam9m10g45ek.dts              |    5 ++
>  arch/arm/boot/dts/at91sam9x5.dtsi                   |   62 +++++++++++++++++++++++
>  arch/arm/boot/dts/at91sam9x5ek.dtsi                 |    5 ++
>  arch/arm/mach-at91/at91sam9g45.c                    |    2 +
>  arch/arm/mach-at91/at91sam9x5.c                     |    2 +
>  drivers/usb/gadget/Kconfig                          |    2 +-
>  drivers/usb/gadget/atmel_usba_udc.c                 |  264 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
>  drivers/usb/gadget/atmel_usba_udc.h                 |    2 +
>  10 files changed, 407 insertions(+), 81 deletions(-)
> 
> Best Regards,
> J.
> _______________________________________________
> devicetree-discuss mailing list
> devicetree-discuss@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/devicetree-discuss
Nicolas Ferre May 23, 2013, 10:22 a.m. UTC | #3
On 23/05/2013 04:23, 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 <plagnioj@jcrosoft.com>
>> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Cc: linux-usb@vger.kernel.org
>
> For this series, test OK on at91sam9m10g45ek and at91sam9x5ek board
> Tested-by: Bo Shen <voice.shen@atmel.com>

After reading this v4 series, it seems good. So, on the whole series:

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

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

Thanks a lot to you, Bo and Jean-Christophe.

Bye,
Felipe Balbi May 23, 2013, 6:46 p.m. UTC | #4
On Mon, May 20, 2013 at 06:25:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> drop static struct usba_udc the_udc
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: linux-usb@vger.kernel.org

Acked-by: Felipe Balbi <balbi@ti.com>

> ---
>  drivers/usb/gadget/atmel_usba_udc.c |   36 +++++++++++++++++------------------
>  1 file changed, 18 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
> index d2ffd04..eea57a3 100644
> --- a/drivers/usb/gadget/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/atmel_usba_udc.c
> @@ -27,9 +27,6 @@
>  
>  #include "atmel_usba_udc.h"
>  
> -
> -static struct usba_udc the_udc;
> -
>  #ifdef CONFIG_USB_GADGET_DEBUG_FS
>  #include <linux/debugfs.h>
>  #include <linux/uaccess.h>
> @@ -1013,16 +1010,13 @@ static void nop_release(struct device *dev)
>  
>  }
>  
> -static struct usba_udc the_udc = {
> -	.gadget	= {
> -		.ops		= &usba_udc_ops,
> -		.ep_list	= LIST_HEAD_INIT(the_udc.gadget.ep_list),
> -		.max_speed	= USB_SPEED_HIGH,
> -		.name		= "atmel_usba_udc",
> -		.dev	= {
> -			.init_name	= "gadget",
> -			.release	= nop_release,
> -		},
> +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,
>  	},
>  };
>  
> @@ -1839,10 +1833,17 @@ static int __init usba_udc_probe(struct platform_device *pdev)
>  	struct usba_platform_data *pdata = pdev->dev.platform_data;
>  	struct resource *regs, *fifo;
>  	struct clk *pclk, *hclk;
> -	struct usba_udc *udc = &the_udc;
> +	struct usba_udc *udc;
>  	static struct usba_ep *usba_ep;
>  	int irq, ret, i;
>  
> +	udc = devm_kzalloc(&pdev->dev, sizeof(*udc), GFP_KERNEL);
> +	if (!udc)
> +		return -ENOMEM;
> +
> +	udc->gadget = usba_gadget_template;
> +	INIT_LIST_HEAD(&udc->gadget.ep_list);
> +
>  	regs = platform_get_resource(pdev, IORESOURCE_MEM, CTRL_IOMEM_ID);
>  	fifo = platform_get_resource(pdev, IORESOURCE_MEM, FIFO_IOMEM_ID);
>  	if (!regs || !fifo || !pdata)
> @@ -1897,8 +1898,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
>  		goto err_alloc_ep;
>  
>  	udc->usba_ep = usba_ep;
> -
> -	the_udc.gadget.ep0 = &usba_ep[0].ep;
> +	udc->gadget.ep0 = &usba_ep[0].ep;
>  
>  	INIT_LIST_HEAD(&usba_ep[0].ep.ep_list);
>  	usba_ep[0].ep_regs = udc->regs + USBA_EPT_BASE(0);
> @@ -1907,7 +1907,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
>  	usba_ep[0].ep.ops = &usba_ep_ops;
>  	usba_ep[0].ep.name = pdata->ep[0].name;
>  	usba_ep[0].ep.maxpacket = pdata->ep[0].fifo_size;
> -	usba_ep[0].udc = &the_udc;
> +	usba_ep[0].udc = udc;
>  	INIT_LIST_HEAD(&usba_ep[0].queue);
>  	usba_ep[0].fifo_size = pdata->ep[0].fifo_size;
>  	usba_ep[0].nr_banks = pdata->ep[0].nr_banks;
> @@ -1924,7 +1924,7 @@ static int __init usba_udc_probe(struct platform_device *pdev)
>  		ep->ep.ops = &usba_ep_ops;
>  		ep->ep.name = pdata->ep[i].name;
>  		ep->ep.maxpacket = pdata->ep[i].fifo_size;
> -		ep->udc = &the_udc;
> +		ep->udc = udc;
>  		INIT_LIST_HEAD(&ep->queue);
>  		ep->fifo_size = pdata->ep[i].fifo_size;
>  		ep->nr_banks = pdata->ep[i].nr_banks;
> -- 
> 1.7.10.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi May 23, 2013, 6:47 p.m. UTC | #5
On Mon, May 20, 2013 at 06:25:54PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> so we can have multiple usb gadget instance
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: linux-usb@vger.kernel.org

Acked-by: Felipe Balbi <balbi@ti.com>
Felipe Balbi May 23, 2013, 6:47 p.m. UTC | #6
On Mon, May 20, 2013 at 06:25:56PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Allow to compile the driver all the time if AT91 enabled.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: linux-usb@vger.kernel.org

Acked-by: Felipe Balbi <balbi@ti.com>