colibri-pxa270-income.c 5.6 KB

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