diff options
author | Maxime Jourdan <mjourdan@baylibre.com> | 2019-03-19 06:11:38 -0400 |
---|---|---|
committer | Neil Armstrong <narmstrong@baylibre.com> | 2019-04-01 04:45:11 -0400 |
commit | 4b0f73055acaced436d5de909b26d001ea7f667c (patch) | |
tree | e8e11b4c5f63bde19c6ddf2a14a744b582f740ea | |
parent | 34775209ba37bff3b4e60ddee0a2d69966146a5d (diff) |
clk: meson-g12a: add video decoder clocks
Add the necessary clock parts for:
- VDEC_1: used to feed VDEC_1
- VDEC_HEVC: the "back" part of the VDEC_HEVC block
- VDEC_HEVCF: the "front" part of the VDEC_HEVC block
In previous SoC generations (GXL, GXBB), there was only one VDEC_HEVC
clock, which got split in two parts for G12A.
Signed-off-by: Maxime Jourdan <mjourdan@baylibre.com>
Acked-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://lkml.kernel.org/r/20190319101138.27520-2-mjourdan@baylibre.com
-rw-r--r-- | drivers/clk/meson/g12a.c | 163 | ||||
-rw-r--r-- | drivers/clk/meson/g12a.h | 8 |
2 files changed, 170 insertions, 1 deletions
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index a47435f91f2f..86a7c1b5bd42 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c | |||
@@ -1495,6 +1495,151 @@ static struct clk_regmap g12a_vpu = { | |||
1495 | }, | 1495 | }, |
1496 | }; | 1496 | }; |
1497 | 1497 | ||
1498 | /* VDEC clocks */ | ||
1499 | |||
1500 | static const char * const g12a_vdec_parent_names[] = { | ||
1501 | "fclk_div2p5", "fclk_div3", "fclk_div4", "fclk_div5", "fclk_div7", | ||
1502 | "hifi_pll", "gp0_pll", | ||
1503 | }; | ||
1504 | |||
1505 | static struct clk_regmap g12a_vdec_1_sel = { | ||
1506 | .data = &(struct clk_regmap_mux_data){ | ||
1507 | .offset = HHI_VDEC_CLK_CNTL, | ||
1508 | .mask = 0x7, | ||
1509 | .shift = 9, | ||
1510 | .flags = CLK_MUX_ROUND_CLOSEST, | ||
1511 | }, | ||
1512 | .hw.init = &(struct clk_init_data){ | ||
1513 | .name = "vdec_1_sel", | ||
1514 | .ops = &clk_regmap_mux_ops, | ||
1515 | .parent_names = g12a_vdec_parent_names, | ||
1516 | .num_parents = ARRAY_SIZE(g12a_vdec_parent_names), | ||
1517 | .flags = CLK_SET_RATE_PARENT, | ||
1518 | }, | ||
1519 | }; | ||
1520 | |||
1521 | static struct clk_regmap g12a_vdec_1_div = { | ||
1522 | .data = &(struct clk_regmap_div_data){ | ||
1523 | .offset = HHI_VDEC_CLK_CNTL, | ||
1524 | .shift = 0, | ||
1525 | .width = 7, | ||
1526 | .flags = CLK_DIVIDER_ROUND_CLOSEST, | ||
1527 | }, | ||
1528 | .hw.init = &(struct clk_init_data){ | ||
1529 | .name = "vdec_1_div", | ||
1530 | .ops = &clk_regmap_divider_ops, | ||
1531 | .parent_names = (const char *[]){ "vdec_1_sel" }, | ||
1532 | .num_parents = 1, | ||
1533 | .flags = CLK_SET_RATE_PARENT, | ||
1534 | }, | ||
1535 | }; | ||
1536 | |||
1537 | static struct clk_regmap g12a_vdec_1 = { | ||
1538 | .data = &(struct clk_regmap_gate_data){ | ||
1539 | .offset = HHI_VDEC_CLK_CNTL, | ||
1540 | .bit_idx = 8, | ||
1541 | }, | ||
1542 | .hw.init = &(struct clk_init_data) { | ||
1543 | .name = "vdec_1", | ||
1544 | .ops = &clk_regmap_gate_ops, | ||
1545 | .parent_names = (const char *[]){ "vdec_1_div" }, | ||
1546 | .num_parents = 1, | ||
1547 | .flags = CLK_SET_RATE_PARENT, | ||
1548 | }, | ||
1549 | }; | ||
1550 | |||
1551 | static struct clk_regmap g12a_vdec_hevcf_sel = { | ||
1552 | .data = &(struct clk_regmap_mux_data){ | ||
1553 | .offset = HHI_VDEC2_CLK_CNTL, | ||
1554 | .mask = 0x7, | ||
1555 | .shift = 9, | ||
1556 | .flags = CLK_MUX_ROUND_CLOSEST, | ||
1557 | }, | ||
1558 | .hw.init = &(struct clk_init_data){ | ||
1559 | .name = "vdec_hevcf_sel", | ||
1560 | .ops = &clk_regmap_mux_ops, | ||
1561 | .parent_names = g12a_vdec_parent_names, | ||
1562 | .num_parents = ARRAY_SIZE(g12a_vdec_parent_names), | ||
1563 | .flags = CLK_SET_RATE_PARENT, | ||
1564 | }, | ||
1565 | }; | ||
1566 | |||
1567 | static struct clk_regmap g12a_vdec_hevcf_div = { | ||
1568 | .data = &(struct clk_regmap_div_data){ | ||
1569 | .offset = HHI_VDEC2_CLK_CNTL, | ||
1570 | .shift = 0, | ||
1571 | .width = 7, | ||
1572 | .flags = CLK_DIVIDER_ROUND_CLOSEST, | ||
1573 | }, | ||
1574 | .hw.init = &(struct clk_init_data){ | ||
1575 | .name = "vdec_hevcf_div", | ||
1576 | .ops = &clk_regmap_divider_ops, | ||
1577 | .parent_names = (const char *[]){ "vdec_hevcf_sel" }, | ||
1578 | .num_parents = 1, | ||
1579 | .flags = CLK_SET_RATE_PARENT, | ||
1580 | }, | ||
1581 | }; | ||
1582 | |||
1583 | static struct clk_regmap g12a_vdec_hevcf = { | ||
1584 | .data = &(struct clk_regmap_gate_data){ | ||
1585 | .offset = HHI_VDEC2_CLK_CNTL, | ||
1586 | .bit_idx = 8, | ||
1587 | }, | ||
1588 | .hw.init = &(struct clk_init_data) { | ||
1589 | .name = "vdec_hevcf", | ||
1590 | .ops = &clk_regmap_gate_ops, | ||
1591 | .parent_names = (const char *[]){ "vdec_hevcf_div" }, | ||
1592 | .num_parents = 1, | ||
1593 | .flags = CLK_SET_RATE_PARENT, | ||
1594 | }, | ||
1595 | }; | ||
1596 | |||
1597 | static struct clk_regmap g12a_vdec_hevc_sel = { | ||
1598 | .data = &(struct clk_regmap_mux_data){ | ||
1599 | .offset = HHI_VDEC2_CLK_CNTL, | ||
1600 | .mask = 0x7, | ||
1601 | .shift = 25, | ||
1602 | .flags = CLK_MUX_ROUND_CLOSEST, | ||
1603 | }, | ||
1604 | .hw.init = &(struct clk_init_data){ | ||
1605 | .name = "vdec_hevc_sel", | ||
1606 | .ops = &clk_regmap_mux_ops, | ||
1607 | .parent_names = g12a_vdec_parent_names, | ||
1608 | .num_parents = ARRAY_SIZE(g12a_vdec_parent_names), | ||
1609 | .flags = CLK_SET_RATE_PARENT, | ||
1610 | }, | ||
1611 | }; | ||
1612 | |||
1613 | static struct clk_regmap g12a_vdec_hevc_div = { | ||
1614 | .data = &(struct clk_regmap_div_data){ | ||
1615 | .offset = HHI_VDEC2_CLK_CNTL, | ||
1616 | .shift = 16, | ||
1617 | .width = 7, | ||
1618 | .flags = CLK_DIVIDER_ROUND_CLOSEST, | ||
1619 | }, | ||
1620 | .hw.init = &(struct clk_init_data){ | ||
1621 | .name = "vdec_hevc_div", | ||
1622 | .ops = &clk_regmap_divider_ops, | ||
1623 | .parent_names = (const char *[]){ "vdec_hevc_sel" }, | ||
1624 | .num_parents = 1, | ||
1625 | .flags = CLK_SET_RATE_PARENT, | ||
1626 | }, | ||
1627 | }; | ||
1628 | |||
1629 | static struct clk_regmap g12a_vdec_hevc = { | ||
1630 | .data = &(struct clk_regmap_gate_data){ | ||
1631 | .offset = HHI_VDEC2_CLK_CNTL, | ||
1632 | .bit_idx = 24, | ||
1633 | }, | ||
1634 | .hw.init = &(struct clk_init_data) { | ||
1635 | .name = "vdec_hevc", | ||
1636 | .ops = &clk_regmap_gate_ops, | ||
1637 | .parent_names = (const char *[]){ "vdec_hevc_div" }, | ||
1638 | .num_parents = 1, | ||
1639 | .flags = CLK_SET_RATE_PARENT, | ||
1640 | }, | ||
1641 | }; | ||
1642 | |||
1498 | /* VAPB Clock */ | 1643 | /* VAPB Clock */ |
1499 | 1644 | ||
1500 | static const char * const g12a_vapb_parent_names[] = { | 1645 | static const char * const g12a_vapb_parent_names[] = { |
@@ -2615,6 +2760,15 @@ static struct clk_hw_onecell_data g12a_hw_onecell_data = { | |||
2615 | [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw, | 2760 | [CLKID_PCIE_PLL_DCO_DIV2] = &g12a_pcie_pll_dco_div2.hw, |
2616 | [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw, | 2761 | [CLKID_PCIE_PLL_OD] = &g12a_pcie_pll_od.hw, |
2617 | [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw, | 2762 | [CLKID_PCIE_PLL] = &g12a_pcie_pll.hw, |
2763 | [CLKID_VDEC_1_SEL] = &g12a_vdec_1_sel.hw, | ||
2764 | [CLKID_VDEC_1_DIV] = &g12a_vdec_1_div.hw, | ||
2765 | [CLKID_VDEC_1] = &g12a_vdec_1.hw, | ||
2766 | [CLKID_VDEC_HEVC_SEL] = &g12a_vdec_hevc_sel.hw, | ||
2767 | [CLKID_VDEC_HEVC_DIV] = &g12a_vdec_hevc_div.hw, | ||
2768 | [CLKID_VDEC_HEVC] = &g12a_vdec_hevc.hw, | ||
2769 | [CLKID_VDEC_HEVCF_SEL] = &g12a_vdec_hevcf_sel.hw, | ||
2770 | [CLKID_VDEC_HEVCF_DIV] = &g12a_vdec_hevcf_div.hw, | ||
2771 | [CLKID_VDEC_HEVCF] = &g12a_vdec_hevcf.hw, | ||
2618 | [NR_CLKS] = NULL, | 2772 | [NR_CLKS] = NULL, |
2619 | }, | 2773 | }, |
2620 | .num = NR_CLKS, | 2774 | .num = NR_CLKS, |
@@ -2803,6 +2957,15 @@ static struct clk_regmap *const g12a_clk_regmaps[] = { | |||
2803 | &g12a_cpu_clk_trace, | 2957 | &g12a_cpu_clk_trace, |
2804 | &g12a_pcie_pll_od, | 2958 | &g12a_pcie_pll_od, |
2805 | &g12a_pcie_pll_dco, | 2959 | &g12a_pcie_pll_dco, |
2960 | &g12a_vdec_1_sel, | ||
2961 | &g12a_vdec_1_div, | ||
2962 | &g12a_vdec_1, | ||
2963 | &g12a_vdec_hevc_sel, | ||
2964 | &g12a_vdec_hevc_div, | ||
2965 | &g12a_vdec_hevc, | ||
2966 | &g12a_vdec_hevcf_sel, | ||
2967 | &g12a_vdec_hevcf_div, | ||
2968 | &g12a_vdec_hevcf, | ||
2806 | }; | 2969 | }; |
2807 | 2970 | ||
2808 | static const struct meson_eeclkc_data g12a_clkc_data = { | 2971 | static const struct meson_eeclkc_data g12a_clkc_data = { |
diff --git a/drivers/clk/meson/g12a.h b/drivers/clk/meson/g12a.h index 1393a09730a6..39c41af70804 100644 --- a/drivers/clk/meson/g12a.h +++ b/drivers/clk/meson/g12a.h | |||
@@ -189,8 +189,14 @@ | |||
189 | #define CLKID_PCIE_PLL_DCO 198 | 189 | #define CLKID_PCIE_PLL_DCO 198 |
190 | #define CLKID_PCIE_PLL_DCO_DIV2 199 | 190 | #define CLKID_PCIE_PLL_DCO_DIV2 199 |
191 | #define CLKID_PCIE_PLL_OD 200 | 191 | #define CLKID_PCIE_PLL_OD 200 |
192 | #define CLKID_VDEC_1_SEL 202 | ||
193 | #define CLKID_VDEC_1_DIV 203 | ||
194 | #define CLKID_VDEC_HEVC_SEL 205 | ||
195 | #define CLKID_VDEC_HEVC_DIV 206 | ||
196 | #define CLKID_VDEC_HEVCF_SEL 208 | ||
197 | #define CLKID_VDEC_HEVCF_DIV 209 | ||
192 | 198 | ||
193 | #define NR_CLKS 202 | 199 | #define NR_CLKS 211 |
194 | 200 | ||
195 | /* include the CLKIDs that have been made part of the DT binding */ | 201 | /* include the CLKIDs that have been made part of the DT binding */ |
196 | #include <dt-bindings/clock/g12a-clkc.h> | 202 | #include <dt-bindings/clock/g12a-clkc.h> |