|
@@ -15,6 +15,9 @@
|
|
#include "clk-kona.h"
|
|
#include "clk-kona.h"
|
|
#include "dt-bindings/clock/bcm281xx.h"
|
|
#include "dt-bindings/clock/bcm281xx.h"
|
|
|
|
|
|
|
|
+#define BCM281XX_CCU_COMMON(_name, _ucase_name) \
|
|
|
|
+ KONA_CCU_COMMON(BCM281XX, _name, _ucase_name)
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* These are the bcm281xx CCU device tree "compatible" strings.
|
|
* These are the bcm281xx CCU device tree "compatible" strings.
|
|
* We're stuck with using "bcm11351" in the string because wild
|
|
* We're stuck with using "bcm11351" in the string because wild
|
|
@@ -27,7 +30,7 @@
|
|
#define BCM281XX_DT_MASTER_CCU_COMPAT "brcm,bcm11351-master-ccu"
|
|
#define BCM281XX_DT_MASTER_CCU_COMPAT "brcm,bcm11351-master-ccu"
|
|
#define BCM281XX_DT_SLAVE_CCU_COMPAT "brcm,bcm11351-slave-ccu"
|
|
#define BCM281XX_DT_SLAVE_CCU_COMPAT "brcm,bcm11351-slave-ccu"
|
|
|
|
|
|
-/* Root CCU clocks */
|
|
|
|
|
|
+/* Root CCU */
|
|
|
|
|
|
static struct peri_clk_data frac_1m_data = {
|
|
static struct peri_clk_data frac_1m_data = {
|
|
.gate = HW_SW_GATE(0x214, 16, 0, 1),
|
|
.gate = HW_SW_GATE(0x214, 16, 0, 1),
|
|
@@ -36,7 +39,11 @@ static struct peri_clk_data frac_1m_data = {
|
|
.clocks = CLOCKS("ref_crystal"),
|
|
.clocks = CLOCKS("ref_crystal"),
|
|
};
|
|
};
|
|
|
|
|
|
-/* AON CCU clocks */
|
|
|
|
|
|
+static struct ccu_data root_ccu_data = {
|
|
|
|
+ BCM281XX_CCU_COMMON(root, ROOT),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/* AON CCU */
|
|
|
|
|
|
static struct peri_clk_data hub_timer_data = {
|
|
static struct peri_clk_data hub_timer_data = {
|
|
.gate = HW_SW_GATE(0x0414, 16, 0, 1),
|
|
.gate = HW_SW_GATE(0x0414, 16, 0, 1),
|
|
@@ -65,7 +72,11 @@ static struct peri_clk_data pmu_bsc_var_data = {
|
|
.trig = TRIGGER(0x0a40, 2),
|
|
.trig = TRIGGER(0x0a40, 2),
|
|
};
|
|
};
|
|
|
|
|
|
-/* Hub CCU clocks */
|
|
|
|
|
|
+static struct ccu_data aon_ccu_data = {
|
|
|
|
+ BCM281XX_CCU_COMMON(aon, AON),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/* Hub CCU */
|
|
|
|
|
|
static struct peri_clk_data tmon_1m_data = {
|
|
static struct peri_clk_data tmon_1m_data = {
|
|
.gate = HW_SW_GATE(0x04a4, 18, 2, 3),
|
|
.gate = HW_SW_GATE(0x04a4, 18, 2, 3),
|
|
@@ -75,7 +86,11 @@ static struct peri_clk_data tmon_1m_data = {
|
|
.trig = TRIGGER(0x0e84, 1),
|
|
.trig = TRIGGER(0x0e84, 1),
|
|
};
|
|
};
|
|
|
|
|
|
-/* Master CCU clocks */
|
|
|
|
|
|
+static struct ccu_data hub_ccu_data = {
|
|
|
|
+ BCM281XX_CCU_COMMON(hub, HUB),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/* Master CCU */
|
|
|
|
|
|
static struct peri_clk_data sdio1_data = {
|
|
static struct peri_clk_data sdio1_data = {
|
|
.gate = HW_SW_GATE(0x0358, 18, 2, 3),
|
|
.gate = HW_SW_GATE(0x0358, 18, 2, 3),
|
|
@@ -158,7 +173,11 @@ static struct peri_clk_data hsic2_12m_data = {
|
|
.trig = TRIGGER(0x0afc, 5),
|
|
.trig = TRIGGER(0x0afc, 5),
|
|
};
|
|
};
|
|
|
|
|
|
-/* Slave CCU clocks */
|
|
|
|
|
|
+static struct ccu_data master_ccu_data = {
|
|
|
|
+ BCM281XX_CCU_COMMON(master, MASTER),
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/* Slave CCU */
|
|
|
|
|
|
static struct peri_clk_data uartb_data = {
|
|
static struct peri_clk_data uartb_data = {
|
|
.gate = HW_SW_GATE(0x0400, 18, 2, 3),
|
|
.gate = HW_SW_GATE(0x0400, 18, 2, 3),
|
|
@@ -266,6 +285,10 @@ static struct peri_clk_data pwm_data = {
|
|
.trig = TRIGGER(0x0afc, 15),
|
|
.trig = TRIGGER(0x0afc, 15),
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+static struct ccu_data slave_ccu_data = {
|
|
|
|
+ BCM281XX_CCU_COMMON(slave, SLAVE),
|
|
|
|
+};
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* CCU setup routines
|
|
* CCU setup routines
|
|
*
|
|
*
|
|
@@ -277,107 +300,52 @@ static struct peri_clk_data pwm_data = {
|
|
*/
|
|
*/
|
|
static int __init bcm281xx_root_ccu_clks_setup(struct ccu_data *ccu)
|
|
static int __init bcm281xx_root_ccu_clks_setup(struct ccu_data *ccu)
|
|
{
|
|
{
|
|
- struct clk **clks;
|
|
|
|
- size_t count = BCM281XX_ROOT_CCU_CLOCK_COUNT;
|
|
|
|
-
|
|
|
|
- clks = kzalloc(count * sizeof(*clks), GFP_KERNEL);
|
|
|
|
- if (!clks) {
|
|
|
|
- pr_err("%s: failed to allocate root clocks\n", __func__);
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
- ccu->data.clks = clks;
|
|
|
|
- ccu->data.clk_num = count;
|
|
|
|
-
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_ROOT_CCU_FRAC_1M, frac_1m);
|
|
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_ROOT_CCU_FRAC_1M, frac_1m);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int __init bcm281xx_aon_ccu_clks_setup(struct ccu_data *ccu)
|
|
static int __init bcm281xx_aon_ccu_clks_setup(struct ccu_data *ccu)
|
|
{
|
|
{
|
|
- struct clk **clks;
|
|
|
|
- size_t count = BCM281XX_AON_CCU_CLOCK_COUNT;
|
|
|
|
-
|
|
|
|
- clks = kzalloc(count * sizeof(*clks), GFP_KERNEL);
|
|
|
|
- if (!clks) {
|
|
|
|
- pr_err("%s: failed to allocate aon clocks\n", __func__);
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
- ccu->data.clks = clks;
|
|
|
|
- ccu->data.clk_num = count;
|
|
|
|
-
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_AON_CCU_HUB_TIMER, hub_timer);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_AON_CCU_PMU_BSC, pmu_bsc);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_AON_CCU_PMU_BSC_VAR, pmu_bsc_var);
|
|
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_AON_CCU_HUB_TIMER, hub_timer);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_AON_CCU_PMU_BSC, pmu_bsc);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_AON_CCU_PMU_BSC_VAR, pmu_bsc_var);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int __init bcm281xx_hub_ccu_clks_setup(struct ccu_data *ccu)
|
|
static int __init bcm281xx_hub_ccu_clks_setup(struct ccu_data *ccu)
|
|
{
|
|
{
|
|
- struct clk **clks;
|
|
|
|
- size_t count = BCM281XX_HUB_CCU_CLOCK_COUNT;
|
|
|
|
-
|
|
|
|
- clks = kzalloc(count * sizeof(*clks), GFP_KERNEL);
|
|
|
|
- if (!clks) {
|
|
|
|
- pr_err("%s: failed to allocate hub clocks\n", __func__);
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
- ccu->data.clks = clks;
|
|
|
|
- ccu->data.clk_num = count;
|
|
|
|
-
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_HUB_CCU_TMON_1M, tmon_1m);
|
|
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_HUB_CCU_TMON_1M, tmon_1m);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int __init bcm281xx_master_ccu_clks_setup(struct ccu_data *ccu)
|
|
static int __init bcm281xx_master_ccu_clks_setup(struct ccu_data *ccu)
|
|
{
|
|
{
|
|
- struct clk **clks;
|
|
|
|
- size_t count = BCM281XX_MASTER_CCU_CLOCK_COUNT;
|
|
|
|
-
|
|
|
|
- clks = kzalloc(count * sizeof(*clks), GFP_KERNEL);
|
|
|
|
- if (!clks) {
|
|
|
|
- pr_err("%s: failed to allocate master clocks\n", __func__);
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
- ccu->data.clks = clks;
|
|
|
|
- ccu->data.clk_num = count;
|
|
|
|
-
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_SDIO1, sdio1);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_SDIO2, sdio2);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_SDIO3, sdio3);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_SDIO4, sdio4);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_USB_IC, usb_ic);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_HSIC2_48M, hsic2_48m);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_MASTER_CCU_HSIC2_12M, hsic2_12m);
|
|
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO1, sdio1);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO2, sdio2);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO3, sdio3);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_SDIO4, sdio4);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_USB_IC, usb_ic);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_HSIC2_48M, hsic2_48m);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_MASTER_CCU_HSIC2_12M, hsic2_12m);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int __init bcm281xx_slave_ccu_clks_setup(struct ccu_data *ccu)
|
|
static int __init bcm281xx_slave_ccu_clks_setup(struct ccu_data *ccu)
|
|
{
|
|
{
|
|
- struct clk **clks;
|
|
|
|
- size_t count = BCM281XX_SLAVE_CCU_CLOCK_COUNT;
|
|
|
|
-
|
|
|
|
- clks = kzalloc(count * sizeof(*clks), GFP_KERNEL);
|
|
|
|
- if (!clks) {
|
|
|
|
- pr_err("%s: failed to allocate slave clocks\n", __func__);
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
- ccu->data.clks = clks;
|
|
|
|
- ccu->data.clk_num = count;
|
|
|
|
-
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_UARTB, uartb);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_UARTB2, uartb2);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_UARTB3, uartb3);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_UARTB4, uartb4);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_SSP0, ssp0);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_SSP2, ssp2);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_BSC1, bsc1);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_BSC2, bsc2);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_BSC3, bsc3);
|
|
|
|
- PERI_CLK_SETUP(clks, ccu, BCM281XX_SLAVE_CCU_PWM, pwm);
|
|
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB, uartb);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB2, uartb2);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB3, uartb3);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_UARTB4, uartb4);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_SSP0, ssp0);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_SSP2, ssp2);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_BSC1, bsc1);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_BSC2, bsc2);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_BSC3, bsc3);
|
|
|
|
+ PERI_CLK_SETUP(ccu, BCM281XX_SLAVE_CCU_PWM, pwm);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -386,27 +354,29 @@ static int __init bcm281xx_slave_ccu_clks_setup(struct ccu_data *ccu)
|
|
|
|
|
|
static void __init kona_dt_root_ccu_setup(struct device_node *node)
|
|
static void __init kona_dt_root_ccu_setup(struct device_node *node)
|
|
{
|
|
{
|
|
- kona_dt_ccu_setup(node, bcm281xx_root_ccu_clks_setup);
|
|
|
|
|
|
+ kona_dt_ccu_setup(&root_ccu_data, node, bcm281xx_root_ccu_clks_setup);
|
|
}
|
|
}
|
|
|
|
|
|
static void __init kona_dt_aon_ccu_setup(struct device_node *node)
|
|
static void __init kona_dt_aon_ccu_setup(struct device_node *node)
|
|
{
|
|
{
|
|
- kona_dt_ccu_setup(node, bcm281xx_aon_ccu_clks_setup);
|
|
|
|
|
|
+ kona_dt_ccu_setup(&aon_ccu_data, node, bcm281xx_aon_ccu_clks_setup);
|
|
}
|
|
}
|
|
|
|
|
|
static void __init kona_dt_hub_ccu_setup(struct device_node *node)
|
|
static void __init kona_dt_hub_ccu_setup(struct device_node *node)
|
|
{
|
|
{
|
|
- kona_dt_ccu_setup(node, bcm281xx_hub_ccu_clks_setup);
|
|
|
|
|
|
+ kona_dt_ccu_setup(&hub_ccu_data, node, bcm281xx_hub_ccu_clks_setup);
|
|
}
|
|
}
|
|
|
|
|
|
static void __init kona_dt_master_ccu_setup(struct device_node *node)
|
|
static void __init kona_dt_master_ccu_setup(struct device_node *node)
|
|
{
|
|
{
|
|
- kona_dt_ccu_setup(node, bcm281xx_master_ccu_clks_setup);
|
|
|
|
|
|
+ kona_dt_ccu_setup(&master_ccu_data, node,
|
|
|
|
+ bcm281xx_master_ccu_clks_setup);
|
|
}
|
|
}
|
|
|
|
|
|
static void __init kona_dt_slave_ccu_setup(struct device_node *node)
|
|
static void __init kona_dt_slave_ccu_setup(struct device_node *node)
|
|
{
|
|
{
|
|
- kona_dt_ccu_setup(node, bcm281xx_slave_ccu_clks_setup);
|
|
|
|
|
|
+ kona_dt_ccu_setup(&slave_ccu_data, node,
|
|
|
|
+ bcm281xx_slave_ccu_clks_setup);
|
|
}
|
|
}
|
|
|
|
|
|
CLK_OF_DECLARE(bcm281xx_root_ccu, BCM281XX_DT_ROOT_CCU_COMPAT,
|
|
CLK_OF_DECLARE(bcm281xx_root_ccu, BCM281XX_DT_ROOT_CCU_COMPAT,
|