sm501.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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(int clksrc, unsigned long req_freq);
  25. /* sm501_misc_control
  26. *
  27. * Modify the SM501's MISC_CONTROL register
  28. */
  29. extern int sm501_misc_control(struct device *dev,
  30. unsigned long set, unsigned long clear);
  31. /* sm501_modify_reg
  32. *
  33. * Modify a register in the SM501 which may be shared with other
  34. * drivers.
  35. */
  36. extern unsigned long sm501_modify_reg(struct device *dev,
  37. unsigned long reg,
  38. unsigned long set,
  39. unsigned long clear);
  40. /* sm501_gpio_set
  41. *
  42. * set the state of the given GPIO line
  43. */
  44. extern void sm501_gpio_set(struct device *dev,
  45. unsigned long gpio,
  46. unsigned int to,
  47. unsigned int dir);
  48. /* sm501_gpio_get
  49. *
  50. * get the state of the given GPIO line
  51. */
  52. extern unsigned long sm501_gpio_get(struct device *dev,
  53. unsigned long gpio);
  54. /* Platform data definitions */
  55. #define SM501FB_FLAG_USE_INIT_MODE (1<<0)
  56. #define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
  57. #define SM501FB_FLAG_USE_HWCURSOR (1<<2)
  58. #define SM501FB_FLAG_USE_HWACCEL (1<<3)
  59. struct sm501_platdata_fbsub {
  60. struct fb_videomode *def_mode;
  61. unsigned int def_bpp;
  62. unsigned long max_mem;
  63. unsigned int flags;
  64. };
  65. enum sm501_fb_routing {
  66. SM501_FB_OWN = 0, /* CRT=>CRT, Panel=>Panel */
  67. SM501_FB_CRT_PANEL = 1, /* Panel=>CRT, Panel=>Panel */
  68. };
  69. /* sm501_platdata_fb flag field bit definitions */
  70. #define SM501_FBPD_SWAP_FB_ENDIAN (1<<0) /* need to endian swap */
  71. /* sm501_platdata_fb
  72. *
  73. * configuration data for the framebuffer driver
  74. */
  75. struct sm501_platdata_fb {
  76. enum sm501_fb_routing fb_route;
  77. unsigned int flags;
  78. struct sm501_platdata_fbsub *fb_crt;
  79. struct sm501_platdata_fbsub *fb_pnl;
  80. };
  81. /* gpio i2c */
  82. struct sm501_platdata_gpio_i2c {
  83. unsigned int pin_sda;
  84. unsigned int pin_scl;
  85. };
  86. /* sm501_initdata
  87. *
  88. * use for initialising values that may not have been setup
  89. * before the driver is loaded.
  90. */
  91. struct sm501_reg_init {
  92. unsigned long set;
  93. unsigned long mask;
  94. };
  95. #define SM501_USE_USB_HOST (1<<0)
  96. #define SM501_USE_USB_SLAVE (1<<1)
  97. #define SM501_USE_SSP0 (1<<2)
  98. #define SM501_USE_SSP1 (1<<3)
  99. #define SM501_USE_UART0 (1<<4)
  100. #define SM501_USE_UART1 (1<<5)
  101. #define SM501_USE_FBACCEL (1<<6)
  102. #define SM501_USE_AC97 (1<<7)
  103. #define SM501_USE_I2S (1<<8)
  104. #define SM501_USE_ALL (0xffffffff)
  105. struct sm501_initdata {
  106. struct sm501_reg_init gpio_low;
  107. struct sm501_reg_init gpio_high;
  108. struct sm501_reg_init misc_timing;
  109. struct sm501_reg_init misc_control;
  110. unsigned long devices;
  111. unsigned long mclk; /* non-zero to modify */
  112. unsigned long m1xclk; /* non-zero to modify */
  113. };
  114. /* sm501_init_gpio
  115. *
  116. * default gpio settings
  117. */
  118. struct sm501_init_gpio {
  119. struct sm501_reg_init gpio_data_low;
  120. struct sm501_reg_init gpio_data_high;
  121. struct sm501_reg_init gpio_ddr_low;
  122. struct sm501_reg_init gpio_ddr_high;
  123. };
  124. /* sm501_platdata
  125. *
  126. * This is passed with the platform device to allow the board
  127. * to control the behaviour of the SM501 driver(s) which attach
  128. * to the device.
  129. *
  130. */
  131. struct sm501_platdata {
  132. struct sm501_initdata *init;
  133. struct sm501_init_gpio *init_gpiop;
  134. struct sm501_platdata_fb *fb;
  135. struct sm501_platdata_gpio_i2c *gpio_i2c;
  136. unsigned int gpio_i2c_nr;
  137. };