Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 166353bd authored by Paul Walmsley's avatar Paul Walmsley
Browse files

OMAP3: control/PRCM: add omap3_ctrl_write_boot_mode()



Get rid of the open-coded scratchpad write in mach-omap2/prcm.c and
replace it with an actual API, omap3_ctrl_write_boot_mode().  While
there, get rid of the gratuitous omap_writel().

There's not much documentation available for what should wind up in
the scratchpad here, so more documentation would be appreciated.
Also, at some point, we should formalize our treatment of the scratchpad;
right now, accesses to the scratchpad are not well-documented.

Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Reviewed-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
Tested-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
Tested-by: default avatarSantosh Shilimkar <santosh.shilimkar@ti.com>
parent dc0b3a70
Loading
Loading
Loading
Loading
+31 −0
Original line number Original line Diff line number Diff line
@@ -209,6 +209,37 @@ void omap4_ctrl_pad_writel(u32 val, u16 offset)
	__raw_writel(val, OMAP4_CTRL_PAD_REGADDR(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

#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
#if defined(CONFIG_ARCH_OMAP3) && defined(CONFIG_PM)
/*
/*
 * Clears the scratchpad contents in case of cold boot-
 * Clears the scratchpad contents in case of cold boot-
+1 −0
Original line number Original line Diff line number Diff line
@@ -357,6 +357,7 @@ extern u32 *get_omap3630_restore_pointer(void);
extern u32 omap3_arm_context[128];
extern u32 omap3_arm_context[128];
extern void omap3_control_save_context(void);
extern void omap3_control_save_context(void);
extern void omap3_control_restore_context(void);
extern void omap3_control_restore_context(void);
extern void omap3_ctrl_write_boot_mode(u8 bootmode);
extern void omap3630_ctrl_disable_rta(void);
extern void omap3630_ctrl_disable_rta(void);
#else
#else
#define omap_ctrl_base_get()		0
#define omap_ctrl_base_get()		0
+1 −9
Original line number Original line Diff line number Diff line
@@ -143,16 +143,8 @@ void omap_prcm_arch_reset(char mode, const char *cmd)


		prcm_offs = WKUP_MOD;
		prcm_offs = WKUP_MOD;
	} else if (cpu_is_omap34xx()) {
	} else if (cpu_is_omap34xx()) {
		u32 l;

		prcm_offs = OMAP3430_GR_MOD;
		prcm_offs = OMAP3430_GR_MOD;
		l = ('B' << 24) | ('M' << 16) | (cmd ? (u8)*cmd : 0);
		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
		/* 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. */
		omap_writel(l, OMAP343X_SCRATCHPAD + 4);
	} else if (cpu_is_omap44xx())
	} else if (cpu_is_omap44xx())
		prcm_offs = OMAP4430_PRM_DEVICE_MOD;
		prcm_offs = OMAP4430_PRM_DEVICE_MOD;
	else
	else