The current method assumes that clocks are numbered from 0 and we can determine a clock by its number. It is safer to use an ID in the clock's platform data to avoid the situation where another clock is bound before the one we expect. Move the existing code into rk3036 since it still works there. Add a new implementation for rk3288. Signed-off-by: Simon Glass <sjg@chromium.org>master
parent
2b9fe111ec
commit
5ddf5d7705
@ -1,28 +0,0 @@ |
||||
/*
|
||||
* (C) Copyright 2015 Google, Inc |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <dm.h> |
||||
#include <errno.h> |
||||
#include <fdtdec.h> |
||||
#include <linux/err.h> |
||||
|
||||
void *rockchip_get_cru(void) |
||||
{ |
||||
struct udevice *dev; |
||||
fdt_addr_t addr; |
||||
int ret; |
||||
|
||||
ret = uclass_get_device(UCLASS_CLK, 0, &dev); |
||||
if (ret) |
||||
return ERR_PTR(ret); |
||||
|
||||
addr = dev_get_addr(dev); |
||||
if (addr == FDT_ADDR_T_NONE) |
||||
return ERR_PTR(-EINVAL); |
||||
|
||||
return (void *)addr; |
||||
} |
Loading…
Reference in new issue