Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Support for trees of clocks served by one clock manager



Jared McNeill <jmcneill%invisible.ca@localhost> writes:

> Thanks! I think we can do without the "(void) cc_phandle;" bits,

Ah, you're right, here's a lighter diff, compile tested with an update
release.

Regards,
 Aymeric

diff --git a/sys/arch/arm/broadcom/bcm2835_aux.c b/sys/arch/arm/broadcom/bcm2835_aux.c
index cd85374aa1ff..a7f56ee68bb5 100644
--- a/sys/arch/arm/broadcom/bcm2835_aux.c
+++ b/sys/arch/arm/broadcom/bcm2835_aux.c
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_aux.c,v 1.1 2017/12/10 21:38:26 skrll Exp $"
 static int	bcmaux_match(device_t, cfdata_t, void *);
 static void	bcmaux_attach(device_t, device_t, void *);
 
-static struct clk *bcmaux_decode(device_t, const void *, size_t);
+static struct clk *bcmaux_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func bcmaux_fdt_funcs = {
 	.decode = bcmaux_decode
@@ -154,7 +154,7 @@ bcmaux_attach(device_t parent, device_t self, void *aux)
 }
 
 static struct clk *
-bcmaux_decode(device_t dev, const void *data, size_t len)
+bcmaux_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct bcmaux_softc * const sc = device_private(dev);
 	u_int clkid;
diff --git a/sys/arch/arm/broadcom/bcm2835_cprman.c b/sys/arch/arm/broadcom/bcm2835_cprman.c
index fa24547b1988..54e57f0d1469 100644
--- a/sys/arch/arm/broadcom/bcm2835_cprman.c
+++ b/sys/arch/arm/broadcom/bcm2835_cprman.c
@@ -74,7 +74,7 @@ struct cprman_softc {
 
 
 static struct clk *
-cprman_decode(device_t dev, const void *data, size_t len)
+cprman_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct cprman_softc * const sc = device_private(dev);
 	struct cprman_clk *clk;
diff --git a/sys/arch/arm/nvidia/tegra124_car.c b/sys/arch/arm/nvidia/tegra124_car.c
index 7f4b0d09b8e7..94bdb2c910bc 100644
--- a/sys/arch/arm/nvidia/tegra124_car.c
+++ b/sys/arch/arm/nvidia/tegra124_car.c
@@ -53,7 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.14 2017/07/21 01:01:22 jmcneill E
 static int	tegra124_car_match(device_t, cfdata_t, void *);
 static void	tegra124_car_attach(device_t, device_t, void *);
 
-static struct clk *tegra124_car_clock_decode(device_t, const void *, size_t);
+static struct clk *tegra124_car_clock_decode(device_t, int, const void *,
+					     size_t);
 
 static const struct fdtbus_clock_controller_func tegra124_car_fdtclock_funcs = {
 	.decode = tegra124_car_clock_decode
@@ -959,7 +960,8 @@ tegra124_car_clock_find_by_id(u_int clock_id)
 }
 
 static struct clk *
-tegra124_car_clock_decode(device_t dev, const void *data, size_t len)
+tegra124_car_clock_decode(device_t dev, int cc_phandle, const void *data,
+			  size_t len)
 {
 	struct tegra124_car_softc * const sc = device_private(dev);
 	struct tegra_clk *tclk;
diff --git a/sys/arch/arm/nvidia/tegra210_car.c b/sys/arch/arm/nvidia/tegra210_car.c
index b3f09b7daaa7..a8f1ec00b3cb 100644
--- a/sys/arch/arm/nvidia/tegra210_car.c
+++ b/sys/arch/arm/nvidia/tegra210_car.c
@@ -53,7 +53,8 @@ __KERNEL_RCSID(0, "$NetBSD: tegra210_car.c,v 1.18 2018/07/16 23:11:47 christos E
 static int	tegra210_car_match(device_t, cfdata_t, void *);
 static void	tegra210_car_attach(device_t, device_t, void *);
 
-static struct clk *tegra210_car_clock_decode(device_t, const void *, size_t);
+static struct clk *tegra210_car_clock_decode(device_t, int, const void *,
+					     size_t);
 
 static const struct fdtbus_clock_controller_func tegra210_car_fdtclock_funcs = {
 	.decode = tegra210_car_clock_decode
@@ -1069,7 +1070,8 @@ tegra210_car_clock_find_by_id(u_int clock_id)
 }
 
 static struct clk *
-tegra210_car_clock_decode(device_t dev, const void *data, size_t len)
+tegra210_car_clock_decode(device_t dev, int cc_phandle, const void *data,
+			  size_t len)
 {
 	struct tegra210_car_softc * const sc = device_private(dev);
 	struct tegra_clk *tclk;
diff --git a/sys/arch/arm/rockchip/rk_cru.c b/sys/arch/arm/rockchip/rk_cru.c
index a8ea8d77bf94..d37ffbc2a2f3 100644
--- a/sys/arch/arm/rockchip/rk_cru.c
+++ b/sys/arch/arm/rockchip/rk_cru.c
@@ -91,7 +91,7 @@ static const struct fdtbus_reset_controller_func rk_cru_fdtreset_funcs = {
 };
 
 static struct clk *
-rk_cru_clock_decode(device_t dev, const void *data, size_t len)
+rk_cru_clock_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct rk_cru_softc * const sc = device_private(dev);
 	struct rk_cru_clk *clk;
diff --git a/sys/arch/arm/rockchip/rk_usb.c b/sys/arch/arm/rockchip/rk_usb.c
index 7e91f16a5fbc..31958fbd0758 100644
--- a/sys/arch/arm/rockchip/rk_usb.c
+++ b/sys/arch/arm/rockchip/rk_usb.c
@@ -183,7 +183,7 @@ static const struct clk_funcs rk_usb_clk_funcs = {
 };
 
 static struct clk *
-rk_usb_fdt_decode(device_t dev, const void *data, size_t len)
+rk_usb_fdt_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct rk_usb_softc * const sc = device_private(dev);
 
diff --git a/sys/arch/arm/samsung/exynos5410_clock.c b/sys/arch/arm/samsung/exynos5410_clock.c
index bc85b59d847a..c3c6a1729f38 100644
--- a/sys/arch/arm/samsung/exynos5410_clock.c
+++ b/sys/arch/arm/samsung/exynos5410_clock.c
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.3 2018/07/02 20:24:55 jmcneil
 
 #include <dev/fdt/fdtvar.h>
 
-static struct clk *exynos5410_clock_decode(device_t, const void *, size_t);
+static struct clk *exynos5410_clock_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func exynos5410_car_fdtclock_funcs = {
 	.decode = exynos5410_clock_decode
@@ -549,7 +549,8 @@ exynos5410_clock_print(struct exynos5410_clock_softc *sc,
 }
 
 static struct clk *
-exynos5410_clock_decode(device_t dev, const void *data, size_t len)
+exynos5410_clock_decode(device_t dev, int cc_phandle, const void *data,
+			size_t len)
 {
 	struct exynos_clk *eclk;
 
diff --git a/sys/arch/arm/samsung/exynos5422_clock.c b/sys/arch/arm/samsung/exynos5422_clock.c
index 926617c54bcc..29e490076fe7 100644
--- a/sys/arch/arm/samsung/exynos5422_clock.c
+++ b/sys/arch/arm/samsung/exynos5422_clock.c
@@ -47,7 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.12 2018/07/05 13:11:58 jmcnei
 
 #include <dev/fdt/fdtvar.h>
 
-static struct clk *exynos5422_clock_decode(device_t, const void *, size_t);
+static struct clk *exynos5422_clock_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func exynos5422_car_fdtclock_funcs = {
 	.decode = exynos5422_clock_decode
@@ -726,7 +726,8 @@ exynos5422_clock_print(struct exynos5422_clock_softc *sc,
 }
 
 static struct clk *
-exynos5422_clock_decode(device_t dev, const void *data, size_t len)
+exynos5422_clock_decode(device_t dev, int cc_phandle, const void *data,
+			size_t len)
 {
 	struct exynos_clk *eclk;
 
diff --git a/sys/arch/arm/sunxi/sunxi_ccu.c b/sys/arch/arm/sunxi/sunxi_ccu.c
index 672627f5222a..d3c8a00be9db 100644
--- a/sys/arch/arm/sunxi/sunxi_ccu.c
+++ b/sys/arch/arm/sunxi/sunxi_ccu.c
@@ -102,7 +102,8 @@ static const struct fdtbus_reset_controller_func sunxi_ccu_fdtreset_funcs = {
 };
 
 static struct clk *
-sunxi_ccu_clock_decode(device_t dev, const void *data, size_t len)
+sunxi_ccu_clock_decode(device_t dev, int cc_phandle, const void *data,
+		       size_t len)
 {
 	struct sunxi_ccu_softc * const sc = device_private(dev);
 	struct sunxi_ccu_clk *clk;
diff --git a/sys/arch/arm/sunxi/sunxi_gates.c b/sys/arch/arm/sunxi/sunxi_gates.c
index f276a209419b..e2975076f493 100644
--- a/sys/arch/arm/sunxi/sunxi_gates.c
+++ b/sys/arch/arm/sunxi/sunxi_gates.c
@@ -70,7 +70,8 @@ struct sunxi_gates_softc {
 	bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val))
 
 static struct clk *
-sunxi_gates_clock_decode(device_t dev, const void *data, size_t len)
+sunxi_gates_clock_decode(device_t dev, int cc_phandle, const void *data,
+			 size_t len)
 {
 	struct sunxi_gates_softc * const sc = device_private(dev);
 	struct sunxi_gate *gate;
diff --git a/sys/arch/arm/sunxi/sunxi_gmacclk.c b/sys/arch/arm/sunxi/sunxi_gmacclk.c
index 04820a7ccd81..61947995e876 100644
--- a/sys/arch/arm/sunxi/sunxi_gmacclk.c
+++ b/sys/arch/arm/sunxi/sunxi_gmacclk.c
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_gmacclk.c,v 1.1 2017/10/07 13:28:59 jmcneill E
 static int	sunxi_gmacclk_match(device_t, cfdata_t, void *);
 static void	sunxi_gmacclk_attach(device_t, device_t, void *);
 
-static struct clk *sunxi_gmacclk_decode(device_t, const void *, size_t);
+static struct clk *sunxi_gmacclk_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func sunxi_gmacclk_fdt_funcs = {
 	.decode = sunxi_gmacclk_decode
@@ -139,7 +139,8 @@ sunxi_gmacclk_attach(device_t parent, device_t self, void *aux)
 }
 
 static struct clk *
-sunxi_gmacclk_decode(device_t dev, const void *data, size_t len)
+sunxi_gmacclk_decode(device_t dev, int cc_phandle, const void *data,
+		     size_t len)
 {
 	struct sunxi_gmacclk_softc * const sc = device_private(dev);
 
diff --git a/sys/dev/fdt/fdt_clock.c b/sys/dev/fdt/fdt_clock.c
index f82e2c86b63a..d5b605b2d97e 100644
--- a/sys/dev/fdt/fdt_clock.c
+++ b/sys/dev/fdt/fdt_clock.c
@@ -103,7 +103,7 @@ fdtbus_clock_get_index_prop(int phandle, u_int index, const char *prop)
 			cc = fdtbus_get_clock_controller(cc_phandle);
 			if (cc == NULL)
 				break;
-			clk = cc->cc_funcs->decode(cc->cc_dev,
+			clk = cc->cc_funcs->decode(cc->cc_dev, cc_phandle,
 			    clock_cells > 0 ? &p[1] : NULL, clock_cells * 4);
 			break;
 		}
@@ -195,6 +195,7 @@ fdtbus_clock_byname(const char *clkname)
 					break;
 				const u_int index_raw = htobe32(index);
 				return cc->cc_funcs->decode(cc->cc_dev,
+				    cc->cc_phandle,
 				    clock_cells > 0 ? &index_raw : NULL,
 				    clock_cells > 0 ? 4 : 0);
 			}
diff --git a/sys/dev/fdt/fdtvar.h b/sys/dev/fdt/fdtvar.h
index 82a2647a5b91..bb981eb0dc67 100644
--- a/sys/dev/fdt/fdtvar.h
+++ b/sys/dev/fdt/fdtvar.h
@@ -111,7 +111,7 @@ struct fdtbus_regulator_controller_func {
 };
 
 struct fdtbus_clock_controller_func {
-	struct clk *	(*decode)(device_t, const void *, size_t);
+	struct clk *	(*decode)(device_t, int, const void *, size_t);
 };
 
 struct fdtbus_reset_controller;
diff --git a/sys/dev/fdt/fixedclock.c b/sys/dev/fdt/fixedclock.c
index cd13273343e9..df46305c4d97 100644
--- a/sys/dev/fdt/fixedclock.c
+++ b/sys/dev/fdt/fixedclock.c
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: fixedclock.c,v 1.4 2018/06/16 00:13:06 jmcneill Exp
 static int	fixedclock_match(device_t, cfdata_t, void *);
 static void	fixedclock_attach(device_t, device_t, void *);
 
-static struct clk *fixedclock_decode(device_t, const void *, size_t);
+static struct clk *fixedclock_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func fixedclock_fdt_funcs = {
 	.decode = fixedclock_decode
@@ -116,7 +116,7 @@ fixedclock_attach(device_t parent, device_t self, void *aux)
 }
 
 static struct clk *
-fixedclock_decode(device_t dev, const void *data, size_t len)
+fixedclock_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct fixedclock_softc * const sc = device_private(dev);
 
diff --git a/sys/dev/fdt/fixedfactorclock.c b/sys/dev/fdt/fixedfactorclock.c
index c27bed7b59c6..18a904d0514f 100644
--- a/sys/dev/fdt/fixedfactorclock.c
+++ b/sys/dev/fdt/fixedfactorclock.c
@@ -42,7 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: fixedfactorclock.c,v 1.2 2018/04/28 15:21:05 jmcneil
 static int	fixedfactorclock_match(device_t, cfdata_t, void *);
 static void	fixedfactorclock_attach(device_t, device_t, void *);
 
-static struct clk *fixedfactorclock_decode(device_t, const void *, size_t);
+static struct clk *fixedfactorclock_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func fixedfactorclock_fdt_funcs = {
 	.decode = fixedfactorclock_decode
@@ -124,7 +124,8 @@ fixedfactorclock_attach(device_t parent, device_t self, void *aux)
 }
 
 static struct clk *
-fixedfactorclock_decode(device_t dev, const void *data, size_t len)
+fixedfactorclock_decode(device_t dev, int cc_phandle, const void *data,
+			size_t len)
 {
 	struct fixedfactorclock_softc * const sc = device_private(dev);
 


Home | Main Index | Thread Index | Old Index