sm712.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /*
  2. * Silicon Motion SM712 frame buffer device
  3. *
  4. * Copyright (C) 2006 Silicon Motion Technology Corp.
  5. * Authors: Ge Wang, [email protected]
  6. * Boyod [email protected]
  7. *
  8. * Copyright (C) 2009 Lemote, Inc.
  9. * Author: Wu Zhangjin, [email protected]
  10. *
  11. * This file is subject to the terms and conditions of the GNU General Public
  12. * License. See the file COPYING in the main directory of this archive for
  13. * more details.
  14. */
  15. #define FB_ACCEL_SMI_LYNX 88
  16. #define SCREEN_X_RES 1024
  17. #define SCREEN_Y_RES_PC 768
  18. #define SCREEN_Y_RES_NETBOOK 600
  19. #define SCREEN_BPP 16
  20. #define dac_reg (0x3c8)
  21. #define dac_val (0x3c9)
  22. extern void __iomem *smtc_regbaseaddress;
  23. #define smtc_mmiowb(dat, reg) writeb(dat, smtc_regbaseaddress + reg)
  24. #define smtc_mmiorb(reg) readb(smtc_regbaseaddress + reg)
  25. #define SIZE_SR00_SR04 (0x04 - 0x00 + 1)
  26. #define SIZE_SR10_SR24 (0x24 - 0x10 + 1)
  27. #define SIZE_SR30_SR75 (0x75 - 0x30 + 1)
  28. #define SIZE_SR80_SR93 (0x93 - 0x80 + 1)
  29. #define SIZE_SRA0_SRAF (0xAF - 0xA0 + 1)
  30. #define SIZE_GR00_GR08 (0x08 - 0x00 + 1)
  31. #define SIZE_AR00_AR14 (0x14 - 0x00 + 1)
  32. #define SIZE_CR00_CR18 (0x18 - 0x00 + 1)
  33. #define SIZE_CR30_CR4D (0x4D - 0x30 + 1)
  34. #define SIZE_CR90_CRA7 (0xA7 - 0x90 + 1)
  35. static inline void smtc_crtcw(int reg, int val)
  36. {
  37. smtc_mmiowb(reg, 0x3d4);
  38. smtc_mmiowb(val, 0x3d5);
  39. }
  40. static inline void smtc_grphw(int reg, int val)
  41. {
  42. smtc_mmiowb(reg, 0x3ce);
  43. smtc_mmiowb(val, 0x3cf);
  44. }
  45. static inline void smtc_attrw(int reg, int val)
  46. {
  47. smtc_mmiorb(0x3da);
  48. smtc_mmiowb(reg, 0x3c0);
  49. smtc_mmiorb(0x3c1);
  50. smtc_mmiowb(val, 0x3c0);
  51. }
  52. static inline void smtc_seqw(int reg, int val)
  53. {
  54. smtc_mmiowb(reg, 0x3c4);
  55. smtc_mmiowb(val, 0x3c5);
  56. }
  57. static inline unsigned int smtc_seqr(int reg)
  58. {
  59. smtc_mmiowb(reg, 0x3c4);
  60. return smtc_mmiorb(0x3c5);
  61. }
  62. /* The next structure holds all information relevant for a specific video mode.
  63. */
  64. struct modeinit {
  65. int mmsizex;
  66. int mmsizey;
  67. int bpp;
  68. int hz;
  69. unsigned char init_misc;
  70. unsigned char init_sr00_sr04[SIZE_SR00_SR04];
  71. unsigned char init_sr10_sr24[SIZE_SR10_SR24];
  72. unsigned char init_sr30_sr75[SIZE_SR30_SR75];
  73. unsigned char init_sr80_sr93[SIZE_SR80_SR93];
  74. unsigned char init_sra0_sraf[SIZE_SRA0_SRAF];
  75. unsigned char init_gr00_gr08[SIZE_GR00_GR08];
  76. unsigned char init_ar00_ar14[SIZE_AR00_AR14];
  77. unsigned char init_cr00_cr18[SIZE_CR00_CR18];
  78. unsigned char init_cr30_cr4d[SIZE_CR30_CR4D];
  79. unsigned char init_cr90_cra7[SIZE_CR90_CRA7];
  80. };
  81. #ifdef __BIG_ENDIAN
  82. #define pal_rgb(r, g, b, val) (((r & 0xf800) >> 8) | \
  83. ((g & 0xe000) >> 13) | \
  84. ((g & 0x1c00) << 3) | \
  85. ((b & 0xf800) >> 3))
  86. #define big_addr 0x800000
  87. #define mmio_addr 0x00800000
  88. #define seqw17() smtc_seqw(0x17, 0x30)
  89. #define big_pixel_depth(p, d) {if (p == 24) {p = 32; d = 32; } }
  90. #define big_swap(p) ((p & 0xff00ff00 >> 8) | (p & 0x00ff00ff << 8))
  91. #else
  92. #define pal_rgb(r, g, b, val) val
  93. #define big_addr 0
  94. #define mmio_addr 0x00c00000
  95. #define seqw17() do { } while (0)
  96. #define big_pixel_depth(p, d) do { } while (0)
  97. #define big_swap(p) p
  98. #endif