aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/clk/meson/meson8b.c167
-rw-r--r--drivers/clk/meson/meson8b.h9
2 files changed, 175 insertions, 1 deletions
diff --git a/drivers/clk/meson/meson8b.c b/drivers/clk/meson/meson8b.c
index 0d08f1ef7af8..8e091c2d10e6 100644
--- a/drivers/clk/meson/meson8b.c
+++ b/drivers/clk/meson/meson8b.c
@@ -1761,6 +1761,147 @@ static struct clk_regmap meson8m2_gp_pll = {
1761 }, 1761 },
1762}; 1762};
1763 1763
1764static const char * const mmeson8b_vpu_0_1_parent_names[] = {
1765 "fclk_div4", "fclk_div3", "fclk_div5", "fclk_div7"
1766};
1767
1768static const char * const mmeson8m2_vpu_0_1_parent_names[] = {
1769 "fclk_div4", "fclk_div3", "fclk_div5", "gp_pll"
1770};
1771
1772static struct clk_regmap meson8b_vpu_0_sel = {
1773 .data = &(struct clk_regmap_mux_data){
1774 .offset = HHI_VPU_CLK_CNTL,
1775 .mask = 0x3,
1776 .shift = 9,
1777 },
1778 .hw.init = &(struct clk_init_data){
1779 .name = "vpu_0_sel",
1780 .ops = &clk_regmap_mux_ops,
1781 .parent_names = mmeson8b_vpu_0_1_parent_names,
1782 .num_parents = ARRAY_SIZE(mmeson8b_vpu_0_1_parent_names),
1783 .flags = CLK_SET_RATE_PARENT,
1784 },
1785};
1786
1787static struct clk_regmap meson8m2_vpu_0_sel = {
1788 .data = &(struct clk_regmap_mux_data){
1789 .offset = HHI_VPU_CLK_CNTL,
1790 .mask = 0x3,
1791 .shift = 9,
1792 },
1793 .hw.init = &(struct clk_init_data){
1794 .name = "vpu_0_sel",
1795 .ops = &clk_regmap_mux_ops,
1796 .parent_names = mmeson8m2_vpu_0_1_parent_names,
1797 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_names),
1798 .flags = CLK_SET_RATE_PARENT,
1799 },
1800};
1801
1802static struct clk_regmap meson8b_vpu_0_div = {
1803 .data = &(struct clk_regmap_div_data){
1804 .offset = HHI_VPU_CLK_CNTL,
1805 .shift = 0,
1806 .width = 7,
1807 },
1808 .hw.init = &(struct clk_init_data){
1809 .name = "vpu_0_div",
1810 .ops = &clk_regmap_divider_ops,
1811 .parent_names = (const char *[]){ "vpu_0_sel" },
1812 .num_parents = 1,
1813 .flags = CLK_SET_RATE_PARENT,
1814 },
1815};
1816
1817static struct clk_regmap meson8b_vpu_0 = {
1818 .data = &(struct clk_regmap_gate_data){
1819 .offset = HHI_VPU_CLK_CNTL,
1820 .bit_idx = 8,
1821 },
1822 .hw.init = &(struct clk_init_data) {
1823 .name = "vpu_0",
1824 .ops = &clk_regmap_gate_ops,
1825 .parent_names = (const char *[]){ "vpu_0_div" },
1826 .num_parents = 1,
1827 .flags = CLK_SET_RATE_PARENT,
1828 },
1829};
1830
1831static struct clk_regmap meson8b_vpu_1_sel = {
1832 .data = &(struct clk_regmap_mux_data){
1833 .offset = HHI_VPU_CLK_CNTL,
1834 .mask = 0x3,
1835 .shift = 25,
1836 },
1837 .hw.init = &(struct clk_init_data){
1838 .name = "vpu_1_sel",
1839 .ops = &clk_regmap_mux_ops,
1840 .parent_names = mmeson8b_vpu_0_1_parent_names,
1841 .num_parents = ARRAY_SIZE(mmeson8b_vpu_0_1_parent_names),
1842 .flags = CLK_SET_RATE_PARENT,
1843 },
1844};
1845
1846static struct clk_regmap meson8m2_vpu_1_sel = {
1847 .data = &(struct clk_regmap_mux_data){
1848 .offset = HHI_VPU_CLK_CNTL,
1849 .mask = 0x3,
1850 .shift = 25,
1851 },
1852 .hw.init = &(struct clk_init_data){
1853 .name = "vpu_1_sel",
1854 .ops = &clk_regmap_mux_ops,
1855 .parent_names = mmeson8m2_vpu_0_1_parent_names,
1856 .num_parents = ARRAY_SIZE(mmeson8m2_vpu_0_1_parent_names),
1857 .flags = CLK_SET_RATE_PARENT,
1858 },
1859};
1860
1861static struct clk_regmap meson8b_vpu_1_div = {
1862 .data = &(struct clk_regmap_div_data){
1863 .offset = HHI_VPU_CLK_CNTL,
1864 .shift = 16,
1865 .width = 7,
1866 },
1867 .hw.init = &(struct clk_init_data){
1868 .name = "vpu_1_div",
1869 .ops = &clk_regmap_divider_ops,
1870 .parent_names = (const char *[]){ "vpu_1_sel" },
1871 .num_parents = 1,
1872 .flags = CLK_SET_RATE_PARENT,
1873 },
1874};
1875
1876static struct clk_regmap meson8b_vpu_1 = {
1877 .data = &(struct clk_regmap_gate_data){
1878 .offset = HHI_VPU_CLK_CNTL,
1879 .bit_idx = 24,
1880 },
1881 .hw.init = &(struct clk_init_data) {
1882 .name = "vpu_1",
1883 .ops = &clk_regmap_gate_ops,
1884 .parent_names = (const char *[]){ "vpu_1_div" },
1885 .num_parents = 1,
1886 .flags = CLK_SET_RATE_PARENT,
1887 },
1888};
1889
1890static struct clk_regmap meson8b_vpu = {
1891 .data = &(struct clk_regmap_mux_data){
1892 .offset = HHI_VPU_CLK_CNTL,
1893 .mask = 1,
1894 .shift = 31,
1895 },
1896 .hw.init = &(struct clk_init_data){
1897 .name = "vpu",
1898 .ops = &clk_regmap_mux_ops,
1899 .parent_names = (const char *[]){ "vpu_0", "vpu_1" },
1900 .num_parents = 2,
1901 .flags = CLK_SET_RATE_NO_REPARENT,
1902 },
1903};
1904
1764/* Everything Else (EE) domain gates */ 1905/* Everything Else (EE) domain gates */
1765 1906
1766static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0); 1907static MESON_GATE(meson8b_ddr, HHI_GCLK_MPEG0, 0);
@@ -2024,6 +2165,9 @@ static struct clk_hw_onecell_data meson8_hw_onecell_data = {
2024 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw, 2165 [CLKID_MALI_0_SEL] = &meson8b_mali_0_sel.hw,
2025 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw, 2166 [CLKID_MALI_0_DIV] = &meson8b_mali_0_div.hw,
2026 [CLKID_MALI] = &meson8b_mali_0.hw, 2167 [CLKID_MALI] = &meson8b_mali_0.hw,
2168 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
2169 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
2170 [CLKID_VPU] = &meson8b_vpu_0.hw,
2027 [CLK_NR_CLKS] = NULL, 2171 [CLK_NR_CLKS] = NULL,
2028 }, 2172 },
2029 .num = CLK_NR_CLKS, 2173 .num = CLK_NR_CLKS,
@@ -2210,6 +2354,13 @@ static struct clk_hw_onecell_data meson8b_hw_onecell_data = {
2210 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw, 2354 [CLKID_MALI_1_DIV] = &meson8b_mali_1_div.hw,
2211 [CLKID_MALI_1] = &meson8b_mali_1.hw, 2355 [CLKID_MALI_1] = &meson8b_mali_1.hw,
2212 [CLKID_MALI] = &meson8b_mali.hw, 2356 [CLKID_MALI] = &meson8b_mali.hw,
2357 [CLKID_VPU_0_SEL] = &meson8b_vpu_0_sel.hw,
2358 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
2359 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
2360 [CLKID_VPU_1_SEL] = &meson8b_vpu_1_sel.hw,
2361 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
2362 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
2363 [CLKID_VPU] = &meson8b_vpu.hw,
2213 [CLK_NR_CLKS] = NULL, 2364 [CLK_NR_CLKS] = NULL,
2214 }, 2365 },
2215 .num = CLK_NR_CLKS, 2366 .num = CLK_NR_CLKS,
@@ -2398,6 +2549,13 @@ static struct clk_hw_onecell_data meson8m2_hw_onecell_data = {
2398 [CLKID_MALI] = &meson8b_mali.hw, 2549 [CLKID_MALI] = &meson8b_mali.hw,
2399 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw, 2550 [CLKID_GP_PLL_DCO] = &meson8m2_gp_pll_dco.hw,
2400 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw, 2551 [CLKID_GP_PLL] = &meson8m2_gp_pll.hw,
2552 [CLKID_VPU_0_SEL] = &meson8m2_vpu_0_sel.hw,
2553 [CLKID_VPU_0_DIV] = &meson8b_vpu_0_div.hw,
2554 [CLKID_VPU_0] = &meson8b_vpu_0.hw,
2555 [CLKID_VPU_1_SEL] = &meson8m2_vpu_1_sel.hw,
2556 [CLKID_VPU_1_DIV] = &meson8b_vpu_1_div.hw,
2557 [CLKID_VPU_1] = &meson8b_vpu_1.hw,
2558 [CLKID_VPU] = &meson8b_vpu.hw,
2401 [CLK_NR_CLKS] = NULL, 2559 [CLK_NR_CLKS] = NULL,
2402 }, 2560 },
2403 .num = CLK_NR_CLKS, 2561 .num = CLK_NR_CLKS,
@@ -2562,6 +2720,15 @@ static struct clk_regmap *const meson8b_clk_regmaps[] = {
2562 &meson8b_mali, 2720 &meson8b_mali,
2563 &meson8m2_gp_pll_dco, 2721 &meson8m2_gp_pll_dco,
2564 &meson8m2_gp_pll, 2722 &meson8m2_gp_pll,
2723 &meson8b_vpu_0_sel,
2724 &meson8m2_vpu_0_sel,
2725 &meson8b_vpu_0_div,
2726 &meson8b_vpu_0,
2727 &meson8b_vpu_1_sel,
2728 &meson8m2_vpu_1_sel,
2729 &meson8b_vpu_1_div,
2730 &meson8b_vpu_1,
2731 &meson8b_vpu,
2565}; 2732};
2566 2733
2567static const struct meson8b_clk_reset_line { 2734static const struct meson8b_clk_reset_line {
diff --git a/drivers/clk/meson/meson8b.h b/drivers/clk/meson/meson8b.h
index a45f7102c558..e775f91ccce9 100644
--- a/drivers/clk/meson/meson8b.h
+++ b/drivers/clk/meson/meson8b.h
@@ -35,6 +35,7 @@
35#define HHI_VID_DIVIDER_CNTL 0x198 /* 0x66 offset in data sheet */ 35#define HHI_VID_DIVIDER_CNTL 0x198 /* 0x66 offset in data sheet */
36#define HHI_SYS_CPU_CLK_CNTL0 0x19c /* 0x67 offset in data sheet */ 36#define HHI_SYS_CPU_CLK_CNTL0 0x19c /* 0x67 offset in data sheet */
37#define HHI_MALI_CLK_CNTL 0x1b0 /* 0x6c offset in data sheet */ 37#define HHI_MALI_CLK_CNTL 0x1b0 /* 0x6c offset in data sheet */
38#define HHI_VPU_CLK_CNTL 0x1bc /* 0x6f offset in data sheet */
38#define HHI_HDMI_CLK_CNTL 0x1cc /* 0x73 offset in data sheet */ 39#define HHI_HDMI_CLK_CNTL 0x1cc /* 0x73 offset in data sheet */
39#define HHI_NAND_CLK_CNTL 0x25c /* 0x97 offset in data sheet */ 40#define HHI_NAND_CLK_CNTL 0x25c /* 0x97 offset in data sheet */
40#define HHI_MPLL_CNTL 0x280 /* 0xa0 offset in data sheet */ 41#define HHI_MPLL_CNTL 0x280 /* 0xa0 offset in data sheet */
@@ -149,8 +150,14 @@
149#define CLKID_MALI_1 180 150#define CLKID_MALI_1 180
150#define CLKID_GP_PLL_DCO 181 151#define CLKID_GP_PLL_DCO 181
151#define CLKID_GP_PLL 182 152#define CLKID_GP_PLL 182
153#define CLKID_VPU_0_SEL 183
154#define CLKID_VPU_0_DIV 184
155#define CLKID_VPU_0 185
156#define CLKID_VPU_1_SEL 186
157#define CLKID_VPU_1_DIV 187
158#define CLKID_VPU_1 189
152 159
153#define CLK_NR_CLKS 183 160#define CLK_NR_CLKS 191
154 161
155/* 162/*
156 * include the CLKID and RESETID that have 163 * include the CLKID and RESETID that have