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