[OpenWrt-Devel] [PATCH 1/2] lantiq: add device tree binding for the phy clock source

John Crispin john at phrozen.org
Sat Apr 30 11:28:37 EDT 2016


Hi,

thanks for the patches,bet that was fun to figure out. comment inline

On 30/04/2016 14:25, Mathias Kresin wrote:
> Signed-off-by: Mathias Kresin <openwrt at kresin.me>
> ---
>  ...x200-add-gphy-clk-src-device-tree-binding.patch | 26 ++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 target/linux/lantiq/patches-4.4/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch
> 
> diff --git a/target/linux/lantiq/patches-4.4/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch b/target/linux/lantiq/patches-4.4/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch
> new file mode 100644
> index 0000000..7a4d239
> --- /dev/null
> +++ b/target/linux/lantiq/patches-4.4/0301-xrx200-add-gphy-clk-src-device-tree-binding.patch
> @@ -0,0 +1,26 @@
> +--- a/arch/mips/lantiq/xway/sysctrl.c
> ++++ b/arch/mips/lantiq/xway/sysctrl.c
> +@@ -426,6 +426,8 @@ static void clkdev_add_clkout(void)
> + /* bring up all register ranges that we need for basic system control */
> + void __init ltq_soc_init(void)
> + {
> ++	int ret;
> ++	u32 phy_clk_src, ifcc;
> + 	struct resource res_pmu, res_cgu, res_ebu;
> + 	struct device_node *np_pmu =
> + 			of_find_compatible_node(NULL, NULL, "lantiq,pmu-xway");
> +@@ -608,4 +610,14 @@ void __init ltq_soc_init(void)
> + 
> + 	if (of_machine_is_compatible("lantiq,vr9"))
> + 		xbar_fpi_burst_disable();
> ++
> ++	if (np_cgu) {
> ++		ret = of_property_read_u32(np_cgu, "lantiq,phy-clk-src",
> ++					   &phy_clk_src);
> ++
> ++		if (!ret) {
> ++			ifcc = ltq_cgu_r32(ifccr) & ~(0x1c);
> ++			ltq_cgu_w32(ifcc | (phy_clk_src << 2), ifccr);
> ++		}
> ++	}

can you move this into its own function and then do a if (!np) return at
the start of that function to reduce indentation

	John

> + }
> 
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list