idp.c 4.5 KB

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