2008-03-18 04:02:50 -04:00
|
|
|
#ifndef __ARCH_ARM_MACH_OMAP2_SDRC_H
|
|
|
|
#define __ARCH_ARM_MACH_OMAP2_SDRC_H
|
|
|
|
|
|
|
|
/*
|
|
|
|
* OMAP2 SDRC register definitions
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 Texas Instruments, Inc.
|
|
|
|
* Copyright (C) 2007 Nokia Corporation
|
|
|
|
*
|
|
|
|
* Written by Paul Walmsley
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#undef DEBUG
|
|
|
|
|
2009-10-20 12:40:47 -04:00
|
|
|
#include <plat/sdrc.h>
|
2008-03-18 04:02:50 -04:00
|
|
|
|
|
|
|
#ifndef __ASSEMBLER__
|
2009-12-08 18:21:29 -05:00
|
|
|
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
2008-07-03 05:24:44 -04:00
|
|
|
extern void __iomem *omap2_sdrc_base;
|
|
|
|
extern void __iomem *omap2_sms_base;
|
2008-03-18 04:02:50 -04:00
|
|
|
|
2008-07-03 05:24:44 -04:00
|
|
|
#define OMAP_SDRC_REGADDR(reg) (omap2_sdrc_base + (reg))
|
|
|
|
#define OMAP_SMS_REGADDR(reg) (omap2_sms_base + (reg))
|
2008-03-18 04:02:50 -04:00
|
|
|
|
|
|
|
/* SDRC global register get/set */
|
|
|
|
|
|
|
|
static inline void sdrc_write_reg(u32 val, u16 reg)
|
|
|
|
{
|
|
|
|
__raw_writel(val, OMAP_SDRC_REGADDR(reg));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 sdrc_read_reg(u16 reg)
|
|
|
|
{
|
|
|
|
return __raw_readl(OMAP_SDRC_REGADDR(reg));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* SMS global register get/set */
|
|
|
|
|
|
|
|
static inline void sms_write_reg(u32 val, u16 reg)
|
|
|
|
{
|
|
|
|
__raw_writel(val, OMAP_SMS_REGADDR(reg));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline u32 sms_read_reg(u16 reg)
|
|
|
|
{
|
|
|
|
return __raw_readl(OMAP_SMS_REGADDR(reg));
|
|
|
|
}
|
|
|
|
#else
|
2009-10-19 18:25:31 -04:00
|
|
|
#define OMAP242X_SDRC_REGADDR(reg) \
|
|
|
|
OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
|
|
|
|
#define OMAP243X_SDRC_REGADDR(reg) \
|
|
|
|
OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
|
|
|
|
#define OMAP34XX_SDRC_REGADDR(reg) \
|
|
|
|
OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
|
2008-03-18 04:02:50 -04:00
|
|
|
#endif /* __ASSEMBLER__ */
|
|
|
|
|
2009-12-08 18:18:47 -05:00
|
|
|
/* Minimum frequency that the SDRC DLL can lock at */
|
|
|
|
#define MIN_SDRC_DLL_LOCK_FREQ 83000000
|
|
|
|
|
|
|
|
/* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
|
|
|
|
#define SDRC_MPURATE_SCALE 8
|
|
|
|
|
|
|
|
/* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
|
|
|
|
#define SDRC_MPURATE_BASE_SHIFT 9
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
|
|
|
|
* 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
|
|
|
|
*/
|
|
|
|
#define SDRC_MPURATE_LOOPS 96
|
|
|
|
|
2008-03-18 04:02:50 -04:00
|
|
|
#endif
|