Commit 3054c09b authored by Tony Lindgren's avatar Tony Lindgren

ARM: OMAP2: Fix _REGADDR macro offset calculations and cm.h for assembly

Make sure unexpected register offsets don't get calculated because of
(unlikely) macro parameter calculations. Also fix cm.h so it can be
included from assembly functions.
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6fd6f3bc
......@@ -14,12 +14,19 @@
* published by the Free Software Foundation.
*/
#include <linux/kernel.h>
#include <asm/io.h>
#include "prcm_common.h"
#define OMAP_CM_REGADDR(module, reg) (void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + module + reg)
#ifndef __ASSEMBLER__
#define OMAP_CM_REGADDR(module, reg) \
(void __iomem *)IO_ADDRESS(OMAP2_CM_BASE + (module) + (reg))
#else
#define OMAP2420_CM_REGADDR(module, reg) \
IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
#define OMAP2430_CM_REGADDR(module, reg) \
IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
#define OMAP34XX_CM_REGADDR(module, reg) \
IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
#endif
/*
* Architecture-specific global CM registers
......@@ -32,7 +39,7 @@
#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
#ifndef __ASSEMBLER__
/* Clock management global register get/set */
static void __attribute__((unused)) cm_write_reg(u32 val, void __iomem *addr)
......@@ -46,7 +53,7 @@ static u32 __attribute__((unused)) cm_read_reg(void __iomem *addr)
{
return __raw_readl(addr);
}
#endif
/*
* Module specific CM registers from CM_BASE + domain offset
......@@ -86,6 +93,7 @@ static u32 __attribute__((unused)) cm_read_reg(void __iomem *addr)
/* Clock management domain register get/set */
#ifndef __ASSEMBLER__
static void __attribute__((unused)) cm_write_mod_reg(u32 val, s16 module, s16 idx)
{
cm_write_reg(val, OMAP_CM_REGADDR(module, idx));
......@@ -95,6 +103,7 @@ static u32 __attribute__((unused)) cm_read_mod_reg(s16 module, s16 idx)
{
return cm_read_reg(OMAP_CM_REGADDR(module, idx));
}
#endif
/* CM register bits shared between 24XX and 3430 */
......
......@@ -19,7 +19,8 @@
#include "prcm_common.h"
#define OMAP_PRM_REGADDR(module, reg) (void __iomem *)IO_ADDRESS(OMAP2_PRM_BASE + module + reg)
#define OMAP_PRM_REGADDR(module, reg) \
(void __iomem *)IO_ADDRESS(OMAP2_PRM_BASE + (module) + (reg))
/*
* Architecture-specific global PRM registers
......
......@@ -15,15 +15,16 @@
*/
#undef DEBUG
#include <linux/kernel.h>
#include <asm/arch/sdrc.h>
#ifndef __ASSEMBLER__
extern unsigned long omap2_sdrc_base;
extern unsigned long omap2_sms_base;
#define OMAP_SDRC_REGADDR(reg) (void __iomem *)IO_ADDRESS(omap2_sdrc_base + reg)
#define OMAP_SMS_REGADDR(reg) (void __iomem *)IO_ADDRESS(omap2_sms_base + reg)
#define OMAP_SDRC_REGADDR(reg) \
(void __iomem *)IO_ADDRESS(omap2_sdrc_base + (reg))
#define OMAP_SMS_REGADDR(reg) \
(void __iomem *)IO_ADDRESS(omap2_sms_base + (reg))
/* SDRC global register get/set */
......@@ -54,7 +55,10 @@ static u32 __attribute__((unused)) sms_read_reg(u16 reg)
{
return __raw_readl(OMAP_SMS_REGADDR(reg));
}
#else
#define OMAP242X_SDRC_REGADDR(reg) IO_ADDRESS(OMAP242X_SDRC_BASE + (reg))
#define OMAP243X_SDRC_REGADDR(reg) IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
#define OMAP34XX_SDRC_REGADDR(reg) IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
#endif /* __ASSEMBLER__ */
#endif
......@@ -16,10 +16,6 @@
#include <asm/arch/io.h>
#define OMAP242X_SDRC_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP242X_SDRC_BASE + reg)
#define OMAP243X_SDRC_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP243X_SDRC_BASE + reg)
#define OMAP343X_SDRC_REGADDR(reg) (void __iomem *)IO_ADDRESS(OMAP343X_SDRC_BASE + reg)
/* SDRC register offsets - read/write with sdrc_{read,write}_reg() */
#define SDRC_SYSCONFIG 0x010
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment