summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt4
-rw-r--r--Documentation/devicetree/bindings/clock/ti,cdce925.txt4
-rw-r--r--drivers/clk/actions/owl-factor.c7
-rw-r--r--drivers/clk/bcm/clk-bcm2835.c138
-rw-r--r--drivers/clk/clk-cdce925.c34
-rw-r--r--drivers/clk/clk.c42
-rw-r--r--include/dt-bindings/clock/bcm2835.h2
7 files changed, 202 insertions, 29 deletions
diff --git a/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt b/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt
index dd906db34b32..9e0b03a6519b 100644
--- a/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt
+++ b/Documentation/devicetree/bindings/clock/brcm,bcm2835-cprman.txt
@@ -12,7 +12,9 @@ clock generators, but a few (like the ARM or HDMI) will source from
12the PLL dividers directly. 12the PLL dividers directly.
13 13
14Required properties: 14Required properties:
15- compatible: Should be "brcm,bcm2835-cprman" 15- compatible: should be one of the following,
16 "brcm,bcm2711-cprman"
17 "brcm,bcm2835-cprman"
16- #clock-cells: Should be <1>. The permitted clock-specifier values can be 18- #clock-cells: Should be <1>. The permitted clock-specifier values can be
17 found in include/dt-bindings/clock/bcm2835.h 19 found in include/dt-bindings/clock/bcm2835.h
18- reg: Specifies base physical address and size of the registers 20- reg: Specifies base physical address and size of the registers
diff --git a/Documentation/devicetree/bindings/clock/ti,cdce925.txt b/Documentation/devicetree/bindings/clock/ti,cdce925.txt
index 0d01f2d5cc36..26544c85202a 100644
--- a/Documentation/devicetree/bindings/clock/ti,cdce925.txt
+++ b/Documentation/devicetree/bindings/clock/ti,cdce925.txt
@@ -24,6 +24,8 @@ Required properties:
24Optional properties: 24Optional properties:
25 - xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a 25 - xtal-load-pf: Crystal load-capacitor value to fine-tune performance on a
26 board, or to compensate for external influences. 26 board, or to compensate for external influences.
27- vdd-supply: A regulator node for Vdd
28- vddout-supply: A regulator node for Vddout
27 29
28For all PLL1, PLL2, ... an optional child node can be used to specify spread 30For all PLL1, PLL2, ... an optional child node can be used to specify spread
29spectrum clocking parameters for a board. 31spectrum clocking parameters for a board.
@@ -41,6 +43,8 @@ Example:
41 clocks = <&xtal_27Mhz>; 43 clocks = <&xtal_27Mhz>;
42 #clock-cells = <1>; 44 #clock-cells = <1>;
43 xtal-load-pf = <5>; 45 xtal-load-pf = <5>;
46 vdd-supply = <&1v8-reg>;
47 vddout-supply = <&3v3-reg>;
44 /* PLL options to get SSC 1% centered */ 48 /* PLL options to get SSC 1% centered */
45 PLL2 { 49 PLL2 {
46 spread-spectrum = <4>; 50 spread-spectrum = <4>;
diff --git a/drivers/clk/actions/owl-factor.c b/drivers/clk/actions/owl-factor.c
index 317d4a9e112e..f15e2621fa18 100644
--- a/drivers/clk/actions/owl-factor.c
+++ b/drivers/clk/actions/owl-factor.c
@@ -64,11 +64,10 @@ static unsigned int _get_table_val(const struct clk_factor_table *table,
64 return val; 64 return val;
65} 65}
66 66
67static int clk_val_best(struct clk_hw *hw, unsigned long rate, 67static int owl_clk_val_best(const struct owl_factor_hw *factor_hw,
68 struct clk_hw *hw, unsigned long rate,
68 unsigned long *best_parent_rate) 69 unsigned long *best_parent_rate)
69{ 70{
70 struct owl_factor *factor = hw_to_owl_factor(hw);
71 struct owl_factor_hw *factor_hw = &factor->factor_hw;
72 const struct clk_factor_table *clkt = factor_hw->table; 71 const struct clk_factor_table *clkt = factor_hw->table;
73 unsigned long parent_rate, try_parent_rate, best = 0, cur_rate; 72 unsigned long parent_rate, try_parent_rate, best = 0, cur_rate;
74 unsigned long parent_rate_saved = *best_parent_rate; 73 unsigned long parent_rate_saved = *best_parent_rate;
@@ -126,7 +125,7 @@ long owl_factor_helper_round_rate(struct owl_clk_common *common,
126 const struct clk_factor_table *clkt = factor_hw->table; 125 const struct clk_factor_table *clkt = factor_hw->table;
127 unsigned int val, mul = 0, div = 1; 126 unsigned int val, mul = 0, div = 1;
128 127
129 val = clk_val_best(&common->hw, rate, parent_rate); 128 val = owl_clk_val_best(factor_hw, &common->hw, rate, parent_rate);
130 _get_table_div_mul(clkt, val, &mul, &div); 129 _get_table_div_mul(clkt, val, &mul, &div);
131 130
132 return *parent_rate * mul / div; 131 return *parent_rate * mul / div;
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 867ae3c20041..802e488fd3c3 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -31,7 +31,7 @@
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/module.h> 33#include <linux/module.h>
34#include <linux/of.h> 34#include <linux/of_device.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <dt-bindings/clock/bcm2835.h> 37#include <dt-bindings/clock/bcm2835.h>
@@ -114,6 +114,8 @@
114#define CM_AVEODIV 0x1bc 114#define CM_AVEODIV 0x1bc
115#define CM_EMMCCTL 0x1c0 115#define CM_EMMCCTL 0x1c0
116#define CM_EMMCDIV 0x1c4 116#define CM_EMMCDIV 0x1c4
117#define CM_EMMC2CTL 0x1d0
118#define CM_EMMC2DIV 0x1d4
117 119
118/* General bits for the CM_*CTL regs */ 120/* General bits for the CM_*CTL regs */
119# define CM_ENABLE BIT(4) 121# define CM_ENABLE BIT(4)
@@ -289,6 +291,10 @@
289#define LOCK_TIMEOUT_NS 100000000 291#define LOCK_TIMEOUT_NS 100000000
290#define BCM2835_MAX_FB_RATE 1750000000u 292#define BCM2835_MAX_FB_RATE 1750000000u
291 293
294#define SOC_BCM2835 BIT(0)
295#define SOC_BCM2711 BIT(1)
296#define SOC_ALL (SOC_BCM2835 | SOC_BCM2711)
297
292/* 298/*
293 * Names of clocks used within the driver that need to be replaced 299 * Names of clocks used within the driver that need to be replaced
294 * with an external parent's name. This array is in the order that 300 * with an external parent's name. This array is in the order that
@@ -320,6 +326,10 @@ struct bcm2835_cprman {
320 struct clk_hw_onecell_data onecell; 326 struct clk_hw_onecell_data onecell;
321}; 327};
322 328
329struct cprman_plat_data {
330 unsigned int soc;
331};
332
323static inline void cprman_write(struct bcm2835_cprman *cprman, u32 reg, u32 val) 333static inline void cprman_write(struct bcm2835_cprman *cprman, u32 reg, u32 val)
324{ 334{
325 writel(CM_PASSWORD | val, cprman->regs + reg); 335 writel(CM_PASSWORD | val, cprman->regs + reg);
@@ -1451,22 +1461,28 @@ typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman,
1451 const void *data); 1461 const void *data);
1452struct bcm2835_clk_desc { 1462struct bcm2835_clk_desc {
1453 bcm2835_clk_register clk_register; 1463 bcm2835_clk_register clk_register;
1464 unsigned int supported;
1454 const void *data; 1465 const void *data;
1455}; 1466};
1456 1467
1457/* assignment helper macros for different clock types */ 1468/* assignment helper macros for different clock types */
1458#define _REGISTER(f, ...) { .clk_register = (bcm2835_clk_register)f, \ 1469#define _REGISTER(f, s, ...) { .clk_register = (bcm2835_clk_register)f, \
1459 .data = __VA_ARGS__ } 1470 .supported = s, \
1460#define REGISTER_PLL(...) _REGISTER(&bcm2835_register_pll, \ 1471 .data = __VA_ARGS__ }
1472#define REGISTER_PLL(s, ...) _REGISTER(&bcm2835_register_pll, \
1473 s, \
1461 &(struct bcm2835_pll_data) \ 1474 &(struct bcm2835_pll_data) \
1462 {__VA_ARGS__}) 1475 {__VA_ARGS__})
1463#define REGISTER_PLL_DIV(...) _REGISTER(&bcm2835_register_pll_divider, \ 1476#define REGISTER_PLL_DIV(s, ...) _REGISTER(&bcm2835_register_pll_divider, \
1464 &(struct bcm2835_pll_divider_data) \ 1477 s, \
1465 {__VA_ARGS__}) 1478 &(struct bcm2835_pll_divider_data) \
1466#define REGISTER_CLK(...) _REGISTER(&bcm2835_register_clock, \ 1479 {__VA_ARGS__})
1480#define REGISTER_CLK(s, ...) _REGISTER(&bcm2835_register_clock, \
1481 s, \
1467 &(struct bcm2835_clock_data) \ 1482 &(struct bcm2835_clock_data) \
1468 {__VA_ARGS__}) 1483 {__VA_ARGS__})
1469#define REGISTER_GATE(...) _REGISTER(&bcm2835_register_gate, \ 1484#define REGISTER_GATE(s, ...) _REGISTER(&bcm2835_register_gate, \
1485 s, \
1470 &(struct bcm2835_gate_data) \ 1486 &(struct bcm2835_gate_data) \
1471 {__VA_ARGS__}) 1487 {__VA_ARGS__})
1472 1488
@@ -1480,7 +1496,8 @@ static const char *const bcm2835_clock_osc_parents[] = {
1480 "testdebug1" 1496 "testdebug1"
1481}; 1497};
1482 1498
1483#define REGISTER_OSC_CLK(...) REGISTER_CLK( \ 1499#define REGISTER_OSC_CLK(s, ...) REGISTER_CLK( \
1500 s, \
1484 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_osc_parents), \ 1501 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_osc_parents), \
1485 .parents = bcm2835_clock_osc_parents, \ 1502 .parents = bcm2835_clock_osc_parents, \
1486 __VA_ARGS__) 1503 __VA_ARGS__)
@@ -1497,7 +1514,8 @@ static const char *const bcm2835_clock_per_parents[] = {
1497 "pllh_aux", 1514 "pllh_aux",
1498}; 1515};
1499 1516
1500#define REGISTER_PER_CLK(...) REGISTER_CLK( \ 1517#define REGISTER_PER_CLK(s, ...) REGISTER_CLK( \
1518 s, \
1501 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_per_parents), \ 1519 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_per_parents), \
1502 .parents = bcm2835_clock_per_parents, \ 1520 .parents = bcm2835_clock_per_parents, \
1503 __VA_ARGS__) 1521 __VA_ARGS__)
@@ -1522,7 +1540,8 @@ static const char *const bcm2835_pcm_per_parents[] = {
1522 "-", 1540 "-",
1523}; 1541};
1524 1542
1525#define REGISTER_PCM_CLK(...) REGISTER_CLK( \ 1543#define REGISTER_PCM_CLK(s, ...) REGISTER_CLK( \
1544 s, \
1526 .num_mux_parents = ARRAY_SIZE(bcm2835_pcm_per_parents), \ 1545 .num_mux_parents = ARRAY_SIZE(bcm2835_pcm_per_parents), \
1527 .parents = bcm2835_pcm_per_parents, \ 1546 .parents = bcm2835_pcm_per_parents, \
1528 __VA_ARGS__) 1547 __VA_ARGS__)
@@ -1541,7 +1560,8 @@ static const char *const bcm2835_clock_vpu_parents[] = {
1541 "pllc_core2", 1560 "pllc_core2",
1542}; 1561};
1543 1562
1544#define REGISTER_VPU_CLK(...) REGISTER_CLK( \ 1563#define REGISTER_VPU_CLK(s, ...) REGISTER_CLK( \
1564 s, \
1545 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_vpu_parents), \ 1565 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_vpu_parents), \
1546 .parents = bcm2835_clock_vpu_parents, \ 1566 .parents = bcm2835_clock_vpu_parents, \
1547 __VA_ARGS__) 1567 __VA_ARGS__)
@@ -1577,12 +1597,14 @@ static const char *const bcm2835_clock_dsi1_parents[] = {
1577 "dsi1_byte_inv", 1597 "dsi1_byte_inv",
1578}; 1598};
1579 1599
1580#define REGISTER_DSI0_CLK(...) REGISTER_CLK( \ 1600#define REGISTER_DSI0_CLK(s, ...) REGISTER_CLK( \
1601 s, \
1581 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi0_parents), \ 1602 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi0_parents), \
1582 .parents = bcm2835_clock_dsi0_parents, \ 1603 .parents = bcm2835_clock_dsi0_parents, \
1583 __VA_ARGS__) 1604 __VA_ARGS__)
1584 1605
1585#define REGISTER_DSI1_CLK(...) REGISTER_CLK( \ 1606#define REGISTER_DSI1_CLK(s, ...) REGISTER_CLK( \
1607 s, \
1586 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi1_parents), \ 1608 .num_mux_parents = ARRAY_SIZE(bcm2835_clock_dsi1_parents), \
1587 .parents = bcm2835_clock_dsi1_parents, \ 1609 .parents = bcm2835_clock_dsi1_parents, \
1588 __VA_ARGS__) 1610 __VA_ARGS__)
@@ -1602,6 +1624,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1602 * AUDIO domain is on. 1624 * AUDIO domain is on.
1603 */ 1625 */
1604 [BCM2835_PLLA] = REGISTER_PLL( 1626 [BCM2835_PLLA] = REGISTER_PLL(
1627 SOC_ALL,
1605 .name = "plla", 1628 .name = "plla",
1606 .cm_ctrl_reg = CM_PLLA, 1629 .cm_ctrl_reg = CM_PLLA,
1607 .a2w_ctrl_reg = A2W_PLLA_CTRL, 1630 .a2w_ctrl_reg = A2W_PLLA_CTRL,
@@ -1616,6 +1639,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1616 .max_rate = 2400000000u, 1639 .max_rate = 2400000000u,
1617 .max_fb_rate = BCM2835_MAX_FB_RATE), 1640 .max_fb_rate = BCM2835_MAX_FB_RATE),
1618 [BCM2835_PLLA_CORE] = REGISTER_PLL_DIV( 1641 [BCM2835_PLLA_CORE] = REGISTER_PLL_DIV(
1642 SOC_ALL,
1619 .name = "plla_core", 1643 .name = "plla_core",
1620 .source_pll = "plla", 1644 .source_pll = "plla",
1621 .cm_reg = CM_PLLA, 1645 .cm_reg = CM_PLLA,
@@ -1625,6 +1649,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1625 .fixed_divider = 1, 1649 .fixed_divider = 1,
1626 .flags = CLK_SET_RATE_PARENT), 1650 .flags = CLK_SET_RATE_PARENT),
1627 [BCM2835_PLLA_PER] = REGISTER_PLL_DIV( 1651 [BCM2835_PLLA_PER] = REGISTER_PLL_DIV(
1652 SOC_ALL,
1628 .name = "plla_per", 1653 .name = "plla_per",
1629 .source_pll = "plla", 1654 .source_pll = "plla",
1630 .cm_reg = CM_PLLA, 1655 .cm_reg = CM_PLLA,
@@ -1634,6 +1659,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1634 .fixed_divider = 1, 1659 .fixed_divider = 1,
1635 .flags = CLK_SET_RATE_PARENT), 1660 .flags = CLK_SET_RATE_PARENT),
1636 [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV( 1661 [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV(
1662 SOC_ALL,
1637 .name = "plla_dsi0", 1663 .name = "plla_dsi0",
1638 .source_pll = "plla", 1664 .source_pll = "plla",
1639 .cm_reg = CM_PLLA, 1665 .cm_reg = CM_PLLA,
@@ -1642,6 +1668,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1642 .hold_mask = CM_PLLA_HOLDDSI0, 1668 .hold_mask = CM_PLLA_HOLDDSI0,
1643 .fixed_divider = 1), 1669 .fixed_divider = 1),
1644 [BCM2835_PLLA_CCP2] = REGISTER_PLL_DIV( 1670 [BCM2835_PLLA_CCP2] = REGISTER_PLL_DIV(
1671 SOC_ALL,
1645 .name = "plla_ccp2", 1672 .name = "plla_ccp2",
1646 .source_pll = "plla", 1673 .source_pll = "plla",
1647 .cm_reg = CM_PLLA, 1674 .cm_reg = CM_PLLA,
@@ -1663,6 +1690,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1663 * AUDIO domain is on. 1690 * AUDIO domain is on.
1664 */ 1691 */
1665 [BCM2835_PLLC] = REGISTER_PLL( 1692 [BCM2835_PLLC] = REGISTER_PLL(
1693 SOC_ALL,
1666 .name = "pllc", 1694 .name = "pllc",
1667 .cm_ctrl_reg = CM_PLLC, 1695 .cm_ctrl_reg = CM_PLLC,
1668 .a2w_ctrl_reg = A2W_PLLC_CTRL, 1696 .a2w_ctrl_reg = A2W_PLLC_CTRL,
@@ -1677,6 +1705,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1677 .max_rate = 3000000000u, 1705 .max_rate = 3000000000u,
1678 .max_fb_rate = BCM2835_MAX_FB_RATE), 1706 .max_fb_rate = BCM2835_MAX_FB_RATE),
1679 [BCM2835_PLLC_CORE0] = REGISTER_PLL_DIV( 1707 [BCM2835_PLLC_CORE0] = REGISTER_PLL_DIV(
1708 SOC_ALL,
1680 .name = "pllc_core0", 1709 .name = "pllc_core0",
1681 .source_pll = "pllc", 1710 .source_pll = "pllc",
1682 .cm_reg = CM_PLLC, 1711 .cm_reg = CM_PLLC,
@@ -1686,6 +1715,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1686 .fixed_divider = 1, 1715 .fixed_divider = 1,
1687 .flags = CLK_SET_RATE_PARENT), 1716 .flags = CLK_SET_RATE_PARENT),
1688 [BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV( 1717 [BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV(
1718 SOC_ALL,
1689 .name = "pllc_core1", 1719 .name = "pllc_core1",
1690 .source_pll = "pllc", 1720 .source_pll = "pllc",
1691 .cm_reg = CM_PLLC, 1721 .cm_reg = CM_PLLC,
@@ -1695,6 +1725,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1695 .fixed_divider = 1, 1725 .fixed_divider = 1,
1696 .flags = CLK_SET_RATE_PARENT), 1726 .flags = CLK_SET_RATE_PARENT),
1697 [BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV( 1727 [BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV(
1728 SOC_ALL,
1698 .name = "pllc_core2", 1729 .name = "pllc_core2",
1699 .source_pll = "pllc", 1730 .source_pll = "pllc",
1700 .cm_reg = CM_PLLC, 1731 .cm_reg = CM_PLLC,
@@ -1704,6 +1735,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1704 .fixed_divider = 1, 1735 .fixed_divider = 1,
1705 .flags = CLK_SET_RATE_PARENT), 1736 .flags = CLK_SET_RATE_PARENT),
1706 [BCM2835_PLLC_PER] = REGISTER_PLL_DIV( 1737 [BCM2835_PLLC_PER] = REGISTER_PLL_DIV(
1738 SOC_ALL,
1707 .name = "pllc_per", 1739 .name = "pllc_per",
1708 .source_pll = "pllc", 1740 .source_pll = "pllc",
1709 .cm_reg = CM_PLLC, 1741 .cm_reg = CM_PLLC,
@@ -1720,6 +1752,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1720 * AUDIO domain is on. 1752 * AUDIO domain is on.
1721 */ 1753 */
1722 [BCM2835_PLLD] = REGISTER_PLL( 1754 [BCM2835_PLLD] = REGISTER_PLL(
1755 SOC_ALL,
1723 .name = "plld", 1756 .name = "plld",
1724 .cm_ctrl_reg = CM_PLLD, 1757 .cm_ctrl_reg = CM_PLLD,
1725 .a2w_ctrl_reg = A2W_PLLD_CTRL, 1758 .a2w_ctrl_reg = A2W_PLLD_CTRL,
@@ -1734,6 +1767,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1734 .max_rate = 2400000000u, 1767 .max_rate = 2400000000u,
1735 .max_fb_rate = BCM2835_MAX_FB_RATE), 1768 .max_fb_rate = BCM2835_MAX_FB_RATE),
1736 [BCM2835_PLLD_CORE] = REGISTER_PLL_DIV( 1769 [BCM2835_PLLD_CORE] = REGISTER_PLL_DIV(
1770 SOC_ALL,
1737 .name = "plld_core", 1771 .name = "plld_core",
1738 .source_pll = "plld", 1772 .source_pll = "plld",
1739 .cm_reg = CM_PLLD, 1773 .cm_reg = CM_PLLD,
@@ -1742,7 +1776,13 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1742 .hold_mask = CM_PLLD_HOLDCORE, 1776 .hold_mask = CM_PLLD_HOLDCORE,
1743 .fixed_divider = 1, 1777 .fixed_divider = 1,
1744 .flags = CLK_SET_RATE_PARENT), 1778 .flags = CLK_SET_RATE_PARENT),
1779 /*
1780 * VPU firmware assumes that PLLD_PER isn't disabled by the ARM core.
1781 * Otherwise this could cause firmware lookups. That's why we mark
1782 * it as critical.
1783 */
1745 [BCM2835_PLLD_PER] = REGISTER_PLL_DIV( 1784 [BCM2835_PLLD_PER] = REGISTER_PLL_DIV(
1785 SOC_ALL,
1746 .name = "plld_per", 1786 .name = "plld_per",
1747 .source_pll = "plld", 1787 .source_pll = "plld",
1748 .cm_reg = CM_PLLD, 1788 .cm_reg = CM_PLLD,
@@ -1750,8 +1790,9 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1750 .load_mask = CM_PLLD_LOADPER, 1790 .load_mask = CM_PLLD_LOADPER,
1751 .hold_mask = CM_PLLD_HOLDPER, 1791 .hold_mask = CM_PLLD_HOLDPER,
1752 .fixed_divider = 1, 1792 .fixed_divider = 1,
1753 .flags = CLK_SET_RATE_PARENT), 1793 .flags = CLK_IS_CRITICAL | CLK_SET_RATE_PARENT),
1754 [BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV( 1794 [BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV(
1795 SOC_ALL,
1755 .name = "plld_dsi0", 1796 .name = "plld_dsi0",
1756 .source_pll = "plld", 1797 .source_pll = "plld",
1757 .cm_reg = CM_PLLD, 1798 .cm_reg = CM_PLLD,
@@ -1760,6 +1801,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1760 .hold_mask = CM_PLLD_HOLDDSI0, 1801 .hold_mask = CM_PLLD_HOLDDSI0,
1761 .fixed_divider = 1), 1802 .fixed_divider = 1),
1762 [BCM2835_PLLD_DSI1] = REGISTER_PLL_DIV( 1803 [BCM2835_PLLD_DSI1] = REGISTER_PLL_DIV(
1804 SOC_ALL,
1763 .name = "plld_dsi1", 1805 .name = "plld_dsi1",
1764 .source_pll = "plld", 1806 .source_pll = "plld",
1765 .cm_reg = CM_PLLD, 1807 .cm_reg = CM_PLLD,
@@ -1775,6 +1817,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1775 * It is in the HDMI power domain. 1817 * It is in the HDMI power domain.
1776 */ 1818 */
1777 [BCM2835_PLLH] = REGISTER_PLL( 1819 [BCM2835_PLLH] = REGISTER_PLL(
1820 SOC_BCM2835,
1778 "pllh", 1821 "pllh",
1779 .cm_ctrl_reg = CM_PLLH, 1822 .cm_ctrl_reg = CM_PLLH,
1780 .a2w_ctrl_reg = A2W_PLLH_CTRL, 1823 .a2w_ctrl_reg = A2W_PLLH_CTRL,
@@ -1789,6 +1832,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1789 .max_rate = 3000000000u, 1832 .max_rate = 3000000000u,
1790 .max_fb_rate = BCM2835_MAX_FB_RATE), 1833 .max_fb_rate = BCM2835_MAX_FB_RATE),
1791 [BCM2835_PLLH_RCAL] = REGISTER_PLL_DIV( 1834 [BCM2835_PLLH_RCAL] = REGISTER_PLL_DIV(
1835 SOC_BCM2835,
1792 .name = "pllh_rcal", 1836 .name = "pllh_rcal",
1793 .source_pll = "pllh", 1837 .source_pll = "pllh",
1794 .cm_reg = CM_PLLH, 1838 .cm_reg = CM_PLLH,
@@ -1798,6 +1842,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1798 .fixed_divider = 10, 1842 .fixed_divider = 10,
1799 .flags = CLK_SET_RATE_PARENT), 1843 .flags = CLK_SET_RATE_PARENT),
1800 [BCM2835_PLLH_AUX] = REGISTER_PLL_DIV( 1844 [BCM2835_PLLH_AUX] = REGISTER_PLL_DIV(
1845 SOC_BCM2835,
1801 .name = "pllh_aux", 1846 .name = "pllh_aux",
1802 .source_pll = "pllh", 1847 .source_pll = "pllh",
1803 .cm_reg = CM_PLLH, 1848 .cm_reg = CM_PLLH,
@@ -1807,6 +1852,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1807 .fixed_divider = 1, 1852 .fixed_divider = 1,
1808 .flags = CLK_SET_RATE_PARENT), 1853 .flags = CLK_SET_RATE_PARENT),
1809 [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV( 1854 [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
1855 SOC_BCM2835,
1810 .name = "pllh_pix", 1856 .name = "pllh_pix",
1811 .source_pll = "pllh", 1857 .source_pll = "pllh",
1812 .cm_reg = CM_PLLH, 1858 .cm_reg = CM_PLLH,
@@ -1822,6 +1868,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1822 1868
1823 /* One Time Programmable Memory clock. Maximum 10Mhz. */ 1869 /* One Time Programmable Memory clock. Maximum 10Mhz. */
1824 [BCM2835_CLOCK_OTP] = REGISTER_OSC_CLK( 1870 [BCM2835_CLOCK_OTP] = REGISTER_OSC_CLK(
1871 SOC_ALL,
1825 .name = "otp", 1872 .name = "otp",
1826 .ctl_reg = CM_OTPCTL, 1873 .ctl_reg = CM_OTPCTL,
1827 .div_reg = CM_OTPDIV, 1874 .div_reg = CM_OTPDIV,
@@ -1833,6 +1880,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1833 * bythe watchdog timer and the camera pulse generator. 1880 * bythe watchdog timer and the camera pulse generator.
1834 */ 1881 */
1835 [BCM2835_CLOCK_TIMER] = REGISTER_OSC_CLK( 1882 [BCM2835_CLOCK_TIMER] = REGISTER_OSC_CLK(
1883 SOC_ALL,
1836 .name = "timer", 1884 .name = "timer",
1837 .ctl_reg = CM_TIMERCTL, 1885 .ctl_reg = CM_TIMERCTL,
1838 .div_reg = CM_TIMERDIV, 1886 .div_reg = CM_TIMERDIV,
@@ -1843,12 +1891,14 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1843 * Generally run at 2Mhz, max 5Mhz. 1891 * Generally run at 2Mhz, max 5Mhz.
1844 */ 1892 */
1845 [BCM2835_CLOCK_TSENS] = REGISTER_OSC_CLK( 1893 [BCM2835_CLOCK_TSENS] = REGISTER_OSC_CLK(
1894 SOC_ALL,
1846 .name = "tsens", 1895 .name = "tsens",
1847 .ctl_reg = CM_TSENSCTL, 1896 .ctl_reg = CM_TSENSCTL,
1848 .div_reg = CM_TSENSDIV, 1897 .div_reg = CM_TSENSDIV,
1849 .int_bits = 5, 1898 .int_bits = 5,
1850 .frac_bits = 0), 1899 .frac_bits = 0),
1851 [BCM2835_CLOCK_TEC] = REGISTER_OSC_CLK( 1900 [BCM2835_CLOCK_TEC] = REGISTER_OSC_CLK(
1901 SOC_ALL,
1852 .name = "tec", 1902 .name = "tec",
1853 .ctl_reg = CM_TECCTL, 1903 .ctl_reg = CM_TECCTL,
1854 .div_reg = CM_TECDIV, 1904 .div_reg = CM_TECDIV,
@@ -1857,6 +1907,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1857 1907
1858 /* clocks with vpu parent mux */ 1908 /* clocks with vpu parent mux */
1859 [BCM2835_CLOCK_H264] = REGISTER_VPU_CLK( 1909 [BCM2835_CLOCK_H264] = REGISTER_VPU_CLK(
1910 SOC_ALL,
1860 .name = "h264", 1911 .name = "h264",
1861 .ctl_reg = CM_H264CTL, 1912 .ctl_reg = CM_H264CTL,
1862 .div_reg = CM_H264DIV, 1913 .div_reg = CM_H264DIV,
@@ -1864,6 +1915,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1864 .frac_bits = 8, 1915 .frac_bits = 8,
1865 .tcnt_mux = 1), 1916 .tcnt_mux = 1),
1866 [BCM2835_CLOCK_ISP] = REGISTER_VPU_CLK( 1917 [BCM2835_CLOCK_ISP] = REGISTER_VPU_CLK(
1918 SOC_ALL,
1867 .name = "isp", 1919 .name = "isp",
1868 .ctl_reg = CM_ISPCTL, 1920 .ctl_reg = CM_ISPCTL,
1869 .div_reg = CM_ISPDIV, 1921 .div_reg = CM_ISPDIV,
@@ -1876,6 +1928,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1876 * in the SDRAM controller can't be used. 1928 * in the SDRAM controller can't be used.
1877 */ 1929 */
1878 [BCM2835_CLOCK_SDRAM] = REGISTER_VPU_CLK( 1930 [BCM2835_CLOCK_SDRAM] = REGISTER_VPU_CLK(
1931 SOC_ALL,
1879 .name = "sdram", 1932 .name = "sdram",
1880 .ctl_reg = CM_SDCCTL, 1933 .ctl_reg = CM_SDCCTL,
1881 .div_reg = CM_SDCDIV, 1934 .div_reg = CM_SDCDIV,
@@ -1883,6 +1936,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1883 .frac_bits = 0, 1936 .frac_bits = 0,
1884 .tcnt_mux = 3), 1937 .tcnt_mux = 3),
1885 [BCM2835_CLOCK_V3D] = REGISTER_VPU_CLK( 1938 [BCM2835_CLOCK_V3D] = REGISTER_VPU_CLK(
1939 SOC_ALL,
1886 .name = "v3d", 1940 .name = "v3d",
1887 .ctl_reg = CM_V3DCTL, 1941 .ctl_reg = CM_V3DCTL,
1888 .div_reg = CM_V3DDIV, 1942 .div_reg = CM_V3DDIV,
@@ -1896,6 +1950,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1896 * in various hardware documentation. 1950 * in various hardware documentation.
1897 */ 1951 */
1898 [BCM2835_CLOCK_VPU] = REGISTER_VPU_CLK( 1952 [BCM2835_CLOCK_VPU] = REGISTER_VPU_CLK(
1953 SOC_ALL,
1899 .name = "vpu", 1954 .name = "vpu",
1900 .ctl_reg = CM_VPUCTL, 1955 .ctl_reg = CM_VPUCTL,
1901 .div_reg = CM_VPUDIV, 1956 .div_reg = CM_VPUDIV,
@@ -1907,6 +1962,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1907 1962
1908 /* clocks with per parent mux */ 1963 /* clocks with per parent mux */
1909 [BCM2835_CLOCK_AVEO] = REGISTER_PER_CLK( 1964 [BCM2835_CLOCK_AVEO] = REGISTER_PER_CLK(
1965 SOC_ALL,
1910 .name = "aveo", 1966 .name = "aveo",
1911 .ctl_reg = CM_AVEOCTL, 1967 .ctl_reg = CM_AVEOCTL,
1912 .div_reg = CM_AVEODIV, 1968 .div_reg = CM_AVEODIV,
@@ -1914,6 +1970,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1914 .frac_bits = 0, 1970 .frac_bits = 0,
1915 .tcnt_mux = 38), 1971 .tcnt_mux = 38),
1916 [BCM2835_CLOCK_CAM0] = REGISTER_PER_CLK( 1972 [BCM2835_CLOCK_CAM0] = REGISTER_PER_CLK(
1973 SOC_ALL,
1917 .name = "cam0", 1974 .name = "cam0",
1918 .ctl_reg = CM_CAM0CTL, 1975 .ctl_reg = CM_CAM0CTL,
1919 .div_reg = CM_CAM0DIV, 1976 .div_reg = CM_CAM0DIV,
@@ -1921,6 +1978,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1921 .frac_bits = 8, 1978 .frac_bits = 8,
1922 .tcnt_mux = 14), 1979 .tcnt_mux = 14),
1923 [BCM2835_CLOCK_CAM1] = REGISTER_PER_CLK( 1980 [BCM2835_CLOCK_CAM1] = REGISTER_PER_CLK(
1981 SOC_ALL,
1924 .name = "cam1", 1982 .name = "cam1",
1925 .ctl_reg = CM_CAM1CTL, 1983 .ctl_reg = CM_CAM1CTL,
1926 .div_reg = CM_CAM1DIV, 1984 .div_reg = CM_CAM1DIV,
@@ -1928,12 +1986,14 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1928 .frac_bits = 8, 1986 .frac_bits = 8,
1929 .tcnt_mux = 15), 1987 .tcnt_mux = 15),
1930 [BCM2835_CLOCK_DFT] = REGISTER_PER_CLK( 1988 [BCM2835_CLOCK_DFT] = REGISTER_PER_CLK(
1989 SOC_ALL,
1931 .name = "dft", 1990 .name = "dft",
1932 .ctl_reg = CM_DFTCTL, 1991 .ctl_reg = CM_DFTCTL,
1933 .div_reg = CM_DFTDIV, 1992 .div_reg = CM_DFTDIV,
1934 .int_bits = 5, 1993 .int_bits = 5,
1935 .frac_bits = 0), 1994 .frac_bits = 0),
1936 [BCM2835_CLOCK_DPI] = REGISTER_PER_CLK( 1995 [BCM2835_CLOCK_DPI] = REGISTER_PER_CLK(
1996 SOC_ALL,
1937 .name = "dpi", 1997 .name = "dpi",
1938 .ctl_reg = CM_DPICTL, 1998 .ctl_reg = CM_DPICTL,
1939 .div_reg = CM_DPIDIV, 1999 .div_reg = CM_DPIDIV,
@@ -1943,6 +2003,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1943 2003
1944 /* Arasan EMMC clock */ 2004 /* Arasan EMMC clock */
1945 [BCM2835_CLOCK_EMMC] = REGISTER_PER_CLK( 2005 [BCM2835_CLOCK_EMMC] = REGISTER_PER_CLK(
2006 SOC_ALL,
1946 .name = "emmc", 2007 .name = "emmc",
1947 .ctl_reg = CM_EMMCCTL, 2008 .ctl_reg = CM_EMMCCTL,
1948 .div_reg = CM_EMMCDIV, 2009 .div_reg = CM_EMMCDIV,
@@ -1950,8 +2011,19 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1950 .frac_bits = 8, 2011 .frac_bits = 8,
1951 .tcnt_mux = 39), 2012 .tcnt_mux = 39),
1952 2013
2014 /* EMMC2 clock (only available for BCM2711) */
2015 [BCM2711_CLOCK_EMMC2] = REGISTER_PER_CLK(
2016 SOC_BCM2711,
2017 .name = "emmc2",
2018 .ctl_reg = CM_EMMC2CTL,
2019 .div_reg = CM_EMMC2DIV,
2020 .int_bits = 4,
2021 .frac_bits = 8,
2022 .tcnt_mux = 42),
2023
1953 /* General purpose (GPIO) clocks */ 2024 /* General purpose (GPIO) clocks */
1954 [BCM2835_CLOCK_GP0] = REGISTER_PER_CLK( 2025 [BCM2835_CLOCK_GP0] = REGISTER_PER_CLK(
2026 SOC_ALL,
1955 .name = "gp0", 2027 .name = "gp0",
1956 .ctl_reg = CM_GP0CTL, 2028 .ctl_reg = CM_GP0CTL,
1957 .div_reg = CM_GP0DIV, 2029 .div_reg = CM_GP0DIV,
@@ -1960,6 +2032,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1960 .is_mash_clock = true, 2032 .is_mash_clock = true,
1961 .tcnt_mux = 20), 2033 .tcnt_mux = 20),
1962 [BCM2835_CLOCK_GP1] = REGISTER_PER_CLK( 2034 [BCM2835_CLOCK_GP1] = REGISTER_PER_CLK(
2035 SOC_ALL,
1963 .name = "gp1", 2036 .name = "gp1",
1964 .ctl_reg = CM_GP1CTL, 2037 .ctl_reg = CM_GP1CTL,
1965 .div_reg = CM_GP1DIV, 2038 .div_reg = CM_GP1DIV,
@@ -1969,6 +2042,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1969 .is_mash_clock = true, 2042 .is_mash_clock = true,
1970 .tcnt_mux = 21), 2043 .tcnt_mux = 21),
1971 [BCM2835_CLOCK_GP2] = REGISTER_PER_CLK( 2044 [BCM2835_CLOCK_GP2] = REGISTER_PER_CLK(
2045 SOC_ALL,
1972 .name = "gp2", 2046 .name = "gp2",
1973 .ctl_reg = CM_GP2CTL, 2047 .ctl_reg = CM_GP2CTL,
1974 .div_reg = CM_GP2DIV, 2048 .div_reg = CM_GP2DIV,
@@ -1978,6 +2052,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1978 2052
1979 /* HDMI state machine */ 2053 /* HDMI state machine */
1980 [BCM2835_CLOCK_HSM] = REGISTER_PER_CLK( 2054 [BCM2835_CLOCK_HSM] = REGISTER_PER_CLK(
2055 SOC_ALL,
1981 .name = "hsm", 2056 .name = "hsm",
1982 .ctl_reg = CM_HSMCTL, 2057 .ctl_reg = CM_HSMCTL,
1983 .div_reg = CM_HSMDIV, 2058 .div_reg = CM_HSMDIV,
@@ -1985,6 +2060,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1985 .frac_bits = 8, 2060 .frac_bits = 8,
1986 .tcnt_mux = 22), 2061 .tcnt_mux = 22),
1987 [BCM2835_CLOCK_PCM] = REGISTER_PCM_CLK( 2062 [BCM2835_CLOCK_PCM] = REGISTER_PCM_CLK(
2063 SOC_ALL,
1988 .name = "pcm", 2064 .name = "pcm",
1989 .ctl_reg = CM_PCMCTL, 2065 .ctl_reg = CM_PCMCTL,
1990 .div_reg = CM_PCMDIV, 2066 .div_reg = CM_PCMDIV,
@@ -1994,6 +2070,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
1994 .low_jitter = true, 2070 .low_jitter = true,
1995 .tcnt_mux = 23), 2071 .tcnt_mux = 23),
1996 [BCM2835_CLOCK_PWM] = REGISTER_PER_CLK( 2072 [BCM2835_CLOCK_PWM] = REGISTER_PER_CLK(
2073 SOC_ALL,
1997 .name = "pwm", 2074 .name = "pwm",
1998 .ctl_reg = CM_PWMCTL, 2075 .ctl_reg = CM_PWMCTL,
1999 .div_reg = CM_PWMDIV, 2076 .div_reg = CM_PWMDIV,
@@ -2002,6 +2079,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2002 .is_mash_clock = true, 2079 .is_mash_clock = true,
2003 .tcnt_mux = 24), 2080 .tcnt_mux = 24),
2004 [BCM2835_CLOCK_SLIM] = REGISTER_PER_CLK( 2081 [BCM2835_CLOCK_SLIM] = REGISTER_PER_CLK(
2082 SOC_ALL,
2005 .name = "slim", 2083 .name = "slim",
2006 .ctl_reg = CM_SLIMCTL, 2084 .ctl_reg = CM_SLIMCTL,
2007 .div_reg = CM_SLIMDIV, 2085 .div_reg = CM_SLIMDIV,
@@ -2010,6 +2088,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2010 .is_mash_clock = true, 2088 .is_mash_clock = true,
2011 .tcnt_mux = 25), 2089 .tcnt_mux = 25),
2012 [BCM2835_CLOCK_SMI] = REGISTER_PER_CLK( 2090 [BCM2835_CLOCK_SMI] = REGISTER_PER_CLK(
2091 SOC_ALL,
2013 .name = "smi", 2092 .name = "smi",
2014 .ctl_reg = CM_SMICTL, 2093 .ctl_reg = CM_SMICTL,
2015 .div_reg = CM_SMIDIV, 2094 .div_reg = CM_SMIDIV,
@@ -2017,6 +2096,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2017 .frac_bits = 8, 2096 .frac_bits = 8,
2018 .tcnt_mux = 27), 2097 .tcnt_mux = 27),
2019 [BCM2835_CLOCK_UART] = REGISTER_PER_CLK( 2098 [BCM2835_CLOCK_UART] = REGISTER_PER_CLK(
2099 SOC_ALL,
2020 .name = "uart", 2100 .name = "uart",
2021 .ctl_reg = CM_UARTCTL, 2101 .ctl_reg = CM_UARTCTL,
2022 .div_reg = CM_UARTDIV, 2102 .div_reg = CM_UARTDIV,
@@ -2026,6 +2106,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2026 2106
2027 /* TV encoder clock. Only operating frequency is 108Mhz. */ 2107 /* TV encoder clock. Only operating frequency is 108Mhz. */
2028 [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK( 2108 [BCM2835_CLOCK_VEC] = REGISTER_PER_CLK(
2109 SOC_ALL,
2029 .name = "vec", 2110 .name = "vec",
2030 .ctl_reg = CM_VECCTL, 2111 .ctl_reg = CM_VECCTL,
2031 .div_reg = CM_VECDIV, 2112 .div_reg = CM_VECDIV,
@@ -2040,6 +2121,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2040 2121
2041 /* dsi clocks */ 2122 /* dsi clocks */
2042 [BCM2835_CLOCK_DSI0E] = REGISTER_PER_CLK( 2123 [BCM2835_CLOCK_DSI0E] = REGISTER_PER_CLK(
2124 SOC_ALL,
2043 .name = "dsi0e", 2125 .name = "dsi0e",
2044 .ctl_reg = CM_DSI0ECTL, 2126 .ctl_reg = CM_DSI0ECTL,
2045 .div_reg = CM_DSI0EDIV, 2127 .div_reg = CM_DSI0EDIV,
@@ -2047,6 +2129,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2047 .frac_bits = 8, 2129 .frac_bits = 8,
2048 .tcnt_mux = 18), 2130 .tcnt_mux = 18),
2049 [BCM2835_CLOCK_DSI1E] = REGISTER_PER_CLK( 2131 [BCM2835_CLOCK_DSI1E] = REGISTER_PER_CLK(
2132 SOC_ALL,
2050 .name = "dsi1e", 2133 .name = "dsi1e",
2051 .ctl_reg = CM_DSI1ECTL, 2134 .ctl_reg = CM_DSI1ECTL,
2052 .div_reg = CM_DSI1EDIV, 2135 .div_reg = CM_DSI1EDIV,
@@ -2054,6 +2137,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2054 .frac_bits = 8, 2137 .frac_bits = 8,
2055 .tcnt_mux = 19), 2138 .tcnt_mux = 19),
2056 [BCM2835_CLOCK_DSI0P] = REGISTER_DSI0_CLK( 2139 [BCM2835_CLOCK_DSI0P] = REGISTER_DSI0_CLK(
2140 SOC_ALL,
2057 .name = "dsi0p", 2141 .name = "dsi0p",
2058 .ctl_reg = CM_DSI0PCTL, 2142 .ctl_reg = CM_DSI0PCTL,
2059 .div_reg = CM_DSI0PDIV, 2143 .div_reg = CM_DSI0PDIV,
@@ -2061,6 +2145,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2061 .frac_bits = 0, 2145 .frac_bits = 0,
2062 .tcnt_mux = 12), 2146 .tcnt_mux = 12),
2063 [BCM2835_CLOCK_DSI1P] = REGISTER_DSI1_CLK( 2147 [BCM2835_CLOCK_DSI1P] = REGISTER_DSI1_CLK(
2148 SOC_ALL,
2064 .name = "dsi1p", 2149 .name = "dsi1p",
2065 .ctl_reg = CM_DSI1PCTL, 2150 .ctl_reg = CM_DSI1PCTL,
2066 .div_reg = CM_DSI1PDIV, 2151 .div_reg = CM_DSI1PDIV,
@@ -2077,6 +2162,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
2077 * non-stop vpu clock. 2162 * non-stop vpu clock.
2078 */ 2163 */
2079 [BCM2835_CLOCK_PERI_IMAGE] = REGISTER_GATE( 2164 [BCM2835_CLOCK_PERI_IMAGE] = REGISTER_GATE(
2165 SOC_ALL,
2080 .name = "peri_image", 2166 .name = "peri_image",
2081 .parent = "vpu", 2167 .parent = "vpu",
2082 .ctl_reg = CM_PERIICTL), 2168 .ctl_reg = CM_PERIICTL),
@@ -2109,9 +2195,14 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
2109 struct resource *res; 2195 struct resource *res;
2110 const struct bcm2835_clk_desc *desc; 2196 const struct bcm2835_clk_desc *desc;
2111 const size_t asize = ARRAY_SIZE(clk_desc_array); 2197 const size_t asize = ARRAY_SIZE(clk_desc_array);
2198 const struct cprman_plat_data *pdata;
2112 size_t i; 2199 size_t i;
2113 int ret; 2200 int ret;
2114 2201
2202 pdata = of_device_get_match_data(&pdev->dev);
2203 if (!pdata)
2204 return -ENODEV;
2205
2115 cprman = devm_kzalloc(dev, 2206 cprman = devm_kzalloc(dev,
2116 struct_size(cprman, onecell.hws, asize), 2207 struct_size(cprman, onecell.hws, asize),
2117 GFP_KERNEL); 2208 GFP_KERNEL);
@@ -2147,8 +2238,10 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
2147 2238
2148 for (i = 0; i < asize; i++) { 2239 for (i = 0; i < asize; i++) {
2149 desc = &clk_desc_array[i]; 2240 desc = &clk_desc_array[i];
2150 if (desc->clk_register && desc->data) 2241 if (desc->clk_register && desc->data &&
2242 (desc->supported & pdata->soc)) {
2151 hws[i] = desc->clk_register(cprman, desc->data); 2243 hws[i] = desc->clk_register(cprman, desc->data);
2244 }
2152 } 2245 }
2153 2246
2154 ret = bcm2835_mark_sdc_parent_critical(hws[BCM2835_CLOCK_SDRAM]->clk); 2247 ret = bcm2835_mark_sdc_parent_critical(hws[BCM2835_CLOCK_SDRAM]->clk);
@@ -2159,8 +2252,17 @@ static int bcm2835_clk_probe(struct platform_device *pdev)
2159 &cprman->onecell); 2252 &cprman->onecell);
2160} 2253}
2161 2254
2255static const struct cprman_plat_data cprman_bcm2835_plat_data = {
2256 .soc = SOC_BCM2835,
2257};
2258
2259static const struct cprman_plat_data cprman_bcm2711_plat_data = {
2260 .soc = SOC_BCM2711,
2261};
2262
2162static const struct of_device_id bcm2835_clk_of_match[] = { 2263static const struct of_device_id bcm2835_clk_of_match[] = {
2163 { .compatible = "brcm,bcm2835-cprman", }, 2264 { .compatible = "brcm,bcm2835-cprman", .data = &cprman_bcm2835_plat_data },
2265 { .compatible = "brcm,bcm2711-cprman", .data = &cprman_bcm2711_plat_data },
2164 {} 2266 {}
2165}; 2267};
2166MODULE_DEVICE_TABLE(of, bcm2835_clk_of_match); 2268MODULE_DEVICE_TABLE(of, bcm2835_clk_of_match);
diff --git a/drivers/clk/clk-cdce925.c b/drivers/clk/clk-cdce925.c
index 23c9326ea48c..308b353815e1 100644
--- a/drivers/clk/clk-cdce925.c
+++ b/drivers/clk/clk-cdce925.c
@@ -16,6 +16,7 @@
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/regmap.h> 18#include <linux/regmap.h>
19#include <linux/regulator/consumer.h>
19#include <linux/slab.h> 20#include <linux/slab.h>
20#include <linux/gcd.h> 21#include <linux/gcd.h>
21 22
@@ -602,6 +603,30 @@ of_clk_cdce925_get(struct of_phandle_args *clkspec, void *_data)
602 return &data->clk[idx].hw; 603 return &data->clk[idx].hw;
603} 604}
604 605
606static void cdce925_regulator_disable(void *regulator)
607{
608 regulator_disable(regulator);
609}
610
611static int cdce925_regulator_enable(struct device *dev, const char *name)
612{
613 struct regulator *regulator;
614 int err;
615
616 regulator = devm_regulator_get(dev, name);
617 if (IS_ERR(regulator))
618 return PTR_ERR(regulator);
619
620 err = regulator_enable(regulator);
621 if (err) {
622 dev_err(dev, "Failed to enable %s: %d\n", name, err);
623 return err;
624 }
625
626 return devm_add_action_or_reset(dev, cdce925_regulator_disable,
627 regulator);
628}
629
605/* The CDCE925 uses a funky way to read/write registers. Bulk mode is 630/* The CDCE925 uses a funky way to read/write registers. Bulk mode is
606 * just weird, so just use the single byte mode exclusively. */ 631 * just weird, so just use the single byte mode exclusively. */
607static struct regmap_bus regmap_cdce925_bus = { 632static struct regmap_bus regmap_cdce925_bus = {
@@ -630,6 +655,15 @@ static int cdce925_probe(struct i2c_client *client,
630 }; 655 };
631 656
632 dev_dbg(&client->dev, "%s\n", __func__); 657 dev_dbg(&client->dev, "%s\n", __func__);
658
659 err = cdce925_regulator_enable(&client->dev, "vdd");
660 if (err)
661 return err;
662
663 err = cdce925_regulator_enable(&client->dev, "vddout");
664 if (err)
665 return err;
666
633 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); 667 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
634 if (!data) 668 if (!data)
635 return -ENOMEM; 669 return -ENOMEM;
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index e7300e1094b9..498cae518147 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -37,6 +37,12 @@ static HLIST_HEAD(clk_root_list);
37static HLIST_HEAD(clk_orphan_list); 37static HLIST_HEAD(clk_orphan_list);
38static LIST_HEAD(clk_notifier_list); 38static LIST_HEAD(clk_notifier_list);
39 39
40static struct hlist_head *all_lists[] = {
41 &clk_root_list,
42 &clk_orphan_list,
43 NULL,
44};
45
40/*** private data structures ***/ 46/*** private data structures ***/
41 47
42struct clk_parent_map { 48struct clk_parent_map {
@@ -2841,12 +2847,6 @@ static int inited = 0;
2841static DEFINE_MUTEX(clk_debug_lock); 2847static DEFINE_MUTEX(clk_debug_lock);
2842static HLIST_HEAD(clk_debug_list); 2848static HLIST_HEAD(clk_debug_list);
2843 2849
2844static struct hlist_head *all_lists[] = {
2845 &clk_root_list,
2846 &clk_orphan_list,
2847 NULL,
2848};
2849
2850static struct hlist_head *orphan_list[] = { 2850static struct hlist_head *orphan_list[] = {
2851 &clk_orphan_list, 2851 &clk_orphan_list,
2852 NULL, 2852 NULL,
@@ -3777,6 +3777,34 @@ static const struct clk_ops clk_nodrv_ops = {
3777 .set_parent = clk_nodrv_set_parent, 3777 .set_parent = clk_nodrv_set_parent,
3778}; 3778};
3779 3779
3780static void clk_core_evict_parent_cache_subtree(struct clk_core *root,
3781 struct clk_core *target)
3782{
3783 int i;
3784 struct clk_core *child;
3785
3786 for (i = 0; i < root->num_parents; i++)
3787 if (root->parents[i].core == target)
3788 root->parents[i].core = NULL;
3789
3790 hlist_for_each_entry(child, &root->children, child_node)
3791 clk_core_evict_parent_cache_subtree(child, target);
3792}
3793
3794/* Remove this clk from all parent caches */
3795static void clk_core_evict_parent_cache(struct clk_core *core)
3796{
3797 struct hlist_head **lists;
3798 struct clk_core *root;
3799
3800 lockdep_assert_held(&prepare_lock);
3801
3802 for (lists = all_lists; *lists; lists++)
3803 hlist_for_each_entry(root, *lists, child_node)
3804 clk_core_evict_parent_cache_subtree(root, core);
3805
3806}
3807
3780/** 3808/**
3781 * clk_unregister - unregister a currently registered clock 3809 * clk_unregister - unregister a currently registered clock
3782 * @clk: clock to unregister 3810 * @clk: clock to unregister
@@ -3815,6 +3843,8 @@ void clk_unregister(struct clk *clk)
3815 clk_core_set_parent_nolock(child, NULL); 3843 clk_core_set_parent_nolock(child, NULL);
3816 } 3844 }
3817 3845
3846 clk_core_evict_parent_cache(clk->core);
3847
3818 hlist_del_init(&clk->core->child_node); 3848 hlist_del_init(&clk->core->child_node);
3819 3849
3820 if (clk->core->prepare_count) 3850 if (clk->core->prepare_count)
diff --git a/include/dt-bindings/clock/bcm2835.h b/include/dt-bindings/clock/bcm2835.h
index 2cec01f96897..b60c03430cf1 100644
--- a/include/dt-bindings/clock/bcm2835.h
+++ b/include/dt-bindings/clock/bcm2835.h
@@ -58,3 +58,5 @@
58#define BCM2835_CLOCK_DSI1E 48 58#define BCM2835_CLOCK_DSI1E 48
59#define BCM2835_CLOCK_DSI0P 49 59#define BCM2835_CLOCK_DSI0P 49
60#define BCM2835_CLOCK_DSI1P 50 60#define BCM2835_CLOCK_DSI1P 50
61
62#define BCM2711_CLOCK_EMMC2 51