s1c33e07.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #ifndef WIKIREADER_S1C33E07_H
  2. #define WIKIREADER_S1C33E07_H
  3. #define EEPROM_MP45PE80 1
  4. static inline int board_revision(void)
  5. {
  6. return 0;
  7. }
  8. static inline void init_pins(void)
  9. {
  10. #if 0 // not enough space for adding this
  11. // A low on pin P63 shuts down the power supply - so try
  12. // to keep it high, without any glitched or we will power down
  13. // immediately.
  14. // This _must_ be the setting performed.
  15. // p60-63: wdt - ensure that P63(#WDTNMI) pin is set high
  16. REG_P6_P6D |= (1 << 3); // P63 = 1 (for safety)
  17. REG_P6_03_CFP &= 0x3f; // P63 = input
  18. REG_MISC_PUP6 |= (1 << 3); // P63 pullup = on
  19. #endif
  20. /* P85: LCD_CS, P83: TFT_CTL1 */
  21. REG_P8_IOC8 = 0x28;
  22. REG_P8_03_CFP = 0x3f;
  23. REG_P8_45_CFP = 0x03;
  24. /* P65-67: SPI */
  25. REG_P6_47_CFP = 0x54;
  26. /* Serial interface */
  27. REG_P0_03_CFP = 0x05;
  28. /* LCD controller */
  29. REG_P8_03_CFP = 0x15;
  30. REG_P9_47_CFP = 0x55;
  31. /* board specific things */
  32. /* SDCARD CS# */
  33. REG_PA_IOC = (1 << 3);
  34. /* EEPROM WP# */
  35. REG_P1_IOC1 = (1 << 4);
  36. REG_P2_IOC2 = (1 << 6);
  37. /* P50 & P52: CS lines */
  38. REG_P5_IOC5 = 0x07;
  39. }
  40. /* MRS command address for burst length=1, CAS latency = 2 */
  41. #define MRSREG (*(volatile unsigned char *) 0x10000442)
  42. #define RAMDUMMY (*(volatile unsigned char *) 0x10000000)
  43. static inline void init_ram(void)
  44. {
  45. int i;
  46. /* P20-P27 functions */
  47. REG_P2_03_CFP = 0x55;
  48. REG_P2_47_CFP = 0x55;
  49. REG_P5_03_CFP |= 0x80;
  50. /* P85 */
  51. REG_P8_45_CFP &= 0x03;
  52. /* disable write protection of clock registers */
  53. REG_CMU_PROTECT = 0x96;
  54. /* switch on SDRAM clk */
  55. REG_CMU_GATEDCLK0 |= 0x78;
  56. /* re-enable write protection of clock registers */
  57. REG_CMU_PROTECT = 0x00;
  58. /* enable SDRAMC application core */
  59. REG_SDRAMC_APP = 0x8000000b;
  60. /* set up SDRAM controller */
  61. /* 4M x 16 bits x 1, 15 Trs/Trfc/Txsr cycles, 3 Tras, 2 Trp */
  62. //REG_SDRAMC_CTL = 0x37e1;
  63. REG_SDRAMC_CTL = 0x37e3;
  64. /* disable RAM self-refresh, ... */
  65. REG_SDRAMC_REF = 0x8c | (1 << 23) | (0x7f << 16);
  66. /* enter RAM setup mode */
  67. REG_SDRAMC_INI = 0x14;
  68. /* SDRAM command sequence: PALL - REF - REF - MRS (for MT48LC16M16A2) */
  69. REG_SDRAMC_INI = 0x12; /* INIPRE */
  70. RAMDUMMY = 0x0; /* dummy write */
  71. REG_SDRAMC_INI = 0x12; /* INIPRE */
  72. RAMDUMMY = 0x0; /* dummy write */
  73. for (i = 0; i < 2; i++) {
  74. REG_SDRAMC_INI = 0x11; /* INIREF */
  75. RAMDUMMY = 0x0; /* dummy write */
  76. }
  77. REG_SDRAMC_INI = 0x14; /* INIMRS */
  78. MRSREG = 0x0; /* dummy write */
  79. /* exit RAM setup mode */
  80. REG_SDRAMC_INI = 0x10;
  81. }
  82. static inline void enable_card_power(void)
  83. {
  84. REG_SRAMC_A0_BSL |= 1 << 1;
  85. *(volatile unsigned int *) 0x200000 = 0xffffffff;
  86. }
  87. static inline void disable_card_power(void)
  88. {
  89. REG_SRAMC_A0_BSL |= 1 << 1;
  90. *(volatile unsigned int *) 0x200000 = 0;
  91. }
  92. #define SDCARD_CS_LO() do { REG_PA_DATA &= ~(1 << 3); } while (0)
  93. #define SDCARD_CS_HI() do { REG_PA_DATA |= (1 << 3); } while (0)
  94. #define EEPROM_WP_HI() do { REG_P2_P2D = (1 << 6); } while (0)
  95. #define power_off() do {} while(0)
  96. #define prepare_keys() do {} while(0)
  97. #define get_key_state() 0
  98. #endif /* WIKIREADER_S1C33E07_H */