[PATCH v2 0/2] sunxi, usb: UDC/DM gadget model support

Sam Edwards cfsworks at gmail.com
Thu Apr 11 23:53:51 CEST 2024


On Thu, Apr 11, 2024 at 1:40 AM John Watts <contact at jookia.org> wrote:
>
> On Thu, Apr 11, 2024 at 12:52:14AM -0600, Sam Edwards wrote:
> > Hi John,
> >
> > This patch was developed against (and used very heavily on) the Turing
> > Pi 2, which has an Allwinner T113-s3 SoC. Likely it should work for
> > any T113/D1 board. I haven't been encountering any USB errors but also
> > my use case hasn't gone much beyond the `udc` command. What
> > device/errors do you have over there?
> >
> > Cheers,
> > Sam
>
> Hi Sam,
>
> I made a list of things that do work:
>
> - DFU (slowly, probably due to no DMA) to RAM
> - CDC serial console
>
> Running a command like this:
>
> ubi part ubi; ubifsmount ubi:root; ums 0 ubi 0;

Hi John,

Ahh I see the problem. In U-Boot, `ubi` isn't actually a block device:
it's implemented as a stub in the block layer, and the filesystem
layer redirects `ubi` accesses to the currently-mounted ubifs instead.
But the `ums` command works on the block layer, so it's not being
intercepted, and instead hitting that stub and likely crashing. In the
spirit of the Linux ubiblock driver, I have another patchset[1] I've
been working on[2] to expose static ubivols as true read-only block
devices. Note that this only works for static volumes: the access
semantics of dynamic volumes are too flash-like to support block
device access, so accessing them with `ums` likely will never work
like users expect.

Still, there could be some interaction issue between `ums`<->USB that
I haven't identified. Could you try with mmc (if available) or a
ramdisk (otherwise) just to confirm that `ums` is fine?

Regards,
Sam

[1] https://lore.kernel.org/u-boot/20230812000606.72319-1-CFSworks@gmail.com/T/
[2] Not very diligently; if you're interested in helping test it, I'd
love to get back to it.

>
> Gives this output in dmesg:
>
> [3633079.772330] usb-storage 1-1.1:1.0: USB Mass Storage device detected
> [3633079.772506] scsi host9: usb-storage 1-1.1:1.0
> [3633080.794607] scsi 9:0:0:0: Direct-Access     Linux    UMS disk 0       ffff PQ: 0 ANSI: 2
> [3633080.794941] sd 9:0:0:0: Attached scsi generic sg6 type 0
> [3633080.795214] sd 9:0:0:0: [sdg] 3942645758 512-byte logical blocks: (2.02 TB/1.83 TiB)
> [3633080.795220] sd 9:0:0:0: [sdg] 3925868545-byte physical blocks
> [3633080.795341] sd 9:0:0:0: [sdg] Write Protect is off
> [3633080.795345] sd 9:0:0:0: [sdg] Mode Sense: 0f 00 00 00
> [3633080.795462] sd 9:0:0:0: [sdg] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
> [3633080.907359] usb 1-1.1: reset high-speed USB device number 44 using xhci_hcd
> [3633081.021905] usb 1-1.1: device descriptor read/64, error -71
> [3633081.238566] usb 1-1.1: device descriptor read/64, error -71
> [3633081.448573] usb 1-1.1: reset high-speed USB device number 44 using xhci_hcd
> [3633081.558566] usb 1-1.1: device descriptor read/64, error -71
> [3633081.775236] usb 1-1.1: device descriptor read/64, error -71
> [3633081.988559] usb 1-1.1: reset high-speed USB device number 44 using xhci_hcd
> [3633086.788615] usb 1-1.1: Device not responding to setup address.
> [3633091.799190] usb 1-1.1: Device not responding to setup address.
> [3633092.008482] usb 1-1.1: device not accepting address 44, error -71
> [3633092.747719] usb 1-1.1: USB disconnect, device number 44
> [3633092.748488] device offline error, dev sdg, sector 0 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748502] buffer_io_error: 10 callbacks suppressed
> [3633092.748504] Buffer I/O error on dev sdg, logical block 0, async page read
> [3633092.748511] Buffer I/O error on dev sdg, logical block 1, async page read
> [3633092.748520] device offline error, dev sdg, sector 4 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748525] Buffer I/O error on dev sdg, logical block 2, async page read
> [3633092.748529] Buffer I/O error on dev sdg, logical block 3, async page read
> [3633092.748582] device offline error, dev sdg, sector 0 op 0x0:(READ) flags 0x0 phys_seg 4 prio class 2
> [3633092.748594] Buffer I/O error on dev sdg, logical block 0, async page read
> [3633092.748600] Buffer I/O error on dev sdg, logical block 1, async page read
> [3633092.748605] Buffer I/O error on dev sdg, logical block 2, async page read
> [3633092.748609] Buffer I/O error on dev sdg, logical block 3, async page read
> [3633092.748621] ldm_validate_partition_table(): Disk read failed.
> [3633092.748638] device offline error, dev sdg, sector 0 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748644] Buffer I/O error on dev sdg, logical block 0, async page read
> [3633092.748649] Buffer I/O error on dev sdg, logical block 1, async page read
> [3633092.748665] device offline error, dev sdg, sector 4 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748686] device offline error, dev sdg, sector 0 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748704] device offline error, dev sdg, sector 4 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748726] device offline error, dev sdg, sector 0 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748744] device offline error, dev sdg, sector 4 op 0x0:(READ) flags 0x0 phys_seg 2 prio class 2
> [3633092.748754]  sdg: unable to read partition table
> [3633092.748825] sd 9:0:0:0: [sdg] Attached SCSI removable disk
>
> Hitting Ctrl-C in U-Boot then re-running the command gives this output:
>
> CTRL+C - Operation aborted
> => ubi part ubi; ubifsmount ubi:root; ums 0 ubi 0;
> UBI partition 'ubi' already selected
> UMS: LUN 0, dev ubi -352321538, hwpart 234, sector 0x0, count 0xeafffffe
> prefetch abort
> pc : [<e8fd9ffa>]          lr : [<45fb7665>]
> reloc pc : [<e5e53ffa>]    lr : [<42e31665>]
> sp : 45d5f970  ip : 45dd66a8     fp : 00000000
> r10: 45ff88ec  r9 : 45d65eb0     r8 : 45dd1fe8
> r7 : 45dd1fd8  r6 : 45ff5f18     r5 : 45dd5600  r4 : 45fff4f0
> r3 : e8fd9fff  r2 : 45ff3260     r1 : 00000005  r0 : 45dd5594
> Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32 (T)
> Code: ffff ffff fefd ffff (ffff) ffff
> Resetting CPU ...
>
> Fastboot instantly downloads an image but produces this output:
>
> => fastboot 0
> musb-hdrc: peripheral reset irq lost!
> Starting download of 7317504 bytes
> .......................................................
> downloading of 7317504 bytes finished
> Booting kernel at 42000000...
>
>
> Wrong Image Type for bootm command
> ERROR -91: can't get kernel image!
> resetting ...
>
>
> Running 'fastboot stage' to just upload an image then hitting Ctrl-C in U-Boot gives this error:
>
> undefined instruction
> pc : [<45d69280>]          lr : [<45fb8c0b>]
> reloc pc : [<42be3280>]    lr : [<42e32c0b>]
> sp : 45d5fa28  ip : 45d6b59c     fp : 00000000
> r10: 00000002  r9 : 45d65eb0     r8 : 00000000
> r7 : 00000002  r6 : 45d68c3c     r5 : 00000000  r4 : 45d69288
> r3 : 45d69280  r2 : 00000001     r1 : 00001238  r0 : 45d69288
> Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
> Code: ffffffff ffffffff ffffffff ffffffff (ffffffff)
> Resetting CPU ...
>
> Not too sure what's happening here.
>
> John.
>
> >
> > >
> > > John.
> > >
> > > On Thu, Jun 08, 2023 at 01:56:29PM -0600, Sam Edwards wrote:
> > > > Happy Thursday, U-Boot list!
> > > >
> > > > Here is attempt 2 at making this USB controller driver compatible with
> > > > DM's gadget model, following what most of the other musb variants do.
> > > >
> > > > v2 removes the unwanted printfs in the probe func, per feedback from Marek.
> > > > I received no other feedback against v1 of this patch.
> > > >
> > > > Cheers,
> > > > Sam
> > > >
> > > > Sam Edwards (2):
> > > >   usb: musb-new: sunxi: remove unwanted printfs
> > > >   usb: musb-new: sunxi: make compatible with UDC/DM gadget model
> > > >
> > > >  drivers/usb/musb-new/sunxi.c | 52 +++++++++++++++++++++---------------
> > > >  1 file changed, 31 insertions(+), 21 deletions(-)
> > > >
> > > > --
> > > > 2.39.2
> > > >


More information about the U-Boot mailing list