Hi Zixun,

I recommend to use sam-ba in order to flash the eMMC partitions: boot1, boot2, 
user0.
sam-ba download links:
https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/SoftwareLibraries/Firmware/sam-ba_v3.7-linux_x86_64.tar.gz
https://ww1.microchip.com/downloads/aemDocuments/documents/MPU32/ProductDocuments/SoftwareLibraries/Firmware/sam-ba_v3.7-win32.zip

For writing the bootstrap binary into boot1 partition, run the following 
command:

sam-ba -p serial -d sama5d2:0:1 -a sdmmc:0:1:1:8:4 -c writeboot:boot.bin -c 
enablebootpartition:1

For help please run:

sam-ba -p serial -d sama5d2 -a sdmmc:help

Syntax: sdmmc:[<instance>]:[<ioset>]:[<partition>]:[<bus_width>]:[<voltages>]
Parameters:
    instance   SDMMC controller number
    ioset      SDMMC I/O set
    partition  Partition number (0=user partition, x>0=boot partition x)
    bus_width  Data bus width (0=controller max, 1=1-bit, 4=4-bit, 8=8-bit)
    voltages   Supported voltages (bitfield: 1=1.8V, 2=3.0V, 4=3.3V)

Regards,
Mihai

________________________________
From: admin LI <ad...@hifiphile.com>
Sent: Friday, May 26, 2023 15:13
To: Cristian Birsan - M91496 <cristian.bir...@microchip.com>
Cc: eugen.hris...@collabora.com <eugen.hris...@collabora.com>; lu...@denx.de 
<lu...@denx.de>; ma...@denx.de <ma...@denx.de>; u-boot@lists.denx.de 
<u-boot@lists.denx.de>; Mihai Sain - M19926 <mihai.s...@microchip.com>
Subject: Re: USB mass storage gadget on SAMA5D2

You don't often get email from ad...@hifiphile.com. Learn why this is 
important<https://aka.ms/LearnAboutSenderIdentification>
EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
content is safe
Hi Cristian,

> What are you trying to achieve ? If you want to just program the eMMC you can 
> do it easily with SAM-BA[1].
On our board the MPU boot from the eMMC boot partition, by exposing the whole 
user partition as a block device we can modify the target system easily, like 
modifying the partition table.

I've tested the gadget works well in Linux, but it's not possible to expose the 
whole disk.

For reference I've implemented at91bootstrap eMMC boot partition support, both 
at91bootstrap and U-Boot are inside the boot partition.
https://github.com/linux4sam/at91bootstrap/pull/163
https://github.com/linux4sam/at91bootstrap/pull/164

Regards,
Zixun

On Thu, May 25, 2023 at 7:16 PM 
<cristian.bir...@microchip.com<mailto:cristian.bir...@microchip.com>> wrote:
Hi,

On 5/22/23 12:00, admin LI wrote:
>
>
> I think there may be some racing in the driver. (Purely assumption as a 
> tinyusb maintainer)
> If I enable DBG_ALL in atmel_usba_udc.h, the block device is enermurated 
> although with I/O error.

What are you trying to achieve ? If you want to just program the eMMC you can 
do it easily with SAM-BA[1].

The mass storage gadget works well in Linux kernel. You can have a look at the 
driver we have in the kernel
here[2].


[1] https://www.microchip.com/en-us/development-tool/SAM-BA-In-system-Programmer
[2] 
https://github.com/linux4microchip/linux/blob/linux-6.1-mchp/drivers/usb/gadget/udc/atmel_usba_udc.c

Regards,
Cristian

>
> [1337613.189788] usb 1-1: new high-speed USB device number 7 using xhci_hcd
> [1337613.674551] usb 1-1: New USB device found, idVendor=dead, 
> idProduct=beef, bcdDevice= 2.17
> [1337613.674565] usb 1-1: New USB device strings: Mfr=1, Product=2, 
> SerialNumber=0
> [1337613.674568] usb 1-1: Product: USB download gadget
> [1337613.674572] usb 1-1: Manufacturer: U-Boot
> [1337613.866033] usb-storage 1-1:1.0: USB Mass Storage device detected
> [1337613.866645] scsi host0: usb-storage 1-1:1.0
> [1337614.997803] scsi 0:0:0:0: Direct-Access     Linux    UMS disk 0       
> ffff PQ: 0 ANSI: 2
> [1337615.230004] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337615.706637] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337616.183308] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337616.659937] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337617.140086] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337617.616632] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337618.073323] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337618.549927] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337619.026540] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337619.499944] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337619.976679] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337620.453285] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337620.916597] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337621.393267] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337621.869676] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337622.346597] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337622.823361] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337623.293287] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337623.635357] sd 0:0:0:0: [sda] Read Capacity(10) failed: Result: 
> hostbyte=DID_ERROR driverbyte=DRIVER_OK
> [1337623.635369] sd 0:0:0:0: [sda] Sense not available.
> [1337623.635376] sd 0:0:0:0: [sda] 0 512-byte logical blocks: (0 B/0 B)
> [1337623.635379] sd 0:0:0:0: [sda] 0-byte physical blocks
> [1337623.756597] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337624.233274] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337624.709945] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337625.186639] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337625.663266] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337626.136617] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337626.478078] sd 0:0:0:0: [sda] Write Protect is off
> [1337626.478088] sd 0:0:0:0: [sda] Mode Sense: 00 00 00 00
> [1337626.599928] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337627.076606] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337627.553276] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337628.029936] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337628.499858] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337628.973267] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337629.313846] sd 0:0:0:0: [sda] Asking for cache data failed
> [1337629.313861] sd 0:0:0:0: [sda] Assuming drive cache: write through
> [1337629.314517] sd 0:0:0:0: [sda] Attached SCSI removable disk
> [1337629.436603] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337629.906353] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337630.373268] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337630.843284] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337631.306595] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337631.783253] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337632.259935] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337632.736612] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337633.213283] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337633.689933] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337634.146549] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337634.626586] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337635.096677] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337635.569893] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337636.043195] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337636.519877] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337636.993235] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337637.463216] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337637.926268] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337638.403221] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337638.879961] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337639.343221] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337639.813267] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337640.293319] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337640.756596] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337641.233227] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337641.709903] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337642.183232] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337642.649871] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337643.123263] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337643.586595] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337644.063281] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337644.539952] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337645.016640] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337645.493347] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337645.969975] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337646.433307] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337646.906317] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337647.366610] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337647.836558] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337648.309969] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337648.773280] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337649.243256] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337649.723285] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337650.199907] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337650.663212] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337651.139885] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337651.613205] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337652.878455] sd 0:0:0:0: [sda] 7471104 512-byte logical blocks: (3.83 
> GB/3.56 GiB)
> [1337653.056594] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337653.533299] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337654.009932] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337654.486656] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337654.963248] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337655.439945] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337655.903277] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337656.379957] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337656.853260] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337657.326598] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337657.803280] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337658.279946] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337658.620594] sda: detected capacity change from 0 to 7471104
> [1337658.743259] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337659.213281] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337659.689931] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337660.169887] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337660.639886] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337661.113316] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337661.576555] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337662.046598] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337662.523268] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337662.999945] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337663.479877] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337663.956609] usb 1-1: reset high-speed USB device number 7 using xhci_hcd
> [1337664.294581] sd 0:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_ERROR 
> driverbyte=DRIVER_OK cmd_age=2s
> [1337664.294593] sd 0:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 00 00 00 
> 00 08 00
> [1337664.294597] I/O error, dev sda, sector 0 op 0x0:(READ) flags 0x0 
> phys_seg 1 prio class 2
> [1337664.294611] Buffer I/O error on dev sda, logical block 0, async page read
>
>
> => ums 0 mmc 0
> UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0x720000
> udc: ep_alloc_request: 2fb6ee28, 0x0
> udc: irq, status=0x000022
> udc: Suspend detected
> udc: Wake Up CPU detected
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000000
> udc: irq, status=0x000020
> udc: Wake Up CPU detected
> udc: irq, status=0x000011
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [0]: s/80855000 c/00001001
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 18
> udc: req 80.06, length 64, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/00014000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 18), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 18), done
> udc: ep0 [1]: s/01254800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/00000040 c/00000001
> udc: irq, status=0x000031
> udc: Wake Up CPU detected
> udc: ep0: req 2fb740f8 complete: status -104, actual 18
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000001
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000029
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000129
> udc: Wake Up CPU detected
> udc: ep0 [0]: s/80845000 c/00001001
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: setting address 2...
> udc: req 00.05, length 0, state 5, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [5]: s/00004400 c/00001401
> udc: ep0 [0]: s/00004000 c/00001001
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [0]: s/80855000 c/00001001
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 18
> udc: req 80.06, length 18, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/00014000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 18), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 18), done
> udc: ep0 [1]: s/01254800 c/00001401
> udc: irq, status=0x000129
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8085d400 c/00001401
> udc: ep0 [4]: s/8085d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 18
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 9
> udc: req 80.06, length 9, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 9), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 9), done
> udc: ep0 [1]: s/0095c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8085d400 c/00001401
> udc: ep0 [4]: s/8085d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 9
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 32
> udc: req 80.06, length 32, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 32), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 32), done
> udc: ep0 [1]: s/0205c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8085d400 c/00001401
> udc: ep0 [4]: s/8085d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 32
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 4
> udc: req 80.06, length 255, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 4), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 4), done
> udc: ep0 [1]: s/0045c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8085d400 c/00001401
> udc: ep0 [4]: s/8085d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 4
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 40
> udc: req 80.06, length 255, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 40), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 40), done
> udc: ep0 [1]: s/0285c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8085d400 c/00001401
> udc: ep0 [4]: s/8085d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 40
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 14
> udc: req 80.06, length 255, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 14), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 14), done
> udc: ep0 [1]: s/00e5c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8084d400 c/00001401
> udc: ep0 [4]: s/8084d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 14
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 0
> udc: req 00.09, length 0, state 3, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [3]: s/0000c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 0), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 0), done
> udc: ep0 [3]: s/0004c800 c/00001401
> udc: ep1: ep_enable: desc=2ffe5ca0
> udc: ep1: EPT_SIZE = 6 (maxpacket = 512)
> udc: EPT_CFG1 after init: 0x8000006e
> udc: INT_ENB after init: 0x000352
> udc: ep2: ep_enable: desc=2ffe5ca9
> udc: ep2: EPT_SIZE = 6 (maxpacket = 512)
> udc: EPT_CFG2 after init: 0x80000066
> udc: INT_ENB after init: 0x000752
> udc: ep_alloc_request: 2fb6ee78, 0x0
> udc: ep_alloc_request: 2fb6eec8, 0x0
> udc: ep_alloc_request: 2fb6ee78, 0x0
> udc: ep_alloc_request: 2fb6eec8, 0x0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [3]: s/8085d400 c/00001401
> udc: ep0: req 2fb740f8 complete: status 0, actual 0
> udc: ep0 [0]: s/8085d000 c/00001001
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 40
> udc: req 80.06, length 255, state 1, ret 0
> udc: ep2: queue req 2fb75ef0, len 512
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 40), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 40), done
> udc: ep0 [1]: s/0285c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8085d400 c/00001401
> udc: ep0 [4]: s/8085d000 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 40
> udc: Packet length: 8
> udc: Copying ctrl request from 0x00300000:
> udc: ep0: queue req 2fb740f8, len 26
> udc: req 80.06, length 255, state 1, ret 0
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/0001c000 c/00001801
> udc: ep0: submit_request: req 2fb740f8 (length 26), dma: 0
> udc: ep0: submit_transaction, req 2fb740f8 (length 26), done
> udc: ep0 [1]: s/01a5c800 c/00001401
> udc: irq, status=0x000125
> udc: Wake Up CPU detected
> udc: ep0 [1]: s/8005c640 c/00001401
> udc: ep0 [4]: s/8005c240 c/00001201
> udc: ep0: req 2fb740f8 complete: status 0, actual 26
> udc: ep0 [0]: s/0001c040 c/00001001
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
> udc: irq, status=0x000025
> udc: Wake Up CPU detected
>
> On Sun, May 21, 2023 at 9:09 AM Eugen Hristev 
> <eugen.hris...@collabora.com<mailto:eugen.hris...@collabora.com> 
> <mailto:eugen.hris...@collabora.com<mailto:eugen.hris...@collabora.com>>> 
> wrote:
>
>     Hi,
>
>     I believe someone from Microchip have tried this before
>     Some people in CC added
>
>     You can also open a case on 
> support.microchip.com<http://support.microchip.com> 
> <http://support.microchip.com>
>
>     Eugen
>
>     On 5/19/23 23:18, admin LI wrote:
>      > Hi,
>      >
>      > I'm trying to use ums to access EMMC on our SAMA5D2 board without 
> success.
>      >
>      > My board_init(), without adding usba_udc_probe() ums will cause data 
> abort
>      > error:
>      > int board_init(void)
>      > {
>      > /* address of boot parameters */
>      > gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
>      >
>      > #ifdef CONFIG_USB_GADGET_ATMEL_USBA
>      > at91_udp_hw_init();
>      > usba_udc_probe(&pdata);
>      > #endif
>      >
>      > return 0;
>      > }
>      >
>      > USB related config:
>      > CONFIG_USB=y
>      > CONFIG_USB_EHCI_HCD=y
>      > CONFIG_USB_STORAGE=y
>      > CONFIG_USB_GADGET=y
>      > CONFIG_USB_GADGET_VENDOR_NUM=0xdead
>      > CONFIG_USB_GADGET_PRODUCT_NUM=0xbeef
>      > CONFIG_USB_GADGET_ATMEL_USBA=y
>      > CONFIG_USB_GADGET_VBUS_DRAW=500
>      > CONFIG_USB_GADGET_DOWNLOAD=y
>      > CONFIG_USB_ETHER=y
>      >
>      > EMMC can be successfully accessed, Linux boot is ok:
>      > => mmc list
>      > sdio-host@a0000000: 0 (eMMC)
>      >
>      > => mmc info
>      > Device: sdio-host@a0000000
>      > Manufacturer ID: 70
>      > OEM: 100
>      > Name: M6270
>      > Bus Speed: 52000000
>      > Mode: MMC High Speed (52MHz)
>      > Rd Block Len: 512
>      > MMC version 5.1
>      > High Capacity: Yes
>      > Capacity: 3.6 GiB
>      > Bus Width: 4-bit
>      > Erase Group Size: 512 KiB
>      > HC WP Group Size: 4 MiB
>      > User Capacity: 3.6 GiB
>      > Boot Capacity: 2 MiB ENH
>      > RPMB Capacity: 512 KiB ENH
>      > Boot area 0 is not write protected
>      > Boot area 1 is not write protected
>      >
>      > => mmc part
>      >
>      > Partition Map for MMC device 0  --   Partition Type: DOS
>      >
>      > Part    Start Sector    Num Sectors     UUID            Type
>      >    1     2048            1044480         0508e2bf-01     83
>      >
>      > However, when I use "ums 0 mmc 0", the USB device is partially 
> enumerated
>      > without a block device available, in the console the rotation cursor 
> spins
>      > about 20s then USB is disconnected.
>      >
>      > On u-boot:
>      > => ums 0 mmc 0
>      > UMS: LUN 0, dev mmc 0, hwpart 0, sector 0x0, count 0x720000
>      > -=> (self-exit after 20s)
>      >
>      > On Linux:
>      > [  699.920316] usb 3-5: new high-speed USB device number 5 using 
> xhci_hcd
>      > [  700.060766] usb 3-5: New USB device found, idVendor=dead,
>      > idProduct=beef, bcdDevice= 2.17
>      > [  700.060772] usb 3-5: New USB device strings: Mfr=1, Product=2,
>      > SerialNumber=0
>      > [  700.060774] usb 3-5: Product: USB download gadget
>      > [  700.060776] usb 3-5: Manufacturer: U-Boot
>      > [  700.081573] usb-storage 3-5:1.0: USB Mass Storage device detected
>      > [  700.081780] scsi host0: usb-storage 3-5:1.0
>      > [  700.081874] usbcore: registered new interface driver usb-storage
>      > [  700.088339] usbcore: registered new interface driver uas
>      > [  722.407008] usb 3-5: USB disconnect, device number 5
>      >
>      >
>      > Thanks,
>

Reply via email to