idp.c 4.3 KB

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