162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Copyright (C) 2009 by Sascha Hauer, Pengutronix 462306a36Sopenharmony_ci */ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#include <linux/kernel.h> 762306a36Sopenharmony_ci#include <linux/init.h> 862306a36Sopenharmony_ci#include <linux/list.h> 962306a36Sopenharmony_ci#include <linux/clk.h> 1062306a36Sopenharmony_ci#include <linux/io.h> 1162306a36Sopenharmony_ci#include <linux/clkdev.h> 1262306a36Sopenharmony_ci#include <linux/err.h> 1362306a36Sopenharmony_ci#include <linux/of.h> 1462306a36Sopenharmony_ci#include <linux/of_address.h> 1562306a36Sopenharmony_ci#include <linux/of_irq.h> 1662306a36Sopenharmony_ci#include <soc/imx/revision.h> 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#include "clk.h" 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define CCM_MPCTL 0x00 2162306a36Sopenharmony_ci#define CCM_UPCTL 0x04 2262306a36Sopenharmony_ci#define CCM_CCTL 0x08 2362306a36Sopenharmony_ci#define CCM_CGCR0 0x0C 2462306a36Sopenharmony_ci#define CCM_CGCR1 0x10 2562306a36Sopenharmony_ci#define CCM_CGCR2 0x14 2662306a36Sopenharmony_ci#define CCM_PCDR0 0x18 2762306a36Sopenharmony_ci#define CCM_PCDR1 0x1C 2862306a36Sopenharmony_ci#define CCM_PCDR2 0x20 2962306a36Sopenharmony_ci#define CCM_PCDR3 0x24 3062306a36Sopenharmony_ci#define CCM_RCSR 0x28 3162306a36Sopenharmony_ci#define CCM_CRDR 0x2C 3262306a36Sopenharmony_ci#define CCM_DCVR0 0x30 3362306a36Sopenharmony_ci#define CCM_DCVR1 0x34 3462306a36Sopenharmony_ci#define CCM_DCVR2 0x38 3562306a36Sopenharmony_ci#define CCM_DCVR3 0x3c 3662306a36Sopenharmony_ci#define CCM_LTR0 0x40 3762306a36Sopenharmony_ci#define CCM_LTR1 0x44 3862306a36Sopenharmony_ci#define CCM_LTR2 0x48 3962306a36Sopenharmony_ci#define CCM_LTR3 0x4c 4062306a36Sopenharmony_ci#define CCM_MCR 0x64 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ci#define ccm(x) (ccm_base + (x)) 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_cistatic struct clk_onecell_data clk_data; 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_cistatic const char *cpu_sel_clks[] = { "mpll", "mpll_cpu_3_4", }; 4762306a36Sopenharmony_cistatic const char *per_sel_clks[] = { "ahb", "upll", }; 4862306a36Sopenharmony_cistatic const char *cko_sel_clks[] = { "dummy", "osc", "cpu", "ahb", 4962306a36Sopenharmony_ci "ipg", "dummy", "dummy", "dummy", 5062306a36Sopenharmony_ci "dummy", "dummy", "per0", "per2", 5162306a36Sopenharmony_ci "per13", "per14", "usbotg_ahb", "dummy",}; 5262306a36Sopenharmony_ci 5362306a36Sopenharmony_cienum mx25_clks { 5462306a36Sopenharmony_ci dummy, osc, mpll, upll, mpll_cpu_3_4, cpu_sel, cpu, ahb, usb_div, ipg, 5562306a36Sopenharmony_ci per0_sel, per1_sel, per2_sel, per3_sel, per4_sel, per5_sel, per6_sel, 5662306a36Sopenharmony_ci per7_sel, per8_sel, per9_sel, per10_sel, per11_sel, per12_sel, 5762306a36Sopenharmony_ci per13_sel, per14_sel, per15_sel, per0, per1, per2, per3, per4, per5, 5862306a36Sopenharmony_ci per6, per7, per8, per9, per10, per11, per12, per13, per14, per15, 5962306a36Sopenharmony_ci csi_ipg_per, epit_ipg_per, esai_ipg_per, esdhc1_ipg_per, esdhc2_ipg_per, 6062306a36Sopenharmony_ci gpt_ipg_per, i2c_ipg_per, lcdc_ipg_per, nfc_ipg_per, owire_ipg_per, 6162306a36Sopenharmony_ci pwm_ipg_per, sim1_ipg_per, sim2_ipg_per, ssi1_ipg_per, ssi2_ipg_per, 6262306a36Sopenharmony_ci uart_ipg_per, ata_ahb, reserved1, csi_ahb, emi_ahb, esai_ahb, esdhc1_ahb, 6362306a36Sopenharmony_ci esdhc2_ahb, fec_ahb, lcdc_ahb, rtic_ahb, sdma_ahb, slcdc_ahb, usbotg_ahb, 6462306a36Sopenharmony_ci reserved2, reserved3, reserved4, reserved5, can1_ipg, can2_ipg, csi_ipg, 6562306a36Sopenharmony_ci cspi1_ipg, cspi2_ipg, cspi3_ipg, dryice_ipg, ect_ipg, epit1_ipg, epit2_ipg, 6662306a36Sopenharmony_ci reserved6, esdhc1_ipg, esdhc2_ipg, fec_ipg, reserved7, reserved8, reserved9, 6762306a36Sopenharmony_ci gpt1_ipg, gpt2_ipg, gpt3_ipg, gpt4_ipg, reserved10, reserved11, reserved12, 6862306a36Sopenharmony_ci iim_ipg, reserved13, reserved14, kpp_ipg, lcdc_ipg, reserved15, pwm1_ipg, 6962306a36Sopenharmony_ci pwm2_ipg, pwm3_ipg, pwm4_ipg, rngb_ipg, reserved16, scc_ipg, sdma_ipg, 7062306a36Sopenharmony_ci sim1_ipg, sim2_ipg, slcdc_ipg, spba_ipg, ssi1_ipg, ssi2_ipg, tsc_ipg, 7162306a36Sopenharmony_ci uart1_ipg, uart2_ipg, uart3_ipg, uart4_ipg, uart5_ipg, reserved17, 7262306a36Sopenharmony_ci wdt_ipg, cko_div, cko_sel, cko, clk_max 7362306a36Sopenharmony_ci}; 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_cistatic struct clk *clk[clk_max]; 7662306a36Sopenharmony_ci 7762306a36Sopenharmony_cistatic void __init __mx25_clocks_init(void __iomem *ccm_base) 7862306a36Sopenharmony_ci{ 7962306a36Sopenharmony_ci BUG_ON(!ccm_base); 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci clk[dummy] = imx_clk_fixed("dummy", 0); 8262306a36Sopenharmony_ci clk[mpll] = imx_clk_pllv1(IMX_PLLV1_IMX25, "mpll", "osc", ccm(CCM_MPCTL)); 8362306a36Sopenharmony_ci clk[upll] = imx_clk_pllv1(IMX_PLLV1_IMX25, "upll", "osc", ccm(CCM_UPCTL)); 8462306a36Sopenharmony_ci clk[mpll_cpu_3_4] = imx_clk_fixed_factor("mpll_cpu_3_4", "mpll", 3, 4); 8562306a36Sopenharmony_ci clk[cpu_sel] = imx_clk_mux("cpu_sel", ccm(CCM_CCTL), 14, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks)); 8662306a36Sopenharmony_ci clk[cpu] = imx_clk_divider("cpu", "cpu_sel", ccm(CCM_CCTL), 30, 2); 8762306a36Sopenharmony_ci clk[ahb] = imx_clk_divider("ahb", "cpu", ccm(CCM_CCTL), 28, 2); 8862306a36Sopenharmony_ci clk[usb_div] = imx_clk_divider("usb_div", "upll", ccm(CCM_CCTL), 16, 6); 8962306a36Sopenharmony_ci clk[ipg] = imx_clk_fixed_factor("ipg", "ahb", 1, 2); 9062306a36Sopenharmony_ci clk[per0_sel] = imx_clk_mux("per0_sel", ccm(CCM_MCR), 0, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9162306a36Sopenharmony_ci clk[per1_sel] = imx_clk_mux("per1_sel", ccm(CCM_MCR), 1, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9262306a36Sopenharmony_ci clk[per2_sel] = imx_clk_mux("per2_sel", ccm(CCM_MCR), 2, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9362306a36Sopenharmony_ci clk[per3_sel] = imx_clk_mux("per3_sel", ccm(CCM_MCR), 3, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9462306a36Sopenharmony_ci clk[per4_sel] = imx_clk_mux("per4_sel", ccm(CCM_MCR), 4, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9562306a36Sopenharmony_ci clk[per5_sel] = imx_clk_mux("per5_sel", ccm(CCM_MCR), 5, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9662306a36Sopenharmony_ci clk[per6_sel] = imx_clk_mux("per6_sel", ccm(CCM_MCR), 6, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9762306a36Sopenharmony_ci clk[per7_sel] = imx_clk_mux("per7_sel", ccm(CCM_MCR), 7, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9862306a36Sopenharmony_ci clk[per8_sel] = imx_clk_mux("per8_sel", ccm(CCM_MCR), 8, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 9962306a36Sopenharmony_ci clk[per9_sel] = imx_clk_mux("per9_sel", ccm(CCM_MCR), 9, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10062306a36Sopenharmony_ci clk[per10_sel] = imx_clk_mux("per10_sel", ccm(CCM_MCR), 10, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10162306a36Sopenharmony_ci clk[per11_sel] = imx_clk_mux("per11_sel", ccm(CCM_MCR), 11, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10262306a36Sopenharmony_ci clk[per12_sel] = imx_clk_mux("per12_sel", ccm(CCM_MCR), 12, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10362306a36Sopenharmony_ci clk[per13_sel] = imx_clk_mux("per13_sel", ccm(CCM_MCR), 13, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10462306a36Sopenharmony_ci clk[per14_sel] = imx_clk_mux("per14_sel", ccm(CCM_MCR), 14, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10562306a36Sopenharmony_ci clk[per15_sel] = imx_clk_mux("per15_sel", ccm(CCM_MCR), 15, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); 10662306a36Sopenharmony_ci clk[cko_div] = imx_clk_divider("cko_div", "cko_sel", ccm(CCM_MCR), 24, 6); 10762306a36Sopenharmony_ci clk[cko_sel] = imx_clk_mux("cko_sel", ccm(CCM_MCR), 20, 4, cko_sel_clks, ARRAY_SIZE(cko_sel_clks)); 10862306a36Sopenharmony_ci clk[cko] = imx_clk_gate("cko", "cko_div", ccm(CCM_MCR), 30); 10962306a36Sopenharmony_ci clk[per0] = imx_clk_divider("per0", "per0_sel", ccm(CCM_PCDR0), 0, 6); 11062306a36Sopenharmony_ci clk[per1] = imx_clk_divider("per1", "per1_sel", ccm(CCM_PCDR0), 8, 6); 11162306a36Sopenharmony_ci clk[per2] = imx_clk_divider("per2", "per2_sel", ccm(CCM_PCDR0), 16, 6); 11262306a36Sopenharmony_ci clk[per3] = imx_clk_divider("per3", "per3_sel", ccm(CCM_PCDR0), 24, 6); 11362306a36Sopenharmony_ci clk[per4] = imx_clk_divider("per4", "per4_sel", ccm(CCM_PCDR1), 0, 6); 11462306a36Sopenharmony_ci clk[per5] = imx_clk_divider("per5", "per5_sel", ccm(CCM_PCDR1), 8, 6); 11562306a36Sopenharmony_ci clk[per6] = imx_clk_divider("per6", "per6_sel", ccm(CCM_PCDR1), 16, 6); 11662306a36Sopenharmony_ci clk[per7] = imx_clk_divider("per7", "per7_sel", ccm(CCM_PCDR1), 24, 6); 11762306a36Sopenharmony_ci clk[per8] = imx_clk_divider("per8", "per8_sel", ccm(CCM_PCDR2), 0, 6); 11862306a36Sopenharmony_ci clk[per9] = imx_clk_divider("per9", "per9_sel", ccm(CCM_PCDR2), 8, 6); 11962306a36Sopenharmony_ci clk[per10] = imx_clk_divider("per10", "per10_sel", ccm(CCM_PCDR2), 16, 6); 12062306a36Sopenharmony_ci clk[per11] = imx_clk_divider("per11", "per11_sel", ccm(CCM_PCDR2), 24, 6); 12162306a36Sopenharmony_ci clk[per12] = imx_clk_divider("per12", "per12_sel", ccm(CCM_PCDR3), 0, 6); 12262306a36Sopenharmony_ci clk[per13] = imx_clk_divider("per13", "per13_sel", ccm(CCM_PCDR3), 8, 6); 12362306a36Sopenharmony_ci clk[per14] = imx_clk_divider("per14", "per14_sel", ccm(CCM_PCDR3), 16, 6); 12462306a36Sopenharmony_ci clk[per15] = imx_clk_divider("per15", "per15_sel", ccm(CCM_PCDR3), 24, 6); 12562306a36Sopenharmony_ci clk[csi_ipg_per] = imx_clk_gate("csi_ipg_per", "per0", ccm(CCM_CGCR0), 0); 12662306a36Sopenharmony_ci clk[epit_ipg_per] = imx_clk_gate("epit_ipg_per", "per1", ccm(CCM_CGCR0), 1); 12762306a36Sopenharmony_ci clk[esai_ipg_per] = imx_clk_gate("esai_ipg_per", "per2", ccm(CCM_CGCR0), 2); 12862306a36Sopenharmony_ci clk[esdhc1_ipg_per] = imx_clk_gate("esdhc1_ipg_per", "per3", ccm(CCM_CGCR0), 3); 12962306a36Sopenharmony_ci clk[esdhc2_ipg_per] = imx_clk_gate("esdhc2_ipg_per", "per4", ccm(CCM_CGCR0), 4); 13062306a36Sopenharmony_ci clk[gpt_ipg_per] = imx_clk_gate("gpt_ipg_per", "per5", ccm(CCM_CGCR0), 5); 13162306a36Sopenharmony_ci clk[i2c_ipg_per] = imx_clk_gate("i2c_ipg_per", "per6", ccm(CCM_CGCR0), 6); 13262306a36Sopenharmony_ci clk[lcdc_ipg_per] = imx_clk_gate("lcdc_ipg_per", "per7", ccm(CCM_CGCR0), 7); 13362306a36Sopenharmony_ci clk[nfc_ipg_per] = imx_clk_gate("nfc_ipg_per", "per8", ccm(CCM_CGCR0), 8); 13462306a36Sopenharmony_ci clk[owire_ipg_per] = imx_clk_gate("owire_ipg_per", "per9", ccm(CCM_CGCR0), 9); 13562306a36Sopenharmony_ci clk[pwm_ipg_per] = imx_clk_gate("pwm_ipg_per", "per10", ccm(CCM_CGCR0), 10); 13662306a36Sopenharmony_ci clk[sim1_ipg_per] = imx_clk_gate("sim1_ipg_per", "per11", ccm(CCM_CGCR0), 11); 13762306a36Sopenharmony_ci clk[sim2_ipg_per] = imx_clk_gate("sim2_ipg_per", "per12", ccm(CCM_CGCR0), 12); 13862306a36Sopenharmony_ci clk[ssi1_ipg_per] = imx_clk_gate("ssi1_ipg_per", "per13", ccm(CCM_CGCR0), 13); 13962306a36Sopenharmony_ci clk[ssi2_ipg_per] = imx_clk_gate("ssi2_ipg_per", "per14", ccm(CCM_CGCR0), 14); 14062306a36Sopenharmony_ci clk[uart_ipg_per] = imx_clk_gate("uart_ipg_per", "per15", ccm(CCM_CGCR0), 15); 14162306a36Sopenharmony_ci clk[ata_ahb] = imx_clk_gate("ata_ahb", "ahb", ccm(CCM_CGCR0), 16); 14262306a36Sopenharmony_ci /* CCM_CGCR0(17): reserved */ 14362306a36Sopenharmony_ci clk[csi_ahb] = imx_clk_gate("csi_ahb", "ahb", ccm(CCM_CGCR0), 18); 14462306a36Sopenharmony_ci clk[emi_ahb] = imx_clk_gate("emi_ahb", "ahb", ccm(CCM_CGCR0), 19); 14562306a36Sopenharmony_ci clk[esai_ahb] = imx_clk_gate("esai_ahb", "ahb", ccm(CCM_CGCR0), 20); 14662306a36Sopenharmony_ci clk[esdhc1_ahb] = imx_clk_gate("esdhc1_ahb", "ahb", ccm(CCM_CGCR0), 21); 14762306a36Sopenharmony_ci clk[esdhc2_ahb] = imx_clk_gate("esdhc2_ahb", "ahb", ccm(CCM_CGCR0), 22); 14862306a36Sopenharmony_ci clk[fec_ahb] = imx_clk_gate("fec_ahb", "ahb", ccm(CCM_CGCR0), 23); 14962306a36Sopenharmony_ci clk[lcdc_ahb] = imx_clk_gate("lcdc_ahb", "ahb", ccm(CCM_CGCR0), 24); 15062306a36Sopenharmony_ci clk[rtic_ahb] = imx_clk_gate("rtic_ahb", "ahb", ccm(CCM_CGCR0), 25); 15162306a36Sopenharmony_ci clk[sdma_ahb] = imx_clk_gate("sdma_ahb", "ahb", ccm(CCM_CGCR0), 26); 15262306a36Sopenharmony_ci clk[slcdc_ahb] = imx_clk_gate("slcdc_ahb", "ahb", ccm(CCM_CGCR0), 27); 15362306a36Sopenharmony_ci clk[usbotg_ahb] = imx_clk_gate("usbotg_ahb", "ahb", ccm(CCM_CGCR0), 28); 15462306a36Sopenharmony_ci /* CCM_CGCR0(29-31): reserved */ 15562306a36Sopenharmony_ci /* CCM_CGCR1(0): reserved in datasheet, used as audmux in FSL kernel */ 15662306a36Sopenharmony_ci clk[can1_ipg] = imx_clk_gate("can1_ipg", "ipg", ccm(CCM_CGCR1), 2); 15762306a36Sopenharmony_ci clk[can2_ipg] = imx_clk_gate("can2_ipg", "ipg", ccm(CCM_CGCR1), 3); 15862306a36Sopenharmony_ci clk[csi_ipg] = imx_clk_gate("csi_ipg", "ipg", ccm(CCM_CGCR1), 4); 15962306a36Sopenharmony_ci clk[cspi1_ipg] = imx_clk_gate("cspi1_ipg", "ipg", ccm(CCM_CGCR1), 5); 16062306a36Sopenharmony_ci clk[cspi2_ipg] = imx_clk_gate("cspi2_ipg", "ipg", ccm(CCM_CGCR1), 6); 16162306a36Sopenharmony_ci clk[cspi3_ipg] = imx_clk_gate("cspi3_ipg", "ipg", ccm(CCM_CGCR1), 7); 16262306a36Sopenharmony_ci clk[dryice_ipg] = imx_clk_gate("dryice_ipg", "ipg", ccm(CCM_CGCR1), 8); 16362306a36Sopenharmony_ci clk[ect_ipg] = imx_clk_gate("ect_ipg", "ipg", ccm(CCM_CGCR1), 9); 16462306a36Sopenharmony_ci clk[epit1_ipg] = imx_clk_gate("epit1_ipg", "ipg", ccm(CCM_CGCR1), 10); 16562306a36Sopenharmony_ci clk[epit2_ipg] = imx_clk_gate("epit2_ipg", "ipg", ccm(CCM_CGCR1), 11); 16662306a36Sopenharmony_ci /* CCM_CGCR1(12): reserved in datasheet, used as esai in FSL kernel */ 16762306a36Sopenharmony_ci clk[esdhc1_ipg] = imx_clk_gate("esdhc1_ipg", "ipg", ccm(CCM_CGCR1), 13); 16862306a36Sopenharmony_ci clk[esdhc2_ipg] = imx_clk_gate("esdhc2_ipg", "ipg", ccm(CCM_CGCR1), 14); 16962306a36Sopenharmony_ci clk[fec_ipg] = imx_clk_gate("fec_ipg", "ipg", ccm(CCM_CGCR1), 15); 17062306a36Sopenharmony_ci /* CCM_CGCR1(16): reserved in datasheet, used as gpio1 in FSL kernel */ 17162306a36Sopenharmony_ci /* CCM_CGCR1(17): reserved in datasheet, used as gpio2 in FSL kernel */ 17262306a36Sopenharmony_ci /* CCM_CGCR1(18): reserved in datasheet, used as gpio3 in FSL kernel */ 17362306a36Sopenharmony_ci clk[gpt1_ipg] = imx_clk_gate("gpt1_ipg", "ipg", ccm(CCM_CGCR1), 19); 17462306a36Sopenharmony_ci clk[gpt2_ipg] = imx_clk_gate("gpt2_ipg", "ipg", ccm(CCM_CGCR1), 20); 17562306a36Sopenharmony_ci clk[gpt3_ipg] = imx_clk_gate("gpt3_ipg", "ipg", ccm(CCM_CGCR1), 21); 17662306a36Sopenharmony_ci clk[gpt4_ipg] = imx_clk_gate("gpt4_ipg", "ipg", ccm(CCM_CGCR1), 22); 17762306a36Sopenharmony_ci /* CCM_CGCR1(23): reserved in datasheet, used as i2c1 in FSL kernel */ 17862306a36Sopenharmony_ci /* CCM_CGCR1(24): reserved in datasheet, used as i2c2 in FSL kernel */ 17962306a36Sopenharmony_ci /* CCM_CGCR1(25): reserved in datasheet, used as i2c3 in FSL kernel */ 18062306a36Sopenharmony_ci clk[iim_ipg] = imx_clk_gate("iim_ipg", "ipg", ccm(CCM_CGCR1), 26); 18162306a36Sopenharmony_ci /* CCM_CGCR1(27): reserved in datasheet, used as iomuxc in FSL kernel */ 18262306a36Sopenharmony_ci /* CCM_CGCR1(28): reserved in datasheet, used as kpp in FSL kernel */ 18362306a36Sopenharmony_ci clk[kpp_ipg] = imx_clk_gate("kpp_ipg", "ipg", ccm(CCM_CGCR1), 28); 18462306a36Sopenharmony_ci clk[lcdc_ipg] = imx_clk_gate("lcdc_ipg", "ipg", ccm(CCM_CGCR1), 29); 18562306a36Sopenharmony_ci /* CCM_CGCR1(30): reserved in datasheet, used as owire in FSL kernel */ 18662306a36Sopenharmony_ci clk[pwm1_ipg] = imx_clk_gate("pwm1_ipg", "ipg", ccm(CCM_CGCR1), 31); 18762306a36Sopenharmony_ci clk[pwm2_ipg] = imx_clk_gate("pwm2_ipg", "ipg", ccm(CCM_CGCR2), 0); 18862306a36Sopenharmony_ci clk[pwm3_ipg] = imx_clk_gate("pwm3_ipg", "ipg", ccm(CCM_CGCR2), 1); 18962306a36Sopenharmony_ci clk[pwm4_ipg] = imx_clk_gate("pwm4_ipg", "ipg", ccm(CCM_CGCR2), 2); 19062306a36Sopenharmony_ci clk[rngb_ipg] = imx_clk_gate("rngb_ipg", "ipg", ccm(CCM_CGCR2), 3); 19162306a36Sopenharmony_ci /* CCM_CGCR2(4): reserved in datasheet, used as rtic in FSL kernel */ 19262306a36Sopenharmony_ci clk[scc_ipg] = imx_clk_gate("scc_ipg", "ipg", ccm(CCM_CGCR2), 5); 19362306a36Sopenharmony_ci clk[sdma_ipg] = imx_clk_gate("sdma_ipg", "ipg", ccm(CCM_CGCR2), 6); 19462306a36Sopenharmony_ci clk[sim1_ipg] = imx_clk_gate("sim1_ipg", "ipg", ccm(CCM_CGCR2), 7); 19562306a36Sopenharmony_ci clk[sim2_ipg] = imx_clk_gate("sim2_ipg", "ipg", ccm(CCM_CGCR2), 8); 19662306a36Sopenharmony_ci clk[slcdc_ipg] = imx_clk_gate("slcdc_ipg", "ipg", ccm(CCM_CGCR2), 9); 19762306a36Sopenharmony_ci clk[spba_ipg] = imx_clk_gate("spba_ipg", "ipg", ccm(CCM_CGCR2), 10); 19862306a36Sopenharmony_ci clk[ssi1_ipg] = imx_clk_gate("ssi1_ipg", "ipg", ccm(CCM_CGCR2), 11); 19962306a36Sopenharmony_ci clk[ssi2_ipg] = imx_clk_gate("ssi2_ipg", "ipg", ccm(CCM_CGCR2), 12); 20062306a36Sopenharmony_ci clk[tsc_ipg] = imx_clk_gate("tsc_ipg", "ipg", ccm(CCM_CGCR2), 13); 20162306a36Sopenharmony_ci clk[uart1_ipg] = imx_clk_gate("uart1_ipg", "ipg", ccm(CCM_CGCR2), 14); 20262306a36Sopenharmony_ci clk[uart2_ipg] = imx_clk_gate("uart2_ipg", "ipg", ccm(CCM_CGCR2), 15); 20362306a36Sopenharmony_ci clk[uart3_ipg] = imx_clk_gate("uart3_ipg", "ipg", ccm(CCM_CGCR2), 16); 20462306a36Sopenharmony_ci clk[uart4_ipg] = imx_clk_gate("uart4_ipg", "ipg", ccm(CCM_CGCR2), 17); 20562306a36Sopenharmony_ci clk[uart5_ipg] = imx_clk_gate("uart5_ipg", "ipg", ccm(CCM_CGCR2), 18); 20662306a36Sopenharmony_ci /* CCM_CGCR2(19): reserved in datasheet, but used as wdt in FSL kernel */ 20762306a36Sopenharmony_ci clk[wdt_ipg] = imx_clk_gate("wdt_ipg", "ipg", ccm(CCM_CGCR2), 19); 20862306a36Sopenharmony_ci 20962306a36Sopenharmony_ci imx_check_clocks(clk, ARRAY_SIZE(clk)); 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci clk_prepare_enable(clk[emi_ahb]); 21262306a36Sopenharmony_ci 21362306a36Sopenharmony_ci /* Clock source for gpt must be derived from AHB */ 21462306a36Sopenharmony_ci clk_set_parent(clk[per5_sel], clk[ahb]); 21562306a36Sopenharmony_ci 21662306a36Sopenharmony_ci /* 21762306a36Sopenharmony_ci * Let's initially set up CLKO parent as ipg, since this configuration 21862306a36Sopenharmony_ci * is used on some imx25 board designs to clock the audio codec. 21962306a36Sopenharmony_ci */ 22062306a36Sopenharmony_ci clk_set_parent(clk[cko_sel], clk[ipg]); 22162306a36Sopenharmony_ci 22262306a36Sopenharmony_ci imx_register_uart_clocks(); 22362306a36Sopenharmony_ci 22462306a36Sopenharmony_ci imx_print_silicon_rev("i.MX25", mx25_revision()); 22562306a36Sopenharmony_ci} 22662306a36Sopenharmony_ci 22762306a36Sopenharmony_cistatic void __init mx25_clocks_init_dt(struct device_node *np) 22862306a36Sopenharmony_ci{ 22962306a36Sopenharmony_ci void __iomem *ccm; 23062306a36Sopenharmony_ci 23162306a36Sopenharmony_ci ccm = of_iomap(np, 0); 23262306a36Sopenharmony_ci __mx25_clocks_init(ccm); 23362306a36Sopenharmony_ci 23462306a36Sopenharmony_ci clk_data.clks = clk; 23562306a36Sopenharmony_ci clk_data.clk_num = ARRAY_SIZE(clk); 23662306a36Sopenharmony_ci of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data); 23762306a36Sopenharmony_ci} 23862306a36Sopenharmony_ciCLK_OF_DECLARE(imx25_ccm, "fsl,imx25-ccm", mx25_clocks_init_dt); 239