|
@@ -843,3 +843,92 @@ int __init omap1_clk_init(void)
|
|
|
*/
|
|
|
{
|
|
|
unsigned pll_ctl_val = omap_readw(DPLL_CTL);
|
|
|
+
|
|
|
+ ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
|
|
|
+ if (pll_ctl_val & 0x10) {
|
|
|
+ /* PLL enabled, apply multiplier and divisor */
|
|
|
+ if (pll_ctl_val & 0xf80)
|
|
|
+ ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
|
|
|
+ ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
|
|
|
+ } else {
|
|
|
+ /* PLL disabled, apply bypass divisor */
|
|
|
+ switch (pll_ctl_val & 0xc) {
|
|
|
+ case 0:
|
|
|
+ break;
|
|
|
+ case 0x4:
|
|
|
+ ck_dpll1.rate /= 2;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ ck_dpll1.rate /= 4;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ propagate_rate(&ck_dpll1);
|
|
|
+ /* Cache rates for clocks connected to ck_ref (not dpll1) */
|
|
|
+ propagate_rate(&ck_ref);
|
|
|
+ omap1_show_rates();
|
|
|
+ if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
|
|
|
+ /* Select slicer output as OMAP input clock */
|
|
|
+ omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1,
|
|
|
+ OMAP7XX_PCC_UPLD_CTRL);
|
|
|
+ }
|
|
|
+
|
|
|
+ /* Amstrad Delta wants BCLK high when inactive */
|
|
|
+ if (machine_is_ams_delta())
|
|
|
+ omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
|
|
|
+ (1 << SDW_MCLK_INV_BIT),
|
|
|
+ ULPD_CLOCK_CTRL);
|
|
|
+
|
|
|
+ /* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
|
|
|
+ /* (on 730, bit 13 must not be cleared) */
|
|
|
+ if (cpu_is_omap7xx())
|
|
|
+ omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
|
|
|
+ else
|
|
|
+ omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
|
|
|
+
|
|
|
+ /* Put DSP/MPUI into reset until needed */
|
|
|
+ omap_writew(0, ARM_RSTCT1);
|
|
|
+ omap_writew(1, ARM_RSTCT2);
|
|
|
+ omap_writew(0x400, ARM_IDLECT1);
|
|
|
+
|
|
|
+ /*
|
|
|
+ * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
|
|
|
+ * of the ARM_IDLECT2 register must be set to zero. The power-on
|
|
|
+ * default value of this bit is one.
|
|
|
+ */
|
|
|
+ omap_writew(0x0000, ARM_IDLECT2); /* Turn LCD clock off also */
|
|
|
+
|
|
|
+ /*
|
|
|
+ * Only enable those clocks we will need, let the drivers
|
|
|
+ * enable other clocks as necessary
|
|
|
+ */
|
|
|
+ clk_enable(&armper_ck.clk);
|
|
|
+ clk_enable(&armxor_ck.clk);
|
|
|
+ clk_enable(&armtim_ck.clk); /* This should be done by timer code */
|
|
|
+
|
|
|
+ if (cpu_is_omap15xx())
|
|
|
+ clk_enable(&arm_gpio_ck);
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+#define OMAP1_DPLL1_SANE_VALUE 60000000
|
|
|
+
|
|
|
+void __init omap1_clk_late_init(void)
|
|
|
+{
|
|
|
+ unsigned long rate = ck_dpll1.rate;
|
|
|
+
|
|
|
+ /* Find the highest supported frequency and enable it */
|
|
|
+ if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
|
|
|
+ pr_err("System frequencies not set, using default. Check your config.\n");
|
|
|
+ /*
|
|
|
+ * Reprogramming the DPLL is tricky, it must be done from SRAM.
|
|
|
+ */
|
|
|
+ omap_sram_reprogram_clock(0x2290, 0x0005);
|
|
|
+ ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE;
|
|
|
+ }
|
|
|
+ propagate_rate(&ck_dpll1);
|
|
|
+ omap1_show_rates();
|
|
|
+ loops_per_jiffy = cpufreq_scale(loops_per_jiffy, rate, ck_dpll1.rate);
|
|
|
+}
|