Commit b6a4226c authored by Paul Walmsley's avatar Paul Walmsley
Browse files

ARM: OMAP2+: common: remove mach-omap2/common.c globals and map_common_io code



Get rid of the mach-omap2/common.c globals by moving the global
initialization for IP block addresses that must occur early into
mach-omap2/io.c.  In the process, remove the *_map_common_io*() and
SoC-specific *set_globals* functions.

Signed-off-by: default avatarPaul Walmsley <paul@pwsan.com>
Tested-by: default avatarVaibhav Hiremath <hvaibhav@ti.com>
parent 76e0e16d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,5 +21,6 @@
#define AM33XX_SCM_BASE		0x44E10000
#define AM33XX_CTRL_BASE	AM33XX_SCM_BASE
#define AM33XX_PRCM_BASE	0x44E00000
#define AM33XX_TAP_BASE		(AM33XX_CTRL_BASE + 0x3FC)

#endif /* __ASM_ARCH_AM33XX_H */
+0 −183
Original line number Diff line number Diff line
@@ -14,196 +14,13 @@
 */
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/platform_data/dsp-omap.h>

#include <plat/vram.h>

#include "soc.h"
#include "iomap.h"
#include "common.h"
#include "clock.h"
#include "sdrc.h"
#include "control.h"
#include "omap-secure.h"

/* Global address base setup code */

static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
{
	omap2_set_globals_tap(omap2_globals);
	omap2_set_globals_sdrc(omap2_globals);
	omap2_set_globals_control(omap2_globals);
	omap2_set_globals_prcm(omap2_globals);
}

#if defined(CONFIG_SOC_OMAP2420)

static struct omap_globals omap242x_globals = {
	.class	= OMAP242X_CLASS,
	.tap	= OMAP2_L4_IO_ADDRESS(0x48014000),
	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
	.sms	= OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
};

void __init omap2_set_globals_242x(void)
{
	__omap2_set_globals(&omap242x_globals);
}

void __init omap242x_map_io(void)
{
	omap242x_map_common_io();
}
#endif

#if defined(CONFIG_SOC_OMAP2430)

static struct omap_globals omap243x_globals = {
	.class	= OMAP243X_CLASS,
	.tap	= OMAP2_L4_IO_ADDRESS(0x4900a000),
	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
	.sms	= OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
	.prm	= OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
	.cm	= OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
};

void __init omap2_set_globals_243x(void)
{
	__omap2_set_globals(&omap243x_globals);
}

void __init omap243x_map_io(void)
{
	omap243x_map_common_io();
}
#endif

#if defined(CONFIG_ARCH_OMAP3)

static struct omap_globals omap3_globals = {
	.class	= OMAP343X_CLASS,
	.tap	= OMAP2_L4_IO_ADDRESS(0x4830A000),
	.sdrc	= OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
	.sms	= OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
	.prm	= OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
	.cm	= OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
};

void __init omap2_set_globals_3xxx(void)
{
	__omap2_set_globals(&omap3_globals);
}

void __init omap3_map_io(void)
{
	omap34xx_map_common_io();
}

/*
 * Adjust TAP register base such that omap3_check_revision accesses the correct
 * TI81XX register for checking device ID (it adds 0x204 to tap base while
 * TI81XX DEVICE ID register is at offset 0x600 from control base).
 */
#define TI81XX_TAP_BASE		(TI81XX_CTRL_BASE + \
				TI81XX_CONTROL_DEVICE_ID - 0x204)

static struct omap_globals ti81xx_globals = {
	.class  = OMAP343X_CLASS,
	.tap    = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
	.ctrl   = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
	.prm    = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
	.cm     = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
};

void __init omap2_set_globals_ti81xx(void)
{
	__omap2_set_globals(&ti81xx_globals);
}

void __init ti81xx_map_io(void)
{
	omapti81xx_map_common_io();
}
#endif

#if defined(CONFIG_SOC_AM33XX)
#define AM33XX_TAP_BASE		(AM33XX_CTRL_BASE + \
				TI81XX_CONTROL_DEVICE_ID - 0x204)

static struct omap_globals am33xx_globals = {
	.class  = AM335X_CLASS,
	.tap    = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
	.ctrl   = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
	.prm    = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
	.cm     = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
};

void __init omap2_set_globals_am33xx(void)
{
	__omap2_set_globals(&am33xx_globals);
}

void __init am33xx_map_io(void)
{
	omapam33xx_map_common_io();
}
#endif

#if defined(CONFIG_ARCH_OMAP4)
static struct omap_globals omap4_globals = {
	.class	= OMAP443X_CLASS,
	.tap	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
	.ctrl_pad	= OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
	.prm	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
	.cm	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
	.prcm_mpu	= OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
};

void __init omap2_set_globals_443x(void)
{
	__omap2_set_globals(&omap4_globals);
}

void __init omap4_map_io(void)
{
	omap44xx_map_common_io();
}
#endif

#if defined(CONFIG_SOC_OMAP5)
static struct omap_globals omap5_globals = {
	.class	= OMAP54XX_CLASS,
	.tap	= OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
	.ctrl	= OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
	.ctrl_pad	= OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
	.prm	= OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
	.cm	= OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
	.cm2	= OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
	.prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
};

void __init omap2_set_globals_5xxx(void)
{
	omap2_set_globals_tap(&omap5_globals);
	omap2_set_globals_control(&omap5_globals);
	omap2_set_globals_prcm(&omap5_globals);
}

void __init omap5_map_io(void)
{
	omap5_map_common_io();
}
#endif

/*
 * Stub function for OMAP2 so that common files
 * continue to build when custom builds are used
+12 −100
Original line number Diff line number Diff line
@@ -43,54 +43,6 @@

#define OMAP_INTC_START		NR_IRQS

#ifdef CONFIG_SOC_OMAP2420
extern void omap242x_map_common_io(void);
#else
static inline void omap242x_map_common_io(void)
{
}
#endif

#ifdef CONFIG_SOC_OMAP2430
extern void omap243x_map_common_io(void);
#else
static inline void omap243x_map_common_io(void)
{
}
#endif

#ifdef CONFIG_ARCH_OMAP3
extern void omap34xx_map_common_io(void);
#else
static inline void omap34xx_map_common_io(void)
{
}
#endif

#ifdef CONFIG_SOC_TI81XX
extern void omapti81xx_map_common_io(void);
#else
static inline void omapti81xx_map_common_io(void)
{
}
#endif

#ifdef CONFIG_SOC_AM33XX
extern void omapam33xx_map_common_io(void);
#else
static inline void omapam33xx_map_common_io(void)
{
}
#endif

#ifdef CONFIG_ARCH_OMAP4
extern void omap44xx_map_common_io(void);
#else
static inline void omap44xx_map_common_io(void)
{
}
#endif

#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
int omap2_pm_init(void);
#else
@@ -127,14 +79,6 @@ static inline int omap_mux_late_init(void)
}
#endif

#ifdef CONFIG_SOC_OMAP5
extern void omap5_map_common_io(void);
#else
static inline void omap5_map_common_io(void)
{
}
#endif

extern void omap2_init_common_infrastructure(void);

extern struct sys_timer omap2_timer;
@@ -169,50 +113,18 @@ void omap4430_init_late(void);
int omap2_common_pm_late_init(void);
void omap_prcm_restart(char, const char *);

/*
 * IO bases for various OMAP processors
 * Except the tap base, rest all the io bases
 * listed are physical addresses.
 */
struct omap_globals {
	u32		class;		/* OMAP class to detect */
	void __iomem	*tap;		/* Control module ID code */
	void __iomem	*sdrc;           /* SDRAM Controller */
	void __iomem	*sms;            /* SDRAM Memory Scheduler */
	void __iomem	*ctrl;           /* System Control Module */
	void __iomem	*ctrl_pad;	/* PAD Control Module */
	void __iomem	*prm;            /* Power and Reset Management */
	void __iomem	*cm;             /* Clock Management */
	void __iomem	*cm2;
	void __iomem	*prcm_mpu;
};

void omap2_set_globals_242x(void);
void omap2_set_globals_243x(void);
void omap2_set_globals_3xxx(void);
void omap2_set_globals_443x(void);
void omap2_set_globals_5xxx(void);
void omap2_set_globals_ti81xx(void);
void omap2_set_globals_am33xx(void);

/* These get called from omap2_set_globals_xxxx(), do not call these */
void omap2_set_globals_tap(struct omap_globals *);
#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
void omap2_set_globals_sdrc(struct omap_globals *);
#else
static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals)
{ }
#endif
void omap2_set_globals_control(struct omap_globals *);
void omap2_set_globals_prcm(struct omap_globals *);

void omap242x_map_io(void);
void omap243x_map_io(void);
void omap3_map_io(void);
void am33xx_map_io(void);
void omap4_map_io(void);
void omap5_map_io(void);
void ti81xx_map_io(void);
/* This gets called from mach-omap2/io.c, do not call this */
void __init omap2_set_globals_tap(u32 class, void __iomem *tap);

void __init omap242x_map_io(void);
void __init omap243x_map_io(void);
void __init omap3_map_io(void);
void __init am33xx_map_io(void);
void __init omap4_map_io(void);
void __init omap5_map_io(void);
void __init ti81xx_map_io(void);

/* omap_barriers_init() is OMAP4 only */
void omap_barriers_init(void);

/**
+4 −6
Original line number Diff line number Diff line
@@ -147,13 +147,11 @@ static struct omap3_control_regs control_context;
#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(struct omap_globals *omap2_globals)
void __init omap2_set_globals_control(void __iomem *ctrl,
				      void __iomem *ctrl_pad)
{
	if (omap2_globals->ctrl)
		omap2_ctrl_base = omap2_globals->ctrl;

	if (omap2_globals->ctrl_pad)
		omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
	omap2_ctrl_base = ctrl;
	omap4_ctrl_pad_base = ctrl_pad;
}

void __iomem *omap_ctrl_base_get(void)
+2 −0
Original line number Diff line number Diff line
@@ -414,6 +414,8 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
extern void omap3630_ctrl_disable_rta(void);
extern int omap3_ctrl_save_padconf(void);
extern void omap2_set_globals_control(void __iomem *ctrl,
				      void __iomem *ctrl_pad);
#else
#define omap_ctrl_base_get()		0
#define omap_ctrl_readb(x)		0
Loading