
Hello!
I've made some more tests, but I am stuck and I don't really know what I am missing. Would love to get some insights, if somebody has an idea :-). So my root problem is that I would like to run my pocketbeagle in fastboot mode so that I can flash an image from my laptop over USB (it's a learning experience, I'm new to u-boot).
When I go into the u-boot prompt and run `fastboot usb 0` (after I set `log level 7`), I get:
``` => fastboot usb 0 uclass_find_device_by_seq() 0 0 uclass_find_device_by_seq() - not found uclass_find_device_by_seq() 1 0 uclass_find_device_by_seq() - not found cmd_call() Command failed, result=1 ```
Similar for `fastboot usb 1` (I don't know which one is the microB on the pocketbeagle), except the numbers are `0 1` and `1 1` in the log output.
If I `dm tree`, for some reason I see only usb1@47401800 (according to the `.dts`, usb0 is @47401000).
``` misc 0 [ + ] ti-musb-wrapper `-- usb@47400000 usb 0 [ ] ti-musb-host `-- usb@47401800 ```
Looking at the defconfig (I use Yocto, so `bitbake -c menuconfig u-boot), I see that "Default Device Tree for DT control" is (am335x-evm). Opening ./build/tmp/work/pocketbeagle-poky-linux-gnueabi/u-boot/1_2020.07-r0/git/arch/arm/dts/am335x-evm.dts (which I believe is the one corresponding to `am335x-evm` in my defconfig), I see the following for usb:
``` &usb { status = "okay"; };
&usb_ctrl_mod { status = "okay"; };
&usb0_phy { status = "okay"; };
&usb1_phy { status = "okay"; };
&usb0 { status = "okay"; };
&usb1 { status = "okay"; dr_mode = "host"; }; ```
And showing usb0 and usb1 with `fdt print` (after I get the value of $fdt_blob with `bdinfo` and use it with `fdt addr $fdt_blob`), I get:
``` => fdt print /ocp/usb@47400000/usb@47401000 usb@47401000 { compatible = "ti,musb-am33xx"; status = "okay"; reg = <0x47401400 0x00000400 0x47401000 0x00000200>; reg-names = "mc", "control"; interrupts = <0x00000012>; interrupt-names = "mc"; dr_mode = "otg"; mentor,multipoint = <0x00000001>; mentor,num-eps = <0x00000010>; mentor,ram-bits = <0x0000000c>; mentor,power = <0x000001f4>; phys = <0x00000037>; dmas = * 0x9df20aa8 [0x00000168]; dma-names = "rx1", "rx2", "rx3", "rx4", "rx5", "rx6", "rx7", "rx8", "rx 9", "rx10", "rx11", "rx12", "rx13", "rx14", "rx15", "tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7", "tx8", "tx9", "tx10", "tx11", "tx12", "tx13", "tx14", "tx15"; }; ```
and
``` => fdt print /ocp/usb@47400000/usb@47401800 usb@47401800 { compatible = "ti,musb-am33xx"; status = "okay"; reg = <0x47401c00 0x00000400 0x47401800 0x00000200>; reg-names = "mc", "control"; interrupts = <0x00000013>; interrupt-names = "mc"; dr_mode = "host"; mentor,multipoint = <0x00000001>; mentor,num-eps = <0x00000010>; mentor,ram-bits = <0x0000000c>; mentor,power = <0x000001f4>; phys = <0x00000039>; dmas = * 0x9df20e50 [0x00000168]; dma-names = "rx1", "rx2", "rx3", "rx4", "rx5", "rx6", "rx7", "rx8", "rx9", "rx10", "rx11", "rx12", "rx13", "rx14", "rx15", "tx1", "tx2", "tx3", "tx4", "tx5", "tx6", "tx7", "tx8", "tx9", "tx10", "tx11", "tx12", "tx13", "tx14", "tx 15"; }; ```
My understanding is therefore that `usb0` is in "otg" mode, and `usb1` is in "host" mode. But that does not really tell me why `fastboot usb 0` and `fastboot usb 1` failed.
I have also tried to edit `am335x-evm.dts` and set both to "peripheral" (I do that in a Yocto patch step and make sure I `bitbake -c cleansstate u-boot` and `bitbake -c clean <my-image>` before I rebuild):
``` &usb0 { status = "okay"; dr_mode = "peripheral"; };
&usb1 { status = "okay"; dr_mode = "peripheral"; }; ```
But that does not change anything in the `fdt print` output: usb0 is still "otg" and usb1 is still "host". Which makes me guess I may be modifying the wrong `am335x-evm.dts`, but I really don't know how I could check that.
Again, any hints are appreciated, I'm happy to DuckDuckGo some new keywords or ideas as my goal is to learn about u-boot, but right now I'm just stuck :-).
Best Regards, Jonas
On Sun, Mar 7, 2021 at 7:31 PM Jonas Vautherin jonas.vautherin@gmail.com wrote:
Yes that was it! I had used `log help`, but misunderstood the output. My bad... Below is the debug output I receive, where I don't really get what's happening except for those two lines:
uclass_find_device_by_seq() - 1 -1 'usb@47401800' uclass_find_device_by_seq() - not found
But I don't really understand what it means. I spent a lot of time reading the available options in menuconfig, and at that point I cannot say what I am doing wrong. Note that I am using the `am335x_evm_defconfig` defconfig, which I changed to get more logging outputs.
Here is the output of `usb start`, let me know if I am missing something obvious from there:
=> usb start starting USB... Bus usb@47401800: __of_translate_address() OF: ** translation for device usb@47401800 ** __of_translate_address() OF: bus is default (na=1, ns=1) on usb@47400000 __of_translate_address() OF: parent bus is default (na=1, ns=1) on ocp of_translate_one() OF: no ranges, 1:1 translation of_translate_one() OF: with offset: 1195382784 __of_translate_address() OF: parent bus is default (na=1, ns=1) on of_translate_one() OF: no ranges, 1:1 translation of_translate_one() OF: with offset: 1195382784 __of_translate_address() OF: reached root node fdtdec_lookup_phandle() fdtdec_lookup_phandle: phys fdtdec_lookup_phandle() fdtdec_lookup_phandle: ti,ctrl_mod fdtdec_get_addr_size_fixed() fdtdec_get_addr_size_fixed: reg: fdtdec_get_addr_size_fixed() addr=44e10620 fdtdec_get_int() fdtdec_get_int: mentor,multipoint: fdtdec_get_int() 0x1 (1) fdtdec_get_int() fdtdec_get_int: mentor,num-eps: fdtdec_get_int() 0x10 (16) fdtdec_get_int() fdtdec_get_int: mentor,ram-bits: fdtdec_get_int() 0xc (12) fdtdec_get_int() fdtdec_get_int: mentor,power: fdtdec_get_int() 0x1f4 (500) uclass_find_device_by_seq() 0 1 uclass_find_device_by_seq() - 1 -1 'usb@47401800' uclass_find_device_by_seq() - not found clk_set_defaults() clk_set_defaults(usb@47401800) clk_set_default_parents() clk_set_default_parents: could not read assigned-clock-parents for 9df24d30 ofnode_read_prop() ofnode_read_prop: assigned-clock-rates: ofnode_read_prop() <not found> musb_core_init() musb-hdrc: hw_ep 0shared, max 64 musb_core_init() musb-hdrc: hw_ep 1tx, max 512 musb_core_init() musb-hdrc: hw_ep 1rx, max 512 musb_core_init() musb-hdrc: hw_ep 2tx, max 512 musb_core_init() musb-hdrc: hw_ep 2rx, max 512 musb_core_init() musb-hdrc: hw_ep 3tx, max 512 musb_core_init() musb-hdrc: hw_ep 3rx, max 512 musb_core_init() musb-hdrc: hw_ep 4tx, max 512 musb_core_init() musb-hdrc: hw_ep 4rx, max 512 musb_core_init() musb-hdrc: hw_ep 5tx, max 512 musb_core_init() musb-hdrc: hw_ep 5rx, max 512 musb_core_init() musb-hdrc: hw_ep 6tx, max 512 musb_core_init() musb-hdrc: hw_ep 6rx, max 512 musb_core_init() musb-hdrc: hw_ep 7tx, max 512 musb_core_init() musb-hdrc: hw_ep 7rx, max 512 musb_core_init() musb-hdrc: hw_ep 8tx, max 512 musb_core_init() musb-hdrc: hw_ep 8rx, max 512 musb_core_init() musb-hdrc: hw_ep 9tx, max 512 musb_core_init() musb-hdrc: hw_ep 9rx, max 512 musb_core_init() musb-hdrc: hw_ep 10tx, max 256 musb_core_init() musb-hdrc: hw_ep 10rx, max 64 musb_core_init() musb-hdrc: hw_ep 11tx, max 256 musb_core_init() musb-hdrc: hw_ep 11rx, max 64 musb_core_init() musb-hdrc: hw_ep 12tx, max 256 musb_core_init() musb-hdrc: hw_ep 12rx, max 64 musb_core_init() musb-hdrc: hw_ep 13shared, max 4096 musb_core_init() musb-hdrc: hw_ep 14shared, max 1024 musb_core_init() musb-hdrc: hw_ep 15shared, max 1024 musb_start() <== devctl 80 musb_stop() HDRC disabled Port not available. usb_init() scan end
Best,
On Sun, Mar 7, 2021 at 3:04 AM Sean Anderson seanga2@gmail.com wrote:
On 3/6/21 8:38 PM, Jonas Vautherin wrote:
Thanks a lot Sean!
I tried to enable logging by using the following CONFIG_:
CONFIG_LOG=y CONFIG_SPL_LOG=y CONFIG_TPL_LOG=y CONFIG_LOG_MAX_LEVEL=5
You need to increase this. Log levels are only compiled-in if they are less than the max log level.
CONFIG_SPL_LOG_MAX_LEVEL=3 CONFIG_TPL_LOG_MAX_LEVEL=3 CONFIG_LOG_DEFAULT_LEVEL=7 CONFIG_LOG_CONSOLE=y CONFIG_SPL_LOG_CONSOLE=y CONFIG_TPL_LOG_CONSOLE=y
CONFIG_CMD_LOG=y
And I got the "log" function indeed. But it did not have the effect I
was hoping for:
=> log level set 7
Use the help function ;)
The correct syntax is "log level 7"
If you use a newer U-Boot (newer than 2021.01) then the output will be more verbose. E.g.
=> log level EMERG ALERT CRIT ERR WARNING NOTICE INFO (default) DEBUG
--Sean
=> log level Default log level: 0 => usb start starting USB... Bus usb@47401800: Port not available.
First, I don't get why it says "Default log level: 0" after I set it
(to whatever number, apparently). And second, it does not seem to bring me more output about the usb issue :-/.
Am I missing something?
Best, Jonas
On Sat, Mar 6, 2021 at 3:20 AM Sean Anderson <seanga2@gmail.com
mailto:seanga2@gmail.com> wrote:
On 3/5/21 7:10 PM, Jonas Vautherin wrote: > Hello! > > I am learning about Fastboot, and I would like to run it from
u-boot and
> detect it from my host computer (I have the tools on my host,
that's
> working with other devices). > > I am using a pocketbeagle and I built an image using Yocto. I
can get into
> the u-boot prompt at boot time, and I get the following output: > > ``` > Rebooting... reboot: Restarting system > > U-Boot SPL 2020.07 (Jul 06 2020 - 19:22:53 +0000) > Trying to boot from MMC1 > > > U-Boot 2020.07 (Jul 06 2020 - 19:22:53 +0000) > > CPU : AM335X-GP rev 2.1 > Model: TI AM335x PocketBeagle > DRAM: 512 MiB > WDT: Started with servicing (60s timeout) > NAND: 0 MiB > MMC: OMAP SD/MMC: 0 > Loading Environment from FAT... *** Warning - bad CRC, using
default
> environment > > <ethaddr> not set. Validating first E-fuse MAC > Net: No ethernet found. > Hit any key to stop autoboot: 2 > ``` > > If I hit a key here, I get the u-boot prompt (`=>`) where I find > "fastboot". The thing is that none of the fastboot commands I
run have any
> output: This is normal. There will be output only when you issue commands. > > * fastboot usb 0 > * fastboot usb > * fastboot udp > > Now, fastboot udp is not enabled in my defconfig, but the udp
gadget
> support is, and the usb fastboot gadget is enabled, too. From my
host, I
> just don't see anything in the `dmesg` output. > > Here are a few questions: > > * Does fastboot usb go over ethernet? If yes, I guess that the
"Net: No
> ethernet found." message is an issue that I need to fix such
that a new usb
> network interface is created by my host, but from my tests with
this
> proprietary device I own, it does not seem to be enumerated as a
network
> interface. Only udp goes over ethernet (though I suppose you could use a usb-ethernet gadget/dongle). > * In readthedocs [1], it mentions that "The
CONFIG_USB_GADGET_VENDOR_NUM
> must be one of the numbers supported by the fastboot client." In
my setup,
> it is set to 0x0451, and I did not find what is supposed to be
supported in
> fastboot.cpp [2]. So from the host, I also tried `fastboot -i
0x0451
> devices`. Is that an issue? The fastboot client detects devices with two bulk endpoints and the correct interface (see match_fastboot and filter_usb_device).
Generally,
you will only have to specify the vid/pid/serial if you have
multiple
devices plugged in at once. > * I thought that maybe I should start USB, because the output of
`usb tree`
> says "USB is stopped. Please issue 'usb start' first.". But
running `usb
> start` errors with "Bus usb@47401800: Port not available.". Is
that related
> to fastboot at all, i.e. should I be concerned about that? And
how can I
> debug it? That's probably why your fastboot isn't working :) You can try debugging it by enabling debug messages. If you want
less than
a firehose, you can try setting the default log level to info, and
then
setting it to debug before running usb start. See [1] for details. [1] https://u-boot.readthedocs.io/en/latest/develop/logging.html --Sean > Thanks in advance for the help! > Jonas > > [1]:
https://u-boot.readthedocs.io/en/latest/android/fastboot.html
> [2]: >
https://android.googlesource.com/platform/system/core/+/master/fastboot/fast...
>