sdrc.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef __ARCH_ARM_MACH_OMAP2_SDRC_H
  2. #define __ARCH_ARM_MACH_OMAP2_SDRC_H
  3. /*
  4. * OMAP2 SDRC register definitions
  5. *
  6. * Copyright (C) 2007 Texas Instruments, Inc.
  7. * Copyright (C) 2007 Nokia Corporation
  8. *
  9. * Written by Paul Walmsley
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #undef DEBUG
  16. #include <plat/sdrc.h>
  17. #ifndef __ASSEMBLER__
  18. #include <linux/io.h>
  19. extern void __iomem *omap2_sdrc_base;
  20. extern void __iomem *omap2_sms_base;
  21. #define OMAP_SDRC_REGADDR(reg) (omap2_sdrc_base + (reg))
  22. #define OMAP_SMS_REGADDR(reg) (omap2_sms_base + (reg))
  23. /* SDRC global register get/set */
  24. static inline void sdrc_write_reg(u32 val, u16 reg)
  25. {
  26. __raw_writel(val, OMAP_SDRC_REGADDR(reg));
  27. }
  28. static inline u32 sdrc_read_reg(u16 reg)
  29. {
  30. return __raw_readl(OMAP_SDRC_REGADDR(reg));
  31. }
  32. /* SMS global register get/set */
  33. static inline void sms_write_reg(u32 val, u16 reg)
  34. {
  35. __raw_writel(val, OMAP_SMS_REGADDR(reg));
  36. }
  37. static inline u32 sms_read_reg(u16 reg)
  38. {
  39. return __raw_readl(OMAP_SMS_REGADDR(reg));
  40. }
  41. #else
  42. #define OMAP242X_SDRC_REGADDR(reg) \
  43. OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE + (reg))
  44. #define OMAP243X_SDRC_REGADDR(reg) \
  45. OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE + (reg))
  46. #define OMAP34XX_SDRC_REGADDR(reg) \
  47. OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE + (reg))
  48. #endif /* __ASSEMBLER__ */
  49. /* Minimum frequency that the SDRC DLL can lock at */
  50. #define MIN_SDRC_DLL_LOCK_FREQ 83000000
  51. /* Scale factor for fixed-point arith in omap3_core_dpll_m2_set_rate() */
  52. #define SDRC_MPURATE_SCALE 8
  53. /* 2^SDRC_MPURATE_BASE_SHIFT: MPU MHz that SDRC_MPURATE_LOOPS is defined for */
  54. #define SDRC_MPURATE_BASE_SHIFT 9
  55. /*
  56. * SDRC_MPURATE_LOOPS: Number of MPU loops to execute at
  57. * 2^MPURATE_BASE_SHIFT MHz for SDRC to stabilize
  58. */
  59. #define SDRC_MPURATE_LOOPS 96
  60. #endif