Clean up omap24xx.h symbolic constants
cover Clean up omap24xx.h symbolic constants
These patches clean up the symbolic constants defined in include/asm-arm/arch-omap/omap24xx.h. The names of some constants, like OMAP24XX_SDRC_BASE, denote that their values are the same on all OMAP24XX platforms. This isn't so - the constant is defined to different values depending on the Kconfig architecture parameters. Also, we'd eventually like to create kernels that can be used on both 2420 or 2430, with runtime CPU detection. These types of defines prevent that from happening.
Fix these defines by explicitly defining separate constants for both architectures, when the values are different. Use ifdefs to control which value is assigned to the "base name" of the constant.
So, to continue the example above, the OMAP24XX_SDRC_BASE constant will be removed, and replaced with two defines: OMAP2420_SDRC_BASE and OMAP243X_SDRC_BASE. Depending on which CONFIG_ARCH_OMAP* Kconfig parameter is specified, we then set an OMAP_SDRC_BASE define to point to one of the two architecture-specific values.
These patches are necessary prerequisites for the forthcoming PRCM cleanup series.
- Paul
PATCH 1/5 omap2: modify omap24xx.h to improve constant names and prepare for multi-arch kernels
Redo the defines in omap24xx.h to fix poorly-named defines, such as OMAP24XX_SDRC_BASE, which is different between 2420 and 2430. Also, prepare for future multi-architecture kernels by removing the architecture prefixes from several of the defines. (Presumably in the future these will be assigned to 'static void __iomem *'s by runtime init code depending on the CPU type.)
--- include/asm-arm/arch-omap/entry-macro.S | 2 include/asm-arm/arch-omap/io.h | 6 +- include/asm-arm/arch-omap/omap24xx.h | 74 +++++++++++++++++++++----------- 3 files changed, 53 insertions(+), 29 deletions(-)
include/asm-arm/arch-omap/io.h +3 -3
@@ -95,13 +95,13 @@#define io_v2p (va) ((va) - IO_OFFSET)/* Works for L3 and L4 */ /* DSP */ -#define DSP_MEM_24XX_PHYS OMAP24XX_DSP_MEM_BASE/* 0x58000000 */ +#define DSP_MEM_24XX_PHYS OMAP2420_DSP_MEM_BASE/* 0x58000000 */ #define DSP_MEM_24XX_VIRT 0xe0000000#define DSP_MEM_24XX_SIZE 0x28000 -#define DSP_IPI_24XX_PHYS OMAP24XX_DSP_IPI_BASE/* 0x59000000 */ +#define DSP_IPI_24XX_PHYS OMAP2420_DSP_IPI_BASE/* 0x59000000 */ #define DSP_IPI_24XX_VIRT 0xe1000000#define DSP_IPI_24XX_SIZE SZ_4K -#define DSP_MMU_24XX_PHYS OMAP24XX_DSP_MMU_BASE/* 0x5a000000 */ +#define DSP_MMU_24XX_PHYS OMAP2420_DSP_MMU_BASE/* 0x5a000000 */ #define DSP_MMU_24XX_VIRT 0xe2000000#define DSP_MMU_24XX_SIZE SZ_4K
include/asm-arm/arch-omap/omap24xx.h +49 -25
95 lines not on this page · raw message
include/asm-arm/arch-omap/entry-macro.S +1 -1
@@ -68,7 +68,7 @@ .endm .macro get_irqnr_and_base, irqnr, irqstat, base, tmp - ldr \base, =VA_IC_BASE + ldr \base, =OMAP2_VA_IC_BASE ldr \irqnr, [\base, #0x98] /* IRQ pending reg 1 */ cmp \irqnr, #0x0 bne 2222f
PATCH 2/5 omap2: use OMAP2_32KSYNCT_BASE in place of OMAP24XX_32KSYNCT_BASE
In reply to Paul WalmsleyChange users of OMAP24XX_32KSYNCT_BASE to use OMAP2_32KSYNCT_BASE, in preparation to remove OMAP24XX_32KSYNCT_BASE. Convert the 32K sync timer reference in pm.c to use a symbolic constant rather than a magic number. Remove the OMAP24XX_32KSYNCT_BASE define.
--- arch/arm/mach-omap2/pm.c | 2 +- arch/arm/mach-omap2/sram-fn.S | 2 +- arch/arm/plat-omap/common.c | 2 +- arch/arm/plat-omap/timer32k.c | 2 +- include/asm-arm/arch-omap/omap24xx.h | 1 - 5 files changed, 4 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/pm.c +1 -1
@@ -158,7 +158,7 @@ static inline u32 prcm_read_reg(int idx)static u32 omap2_read_32k_sync_counter (void ) { -return omap_readl (0x48004010 ); +return omap_readl (OMAP2_32KSYNCT_BASE +0x0010 ); }#ifdef CONFIG_PM_DEBUG
arch/arm/mach-omap2/sram-fn.S +1 -1
@@ -29,7 +29,7 @@ #include "prcm-regs.h" -#define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP24XX_32KSYNCT_BASE + 0x010) +#define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010) #define CM_CLKSEL2_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x544) #define PRCM_VOLTCTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x050)
arch/arm/plat-omap/common.c +1 -1
@@ -192,7 +192,7 @@ console_initcall(omap_add_serial_console#if defined(CONFIG_ARCH_OMAP16XX )#define TIMER_32K_SYNCHRONIZED 0xfffbc410#elif defined(CONFIG_ARCH_OMAP24XX ) -#define TIMER_32K_SYNCHRONIZED (OMAP24XX_32KSYNCT_BASE + 0x10) +#define TIMER_32K_SYNCHRONIZED (OMAP2_32KSYNCT_BASE + 0x10)#endif #ifdef TIMER_32K_SYNCHRONIZED
arch/arm/plat-omap/timer32k.c +1 -1
@@ -71,7 +71,7 @@ struct sys_timer omap_timer;#if defined(CONFIG_ARCH_OMAP16XX )#define TIMER_32K_SYNCHRONIZED 0xfffbc410#elif defined(CONFIG_ARCH_OMAP24XX ) -#define TIMER_32K_SYNCHRONIZED (OMAP24XX_32KSYNCT_BASE + 0x10) +#define TIMER_32K_SYNCHRONIZED (OMAP2_32KSYNCT_BASE + 0x10)#else #error OMAP 32KHz timer does not currently work on 15XX!#endif
include/asm-arm/arch-omap/omap24xx.h +0 -1
@@ -73,7 +73,6 @@#endif /* Temporary defines to be cleaned up in following patches */ -#define OMAP24XX_32KSYNCT_BASE OMAP2_32KSYNCT_BASE#define OMAP24XX_SDRC_BASE OMAP2_SDRC_BASE#define OMAP24XX_PRCM_BASE OMAP2_PRCM_BASE#define OMAP24XX_CTRL_BASE OMAP2_CTRL_BASE
PATCH 3/5 omap2: use OMAP2_PRCM_BASE in place of OMAP24XX_PRCM_BASE
In reply to Paul WalmsleyChange users of OMAP24XX_PRCM_BASE to use OMAP2_PRCM_BASE. Remove the OMAP24XX_PRCM_BASE define.
--- arch/arm/mach-omap2/mmu.c | 3 ++- arch/arm/mach-omap2/pm.c | 2 +- arch/arm/mach-omap2/prcm-regs.h | 2 +- arch/arm/mach-omap2/sram-fn.S | 12 ++++++------ include/asm-arm/arch-omap/omap24xx.h | 1 - 5 files changed, 10 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/mmu.c +2 -1
@@ -96,7 +96,8 @@ static int exmap_setup_preserved_entriesexmap_setup_preserved_mem_page (mmu, dspvect_page,DSP_INIT_PAGE , n++); -exmap_setup_iomap_page (mmu,OMAP24XX_PRCM_BASE ,0x7000 , n++); +/* REVISIT: This will need to be revisited for 3430 */ +exmap_setup_iomap_page (mmu,OMAP2_PRCM_BASE ,0x7000 , n++);exmap_setup_iomap_page (mmu,OMAP24XX_MAILBOX_BASE ,0x11000 , n++);if (cpu_is_omap2420 ()) {
arch/arm/mach-omap2/pm.c +1 -1
@@ -144,7 +144,7 @@ static void (*omap2_sram_idle)(void);static void (*omap2_sram_suspend)(int dllctrl);static void (*saved_idle)(void ); -static u32 prcm_base =IO_ADDRESS (OMAP24XX_PRCM_BASE ); +static u32 prcm_base =IO_ADDRESS (OMAP2_PRCM_BASE );static inline void prcm_write_reg (int idx,u32 val) {
arch/arm/mach-omap2/prcm-regs.h +1 -1
@@ -29,7 +29,7 @@#ifndef __ASSEMBLER__ -#define PRCM_REG32 (offset) __REG32(OMAP24XX_PRCM_BASE + (offset)) +#define PRCM_REG32 (offset) __REG32(OMAP2_PRCM_BASE + (offset))#define PRCM_REVISION PRCM_REG32(0x000)#define PRCM_SYSCONFIG PRCM_REG32(0x010)
arch/arm/mach-omap2/sram-fn.S +6 -6
@@ -31,12 +31,12 @@ #define TIMER_32KSYNCT_CR_V IO_ADDRESS(OMAP2_32KSYNCT_BASE + 0x010) -#define CM_CLKSEL2_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x544) -#define PRCM_VOLTCTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x050) -#define PRCM_CLKCFG_CTRL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x080) -#define CM_CLKEN_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x500) -#define CM_IDLEST_CKGEN_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x520) -#define CM_CLKSEL1_PLL_V IO_ADDRESS(OMAP24XX_PRCM_BASE + 0x540) +#define CM_CLKSEL2_PLL_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x544) +#define PRCM_VOLTCTRL_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x050) +#define PRCM_CLKCFG_CTRL_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x080) +#define CM_CLKEN_PLL_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x500) +#define CM_IDLEST_CKGEN_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x520) +#define CM_CLKSEL1_PLL_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x540) #define SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE + 0x060) #define SDRC_RFR_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE + 0x0a4)
include/asm-arm/arch-omap/omap24xx.h +0 -1
@@ -74,7 +74,6 @@/* Temporary defines to be cleaned up in following patches */ #define OMAP24XX_SDRC_BASE OMAP2_SDRC_BASE -#define OMAP24XX_PRCM_BASE OMAP2_PRCM_BASE#define OMAP24XX_CTRL_BASE OMAP2_CTRL_BASE#endif /* __ASM_ARCH_OMAP24XX_H */
PATCH 4/5 omap2: use OMAP2_SDRC_BASE in place of OMAP24XX_SDRC_BASE
In reply to Paul WalmsleyChange users of OMAP24XX_SDRC_BASE to use OMAP2_SDRC_BASE. Remove the OMAP24XX_SDRC_BASE define.
--- arch/arm/mach-omap2/prcm-regs.h | 14 +++++++------- arch/arm/mach-omap2/sleep.S | 10 ++++++---- arch/arm/mach-omap2/sram-fn.S | 4 ++-- include/asm-arm/arch-omap/io.h | 2 +- include/asm-arm/arch-omap/omap24xx.h | 1 - 5 files changed, 16 insertions(+), 15 deletions(-)
arch/arm/mach-omap2/prcm-regs.h +7 -7
@@ -199,7 +199,7 @@#define UART1_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6A054)#define UART2_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6C054)#define UART3_SYSCONFIG __REG32(OMAP24XX_L4_IO_BASE + 0x6E054) -#define SDRC_SYSCONFIG __REG32(OMAP24XX_SDRC_BASE + 0x10) +#define SDRC_SYSCONFIG __REG32(OMAP2_SDRC_BASE + 0x10)#define OMAP24XX_SMS_BASE (L3_24XX_BASE + 0x8000)#define SMS_SYSCONFIG __REG32(OMAP24XX_SMS_BASE + 0x10)#define SSI_SYSCONFIG __REG32(DISP_BASE + 0x8010)
@@ -263,12 +263,12 @@#define GPTIMER3_TISR __REG32(OMAP24XX_L4_IO_BASE + 0x78018)/* SDRC */ -#define SDRC_DLLA_CTRL __REG32(OMAP24XX_SDRC_BASE + 0x060) -#define SDRC_DLLA_STATUS __REG32(OMAP24XX_SDRC_BASE + 0x064) -#define SDRC_DLLB_CTRL __REG32(OMAP24XX_SDRC_BASE + 0x068) -#define SDRC_DLLB_STATUS __REG32(OMAP24XX_SDRC_BASE + 0x06C) -#define SDRC_POWER __REG32(OMAP24XX_SDRC_BASE + 0x070) -#define SDRC_MR_0 __REG32(OMAP24XX_SDRC_BASE + 0x084) +#define SDRC_DLLA_CTRL __REG32(OMAP2_SDRC_BASE + 0x060) +#define SDRC_DLLA_STATUS __REG32(OMAP2_SDRC_BASE + 0x064) +#define SDRC_DLLB_CTRL __REG32(OMAP2_SDRC_BASE + 0x068) +#define SDRC_DLLB_STATUS __REG32(OMAP2_SDRC_BASE + 0x06C) +#define SDRC_POWER __REG32(OMAP2_SDRC_BASE + 0x070) +#define SDRC_MR_0 __REG32(OMAP2_SDRC_BASE + 0x084)/* GPIO 1 */ #define GPIO1_BASE GPIOX_BASE(1)
arch/arm/mach-omap2/sleep.S +6 -4
@@ -30,11 +30,13 @@ #include <asm/arch/io.h> #include <asm/arch/pm.h> -#define A_SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0x60) -#define A_SDRC_POWER_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0x70) -#define A_SDRC_RFR_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0xA4) +#include <asm/arch/omap24xx.h> + +#define A_SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP2_SDRC_BASE + 0x60) +#define A_SDRC_POWER_V IO_ADDRESS(OMAP2_SDRC_BASE + 0x70) +#define A_SDRC_RFR_CTRL_V IO_ADDRESS(OMAP2_SDRC_BASE + 0xA4) #define A_SDRC0_V (0xC0000000) -#define A_SDRC_MANUAL_V IO_ADDRESS(OMAP24XX_SDRC_BASE+0xA8) +#define A_SDRC_MANUAL_V IO_ADDRESS(OMAP2_SDRC_BASE + 0xA8) .text
arch/arm/mach-omap2/sram-fn.S +2 -2
@@ -38,8 +38,8 @@ #define CM_IDLEST_CKGEN_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x520) #define CM_CLKSEL1_PLL_V IO_ADDRESS(OMAP2_PRCM_BASE + 0x540) -#define SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE + 0x060) -#define SDRC_RFR_CTRL_V IO_ADDRESS(OMAP24XX_SDRC_BASE + 0x0a4) +#define SDRC_DLLA_CTRL_V IO_ADDRESS(OMAP2_SDRC_BASE + 0x060) +#define SDRC_RFR_CTRL_V IO_ADDRESS(OMAP2_SDRC_BASE + 0x0a4) .text
include/asm-arm/arch-omap/io.h +1 -1
@@ -80,7 +80,7 @@#define OMAP243X_GPMC_PHYS OMAP243X_GPMC_BASE/* 0x49000000 */ #define OMAP243X_GPMC_VIRT 0xFE000000#define OMAP243X_GPMC_SIZE SZ_1M -#define OMAP243X_SDRC_PHYS OMAP24XX_SDRC_BASE +#define OMAP243X_SDRC_PHYS OMAP243X_SDRC_BASE#define OMAP243X_SDRC_VIRT 0xFD000000#define OMAP243X_SDRC_SIZE SZ_1M#define OMAP243X_SMS_PHYS OMAP243X_SMS_BASE
include/asm-arm/arch-omap/omap24xx.h +0 -1
@@ -73,7 +73,6 @@#endif /* Temporary defines to be cleaned up in following patches */ -#define OMAP24XX_SDRC_BASE OMAP2_SDRC_BASE#define OMAP24XX_CTRL_BASE OMAP2_CTRL_BASE#endif /* __ASM_ARCH_OMAP24XX_H */
PATCH 5/5 omap2: use OMAP2_CTRL_BASE in place of OMAP24XX_CTRL_BASE
In reply to Paul WalmsleyChange users of OMAP24XX_CTRL_BASE to use OMAP2_CTRL_BASE. Remove the OMAP24XX_CTRL_BASE define.
--- arch/arm/mach-omap2/prcm-regs.h | 2 +- arch/arm/plat-omap/mux.c | 6 +++--- include/asm-arm/arch-omap/omap24xx.h | 3 --- 3 files changed, 4 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/prcm-regs.h +1 -1
@@ -350,7 +350,7 @@#endif /* IO CONFIG */ -#define CONTROL_REG32 (offset) __REG32(OMAP24XX_CTRL_BASE + (offset)) +#define CONTROL_REG32 (offset) __REG32(OMAP2_CTRL_BASE + (offset))#define CONTROL_PADCONF_SPI1_NCS2 CONTROL_REG32(0x104)#define CONTROL_PADCONF_SYS_XTALOUT CONTROL_REG32(0x134)#define CONTROL_PADCONF_UART1_RX CONTROL_REG32(0x0C8)
arch/arm/plat-omap/mux.c +3 -3
@@ -85,7 +85,7 @@ int __init_or_module omap_cfg_reg(const reg |=OMAP24XX_PULL_UP ;#if defined(CONFIG_OMAP_MUX_DEBUG ) || defined(CONFIG_OMAP_MUX_WARNINGS ) { -u8 orig =omap_readb (OMAP24XX_CTRL_BASE + cfg->mux_reg); +u8 orig =omap_readb (OMAP2_CTRL_BASE + cfg->mux_reg);u8 debug =0 ;#ifdef CONFIG_OMAP_MUX_DEBUG
@@ -95,11 +95,11 @@ int __init_or_module omap_cfg_reg(constif (debug || warn)printk ("MUX: setup %s (0x%08x): 0x%02x -> 0x%02x\n" , cfg->name, -OMAP24XX_CTRL_BASE + cfg->mux_reg, +OMAP2_CTRL_BASE + cfg->mux_reg, orig, reg); }#endif -omap_writeb (reg,OMAP24XX_CTRL_BASE + cfg->mux_reg); +omap_writeb (reg,OMAP2_CTRL_BASE + cfg->mux_reg);return 0 ; }
include/asm-arm/arch-omap/omap24xx.h +0 -3
@@ -72,8 +72,5 @@#error "Unknown architecture"#endif -/* Temporary defines to be cleaned up in following patches */ -#define OMAP24XX_CTRL_BASE OMAP2_CTRL_BASE -#endif /* __ASM_ARCH_OMAP24XX_H */