1af873fceSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 282b0f4b7SLee Jones /* 382b0f4b7SLee Jones * Clock definitions for u8500 platform. 482b0f4b7SLee Jones * 582b0f4b7SLee Jones * Copyright (C) 2012 ST-Ericsson SA 682b0f4b7SLee Jones * Author: Ulf Hansson <ulf.hansson@linaro.org> 782b0f4b7SLee Jones */ 882b0f4b7SLee Jones 9dec759d8SLee Jones #include <linux/of.h> 105dc0fe19SLinus Walleij #include <linux/of_address.h> 1182b0f4b7SLee Jones #include <linux/clk-provider.h> 1282b0f4b7SLee Jones #include <linux/mfd/dbx500-prcmu.h> 1382b0f4b7SLee Jones #include "clk.h" 1482b0f4b7SLee Jones 152d080300SLee Jones #define PRCC_NUM_PERIPH_CLUSTERS 6 162d080300SLee Jones #define PRCC_PERIPHS_PER_CLUSTER 32 172d080300SLee Jones 18f9fcb8e8SLee Jones static struct clk *prcmu_clk[PRCMU_NUM_CLKS]; 192d080300SLee Jones static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER]; 2089da2dfaSLee Jones static struct clk *prcc_kclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER]; 21f9fcb8e8SLee Jones 22b4bdc81bSLee Jones #define PRCC_SHOW(clk, base, bit) \ 23b4bdc81bSLee Jones clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] 242d080300SLee Jones #define PRCC_PCLK_STORE(clk, base, bit) \ 252d080300SLee Jones prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk 2689da2dfaSLee Jones #define PRCC_KCLK_STORE(clk, base, bit) \ 2789da2dfaSLee Jones prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk 28b4bdc81bSLee Jones 29c112c1d8SSachin Kamat static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec, 30c112c1d8SSachin Kamat void *data) 31b4bdc81bSLee Jones { 32b4bdc81bSLee Jones struct clk **clk_data = data; 33b4bdc81bSLee Jones unsigned int base, bit; 34b4bdc81bSLee Jones 35b4bdc81bSLee Jones if (clkspec->args_count != 2) 36b4bdc81bSLee Jones return ERR_PTR(-EINVAL); 37b4bdc81bSLee Jones 38b4bdc81bSLee Jones base = clkspec->args[0]; 39b4bdc81bSLee Jones bit = clkspec->args[1]; 40b4bdc81bSLee Jones 41b4bdc81bSLee Jones if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) { 42b4bdc81bSLee Jones pr_err("%s: invalid PRCC base %d\n", __func__, base); 43b4bdc81bSLee Jones return ERR_PTR(-EINVAL); 44b4bdc81bSLee Jones } 45b4bdc81bSLee Jones 46b4bdc81bSLee Jones return PRCC_SHOW(clk_data, base, bit); 47b4bdc81bSLee Jones } 48b4bdc81bSLee Jones 495dc0fe19SLinus Walleij /* CLKRST4 is missing making it hard to index things */ 505dc0fe19SLinus Walleij enum clkrst_index { 515dc0fe19SLinus Walleij CLKRST1_INDEX = 0, 525dc0fe19SLinus Walleij CLKRST2_INDEX, 535dc0fe19SLinus Walleij CLKRST3_INDEX, 545dc0fe19SLinus Walleij CLKRST5_INDEX, 555dc0fe19SLinus Walleij CLKRST6_INDEX, 565dc0fe19SLinus Walleij CLKRST_MAX, 575dc0fe19SLinus Walleij }; 585dc0fe19SLinus Walleij 59269f1aacSArnd Bergmann static void u8500_clk_init(struct device_node *np) 6082b0f4b7SLee Jones { 6182b0f4b7SLee Jones struct prcmu_fw_version *fw_version; 62dec759d8SLee Jones struct device_node *child = NULL; 6382b0f4b7SLee Jones const char *sgaclk_parent = NULL; 644e334660SLee Jones struct clk *clk, *rtc_clk, *twd_clk; 655dc0fe19SLinus Walleij u32 bases[CLKRST_MAX]; 665dc0fe19SLinus Walleij int i; 6782b0f4b7SLee Jones 685dc0fe19SLinus Walleij for (i = 0; i < ARRAY_SIZE(bases); i++) { 695dc0fe19SLinus Walleij struct resource r; 705dc0fe19SLinus Walleij 715dc0fe19SLinus Walleij if (of_address_to_resource(np, i, &r)) 725dc0fe19SLinus Walleij /* Not much choice but to continue */ 735dc0fe19SLinus Walleij pr_err("failed to get CLKRST %d base address\n", 745dc0fe19SLinus Walleij i + 1); 755dc0fe19SLinus Walleij bases[i] = r.start; 765dc0fe19SLinus Walleij } 77dec759d8SLee Jones 7882b0f4b7SLee Jones /* Clock sources */ 7982b0f4b7SLee Jones clk = clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0, 8066f4ae77SStephen Boyd CLK_IGNORE_UNUSED); 81f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLSOC0] = clk; 8282b0f4b7SLee Jones 8382b0f4b7SLee Jones clk = clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1, 8466f4ae77SStephen Boyd CLK_IGNORE_UNUSED); 85f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLSOC1] = clk; 8682b0f4b7SLee Jones 8782b0f4b7SLee Jones clk = clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR, 8866f4ae77SStephen Boyd CLK_IGNORE_UNUSED); 89f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLDDR] = clk; 9082b0f4b7SLee Jones 9182b0f4b7SLee Jones /* FIXME: Add sys, ulp and int clocks here. */ 9282b0f4b7SLee Jones 93d625a730SLee Jones rtc_clk = clk_register_fixed_rate(NULL, "rtc32k", "NULL", 9466f4ae77SStephen Boyd CLK_IGNORE_UNUSED, 9582b0f4b7SLee Jones 32768); 9682b0f4b7SLee Jones 9782b0f4b7SLee Jones /* PRCMU clocks */ 9882b0f4b7SLee Jones fw_version = prcmu_get_fw_version(); 9982b0f4b7SLee Jones if (fw_version != NULL) { 10082b0f4b7SLee Jones switch (fw_version->project) { 10182b0f4b7SLee Jones case PRCMU_FW_PROJECT_U8500_C2: 102*9050ad81SLinus Walleij case PRCMU_FW_PROJECT_U8500_SSG1: 10382b0f4b7SLee Jones case PRCMU_FW_PROJECT_U8520: 10482b0f4b7SLee Jones case PRCMU_FW_PROJECT_U8420: 105248fdcc7SLinus Walleij case PRCMU_FW_PROJECT_U8420_SYSCLK: 106*9050ad81SLinus Walleij case PRCMU_FW_PROJECT_U8500_SSG2: 10782b0f4b7SLee Jones sgaclk_parent = "soc0_pll"; 10882b0f4b7SLee Jones break; 10982b0f4b7SLee Jones default: 11082b0f4b7SLee Jones break; 11182b0f4b7SLee Jones } 11282b0f4b7SLee Jones } 11382b0f4b7SLee Jones 11482b0f4b7SLee Jones if (sgaclk_parent) 11582b0f4b7SLee Jones clk = clk_reg_prcmu_gate("sgclk", sgaclk_parent, 11682b0f4b7SLee Jones PRCMU_SGACLK, 0); 11782b0f4b7SLee Jones else 11866f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("sgclk", NULL, PRCMU_SGACLK, 0); 119f9fcb8e8SLee Jones prcmu_clk[PRCMU_SGACLK] = clk; 12082b0f4b7SLee Jones 12166f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("uartclk", NULL, PRCMU_UARTCLK, 0); 122f9fcb8e8SLee Jones prcmu_clk[PRCMU_UARTCLK] = clk; 12382b0f4b7SLee Jones 12466f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("msp02clk", NULL, PRCMU_MSP02CLK, 0); 125f9fcb8e8SLee Jones prcmu_clk[PRCMU_MSP02CLK] = clk; 12682b0f4b7SLee Jones 12766f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("msp1clk", NULL, PRCMU_MSP1CLK, 0); 128f9fcb8e8SLee Jones prcmu_clk[PRCMU_MSP1CLK] = clk; 12982b0f4b7SLee Jones 13066f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("i2cclk", NULL, PRCMU_I2CCLK, 0); 131f9fcb8e8SLee Jones prcmu_clk[PRCMU_I2CCLK] = clk; 13282b0f4b7SLee Jones 13366f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("slimclk", NULL, PRCMU_SLIMCLK, 0); 134f9fcb8e8SLee Jones prcmu_clk[PRCMU_SLIMCLK] = clk; 13582b0f4b7SLee Jones 13666f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per1clk", NULL, PRCMU_PER1CLK, 0); 137f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER1CLK] = clk; 13882b0f4b7SLee Jones 13966f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per2clk", NULL, PRCMU_PER2CLK, 0); 140f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER2CLK] = clk; 14182b0f4b7SLee Jones 14266f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per3clk", NULL, PRCMU_PER3CLK, 0); 143f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER3CLK] = clk; 14482b0f4b7SLee Jones 14566f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per5clk", NULL, PRCMU_PER5CLK, 0); 146f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER5CLK] = clk; 14782b0f4b7SLee Jones 14866f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per6clk", NULL, PRCMU_PER6CLK, 0); 149f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER6CLK] = clk; 15082b0f4b7SLee Jones 15166f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("per7clk", NULL, PRCMU_PER7CLK, 0); 152f9fcb8e8SLee Jones prcmu_clk[PRCMU_PER7CLK] = clk; 15382b0f4b7SLee Jones 15482b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("lcdclk", NULL, PRCMU_LCDCLK, 0, 15566f4ae77SStephen Boyd CLK_SET_RATE_GATE); 156f9fcb8e8SLee Jones prcmu_clk[PRCMU_LCDCLK] = clk; 15782b0f4b7SLee Jones 15866f4ae77SStephen Boyd clk = clk_reg_prcmu_opp_gate("bmlclk", NULL, PRCMU_BMLCLK, 0); 159f9fcb8e8SLee Jones prcmu_clk[PRCMU_BMLCLK] = clk; 16082b0f4b7SLee Jones 16182b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("hsitxclk", NULL, PRCMU_HSITXCLK, 0, 16266f4ae77SStephen Boyd CLK_SET_RATE_GATE); 163f9fcb8e8SLee Jones prcmu_clk[PRCMU_HSITXCLK] = clk; 16482b0f4b7SLee Jones 16582b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("hsirxclk", NULL, PRCMU_HSIRXCLK, 0, 16666f4ae77SStephen Boyd CLK_SET_RATE_GATE); 167f9fcb8e8SLee Jones prcmu_clk[PRCMU_HSIRXCLK] = clk; 16882b0f4b7SLee Jones 16982b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("hdmiclk", NULL, PRCMU_HDMICLK, 0, 17066f4ae77SStephen Boyd CLK_SET_RATE_GATE); 171f9fcb8e8SLee Jones prcmu_clk[PRCMU_HDMICLK] = clk; 17282b0f4b7SLee Jones 17366f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("apeatclk", NULL, PRCMU_APEATCLK, 0); 174f9fcb8e8SLee Jones prcmu_clk[PRCMU_APEATCLK] = clk; 17582b0f4b7SLee Jones 176a6ae41b5SLinus Walleij clk = clk_reg_prcmu_scalable("apetraceclk", NULL, PRCMU_APETRACECLK, 0, 17766f4ae77SStephen Boyd CLK_SET_RATE_GATE); 178f9fcb8e8SLee Jones prcmu_clk[PRCMU_APETRACECLK] = clk; 17982b0f4b7SLee Jones 18066f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("mcdeclk", NULL, PRCMU_MCDECLK, 0); 181f9fcb8e8SLee Jones prcmu_clk[PRCMU_MCDECLK] = clk; 18282b0f4b7SLee Jones 18366f4ae77SStephen Boyd clk = clk_reg_prcmu_opp_gate("ipi2cclk", NULL, PRCMU_IPI2CCLK, 0); 184f9fcb8e8SLee Jones prcmu_clk[PRCMU_IPI2CCLK] = clk; 18582b0f4b7SLee Jones 18666f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("dsialtclk", NULL, PRCMU_DSIALTCLK, 0); 187f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSIALTCLK] = clk; 18882b0f4b7SLee Jones 18966f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("dmaclk", NULL, PRCMU_DMACLK, 0); 190f9fcb8e8SLee Jones prcmu_clk[PRCMU_DMACLK] = clk; 19182b0f4b7SLee Jones 19266f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("b2r2clk", NULL, PRCMU_B2R2CLK, 0); 193f9fcb8e8SLee Jones prcmu_clk[PRCMU_B2R2CLK] = clk; 19482b0f4b7SLee Jones 19582b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("tvclk", NULL, PRCMU_TVCLK, 0, 19666f4ae77SStephen Boyd CLK_SET_RATE_GATE); 197f9fcb8e8SLee Jones prcmu_clk[PRCMU_TVCLK] = clk; 19882b0f4b7SLee Jones 19966f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("sspclk", NULL, PRCMU_SSPCLK, 0); 200f9fcb8e8SLee Jones prcmu_clk[PRCMU_SSPCLK] = clk; 20182b0f4b7SLee Jones 20266f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("rngclk", NULL, PRCMU_RNGCLK, 0); 203f9fcb8e8SLee Jones prcmu_clk[PRCMU_RNGCLK] = clk; 20482b0f4b7SLee Jones 20566f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("uiccclk", NULL, PRCMU_UICCCLK, 0); 206f9fcb8e8SLee Jones prcmu_clk[PRCMU_UICCCLK] = clk; 20782b0f4b7SLee Jones 20866f4ae77SStephen Boyd clk = clk_reg_prcmu_gate("timclk", NULL, PRCMU_TIMCLK, 0); 209f9fcb8e8SLee Jones prcmu_clk[PRCMU_TIMCLK] = clk; 21082b0f4b7SLee Jones 211689a318cSLinus Walleij clk = clk_reg_prcmu_gate("ab8500_sysclk", NULL, PRCMU_SYSCLK, 0); 212689a318cSLinus Walleij prcmu_clk[PRCMU_SYSCLK] = clk; 213689a318cSLinus Walleij 21482b0f4b7SLee Jones clk = clk_reg_prcmu_opp_volt_scalable("sdmmcclk", NULL, PRCMU_SDMMCCLK, 21566f4ae77SStephen Boyd 100000000, CLK_SET_RATE_GATE); 216f9fcb8e8SLee Jones prcmu_clk[PRCMU_SDMMCCLK] = clk; 21782b0f4b7SLee Jones 21882b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi_pll", "hdmiclk", 21982b0f4b7SLee Jones PRCMU_PLLDSI, 0, CLK_SET_RATE_GATE); 220f9fcb8e8SLee Jones prcmu_clk[PRCMU_PLLDSI] = clk; 22182b0f4b7SLee Jones 22282b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi0clk", "dsi_pll", 22382b0f4b7SLee Jones PRCMU_DSI0CLK, 0, CLK_SET_RATE_GATE); 224f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI0CLK] = clk; 22582b0f4b7SLee Jones 22682b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi1clk", "dsi_pll", 22782b0f4b7SLee Jones PRCMU_DSI1CLK, 0, CLK_SET_RATE_GATE); 228f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI1CLK] = clk; 22982b0f4b7SLee Jones 23082b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi0escclk", "tvclk", 23182b0f4b7SLee Jones PRCMU_DSI0ESCCLK, 0, CLK_SET_RATE_GATE); 232f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI0ESCCLK] = clk; 23382b0f4b7SLee Jones 23482b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi1escclk", "tvclk", 23582b0f4b7SLee Jones PRCMU_DSI1ESCCLK, 0, CLK_SET_RATE_GATE); 236f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI1ESCCLK] = clk; 23782b0f4b7SLee Jones 23882b0f4b7SLee Jones clk = clk_reg_prcmu_scalable("dsi2escclk", "tvclk", 23982b0f4b7SLee Jones PRCMU_DSI2ESCCLK, 0, CLK_SET_RATE_GATE); 240f9fcb8e8SLee Jones prcmu_clk[PRCMU_DSI2ESCCLK] = clk; 24182b0f4b7SLee Jones 24282b0f4b7SLee Jones clk = clk_reg_prcmu_scalable_rate("armss", NULL, 24366f4ae77SStephen Boyd PRCMU_ARMSS, 0, CLK_IGNORE_UNUSED); 244257015a2SLee Jones prcmu_clk[PRCMU_ARMSS] = clk; 24582b0f4b7SLee Jones 2464e334660SLee Jones twd_clk = clk_register_fixed_factor(NULL, "smp_twd", "armss", 24782b0f4b7SLee Jones CLK_IGNORE_UNUSED, 1, 2); 24882b0f4b7SLee Jones 24982b0f4b7SLee Jones /* 25082b0f4b7SLee Jones * FIXME: Add special handled PRCMU clocks here: 25182b0f4b7SLee Jones * 1. clkout0yuv, use PRCMU as parent + need regulator + pinctrl. 25282b0f4b7SLee Jones * 2. ab9540_clkout1yuv, see clkout0yuv 25382b0f4b7SLee Jones */ 25482b0f4b7SLee Jones 25582b0f4b7SLee Jones /* PRCC P-clocks */ 2565dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases[CLKRST1_INDEX], 25782b0f4b7SLee Jones BIT(0), 0); 2582d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 0); 25982b0f4b7SLee Jones 2605dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases[CLKRST1_INDEX], 26182b0f4b7SLee Jones BIT(1), 0); 2622d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 1); 26382b0f4b7SLee Jones 2645dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases[CLKRST1_INDEX], 26582b0f4b7SLee Jones BIT(2), 0); 2662d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 2); 26782b0f4b7SLee Jones 2685dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases[CLKRST1_INDEX], 26982b0f4b7SLee Jones BIT(3), 0); 2702d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 3); 27182b0f4b7SLee Jones 2725dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases[CLKRST1_INDEX], 27382b0f4b7SLee Jones BIT(4), 0); 2742d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 4); 27582b0f4b7SLee Jones 2765dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases[CLKRST1_INDEX], 27782b0f4b7SLee Jones BIT(5), 0); 2782d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 5); 27982b0f4b7SLee Jones 2805dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases[CLKRST1_INDEX], 28182b0f4b7SLee Jones BIT(6), 0); 2822d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 6); 28382b0f4b7SLee Jones 2845dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases[CLKRST1_INDEX], 28582b0f4b7SLee Jones BIT(7), 0); 2862d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 7); 28782b0f4b7SLee Jones 2885dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases[CLKRST1_INDEX], 28982b0f4b7SLee Jones BIT(8), 0); 2902d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 8); 29182b0f4b7SLee Jones 2925dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases[CLKRST1_INDEX], 29382b0f4b7SLee Jones BIT(9), 0); 2942d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 9); 29582b0f4b7SLee Jones 2965dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases[CLKRST1_INDEX], 29782b0f4b7SLee Jones BIT(10), 0); 2982d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 10); 29982b0f4b7SLee Jones 3005dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases[CLKRST1_INDEX], 30182b0f4b7SLee Jones BIT(11), 0); 3022d080300SLee Jones PRCC_PCLK_STORE(clk, 1, 11); 30382b0f4b7SLee Jones 3045dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases[CLKRST2_INDEX], 30582b0f4b7SLee Jones BIT(0), 0); 3062d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 0); 30782b0f4b7SLee Jones 3085dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases[CLKRST2_INDEX], 30982b0f4b7SLee Jones BIT(1), 0); 3102d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 1); 31182b0f4b7SLee Jones 3125dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases[CLKRST2_INDEX], 31382b0f4b7SLee Jones BIT(2), 0); 3142d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 2); 31582b0f4b7SLee Jones 3165dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases[CLKRST2_INDEX], 31782b0f4b7SLee Jones BIT(3), 0); 3182d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 3); 31982b0f4b7SLee Jones 3205dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases[CLKRST2_INDEX], 32182b0f4b7SLee Jones BIT(4), 0); 3222d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 4); 32382b0f4b7SLee Jones 3245dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases[CLKRST2_INDEX], 32582b0f4b7SLee Jones BIT(5), 0); 3262d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 5); 32782b0f4b7SLee Jones 3285dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases[CLKRST2_INDEX], 32982b0f4b7SLee Jones BIT(6), 0); 3302d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 6); 33182b0f4b7SLee Jones 3325dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases[CLKRST2_INDEX], 33382b0f4b7SLee Jones BIT(7), 0); 3342d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 7); 33582b0f4b7SLee Jones 3365dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases[CLKRST2_INDEX], 33782b0f4b7SLee Jones BIT(8), 0); 3382d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 8); 33982b0f4b7SLee Jones 3405dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases[CLKRST2_INDEX], 34182b0f4b7SLee Jones BIT(9), 0); 3422d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 9); 34382b0f4b7SLee Jones 3445dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases[CLKRST2_INDEX], 34582b0f4b7SLee Jones BIT(10), 0); 3462d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 10); 34782b0f4b7SLee Jones 3485dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases[CLKRST2_INDEX], 34982b0f4b7SLee Jones BIT(11), 0); 350f5ff9a11SLinus Walleij PRCC_PCLK_STORE(clk, 2, 11); 35182b0f4b7SLee Jones 3525dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases[CLKRST2_INDEX], 35382b0f4b7SLee Jones BIT(12), 0); 3542d080300SLee Jones PRCC_PCLK_STORE(clk, 2, 12); 35582b0f4b7SLee Jones 3565dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases[CLKRST3_INDEX], 35782b0f4b7SLee Jones BIT(0), 0); 3582d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 0); 35982b0f4b7SLee Jones 3605dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases[CLKRST3_INDEX], 36182b0f4b7SLee Jones BIT(1), 0); 3622d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 1); 36382b0f4b7SLee Jones 3645dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases[CLKRST3_INDEX], 36582b0f4b7SLee Jones BIT(2), 0); 3662d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 2); 36782b0f4b7SLee Jones 3685dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases[CLKRST3_INDEX], 36982b0f4b7SLee Jones BIT(3), 0); 3702d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 3); 37182b0f4b7SLee Jones 3725dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases[CLKRST3_INDEX], 37382b0f4b7SLee Jones BIT(4), 0); 3742d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 4); 37582b0f4b7SLee Jones 3765dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases[CLKRST3_INDEX], 37782b0f4b7SLee Jones BIT(5), 0); 3782d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 5); 37982b0f4b7SLee Jones 3805dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases[CLKRST3_INDEX], 38182b0f4b7SLee Jones BIT(6), 0); 3822d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 6); 38382b0f4b7SLee Jones 3845dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases[CLKRST3_INDEX], 38582b0f4b7SLee Jones BIT(7), 0); 3862d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 7); 38782b0f4b7SLee Jones 3885dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases[CLKRST3_INDEX], 38982b0f4b7SLee Jones BIT(8), 0); 3902d080300SLee Jones PRCC_PCLK_STORE(clk, 3, 8); 39182b0f4b7SLee Jones 3925dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases[CLKRST5_INDEX], 39382b0f4b7SLee Jones BIT(0), 0); 3942d080300SLee Jones PRCC_PCLK_STORE(clk, 5, 0); 39582b0f4b7SLee Jones 3965dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases[CLKRST5_INDEX], 39782b0f4b7SLee Jones BIT(1), 0); 3982d080300SLee Jones PRCC_PCLK_STORE(clk, 5, 1); 39982b0f4b7SLee Jones 4005dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases[CLKRST6_INDEX], 40182b0f4b7SLee Jones BIT(0), 0); 4022d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 0); 40382b0f4b7SLee Jones 4045dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases[CLKRST6_INDEX], 40582b0f4b7SLee Jones BIT(1), 0); 4062d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 1); 40782b0f4b7SLee Jones 4085dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases[CLKRST6_INDEX], 40982b0f4b7SLee Jones BIT(2), 0); 4102d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 2); 41182b0f4b7SLee Jones 4125dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases[CLKRST6_INDEX], 41382b0f4b7SLee Jones BIT(3), 0); 4142d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 3); 41582b0f4b7SLee Jones 4165dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases[CLKRST6_INDEX], 41782b0f4b7SLee Jones BIT(4), 0); 4182d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 4); 41982b0f4b7SLee Jones 4205dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases[CLKRST6_INDEX], 42182b0f4b7SLee Jones BIT(5), 0); 4222d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 5); 42382b0f4b7SLee Jones 4245dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases[CLKRST6_INDEX], 42582b0f4b7SLee Jones BIT(6), 0); 4262d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 6); 42782b0f4b7SLee Jones 4285dc0fe19SLinus Walleij clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases[CLKRST6_INDEX], 42982b0f4b7SLee Jones BIT(7), 0); 4302d080300SLee Jones PRCC_PCLK_STORE(clk, 6, 7); 43182b0f4b7SLee Jones 43282b0f4b7SLee Jones /* PRCC K-clocks 43382b0f4b7SLee Jones * 43482b0f4b7SLee Jones * FIXME: Some drivers requires PERPIH[n| to be automatically enabled 43582b0f4b7SLee Jones * by enabling just the K-clock, even if it is not a valid parent to 43682b0f4b7SLee Jones * the K-clock. Until drivers get fixed we might need some kind of 43782b0f4b7SLee Jones * "parent muxed join". 43882b0f4b7SLee Jones */ 43982b0f4b7SLee Jones 44082b0f4b7SLee Jones /* Periph1 */ 44182b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk", 4425dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(0), CLK_SET_RATE_GATE); 44389da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 0); 44482b0f4b7SLee Jones 44582b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk", 4465dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(1), CLK_SET_RATE_GATE); 44789da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 1); 44882b0f4b7SLee Jones 44982b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk", 4505dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(2), CLK_SET_RATE_GATE); 45189da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 2); 45282b0f4b7SLee Jones 45382b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk", 4545dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(3), CLK_SET_RATE_GATE); 45589da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 3); 45682b0f4b7SLee Jones 45782b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk", 4585dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(4), CLK_SET_RATE_GATE); 45989da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 4); 46082b0f4b7SLee Jones 46182b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk", 4625dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(5), CLK_SET_RATE_GATE); 46389da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 5); 46482b0f4b7SLee Jones 46582b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk", 4665dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(6), CLK_SET_RATE_GATE); 46789da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 6); 46882b0f4b7SLee Jones 46982b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk", 4705dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(8), CLK_SET_RATE_GATE); 47189da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 8); 47282b0f4b7SLee Jones 47382b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk", 4745dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(9), CLK_SET_RATE_GATE); 47589da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 9); 47682b0f4b7SLee Jones 47782b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk", 4785dc0fe19SLinus Walleij bases[CLKRST1_INDEX], BIT(10), CLK_SET_RATE_GATE); 47989da2dfaSLee Jones PRCC_KCLK_STORE(clk, 1, 10); 48082b0f4b7SLee Jones 48182b0f4b7SLee Jones /* Periph2 */ 48282b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk", 4835dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(0), CLK_SET_RATE_GATE); 48489da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 0); 48582b0f4b7SLee Jones 48682b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk", 4875dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(2), CLK_SET_RATE_GATE); 48889da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 2); 48982b0f4b7SLee Jones 49082b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk", 4915dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(3), CLK_SET_RATE_GATE); 49289da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 3); 49382b0f4b7SLee Jones 49482b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk", 4955dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(4), CLK_SET_RATE_GATE); 49689da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 4); 49782b0f4b7SLee Jones 49882b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk", 4995dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(5), CLK_SET_RATE_GATE); 50089da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 5); 50182b0f4b7SLee Jones 50282b0f4b7SLee Jones /* Note that rate is received from parent. */ 50382b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk", 5045dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(6), 50582b0f4b7SLee Jones CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT); 50689da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 6); 50789da2dfaSLee Jones 50882b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk", 5095dc0fe19SLinus Walleij bases[CLKRST2_INDEX], BIT(7), 51082b0f4b7SLee Jones CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT); 51189da2dfaSLee Jones PRCC_KCLK_STORE(clk, 2, 7); 51282b0f4b7SLee Jones 51382b0f4b7SLee Jones /* Periph3 */ 51482b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk", 5155dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(1), CLK_SET_RATE_GATE); 51689da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 1); 51782b0f4b7SLee Jones 51882b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk", 5195dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(2), CLK_SET_RATE_GATE); 52089da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 2); 52182b0f4b7SLee Jones 52282b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk", 5235dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(3), CLK_SET_RATE_GATE); 52489da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 3); 52582b0f4b7SLee Jones 52682b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk", 5275dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(4), CLK_SET_RATE_GATE); 52889da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 4); 52982b0f4b7SLee Jones 53082b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k", 5315dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(5), CLK_SET_RATE_GATE); 53289da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 5); 53382b0f4b7SLee Jones 53482b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk", 5355dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(6), CLK_SET_RATE_GATE); 53689da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 6); 53782b0f4b7SLee Jones 53882b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk", 5395dc0fe19SLinus Walleij bases[CLKRST3_INDEX], BIT(7), CLK_SET_RATE_GATE); 54089da2dfaSLee Jones PRCC_KCLK_STORE(clk, 3, 7); 54182b0f4b7SLee Jones 54282b0f4b7SLee Jones /* Periph6 */ 54382b0f4b7SLee Jones clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk", 5445dc0fe19SLinus Walleij bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE); 54589da2dfaSLee Jones PRCC_KCLK_STORE(clk, 6, 0); 546dec759d8SLee Jones 547dec759d8SLee Jones for_each_child_of_node(np, child) { 548f9fcb8e8SLee Jones static struct clk_onecell_data clk_data; 549f9fcb8e8SLee Jones 55087ab1151SRob Herring if (of_node_name_eq(child, "prcmu-clock")) { 551f9fcb8e8SLee Jones clk_data.clks = prcmu_clk; 552f9fcb8e8SLee Jones clk_data.clk_num = ARRAY_SIZE(prcmu_clk); 553f9fcb8e8SLee Jones of_clk_add_provider(child, of_clk_src_onecell_get, &clk_data); 554f9fcb8e8SLee Jones } 55587ab1151SRob Herring if (of_node_name_eq(child, "prcc-periph-clock")) 5562d080300SLee Jones of_clk_add_provider(child, ux500_twocell_get, prcc_pclk); 55789da2dfaSLee Jones 55887ab1151SRob Herring if (of_node_name_eq(child, "prcc-kernel-clock")) 55989da2dfaSLee Jones of_clk_add_provider(child, ux500_twocell_get, prcc_kclk); 560d625a730SLee Jones 56187ab1151SRob Herring if (of_node_name_eq(child, "rtc32k-clock")) 562d625a730SLee Jones of_clk_add_provider(child, of_clk_src_simple_get, rtc_clk); 5634e334660SLee Jones 56487ab1151SRob Herring if (of_node_name_eq(child, "smp-twd-clock")) 5654e334660SLee Jones of_clk_add_provider(child, of_clk_src_simple_get, twd_clk); 566dec759d8SLee Jones } 56782b0f4b7SLee Jones } 568269f1aacSArnd Bergmann CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init); 569