void __init mxc_timer_init(struct clk *timer_clk, void __iomem *base, int irq) { uint32_t tctl_val; u32 reg; clk_enable(timer_clk); timer_base = base; /* * Initialise to a known state (all timers off, and timing reset) */ __raw_writel(0, timer_base + MXC_TCTL); __raw_writel(0, timer_base + MXC_TPRER); /* see datasheet note */ if (timer_is_v2()) { if (cpu_is_mx5() || cpu_is_mx6sl() || mx6q_revision() == IMX_CHIP_REVISION_1_0) tctl_val = V2_TCTL_CLK_PER | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; else { tctl_val = V2_TCTL_CLK_OSC_DIV8 | V2_TCTL_FRR | V2_TCTL_WAITEN | MXC_TCTL_TEN; if (!cpu_is_mx6q()) { reg = __raw_readl(timer_base + MXC_TPRER); reg |= (V2_TPRER_PRE24M_DIV8 << V2_TPRER_PRE24M_OFFSET); __raw_writel(reg, timer_base + MXC_TPRER); /* Enable the 24MHz input clock. */ tctl_val |= V2_TCTL_ENABLE24M; } } } else tctl_val = MX1_2_TCTL_FRR | MX1_2_TCTL_CLK_PCLK1 | MXC_TCTL_TEN; __raw_writel(tctl_val, timer_base + MXC_TCTL); /* init and register the timer to the framework */ mxc_clocksource_init(timer_clk); mxc_clockevent_init(timer_clk); /* Make irqs happen */ setup_irq(irq, &mxc_timer_irq); }
static int __init post_cpu_init(void) { void __iomem *base; unsigned int reg; struct clk *gpcclk = clk_get(NULL, "gpc_dvfs_clk"); int iram_size = IRAM_SIZE; if (!cpu_is_mx5()) return 0; if (cpu_is_mx51()) { mipi_hsc_disable(); #if defined(CONFIG_MXC_SECURITY_SCC) || defined(CONFIG_MXC_SECURITY_SCC_MODULE) iram_size -= SCC_RAM_SIZE; #endif iram_init(MX51_IRAM_BASE_ADDR, iram_size); } else { iram_init(MX53_IRAM_BASE_ADDR, iram_size); } gpc_base = ioremap(MX53_BASE_ADDR(GPC_BASE_ADDR), SZ_4K); ccm_base = ioremap(MX53_BASE_ADDR(CCM_BASE_ADDR), SZ_4K); clk_enable(gpcclk); /* Setup the number of clock cycles to wait for SRPG * power up and power down requests. */ __raw_writel(0x010F0201, gpc_base + SRPG_ARM_PUPSCR); __raw_writel(0x010F0201, gpc_base + SRPG_NEON_PUPSCR); __raw_writel(0x00000008, gpc_base + SRPG_EMPGC0_PUPSCR); __raw_writel(0x00000008, gpc_base + SRPG_EMPGC1_PUPSCR); __raw_writel(0x01010101, gpc_base + SRPG_ARM_PDNSCR); __raw_writel(0x01010101, gpc_base + SRPG_NEON_PDNSCR); __raw_writel(0x00000018, gpc_base + SRPG_EMPGC0_PDNSCR); __raw_writel(0x00000018, gpc_base + SRPG_EMPGC1_PDNSCR); clk_disable(gpcclk); clk_put(gpcclk); /* Set ALP bits to 000. Set ALP_EN bit in Arm Memory Controller reg. */ arm_plat_base = ioremap(MX53_BASE_ADDR(ARM_BASE_ADDR), SZ_4K); reg = 0x8; __raw_writel(reg, arm_plat_base + CORTEXA8_PLAT_AMC); base = ioremap(MX53_BASE_ADDR(AIPS1_BASE_ADDR), SZ_4K); __raw_writel(0x0, base + 0x40); __raw_writel(0x0, base + 0x44); __raw_writel(0x0, base + 0x48); __raw_writel(0x0, base + 0x4C); reg = __raw_readl(base + 0x50) & 0x00FFFFFF; __raw_writel(reg, base + 0x50); iounmap(base); base = ioremap(MX53_BASE_ADDR(AIPS2_BASE_ADDR), SZ_4K); __raw_writel(0x0, base + 0x40); __raw_writel(0x0, base + 0x44); __raw_writel(0x0, base + 0x48); __raw_writel(0x0, base + 0x4C); reg = __raw_readl(base + 0x50) & 0x00FFFFFF; __raw_writel(reg, base + 0x50); iounmap(base); if (cpu_is_mx51() || cpu_is_mx53()) { /*Allow for automatic gating of the EMI internal clock. * If this is done, emi_intr CCGR bits should be set to 11. */ base = ioremap(MX53_BASE_ADDR(M4IF_BASE_ADDR), SZ_4K); reg = __raw_readl(base + 0x8c); reg &= ~0x1; __raw_writel(reg, base + 0x8c); iounmap(base); } if (cpu_is_mx50()) init_ddr_settings(); return 0; }