RE: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread Felipe Balbi

Hi Gil,

Gil Weber  writes:
>>> To make sure, I have also performed some additional tests. The problem
>>> seems unrelated to the gadget being used: I have tried various
>>> combinations (zero, ethernet, etc.), even setting up an ACM device
>>> using configfs, and the result is the same: a host detects the device
>>> for a brief moment, but nothing after that.
>>
>>Odd. At Gil (now in Cc) has at91 working for him on his board. Gil, care
>>to confirm ?
>
> Just to confirm, ethernet gadget is working on my board with kernel 4.4...
> I haven't notice any issue since I applied the patch you gave me. 
> I have also tried 4.5.

Thanks for confirming ;-)

-- 
balbi


signature.asc
Description: PGP signature


RE: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread Gil Weber
Hi,

>> To make sure, I have also performed some additional tests. The problem
>> seems unrelated to the gadget being used: I have tried various
>> combinations (zero, ethernet, etc.), even setting up an ACM device
>> using configfs, and the result is the same: a host detects the device
>> for a brief moment, but nothing after that.
>
>Odd. At Gil (now in Cc) has at91 working for him on his board. Gil, care
>to confirm ?

Just to confirm, ethernet gadget is working on my board with kernel 4.4...
I haven't notice any issue since I applied the patch you gave me. 
I have also tried 4.5.

Regards,
Gil

--
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: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread Felipe Balbi

Hi,

JB  writes:
>>> To make sure, I have also performed some additional tests. The problem
>>> seems unrelated to the gadget being used: I have tried various
>>> combinations (zero, ethernet, etc.), even setting up an ACM device
>>> using configfs, and the result is the same: a host detects the device
>>> for a brief moment, but nothing after that.
>>
>> Odd. At Gil (now in Cc) has at91 working for him on his board. Gil, care
>> to confirm ?
>
> Since this is a SAMA5D31 device, it uses atmel_usba_udc instead of at91_udc.

yeah, my bad. That's the one Gil's using too ;-)

> And thank you, I will try your suggestions later today.

no problem.

-- 
balbi


signature.asc
Description: PGP signature


Re: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread JB
Hello,

>> To make sure, I have also performed some additional tests. The problem
>> seems unrelated to the gadget being used: I have tried various
>> combinations (zero, ethernet, etc.), even setting up an ACM device
>> using configfs, and the result is the same: a host detects the device
>> for a brief moment, but nothing after that.
>
> Odd. At Gil (now in Cc) has at91 working for him on his board. Gil, care
> to confirm ?

Since this is a SAMA5D31 device, it uses atmel_usba_udc instead of at91_udc.

And thank you, I will try your suggestions later today.

Bálint
--
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: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread Felipe Balbi

Hi,

JB  writes:
>> did you check that getty is still running ? That "deactivated" message
>> means that whatever had /dev/ttyGS0 opened, decided to close it. This
>> could mean that getty got a SIGHUP and just decided to close that fd.
>
> I have only briefly experimented with getty (I also tried opening the
> port with minicom). Would this even matter? Even if the serial port is
> not open, shouldn't the device be enumerated by its host?

yes and no ;-)

ACM might need a userspace component to implement, e.g. AT command
support. We shouldn't connect to host until that userspace component is
ready.

If you just want a serial console, then the generic serial (non-ACM) is
a better bet. Just load gserial with use_obex=0 use_acm=0:

# modprobe g_serial use_obex=0 use_acm=0

> To make sure, I have also performed some additional tests. The problem
> seems unrelated to the gadget being used: I have tried various
> combinations (zero, ethernet, etc.), even setting up an ACM device
> using configfs, and the result is the same: a host detects the device
> for a brief moment, but nothing after that.

Odd. At Gil (now in Cc) has at91 working for him on his board. Gil, care
to confirm ?

JB, I guess you need to add more debugging messages around at91
driver. Try to figure out if VBUS is dropping, or something crazy like
that. There's no reason for the gadget to just disconnect after
enumeration starting.

cheers

-- 
balbi


signature.asc
Description: PGP signature


Re: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread JB
Hello,

> did you check that getty is still running ? That "deactivated" message
> means that whatever had /dev/ttyGS0 opened, decided to close it. This
> could mean that getty got a SIGHUP and just decided to close that fd.

I have only briefly experimented with getty (I also tried opening the
port with minicom). Would this even matter? Even if the serial port is
not open, shouldn't the device be enumerated by its host?

To make sure, I have also performed some additional tests. The problem
seems unrelated to the gadget being used: I have tried various
combinations (zero, ethernet, etc.), even setting up an ACM device
using configfs, and the result is the same: a host detects the device
for a brief moment, but nothing after that.

Thanks,
Bálint
--
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: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread Felipe Balbi

Hi,

JB  writes:
> [ text/plain ]
>> IIRC ACM will only do anything after you open /dev/ttyGS0 on the
>> peripheral side. Are you running getty on ttyGS0 ?
>
> I did try that, that would explain why it appears only once.

did you check that getty is still running ? That "deactivated" message
means that whatever had /dev/ttyGS0 opened, decided to close it. This
could mean that getty got a SIGHUP and just decided to close that fd.

-- 
balbi


signature.asc
Description: PGP signature


Re: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-30 Thread JB
> IIRC ACM will only do anything after you open /dev/ttyGS0 on the
> peripheral side. Are you running getty on ttyGS0 ?

I did try that, that would explain why it appears only once.
--
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: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-29 Thread Felipe Balbi
JB  writes:
> Hello,
>
>> 4.5.0+, which patches do you have on top of 4.5 vanilla ?
>
> No code patches, just the configuration and dts file for the board.
>
>> Also, can you try this patch:
>
> I tried it, but the result is the same.
>
> Sometimes I can see another entry in the log:
>
> g_serial gadget: suspend
>
> And there is a single instance where this is followed by a few other entries:
>
> gadget: high-speed config #2: CDC ACM config
> gadget: reset acm control interface 0
> g_serial gadget: reset acm ttyGS0
> g_serial gadget: activate acm ttyGS0
> g_serial gadget: acm ttyGS0 serial state 
> g_serial gadget: non-core control reqa1.21 v i l7
> g_serial gadget: acm ttyGS0 reqa1.21 v i l7
> g_serial gadget: non-core control req21.22 v i l0
> g_serial gadget: acm ttyGS0 req21.22 v i l0
> g_serial gadget: non-core control req21.20 v i l7
> g_serial gadget: acm ttyGS0 req21.20 v i l7
> g_serial gadget: non-core control reqa1.21 v i l7
> g_serial gadget: acm ttyGS0 reqa1.21 v i l7
> g_serial gadget: reset config
> g_serial gadget: acm ttyGS0 deactivated
>
> Any other leads?

IIRC ACM will only do anything after you open /dev/ttyGS0 on the
peripheral side. Are you running getty on ttyGS0 ?

-- 
balbi


signature.asc
Description: PGP signature


Re: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-29 Thread JB
Hello,

> 4.5.0+, which patches do you have on top of 4.5 vanilla ?

No code patches, just the configuration and dts file for the board.

> Also, can you try this patch:

I tried it, but the result is the same.

Sometimes I can see another entry in the log:

g_serial gadget: suspend

And there is a single instance where this is followed by a few other entries:

gadget: high-speed config #2: CDC ACM config
gadget: reset acm control interface 0
g_serial gadget: reset acm ttyGS0
g_serial gadget: activate acm ttyGS0
g_serial gadget: acm ttyGS0 serial state 
g_serial gadget: non-core control reqa1.21 v i l7
g_serial gadget: acm ttyGS0 reqa1.21 v i l7
g_serial gadget: non-core control req21.22 v i l0
g_serial gadget: acm ttyGS0 req21.22 v i l0
g_serial gadget: non-core control req21.20 v i l7
g_serial gadget: acm ttyGS0 req21.20 v i l7
g_serial gadget: non-core control reqa1.21 v i l7
g_serial gadget: acm ttyGS0 reqa1.21 v i l7
g_serial gadget: reset config
g_serial gadget: acm ttyGS0 deactivated

Any other leads?

Thanks,
Bálint
--
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: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-28 Thread Felipe Balbi

Hi,

(please, don't top-post)

JB  writes:
> [ text/plain ]
> But that's it. On the host side, the device is detected for a brief
> moment - I managed to get the device info, and it looks like the real
> deal:
>
> Gadget Serial v2.4:
>Product ID: 0xa4a7
>Vendor ID: 0x0525  (PLX Technology, Inc.)
>Version: 4.05
>Speed: Up to 480 Mb/sec
>Manufacturer: Linux 4.5.0+ with atmel_usba_udc

4.5.0+, which patches do you have on top of 4.5 vanilla ?

Also, can you try this patch:

commit d0211ef4d96e1faf8939af6b171e47e6d85e31b2
Author: Felipe Balbi 
Date:   Mon Mar 21 09:04:23 2016 +0200

usb: gadget: udc: atmel: don't disable enpdoints we don't own

UDC driver should NEVER do anything behind
udc-core's back, so let's stop disabling endpoints
we don't exactly own - rather we provide as
resources for gadget drivers. This fixes the
regression reported by Gil.

Reported-by: Gil Weber 
Tested-by: Gil Weber 
Signed-off-by: Felipe Balbi 

diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c 
b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 81d42cce885a..18569de06b04 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1045,20 +1045,6 @@ static void reset_all_endpoints(struct usba_udc *udc)
list_del_init(&req->queue);
request_complete(ep, req, -ECONNRESET);
}
-
-   /* NOTE:  normally, the next call to the gadget driver is in
-* charge of disabling endpoints... usually disconnect().
-* The exception would be entering a high speed test mode.
-*
-* FIXME remove this code ... and retest thoroughly.
-*/
-   list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) {
-   if (ep->ep.desc) {
-   spin_unlock(&udc->lock);
-   usba_ep_disable(&ep->ep);
-   spin_lock(&udc->lock);
-   }
-   }
 }
 
 static struct usba_ep *get_ep_by_addr(struct usba_udc *udc, u16 wIndex)

-- 
balbi


signature.asc
Description: PGP signature


Re: Getting a gadget serial device working on Atmel SAMA5D31

2016-03-28 Thread JB
But that's it. On the host side, the device is detected for a brief
moment - I managed to get the device info, and it looks like the real
deal:

Gadget Serial v2.4:
   Product ID: 0xa4a7
   Vendor ID: 0x0525  (PLX Technology, Inc.)
   Version: 4.05
   Speed: Up to 480 Mb/sec
   Manufacturer: Linux 4.5.0+ with atmel_usba_udc
   Location ID: 0x1420 / 6
   Current Available (mA): 1000
   Extra Operating Current (mA): 0

But then it disappears completely. I have tried it on a Windows, a
Linux and a OS X machine to rule out a problem on the host side. I
have also tried it with the binary kernel the manufacturer provides,
but I couldn't even replicate this limited success I had. I have not
been able to figure out what I am doing wrong, so any help is
appreciated.

Thanks,
Bálint

2016-03-29 5:12 GMT+02:00 JB :
> Hello,
>
> I am trying to figure out how to get a g_serial device running on the
> Acme Acqua board built around the Atmel SAMA5D3. I am using an
> unmodified 4.5 kernel with a configuration and a dts file provided by
> Acme (originally for kernel version 4.4.5, but the problems I
> encountered appear to be the same on earlier versions). I have enabled
> gadget support and the serial gadget device using menuconfig,
> alongside CONFIG_USB_ATMEL_USBA. But it doesn't work.
>
> I have enabled the verbose debugging options and captured the
> following messages:
>
> atmel_usba_udc 50.gadget: MMIO registers at 0xf803 mapped at d08d8000
> atmel_usba_udc 50.gadget: FIFO at 0x0050 mapped at d220
> userial_init: registered 4 ttyGS* devices
> udc 50.gadget: registering UDC driver [g_serial]
> g_serial gadget: adding 'acm'/cfb53a00 to config 'CDC ACM config'/c0775adc
> g_serial gadget: acm ttyGS0: dual speed IN/ep1 OUT/ep2 NOTIFY/ep3
> g_serial gadget: Gadget Serial v2.4
> g_serial gadget: g_serial ready
> ...
--
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


Getting a gadget serial device working on Atmel SAMA5D31

2016-03-28 Thread JB
Hello,

I am trying to figure out how to get a g_serial device running on the
Acme Acqua board built around the Atmel SAMA5D3. I am using an
unmodified 4.5 kernel with a configuration and a dts file provided by
Acme (originally for kernel version 4.4.5, but the problems I
encountered appear to be the same on earlier versions). I have enabled
gadget support and the serial gadget device using menuconfig,
alongside CONFIG_USB_ATMEL_USBA. But it doesn't work.

I have enabled the verbose debugging options and captured the
following messages:

atmel_usba_udc 50.gadget: MMIO registers at 0xf803 mapped at d08d8000
atmel_usba_udc 50.gadget: FIFO at 0x0050 mapped at d220
userial_init: registered 4 ttyGS* devices
udc 50.gadget: registering UDC driver [g_serial]
g_serial gadget: adding 'acm'/cfb53a00 to config 'CDC ACM config'/c0775adc
g_serial gadget: acm ttyGS0: dual speed IN/ep1 OUT/ep2 NOTIFY/ep3
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
...
--
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