ftsmc020.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * (C) Copyright 2009 Faraday Technology
  3. * Po-Yu Chuang <ratbert@faraday-tech.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19. /*
  20. * Static Memory Controller
  21. */
  22. #ifndef __FTSMC020_H
  23. #define __FTSMC020_H
  24. #ifndef __ASSEMBLY__
  25. struct ftsmc020 {
  26. struct {
  27. unsigned int cr; /* 0x00, 0x08, 0x10, 0x18 */
  28. unsigned int tpr; /* 0x04, 0x0c, 0x14, 0x1c */
  29. } bank[4];
  30. unsigned int pad[8]; /* 0x20 - 0x3c */
  31. unsigned int ssr; /* 0x40 */
  32. };
  33. void ftsmc020_init(void);
  34. #endif /* __ASSEMBLY__ */
  35. /*
  36. * Memory Bank Configuration Register
  37. */
  38. #define FTSMC020_BANK_ENABLE (1 << 28)
  39. #define FTSMC020_BANK_BASE(x) ((x) & 0x0fff1000)
  40. #define FTSMC020_BANK_WPROT (1 << 11)
  41. #define FTSMC020_BANK_SIZE_32K (0xb << 4)
  42. #define FTSMC020_BANK_SIZE_64K (0xc << 4)
  43. #define FTSMC020_BANK_SIZE_128K (0xd << 4)
  44. #define FTSMC020_BANK_SIZE_256K (0xe << 4)
  45. #define FTSMC020_BANK_SIZE_512K (0xf << 4)
  46. #define FTSMC020_BANK_SIZE_1M (0x0 << 4)
  47. #define FTSMC020_BANK_SIZE_2M (0x1 << 4)
  48. #define FTSMC020_BANK_SIZE_4M (0x2 << 4)
  49. #define FTSMC020_BANK_SIZE_8M (0x3 << 4)
  50. #define FTSMC020_BANK_SIZE_16M (0x4 << 4)
  51. #define FTSMC020_BANK_SIZE_32M (0x5 << 4)
  52. #define FTSMC020_BANK_MBW_8 (0x0 << 0)
  53. #define FTSMC020_BANK_MBW_16 (0x1 << 0)
  54. #define FTSMC020_BANK_MBW_32 (0x2 << 0)
  55. /*
  56. * Memory Bank Timing Parameter Register
  57. */
  58. #define FTSMC020_TPR_ETRNA(x) (((x) & 0xf) << 28)
  59. #define FTSMC020_TPR_EATI(x) (((x) & 0xf) << 24)
  60. #define FTSMC020_TPR_RBE (1 << 20)
  61. #define FTSMC020_TPR_AST(x) (((x) & 0x3) << 18)
  62. #define FTSMC020_TPR_CTW(x) (((x) & 0x3) << 16)
  63. #define FTSMC020_TPR_ATI(x) (((x) & 0xf) << 12)
  64. #define FTSMC020_TPR_AT2(x) (((x) & 0x3) << 8)
  65. #define FTSMC020_TPR_WTC(x) (((x) & 0x3) << 6)
  66. #define FTSMC020_TPR_AHT(x) (((x) & 0x3) << 4)
  67. #define FTSMC020_TPR_TRNA(x) (((x) & 0xf) << 0)
  68. #endif /* __FTSMC020_H */