18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_ci#include <linux/clk.h>
38c2ecf20Sopenharmony_ci#include <linux/clk-provider.h>
48c2ecf20Sopenharmony_ci#include <linux/clkdev.h>
58c2ecf20Sopenharmony_ci#include <linux/err.h>
68c2ecf20Sopenharmony_ci#include <linux/io.h>
78c2ecf20Sopenharmony_ci#include <linux/of.h>
88c2ecf20Sopenharmony_ci#include <linux/of_address.h>
98c2ecf20Sopenharmony_ci#include <dt-bindings/clock/imx27-clock.h>
108c2ecf20Sopenharmony_ci#include <soc/imx/revision.h>
118c2ecf20Sopenharmony_ci#include <soc/imx/timer.h>
128c2ecf20Sopenharmony_ci#include <asm/irq.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include "clk.h"
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define MX27_CCM_BASE_ADDR	0x10027000
178c2ecf20Sopenharmony_ci#define MX27_GPT1_BASE_ADDR	0x10003000
188c2ecf20Sopenharmony_ci#define MX27_INT_GPT1		(NR_IRQS_LEGACY + 26)
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_cistatic void __iomem *ccm __initdata;
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* Register offsets */
238c2ecf20Sopenharmony_ci#define CCM_CSCR		(ccm + 0x00)
248c2ecf20Sopenharmony_ci#define CCM_MPCTL0		(ccm + 0x04)
258c2ecf20Sopenharmony_ci#define CCM_MPCTL1		(ccm + 0x08)
268c2ecf20Sopenharmony_ci#define CCM_SPCTL0		(ccm + 0x0c)
278c2ecf20Sopenharmony_ci#define CCM_SPCTL1		(ccm + 0x10)
288c2ecf20Sopenharmony_ci#define CCM_PCDR0		(ccm + 0x18)
298c2ecf20Sopenharmony_ci#define CCM_PCDR1		(ccm + 0x1c)
308c2ecf20Sopenharmony_ci#define CCM_PCCR0		(ccm + 0x20)
318c2ecf20Sopenharmony_ci#define CCM_PCCR1		(ccm + 0x24)
328c2ecf20Sopenharmony_ci#define CCM_CCSR		(ccm + 0x28)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistatic const char *vpu_sel_clks[] = { "spll", "mpll_main2", };
358c2ecf20Sopenharmony_cistatic const char *cpu_sel_clks[] = { "mpll_main2", "mpll", };
368c2ecf20Sopenharmony_cistatic const char *mpll_sel_clks[] = { "fpm", "mpll_osc_sel", };
378c2ecf20Sopenharmony_cistatic const char *mpll_osc_sel_clks[] = { "ckih_gate", "ckih_div1p5", };
388c2ecf20Sopenharmony_cistatic const char *clko_sel_clks[] = {
398c2ecf20Sopenharmony_ci	"ckil", "fpm", "ckih_gate", "ckih_gate",
408c2ecf20Sopenharmony_ci	"ckih_gate", "mpll", "spll", "cpu_div",
418c2ecf20Sopenharmony_ci	"ahb", "ipg", "per1_div", "per2_div",
428c2ecf20Sopenharmony_ci	"per3_div", "per4_div", "ssi1_div", "ssi2_div",
438c2ecf20Sopenharmony_ci	"nfc_div", "mshc_div", "vpu_div", "60m",
448c2ecf20Sopenharmony_ci	"32k", "usb_div", "dptc",
458c2ecf20Sopenharmony_ci};
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_cistatic const char *ssi_sel_clks[] = { "spll_gate", "mpll", };
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_cistatic struct clk *clk[IMX27_CLK_MAX];
508c2ecf20Sopenharmony_cistatic struct clk_onecell_data clk_data;
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_cistatic void __init _mx27_clocks_init(unsigned long fref)
538c2ecf20Sopenharmony_ci{
548c2ecf20Sopenharmony_ci	BUG_ON(!ccm);
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci	clk[IMX27_CLK_DUMMY] = imx_clk_fixed("dummy", 0);
578c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CKIH] = imx_clk_fixed("ckih", fref);
588c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CKIL] = imx_clk_fixed("ckil", 32768);
598c2ecf20Sopenharmony_ci	clk[IMX27_CLK_FPM] = imx_clk_fixed_factor("fpm", "ckil", 1024, 1);
608c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CKIH_DIV1P5] = imx_clk_fixed_factor("ckih_div1p5", "ckih_gate", 2, 3);
618c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CKIH_GATE] = imx_clk_gate_dis("ckih_gate", "ckih", CCM_CSCR, 3);
628c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MPLL_OSC_SEL] = imx_clk_mux("mpll_osc_sel", CCM_CSCR, 4, 1, mpll_osc_sel_clks, ARRAY_SIZE(mpll_osc_sel_clks));
638c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MPLL_SEL] = imx_clk_mux("mpll_sel", CCM_CSCR, 16, 1, mpll_sel_clks, ARRAY_SIZE(mpll_sel_clks));
648c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MPLL] = imx_clk_pllv1(IMX_PLLV1_IMX27, "mpll", "mpll_sel", CCM_MPCTL0);
658c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SPLL] = imx_clk_pllv1(IMX_PLLV1_IMX27, "spll", "ckih_gate", CCM_SPCTL0);
668c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SPLL_GATE] = imx_clk_gate("spll_gate", "spll", CCM_CSCR, 1);
678c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MPLL_MAIN2] = imx_clk_fixed_factor("mpll_main2", "mpll", 2, 3);
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci	if (mx27_revision() >= IMX_CHIP_REVISION_2_0) {
708c2ecf20Sopenharmony_ci		clk[IMX27_CLK_AHB] = imx_clk_divider("ahb", "mpll_main2", CCM_CSCR, 8, 2);
718c2ecf20Sopenharmony_ci		clk[IMX27_CLK_IPG] = imx_clk_fixed_factor("ipg", "ahb", 1, 2);
728c2ecf20Sopenharmony_ci	} else {
738c2ecf20Sopenharmony_ci		clk[IMX27_CLK_AHB] = imx_clk_divider("ahb", "mpll_main2", CCM_CSCR, 9, 4);
748c2ecf20Sopenharmony_ci		clk[IMX27_CLK_IPG] = imx_clk_divider("ipg", "ahb", CCM_CSCR, 8, 1);
758c2ecf20Sopenharmony_ci	}
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MSHC_DIV] = imx_clk_divider("mshc_div", "ahb", CCM_PCDR0, 0, 6);
788c2ecf20Sopenharmony_ci	clk[IMX27_CLK_NFC_DIV] = imx_clk_divider("nfc_div", "ahb", CCM_PCDR0, 6, 4);
798c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER1_DIV] = imx_clk_divider("per1_div", "mpll_main2", CCM_PCDR1, 0, 6);
808c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER2_DIV] = imx_clk_divider("per2_div", "mpll_main2", CCM_PCDR1, 8, 6);
818c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER3_DIV] = imx_clk_divider("per3_div", "mpll_main2", CCM_PCDR1, 16, 6);
828c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER4_DIV] = imx_clk_divider("per4_div", "mpll_main2", CCM_PCDR1, 24, 6);
838c2ecf20Sopenharmony_ci	clk[IMX27_CLK_VPU_SEL] = imx_clk_mux("vpu_sel", CCM_CSCR, 21, 1, vpu_sel_clks, ARRAY_SIZE(vpu_sel_clks));
848c2ecf20Sopenharmony_ci	clk[IMX27_CLK_VPU_DIV] = imx_clk_divider("vpu_div", "vpu_sel", CCM_PCDR0, 10, 6);
858c2ecf20Sopenharmony_ci	clk[IMX27_CLK_USB_DIV] = imx_clk_divider("usb_div", "spll_gate", CCM_CSCR, 28, 3);
868c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CPU_SEL] = imx_clk_mux("cpu_sel", CCM_CSCR, 15, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks));
878c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CLKO_SEL] = imx_clk_mux("clko_sel", CCM_CCSR, 0, 5, clko_sel_clks, ARRAY_SIZE(clko_sel_clks));
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci	if (mx27_revision() >= IMX_CHIP_REVISION_2_0)
908c2ecf20Sopenharmony_ci		clk[IMX27_CLK_CPU_DIV] = imx_clk_divider("cpu_div", "cpu_sel", CCM_CSCR, 12, 2);
918c2ecf20Sopenharmony_ci	else
928c2ecf20Sopenharmony_ci		clk[IMX27_CLK_CPU_DIV] = imx_clk_divider("cpu_div", "cpu_sel", CCM_CSCR, 13, 3);
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CLKO_DIV] = imx_clk_divider("clko_div", "clko_sel", CCM_PCDR0, 22, 3);
958c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI1_SEL] = imx_clk_mux("ssi1_sel", CCM_CSCR, 22, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
968c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI2_SEL] = imx_clk_mux("ssi2_sel", CCM_CSCR, 23, 1, ssi_sel_clks, ARRAY_SIZE(ssi_sel_clks));
978c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI1_DIV] = imx_clk_divider("ssi1_div", "ssi1_sel", CCM_PCDR0, 16, 6);
988c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI2_DIV] = imx_clk_divider("ssi2_div", "ssi2_sel", CCM_PCDR0, 26, 6);
998c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CLKO_EN] = imx_clk_gate("clko_en", "clko_div", CCM_PCCR0, 0);
1008c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI2_IPG_GATE] = imx_clk_gate("ssi2_ipg_gate", "ipg", CCM_PCCR0, 0);
1018c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI1_IPG_GATE] = imx_clk_gate("ssi1_ipg_gate", "ipg", CCM_PCCR0, 1);
1028c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SLCDC_IPG_GATE] = imx_clk_gate("slcdc_ipg_gate", "ipg", CCM_PCCR0, 2);
1038c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SDHC3_IPG_GATE] = imx_clk_gate("sdhc3_ipg_gate", "ipg", CCM_PCCR0, 3);
1048c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SDHC2_IPG_GATE] = imx_clk_gate("sdhc2_ipg_gate", "ipg", CCM_PCCR0, 4);
1058c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SDHC1_IPG_GATE] = imx_clk_gate("sdhc1_ipg_gate", "ipg", CCM_PCCR0, 5);
1068c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SCC_IPG_GATE] = imx_clk_gate("scc_ipg_gate", "ipg", CCM_PCCR0, 6);
1078c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SAHARA_IPG_GATE] = imx_clk_gate("sahara_ipg_gate", "ipg", CCM_PCCR0, 7);
1088c2ecf20Sopenharmony_ci	clk[IMX27_CLK_RTIC_IPG_GATE] = imx_clk_gate("rtic_ipg_gate", "ipg", CCM_PCCR0, 8);
1098c2ecf20Sopenharmony_ci	clk[IMX27_CLK_RTC_IPG_GATE] = imx_clk_gate("rtc_ipg_gate", "ipg", CCM_PCCR0, 9);
1108c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PWM_IPG_GATE] = imx_clk_gate("pwm_ipg_gate", "ipg", CCM_PCCR0, 11);
1118c2ecf20Sopenharmony_ci	clk[IMX27_CLK_OWIRE_IPG_GATE] = imx_clk_gate("owire_ipg_gate", "ipg", CCM_PCCR0, 12);
1128c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MSHC_IPG_GATE] = imx_clk_gate("mshc_ipg_gate", "ipg", CCM_PCCR0, 13);
1138c2ecf20Sopenharmony_ci	clk[IMX27_CLK_LCDC_IPG_GATE] = imx_clk_gate("lcdc_ipg_gate", "ipg", CCM_PCCR0, 14);
1148c2ecf20Sopenharmony_ci	clk[IMX27_CLK_KPP_IPG_GATE] = imx_clk_gate("kpp_ipg_gate", "ipg", CCM_PCCR0, 15);
1158c2ecf20Sopenharmony_ci	clk[IMX27_CLK_IIM_IPG_GATE] = imx_clk_gate("iim_ipg_gate", "ipg", CCM_PCCR0, 16);
1168c2ecf20Sopenharmony_ci	clk[IMX27_CLK_I2C2_IPG_GATE] = imx_clk_gate("i2c2_ipg_gate", "ipg", CCM_PCCR0, 17);
1178c2ecf20Sopenharmony_ci	clk[IMX27_CLK_I2C1_IPG_GATE] = imx_clk_gate("i2c1_ipg_gate", "ipg", CCM_PCCR0, 18);
1188c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPT6_IPG_GATE] = imx_clk_gate("gpt6_ipg_gate", "ipg", CCM_PCCR0, 19);
1198c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPT5_IPG_GATE] = imx_clk_gate("gpt5_ipg_gate", "ipg", CCM_PCCR0, 20);
1208c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPT4_IPG_GATE] = imx_clk_gate("gpt4_ipg_gate", "ipg", CCM_PCCR0, 21);
1218c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPT3_IPG_GATE] = imx_clk_gate("gpt3_ipg_gate", "ipg", CCM_PCCR0, 22);
1228c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPT2_IPG_GATE] = imx_clk_gate("gpt2_ipg_gate", "ipg", CCM_PCCR0, 23);
1238c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPT1_IPG_GATE] = imx_clk_gate("gpt1_ipg_gate", "ipg", CCM_PCCR0, 24);
1248c2ecf20Sopenharmony_ci	clk[IMX27_CLK_GPIO_IPG_GATE] = imx_clk_gate("gpio_ipg_gate", "ipg", CCM_PCCR0, 25);
1258c2ecf20Sopenharmony_ci	clk[IMX27_CLK_FEC_IPG_GATE] = imx_clk_gate("fec_ipg_gate", "ipg", CCM_PCCR0, 26);
1268c2ecf20Sopenharmony_ci	clk[IMX27_CLK_EMMA_IPG_GATE] = imx_clk_gate("emma_ipg_gate", "ipg", CCM_PCCR0, 27);
1278c2ecf20Sopenharmony_ci	clk[IMX27_CLK_DMA_IPG_GATE] = imx_clk_gate("dma_ipg_gate", "ipg", CCM_PCCR0, 28);
1288c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CSPI3_IPG_GATE] = imx_clk_gate("cspi3_ipg_gate", "ipg", CCM_PCCR0, 29);
1298c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CSPI2_IPG_GATE] = imx_clk_gate("cspi2_ipg_gate", "ipg", CCM_PCCR0, 30);
1308c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CSPI1_IPG_GATE] = imx_clk_gate("cspi1_ipg_gate", "ipg", CCM_PCCR0, 31);
1318c2ecf20Sopenharmony_ci	clk[IMX27_CLK_MSHC_BAUD_GATE] = imx_clk_gate("mshc_baud_gate", "mshc_div", CCM_PCCR1, 2);
1328c2ecf20Sopenharmony_ci	clk[IMX27_CLK_NFC_BAUD_GATE] = imx_clk_gate("nfc_baud_gate", "nfc_div", CCM_PCCR1,  3);
1338c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI2_BAUD_GATE] = imx_clk_gate("ssi2_baud_gate", "ssi2_div", CCM_PCCR1,  4);
1348c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SSI1_BAUD_GATE] = imx_clk_gate("ssi1_baud_gate", "ssi1_div", CCM_PCCR1,  5);
1358c2ecf20Sopenharmony_ci	clk[IMX27_CLK_VPU_BAUD_GATE] = imx_clk_gate("vpu_baud_gate", "vpu_div", CCM_PCCR1,  6);
1368c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER4_GATE] = imx_clk_gate("per4_gate", "per4_div", CCM_PCCR1,  7);
1378c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER3_GATE] = imx_clk_gate("per3_gate", "per3_div", CCM_PCCR1,  8);
1388c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER2_GATE] = imx_clk_gate("per2_gate", "per2_div", CCM_PCCR1,  9);
1398c2ecf20Sopenharmony_ci	clk[IMX27_CLK_PER1_GATE] = imx_clk_gate("per1_gate", "per1_div", CCM_PCCR1, 10);
1408c2ecf20Sopenharmony_ci	clk[IMX27_CLK_USB_AHB_GATE] = imx_clk_gate("usb_ahb_gate", "ahb", CCM_PCCR1, 11);
1418c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SLCDC_AHB_GATE] = imx_clk_gate("slcdc_ahb_gate", "ahb", CCM_PCCR1, 12);
1428c2ecf20Sopenharmony_ci	clk[IMX27_CLK_SAHARA_AHB_GATE] = imx_clk_gate("sahara_ahb_gate", "ahb", CCM_PCCR1, 13);
1438c2ecf20Sopenharmony_ci	clk[IMX27_CLK_RTIC_AHB_GATE] = imx_clk_gate("rtic_ahb_gate", "ahb", CCM_PCCR1, 14);
1448c2ecf20Sopenharmony_ci	clk[IMX27_CLK_LCDC_AHB_GATE] = imx_clk_gate("lcdc_ahb_gate", "ahb", CCM_PCCR1, 15);
1458c2ecf20Sopenharmony_ci	clk[IMX27_CLK_VPU_AHB_GATE] = imx_clk_gate("vpu_ahb_gate", "ahb", CCM_PCCR1, 16);
1468c2ecf20Sopenharmony_ci	clk[IMX27_CLK_FEC_AHB_GATE] = imx_clk_gate("fec_ahb_gate", "ahb", CCM_PCCR1, 17);
1478c2ecf20Sopenharmony_ci	clk[IMX27_CLK_EMMA_AHB_GATE] = imx_clk_gate("emma_ahb_gate", "ahb", CCM_PCCR1, 18);
1488c2ecf20Sopenharmony_ci	clk[IMX27_CLK_EMI_AHB_GATE] = imx_clk_gate("emi_ahb_gate", "ahb", CCM_PCCR1, 19);
1498c2ecf20Sopenharmony_ci	clk[IMX27_CLK_DMA_AHB_GATE] = imx_clk_gate("dma_ahb_gate", "ahb", CCM_PCCR1, 20);
1508c2ecf20Sopenharmony_ci	clk[IMX27_CLK_CSI_AHB_GATE] = imx_clk_gate("csi_ahb_gate", "ahb", CCM_PCCR1, 21);
1518c2ecf20Sopenharmony_ci	clk[IMX27_CLK_BROM_AHB_GATE] = imx_clk_gate("brom_ahb_gate", "ahb", CCM_PCCR1, 22);
1528c2ecf20Sopenharmony_ci	clk[IMX27_CLK_ATA_AHB_GATE] = imx_clk_gate("ata_ahb_gate", "ahb", CCM_PCCR1, 23);
1538c2ecf20Sopenharmony_ci	clk[IMX27_CLK_WDOG_IPG_GATE] = imx_clk_gate("wdog_ipg_gate", "ipg", CCM_PCCR1, 24);
1548c2ecf20Sopenharmony_ci	clk[IMX27_CLK_USB_IPG_GATE] = imx_clk_gate("usb_ipg_gate", "ipg", CCM_PCCR1, 25);
1558c2ecf20Sopenharmony_ci	clk[IMX27_CLK_UART6_IPG_GATE] = imx_clk_gate("uart6_ipg_gate", "ipg", CCM_PCCR1, 26);
1568c2ecf20Sopenharmony_ci	clk[IMX27_CLK_UART5_IPG_GATE] = imx_clk_gate("uart5_ipg_gate", "ipg", CCM_PCCR1, 27);
1578c2ecf20Sopenharmony_ci	clk[IMX27_CLK_UART4_IPG_GATE] = imx_clk_gate("uart4_ipg_gate", "ipg", CCM_PCCR1, 28);
1588c2ecf20Sopenharmony_ci	clk[IMX27_CLK_UART3_IPG_GATE] = imx_clk_gate("uart3_ipg_gate", "ipg", CCM_PCCR1, 29);
1598c2ecf20Sopenharmony_ci	clk[IMX27_CLK_UART2_IPG_GATE] = imx_clk_gate("uart2_ipg_gate", "ipg", CCM_PCCR1, 30);
1608c2ecf20Sopenharmony_ci	clk[IMX27_CLK_UART1_IPG_GATE] = imx_clk_gate("uart1_ipg_gate", "ipg", CCM_PCCR1, 31);
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci	imx_check_clocks(clk, ARRAY_SIZE(clk));
1638c2ecf20Sopenharmony_ci
1648c2ecf20Sopenharmony_ci	clk_register_clkdev(clk[IMX27_CLK_CPU_DIV], NULL, "cpu0");
1658c2ecf20Sopenharmony_ci
1668c2ecf20Sopenharmony_ci	clk_prepare_enable(clk[IMX27_CLK_EMI_AHB_GATE]);
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci	imx_register_uart_clocks(7);
1698c2ecf20Sopenharmony_ci
1708c2ecf20Sopenharmony_ci	imx_print_silicon_rev("i.MX27", mx27_revision());
1718c2ecf20Sopenharmony_ci}
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_cistatic void __init mx27_clocks_init_dt(struct device_node *np)
1748c2ecf20Sopenharmony_ci{
1758c2ecf20Sopenharmony_ci	struct device_node *refnp;
1768c2ecf20Sopenharmony_ci	u32 fref = 26000000; /* default */
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci	for_each_compatible_node(refnp, NULL, "fixed-clock") {
1798c2ecf20Sopenharmony_ci		if (!of_device_is_compatible(refnp, "fsl,imx-osc26m"))
1808c2ecf20Sopenharmony_ci			continue;
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci		if (!of_property_read_u32(refnp, "clock-frequency", &fref)) {
1838c2ecf20Sopenharmony_ci			of_node_put(refnp);
1848c2ecf20Sopenharmony_ci			break;
1858c2ecf20Sopenharmony_ci		}
1868c2ecf20Sopenharmony_ci	}
1878c2ecf20Sopenharmony_ci
1888c2ecf20Sopenharmony_ci	ccm = of_iomap(np, 0);
1898c2ecf20Sopenharmony_ci
1908c2ecf20Sopenharmony_ci	_mx27_clocks_init(fref);
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci	clk_data.clks = clk;
1938c2ecf20Sopenharmony_ci	clk_data.clk_num = ARRAY_SIZE(clk);
1948c2ecf20Sopenharmony_ci	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
1958c2ecf20Sopenharmony_ci}
1968c2ecf20Sopenharmony_ciCLK_OF_DECLARE(imx27_ccm, "fsl,imx27-ccm", mx27_clocks_init_dt);
197