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

drivers: clk: st: Simplify clock binding of STiH4xx platforms

This patch reworks the clock binding to avoid too much detail in DT.
Now we have only compatible string per type of clock
(remark from Rob https://lkml.org/lkml/2016/5/25/492)

Signed-off-by: Gabriel Fernandez <gabriel.fernandez@st.com>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>

authored by

Gabriel Fernandez and committed by
Stephen Boyd
880d54ff 7df404c9

+65 -88
+1 -1
Documentation/devicetree/bindings/clock/st/st,clkgen-mux.txt
··· 10 10 Required properties: 11 11 12 12 - compatible : shall be: 13 - "st,stih407-clkgen-a9-mux", "st,clkgen-mux" 13 + "st,stih407-clkgen-a9-mux" 14 14 15 15 - #clock-cells : from common clock binding; shall be set to 0. 16 16
+5 -6
Documentation/devicetree/bindings/clock/st/st,clkgen-pll.txt
··· 9 9 Required properties: 10 10 11 11 - compatible : shall be: 12 - "st,stih407-plls-c32-a0", "st,clkgen-plls-c32" 13 - "st,stih407-plls-c32-a9", "st,clkgen-plls-c32" 14 - "sst,plls-c32-cx_0", "st,clkgen-plls-c32" 15 - "sst,plls-c32-cx_1", "st,clkgen-plls-c32" 16 - "st,stih418-plls-c28-a9", "st,clkgen-plls-c32" 12 + "st,clkgen-pll0" 13 + "st,clkgen-pll1" 14 + "st,stih407-clkgen-plla9" 15 + "st,stih418-clkgen-plla9" 17 16 18 17 - #clock-cells : From common clock binding; shall be set to 1. 19 18 ··· 28 29 29 30 clockgen_a9_pll: clockgen-a9-pll { 30 31 #clock-cells = <1>; 31 - compatible = "st,stih407-plls-c32-a9", "st,clkgen-plls-c32"; 32 + compatible = "st,stih407-clkgen-plla9"; 32 33 33 34 clocks = <&clk_sysin>; 34 35
+1 -1
Documentation/devicetree/bindings/clock/st/st,clkgen.txt
··· 48 48 49 49 clk_s_a0_pll: clk-s-a0-pll { 50 50 #clock-cells = <1>; 51 - compatible = "st,stih407-plls-c32-a0", "st,clkgen-plls-c32"; 51 + compatible = "st,clkgen-pll0"; 52 52 53 53 clocks = <&clk_sysin>; 54 54
+3 -3
Documentation/devicetree/bindings/clock/st/st,quadfs.txt
··· 11 11 12 12 Required properties: 13 13 - compatible : shall be: 14 - "st,stih407-quadfs660-C", "st,quadfs" 15 - "st,stih407-quadfs660-D", "st,quadfs" 14 + "st,quadfs" 15 + "st,quadfs-pll" 16 16 17 17 18 18 - #clock-cells : from common clock binding; shall be set to 1. ··· 33 33 34 34 clk_s_c0_quadfs: clk-s-c0-quadfs@9103000 { 35 35 #clock-cells = <1>; 36 - compatible = "st,stih407-quadfs660-C", "st,quadfs"; 36 + compatible = "st,quadfs-pll"; 37 37 reg = <0x9103000 0x1000>; 38 38 39 39 clocks = <&clk_sysin>;
+17 -24
drivers/clk/st/clkgen-fsyn.c
··· 819 819 return clk; 820 820 } 821 821 822 - static const struct of_device_id quadfs_of_match[] = { 823 - { 824 - .compatible = "st,stih407-quadfs660-C", 825 - .data = &st_fs660c32_C 826 - }, 827 - { 828 - .compatible = "st,stih407-quadfs660-D", 829 - .data = &st_fs660c32_D 830 - }, 831 - {} 832 - }; 833 - 834 822 static void __init st_of_create_quadfs_fsynths( 835 823 struct device_node *np, const char *pll_name, 836 824 struct clkgen_quadfs_data *quadfs, void __iomem *reg, ··· 878 890 of_clk_add_provider(np, of_clk_src_onecell_get, clk_data); 879 891 } 880 892 881 - static void __init st_of_quadfs_setup(struct device_node *np) 893 + static void __init st_of_quadfs_setup(struct device_node *np, 894 + struct clkgen_quadfs_data *data) 882 895 { 883 - const struct of_device_id *match; 884 896 struct clk *clk; 885 897 const char *pll_name, *clk_parent_name; 886 898 void __iomem *reg; 887 899 spinlock_t *lock; 888 - 889 - match = of_match_node(quadfs_of_match, np); 890 - if (WARN_ON(!match)) 891 - return; 892 900 893 901 reg = of_iomap(np, 0); 894 902 if (!reg) ··· 904 920 905 921 spin_lock_init(lock); 906 922 907 - clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, 908 - (struct clkgen_quadfs_data *) match->data, reg, lock); 923 + clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, data, 924 + reg, lock); 909 925 if (IS_ERR(clk)) 910 926 goto err_exit; 911 927 else ··· 914 930 __clk_get_name(clk_get_parent(clk)), 915 931 (unsigned int)clk_get_rate(clk)); 916 932 917 - st_of_create_quadfs_fsynths(np, pll_name, 918 - (struct clkgen_quadfs_data *)match->data, 919 - reg, lock); 933 + st_of_create_quadfs_fsynths(np, pll_name, data, reg, lock); 920 934 921 935 err_exit: 922 936 kfree(pll_name); /* No longer need local copy of the PLL name */ 923 937 } 924 - CLK_OF_DECLARE(quadfs, "st,quadfs", st_of_quadfs_setup); 938 + 939 + static void __init st_of_quadfs660C_setup(struct device_node *np) 940 + { 941 + st_of_quadfs_setup(np, (struct clkgen_quadfs_data *) &st_fs660c32_C); 942 + } 943 + CLK_OF_DECLARE(quadfs660C, "st,quadfs-pll", st_of_quadfs660C_setup); 944 + 945 + static void __init st_of_quadfs660D_setup(struct device_node *np) 946 + { 947 + st_of_quadfs_setup(np, (struct clkgen_quadfs_data *) &st_fs660c32_D); 948 + } 949 + CLK_OF_DECLARE(quadfs660D, "st,quadfs", st_of_quadfs660D_setup);
+9 -19
drivers/clk/st/clkgen-mux.c
··· 53 53 .lock = &clkgen_a9_lock, 54 54 }; 55 55 56 - static const struct of_device_id mux_of_match[] = { 57 - { 58 - .compatible = "st,stih407-clkgen-a9-mux", 59 - .data = &stih407_a9_mux_data, 60 - }, 61 - {} 62 - }; 63 - static void __init st_of_clkgen_mux_setup(struct device_node *np) 56 + static void __init st_of_clkgen_mux_setup(struct device_node *np, 57 + struct clkgen_mux_data *data) 64 58 { 65 - const struct of_device_id *match; 66 59 struct clk *clk; 67 60 void __iomem *reg; 68 61 const char **parents; 69 62 int num_parents = 0; 70 - const struct clkgen_mux_data *data; 71 - 72 - match = of_match_node(mux_of_match, np); 73 - if (!match) { 74 - pr_err("%s: No matching data\n", __func__); 75 - return; 76 - } 77 - 78 - data = match->data; 79 63 80 64 reg = of_iomap(np, 0); 81 65 if (!reg) { ··· 96 112 err_parents: 97 113 iounmap(reg); 98 114 } 99 - CLK_OF_DECLARE(clkgen_mux, "st,clkgen-mux", st_of_clkgen_mux_setup); 115 + 116 + static void __init st_of_clkgen_a9_mux_setup(struct device_node *np) 117 + { 118 + st_of_clkgen_mux_setup(np, &stih407_a9_mux_data); 119 + } 120 + CLK_OF_DECLARE(clkgen_a9mux, "st,stih407-clkgen-a9-mux", 121 + st_of_clkgen_a9_mux_setup);
+29 -34
drivers/clk/st/clkgen-pll.c
··· 702 702 return clk; 703 703 } 704 704 705 - static const struct of_device_id c32_pll_of_match[] = { 706 - { 707 - .compatible = "st,stih407-plls-c32-a0", 708 - .data = &st_pll3200c32_407_a0, 709 - }, 710 - { 711 - .compatible = "st,plls-c32-cx_0", 712 - .data = &st_pll3200c32_cx_0, 713 - }, 714 - { 715 - .compatible = "st,plls-c32-cx_1", 716 - .data = &st_pll3200c32_cx_1, 717 - }, 718 - { 719 - .compatible = "st,stih407-plls-c32-a9", 720 - .data = &st_pll3200c32_407_a9, 721 - }, 722 - { 723 - .compatible = "st,stih418-plls-c28-a9", 724 - .data = &st_pll4600c28_418_a9, 725 - }, 726 - {} 727 - }; 728 705 729 - static void __init clkgen_c32_pll_setup(struct device_node *np) 706 + static void __init clkgen_c32_pll_setup(struct device_node *np, 707 + struct clkgen_pll_data *data) 730 708 { 731 - const struct of_device_id *match; 732 709 struct clk *clk; 733 710 const char *parent_name, *pll_name; 734 711 void __iomem *pll_base; 735 712 int num_odfs, odf; 736 713 struct clk_onecell_data *clk_data; 737 - struct clkgen_pll_data *data; 738 714 unsigned long pll_flags = 0; 739 715 740 - match = of_match_node(c32_pll_of_match, np); 741 - if (!match) { 742 - pr_err("%s: No matching data\n", __func__); 743 - return; 744 - } 745 - 746 - data = (struct clkgen_pll_data *) match->data; 747 716 748 717 parent_name = of_clk_get_parent_name(np, 0); 749 718 if (!parent_name) ··· 771 802 kfree(clk_data->clks); 772 803 kfree(clk_data); 773 804 } 774 - CLK_OF_DECLARE(clkgen_c32_pll, "st,clkgen-plls-c32", clkgen_c32_pll_setup); 805 + static void __init clkgen_c32_pll0_setup(struct device_node *np) 806 + { 807 + clkgen_c32_pll_setup(np, 808 + (struct clkgen_pll_data *) &st_pll3200c32_cx_0); 809 + } 810 + CLK_OF_DECLARE(c32_pll0, "st,clkgen-pll0", clkgen_c32_pll0_setup); 811 + 812 + static void __init clkgen_c32_pll1_setup(struct device_node *np) 813 + { 814 + clkgen_c32_pll_setup(np, 815 + (struct clkgen_pll_data *) &st_pll3200c32_cx_1); 816 + } 817 + CLK_OF_DECLARE(c32_pll1, "st,clkgen-pll1", clkgen_c32_pll1_setup); 818 + 819 + static void __init clkgen_c32_plla9_setup(struct device_node *np) 820 + { 821 + clkgen_c32_pll_setup(np, 822 + (struct clkgen_pll_data *) &st_pll3200c32_407_a9); 823 + } 824 + CLK_OF_DECLARE(c32_plla9, "st,stih407-clkgen-plla9", clkgen_c32_plla9_setup); 825 + 826 + static void __init clkgen_c28_plla9_setup(struct device_node *np) 827 + { 828 + clkgen_c32_pll_setup(np, 829 + (struct clkgen_pll_data *) &st_pll4600c28_418_a9); 830 + } 831 + CLK_OF_DECLARE(c28_plla9, "st,stih418-clkgen-plla9", clkgen_c28_plla9_setup);