mirror of
https://github.com/u-boot/u-boot.git
synced 2024-12-13 06:43:29 +08:00
rockchip: clk: Update the rk3288 driver to support of-platdata
Add support for of-platdata with rk3288. This requires decoding the of-platdata struct and setting up the devices from that. Also the driver needs to be renamed to match the string that of-platdata will search for. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
08fd82cf3e
commit
2d143bd619
@ -7,7 +7,9 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <clk-uclass.h>
|
#include <clk-uclass.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
|
#include <dt-structs.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <mapmem.h>
|
||||||
#include <syscon.h>
|
#include <syscon.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include <asm/arch/clock.h>
|
#include <asm/arch/clock.h>
|
||||||
@ -21,6 +23,12 @@
|
|||||||
|
|
||||||
DECLARE_GLOBAL_DATA_PTR;
|
DECLARE_GLOBAL_DATA_PTR;
|
||||||
|
|
||||||
|
struct rk3288_clk_plat {
|
||||||
|
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
|
struct dtd_rockchip_rk3288_cru dtd;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
struct rk3288_clk_priv {
|
struct rk3288_clk_priv {
|
||||||
struct rk3288_grf *grf;
|
struct rk3288_grf *grf;
|
||||||
struct rk3288_cru *cru;
|
struct rk3288_cru *cru;
|
||||||
@ -785,9 +793,11 @@ static struct clk_ops rk3288_clk_ops = {
|
|||||||
|
|
||||||
static int rk3288_clk_ofdata_to_platdata(struct udevice *dev)
|
static int rk3288_clk_ofdata_to_platdata(struct udevice *dev)
|
||||||
{
|
{
|
||||||
|
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
struct rk3288_clk_priv *priv = dev_get_priv(dev);
|
struct rk3288_clk_priv *priv = dev_get_priv(dev);
|
||||||
|
|
||||||
priv->cru = (struct rk3288_cru *)dev_get_addr(dev);
|
priv->cru = (struct rk3288_cru *)dev_get_addr(dev);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -800,6 +810,11 @@ static int rk3288_clk_probe(struct udevice *dev)
|
|||||||
if (IS_ERR(priv->grf))
|
if (IS_ERR(priv->grf))
|
||||||
return PTR_ERR(priv->grf);
|
return PTR_ERR(priv->grf);
|
||||||
#ifdef CONFIG_SPL_BUILD
|
#ifdef CONFIG_SPL_BUILD
|
||||||
|
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
|
struct rk3288_clk_plat *plat = dev_get_platdata(dev);
|
||||||
|
|
||||||
|
priv->cru = map_sysmem(plat->dtd.reg[0], plat->dtd.reg[1]);
|
||||||
|
#endif
|
||||||
rkclk_init(priv->cru, priv->grf);
|
rkclk_init(priv->cru, priv->grf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -823,11 +838,12 @@ static const struct udevice_id rk3288_clk_ids[] = {
|
|||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
U_BOOT_DRIVER(clk_rk3288) = {
|
U_BOOT_DRIVER(rockchip_rk3288_cru) = {
|
||||||
.name = "clk_rk3288",
|
.name = "rockchip_rk3288_cru",
|
||||||
.id = UCLASS_CLK,
|
.id = UCLASS_CLK,
|
||||||
.of_match = rk3288_clk_ids,
|
.of_match = rk3288_clk_ids,
|
||||||
.priv_auto_alloc_size = sizeof(struct rk3288_clk_priv),
|
.priv_auto_alloc_size = sizeof(struct rk3288_clk_priv),
|
||||||
|
.platdata_auto_alloc_size = sizeof(struct rk3288_clk_plat),
|
||||||
.ops = &rk3288_clk_ops,
|
.ops = &rk3288_clk_ops,
|
||||||
.bind = rk3288_clk_bind,
|
.bind = rk3288_clk_bind,
|
||||||
.ofdata_to_platdata = rk3288_clk_ofdata_to_platdata,
|
.ofdata_to_platdata = rk3288_clk_ofdata_to_platdata,
|
||||||
|
Loading…
Reference in New Issue
Block a user