Skip to contentSkip to conversation

Clean up omap24xx.h symbolic constants

PATCH In review Paul Walmsley 5 participants 12 messages May 16, 2007 – May 21, 2007

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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 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

#1 lore raw

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/io.h       |    6 +-
 include/asm-arm/arch-omap/omap24xx.h |   72 ++++++++++++++++++++++-----------
 2 files changed, 51 insertions(+), 27 deletions(-)
include/asm-arm/arch-omap/io.h +3 -3
index d2fe0d0..28ae4d9 100644
@@ -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 +48 -24

94 lines not on this page · raw message

Signature · 3 lines
1.5.1.3

-- 
#2 lore raw

PATCH 2/5 omap2: use OMAP24XX_32KSYNCT_BASE in place of OMAP_32KSYNCT_BASE

In reply to Paul Walmsley

Change users of OMAP24XX_32KSYNCT_BASE to use OMAP_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
index 13d05a5..0c84a18 100644
@@ -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(OMAP_32KSYNCT_BASE + 0x0010);
 }
 
 #ifdef CONFIG_PM_DEBUG
arch/arm/mach-omap2/sram-fn.S +1 -1
index b275766..9109b02 100644
@@ -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(OMAP_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
index e03ace4..e9ebdd8 100644
@@ -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		(OMAP_32KSYNCT_BASE + 0x10)
 #endif
 
 #ifdef	TIMER_32K_SYNCHRONIZED
arch/arm/plat-omap/timer32k.c +1 -1
index 2474597..10fa89d 100644
@@ -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		(OMAP_32KSYNCT_BASE + 0x10)
 #else
 #error OMAP 32KHz timer does not currently work on 15XX!
 #endif
include/asm-arm/arch-omap/omap24xx.h +0 -1
index 249438d..a56a431 100644
@@ -73,7 +73,6 @@
 #endif
 
 /* Temporary defines to be cleaned up in following patches */
-#define OMAP24XX_32KSYNCT_BASE	OMAP_32KSYNCT_BASE
 #define OMAP24XX_SDRC_BASE	SDRC_BASE
 #define OMAP24XX_PRCM_BASE	PRCM_BASE
 #define OMAP24XX_CTRL_BASE	CTRL_BASE
Signature · 3 lines
1.5.1.3

-- 
#3 lore raw

PATCH 3/5 omap2: use PRCM_BASE in place of OMAP24XX_PRCM_BASE

In reply to Paul Walmsley

Change users of OMAP24XX_PRCM_BASE to use PRCM_BASE. Remove the OMAP24XX_PRCM_BASE define.

---
 arch/arm/mach-omap2/mmu.c            |    2 +-
 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, 9 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/mmu.c +1 -1
index 2a52907..1f68d15 100644
@@ -96,7 +96,7 @@ static int exmap_setup_preserved_entries(struct omap_mmu *mmu)
 
 	exmap_setup_preserved_mem_page(mmu, dspvect_page, DSP_INIT_PAGE, n++);
 
-	exmap_setup_iomap_page(mmu, OMAP24XX_PRCM_BASE, 0x7000, n++);
+	exmap_setup_iomap_page(mmu, 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
index 0c84a18..ad70280 100644
@@ -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(PRCM_BASE);
 
 static inline void prcm_write_reg(int idx, u32 val)
 {
arch/arm/mach-omap2/prcm-regs.h +1 -1
index 4672a2c..c5bb9b6 100644
@@ -29,7 +29,7 @@
 
 #ifndef __ASSEMBLER__
 
-#define PRCM_REG32(offset)	__REG32(OMAP24XX_PRCM_BASE + (offset))
+#define PRCM_REG32(offset)	__REG32(PRCM_BASE + (offset))
 
 #define PRCM_REVISION		PRCM_REG32(0x000)
 #define PRCM_SYSCONFIG		PRCM_REG32(0x010)
arch/arm/mach-omap2/sram-fn.S +6 -6
index 9109b02..c9c53e6 100644
@@ -31,12 +31,12 @@
 
 #define TIMER_32KSYNCT_CR_V	IO_ADDRESS(OMAP_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(PRCM_BASE + 0x544)
+#define PRCM_VOLTCTRL_V		IO_ADDRESS(PRCM_BASE + 0x050)
+#define PRCM_CLKCFG_CTRL_V	IO_ADDRESS(PRCM_BASE + 0x080)
+#define CM_CLKEN_PLL_V		IO_ADDRESS(PRCM_BASE + 0x500)
+#define CM_IDLEST_CKGEN_V	IO_ADDRESS(PRCM_BASE + 0x520)
+#define CM_CLKSEL1_PLL_V	IO_ADDRESS(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
index a56a431..5f5b40b 100644
@@ -74,7 +74,6 @@
 
 /* Temporary defines to be cleaned up in following patches */
 #define OMAP24XX_SDRC_BASE	SDRC_BASE
-#define OMAP24XX_PRCM_BASE	PRCM_BASE
 #define OMAP24XX_CTRL_BASE	CTRL_BASE
 
 #endif /* __ASM_ARCH_OMAP24XX_H */
Signature · 3 lines
1.5.1.3

-- 
#4 lore raw

PATCH 4/5 omap2: use SDRC_BASE in place of OMAP24XX_SDRC_BASE

In reply to Paul Walmsley

Change users of OMAP24XX_SDRC_BASE to use 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
index c5bb9b6..3c0688c 100644
@@ -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(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(SDRC_BASE + 0x060)
+#define SDRC_DLLA_STATUS	__REG32(SDRC_BASE + 0x064)
+#define SDRC_DLLB_CTRL		__REG32(SDRC_BASE + 0x068)
+#define SDRC_DLLB_STATUS	__REG32(SDRC_BASE + 0x06C)
+#define SDRC_POWER		__REG32(SDRC_BASE + 0x070)
+#define SDRC_MR_0		__REG32(SDRC_BASE + 0x084)
 
 /* GPIO 1 */
 #define GPIO1_BASE		GPIOX_BASE(1)
arch/arm/mach-omap2/sleep.S +6 -4
index a67bc18..ce9005d 100644
@@ -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(SDRC_BASE + 0x60)
+#define	A_SDRC_POWER_V		IO_ADDRESS(SDRC_BASE + 0x70)
+#define A_SDRC_RFR_CTRL_V	IO_ADDRESS(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(SDRC_BASE + 0xA8)
 
 	.text
 
arch/arm/mach-omap2/sram-fn.S +2 -2
index c9c53e6..3fe3a34 100644
@@ -38,8 +38,8 @@
 #define CM_IDLEST_CKGEN_V	IO_ADDRESS(PRCM_BASE + 0x520)
 #define CM_CLKSEL1_PLL_V	IO_ADDRESS(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(SDRC_BASE + 0x060)
+#define SDRC_RFR_CTRL_V		IO_ADDRESS(SDRC_BASE + 0x0a4)
 
 	.text
 
include/asm-arm/arch-omap/io.h +1 -1
index 28ae4d9..403b707 100644
@@ -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
index 5f5b40b..fd9d48b 100644
@@ -73,7 +73,6 @@
 #endif
 
 /* Temporary defines to be cleaned up in following patches */
-#define OMAP24XX_SDRC_BASE	SDRC_BASE
 #define OMAP24XX_CTRL_BASE	CTRL_BASE
 
 #endif /* __ASM_ARCH_OMAP24XX_H */
Signature · 3 lines
1.5.1.3

-- 
#5 lore raw

PATCH 5/5 omap2: use CTRL_BASE in place of OMAP24XX_CTRL_BASE

In reply to Paul Walmsley

Change users of OMAP24XX_CTRL_BASE to use 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 |    2 --
 3 files changed, 4 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/prcm-regs.h +1 -1
index 3c0688c..a6842cb 100644
@@ -350,7 +350,7 @@
 #endif
 
 /* IO CONFIG */
-#define CONTROL_REG32(offset)		__REG32(OMAP24XX_CTRL_BASE + (offset))
+#define CONTROL_REG32(offset)		__REG32(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
index 8b987b4..b40083f 100644
@@ -85,7 +85,7 @@ int __init_or_module omap_cfg_reg(const unsigned long index)
 			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(CTRL_BASE + cfg->mux_reg);
 			u8 debug = 0;
 
 #ifdef	CONFIG_OMAP_MUX_DEBUG
@@ -95,11 +95,11 @@ int __init_or_module omap_cfg_reg(const unsigned long index)
 			if (debug || warn)
 				printk("MUX: setup %s (0x%08x): 0x%02x -> 0x%02x\n",
 						cfg->name,
-						OMAP24XX_CTRL_BASE + cfg->mux_reg,
+						CTRL_BASE + cfg->mux_reg,
 						orig, reg);
 		}
 #endif
-		omap_writeb(reg, OMAP24XX_CTRL_BASE + cfg->mux_reg);
+		omap_writeb(reg, CTRL_BASE + cfg->mux_reg);
 
 		return 0;
 	}
include/asm-arm/arch-omap/omap24xx.h +0 -2
index fd9d48b..9c8c959 100644
@@ -72,8 +72,6 @@
 #error "Unknown architecture"
 #endif
 
-/* Temporary defines to be cleaned up in following patches */
-#define OMAP24XX_CTRL_BASE	CTRL_BASE
 
 #endif /* __ASM_ARCH_OMAP24XX_H */
 
Signature · 3 lines
1.5.1.3

-- 
#6 lore raw
In reply to Paul Walmsley

Hello,

Quoted 7 lines · Paul Walmsley

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 SDRC_BASE define to point to one of the two architecture-specific values.

IMHO, using of SDRC_BASE as well as CTRL_BASE, PRCM_BASE etc., can lead to name collision, the names is not so unique as may seem. I suggest using of OMAP_ prefix for these names.

Regards,
Dmitry

maintainer
#7 lore raw
Quoted 10 lines · Dmitry Krivoschekov

Hello,

Quoted 7 lines · Paul Walmsley

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 SDRC_BASE define to point to one of the two architecture-specific values.

Quoted 3 lines

IMHO, using of SDRC_BASE as well as CTRL_BASE, PRCM_BASE etc., can lead to name collision, the names is not so unique as may seem. I suggest using of OMAP_ prefix for these names.

Good point. We could use OMAP_ prefix and in case of conflicts with omap1 defines, we could rename them to have OMAP1_ prefix.

Regards,

Tony

#8 lore raw

Hi:

IMHO, using of SDRC_BASE as well as CTRL_BASE, PRCM_BASE etc.,

Quoted 6 lines
Quoted 2 lines

can lead to name collision, the names is not so unique as may seem. I suggest using of OMAP_ prefix for these names.

Good point. We could use OMAP_ prefix and in case of conflicts with omap1 defines, we could rename them to have OMAP1_ prefix.

When we started with 3430 developments we had similar issues. Our approach was,

OMAP3_prefix : If the Macro is defined and valid for 3430 only OMAP2_prefix : If its valid only for OMAP2

	OMAP242x_prefix :	for 2420 specific
	OMAP243x_prefix : for 2430 specific	

OMAP1_prefix : for all OMAP1 platforms, but we didn't change any, thinking it might break previous programs. OMAP_prefix : Generic for all OMAP platforms.

It's better if we follow some kind of standard and pass it as a review comment for any patches from now on.

Other alternative is to use Peripheral version in OMAP. Example:

OMAP1 has DMA version 3
OMAP2 has DMA version 4
OMAP3 has DMA version 4

So define a macro for DMA as

OMAP_DMA3_yyyyyy : for all OMAPs where DMA version 3 is used (like OMAPV1030, OMAP1710, OMAP1610, etc)

OMAP_DMA4_yyyyyy : for all OMAPs where DMA version 4 is used (like OMAP3430 2430 2420, etc).

Similar thing can be adopted for SPI, McBSP, I2C, and other peripherals of OMAP.

Regards,
Khasim

maintainer
#9 lore raw
Quoted 12 lines · Syed Mohammed, Khasim

Hi:

IMHO, using of SDRC_BASE as well as CTRL_BASE, PRCM_BASE etc.,

Quoted 6 lines
Quoted 2 lines

can lead to name collision, the names is not so unique as may seem. I suggest using of OMAP_ prefix for these names.

Good point. We could use OMAP_ prefix and in case of conflicts with omap1 defines, we could rename them to have OMAP1_ prefix.

When we started with 3430 developments we had similar issues. Our approach was,

Quoted 8 lines

OMAP3_prefix : If the Macro is defined and valid for 3430 only OMAP2_prefix : If its valid only for OMAP2

	OMAP242x_prefix :	for 2420 specific
	OMAP243x_prefix : for 2430 specific	

OMAP1_prefix : for all OMAP1 platforms, but we didn't change any, thinking it might break previous programs. OMAP_prefix : Generic for all OMAP platforms.

It's better if we follow some kind of standard and pass it as a review comment for any patches from now on.

Maybe just use OMAP2_ prefix for defines common to all omaps >= 2 until we have have to rename some registers again?

Anybody have better ideas?

Quoted 6 lines

Other alternative is to use Peripheral version in OMAP. Example:

OMAP1 has DMA version 3
OMAP2 has DMA version 4
OMAP3 has DMA version 4

Quoted 7 lines

So define a macro for DMA as

OMAP_DMA3_yyyyyy : for all OMAPs where DMA version 3 is used (like OMAPV1030, OMAP1710, OMAP1610, etc)

OMAP_DMA4_yyyyyy : for all OMAPs where DMA version 4 is used (like OMAP3430 2430 2420, etc).

Similar thing can be adopted for SPI, McBSP, I2C, and other peripherals of OMAP.

Yeah this should be used where possible to keep the drivers working. I think omap I2C driver is already doing it.

Regards,

Tony

#10 lore raw
Quoted 6 lines

Maybe just use OMAP2_ prefix for defines common to all omaps >= 2 until we have have to rename some registers again?

Anybody have better ideas?

I agree with this approach, as most of the peripherals have same register offset and bit definitions.

Regards,
Khasim

#11 lore raw
Quoted 7 lines · Khasim
Quoted 5 lines

Maybe just use OMAP2_ prefix for defines common to all omaps >= 2 until we have have to rename some registers again?

Anybody have better ideas?

I agree with this approach, as most of the peripherals have same register offset and bit definitions.

Makes sense - I will respin the patches with this naming scheme.

- Paul