idp.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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. GPIOxx_LCD_DSTN_16BPP,
  44. /* BTUART */
  45. GPIO42_BTUART_RXD,
  46. GPIO43_BTUART_TXD,
  47. GPIO44_BTUART_CTS,
  48. GPIO45_BTUART_RTS,
  49. /* STUART */
  50. GPIO46_STUART_RXD,
  51. GPIO47_STUART_TXD,
  52. /* MMC */
  53. GPIO6_MMC_CLK,
  54. GPIO8_MMC_CS0,
  55. /* Ethernet */
  56. GPIO33_nCS_5, /* Ethernet CS */
  57. GPIO4_GPIO, /* Ethernet IRQ */
  58. };
  59. static struct resource smc91x_resources[] = {
  60. [0] = {
  61. .start = (IDP_ETH_PHYS + 0x300),
  62. .end = (IDP_ETH_PHYS + 0xfffff),
  63. .flags = IORESOURCE_MEM,
  64. },
  65. [1] = {
  66. .start = IRQ_GPIO(4),
  67. .end = IRQ_GPIO(4),
  68. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
  69. }
  70. };
  71. static struct platform_device smc91x_device = {
  72. .name = "smc91x",
  73. .id = 0,
  74. .num_resources = ARRAY_SIZE(smc91x_resources),
  75. .resource = smc91x_resources,
  76. };
  77. static void idp_backlight_power(int on)
  78. {
  79. if (on) {
  80. IDP_CPLD_LCD |= (1<<1);
  81. } else {
  82. IDP_CPLD_LCD &= ~(1<<1);
  83. }
  84. }
  85. static void idp_vlcd(int on)
  86. {
  87. if (on) {
  88. IDP_CPLD_LCD |= (1<<2);
  89. } else {
  90. IDP_CPLD_LCD &= ~(1<<2);
  91. }
  92. }
  93. static void idp_lcd_power(int on, struct fb_var_screeninfo *var)
  94. {
  95. if (on) {
  96. IDP_CPLD_LCD |= (1<<0);
  97. } else {
  98. IDP_CPLD_LCD &= ~(1<<0);
  99. }
  100. /* call idp_vlcd for now as core driver does not support
  101. * both power and vlcd hooks. Note, this is not technically
  102. * the correct sequence, but seems to work. Disclaimer:
  103. * this may eventually damage the display.
  104. */
  105. idp_vlcd(on);
  106. }
  107. static struct pxafb_mode_info sharp_lm8v31_mode = {
  108. .pixclock = 270000,
  109. .xres = 640,
  110. .yres = 480,
  111. .bpp = 16,
  112. .hsync_len = 1,
  113. .left_margin = 3,
  114. .right_margin = 3,
  115. .vsync_len = 1,
  116. .upper_margin = 0,
  117. .lower_margin = 0,
  118. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  119. .cmap_greyscale = 0,
  120. };
  121. static struct pxafb_mach_info sharp_lm8v31 = {
  122. .modes = &sharp_lm8v31_mode,
  123. .num_modes = 1,
  124. .cmap_inverse = 0,
  125. .cmap_static = 0,
  126. .lcd_conn = LCD_COLOR_DSTN_16BPP | LCD_PCLK_EDGE_FALL |
  127. LCD_AC_BIAS_FREQ(255),
  128. .pxafb_backlight_power = &idp_backlight_power,
  129. .pxafb_lcd_power = &idp_lcd_power
  130. };
  131. static struct pxamci_platform_data idp_mci_platform_data = {
  132. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  133. .gpio_card_detect = -1,
  134. .gpio_card_ro = -1,
  135. .gpio_power = -1,
  136. };
  137. static void __init idp_init(void)
  138. {
  139. printk("idp_init()\n");
  140. pxa2xx_mfp_config(ARRAY_AND_SIZE(idp_pin_config));
  141. pxa_set_ffuart_info(NULL);
  142. pxa_set_btuart_info(NULL);
  143. pxa_set_stuart_info(NULL);
  144. platform_device_register(&smc91x_device);
  145. //platform_device_register(&mst_audio_device);
  146. pxa_set_fb_info(NULL, &sharp_lm8v31);
  147. pxa_set_mci_info(&idp_mci_platform_data);
  148. }
  149. static struct map_desc idp_io_desc[] __initdata = {
  150. {
  151. .virtual = IDP_COREVOLT_VIRT,
  152. .pfn = __phys_to_pfn(IDP_COREVOLT_PHYS),
  153. .length = IDP_COREVOLT_SIZE,
  154. .type = MT_DEVICE
  155. }, {
  156. .virtual = IDP_CPLD_VIRT,
  157. .pfn = __phys_to_pfn(IDP_CPLD_PHYS),
  158. .length = IDP_CPLD_SIZE,
  159. .type = MT_DEVICE
  160. }
  161. };
  162. static void __init idp_map_io(void)
  163. {
  164. pxa25x_map_io();
  165. iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
  166. }
  167. MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
  168. /* Maintainer: Vibren Technologies */
  169. .map_io = idp_map_io,
  170. .init_irq = pxa25x_init_irq,
  171. .timer = &pxa_timer,
  172. .init_machine = idp_init,
  173. MACHINE_END