idp.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * linux/arch/arm/mach-pxa/idp.c
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. *
  8. * Copyright (c) 2001 Cliff Brake, Accelent Systems Inc.
  9. *
  10. * 2001-09-13: Cliff Brake <cbrake@accelent.com>
  11. * Initial code
  12. *
  13. * 2005-02-15: Cliff Brake <cliff.brake@gmail.com>
  14. * <http://www.vibren.com> <http://bec-systems.com>
  15. * Updated for 2.6 kernel
  16. *
  17. */
  18. #include <linux/init.h>
  19. #include <linux/interrupt.h>
  20. #include <linux/irq.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/fb.h>
  23. #include <asm/setup.h>
  24. #include <asm/memory.h>
  25. #include <asm/mach-types.h>
  26. #include <mach/hardware.h>
  27. #include <asm/irq.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <mach/pxa25x.h>
  31. #include <mach/idp.h>
  32. #include <mach/pxafb.h>
  33. #include <mach/bitfield.h>
  34. #include <mach/mmc.h>
  35. #include "generic.h"
  36. #include "devices.h"
  37. /* TODO:
  38. * - add pxa2xx_audio_ops_t device structure
  39. * - Ethernet interrupt
  40. */
  41. static unsigned long idp_pin_config[] __initdata = {
  42. /* LCD */
  43. GPIO58_LCD_LDD_0,
  44. GPIO59_LCD_LDD_1,
  45. GPIO60_LCD_LDD_2,
  46. GPIO61_LCD_LDD_3,
  47. GPIO62_LCD_LDD_4,
  48. GPIO63_LCD_LDD_5,
  49. GPIO64_LCD_LDD_6,
  50. GPIO65_LCD_LDD_7,
  51. GPIO66_LCD_LDD_8,
  52. GPIO67_LCD_LDD_9,
  53. GPIO68_LCD_LDD_10,
  54. GPIO69_LCD_LDD_11,
  55. GPIO70_LCD_LDD_12,
  56. GPIO71_LCD_LDD_13,
  57. GPIO72_LCD_LDD_14,
  58. GPIO73_LCD_LDD_15,
  59. GPIO74_LCD_FCLK,
  60. GPIO75_LCD_LCLK,
  61. GPIO76_LCD_PCLK,
  62. /* BTUART */
  63. GPIO42_BTUART_RXD,
  64. GPIO43_BTUART_TXD,
  65. GPIO44_BTUART_CTS,
  66. GPIO45_BTUART_RTS,
  67. /* STUART */
  68. GPIO46_STUART_RXD,
  69. GPIO47_STUART_TXD,
  70. /* MMC */
  71. GPIO6_MMC_CLK,
  72. GPIO8_MMC_CS0,
  73. /* Ethernet */
  74. GPIO33_nCS_5, /* Ethernet CS */
  75. GPIO4_GPIO, /* Ethernet IRQ */
  76. };
  77. static struct resource smc91x_resources[] = {
  78. [0] = {
  79. .start = (IDP_ETH_PHYS + 0x300),
  80. .end = (IDP_ETH_PHYS + 0xfffff),
  81. .flags = IORESOURCE_MEM,
  82. },
  83. [1] = {
  84. .start = IRQ_GPIO(4),
  85. .end = IRQ_GPIO(4),
  86. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  87. }
  88. };
  89. static struct platform_device smc91x_device = {
  90. .name = "smc91x",
  91. .id = 0,
  92. .num_resources = ARRAY_SIZE(smc91x_resources),
  93. .resource = smc91x_resources,
  94. };
  95. static void idp_backlight_power(int on)
  96. {
  97. if (on) {
  98. IDP_CPLD_LCD |= (1<<1);
  99. } else {
  100. IDP_CPLD_LCD &= ~(1<<1);
  101. }
  102. }
  103. static void idp_vlcd(int on)
  104. {
  105. if (on) {
  106. IDP_CPLD_LCD |= (1<<2);
  107. } else {
  108. IDP_CPLD_LCD &= ~(1<<2);
  109. }
  110. }
  111. static void idp_lcd_power(int on, struct fb_var_screeninfo *var)
  112. {
  113. if (on) {
  114. IDP_CPLD_LCD |= (1<<0);
  115. } else {
  116. IDP_CPLD_LCD &= ~(1<<0);
  117. }
  118. /* call idp_vlcd for now as core driver does not support
  119. * both power and vlcd hooks. Note, this is not technically
  120. * the correct sequence, but seems to work. Disclaimer:
  121. * this may eventually damage the display.
  122. */
  123. idp_vlcd(on);
  124. }
  125. static struct pxafb_mode_info sharp_lm8v31_mode = {
  126. .pixclock = 270000,
  127. .xres = 640,
  128. .yres = 480,
  129. .bpp = 16,
  130. .hsync_len = 1,
  131. .left_margin = 3,
  132. .right_margin = 3,
  133. .vsync_len = 1,
  134. .upper_margin = 0,
  135. .lower_margin = 0,
  136. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  137. .cmap_greyscale = 0,
  138. };
  139. static struct pxafb_mach_info sharp_lm8v31 = {
  140. .modes = &sharp_lm8v31_mode,
  141. .num_modes = 1,
  142. .cmap_inverse = 0,
  143. .cmap_static = 0,
  144. .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL |
  145. LCD_AC_BIAS_FREQ(255),
  146. .pxafb_backlight_power = &idp_backlight_power,
  147. .pxafb_lcd_power = &idp_lcd_power
  148. };
  149. static struct pxamci_platform_data idp_mci_platform_data = {
  150. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  151. };
  152. static void __init idp_init(void)
  153. {
  154. printk("idp_init()\n");
  155. pxa2xx_mfp_config(ARRAY_AND_SIZE(idp_pin_config));
  156. platform_device_register(&smc91x_device);
  157. //platform_device_register(&mst_audio_device);
  158. set_pxa_fb_info(&sharp_lm8v31);
  159. pxa_set_mci_info(&idp_mci_platform_data);
  160. }
  161. static struct map_desc idp_io_desc[] __initdata = {
  162. {
  163. .virtual = IDP_COREVOLT_VIRT,
  164. .pfn = __phys_to_pfn(IDP_COREVOLT_PHYS),
  165. .length = IDP_COREVOLT_SIZE,
  166. .type = MT_DEVICE
  167. }, {
  168. .virtual = IDP_CPLD_VIRT,
  169. .pfn = __phys_to_pfn(IDP_CPLD_PHYS),
  170. .length = IDP_CPLD_SIZE,
  171. .type = MT_DEVICE
  172. }
  173. };
  174. static void __init idp_map_io(void)
  175. {
  176. pxa_map_io();
  177. iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
  178. }
  179. MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
  180. /* Maintainer: Vibren Technologies */
  181. .phys_io = 0x40000000,
  182. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  183. .map_io = idp_map_io,
  184. .init_irq = pxa25x_init_irq,
  185. .timer = &pxa_timer,
  186. .init_machine = idp_init,
  187. MACHINE_END