idp.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 <asm/hardware.h>
  27. #include <asm/irq.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/arch/pxa-regs.h>
  31. #include <asm/arch/idp.h>
  32. #include <asm/arch/pxafb.h>
  33. #include <asm/arch/bitfield.h>
  34. #include <asm/arch/mmc.h>
  35. #include "generic.h"
  36. /* TODO:
  37. * - add pxa2xx_audio_ops_t device structure
  38. * - Ethernet interrupt
  39. */
  40. static struct resource smc91x_resources[] = {
  41. [0] = {
  42. .start = (IDP_ETH_PHYS + 0x300),
  43. .end = (IDP_ETH_PHYS + 0xfffff),
  44. .flags = IORESOURCE_MEM,
  45. },
  46. [1] = {
  47. .start = IRQ_GPIO(4),
  48. .end = IRQ_GPIO(4),
  49. .flags = IORESOURCE_IRQ,
  50. }
  51. };
  52. static struct platform_device smc91x_device = {
  53. .name = "smc91x",
  54. .id = 0,
  55. .num_resources = ARRAY_SIZE(smc91x_resources),
  56. .resource = smc91x_resources,
  57. };
  58. static void idp_backlight_power(int on)
  59. {
  60. if (on) {
  61. IDP_CPLD_LCD |= (1<<1);
  62. } else {
  63. IDP_CPLD_LCD &= ~(1<<1);
  64. }
  65. }
  66. static void idp_vlcd(int on)
  67. {
  68. if (on) {
  69. IDP_CPLD_LCD |= (1<<2);
  70. } else {
  71. IDP_CPLD_LCD &= ~(1<<2);
  72. }
  73. }
  74. static void idp_lcd_power(int on, struct fb_var_screeninfo *var)
  75. {
  76. if (on) {
  77. IDP_CPLD_LCD |= (1<<0);
  78. } else {
  79. IDP_CPLD_LCD &= ~(1<<0);
  80. }
  81. /* call idp_vlcd for now as core driver does not support
  82. * both power and vlcd hooks. Note, this is not technically
  83. * the correct sequence, but seems to work. Disclaimer:
  84. * this may eventually damage the display.
  85. */
  86. idp_vlcd(on);
  87. }
  88. static struct pxafb_mode_info sharp_lm8v31_mode = {
  89. .pixclock = 270000,
  90. .xres = 640,
  91. .yres = 480,
  92. .bpp = 16,
  93. .hsync_len = 1,
  94. .left_margin = 3,
  95. .right_margin = 3,
  96. .vsync_len = 1,
  97. .upper_margin = 0,
  98. .lower_margin = 0,
  99. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  100. .cmap_greyscale = 0,
  101. };
  102. static struct pxafb_mach_info sharp_lm8v31 = {
  103. .modes = &sharp_lm8v31_mode,
  104. .num_modes = 1,
  105. .cmap_inverse = 0,
  106. .cmap_static = 0,
  107. .lccr0 = LCCR0_SDS,
  108. .lccr3 = LCCR3_PCP | LCCR3_Acb(255),
  109. .pxafb_backlight_power = &idp_backlight_power,
  110. .pxafb_lcd_power = &idp_lcd_power
  111. };
  112. static int idp_mci_init(struct device *dev, irq_handler_t idp_detect_int, void *data)
  113. {
  114. /* setup GPIO for PXA25x MMC controller */
  115. pxa_gpio_mode(GPIO6_MMCCLK_MD);
  116. pxa_gpio_mode(GPIO8_MMCCS0_MD);
  117. return 0;
  118. }
  119. static struct pxamci_platform_data idp_mci_platform_data = {
  120. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  121. .init = idp_mci_init,
  122. };
  123. static void __init idp_init(void)
  124. {
  125. printk("idp_init()\n");
  126. platform_device_register(&smc91x_device);
  127. //platform_device_register(&mst_audio_device);
  128. set_pxa_fb_info(&sharp_lm8v31);
  129. pxa_set_mci_info(&idp_mci_platform_data);
  130. }
  131. static void __init idp_init_irq(void)
  132. {
  133. pxa_init_irq();
  134. set_irq_type(TOUCH_PANEL_IRQ, TOUCH_PANEL_IRQ_EDGE);
  135. }
  136. static struct map_desc idp_io_desc[] __initdata = {
  137. {
  138. .virtual = IDP_COREVOLT_VIRT,
  139. .pfn = __phys_to_pfn(IDP_COREVOLT_PHYS),
  140. .length = IDP_COREVOLT_SIZE,
  141. .type = MT_DEVICE
  142. }, {
  143. .virtual = IDP_CPLD_VIRT,
  144. .pfn = __phys_to_pfn(IDP_CPLD_PHYS),
  145. .length = IDP_CPLD_SIZE,
  146. .type = MT_DEVICE
  147. }
  148. };
  149. static void __init idp_map_io(void)
  150. {
  151. pxa_map_io();
  152. iotable_init(idp_io_desc, ARRAY_SIZE(idp_io_desc));
  153. // serial ports 2 & 3
  154. pxa_gpio_mode(GPIO42_BTRXD_MD);
  155. pxa_gpio_mode(GPIO43_BTTXD_MD);
  156. pxa_gpio_mode(GPIO44_BTCTS_MD);
  157. pxa_gpio_mode(GPIO45_BTRTS_MD);
  158. pxa_gpio_mode(GPIO46_STRXD_MD);
  159. pxa_gpio_mode(GPIO47_STTXD_MD);
  160. }
  161. MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
  162. /* Maintainer: Vibren Technologies */
  163. .phys_io = 0x40000000,
  164. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  165. .map_io = idp_map_io,
  166. .init_irq = idp_init_irq,
  167. .timer = &pxa_timer,
  168. .init_machine = idp_init,
  169. MACHINE_END