Using USB Mass Storage on AM335X

Hi,
I am working on porting mainline U-Boot to a custom AM335X board that only has eMMC as the boot medium.
I can load U-Boot via serial boot and flash MLO and u-boot.img into the eMMC using DFU. Then the board boots successfully via eMMC.
Now I want to run the "ums" command to be able to mount the eMMC on the host. The problem I am getting is that when I select CONFIG_CMD_USB_MASS_STORAGE=y the board no longer boots.
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
Thanks for your help

On Thu, Oct 29, 2020 at 07:19:47PM -0300, Otavio Salvador wrote:
Hi,
I am working on porting mainline U-Boot to a custom AM335X board that only has eMMC as the boot medium.
I can load U-Boot via serial boot and flash MLO and u-boot.img into the eMMC using DFU. Then the board boots successfully via eMMC.
Now I want to run the "ums" command to be able to mount the eMMC on the host. The problem I am getting is that when I select CONFIG_CMD_USB_MASS_STORAGE=y the board no longer boots.
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
Have you otherwise confirmed that you have gadget support configured / enabled correctly on the board? The first thing that comes to mind with that type of problem is clock/pinmux being wrong.

Em qui., 29 de out. de 2020 às 19:46, Tom Rini trini@konsulko.com escreveu:
On Thu, Oct 29, 2020 at 07:19:47PM -0300, Otavio Salvador wrote:
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
Have you otherwise confirmed that you have gadget support configured / enabled correctly on the board? The first thing that comes to mind with that type of problem is clock/pinmux being wrong.
I think so as the DFU works just fine. Anything specific I could look for?

Hello Otavio,
Am 29.10.2020 um 23:19 schrieb Otavio Salvador:
Hi,
I am working on porting mainline U-Boot to a custom AM335X board that only has eMMC as the boot medium.
I can load U-Boot via serial boot and flash MLO and u-boot.img into the eMMC using DFU. Then the board boots successfully via eMMC.
Now I want to run the "ums" command to be able to mount the eMMC on the host. The problem I am getting is that when I select CONFIG_CMD_USB_MASS_STORAGE=y the board no longer boots.
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
Not really ... I cannot see, which impact activating this command has with not booting ...
May some problem with image size? Early malloc space, some addresses which now overlap?
You see absolutly no U-Boot output on serial? Do you have enabled early debug uart (if it is possible for am335x .. I can;t remember)
If so, you need a debugger, as it fails very early ...
So, you see .. no real idea ... I am sorry.
bye, Heiko

+ Pratyush
On 30/10/20 11:36 am, Heiko Schocher wrote:
Hello Otavio,
Am 29.10.2020 um 23:19 schrieb Otavio Salvador:
Hi,
I am working on porting mainline U-Boot to a custom AM335X board that only has eMMC as the boot medium.
I can load U-Boot via serial boot and flash MLO and u-boot.img into the eMMC using DFU. Then the board boots successfully via eMMC.
Now I want to run the "ums" command to be able to mount the eMMC on the host. The problem I am getting is that when I select CONFIG_CMD_USB_MASS_STORAGE=y the board no longer boots.
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
Not really ... I cannot see, which impact activating this command has with not booting ...
May some problem with image size? Early malloc space, some addresses which now overlap?
Good point. Just to avoid this scenario, can you make sure UMS is enabled only in U-Boot and not in SPL? or you can try with old MLO with new U-Boot :).
As Heiko already asked, can you provide more details in the failing scenario?
Thanks and regards, Lokesh

Hi Lokesh, Otavio,
- Pratyush
On 30/10/20 11:36 am, Heiko Schocher wrote:
Hello Otavio,
Am 29.10.2020 um 23:19 schrieb Otavio Salvador:
Hi,
I am working on porting mainline U-Boot to a custom AM335X board that only has eMMC as the boot medium.
I can load U-Boot via serial boot and flash MLO and u-boot.img into the eMMC using DFU. Then the board boots successfully via eMMC.
Now I want to run the "ums" command to be able to mount the eMMC on the host. The problem I am getting is that when I select CONFIG_CMD_USB_MASS_STORAGE=y the board no longer boots.
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
Not really ... I cannot see, which impact activating this command has with not booting ...
May some problem with image size? Early malloc space, some addresses which now overlap?
Good point. Just to avoid this scenario, can you make sure UMS is enabled only in U-Boot and not in SPL? or you can try with old MLO with new U-Boot :).
IIRC there were some attempts to port gadget infrastructure to SPL for the TI SoCs. As pointed out above - it may happen that CONFIG_CMD_USB_MASS_STORAGE implicitly enables some other option in Kconfig, which also enables some SPL initialization for gadgets.
The other option would be to check if the SPL malloc space is enough to handle allocations for gargets (as pointed out above).
As Heiko already asked, can you provide more details in the failing scenario?
And yes, JTAG debugger would help.
Thanks and regards, Lokesh
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

Hello all,
Em qui., 29 de out. de 2020 às 19:19, Otavio Salvador otavio@ossystems.com.br escreveu: ...
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
We found it; setting CONFIG_SYS_MALLOC_F_LEN=0x2000 it works :-)

Hello Otavio,
Am 01.11.2020 um 02:12 schrieb Otavio Salvador:
Hello all,
Em qui., 29 de out. de 2020 às 19:19, Otavio Salvador otavio@ossystems.com.br escreveu: ...
Does anyone know why selecting CONFIG_CMD_USB_MASS_STORAGE=y causes the board to not boot anymore?
We found it; setting CONFIG_SYS_MALLOC_F_LEN=0x2000 it works :-)
Fine!
bye, Heiko
participants (5)
-
Heiko Schocher
-
Lokesh Vutla
-
Lukasz Majewski
-
Otavio Salvador
-
Tom Rini