]> git.karo-electronics.de Git - karo-tx-uboot.git/blob - arch/arm/mach-rockchip/common.c
rockchip: Add core SoC start-up code
[karo-tx-uboot.git] / arch / arm / mach-rockchip / common.c
1 /*
2  * (C) Copyright 2015 Google, Inc
3  *
4  * SPDX-License-Identifier:     GPL-2.0+
5  */
6
7 #include <common.h>
8 #include <dm.h>
9 #include <errno.h>
10 #include <fdtdec.h>
11 #include <linux/err.h>
12
13 void *rockchip_get_cru(void)
14 {
15         struct udevice *dev;
16         fdt_addr_t addr;
17         int ret;
18
19         ret = uclass_get_device(UCLASS_CLK, 0, &dev);
20         if (ret)
21                 return ERR_PTR(ret);
22
23         addr = dev_get_addr(dev);
24         if (addr == FDT_ADDR_T_NONE)
25                 return ERR_PTR(-EINVAL);
26
27         return (void *)addr;
28 }