* [PATCH 0/3] ARM: at91: at91sam9n12ek: enable usb gadget support
@ 2015-02-09 9:02 Bo Shen
2015-02-09 9:02 ` [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support Bo Shen
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Bo Shen @ 2015-02-09 9:02 UTC (permalink / raw)
To: linux-arm-kernel
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
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support 2015-02-09 9:02 [PATCH 0/3] ARM: at91: at91sam9n12ek: enable usb gadget support Bo Shen @ 2015-02-09 9:02 ` Bo Shen 2015-02-09 11:14 ` Alexandre Belloni 2015-02-09 9:02 ` [PATCH 2/3] ARM: at91: dt: at91sam9n12: add udp device node Bo Shen 2015-02-09 9:02 ` [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp Bo Shen 2 siblings, 1 reply; 8+ messages in thread From: Bo Shen @ 2015-02-09 9:02 UTC (permalink / raw) To: linux-arm-kernel Add at91sam9n12 SoC support. Signed-off-by: Bo Shen <voice.shen@atmel.com> --- 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 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support 2015-02-09 9:02 ` [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support Bo Shen @ 2015-02-09 11:14 ` Alexandre Belloni 2015-02-10 1:25 ` Bo Shen 0 siblings, 1 reply; 8+ messages in thread From: Alexandre Belloni @ 2015-02-09 11:14 UTC (permalink / raw) To: linux-arm-kernel Hi Bo, On 09/02/2015 at 17:02:50 +0800, Bo Shen wrote : > Add at91sam9n12 SoC support. > > Signed-off-by: Bo Shen <voice.shen@atmel.com> > --- > > 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 > 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 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel at lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support 2015-02-09 11:14 ` Alexandre Belloni @ 2015-02-10 1:25 ` Bo Shen 0 siblings, 0 replies; 8+ messages in thread From: Bo Shen @ 2015-02-10 1:25 UTC (permalink / raw) To: linux-arm-kernel 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 <voice.shen@atmel.com> >> --- >> >> 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] ARM: at91: dt: at91sam9n12: add udp device node 2015-02-09 9:02 [PATCH 0/3] ARM: at91: at91sam9n12ek: enable usb gadget support Bo Shen 2015-02-09 9:02 ` [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support Bo Shen @ 2015-02-09 9:02 ` Bo Shen 2015-02-09 9:02 ` [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp Bo Shen 2 siblings, 0 replies; 8+ messages in thread From: Bo Shen @ 2015-02-09 9:02 UTC (permalink / raw) To: linux-arm-kernel Add usb device node for at91sam9n12. Signed-off-by: Bo Shen <voice.shen@atmel.com> --- 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 at 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 at 40000000 { -- 2.3.0.rc0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp 2015-02-09 9:02 [PATCH 0/3] ARM: at91: at91sam9n12ek: enable usb gadget support Bo Shen 2015-02-09 9:02 ` [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support Bo Shen 2015-02-09 9:02 ` [PATCH 2/3] ARM: at91: dt: at91sam9n12: add udp device node Bo Shen @ 2015-02-09 9:02 ` Bo Shen 2015-02-09 10:04 ` Sylvain Rochet 2 siblings, 1 reply; 8+ messages in thread From: Bo Shen @ 2015-02-09 9:02 UTC (permalink / raw) To: linux-arm-kernel Enable usb device port on at91sam9n12ek board. Signed-off-by: Bo Shen <voice.shen@atmel.com> --- 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 at f803c000 { + atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>; + status = "okay"; + }; + watchdog at fffffe40 { status = "okay"; }; -- 2.3.0.rc0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp 2015-02-09 9:02 ` [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp Bo Shen @ 2015-02-09 10:04 ` Sylvain Rochet 2015-02-09 10:23 ` Bo Shen 0 siblings, 1 reply; 8+ messages in thread From: Sylvain Rochet @ 2015-02-09 10:04 UTC (permalink / raw) To: linux-arm-kernel 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 <voice.shen@atmel.com> > --- > > 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 at 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 at f803c000 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_board_usb1>; ? } pinctrl ? { usb1 { pinctrl_board_usb1: usb1-board { atmel,pins = <AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PB16, no pull up and deglitch */ }; }; }; Sylvain ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp 2015-02-09 10:04 ` Sylvain Rochet @ 2015-02-09 10:23 ` Bo Shen 0 siblings, 0 replies; 8+ messages in thread From: Bo Shen @ 2015-02-09 10:23 UTC (permalink / raw) To: linux-arm-kernel 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 <voice.shen@atmel.com> >> --- >> >> 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 at 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 at f803c000 { > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_board_usb1>; > ? > } > > pinctrl ? { > usb1 { > pinctrl_board_usb1: usb1-board { > atmel,pins = <AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>; /* PB16, no pull up and deglitch */ > }; > }; > }; Thanks. I will add it in next version. > > Sylvain > Best Regards, Bo Shen ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-02-10 1:25 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-02-09 9:02 [PATCH 0/3] ARM: at91: at91sam9n12ek: enable usb gadget support Bo Shen 2015-02-09 9:02 ` [PATCH 1/3] USB: gadget: at91_udc: add at91sam9n12 support Bo Shen 2015-02-09 11:14 ` Alexandre Belloni 2015-02-10 1:25 ` Bo Shen 2015-02-09 9:02 ` [PATCH 2/3] ARM: at91: dt: at91sam9n12: add udp device node Bo Shen 2015-02-09 9:02 ` [PATCH 3/3] ARM: at91: dt: at91sam9n12ek: enable udp Bo Shen 2015-02-09 10:04 ` Sylvain Rochet 2015-02-09 10:23 ` Bo Shen
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox