[PATCH 06/19] aspeed: ast2500: Read clock ofdata in the correct method
sjg at google.com
sjg at google.com
Fri Jan 10 09:57:48 CET 2020
Hi Cédric,
On Tue, 7 Jan 2020 at 21:20, Cédric Le Goater <clg at kaod.org> wrote:
>
> On 12/30/19 5:19 AM, Simon Glass wrote:
> > At present the clock driver reads its ofdata in the probe() method. This
> > is not correct although it is often harmless.
> >
> > However in this case it causes a problem, something like this:
> >
> > - ast_get_scu() is called (from somewhere) to get the SCI address
> > - this probes the clock
> > - first sets up ofdata (which does nothing at present)
> > - DM marks clock device as active
> > - DM calls pinctrl
> > - pinctrl probes and calls ast_get_scu() in ast2500_pinctrl_probe()
> > - ast_get_scu() probes the clock, but sees it already marked as
> > probed
> > - ast_get_scu() accesses the clock's private data, with scu as NULL
> > - DM calls clock probe function ast2500_clk_probe() which reads scu
> >
> > By putting the read of scu into the correct method, scu is read as part of
> > ofdata setup, and everything is OK.
> >
> > Note: This problem did not matter until now since DM always probed all
> > parents before reading a child's ofdata. The fact that pinctrl is a child
> > of clock seems to trigger this strange bug.
>
> Did you find it with QEMU ?
Yes that's right.
>
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
>
> Reviewed-by: Cédric Le Goater <clg at kaod.org>
>
> C.
>
> > ---
> >
> > drivers/clk/aspeed/clk_ast2500.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
Applied to u-boot-dm, thanks!
More information about the U-Boot
mailing list