sm501.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. /* Platform data definitions */
  42. #define SM501FB_FLAG_USE_INIT_MODE (1<<0)
  43. #define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
  44. #define SM501FB_FLAG_USE_HWCURSOR (1<<2)
  45. #define SM501FB_FLAG_USE_HWACCEL (1<<3)
  46. #define SM501FB_FLAG_PANEL_NO_FPEN (1<<4)
  47. #define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5)
  48. #define SM501FB_FLAG_PANEL_INV_FPEN (1<<6)
  49. #define SM501FB_FLAG_PANEL_INV_VBIASEN (1<<7)
  50. struct sm501_platdata_fbsub {
  51. struct fb_videomode *def_mode;
  52. unsigned int def_bpp;
  53. unsigned long max_mem;
  54. unsigned int flags;
  55. };
  56. enum sm501_fb_routing {
  57. SM501_FB_OWN = 0, /* CRT=>CRT, Panel=>Panel */
  58. SM501_FB_CRT_PANEL = 1, /* Panel=>CRT, Panel=>Panel */
  59. };
  60. /* sm501_platdata_fb flag field bit definitions */
  61. #define SM501_FBPD_SWAP_FB_ENDIAN (1<<0) /* need to endian swap */
  62. /* sm501_platdata_fb
  63. *
  64. * configuration data for the framebuffer driver
  65. */
  66. struct sm501_platdata_fb {
  67. enum sm501_fb_routing fb_route;
  68. unsigned int flags;
  69. struct sm501_platdata_fbsub *fb_crt;
  70. struct sm501_platdata_fbsub *fb_pnl;
  71. };
  72. /* gpio i2c
  73. *
  74. * Note, we have to pass in the bus number, as the number used will be
  75. * passed to the i2c-gpio driver's platform_device.id, subsequently used
  76. * to register the i2c bus.
  77. */
  78. struct sm501_platdata_gpio_i2c {
  79. unsigned int bus_num;
  80. unsigned int pin_sda;
  81. unsigned int pin_scl;
  82. int udelay;
  83. int timeout;
  84. };
  85. /* sm501_initdata
  86. *
  87. * use for initialising values that may not have been setup
  88. * before the driver is loaded.
  89. */
  90. struct sm501_reg_init {
  91. unsigned long set;
  92. unsigned long mask;
  93. };
  94. #define SM501_USE_USB_HOST (1<<0)
  95. #define SM501_USE_USB_SLAVE (1<<1)
  96. #define SM501_USE_SSP0 (1<<2)
  97. #define SM501_USE_SSP1 (1<<3)
  98. #define SM501_USE_UART0 (1<<4)
  99. #define SM501_USE_UART1 (1<<5)
  100. #define SM501_USE_FBACCEL (1<<6)
  101. #define SM501_USE_AC97 (1<<7)
  102. #define SM501_USE_I2S (1<<8)
  103. #define SM501_USE_GPIO (1<<9)
  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. #define SM501_FLAG_SUSPEND_OFF (1<<4)
  125. /* sm501_platdata
  126. *
  127. * This is passed with the platform device to allow the board
  128. * to control the behaviour of the SM501 driver(s) which attach
  129. * to the device.
  130. *
  131. */
  132. struct sm501_platdata {
  133. struct sm501_initdata *init;
  134. struct sm501_init_gpio *init_gpiop;
  135. struct sm501_platdata_fb *fb;
  136. int flags;
  137. int gpio_base;
  138. int (*get_power)(struct device *dev);
  139. int (*set_power)(struct device *dev, unsigned int on);
  140. struct sm501_platdata_gpio_i2c *gpio_i2c;
  141. unsigned int gpio_i2c_nr;
  142. };
  143. #if defined(CONFIG_PPC32)
  144. #define smc501_readl(addr) ioread32be((addr))
  145. #define smc501_writel(val, addr) iowrite32be((val), (addr))
  146. #else
  147. #define smc501_readl(addr) readl(addr)
  148. #define smc501_writel(val, addr) writel(val, addr)
  149. #endif