idp.c 4.2 KB

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