USB mass storage gadget on SAMA5D2

admin LI admin at hifiphile.com
Fri May 19 22:18:53 CEST 2023


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 at a0000000: 0 (eMMC)

=> mmc info
Device: sdio-host at 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,


More information about the U-Boot mailing list