rockchip: Add a way to obtain the main clock device
authorSimon Glass <sjg@chromium.org>
Sun, 17 Jul 2016 21:23:16 +0000 (15:23 -0600)
committerSimon Glass <sjg@chromium.org>
Tue, 26 Jul 2016 02:46:45 +0000 (20:46 -0600)
On Rockchip SoCs we typically have a main clock device that uses the Soc
clock driver. There is also a fixed clock for the oscillator. Add a function
to obtain the core clock.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/arm/include/asm/arch-rockchip/clock.h
arch/arm/mach-rockchip/rk3288/Makefile
arch/arm/mach-rockchip/rk3288/clk_rk3288.c [new file with mode: 0644]

index 4bebd624798963172cb9672c11c2ef8f1649686e..21edbc2f8989705b1b84c9b1b3d03706a72907bc 100644 (file)
@@ -67,4 +67,6 @@ struct rk3288_grf;
 
 void rk3288_clk_configure_cpu(struct rk3288_cru *cru, struct rk3288_grf *grf);
 
+int rockchip_get_clk(struct udevice **devp);
+
 #endif
index 6f62375f46452c910a8b0cd37bc15f73ac1ae4a2..82b00a1b01254593e6d4e0387367082c9ac84766 100644 (file)
@@ -4,6 +4,7 @@
 # SPDX-License-Identifier:      GPL-2.0+
 #
 
+obj-y += clk_rk3288.o
 obj-y += reset_rk3288.o
 obj-y += sdram_rk3288.o
 obj-y += syscon_rk3288.o
diff --git a/arch/arm/mach-rockchip/rk3288/clk_rk3288.c b/arch/arm/mach-rockchip/rk3288/clk_rk3288.c
new file mode 100644 (file)
index 0000000..2099e34
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2015 Google, Inc
+ * Written by Simon Glass <sjg@chromium.org>
+ *
+ * SPDX-License-Identifier:    GPL-2.0+
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <syscon.h>
+#include <asm/arch/clock.h>
+
+int rockchip_get_clk(struct udevice **devp)
+{
+       return uclass_get_device_by_driver(UCLASS_CLK,
+                       DM_GET_DRIVER(rockchip_rk3288_cru), devp);
+}