Re: u-boot debug, was: Re: U-boot on RPI3, sees disk but won't boot it

From: Klaus_Küchemann <maciphone2_at_googlemail.com>
Date: Tue, 27 Sep 2022 20:25:48 UTC

> Am 27.09.2022 um 22:06 schrieb Mark Millard <marklmi@yahoo.com>:
> 
> 
> On 2022-Sep-27, at 12:48, Klaus Küchemann <maciphone2@googlemail.com> wrote:
> 
>> Am 27.09.2022 um 21:20 schrieb Mark Millard <marklmi@yahoo.com>:
>>> 
>>> On 2022-Sep-27, at 11:33, Klaus Küchemann <maciphone2@googlemail.com> wrote:
>>> 
>>> 
>>>>> Am 27.09.2022 um 19:58 schrieb Klaus Küchemann <maciphone2@googlemail.com>:
>>>>> 
>>>>> 
>>>>>> Am 27.09.2022 um 18:03 schrieb bob prohaska <fbsd@www.zefox.net>:
>>>>>> 
>>>>>> I did look at common/usb.c but it's far from obvious how one
>>>>>> can turn on the logging feature so as to report more errors
>>>>>> to the console.
>>>>> 
>>>>> you can add the following to common/usb.c (e.g. insert in line 44):
>>>>> 
>>>>> #define DEBUG
>>>>> 
>>>>> --
>>>>> 
>>>>> that should then print out all debug functions inside the usb.c file to the console 
>>>>> after recompilation of u-boot.
>>>>> 
>>>>> Regards
>>>>> 
>>>>> Klaus
>>>> 
>>>> I saw there is  /*#include <log.h>*/ available in usb.c 
>>>> so you could also try to add :
>>>> 
>>>> #define LOG_DEBUG
>>>> 
>>>> to the common/usb.c file which should also then enable the debug functions
>>>> which then would be output in logging style.
>>>> 
>>>> You will need the debug output to to narrow down the issue.
>>>> 
>>>> just a guess : 
>>>> electrical problem(of the Pi itself)  which could perhaps be fixed by  manipulating the scan delay time .
>>> 
>>> Looks to me like:
>>> 
>>> https://github.com/u-boot/u-boot/blob/master/common/usb_hub.c
>>> 
>>> might be relevant, not just:
>>> 
>>> https://github.com/u-boot/u-boot/blob/master/common/usb.c
>>> 
>>> 
>>> For example, usb_hub.c is where usb_pgood_delay is involved.
>>> (My patch to enable my boot media assigns that, not that
>>> such helped Bob.)
>>> 
>>> But I've not been able to uniquely identify all the specific
>>> identifiers for all the (relevant) "usb boot scan delays",
>>> although I'd expect that pgood_delay (and its usb_pgood_delay)
>>> would be considered an example.
>>> 
>>> ===
>>> Mark Millard
>>> marklmi at yahoo.com
>> 
>> good idea,
>> I would then suggest to enable debug also in common/usb_hub.c
>> by adding #define DEBUG or #define LOG_DEBUG ..
>> 
>> for the usb.c I’d expect something from the mdelay function as an usb scan timer..
>> so let’s see what debug logs  usb.c & usb_hub.c  will spit out ..
> 
> I'm not sure it would be relevant, there is also:
> 
> https://github.com/u-boot/u-boot/blob/master/common/usb_storage.c
> 
> But , unlike usb_pgood_delay that I recognized and it
> being in usb_hub.c , I've no specific identification
> of something relevant from usb_storage.c .
> 
> ===
> Mark Millard
> marklmi at yahoo.com

Also a good idea :-), 
So enable debug also in 
usb_storage.c 
It also has /* #include <linux/delay.h> */  and /*#include <log.h>*/
And for the case of a debug output which points to a scan timing problem the
mdelay function appears 8 times in usb_storage.c .
So a big playground for manipulating the  delays ,
I hope not too big  for us :-)… 
let’s see what debug outputs...

Regards 

Klaus