[PATCH 4/7] clk: sunxi: Use a single driver for all variants

Andre Przywara andre.przywara at arm.com
Mon Jun 27 02:43:41 CEST 2022


On Mon,  9 May 2022 00:29:34 -0500
Samuel Holland <samuel at sholland.org> wrote:

Hi,

> Now that all of the variants use the same bind/probe functions and ops,
> there is no need to have a separate driver for each variant. Since most
> SoCs contain two variants (the main CCU and PRCM CCU), this saves a bit
> of firmware size and RAM.
> 
> Signed-off-by: Samuel Holland <samuel at sholland.org>

Nice one, I like that cleanup. Again I added support for the F1C100s.

Reviewed-by: Andre Przywara <andre.przywara at arm.com>

Cheers,
Andre

> ---
> 
>  drivers/clk/sunxi/clk_a10.c   |  20 +-----
>  drivers/clk/sunxi/clk_a10s.c  |  20 +-----
>  drivers/clk/sunxi/clk_a23.c   |  20 +-----
>  drivers/clk/sunxi/clk_a31.c   |  18 +-----
>  drivers/clk/sunxi/clk_a31_r.c |  22 +------
>  drivers/clk/sunxi/clk_a64.c   |  18 +-----
>  drivers/clk/sunxi/clk_a80.c   |  22 +------
>  drivers/clk/sunxi/clk_a83t.c  |  18 +-----
>  drivers/clk/sunxi/clk_h3.c    |  20 +-----
>  drivers/clk/sunxi/clk_h6.c    |  18 +-----
>  drivers/clk/sunxi/clk_h616.c  |  18 +-----
>  drivers/clk/sunxi/clk_h6_r.c  |  20 +-----
>  drivers/clk/sunxi/clk_r40.c   |  18 +-----
>  drivers/clk/sunxi/clk_sunxi.c | 118 +++++++++++++++++++++++++++++++++-
>  drivers/clk/sunxi/clk_v3s.c   |  20 +-----
>  include/clk/sunxi.h           |  12 ----
>  16 files changed, 131 insertions(+), 271 deletions(-)
> 
> diff --git a/drivers/clk/sunxi/clk_a10.c b/drivers/clk/sunxi/clk_a10.c
> index e5374f6cf0..4752a1167b 100644
> --- a/drivers/clk/sunxi/clk_a10.c
> +++ b/drivers/clk/sunxi/clk_a10.c
> @@ -62,27 +62,9 @@ static struct ccu_reset a10_resets[] = {
>  	[RST_USB_PHY2]		= RESET(0x0cc, BIT(2)),
>  };
>  
> -static const struct ccu_desc a10_ccu_desc = {
> +const struct ccu_desc a10_ccu_desc = {
>  	.gates = a10_gates,
>  	.resets = a10_resets,
>  	.num_gates = ARRAY_SIZE(a10_gates),
>  	.num_resets = ARRAY_SIZE(a10_resets),
>  };
> -
> -static const struct udevice_id a10_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun4i-a10-ccu",
> -	  .data = (ulong)&a10_ccu_desc },
> -	{ .compatible = "allwinner,sun7i-a20-ccu",
> -	  .data = (ulong)&a10_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun4i_a10) = {
> -	.name		= "sun4i_a10_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a10_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c
> index 07d518c121..9619c5f935 100644
> --- a/drivers/clk/sunxi/clk_a10s.c
> +++ b/drivers/clk/sunxi/clk_a10s.c
> @@ -47,27 +47,9 @@ static struct ccu_reset a10s_resets[] = {
>  	[RST_USB_PHY1]		= RESET(0x0cc, BIT(1)),
>  };
>  
> -static const struct ccu_desc a10s_ccu_desc = {
> +const struct ccu_desc a10s_ccu_desc = {
>  	.gates = a10s_gates,
>  	.resets = a10s_resets,
>  	.num_gates = ARRAY_SIZE(a10s_gates),
>  	.num_resets = ARRAY_SIZE(a10s_resets),
>  };
> -
> -static const struct udevice_id a10s_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun5i-a10s-ccu",
> -	  .data = (ulong)&a10s_ccu_desc },
> -	{ .compatible = "allwinner,sun5i-a13-ccu",
> -	  .data = (ulong)&a10s_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun5i_a10s) = {
> -	.name		= "sun5i_a10s_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a10s_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a23.c b/drivers/clk/sunxi/clk_a23.c
> index 9c0e5db07c..5e19c11c23 100644
> --- a/drivers/clk/sunxi/clk_a23.c
> +++ b/drivers/clk/sunxi/clk_a23.c
> @@ -66,27 +66,9 @@ static struct ccu_reset a23_resets[] = {
>  	[RST_BUS_UART4]		= RESET(0x2d8, BIT(20)),
>  };
>  
> -static const struct ccu_desc a23_ccu_desc = {
> +const struct ccu_desc a23_ccu_desc = {
>  	.gates = a23_gates,
>  	.resets = a23_resets,
>  	.num_gates = ARRAY_SIZE(a23_gates),
>  	.num_resets = ARRAY_SIZE(a23_resets),
>  };
> -
> -static const struct udevice_id a23_clk_ids[] = {
> -	{ .compatible = "allwinner,sun8i-a23-ccu",
> -	  .data = (ulong)&a23_ccu_desc },
> -	{ .compatible = "allwinner,sun8i-a33-ccu",
> -	  .data = (ulong)&a23_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun8i_a23) = {
> -	.name		= "sun8i_a23_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a23_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a31.c b/drivers/clk/sunxi/clk_a31.c
> index 3d0767e290..0aaaaf58ea 100644
> --- a/drivers/clk/sunxi/clk_a31.c
> +++ b/drivers/clk/sunxi/clk_a31.c
> @@ -87,25 +87,9 @@ static struct ccu_reset a31_resets[] = {
>  	[RST_APB2_UART5]	= RESET(0x2d8, BIT(21)),
>  };
>  
> -static const struct ccu_desc a31_ccu_desc = {
> +const struct ccu_desc a31_ccu_desc = {
>  	.gates = a31_gates,
>  	.resets = a31_resets,
>  	.num_gates = ARRAY_SIZE(a31_gates),
>  	.num_resets = ARRAY_SIZE(a31_resets),
>  };
> -
> -static const struct udevice_id a31_clk_ids[] = {
> -	{ .compatible = "allwinner,sun6i-a31-ccu",
> -	  .data = (ulong)&a31_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun6i_a31) = {
> -	.name		= "sun6i_a31_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a31_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a31_r.c b/drivers/clk/sunxi/clk_a31_r.c
> index 04c238204d..fa6887fa75 100644
> --- a/drivers/clk/sunxi/clk_a31_r.c
> +++ b/drivers/clk/sunxi/clk_a31_r.c
> @@ -28,29 +28,9 @@ static struct ccu_reset a31_r_resets[] = {
>  	[RST_APB0_I2C]		= RESET(0x0b0, BIT(6)),
>  };
>  
> -static const struct ccu_desc a31_r_ccu_desc = {
> +const struct ccu_desc a31_r_ccu_desc = {
>  	.gates = a31_r_gates,
>  	.resets = a31_r_resets,
>  	.num_gates = ARRAY_SIZE(a31_r_gates),
>  	.num_resets = 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 },
> -	{ .compatible = "allwinner,sun8i-h3-r-ccu",
> -	  .data = (ulong)&a31_r_ccu_desc },
> -	{ .compatible = "allwinner,sun50i-a64-r-ccu",
> -	  .data = (ulong)&a31_r_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun6i_a31_r) = {
> -	.name		= "sun6i_a31_r_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a31_r_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a64.c b/drivers/clk/sunxi/clk_a64.c
> index b41260cbe6..bd50cd4dda 100644
> --- a/drivers/clk/sunxi/clk_a64.c
> +++ b/drivers/clk/sunxi/clk_a64.c
> @@ -73,25 +73,9 @@ static const struct ccu_reset a64_resets[] = {
>  	[RST_BUS_UART4]		= RESET(0x2d8, BIT(20)),
>  };
>  
> -static const struct ccu_desc a64_ccu_desc = {
> +const struct ccu_desc a64_ccu_desc = {
>  	.gates = a64_gates,
>  	.resets = a64_resets,
>  	.num_gates = ARRAY_SIZE(a64_gates),
>  	.num_resets = ARRAY_SIZE(a64_resets),
>  };
> -
> -static const struct udevice_id a64_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun50i-a64-ccu",
> -	  .data = (ulong)&a64_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun50i_a64) = {
> -	.name		= "sun50i_a64_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a64_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a80.c b/drivers/clk/sunxi/clk_a80.c
> index a3ad3b7804..561380c817 100644
> --- a/drivers/clk/sunxi/clk_a80.c
> +++ b/drivers/clk/sunxi/clk_a80.c
> @@ -72,34 +72,16 @@ static const struct ccu_reset a80_mmc_resets[] = {
>  	[3]			= GATE(0xc, BIT(18)),
>  };
>  
> -static const struct ccu_desc a80_ccu_desc = {
> +const struct ccu_desc a80_ccu_desc = {
>  	.gates = a80_gates,
>  	.resets = a80_resets,
>  	.num_gates = ARRAY_SIZE(a80_gates),
>  	.num_resets = ARRAY_SIZE(a80_resets),
>  };
>  
> -static const struct ccu_desc a80_mmc_clk_desc = {
> +const struct ccu_desc a80_mmc_clk_desc = {
>  	.gates = a80_mmc_gates,
>  	.resets = a80_mmc_resets,
>  	.num_gates = ARRAY_SIZE(a80_mmc_gates),
>  	.num_resets = ARRAY_SIZE(a80_mmc_resets),
>  };
> -
> -static const struct udevice_id a80_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun9i-a80-ccu",
> -	  .data = (ulong)&a80_ccu_desc },
> -	{ .compatible = "allwinner,sun9i-a80-mmc-config-clk",
> -	  .data = (ulong)&a80_mmc_clk_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun9i_a80) = {
> -	.name		= "sun9i_a80_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a80_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_a83t.c b/drivers/clk/sunxi/clk_a83t.c
> index cad5b484cf..e246437af2 100644
> --- a/drivers/clk/sunxi/clk_a83t.c
> +++ b/drivers/clk/sunxi/clk_a83t.c
> @@ -70,25 +70,9 @@ static struct ccu_reset a83t_resets[] = {
>  	[RST_BUS_UART4]		= RESET(0x2d8, BIT(20)),
>  };
>  
> -static const struct ccu_desc a83t_ccu_desc = {
> +const struct ccu_desc a83t_ccu_desc = {
>  	.gates = a83t_gates,
>  	.resets = a83t_resets,
>  	.num_gates = ARRAY_SIZE(a83t_gates),
>  	.num_resets = ARRAY_SIZE(a83t_resets),
>  };
> -
> -static const struct udevice_id a83t_clk_ids[] = {
> -	{ .compatible = "allwinner,sun8i-a83t-ccu",
> -	  .data = (ulong)&a83t_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun8i_a83t) = {
> -	.name		= "sun8i_a83t_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= a83t_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_h3.c b/drivers/clk/sunxi/clk_h3.c
> index 3b4e9af111..5d2a53185e 100644
> --- a/drivers/clk/sunxi/clk_h3.c
> +++ b/drivers/clk/sunxi/clk_h3.c
> @@ -86,27 +86,9 @@ static struct ccu_reset h3_resets[] = {
>  	[RST_BUS_UART3]		= RESET(0x2d8, BIT(19)),
>  };
>  
> -static const struct ccu_desc h3_ccu_desc = {
> +const struct ccu_desc h3_ccu_desc = {
>  	.gates = h3_gates,
>  	.resets = h3_resets,
>  	.num_gates = ARRAY_SIZE(h3_gates),
>  	.num_resets = ARRAY_SIZE(h3_resets),
>  };
> -
> -static const struct udevice_id h3_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun8i-h3-ccu",
> -	  .data = (ulong)&h3_ccu_desc },
> -	{ .compatible = "allwinner,sun50i-h5-ccu",
> -	  .data = (ulong)&h3_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun8i_h3) = {
> -	.name		= "sun8i_h3_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= h3_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_h6.c b/drivers/clk/sunxi/clk_h6.c
> index 93343b090d..02ba07bdaf 100644
> --- a/drivers/clk/sunxi/clk_h6.c
> +++ b/drivers/clk/sunxi/clk_h6.c
> @@ -87,25 +87,9 @@ static struct ccu_reset h6_resets[] = {
>  	[RST_BUS_OTG]		= RESET(0xa8c, BIT(24)),
>  };
>  
> -static const struct ccu_desc h6_ccu_desc = {
> +const struct ccu_desc h6_ccu_desc = {
>  	.gates = h6_gates,
>  	.resets = h6_resets,
>  	.num_gates = ARRAY_SIZE(h6_gates),
>  	.num_resets = ARRAY_SIZE(h6_resets),
>  };
> -
> -static const struct udevice_id h6_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun50i-h6-ccu",
> -	  .data = (ulong)&h6_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun50i_h6) = {
> -	.name		= "sun50i_h6_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= h6_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_h616.c b/drivers/clk/sunxi/clk_h616.c
> index e791736093..abcc6fc264 100644
> --- a/drivers/clk/sunxi/clk_h616.c
> +++ b/drivers/clk/sunxi/clk_h616.c
> @@ -105,25 +105,9 @@ static struct ccu_reset h616_resets[] = {
>  	[RST_BUS_OTG]		= RESET(0xa8c, BIT(24)),
>  };
>  
> -static const struct ccu_desc h616_ccu_desc = {
> +const struct ccu_desc h616_ccu_desc = {
>  	.gates = h616_gates,
>  	.resets = h616_resets,
>  	.num_gates = ARRAY_SIZE(h616_gates),
>  	.num_resets = ARRAY_SIZE(h616_resets),
>  };
> -
> -static const struct udevice_id h616_ccu_ids[] = {
> -	{ .compatible = "allwinner,sun50i-h616-ccu",
> -	  .data = (ulong)&h616_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun50i_h616) = {
> -	.name		= "sun50i_h616_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= h616_ccu_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_h6_r.c b/drivers/clk/sunxi/clk_h6_r.c
> index 0f5cefd687..d82f791e79 100644
> --- a/drivers/clk/sunxi/clk_h6_r.c
> +++ b/drivers/clk/sunxi/clk_h6_r.c
> @@ -32,27 +32,9 @@ static struct ccu_reset h6_r_resets[] = {
>  	[RST_R_APB1_W1]		= RESET(0x1ec, BIT(16)),
>  };
>  
> -static const struct ccu_desc h6_r_ccu_desc = {
> +const struct ccu_desc h6_r_ccu_desc = {
>  	.gates = h6_r_gates,
>  	.resets = h6_r_resets,
>  	.num_gates = ARRAY_SIZE(h6_r_gates),
>  	.num_resets = 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 },
> -	{ .compatible = "allwinner,sun50i-h616-r-ccu",
> -	  .data = (ulong)&h6_r_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun6i_h6_r) = {
> -	.name		= "sun6i_h6_r_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= h6_r_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_r40.c b/drivers/clk/sunxi/clk_r40.c
> index a59ac06975..a5b756be40 100644
> --- a/drivers/clk/sunxi/clk_r40.c
> +++ b/drivers/clk/sunxi/clk_r40.c
> @@ -97,25 +97,9 @@ static struct ccu_reset r40_resets[] = {
>  	[RST_BUS_UART7]		= RESET(0x2d8, BIT(23)),
>  };
>  
> -static const struct ccu_desc r40_ccu_desc = {
> +const struct ccu_desc r40_ccu_desc = {
>  	.gates = r40_gates,
>  	.resets = r40_resets,
>  	.num_gates = ARRAY_SIZE(r40_gates),
>  	.num_resets = ARRAY_SIZE(r40_resets),
>  };
> -
> -static const struct udevice_id r40_clk_ids[] = {
> -	{ .compatible = "allwinner,sun8i-r40-ccu",
> -	  .data = (ulong)&r40_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun8i_r40) = {
> -	.name		= "sun8i_r40_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= r40_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/drivers/clk/sunxi/clk_sunxi.c b/drivers/clk/sunxi/clk_sunxi.c
> index e1129f6ccf..7d9e6029ff 100644
> --- a/drivers/clk/sunxi/clk_sunxi.c
> +++ b/drivers/clk/sunxi/clk_sunxi.c
> @@ -64,12 +64,12 @@ struct clk_ops sunxi_clk_ops = {
>  	.disable = sunxi_clk_disable,
>  };
>  
> -int sunxi_clk_bind(struct udevice *dev)
> +static int sunxi_clk_bind(struct udevice *dev)
>  {
>  	return sunxi_reset_bind(dev);
>  }
>  
> -int sunxi_clk_probe(struct udevice *dev)
> +static int sunxi_clk_probe(struct udevice *dev)
>  {
>  	struct ccu_priv *priv = dev_get_priv(dev);
>  	struct clk_bulk clk_bulk;
> @@ -94,3 +94,117 @@ int sunxi_clk_probe(struct udevice *dev)
>  
>  	return 0;
>  }
> +
> +extern const struct ccu_desc a10_ccu_desc;
> +extern const struct ccu_desc a10s_ccu_desc;
> +extern const struct ccu_desc a23_ccu_desc;
> +extern const struct ccu_desc a31_ccu_desc;
> +extern const struct ccu_desc a31_r_ccu_desc;
> +extern const struct ccu_desc a64_ccu_desc;
> +extern const struct ccu_desc a80_ccu_desc;
> +extern const struct ccu_desc a80_mmc_clk_desc;
> +extern const struct ccu_desc a83t_ccu_desc;
> +extern const struct ccu_desc h3_ccu_desc;
> +extern const struct ccu_desc h6_ccu_desc;
> +extern const struct ccu_desc h616_ccu_desc;
> +extern const struct ccu_desc h6_r_ccu_desc;
> +extern const struct ccu_desc r40_ccu_desc;
> +extern const struct ccu_desc v3s_ccu_desc;
> +
> +static const struct udevice_id sunxi_clk_ids[] = {
> +#ifdef CONFIG_CLK_SUN4I_A10
> +	{ .compatible = "allwinner,sun4i-a10-ccu",
> +	  .data = (ulong)&a10_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN5I_A10S
> +	{ .compatible = "allwinner,sun5i-a10s-ccu",
> +	  .data = (ulong)&a10s_ccu_desc },
> +	{ .compatible = "allwinner,sun5i-a13-ccu",
> +	  .data = (ulong)&a10s_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN6I_A31
> +	{ .compatible = "allwinner,sun6i-a31-ccu",
> +	  .data = (ulong)&a31_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN4I_A10
> +	{ .compatible = "allwinner,sun7i-a20-ccu",
> +	  .data = (ulong)&a10_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN8I_A23
> +	{ .compatible = "allwinner,sun8i-a23-ccu",
> +	  .data = (ulong)&a23_ccu_desc },
> +	{ .compatible = "allwinner,sun8i-a33-ccu",
> +	  .data = (ulong)&a23_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN8I_A83T
> +	{ .compatible = "allwinner,sun8i-a83t-ccu",
> +	  .data = (ulong)&a83t_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN6I_A31_R
> +	{ .compatible = "allwinner,sun8i-a83t-r-ccu",
> +	  .data = (ulong)&a31_r_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN8I_H3
> +	{ .compatible = "allwinner,sun8i-h3-ccu",
> +	  .data = (ulong)&h3_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN6I_A31_R
> +	{ .compatible = "allwinner,sun8i-h3-r-ccu",
> +	  .data = (ulong)&a31_r_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN8I_R40
> +	{ .compatible = "allwinner,sun8i-r40-ccu",
> +	  .data = (ulong)&r40_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN8I_V3S
> +	{ .compatible = "allwinner,sun8i-v3-ccu",
> +	  .data = (ulong)&v3s_ccu_desc },
> +	{ .compatible = "allwinner,sun8i-v3s-ccu",
> +	  .data = (ulong)&v3s_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN9I_A80
> +	{ .compatible = "allwinner,sun9i-a80-ccu",
> +	  .data = (ulong)&a80_ccu_desc },
> +	{ .compatible = "allwinner,sun9i-a80-mmc-config-clk",
> +	  .data = (ulong)&a80_mmc_clk_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN50I_A64
> +	{ .compatible = "allwinner,sun50i-a64-ccu",
> +	  .data = (ulong)&a64_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN6I_A31_R
> +	{ .compatible = "allwinner,sun50i-a64-r-ccu",
> +	  .data = (ulong)&a31_r_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN8I_H3
> +	{ .compatible = "allwinner,sun50i-h5-ccu",
> +	  .data = (ulong)&h3_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN50I_H6
> +	{ .compatible = "allwinner,sun50i-h6-ccu",
> +	  .data = (ulong)&h6_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN50I_H6_R
> +	{ .compatible = "allwinner,sun50i-h6-r-ccu",
> +	  .data = (ulong)&h6_r_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN50I_H616
> +	{ .compatible = "allwinner,sun50i-h616-ccu",
> +	  .data = (ulong)&h616_ccu_desc },
> +#endif
> +#ifdef CONFIG_CLK_SUN50I_H6_R
> +	{ .compatible = "allwinner,sun50i-h616-r-ccu",
> +	  .data = (ulong)&h6_r_ccu_desc },
> +#endif
> +	{ }
> +};
> +
> +U_BOOT_DRIVER(sunxi_clk) = {
> +	.name		= "sunxi_clk",
> +	.id		= UCLASS_CLK,
> +	.of_match	= sunxi_clk_ids,
> +	.bind		= sunxi_clk_bind,
> +	.probe		= sunxi_clk_probe,
> +	.priv_auto	= sizeof(struct ccu_priv),
> +	.ops		= &sunxi_clk_ops,
> +};
> diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c
> index c6a17b4535..e632afc083 100644
> --- a/drivers/clk/sunxi/clk_v3s.c
> +++ b/drivers/clk/sunxi/clk_v3s.c
> @@ -47,27 +47,9 @@ static struct ccu_reset v3s_resets[] = {
>  	[RST_BUS_UART2]		= RESET(0x2d8, BIT(18)),
>  };
>  
> -static const struct ccu_desc v3s_ccu_desc = {
> +const struct ccu_desc v3s_ccu_desc = {
>  	.gates = v3s_gates,
>  	.resets = v3s_resets,
>  	.num_gates = ARRAY_SIZE(v3s_gates),
>  	.num_resets = ARRAY_SIZE(v3s_resets),
>  };
> -
> -static const struct udevice_id v3s_clk_ids[] = {
> -	{ .compatible = "allwinner,sun8i-v3s-ccu",
> -	  .data = (ulong)&v3s_ccu_desc },
> -	{ .compatible = "allwinner,sun8i-v3-ccu",
> -	  .data = (ulong)&v3s_ccu_desc },
> -	{ }
> -};
> -
> -U_BOOT_DRIVER(clk_sun8i_v3s) = {
> -	.name		= "sun8i_v3s_ccu",
> -	.id		= UCLASS_CLK,
> -	.of_match	= v3s_clk_ids,
> -	.priv_auto	= sizeof(struct ccu_priv),
> -	.ops		= &sunxi_clk_ops,
> -	.probe		= sunxi_clk_probe,
> -	.bind		= sunxi_clk_bind,
> -};
> diff --git a/include/clk/sunxi.h b/include/clk/sunxi.h
> index c798c226f5..11caf12b17 100644
> --- a/include/clk/sunxi.h
> +++ b/include/clk/sunxi.h
> @@ -80,18 +80,6 @@ struct ccu_priv {
>  	const struct ccu_desc *desc;
>  };
>  
> -/**
> - * sunxi_clk_bind - common sunxi clock bind
> - * @dev:	clock device
> - */
> -int sunxi_clk_bind(struct udevice *dev);
> -
> -/**
> - * sunxi_clk_probe - common sunxi clock probe
> - * @dev:	clock device
> - */
> -int sunxi_clk_probe(struct udevice *dev);
> -
>  extern struct clk_ops sunxi_clk_ops;
>  
>  /**



More information about the U-Boot mailing list