colibri-pxa270-income.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. /*
  2. * linux/arch/arm/mach-pxa/income.c
  3. *
  4. * Support for Income s.r.o. SH-Dmaster PXA270 SBC
  5. *
  6. * Copyright (C) 2010
  7. * Marek Vasut <marek.vasut@gmail.com>
  8. * Pavel Revak <palo@bielyvlk.sk>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/bitops.h>
  15. #include <linux/delay.h>
  16. #include <linux/gpio.h>
  17. #include <linux/init.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/leds.h>
  20. #include <linux/ioport.h>
  21. #include <linux/kernel.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/pwm.h>
  24. #include <linux/pwm_backlight.h>
  25. #include <linux/platform_data/i2c-pxa.h>
  26. #include <asm/irq.h>
  27. #include <asm/mach-types.h>
  28. #include <mach/hardware.h>
  29. #include <linux/platform_data/mmc-pxamci.h>
  30. #include <linux/platform_data/usb-ohci-pxa27x.h>
  31. #include "pxa27x.h"
  32. #include "pxa27x-udc.h"
  33. #include <linux/platform_data/video-pxafb.h>
  34. #include "devices.h"
  35. #include "generic.h"
  36. #define GPIO114_INCOME_ETH_IRQ (114)
  37. #define GPIO0_INCOME_SD_DETECT (0)
  38. #define GPIO0_INCOME_SD_RO (1)
  39. #define GPIO54_INCOME_LED_A (54)
  40. #define GPIO55_INCOME_LED_B (55)
  41. #define GPIO113_INCOME_TS_IRQ (113)
  42. /******************************************************************************
  43. * SD/MMC card controller
  44. ******************************************************************************/
  45. #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE)
  46. static struct pxamci_platform_data income_mci_platform_data = {
  47. .ocr_mask = MMC_VDD_32_33 | MMC_VDD_33_34,
  48. .gpio_power = -1,
  49. .gpio_card_detect = GPIO0_INCOME_SD_DETECT,
  50. .gpio_card_ro = GPIO0_INCOME_SD_RO,
  51. .detect_delay_ms = 200,
  52. };
  53. static void __init income_mmc_init(void)
  54. {
  55. pxa_set_mci_info(&income_mci_platform_data);
  56. }
  57. #else
  58. static inline void income_mmc_init(void) {}
  59. #endif
  60. /******************************************************************************
  61. * USB Host
  62. ******************************************************************************/
  63. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  64. static struct pxaohci_platform_data income_ohci_info = {
  65. .port_mode = PMM_PERPORT_MODE,
  66. .flags = ENABLE_PORT1 | POWER_CONTROL_LOW | POWER_SENSE_LOW,
  67. };
  68. static void __init income_uhc_init(void)
  69. {
  70. pxa_set_ohci_info(&income_ohci_info);
  71. }
  72. #else
  73. static inline void income_uhc_init(void) {}
  74. #endif
  75. /******************************************************************************
  76. * LED
  77. ******************************************************************************/
  78. #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
  79. struct gpio_led income_gpio_leds[] = {
  80. {
  81. .name = "income:green:leda",
  82. .default_trigger = "none",
  83. .gpio = GPIO54_INCOME_LED_A,
  84. .active_low = 1,
  85. },
  86. {
  87. .name = "income:green:ledb",
  88. .default_trigger = "none",
  89. .gpio = GPIO55_INCOME_LED_B,
  90. .active_low = 1,
  91. }
  92. };
  93. static struct gpio_led_platform_data income_gpio_led_info = {
  94. .leds = income_gpio_leds,
  95. .num_leds = ARRAY_SIZE(income_gpio_leds),
  96. };
  97. static struct platform_device income_leds = {
  98. .name = "leds-gpio",
  99. .id = -1,
  100. .dev = {
  101. .platform_data = &income_gpio_led_info,
  102. }
  103. };
  104. static void __init income_led_init(void)
  105. {
  106. platform_device_register(&income_leds);
  107. }
  108. #else
  109. static inline void income_led_init(void) {}
  110. #endif
  111. /******************************************************************************
  112. * I2C
  113. ******************************************************************************/
  114. #if defined(CONFIG_I2C_PXA) || defined(CONFIG_I2C_PXA_MODULE)
  115. static struct i2c_board_info __initdata income_i2c_devs[] = {
  116. {
  117. I2C_BOARD_INFO("ds1340", 0x68),
  118. }, {
  119. I2C_BOARD_INFO("lm75", 0x4f),
  120. },
  121. };
  122. static void __init income_i2c_init(void)
  123. {
  124. pxa_set_i2c_info(NULL);
  125. pxa27x_set_i2c_power_info(NULL);
  126. i2c_register_board_info(0, ARRAY_AND_SIZE(income_i2c_devs));
  127. }
  128. #else
  129. static inline void income_i2c_init(void) {}
  130. #endif
  131. /******************************************************************************
  132. * Framebuffer
  133. ******************************************************************************/
  134. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  135. static struct pxafb_mode_info income_lcd_modes[] = {
  136. {
  137. .pixclock = 144700,
  138. .xres = 320,
  139. .yres = 240,
  140. .bpp = 32,
  141. .depth = 18,
  142. .left_margin = 10,
  143. .right_margin = 10,
  144. .upper_margin = 7,
  145. .lower_margin = 8,
  146. .hsync_len = 20,
  147. .vsync_len = 2,
  148. .sync = FB_SYNC_VERT_HIGH_ACT,
  149. },
  150. };
  151. static struct pxafb_mach_info income_lcd_screen = {
  152. .modes = income_lcd_modes,
  153. .num_modes = ARRAY_SIZE(income_lcd_modes),
  154. .lcd_conn = LCD_COLOR_TFT_18BPP | LCD_PCLK_EDGE_FALL,
  155. };
  156. static void __init income_lcd_init(void)
  157. {
  158. pxa_set_fb_info(NULL, &income_lcd_screen);
  159. }
  160. #else
  161. static inline void income_lcd_init(void) {}
  162. #endif
  163. /******************************************************************************
  164. * Backlight
  165. ******************************************************************************/
  166. #if defined(CONFIG_BACKLIGHT_PWM) || defined(CONFIG_BACKLIGHT_PWM_MODULE)
  167. static struct pwm_lookup income_pwm_lookup[] = {
  168. PWM_LOOKUP("pxa27x-pwm.0", 0, "pwm-backlight.0", NULL, 1000000,
  169. PWM_POLARITY_NORMAL),
  170. };
  171. static struct platform_pwm_backlight_data income_backlight_data = {
  172. .max_brightness = 0x3ff,
  173. .dft_brightness = 0x1ff,
  174. .enable_gpio = -1,
  175. };
  176. static struct platform_device income_backlight = {
  177. .name = "pwm-backlight",
  178. .dev = {
  179. .parent = &pxa27x_device_pwm0.dev,
  180. .platform_data = &income_backlight_data,
  181. },
  182. };
  183. static void __init income_pwm_init(void)
  184. {
  185. pwm_add_table(income_pwm_lookup, ARRAY_SIZE(income_pwm_lookup));
  186. platform_device_register(&income_backlight);
  187. }
  188. #else
  189. static inline void income_pwm_init(void) {}
  190. #endif
  191. void __init colibri_pxa270_income_boardinit(void)
  192. {
  193. pxa_set_ffuart_info(NULL);
  194. pxa_set_btuart_info(NULL);
  195. pxa_set_stuart_info(NULL);
  196. income_mmc_init();
  197. income_uhc_init();
  198. income_led_init();
  199. income_i2c_init();
  200. income_lcd_init();
  201. income_pwm_init();
  202. }