|
@@ -90,3 +90,182 @@ struct omap3_scratchpad_sdrc_block {
|
|
u16 dcdl_2_ctrl;
|
|
u16 dcdl_2_ctrl;
|
|
u32 flags;
|
|
u32 flags;
|
|
u32 block_size;
|
|
u32 block_size;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+void *omap3_secure_ram_storage;
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * This is used to store ARM registers in SDRAM before attempting
|
|
|
|
+ * an MPU OFF. The save and restore happens from the SRAM sleep code.
|
|
|
|
+ * The address is stored in scratchpad, so that it can be used
|
|
|
|
+ * during the restore path.
|
|
|
|
+ */
|
|
|
|
+u32 omap3_arm_context[128];
|
|
|
|
+
|
|
|
|
+struct omap3_control_regs {
|
|
|
|
+ u32 sysconfig;
|
|
|
|
+ u32 devconf0;
|
|
|
|
+ u32 mem_dftrw0;
|
|
|
|
+ u32 mem_dftrw1;
|
|
|
|
+ u32 msuspendmux_0;
|
|
|
|
+ u32 msuspendmux_1;
|
|
|
|
+ u32 msuspendmux_2;
|
|
|
|
+ u32 msuspendmux_3;
|
|
|
|
+ u32 msuspendmux_4;
|
|
|
|
+ u32 msuspendmux_5;
|
|
|
|
+ u32 sec_ctrl;
|
|
|
|
+ u32 devconf1;
|
|
|
|
+ u32 csirxfe;
|
|
|
|
+ u32 iva2_bootaddr;
|
|
|
|
+ u32 iva2_bootmod;
|
|
|
|
+ u32 debobs_0;
|
|
|
|
+ u32 debobs_1;
|
|
|
|
+ u32 debobs_2;
|
|
|
|
+ u32 debobs_3;
|
|
|
|
+ u32 debobs_4;
|
|
|
|
+ u32 debobs_5;
|
|
|
|
+ u32 debobs_6;
|
|
|
|
+ u32 debobs_7;
|
|
|
|
+ u32 debobs_8;
|
|
|
|
+ u32 prog_io0;
|
|
|
|
+ u32 prog_io1;
|
|
|
|
+ u32 dss_dpll_spreading;
|
|
|
|
+ u32 core_dpll_spreading;
|
|
|
|
+ u32 per_dpll_spreading;
|
|
|
|
+ u32 usbhost_dpll_spreading;
|
|
|
|
+ u32 pbias_lite;
|
|
|
|
+ u32 temp_sensor;
|
|
|
|
+ u32 sramldo4;
|
|
|
|
+ u32 sramldo5;
|
|
|
|
+ u32 csi;
|
|
|
|
+ u32 padconf_sys_nirq;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static struct omap3_control_regs control_context;
|
|
|
|
+#endif /* CONFIG_ARCH_OMAP3 && CONFIG_PM */
|
|
|
|
+
|
|
|
|
+#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
|
|
|
|
+#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg))
|
|
|
|
+
|
|
|
|
+void __init omap2_set_globals_control(void __iomem *ctrl,
|
|
|
|
+ void __iomem *ctrl_pad)
|
|
|
|
+{
|
|
|
|
+ omap2_ctrl_base = ctrl;
|
|
|
|
+ omap4_ctrl_pad_base = ctrl_pad;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void __iomem *omap_ctrl_base_get(void)
|
|
|
|
+{
|
|
|
|
+ return omap2_ctrl_base;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+u8 omap_ctrl_readb(u16 offset)
|
|
|
|
+{
|
|
|
|
+ return __raw_readb(OMAP_CTRL_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+u16 omap_ctrl_readw(u16 offset)
|
|
|
|
+{
|
|
|
|
+ return __raw_readw(OMAP_CTRL_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+u32 omap_ctrl_readl(u16 offset)
|
|
|
|
+{
|
|
|
|
+ return __raw_readl(OMAP_CTRL_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void omap_ctrl_writeb(u8 val, u16 offset)
|
|
|
|
+{
|
|
|
|
+ __raw_writeb(val, OMAP_CTRL_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void omap_ctrl_writew(u16 val, u16 offset)
|
|
|
|
+{
|
|
|
|
+ __raw_writew(val, OMAP_CTRL_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void omap_ctrl_writel(u32 val, u16 offset)
|
|
|
|
+{
|
|
|
|
+ __raw_writel(val, OMAP_CTRL_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * On OMAP4 control pad are not addressable from control
|
|
|
|
+ * core base. So the common omap_ctrl_read/write APIs breaks
|
|
|
|
+ * Hence export separate APIs to manage the omap4 pad control
|
|
|
|
+ * registers. This APIs will work only for OMAP4
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+u32 omap4_ctrl_pad_readl(u16 offset)
|
|
|
|
+{
|
|
|
|
+ return __raw_readl(OMAP4_CTRL_PAD_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void omap4_ctrl_pad_writel(u32 val, u16 offset)
|
|
|
|
+{
|
|
|
|
+ __raw_writel(val, OMAP4_CTRL_PAD_REGADDR(offset));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_ARCH_OMAP3
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap3_ctrl_write_boot_mode - set scratchpad boot mode for the next boot
|
|
|
|
+ * @bootmode: 8-bit value to pass to some boot code
|
|
|
|
+ *
|
|
|
|
+ * Set the bootmode in the scratchpad RAM. This is used after the
|
|
|
|
+ * system restarts. Not sure what actually uses this - it may be the
|
|
|
|
+ * bootloader, rather than the boot ROM - contrary to the preserved
|
|
|
|
+ * comment below. No return value.
|
|
|
|
+ */
|
|
|
|
+void omap3_ctrl_write_boot_mode(u8 bootmode)
|
|
|
|
+{
|
|
|
|
+ u32 l;
|
|
|
|
+
|
|
|
|
+ l = ('B' << 24) | ('M' << 16) | bootmode;
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * Reserve the first word in scratchpad for communicating
|
|
|
|
+ * with the boot ROM. A pointer to a data structure
|
|
|
|
+ * describing the boot process can be stored there,
|
|
|
|
+ * cf. OMAP34xx TRM, Initialization / Software Booting
|
|
|
|
+ * Configuration.
|
|
|
|
+ *
|
|
|
|
+ * XXX This should use some omap_ctrl_writel()-type function
|
|
|
|
+ */
|
|
|
|
+ __raw_writel(l, OMAP2_L4_IO_ADDRESS(OMAP343X_SCRATCHPAD + 4));
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap_ctrl_write_dsp_boot_addr - set boot address for a remote processor
|
|
|
|
+ * @bootaddr: physical address of the boot loader
|
|
|
|
+ *
|
|
|
|
+ * Set boot address for the boot loader of a supported processor
|
|
|
|
+ * when a power ON sequence occurs.
|
|
|
|
+ */
|
|
|
|
+void omap_ctrl_write_dsp_boot_addr(u32 bootaddr)
|
|
|
|
+{
|
|
|
|
+ u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTADDR :
|
|
|
|
+ cpu_is_omap34xx() ? OMAP343X_CONTROL_IVA2_BOOTADDR :
|
|
|
|
+ cpu_is_omap44xx() ? OMAP4_CTRL_MODULE_CORE_DSP_BOOTADDR :
|
|
|
|
+ 0;
|
|
|
|
+
|
|
|
|
+ if (!offset) {
|
|
|
|
+ pr_err("%s: unsupported omap type\n", __func__);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ omap_ctrl_writel(bootaddr, offset);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * omap_ctrl_write_dsp_boot_mode - set boot mode for a remote processor
|
|
|
|
+ * @bootmode: 8-bit value to pass to some boot code
|
|
|
|
+ *
|
|
|
|
+ * Sets boot mode for the boot loader of a supported processor
|
|
|
|
+ * when a power ON sequence occurs.
|
|
|
|
+ */
|
|
|
|
+void omap_ctrl_write_dsp_boot_mode(u8 bootmode)
|
|
|
|
+{
|
|
|
|
+ u32 offset = cpu_is_omap243x() ? OMAP243X_CONTROL_IVA2_BOOTMOD :
|