proto2.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. #ifndef WIKIREADER_PROTO2_H
  2. #define WIKIREADER_PROTO2_H
  3. #define DISPLAY_INVERTED 1
  4. #define EEPROM_SST25VF040 1
  5. static inline int board_revision(void)
  6. {
  7. return 2;
  8. }
  9. /* this is the board support file for caiaq's 2nd prototype */
  10. static inline void init_pins(void)
  11. {
  12. /* P85: LCD_CS, P83: TFT_CTL1 */
  13. REG_P8_IOC8 = 0x28;
  14. REG_P8_03_CFP = 0x3f;
  15. REG_P8_45_CFP = 0x03;
  16. /* P65-67: SPI */
  17. REG_P6_47_CFP = 0x54;
  18. /* Serial interface */
  19. REG_P0_03_CFP = 0x05;
  20. /* LCD controller */
  21. REG_P8_03_CFP = 0x15;
  22. REG_P9_47_CFP = 0x55;
  23. /* board specific things */
  24. /* P13 & P14: debug LEDs */
  25. REG_P1_IOC1 = 0x18;
  26. /* SDCARD power */
  27. REG_P3_IOC3 = 0x0f;
  28. /* SDCARD CS# */
  29. REG_P5_03_CFP = 0x01;
  30. REG_MISC_PUP6 = (1 << 5);
  31. /* P50 & P52: CS lines */
  32. REG_P5_IOC5 = 0x07;
  33. /* use P64 and NMI pins for hardware watchdog logic */
  34. REG_P6_IOC6 = 0x18;
  35. REG_P6_P6D = 0x08;
  36. REG_P6_P6D = 0x18;
  37. }
  38. #ifdef INCLUDED_FROM_KERNEL
  39. static inline void power_off(void)
  40. {
  41. /* switch off condition: P64 high, P63 low */
  42. REG_P6_P6D = 0x10;
  43. }
  44. static inline void prepare_keys(void)
  45. {
  46. /* initial comparison is all buttons open */
  47. REG_KINTCOMP_SCPK0 = 0x00;
  48. /* enable mask for three buttons */
  49. REG_KINTCOMP_SMPK0 = 0x07;
  50. /* select P60/P61/P62 */
  51. REG_KINTSEL_SPPK01 = 0x04;
  52. /* only interested in KINT0 source */
  53. REG_INT_EK01_EP0_3 = 0x10;
  54. }
  55. static inline unsigned char get_key_state(void)
  56. {
  57. return REG_P6_P6D & 0x7;
  58. }
  59. #endif
  60. /* MRS command address for burst length=1, CAS latency = 2 */
  61. #define MRSREG (*(volatile unsigned char *) 0x10000442)
  62. #define RAMDUMMY (*(volatile unsigned char *) 0x10000000)
  63. /* setup for ESMT M52S128168A */
  64. static inline void init_ram(void)
  65. {
  66. int i;
  67. /* P20-P27 functions */
  68. REG_P2_03_CFP = 0x55;
  69. REG_P2_47_CFP = 0x55;
  70. REG_P5_03_CFP |= 0x80;
  71. /* P85 */
  72. REG_P8_45_CFP &= 0x03;
  73. /* disable write protection of clock registers */
  74. REG_CMU_PROTECT = 0x96;
  75. /* switch on SDRAM clk */
  76. REG_CMU_GATEDCLK0 |= 0x78;
  77. /* re-enable write protection of clock registers */
  78. REG_CMU_PROTECT = 0x00;
  79. /* enable SDRAMC application core */
  80. REG_SDRAMC_APP = 0x8000000b;
  81. /* set up SDRAM controller */
  82. /* 8M x 16 bits x 1, minimal possible timing */
  83. REG_SDRAMC_CTL = 0x22;
  84. /* disable RAM self-refresh, ... */
  85. REG_SDRAMC_REF = 0x8c | (0 << 23) | (0x7f << 16);
  86. /* SDRAM command sequence */
  87. for (i = 0; i < 4; i++) {
  88. REG_SDRAMC_INI = 0x12; /* PALL */
  89. RAMDUMMY = 0x0; /* dummy write */
  90. }
  91. for (i = 0; i < 4; i++) {
  92. REG_SDRAMC_INI = 0x11; /* INIREF */
  93. RAMDUMMY = 0x0; /* dummy write */
  94. }
  95. REG_SDRAMC_INI = 0x14; /* INIMRS */
  96. MRSREG = 0x0; /* dummy write */
  97. /* exit RAM setup mode */
  98. REG_SDRAMC_INI = 0x10;
  99. }
  100. #define enable_card_power() do { REG_P3_P3D |= (1 << 3); } while(0)
  101. #define disable_card_power() do { REG_P3_P3D &= ~(1 << 3); } while(0)
  102. #define SDCARD_CS_LO() do { REG_P5_P5D &= ~(1 << 0); } while (0)
  103. #define SDCARD_CS_HI() do { REG_P5_P5D |= (1 << 0); } while (0)
  104. #define EEPROM_WP_HI() do {} while (0)
  105. #define AVDD_MILLIVOLTS 2700
  106. #define ADC_SERIES_RESISTOR_K 220
  107. #define ADC_SHUNT_RESISTOR_K 1000
  108. #endif /* WIKIREADER_PROTO2_H */