
Dear Patrick,
In message 8970fb86c1374d1999ff656c2a3272da@SFHDAG6NODE3.st.com you wrote:
- ret = uclass_get_device(UCLASS_CLK, 0, &dev);
- if (ret) {
debug("Clock init failed: %d\n", ret);
return;
- }
- clk = uclass_get_device(UCLASS_CLK, 0, &dev);
- if (clk)
debug("%s: Clock init failed: %d\n", __func__, clk);
- ret = uclass_get_device(UCLASS_RESET, 0, &dev);
- if (ret) {
debug("Reset init failed: %d\n", ret);
return;
- }
- reset = uclass_get_device(UCLASS_RESET, 0, &dev);
- if (reset)
debug("%s: Reset init failed: %d\n", __func__, reset);
- ret = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
- if (ret) {
debug("%s: Cannot find pinctrl device\n", __func__);
return;
- }
pinctrl = uclass_get_device(UCLASS_PINCTRL, 0, &dev);
if (pinctrl)
debug("%s: Cannot find pinctrl device: %d\n",
__func__, pinctrl);
/* enable console uart printing */ preloader_console_init();
if (clk || reset || pinctrl)
printf("%s: probe failed clk=%d reset=%d pinctrl=%d\n",
__func__, clk, reset, pinctrl);
This change makes little sense to me/ If you want error messages, then just turn above debug() into printf(), and be done with it. As an additional benefit so see at once which step failed.
In this patch, I try to display error as soon as console is available (after preloader_console_init) , if after one driver initialization (clk, reset, pincontrol) failing.
Change debug to printf only works only if CONFIG_DEBUG_UART is activated (not by default) and board_debug_uart_init() exist to configure the needed UART TX pins.
Maybe you can remember an error code so you can tell the user which of the steps failed? That would be more useful, then.
Best regards,
Wolfgang Denk