|
@@ -531,3 +531,191 @@ static int omap_pm_read_proc(
|
|
|
"MPUI1510_CTRL_REG 0x%-8x \n"
|
|
|
"MPUI1510_DSP_STATUS_REG: 0x%-8x \n"
|
|
|
"MPUI1510_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
|
|
+ "MPUI1510_DSP_API_CONFIG_REG: 0x%-8x \n"
|
|
|
+ "MPUI1510_SDRAM_CONFIG_REG: 0x%-8x \n"
|
|
|
+ "MPUI1510_EMIFS_CONFIG_REG: 0x%-8x \n",
|
|
|
+ MPUI1510_SHOW(MPUI_CTRL),
|
|
|
+ MPUI1510_SHOW(MPUI_DSP_STATUS),
|
|
|
+ MPUI1510_SHOW(MPUI_DSP_BOOT_CONFIG),
|
|
|
+ MPUI1510_SHOW(MPUI_DSP_API_CONFIG),
|
|
|
+ MPUI1510_SHOW(EMIFF_SDRAM_CONFIG),
|
|
|
+ MPUI1510_SHOW(EMIFS_CONFIG));
|
|
|
+ } else if (cpu_is_omap16xx()) {
|
|
|
+ my_buffer_offset += sprintf(my_base + my_buffer_offset,
|
|
|
+ "MPUI1610_CTRL_REG 0x%-8x \n"
|
|
|
+ "MPUI1610_DSP_STATUS_REG: 0x%-8x \n"
|
|
|
+ "MPUI1610_DSP_BOOT_CONFIG_REG: 0x%-8x \n"
|
|
|
+ "MPUI1610_DSP_API_CONFIG_REG: 0x%-8x \n"
|
|
|
+ "MPUI1610_SDRAM_CONFIG_REG: 0x%-8x \n"
|
|
|
+ "MPUI1610_EMIFS_CONFIG_REG: 0x%-8x \n",
|
|
|
+ MPUI1610_SHOW(MPUI_CTRL),
|
|
|
+ MPUI1610_SHOW(MPUI_DSP_STATUS),
|
|
|
+ MPUI1610_SHOW(MPUI_DSP_BOOT_CONFIG),
|
|
|
+ MPUI1610_SHOW(MPUI_DSP_API_CONFIG),
|
|
|
+ MPUI1610_SHOW(EMIFF_SDRAM_CONFIG),
|
|
|
+ MPUI1610_SHOW(EMIFS_CONFIG));
|
|
|
+ }
|
|
|
+
|
|
|
+ g_read_completed++;
|
|
|
+ } else if (g_read_completed >= 1) {
|
|
|
+ *eof = 1;
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ g_read_completed++;
|
|
|
+
|
|
|
+ *my_first_byte = page_buffer;
|
|
|
+ return my_buffer_offset;
|
|
|
+}
|
|
|
+
|
|
|
+static void omap_pm_init_proc(void)
|
|
|
+{
|
|
|
+ /* XXX Appears to leak memory */
|
|
|
+ create_proc_read_entry("driver/omap_pm",
|
|
|
+ S_IWUSR | S_IRUGO, NULL,
|
|
|
+ omap_pm_read_proc, NULL);
|
|
|
+}
|
|
|
+
|
|
|
+#endif /* DEBUG && CONFIG_PROC_FS */
|
|
|
+
|
|
|
+/*
|
|
|
+ * omap_pm_prepare - Do preliminary suspend work.
|
|
|
+ *
|
|
|
+ */
|
|
|
+static int omap_pm_prepare(void)
|
|
|
+{
|
|
|
+ /* We cannot sleep in idle until we have resumed */
|
|
|
+ disable_hlt();
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * omap_pm_enter - Actually enter a sleep state.
|
|
|
+ * @state: State we're entering.
|
|
|
+ *
|
|
|
+ */
|
|
|
+
|
|
|
+static int omap_pm_enter(suspend_state_t state)
|
|
|
+{
|
|
|
+ switch (state)
|
|
|
+ {
|
|
|
+ case PM_SUSPEND_STANDBY:
|
|
|
+ case PM_SUSPEND_MEM:
|
|
|
+ omap1_pm_suspend();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * omap_pm_finish - Finish up suspend sequence.
|
|
|
+ *
|
|
|
+ * This is called after we wake back up (or if entering the sleep state
|
|
|
+ * failed).
|
|
|
+ */
|
|
|
+
|
|
|
+static void omap_pm_finish(void)
|
|
|
+{
|
|
|
+ enable_hlt();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+static irqreturn_t omap_wakeup_interrupt(int irq, void *dev)
|
|
|
+{
|
|
|
+ return IRQ_HANDLED;
|
|
|
+}
|
|
|
+
|
|
|
+static struct irqaction omap_wakeup_irq = {
|
|
|
+ .name = "peripheral wakeup",
|
|
|
+ .flags = IRQF_DISABLED,
|
|
|
+ .handler = omap_wakeup_interrupt
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+static const struct platform_suspend_ops omap_pm_ops = {
|
|
|
+ .prepare = omap_pm_prepare,
|
|
|
+ .enter = omap_pm_enter,
|
|
|
+ .finish = omap_pm_finish,
|
|
|
+ .valid = suspend_valid_only_mem,
|
|
|
+};
|
|
|
+
|
|
|
+static int __init omap_pm_init(void)
|
|
|
+{
|
|
|
+
|
|
|
+#ifdef CONFIG_OMAP_32K_TIMER
|
|
|
+ int error;
|
|
|
+#endif
|
|
|
+
|
|
|
+ if (!cpu_class_is_omap1())
|
|
|
+ return -ENODEV;
|
|
|
+
|
|
|
+ printk("Power Management for TI OMAP.\n");
|
|
|
+
|
|
|
+ /*
|
|
|
+ * We copy the assembler sleep/wakeup routines to SRAM.
|
|
|
+ * These routines need to be in SRAM as that's the only
|
|
|
+ * memory the MPU can see when it wakes up.
|
|
|
+ */
|
|
|
+ if (cpu_is_omap7xx()) {
|
|
|
+ omap_sram_suspend = omap_sram_push(omap7xx_cpu_suspend,
|
|
|
+ omap7xx_cpu_suspend_sz);
|
|
|
+ } else if (cpu_is_omap15xx()) {
|
|
|
+ omap_sram_suspend = omap_sram_push(omap1510_cpu_suspend,
|
|
|
+ omap1510_cpu_suspend_sz);
|
|
|
+ } else if (cpu_is_omap16xx()) {
|
|
|
+ omap_sram_suspend = omap_sram_push(omap1610_cpu_suspend,
|
|
|
+ omap1610_cpu_suspend_sz);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (omap_sram_suspend == NULL) {
|
|
|
+ printk(KERN_ERR "PM not initialized: Missing SRAM support\n");
|
|
|
+ return -ENODEV;
|
|
|
+ }
|
|
|
+
|
|
|
+ arm_pm_idle = omap1_pm_idle;
|
|
|
+
|
|
|
+ if (cpu_is_omap7xx())
|
|
|
+ setup_irq(INT_7XX_WAKE_UP_REQ, &omap_wakeup_irq);
|
|
|
+ else if (cpu_is_omap16xx())
|
|
|
+ setup_irq(INT_1610_WAKE_UP_REQ, &omap_wakeup_irq);
|
|
|
+
|
|
|
+ /* Program new power ramp-up time
|
|
|
+ * (0 for most boards since we don't lower voltage when in deep sleep)
|
|
|
+ */
|
|
|
+ omap_writew(ULPD_SETUP_ANALOG_CELL_3_VAL, ULPD_SETUP_ANALOG_CELL_3);
|
|
|
+
|
|
|
+ /* Setup ULPD POWER_CTRL_REG - enter deep sleep whenever possible */
|
|
|
+ omap_writew(ULPD_POWER_CTRL_REG_VAL, ULPD_POWER_CTRL);
|
|
|
+
|
|
|
+ /* Configure IDLECT3 */
|
|
|
+ if (cpu_is_omap7xx())
|
|
|
+ omap_writel(OMAP7XX_IDLECT3_VAL, OMAP7XX_IDLECT3);
|
|
|
+ else if (cpu_is_omap16xx())
|
|
|
+ omap_writel(OMAP1610_IDLECT3_VAL, OMAP1610_IDLECT3);
|
|
|
+
|
|
|
+ suspend_set_ops(&omap_pm_ops);
|
|
|
+
|
|
|
+#if defined(DEBUG) && defined(CONFIG_PROC_FS)
|
|
|
+ omap_pm_init_proc();
|
|
|
+#endif
|
|
|
+
|
|
|
+#ifdef CONFIG_OMAP_32K_TIMER
|
|
|
+ error = sysfs_create_file(power_kobj, &sleep_while_idle_attr.attr);
|
|
|
+ if (error)
|
|
|
+ printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
|
|
|
+#endif
|
|
|
+
|
|
|
+ if (cpu_is_omap16xx()) {
|
|
|
+ /* configure LOW_PWR pin */
|
|
|
+ omap_cfg_reg(T20_1610_LOW_PWR);
|
|
|
+ }
|
|
|
+
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+__initcall(omap_pm_init);
|