vcma9.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * (C) Copyright 2002
  3. * David Mueller, ELSOFT AG, d.mueller@elsoft.ch
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. *
  23. */
  24. /****************************************************************************
  25. * Global routines used for VCMA9
  26. *****************************************************************************/
  27. #include <s3c2410.h>
  28. extern int mem_test(unsigned long start, unsigned long ramsize,int mode);
  29. void print_vcma9_info(void);
  30. #if (CONFIG_COMMANDS & CFG_CMD_NAND)
  31. typedef enum {
  32. NFCE_LOW,
  33. NFCE_HIGH
  34. } NFCE_STATE;
  35. static inline void NF_Conf(u16 conf)
  36. {
  37. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  38. nand->NFCONF = conf;
  39. }
  40. static inline void NF_Cmd(u8 cmd)
  41. {
  42. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  43. nand->NFCMD = cmd;
  44. }
  45. static inline void NF_CmdW(u8 cmd)
  46. {
  47. NF_Cmd(cmd);
  48. udelay(1);
  49. }
  50. static inline void NF_Addr(u8 addr)
  51. {
  52. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  53. nand->NFADDR = addr;
  54. }
  55. static inline void NF_SetCE(NFCE_STATE s)
  56. {
  57. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  58. switch (s) {
  59. case NFCE_LOW:
  60. nand->NFCONF &= ~(1<<11);
  61. break;
  62. case NFCE_HIGH:
  63. nand->NFCONF |= (1<<11);
  64. break;
  65. }
  66. }
  67. static inline void NF_WaitRB(void)
  68. {
  69. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  70. while (!(nand->NFSTAT & (1<<0)));
  71. }
  72. static inline void NF_Write(u8 data)
  73. {
  74. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  75. nand->NFDATA = data;
  76. }
  77. static inline u8 NF_Read(void)
  78. {
  79. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  80. return(nand->NFDATA);
  81. }
  82. static inline void NF_Init_ECC(void)
  83. {
  84. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  85. nand->NFCONF |= (1<<12);
  86. }
  87. static inline u32 NF_Read_ECC(void)
  88. {
  89. S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
  90. return(nand->NFECC);
  91. }
  92. #endif
  93. #define PLD_BASE_ADDRESS 0x2C000100
  94. #define PLD_ID_REG (PLD_BASE_ADDRESS + 0)
  95. #define PLD_NIC_REG (PLD_BASE_ADDRESS + 1)
  96. #define PLD_CAN_REG (PLD_BASE_ADDRESS + 2)
  97. #define PLD_MISC_REG (PLD_BASE_ADDRESS + 3)
  98. #define PLD_GPCD_REG (PLD_BASE_ADDRESS + 4)
  99. #define PLD_BOARD_REG (PLD_BASE_ADDRESS + 5)