From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wolfgang Denk Date: Thu, 23 Apr 2020 22:39:34 +0200 Subject: [PATCH 06/16] arm: stm32mp: spl: display error in board_init_f In-Reply-To: <8970fb86c1374d1999ff656c2a3272da@SFHDAG6NODE3.st.com> References: <20200331180330.1.Ied6708bad5048382a57618f95d67c549aae49f42@changeid> <20200331180330.6.I41a641a07fd12da45b392920fc3407e608926396@changeid> <20200401113019.73B6724003E@gemini.denx.de> <8970fb86c1374d1999ff656c2a3272da@SFHDAG6NODE3.st.com> Message-ID: <20200423203934.B536F2439C9@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 -- DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de I know engineers. They love to change things. - Dr. McCoy