idp.c 4.1 KB

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