blob: b0c5af53da687d5208440998f33bb5ba59689891 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0
Kever Yang1cfd5502017-02-23 15:37:52 +08002/*
3 * (C) Copyright 2017 Rockchip Electronics Co., Ltd
Kever Yang1cfd5502017-02-23 15:37:52 +08004 */
5
Kever Yang1cfd5502017-02-23 15:37:52 +08006#include <dm.h>
Kever Yang9fbe17c2019-03-28 11:01:23 +08007#include <asm/arch-rockchip/clock.h>
8#include <asm/arch-rockchip/cru_rk3328.h>
Simon Glassd66c5f72020-02-03 07:36:15 -07009#include <linux/err.h>
Kever Yang1cfd5502017-02-23 15:37:52 +080010
11int rockchip_get_clk(struct udevice **devp)
12{
13 return uclass_get_device_by_driver(UCLASS_CLK,
Simon Glass65130cd2020-12-28 20:34:56 -070014 DM_DRIVER_GET(rockchip_rk3328_cru), devp);
Kever Yang1cfd5502017-02-23 15:37:52 +080015}
16
17void *rockchip_get_cru(void)
18{
19 struct rk3328_clk_priv *priv;
20 struct udevice *dev;
21 int ret;
22
23 ret = rockchip_get_clk(&dev);
24 if (ret)
25 return ERR_PTR(ret);
26
Kever Yanga6367902017-10-25 16:24:48 +080027 priv = dev_get_priv(dev);
Kever Yang1cfd5502017-02-23 15:37:52 +080028
29 return priv->cru;
30}