[U-Boot] [PATCH v1 2/2] clk: at91: Add .ops callback for clk_generic

Wenyou.Yang at microchip.com Wenyou.Yang at microchip.com
Fri Sep 2 03:46:31 CEST 2016


Hi Stephen,

> > Subject: [PATCH v1 2/2] clk: at91: Add .ops callback for clk_generic
> >
> > To avoid the wild pointer as NULL->of_xlate, add an empty .ops
> > callback for the clk_generic driver.
> 
> This shouldn't be needed. If this driver isn't a clock provider, and it cannot be a
> clock provider without implementing and clock ops, then nothing should be calling
> of_xlate through its ops pointer, and the driver shouldn't be a UCLASS_CLK.

The Atmel clock tree structure has some difference, take the following spi0 node as an example.
The 'spi0' node use the 'clocks' phandle to refer to the 'spi0_clk' node to enable its clock.

The 'spi0_clk' doesn't provide .ops->enable(), only its peripheral ID via 'reg' property.
It uses its parent node (i.e. periph32ck) .ops->enable(), shared with other sibling nodes.

These nodes as 'spi0_clk' don't have .compatible, which is bound with the 'clk_generic' driver.
If not provide .ops for the 'clk_generic' driver, it will produce the wild pointer as NULL->of_xlate
when call clk_get_by_index() in the spi driver.


	periph32ck {
		compatible = "atmel,at91sam9x5-clk-peripheral";
		#address-cells = <1>;
		#size-cells = <0>;
		clocks = <&h32ck>;

		[snip]

		twi0_clk: twi0_clk {
			reg = <29>;
			#clock-cells = <0>;
			atmel,clk-output-range = <0 83000000>;
		};

		[snip]

		spi0_clk: spi0_clk {
			#clock-cells = <0>;
			reg = <33>;
			atmel,clk-output-range = <0 83000000>;
		};

		[snip]

	};

	[snip]
				
	spi0: spi at f8000000 {
		compatible = "atmel,at91rm9200-spi";
		reg = <0xf8000000 0x100>;
		clocks = <&spi0_clk>;
		clock-names = "spi_clk";
	};

Thanks.

Best Regards,
Wenyou Yang


More information about the U-Boot mailing list