Commit accaaea5ccef936c9ea5f6da56d021bb717ed3b6

Authored by Kever Yang
Committed by Philipp Tomsich
1 parent 239a25aef1

rockchip: rk3036: add ofdata_to_platdata() method for driver

Parse of data in dedicated api instead of in probe().

The clk_set_rate() may be called before the clk driver is probed,
after core support set default clock.
This patch fix system abort issue since:
f4fcba5 clk: implement clk_set_defaults()

Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>

Showing 1 changed file with 10 additions and 1 deletions Side-by-side Diff

drivers/clk/rockchip/clk_rk3036.c
... ... @@ -317,11 +317,19 @@
317 317 .set_rate = rk3036_clk_set_rate,
318 318 };
319 319  
320   -static int rk3036_clk_probe(struct udevice *dev)
  320 +static int rk3036_clk_ofdata_to_platdata(struct udevice *dev)
321 321 {
322 322 struct rk3036_clk_priv *priv = dev_get_priv(dev);
323 323  
324 324 priv->cru = dev_read_addr_ptr(dev);
  325 +
  326 + return 0;
  327 +}
  328 +
  329 +static int rk3036_clk_probe(struct udevice *dev)
  330 +{
  331 + struct rk3036_clk_priv *priv = dev_get_priv(dev);
  332 +
325 333 rkclk_init(priv->cru);
326 334  
327 335 return 0;
... ... @@ -367,6 +375,7 @@
367 375 .id = UCLASS_CLK,
368 376 .of_match = rk3036_clk_ids,
369 377 .priv_auto_alloc_size = sizeof(struct rk3036_clk_priv),
  378 + .ofdata_to_platdata = rk3036_clk_ofdata_to_platdata,
370 379 .ops = &rk3036_clk_ops,
371 380 .bind = rk3036_clk_bind,
372 381 .probe = rk3036_clk_probe,