182b0f4b7SLee Jones /* 282b0f4b7SLee Jones * Clock definitions for u8500 platform. 382b0f4b7SLee Jones * 482b0f4b7SLee Jones * Copyright (C) 2012 ST-Ericsson SA 582b0f4b7SLee Jones * Author: Ulf Hansson <ulf.hansson@linaro.org> 682b0f4b7SLee Jones * 782b0f4b7SLee Jones * License terms: GNU General Public License (GPL) version 2 882b0f4b7SLee Jones */ 982b0f4b7SLee Jones 10dec759d8SLee Jones #include <linux/of.h> 115dc0fe19SLinus Walleij #include <linux/of_address.h> 1282b0f4b7SLee Jones #include <linux/clk-provider.h> 1382b0f4b7SLee Jones #include <linux/mfd/dbx500-prcmu.h> 1482b0f4b7SLee Jones #include "clk.h" 1582b0f4b7SLee Jones 162d080300SLee Jones #define PRCC_NUM_PERIPH_CLUSTERS 6 172d080300SLee Jones #define PRCC_PERIPHS_PER_CLUSTER 32 182d080300SLee Jones 19f9fcb8e8SLee Jones static struct clk *prcmu_clk[PRCMU_NUM_CLKS]; 202d080300SLee Jones static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER]; 2189da2dfaSLee Jones static struct clk *prcc_kclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER]; 22f9fcb8e8SLee Jones 23b4bdc81bSLee Jones #define PRCC_SHOW(clk, base, bit) \ 24b4bdc81bSLee Jones clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] 252d080300SLee Jones #define PRCC_PCLK_STORE(clk, base, bit) \ 262d080300SLee Jones prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk 2789da2dfaSLee Jones #define PRCC_KCLK_STORE(clk, base, bit) \ 2889da2dfaSLee Jones prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk 29b4bdc81bSLee Jones 30c112c1d8SSachin Kamat static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, 31c112c1d8SSachin Kamat void *data) 32b4bdc81bSLee Jones { 33b4bdc81bSLee Jones struct clk **clk_data = data; 34b4bdc81bSLee Jones unsigned int base, bit; 35b4bdc81bSLee Jones 36b4bdc81bSLee Jones if (clkspec->args_count != 2) 37b4bdc81bSLee Jones return ERR_PTR(-EINVAL); 38b4bdc81bSLee Jones 39b4bdc81bSLee Jones base = clkspec->args[0]; 40b4bdc81bSLee Jones bit = clkspec->args[1]; 41b4bdc81bSLee Jones 42b4bdc81bSLee Jones if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) { 43b4bdc81bSLee Jones pr_err("%s: invalid PRCC base %d\n", __func__, base); 44b4bdc81bSLee Jones return ERR_PTR(-EINVAL); 45b4bdc81bSLee Jones } 46b4bdc81bSLee Jones 47b4bdc81bSLee Jones return PRCC_SHOW(clk_data, base, bit); 48b4bdc81bSLee Jones } 49b4bdc81bSLee Jones 505dc0fe19SLinus Walleij /* CLKRST4 is missing making it hard to index things */ 515dc0fe19SLinus Walleij enum clkrst_index { 525dc0fe19SLinus Walleij CLKRST1_INDEX = 0, 535dc0fe19SLinus Walleij CLKRST2_INDEX, 545dc0fe19SLinus Walleij CLKRST3_INDEX, 555dc0fe19SLinus Walleij CLKRST5_INDEX, 565dc0fe19SLinus Walleij CLKRST6_INDEX, 575dc0fe19SLinus Walleij CLKRST_MAX, 585dc0fe19SLinus Walleij }; 595dc0fe19SLinus Walleij 60269f1aacSArnd Bergmann static void u8500_clk_init(struct device_node *np) 6182b0f4b7SLee Jones { 6282b0f4b7SLee Jones struct prcmu_fw_version *fw_version; 63dec759d8SLee Jones struct device_node *child = NULL; 6482b0f4b7SLee Jones const char *sgaclk_parent = NULL; 654e334660SLee Jones struct clk *clk, *rtc_clk, *twd_clk; 665dc0fe19SLinus Walleij u32 bases[CLKRST_MAX]; 675dc0fe19SLinus Walleij int i; 6882b0f4b7SLee Jones 695dc0fe19SLinus Walleij for (i = 0; i < ARRAY_SIZE(bases); i++) { 705dc0fe19SLinus Walleij struct resource r; 715dc0fe19SLinus Walleij 725dc0fe19SLinus Walleij if (of_address_to_resource(np, i, &r)) 735dc0fe19SLinus Walleij /* Not much choice but to continue */ 745dc0fe19SLinus Walleij pr_err("failed to get CLKRST %d base address\n", 755dc0fe19SLinus Walleij i + 1); 765dc0fe19SLinus Walleij bases[i] = r.start; 775dc0fe19SLinus Walleij } 78dec759d8SLee Jones 7982b0f4b7SLee Jones /* Clock sources */ 8082b0f4b7SLee Jones clk = clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0, 8166f4ae77SStephen Boyd CLK_IGNORE_UNUSED); 82f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLSOC0] = clk; 8382b0f4b7SLee Jones 8482b0f4b7SLee Jones clk = clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1, 8566f4ae77SStephen Boyd CLK_IGNORE_UNUSED); 86f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLSOC1] = clk; 8782b0f4b7SLee Jones 8882b0f4b7SLee Jones clk = clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR, 8966f4ae77SStephen Boyd CLK_IGNORE_UNUSED); 90f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLDDR] = clk; 9182b0f4b7SLee Jones 9282b0f4b7SLee Jones /* FIXME: Add sys, ulp and int clocks here. */ 9382b0f4b7SLee Jones 94d625a730SLee Jones rtc_clk = clk_register_fixed_rate(NULL, "rtc32k", "NULL", 9566f4ae77SStephen Boyd CLK_IGNORE_UNUSED, 9682b0f4b7SLee Jones 32768); 9782b0f4b7SLee Jones 9882b0f4b7SLee Jones /* PRCMU clocks */ 9982b0f4b7SLee Jones fw_version = prcmu_get_fw_version(); 10082b0f4b7SLee Jones if (fw_version != NULL) { 10182b0f4b7SLee Jones switch (fw_version->project) { 10282b0f4b7SLee Jones case PRCMU_FW_PROJECT_U8500_C2: 10382b0f4b7SLee Jones case PRCMU_FW_PROJECT_U8520: 10482b0f4b7SLee Jones case PRCMU_FW_PROJECT_U8420: 10582b0f4b7SLee Jones sgaclk_parent = "soc0_pll"; 10682b0f4b7SLee Jones break; 10782b0f4b7SLee Jones default: 10882b0f4b7SLee Jones break; 10982b0f4b7SLee Jones } 11082b0f4b7SLee Jones } 11182b0f4b7SLee Jones 11282b0f4b7SLee Jones if (sgaclk_parent) 11382b0f4b7SLee Jones clk = clk_reg_prcmu_gate("sgclk", sgaclk_parent, 11482b0f4b7SLee Jones PRCMU_SGACLK, 0); 11582b0f4b7SLee Jones else 11666f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("sgclk", NULL, PRCMU_SGACLK, 0); 117f9fcb8e8SLee Jones prcmu_clk[PRCMU_SGACLK] = clk; 11882b0f4b7SLee Jones 11966f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("uartclk", NULL, PRCMU_UARTCLK, 0); 120f9fcb8e8SLee Jones prcmu_clk[PRCMU_UARTCLK] = clk; 12182b0f4b7SLee Jones 12266f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("msp02clk", NULL, PRCMU_MSP02CLK, 0); 123f9fcb8e8SLee Jones prcmu_clk[PRCMU_MSP02CLK] = clk; 12482b0f4b7SLee Jones 12566f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("msp1clk", NULL, PRCMU_MSP1CLK, 0); 126f9fcb8e8SLee Jones prcmu_clk[PRCMU_MSP1CLK] = clk; 12782b0f4b7SLee Jones 12866f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("i2cclk", NULL, PRCMU_I2CCLK, 0); 129f9fcb8e8SLee Jones prcmu_clk[PRCMU_I2CCLK] = clk; 13082b0f4b7SLee Jones 13166f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("slimclk", NULL, PRCMU_SLIMCLK, 0); 132f9fcb8e8SLee Jones prcmu_clk[PRCMU_SLIMCLK] = clk; 13382b0f4b7SLee Jones 13466f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per1clk", NULL, PRCMU_PER1CLK, 0); 135f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER1CLK] = clk; 13682b0f4b7SLee Jones 13766f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per2clk", NULL, PRCMU_PER2CLK, 0); 138f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER2CLK] = clk; 13982b0f4b7SLee Jones 14066f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per3clk", NULL, PRCMU_PER3CLK, 0); 141f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER3CLK] = clk; 14282b0f4b7SLee Jones 14366f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per5clk", NULL, PRCMU_PER5CLK, 0); 144f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER5CLK] = clk; 14582b0f4b7SLee Jones 14666f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per6clk", NULL, PRCMU_PER6CLK, 0); 147f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER6CLK] = clk; 14882b0f4b7SLee Jones 14966f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per7clk", NULL, PRCMU_PER7CLK, 0); 150f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER7CLK] = clk; 15182b0f4b7SLee Jones 15282b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("lcdclk", NULL, PRCMU_LCDCLK, 0, 15366f4ae77SStephen Boyd CLK_SET_RATE_GATE); 154f9fcb8e8SLee Jones prcmu_clk[PRCMU_LCDCLK] = clk; 15582b0f4b7SLee Jones 15666f4ae77SStephen Boyd clk = clk_reg_prcmu_opp_gate("bmlclk", NULL, PRCMU_BMLCLK, 0); 157f9fcb8e8SLee Jones prcmu_clk[PRCMU_BMLCLK] = clk; 15882b0f4b7SLee Jones 15982b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("hsitxclk", NULL, PRCMU_HSITXCLK, 0, 16066f4ae77SStephen Boyd CLK_SET_RATE_GATE); 161f9fcb8e8SLee Jones prcmu_clk[PRCMU_HSITXCLK] = clk; 16282b0f4b7SLee Jones 16382b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("hsirxclk", NULL, PRCMU_HSIRXCLK, 0, 16466f4ae77SStephen Boyd CLK_SET_RATE_GATE); 165f9fcb8e8SLee Jones prcmu_clk[PRCMU_HSIRXCLK] = clk; 16682b0f4b7SLee Jones 16782b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("hdmiclk", NULL, PRCMU_HDMICLK, 0, 16866f4ae77SStephen Boyd CLK_SET_RATE_GATE); 169f9fcb8e8SLee Jones prcmu_clk[PRCMU_HDMICLK] = clk; 17082b0f4b7SLee Jones 17166f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("apeatclk", NULL, PRCMU_APEATCLK, 0); 172f9fcb8e8SLee Jones prcmu_clk[PRCMU_APEATCLK] = clk; 17382b0f4b7SLee Jones 174a6ae41b5SLinus Walleij clk = clk_reg_prcmu_scalable("apetraceclk", NULL, PRCMU_APETRACECLK, 0, 17566f4ae77SStephen Boyd CLK_SET_RATE_GATE); 176f9fcb8e8SLee Jones prcmu_clk[PRCMU_APETRACECLK] = clk; 17782b0f4b7SLee Jones 17866f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("mcdeclk", NULL, PRCMU_MCDECLK, 0); 179f9fcb8e8SLee Jones prcmu_clk[PRCMU_MCDECLK] = clk; 18082b0f4b7SLee Jones 18166f4ae77SStephen Boyd clk = clk_reg_prcmu_opp_gate("ipi2cclk", NULL, PRCMU_IPI2CCLK, 0); 182f9fcb8e8SLee Jones prcmu_clk[PRCMU_IPI2CCLK] = clk; 18382b0f4b7SLee Jones 18466f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("dsialtclk", NULL, PRCMU_DSIALTCLK, 0); 185f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSIALTCLK] = clk; 18682b0f4b7SLee Jones 18766f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("dmaclk", NULL, PRCMU_DMACLK, 0); 188f9fcb8e8SLee Jones prcmu_clk[PRCMU_DMACLK] = clk; 18982b0f4b7SLee Jones 19066f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("b2r2clk", NULL, PRCMU_B2R2CLK, 0); 191f9fcb8e8SLee Jones prcmu_clk[PRCMU_B2R2CLK] = clk; 19282b0f4b7SLee Jones 19382b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("tvclk", NULL, PRCMU_TVCLK, 0, 19466f4ae77SStephen Boyd CLK_SET_RATE_GATE); 195f9fcb8e8SLee Jones prcmu_clk[PRCMU_TVCLK] = clk; 19682b0f4b7SLee Jones 19766f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("sspclk", NULL, PRCMU_SSPCLK, 0); 198f9fcb8e8SLee Jones prcmu_clk[PRCMU_SSPCLK] = clk; 19982b0f4b7SLee Jones 20066f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("rngclk", NULL, PRCMU_RNGCLK, 0); 201f9fcb8e8SLee Jones prcmu_clk[PRCMU_RNGCLK] = clk; 20282b0f4b7SLee Jones 20366f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("uiccclk", NULL, PRCMU_UICCCLK, 0); 204f9fcb8e8SLee Jones prcmu_clk[PRCMU_UICCCLK] = clk; 20582b0f4b7SLee Jones 20666f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("timclk", NULL, PRCMU_TIMCLK, 0); 207f9fcb8e8SLee Jones prcmu_clk[PRCMU_TIMCLK] = clk; 20882b0f4b7SLee Jones 209*689a318cSLinus Walleij clk = clk_reg_prcmu_gate("ab8500_sysclk", NULL, PRCMU_SYSCLK, 0); 210*689a318cSLinus Walleij prcmu_clk[PRCMU_SYSCLK] = clk; 211*689a318cSLinus Walleij 21282b0f4b7SLee Jones clk = clk_reg_prcmu_opp_volt_scalable("sdmmcclk", NULL, PRCMU_SDMMCCLK, 21366f4ae77SStephen Boyd 100000000, CLK_SET_RATE_GATE); 214f9fcb8e8SLee Jones prcmu_clk[PRCMU_SDMMCCLK] = clk; 21582b0f4b7SLee Jones 21682b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi_pll", "hdmiclk", 21782b0f4b7SLee Jones PRCMU_PLLDSI, 0, CLK_SET_RATE_GATE); 218f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLDSI] = clk; 21982b0f4b7SLee Jones 22082b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi0clk", "dsi_pll", 22182b0f4b7SLee Jones PRCMU_DSI0CLK, 0, CLK_SET_RATE_GATE); 222f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI0CLK] = clk; 22382b0f4b7SLee Jones 22482b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi1clk", "dsi_pll", 22582b0f4b7SLee Jones PRCMU_DSI1CLK, 0, CLK_SET_RATE_GATE); 226f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI1CLK] = clk; 22782b0f4b7SLee Jones 22882b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi0escclk", "tvclk", 22982b0f4b7SLee Jones PRCMU_DSI0ESCCLK, 0, CLK_SET_RATE_GATE); 230f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI0ESCCLK] = clk; 23182b0f4b7SLee Jones 23282b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi1escclk", "tvclk", 23382b0f4b7SLee Jones PRCMU_DSI1ESCCLK, 0, CLK_SET_RATE_GATE); 234f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI1ESCCLK] = clk; 23582b0f4b7SLee Jones 23682b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi2escclk", "tvclk", 23782b0f4b7SLee Jones PRCMU_DSI2ESCCLK, 0, CLK_SET_RATE_GATE); 238f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI2ESCCLK] = clk; 23982b0f4b7SLee Jones 24082b0f4b7SLee Jones clk = clk_reg_prcmu_scalable_rate("armss", NULL, 24166f4ae77SStephen Boyd PRCMU_ARMSS, 0, CLK_IGNORE_UNUSED); 242257015a2SLee Jones prcmu_clk[PRCMU_ARMSS] = clk; 24382b0f4b7SLee Jones 2444e334660SLee Jones twd_clk = clk_register_fixed_factor(NULL, "smp_twd", "armss", 24582b0f4b7SLee Jones CLK_IGNORE_UNUSED, 1, 2); 24682b0f4b7SLee Jones 24782b0f4b7SLee Jones /* 24882b0f4b7SLee Jones * FIXME: Add special handled PRCMU clocks here: 24982b0f4b7SLee Jones * 1. clkout0yuv, use PRCMU as parent + need regulator + pinctrl. 25082b0f4b7SLee Jones * 2. ab9540_clkout1yuv, see clkout0yuv 25182b0f4b7SLee Jones */ 25282b0f4b7SLee Jones 25382b0f4b7SLee Jones /* PRCC P-clocks */ 2545dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases[CLKRST1_INDEX], 25582b0f4b7SLee Jones BIT(0), 0); 2562d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 0); 25782b0f4b7SLee Jones 2585dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases[CLKRST1_INDEX], 25982b0f4b7SLee Jones BIT(1), 0); 2602d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 1); 26182b0f4b7SLee Jones 2625dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases[CLKRST1_INDEX], 26382b0f4b7SLee Jones BIT(2), 0); 2642d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 2); 26582b0f4b7SLee Jones 2665dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases[CLKRST1_INDEX], 26782b0f4b7SLee Jones BIT(3), 0); 2682d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 3); 26982b0f4b7SLee Jones 2705dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases[CLKRST1_INDEX], 27182b0f4b7SLee Jones BIT(4), 0); 2722d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 4); 27382b0f4b7SLee Jones 2745dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases[CLKRST1_INDEX], 27582b0f4b7SLee Jones BIT(5), 0); 2762d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 5); 27782b0f4b7SLee Jones 2785dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases[CLKRST1_INDEX], 27982b0f4b7SLee Jones BIT(6), 0); 2802d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 6); 28182b0f4b7SLee Jones 2825dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases[CLKRST1_INDEX], 28382b0f4b7SLee Jones BIT(7), 0); 2842d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 7); 28582b0f4b7SLee Jones 2865dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases[CLKRST1_INDEX], 28782b0f4b7SLee Jones BIT(8), 0); 2882d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 8); 28982b0f4b7SLee Jones 2905dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases[CLKRST1_INDEX], 29182b0f4b7SLee Jones BIT(9), 0); 2922d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 9); 29382b0f4b7SLee Jones 2945dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases[CLKRST1_INDEX], 29582b0f4b7SLee Jones BIT(10), 0); 2962d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 10); 29782b0f4b7SLee Jones 2985dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases[CLKRST1_INDEX], 29982b0f4b7SLee Jones BIT(11), 0); 3002d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 11); 30182b0f4b7SLee Jones 3025dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases[CLKRST2_INDEX], 30382b0f4b7SLee Jones BIT(0), 0); 3042d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 0); 30582b0f4b7SLee Jones 3065dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases[CLKRST2_INDEX], 30782b0f4b7SLee Jones BIT(1), 0); 3082d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 1); 30982b0f4b7SLee Jones 3105dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases[CLKRST2_INDEX], 31182b0f4b7SLee Jones BIT(2), 0); 3122d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 2); 31382b0f4b7SLee Jones 3145dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases[CLKRST2_INDEX], 31582b0f4b7SLee Jones BIT(3), 0); 3162d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 3); 31782b0f4b7SLee Jones 3185dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases[CLKRST2_INDEX], 31982b0f4b7SLee Jones BIT(4), 0); 3202d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 4); 32182b0f4b7SLee Jones 3225dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases[CLKRST2_INDEX], 32382b0f4b7SLee Jones BIT(5), 0); 3242d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 5); 32582b0f4b7SLee Jones 3265dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases[CLKRST2_INDEX], 32782b0f4b7SLee Jones BIT(6), 0); 3282d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 6); 32982b0f4b7SLee Jones 3305dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases[CLKRST2_INDEX], 33182b0f4b7SLee Jones BIT(7), 0); 3322d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 7); 33382b0f4b7SLee Jones 3345dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases[CLKRST2_INDEX], 33582b0f4b7SLee Jones BIT(8), 0); 3362d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 8); 33782b0f4b7SLee Jones 3385dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases[CLKRST2_INDEX], 33982b0f4b7SLee Jones BIT(9), 0); 3402d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 9); 34182b0f4b7SLee Jones 3425dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases[CLKRST2_INDEX], 34382b0f4b7SLee Jones BIT(10), 0); 3442d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 10); 34582b0f4b7SLee Jones 3465dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases[CLKRST2_INDEX], 34782b0f4b7SLee Jones BIT(11), 0); 348f5ff9a11SLinus Walleij PRCC_PCLK_STORE(clk, 2, 11); 34982b0f4b7SLee Jones 3505dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases[CLKRST2_INDEX], 35182b0f4b7SLee Jones BIT(12), 0); 3522d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 12); 35382b0f4b7SLee Jones 3545dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases[CLKRST3_INDEX], 35582b0f4b7SLee Jones BIT(0), 0); 3562d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 0); 35782b0f4b7SLee Jones 3585dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases[CLKRST3_INDEX], 35982b0f4b7SLee Jones BIT(1), 0); 3602d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 1); 36182b0f4b7SLee Jones 3625dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases[CLKRST3_INDEX], 36382b0f4b7SLee Jones BIT(2), 0); 3642d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 2); 36582b0f4b7SLee Jones 3665dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases[CLKRST3_INDEX], 36782b0f4b7SLee Jones BIT(3), 0); 3682d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 3); 36982b0f4b7SLee Jones 3705dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases[CLKRST3_INDEX], 37182b0f4b7SLee Jones BIT(4), 0); 3722d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 4); 37382b0f4b7SLee Jones 3745dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases[CLKRST3_INDEX], 37582b0f4b7SLee Jones BIT(5), 0); 3762d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 5); 37782b0f4b7SLee Jones 3785dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases[CLKRST3_INDEX], 37982b0f4b7SLee Jones BIT(6), 0); 3802d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 6); 38182b0f4b7SLee Jones 3825dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases[CLKRST3_INDEX], 38382b0f4b7SLee Jones BIT(7), 0); 3842d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 7); 38582b0f4b7SLee Jones 3865dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases[CLKRST3_INDEX], 38782b0f4b7SLee Jones BIT(8), 0); 3882d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 8); 38982b0f4b7SLee Jones 3905dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases[CLKRST5_INDEX], 39182b0f4b7SLee Jones BIT(0), 0); 3922d080300SLee Jones PRCC_PCLK_STORE(clk, 5, 0); 39382b0f4b7SLee Jones 3945dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases[CLKRST5_INDEX], 39582b0f4b7SLee Jones BIT(1), 0); 3962d080300SLee Jones PRCC_PCLK_STORE(clk, 5, 1); 39782b0f4b7SLee Jones 3985dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases[CLKRST6_INDEX], 39982b0f4b7SLee Jones BIT(0), 0); 4002d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 0); 40182b0f4b7SLee Jones 4025dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases[CLKRST6_INDEX], 40382b0f4b7SLee Jones BIT(1), 0); 4042d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 1); 40582b0f4b7SLee Jones 4065dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases[CLKRST6_INDEX], 40782b0f4b7SLee Jones BIT(2), 0); 4082d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 2); 40982b0f4b7SLee Jones 4105dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases[CLKRST6_INDEX], 41182b0f4b7SLee Jones BIT(3), 0); 4122d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 3); 41382b0f4b7SLee Jones 4145dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases[CLKRST6_INDEX], 41582b0f4b7SLee Jones BIT(4), 0); 4162d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 4); 41782b0f4b7SLee Jones 4185dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases[CLKRST6_INDEX], 41982b0f4b7SLee Jones BIT(5), 0); 4202d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 5); 42182b0f4b7SLee Jones 4225dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases[CLKRST6_INDEX], 42382b0f4b7SLee Jones BIT(6), 0); 4242d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 6); 42582b0f4b7SLee Jones 4265dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases[CLKRST6_INDEX], 42782b0f4b7SLee Jones BIT(7), 0); 4282d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 7); 42982b0f4b7SLee Jones 43082b0f4b7SLee Jones /* PRCC K-clocks 43182b0f4b7SLee Jones * 43282b0f4b7SLee Jones * FIXME: Some drivers requires PERPIH[n| to be automatically enabled 43382b0f4b7SLee Jones * by enabling just the K-clock, even if it is not a valid parent to 43482b0f4b7SLee Jones * the K-clock. Until drivers get fixed we might need some kind of 43582b0f4b7SLee Jones * "parent muxed join". 43682b0f4b7SLee Jones */ 43782b0f4b7SLee Jones 43882b0f4b7SLee Jones /* Periph1 */ 43982b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk", 4405dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(0), CLK_SET_RATE_GATE); 44189da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 0); 44282b0f4b7SLee Jones 44382b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk", 4445dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(1), CLK_SET_RATE_GATE); 44589da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 1); 44682b0f4b7SLee Jones 44782b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk", 4485dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(2), CLK_SET_RATE_GATE); 44989da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 2); 45082b0f4b7SLee Jones 45182b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk", 4525dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(3), CLK_SET_RATE_GATE); 45389da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 3); 45482b0f4b7SLee Jones 45582b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk", 4565dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(4), CLK_SET_RATE_GATE); 45789da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 4); 45882b0f4b7SLee Jones 45982b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk", 4605dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(5), CLK_SET_RATE_GATE); 46189da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 5); 46282b0f4b7SLee Jones 46382b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk", 4645dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(6), CLK_SET_RATE_GATE); 46589da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 6); 46682b0f4b7SLee Jones 46782b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk", 4685dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(8), CLK_SET_RATE_GATE); 46989da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 8); 47082b0f4b7SLee Jones 47182b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk", 4725dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(9), CLK_SET_RATE_GATE); 47389da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 9); 47482b0f4b7SLee Jones 47582b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk", 4765dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(10), CLK_SET_RATE_GATE); 47789da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 10); 47882b0f4b7SLee Jones 47982b0f4b7SLee Jones /* Periph2 */ 48082b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk", 4815dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(0), CLK_SET_RATE_GATE); 48289da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 0); 48382b0f4b7SLee Jones 48482b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk", 4855dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(2), CLK_SET_RATE_GATE); 48689da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 2); 48782b0f4b7SLee Jones 48882b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk", 4895dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(3), CLK_SET_RATE_GATE); 49089da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 3); 49182b0f4b7SLee Jones 49282b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk", 4935dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(4), CLK_SET_RATE_GATE); 49489da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 4); 49582b0f4b7SLee Jones 49682b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk", 4975dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(5), CLK_SET_RATE_GATE); 49889da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 5); 49982b0f4b7SLee Jones 50082b0f4b7SLee Jones /* Note that rate is received from parent. */ 50182b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk", 5025dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(6), 50382b0f4b7SLee Jones CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT); 50489da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 6); 50589da2dfaSLee Jones 50682b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk", 5075dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(7), 50882b0f4b7SLee Jones CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT); 50989da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 7); 51082b0f4b7SLee Jones 51182b0f4b7SLee Jones /* Periph3 */ 51282b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk", 5135dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(1), CLK_SET_RATE_GATE); 51489da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 1); 51582b0f4b7SLee Jones 51682b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk", 5175dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(2), CLK_SET_RATE_GATE); 51889da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 2); 51982b0f4b7SLee Jones 52082b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk", 5215dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(3), CLK_SET_RATE_GATE); 52289da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 3); 52382b0f4b7SLee Jones 52482b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk", 5255dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(4), CLK_SET_RATE_GATE); 52689da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 4); 52782b0f4b7SLee Jones 52882b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k", 5295dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(5), CLK_SET_RATE_GATE); 53089da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 5); 53182b0f4b7SLee Jones 53282b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk", 5335dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(6), CLK_SET_RATE_GATE); 53489da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 6); 53582b0f4b7SLee Jones 53682b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk", 5375dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(7), CLK_SET_RATE_GATE); 53889da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 7); 53982b0f4b7SLee Jones 54082b0f4b7SLee Jones /* Periph6 */ 54182b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk", 5425dc0fe19SLinus Walleij bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE); 54389da2dfaSLee Jones PRCC_KCLK_STORE(clk, 6, 0); 544dec759d8SLee Jones 545dec759d8SLee Jones for_each_child_of_node(np, child) { 546f9fcb8e8SLee Jones static struct clk_onecell_data clk_data; 547f9fcb8e8SLee Jones 548f9fcb8e8SLee Jones if (!of_node_cmp(child->name, "prcmu-clock")) { 549f9fcb8e8SLee Jones clk_data.clks = prcmu_clk; 550f9fcb8e8SLee Jones clk_data.clk_num = ARRAY_SIZE(prcmu_clk); 551f9fcb8e8SLee Jones of_clk_add_provider(child, of_clk_src_onecell_get, &clk_data); 552f9fcb8e8SLee Jones } 5532d080300SLee Jones if (!of_node_cmp(child->name, "prcc-periph-clock")) 5542d080300SLee Jones of_clk_add_provider(child, ux500_twocell_get, prcc_pclk); 55589da2dfaSLee Jones 55689da2dfaSLee Jones if (!of_node_cmp(child->name, "prcc-kernel-clock")) 55789da2dfaSLee Jones of_clk_add_provider(child, ux500_twocell_get, prcc_kclk); 558d625a730SLee Jones 559d625a730SLee Jones if (!of_node_cmp(child->name, "rtc32k-clock")) 560d625a730SLee Jones of_clk_add_provider(child, of_clk_src_simple_get, rtc_clk); 5614e334660SLee Jones 5624e334660SLee Jones if (!of_node_cmp(child->name, "smp-twd-clock")) 5634e334660SLee Jones of_clk_add_provider(child, of_clk_src_simple_get, twd_clk); 564dec759d8SLee Jones } 56582b0f4b7SLee Jones } 566269f1aacSArnd Bergmann CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init); 567