reset: sunxi: Get the reset count from the CCU descriptor
This allows all of the clock drivers to use a common bind function.
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
[Andre: add F1C100s support]
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
diff --git a/drivers/clk/sunxi/clk_a10.c b/drivers/clk/sunxi/clk_a10.c
index b3cca2a..7bd9a37 100644
--- a/drivers/clk/sunxi/clk_a10.c
+++ b/drivers/clk/sunxi/clk_a10.c
@@ -71,11 +71,6 @@
.num_resets = ARRAY_SIZE(a10_resets),
};
-static int a10_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a10_resets));
-}
-
static const struct udevice_id a10_ccu_ids[] = {
{ .compatible = "allwinner,sun4i-a10-ccu",
.data = (ulong)&a10_ccu_desc },
@@ -91,5 +86,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a10_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c
index 0e75c30..4a83d6b 100644
--- a/drivers/clk/sunxi/clk_a10s.c
+++ b/drivers/clk/sunxi/clk_a10s.c
@@ -56,11 +56,6 @@
.num_resets = ARRAY_SIZE(a10s_resets),
};
-static int a10s_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a10s_resets));
-}
-
static const struct udevice_id a10s_ccu_ids[] = {
{ .compatible = "allwinner,sun5i-a10s-ccu",
.data = (ulong)&a10s_ccu_desc },
@@ -76,5 +71,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a10s_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a23.c b/drivers/clk/sunxi/clk_a23.c
index a9c77ba..c7f516d 100644
--- a/drivers/clk/sunxi/clk_a23.c
+++ b/drivers/clk/sunxi/clk_a23.c
@@ -75,11 +75,6 @@
.num_resets = ARRAY_SIZE(a23_resets),
};
-static int a23_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a23_resets));
-}
-
static const struct udevice_id a23_clk_ids[] = {
{ .compatible = "allwinner,sun8i-a23-ccu",
.data = (ulong)&a23_ccu_desc },
@@ -95,5 +90,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a23_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a31.c b/drivers/clk/sunxi/clk_a31.c
index 69df4e0..aa113fa 100644
--- a/drivers/clk/sunxi/clk_a31.c
+++ b/drivers/clk/sunxi/clk_a31.c
@@ -96,11 +96,6 @@
.num_resets = ARRAY_SIZE(a31_resets),
};
-static int a31_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a31_resets));
-}
-
static const struct udevice_id a31_clk_ids[] = {
{ .compatible = "allwinner,sun6i-a31-ccu",
.data = (ulong)&a31_ccu_desc },
@@ -114,5 +109,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a31_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a31_r.c b/drivers/clk/sunxi/clk_a31_r.c
index 7bf1c45..04c2382 100644
--- a/drivers/clk/sunxi/clk_a31_r.c
+++ b/drivers/clk/sunxi/clk_a31_r.c
@@ -35,11 +35,6 @@
.num_resets = ARRAY_SIZE(a31_r_resets),
};
-static int a31_r_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a31_r_resets));
-}
-
static const struct udevice_id a31_r_clk_ids[] = {
{ .compatible = "allwinner,sun8i-a83t-r-ccu",
.data = (ulong)&a31_r_ccu_desc },
@@ -57,5 +52,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a31_r_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a64.c b/drivers/clk/sunxi/clk_a64.c
index e24d5c5..eac1151 100644
--- a/drivers/clk/sunxi/clk_a64.c
+++ b/drivers/clk/sunxi/clk_a64.c
@@ -84,11 +84,6 @@
.num_resets = ARRAY_SIZE(a64_resets),
};
-static int a64_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a64_resets));
-}
-
static const struct udevice_id a64_ccu_ids[] = {
{ .compatible = "allwinner,sun50i-a64-ccu",
.data = (ulong)&a64_ccu_desc },
@@ -102,5 +97,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a64_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a80.c b/drivers/clk/sunxi/clk_a80.c
index adedcba..426205d 100644
--- a/drivers/clk/sunxi/clk_a80.c
+++ b/drivers/clk/sunxi/clk_a80.c
@@ -88,16 +88,6 @@
.num_resets = ARRAY_SIZE(a80_mmc_resets),
};
-static int a80_clk_bind(struct udevice *dev)
-{
- ulong count = ARRAY_SIZE(a80_resets);
-
- if (device_is_compatible(dev, "allwinner,sun9i-a80-mmc-config-clk"))
- count = ARRAY_SIZE(a80_mmc_resets);
-
- return sunxi_reset_bind(dev, count);
-}
-
static const struct udevice_id a80_ccu_ids[] = {
{ .compatible = "allwinner,sun9i-a80-ccu",
.data = (ulong)&a80_ccu_desc },
@@ -113,5 +103,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a80_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_a83t.c b/drivers/clk/sunxi/clk_a83t.c
index 4a0659a..464e95c 100644
--- a/drivers/clk/sunxi/clk_a83t.c
+++ b/drivers/clk/sunxi/clk_a83t.c
@@ -79,11 +79,6 @@
.num_resets = ARRAY_SIZE(a83t_resets),
};
-static int a83t_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(a83t_resets));
-}
-
static const struct udevice_id a83t_clk_ids[] = {
{ .compatible = "allwinner,sun8i-a83t-ccu",
.data = (ulong)&a83t_ccu_desc },
@@ -97,5 +92,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = a83t_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_f1c100s.c b/drivers/clk/sunxi/clk_f1c100s.c
index cb0159e..acba8f2 100644
--- a/drivers/clk/sunxi/clk_f1c100s.c
+++ b/drivers/clk/sunxi/clk_f1c100s.c
@@ -54,11 +54,6 @@
.num_resets = ARRAY_SIZE(f1c100s_resets),
};
-static int f1c100s_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(f1c100s_resets));
-}
-
static const struct udevice_id f1c100s_clk_ids[] = {
{ .compatible = "allwinner,suniv-f1c100s-ccu",
.data = (ulong)&f1c100s_ccu_desc },
@@ -72,5 +67,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = f1c100s_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_h3.c b/drivers/clk/sunxi/clk_h3.c
index d69cb04..474cf98 100644
--- a/drivers/clk/sunxi/clk_h3.c
+++ b/drivers/clk/sunxi/clk_h3.c
@@ -97,11 +97,6 @@
.num_resets = ARRAY_SIZE(h3_resets),
};
-static int h3_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(h3_resets));
-}
-
static const struct udevice_id h3_ccu_ids[] = {
{ .compatible = "allwinner,sun8i-h3-ccu",
.data = (ulong)&h3_ccu_desc },
@@ -117,5 +112,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = h3_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_h6.c b/drivers/clk/sunxi/clk_h6.c
index f8d2379..4e717af 100644
--- a/drivers/clk/sunxi/clk_h6.c
+++ b/drivers/clk/sunxi/clk_h6.c
@@ -98,11 +98,6 @@
.num_resets = ARRAY_SIZE(h6_resets),
};
-static int h6_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(h6_resets));
-}
-
static const struct udevice_id h6_ccu_ids[] = {
{ .compatible = "allwinner,sun50i-h6-ccu",
.data = (ulong)&h6_ccu_desc },
@@ -116,5 +111,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = h6_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_h616.c b/drivers/clk/sunxi/clk_h616.c
index 34cfcff..1ecccd7 100644
--- a/drivers/clk/sunxi/clk_h616.c
+++ b/drivers/clk/sunxi/clk_h616.c
@@ -116,11 +116,6 @@
.num_resets = ARRAY_SIZE(h616_resets),
};
-static int h616_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(h616_resets));
-}
-
static const struct udevice_id h616_ccu_ids[] = {
{ .compatible = "allwinner,sun50i-h616-ccu",
.data = (ulong)&h616_ccu_desc },
@@ -134,5 +129,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = h616_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_h6_r.c b/drivers/clk/sunxi/clk_h6_r.c
index 1891375..bb67d58 100644
--- a/drivers/clk/sunxi/clk_h6_r.c
+++ b/drivers/clk/sunxi/clk_h6_r.c
@@ -41,11 +41,6 @@
.num_resets = ARRAY_SIZE(h6_r_resets),
};
-static int h6_r_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(h6_r_resets));
-}
-
static const struct udevice_id h6_r_clk_ids[] = {
{ .compatible = "allwinner,sun50i-h6-r-ccu",
.data = (ulong)&h6_r_ccu_desc },
@@ -61,5 +56,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = h6_r_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_r40.c b/drivers/clk/sunxi/clk_r40.c
index 81e4a02..daab6ad 100644
--- a/drivers/clk/sunxi/clk_r40.c
+++ b/drivers/clk/sunxi/clk_r40.c
@@ -106,11 +106,6 @@
.num_resets = ARRAY_SIZE(r40_resets),
};
-static int r40_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(r40_resets));
-}
-
static const struct udevice_id r40_clk_ids[] = {
{ .compatible = "allwinner,sun8i-r40-ccu",
.data = (ulong)&r40_ccu_desc },
@@ -124,5 +119,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = r40_clk_bind,
+ .bind = sunxi_clk_bind,
};
diff --git a/drivers/clk/sunxi/clk_sunxi.c b/drivers/clk/sunxi/clk_sunxi.c
index 62e7738..23d81f6 100644
--- a/drivers/clk/sunxi/clk_sunxi.c
+++ b/drivers/clk/sunxi/clk_sunxi.c
@@ -67,6 +67,11 @@
.disable = sunxi_clk_disable,
};
+int sunxi_clk_bind(struct udevice *dev)
+{
+ return sunxi_reset_bind(dev);
+}
+
int sunxi_clk_probe(struct udevice *dev)
{
struct ccu_priv *priv = dev_get_priv(dev);
diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c
index f45e940..5b5afa6 100644
--- a/drivers/clk/sunxi/clk_v3s.c
+++ b/drivers/clk/sunxi/clk_v3s.c
@@ -56,11 +56,6 @@
.num_resets = ARRAY_SIZE(v3s_resets),
};
-static int v3s_clk_bind(struct udevice *dev)
-{
- return sunxi_reset_bind(dev, ARRAY_SIZE(v3s_resets));
-}
-
static const struct udevice_id v3s_clk_ids[] = {
{ .compatible = "allwinner,sun8i-v3s-ccu",
.data = (ulong)&v3s_ccu_desc },
@@ -76,5 +71,5 @@
.priv_auto = sizeof(struct ccu_priv),
.ops = &sunxi_clk_ops,
.probe = sunxi_clk_probe,
- .bind = v3s_clk_bind,
+ .bind = sunxi_clk_bind,
};