[U-Boot] [PATCH v2 2/7] clk: at91: Improve the clock implementation

Stephen Warren swarren at wwwdotorg.org
Tue Sep 20 23:27:51 CEST 2016


On 09/18/2016 12:53 AM, Wenyou Yang wrote:
> For the peripheral clock, provide the clock ops for the clock
> provider, such as spi0_clk. The .of_xlate is to get the clk->id,
> the .enable is to enable the spi0 peripheral clock, the .get_rate
> is to get the clock frequency.
>
> The driver for periph32ck node is responsible for recursively
> binding its children as clk devices, not provide the clock ops.
>
> So do the generated clock and system clock.

> diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c

> -static ulong generated_clk_get_rate(struct clk *clk)
> +static int generic_clk_of_xlate(struct clk *clk,
> +			       struct fdtdec_phandle_args *args)
> +{
> +	return at91_clk_of_xlate(clk, args);
> +}

You don't need this wrapper function; simply do the following:

static struct clk_ops generic_clk_ops = {
	.of_xlate = at91_clk_of_xlate,

The same comment applies to the other places at91_clk_of_xlate is used.

> +static int generic_clk_probe(struct udevice *dev)
>  {
> -	return at91_pmc_core_probe(dev);
> +	return at91_clk_probe(dev);
>  }

Same comment here.

> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c

> +int at91_clk_of_xlate(struct clk *clk, struct fdtdec_phandle_args *args)
> +{
> +	int periph;
> +
> +	if (args->args_count) {
> +		debug("Invaild args_count: %d\n", args->args_count);

s/Invaild/Invalid/

Aside from those issues,
Acked-by: Stephen Warren <swarren at nvidia.com>


More information about the U-Boot mailing list