sm501.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* include/linux/sm501.h
  2. *
  3. * Copyright (c) 2006 Simtec Electronics
  4. * Ben Dooks <ben@simtec.co.uk>
  5. * Vincent Sanders <vince@simtec.co.uk>
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20. extern int sm501_unit_power(struct device *dev,
  21. unsigned int unit, unsigned int to);
  22. extern unsigned long sm501_set_clock(struct device *dev,
  23. int clksrc, unsigned long freq);
  24. extern unsigned long sm501_find_clock(struct device *dev,
  25. int clksrc, unsigned long req_freq);
  26. /* sm501_misc_control
  27. *
  28. * Modify the SM501's MISC_CONTROL register
  29. */
  30. extern int sm501_misc_control(struct device *dev,
  31. unsigned long set, unsigned long clear);
  32. /* sm501_modify_reg
  33. *
  34. * Modify a register in the SM501 which may be shared with other
  35. * drivers.
  36. */
  37. extern unsigned long sm501_modify_reg(struct device *dev,
  38. unsigned long reg,
  39. unsigned long set,
  40. unsigned long clear);
  41. /* sm501_gpio_set
  42. *
  43. * set the state of the given GPIO line
  44. */
  45. extern void sm501_gpio_set(struct device *dev,
  46. unsigned long gpio,
  47. unsigned int to,
  48. unsigned int dir);
  49. /* sm501_gpio_get
  50. *
  51. * get the state of the given GPIO line
  52. */
  53. extern unsigned long sm501_gpio_get(struct device *dev,
  54. unsigned long gpio);
  55. /* Platform data definitions */
  56. #define SM501FB_FLAG_USE_INIT_MODE (1<<0)
  57. #define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
  58. #define SM501FB_FLAG_USE_HWCURSOR (1<<2)
  59. #define SM501FB_FLAG_USE_HWACCEL (1<<3)
  60. #define SM501FB_FLAG_PANEL_USE_FPEN (1<<4)
  61. #define SM501FB_FLAG_PANEL_USE_VBIASEN (1<<5)
  62. struct sm501_platdata_fbsub {
  63. struct fb_videomode *def_mode;
  64. unsigned int def_bpp;
  65. unsigned long max_mem;
  66. unsigned int flags;
  67. };
  68. enum sm501_fb_routing {
  69. SM501_FB_OWN = 0, /* CRT=>CRT, Panel=>Panel */
  70. SM501_FB_CRT_PANEL = 1, /* Panel=>CRT, Panel=>Panel */
  71. };
  72. /* sm501_platdata_fb flag field bit definitions */
  73. #define SM501_FBPD_SWAP_FB_ENDIAN (1<<0) /* need to endian swap */
  74. /* sm501_platdata_fb
  75. *
  76. * configuration data for the framebuffer driver
  77. */
  78. struct sm501_platdata_fb {
  79. enum sm501_fb_routing fb_route;
  80. unsigned int flags;
  81. struct sm501_platdata_fbsub *fb_crt;
  82. struct sm501_platdata_fbsub *fb_pnl;
  83. };
  84. /* gpio i2c */
  85. struct sm501_platdata_gpio_i2c {
  86. unsigned int pin_sda;
  87. unsigned int pin_scl;
  88. };
  89. /* sm501_initdata
  90. *
  91. * use for initialising values that may not have been setup
  92. * before the driver is loaded.
  93. */
  94. struct sm501_reg_init {
  95. unsigned long set;
  96. unsigned long mask;
  97. };
  98. #define SM501_USE_USB_HOST (1<<0)
  99. #define SM501_USE_USB_SLAVE (1<<1)
  100. #define SM501_USE_SSP0 (1<<2)
  101. #define SM501_USE_SSP1 (1<<3)
  102. #define SM501_USE_UART0 (1<<4)
  103. #define SM501_USE_UART1 (1<<5)
  104. #define SM501_USE_FBACCEL (1<<6)
  105. #define SM501_USE_AC97 (1<<7)
  106. #define SM501_USE_I2S (1<<8)
  107. #define SM501_USE_ALL (0xffffffff)
  108. struct sm501_initdata {
  109. struct sm501_reg_init gpio_low;
  110. struct sm501_reg_init gpio_high;
  111. struct sm501_reg_init misc_timing;
  112. struct sm501_reg_init misc_control;
  113. unsigned long devices;
  114. unsigned long mclk; /* non-zero to modify */
  115. unsigned long m1xclk; /* non-zero to modify */
  116. };
  117. /* sm501_init_gpio
  118. *
  119. * default gpio settings
  120. */
  121. struct sm501_init_gpio {
  122. struct sm501_reg_init gpio_data_low;
  123. struct sm501_reg_init gpio_data_high;
  124. struct sm501_reg_init gpio_ddr_low;
  125. struct sm501_reg_init gpio_ddr_high;
  126. };
  127. /* sm501_platdata
  128. *
  129. * This is passed with the platform device to allow the board
  130. * to control the behaviour of the SM501 driver(s) which attach
  131. * to the device.
  132. *
  133. */
  134. struct sm501_platdata {
  135. struct sm501_initdata *init;
  136. struct sm501_init_gpio *init_gpiop;
  137. struct sm501_platdata_fb *fb;
  138. struct sm501_platdata_gpio_i2c *gpio_i2c;
  139. unsigned int gpio_i2c_nr;
  140. };