Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: rockchip: Handle clock tree for rk3288w variant

The revision rk3288w has a different clock tree about "hclk_vio"
clock, according to the BSP kernel code.

This patch handles this difference by detecting which device-tree
we are using. If it is a "rockchip,rk3288-cru", let's register
the clock tree as it was before. If the device-tree node is
"rockchip,rk3288w-cru", we will apply the difference with this
version of this SoC.

Noticed that this new device-tree compatible must be handled in
bootloader such as u-boot.

Signed-off-by: Mylène Josserand <mylene.josserand@collabora.com>
Link: https://lore.kernel.org/r/20200602080644.11333-2-mylene.josserand@collabora.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>

authored by

Mylène Josserand and committed by
Heiko Stuebner
1627f683 7f6ffbb8

+18 -2
+18 -2
drivers/clk/rockchip/clk-rk3288.c
··· 425 425 COMPOSITE(0, "aclk_vio0", mux_pll_src_cpll_gpll_usb480m_p, CLK_IGNORE_UNUSED, 426 426 RK3288_CLKSEL_CON(31), 6, 2, MFLAGS, 0, 5, DFLAGS, 427 427 RK3288_CLKGATE_CON(3), 0, GFLAGS), 428 - DIV(0, "hclk_vio", "aclk_vio0", 0, 429 - RK3288_CLKSEL_CON(28), 8, 5, DFLAGS), 430 428 COMPOSITE(0, "aclk_vio1", mux_pll_src_cpll_gpll_usb480m_p, CLK_IGNORE_UNUSED, 431 429 RK3288_CLKSEL_CON(31), 14, 2, MFLAGS, 8, 5, DFLAGS, 432 430 RK3288_CLKGATE_CON(3), 2, GFLAGS), ··· 817 819 INVERTER(0, "pclk_isp", "pclk_isp_in", RK3288_CLKSEL_CON(29), 3, IFLAGS), 818 820 }; 819 821 822 + static struct rockchip_clk_branch rk3288w_hclkvio_branch[] __initdata = { 823 + DIV(0, "hclk_vio", "aclk_vio1", 0, 824 + RK3288_CLKSEL_CON(28), 8, 5, DFLAGS), 825 + }; 826 + 827 + static struct rockchip_clk_branch rk3288_hclkvio_branch[] __initdata = { 828 + DIV(0, "hclk_vio", "aclk_vio0", 0, 829 + RK3288_CLKSEL_CON(28), 8, 5, DFLAGS), 830 + }; 831 + 820 832 static const char *const rk3288_critical_clocks[] __initconst = { 821 833 "aclk_cpu", 822 834 "aclk_peri", ··· 944 936 RK3288_GRF_SOC_STATUS1); 945 937 rockchip_clk_register_branches(ctx, rk3288_clk_branches, 946 938 ARRAY_SIZE(rk3288_clk_branches)); 939 + 940 + if (of_device_is_compatible(np, "rockchip,rk3288w-cru")) 941 + rockchip_clk_register_branches(ctx, rk3288w_hclkvio_branch, 942 + ARRAY_SIZE(rk3288w_hclkvio_branch)); 943 + else 944 + rockchip_clk_register_branches(ctx, rk3288_hclkvio_branch, 945 + ARRAY_SIZE(rk3288_hclkvio_branch)); 946 + 947 947 rockchip_clk_protect_critical(rk3288_critical_clocks, 948 948 ARRAY_SIZE(rk3288_critical_clocks)); 949 949