sm501.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /* include/linux/sm501.h
  3. *
  4. * Copyright (c) 2006 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * Vincent Sanders <vince@simtec.co.uk>
  7. */
  8. extern int sm501_unit_power(struct device *dev,
  9. unsigned int unit, unsigned int to);
  10. extern unsigned long sm501_set_clock(struct device *dev,
  11. int clksrc, unsigned long freq);
  12. extern unsigned long sm501_find_clock(struct device *dev,
  13. int clksrc, unsigned long req_freq);
  14. /* sm501_misc_control
  15. *
  16. * Modify the SM501's MISC_CONTROL register
  17. */
  18. extern int sm501_misc_control(struct device *dev,
  19. unsigned long set, unsigned long clear);
  20. /* sm501_modify_reg
  21. *
  22. * Modify a register in the SM501 which may be shared with other
  23. * drivers.
  24. */
  25. extern unsigned long sm501_modify_reg(struct device *dev,
  26. unsigned long reg,
  27. unsigned long set,
  28. unsigned long clear);
  29. /* Platform data definitions */
  30. #define SM501FB_FLAG_USE_INIT_MODE (1<<0)
  31. #define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
  32. #define SM501FB_FLAG_USE_HWCURSOR (1<<2)
  33. #define SM501FB_FLAG_USE_HWACCEL (1<<3)
  34. #define SM501FB_FLAG_PANEL_NO_FPEN (1<<4)
  35. #define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5)
  36. #define SM501FB_FLAG_PANEL_INV_FPEN (1<<6)
  37. #define SM501FB_FLAG_PANEL_INV_VBIASEN (1<<7)
  38. struct sm501_platdata_fbsub {
  39. struct fb_videomode *def_mode;
  40. unsigned int def_bpp;
  41. unsigned long max_mem;
  42. unsigned int flags;
  43. };
  44. enum sm501_fb_routing {
  45. SM501_FB_OWN = 0, /* CRT=>CRT, Panel=>Panel */
  46. SM501_FB_CRT_PANEL = 1, /* Panel=>CRT, Panel=>Panel */
  47. };
  48. /* sm501_platdata_fb flag field bit definitions */
  49. #define SM501_FBPD_SWAP_FB_ENDIAN (1<<0) /* need to endian swap */
  50. /* sm501_platdata_fb
  51. *
  52. * configuration data for the framebuffer driver
  53. */
  54. struct sm501_platdata_fb {
  55. enum sm501_fb_routing fb_route;
  56. unsigned int flags;
  57. struct sm501_platdata_fbsub *fb_crt;
  58. struct sm501_platdata_fbsub *fb_pnl;
  59. };
  60. /* gpio i2c
  61. *
  62. * Note, we have to pass in the bus number, as the number used will be
  63. * passed to the i2c-gpio driver's platform_device.id, subsequently used
  64. * to register the i2c bus.
  65. */
  66. struct sm501_platdata_gpio_i2c {
  67. unsigned int bus_num;
  68. unsigned int pin_sda;
  69. unsigned int pin_scl;
  70. int udelay;
  71. int timeout;
  72. };
  73. /* sm501_initdata
  74. *
  75. * use for initialising values that may not have been setup
  76. * before the driver is loaded.
  77. */
  78. struct sm501_reg_init {
  79. unsigned long set;
  80. unsigned long mask;
  81. };
  82. #define SM501_USE_USB_HOST (1<<0)
  83. #define SM501_USE_USB_SLAVE (1<<1)
  84. #define SM501_USE_SSP0 (1<<2)
  85. #define SM501_USE_SSP1 (1<<3)
  86. #define SM501_USE_UART0 (1<<4)
  87. #define SM501_USE_UART1 (1<<5)
  88. #define SM501_USE_FBACCEL (1<<6)
  89. #define SM501_USE_AC97 (1<<7)
  90. #define SM501_USE_I2S (1<<8)
  91. #define SM501_USE_GPIO (1<<9)
  92. #define SM501_USE_ALL (0xffffffff)
  93. struct sm501_initdata {
  94. struct sm501_reg_init gpio_low;
  95. struct sm501_reg_init gpio_high;
  96. struct sm501_reg_init misc_timing;
  97. struct sm501_reg_init misc_control;
  98. unsigned long devices;
  99. unsigned long mclk; /* non-zero to modify */
  100. unsigned long m1xclk; /* non-zero to modify */
  101. };
  102. /* sm501_init_gpio
  103. *
  104. * default gpio settings
  105. */
  106. struct sm501_init_gpio {
  107. struct sm501_reg_init gpio_data_low;
  108. struct sm501_reg_init gpio_data_high;
  109. struct sm501_reg_init gpio_ddr_low;
  110. struct sm501_reg_init gpio_ddr_high;
  111. };
  112. #define SM501_FLAG_SUSPEND_OFF (1<<4)
  113. /* sm501_platdata
  114. *
  115. * This is passed with the platform device to allow the board
  116. * to control the behaviour of the SM501 driver(s) which attach
  117. * to the device.
  118. *
  119. */
  120. struct sm501_platdata {
  121. struct sm501_initdata *init;
  122. struct sm501_init_gpio *init_gpiop;
  123. struct sm501_platdata_fb *fb;
  124. int flags;
  125. int gpio_base;
  126. int (*get_power)(struct device *dev);
  127. int (*set_power)(struct device *dev, unsigned int on);
  128. struct sm501_platdata_gpio_i2c *gpio_i2c;
  129. unsigned int gpio_i2c_nr;
  130. };
  131. #if defined(CONFIG_PPC32)
  132. #define smc501_readl(addr) ioread32be((addr))
  133. #define smc501_writel(val, addr) iowrite32be((val), (addr))
  134. #else
  135. #define smc501_readl(addr) readl(addr)
  136. #define smc501_writel(val, addr) writel(val, addr)
  137. #endif