lubbock.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. /*
  2. * linux/arch/arm/mach-pxa/lubbock.c
  3. *
  4. * Support for the Intel DBPXA250 Development Platform.
  5. *
  6. * Author: Nicolas Pitre
  7. * Created: Jun 15, 2001
  8. * Copyright: MontaVista Software Inc.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. */
  14. #include <linux/module.h>
  15. #include <linux/kernel.h>
  16. #include <linux/init.h>
  17. #include <linux/device.h>
  18. #include <linux/major.h>
  19. #include <linux/fb.h>
  20. #include <linux/interrupt.h>
  21. #include <asm/setup.h>
  22. #include <asm/memory.h>
  23. #include <asm/mach-types.h>
  24. #include <asm/hardware.h>
  25. #include <asm/irq.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/irq.h>
  29. #include <asm/hardware/sa1111.h>
  30. #include <asm/arch/pxa-regs.h>
  31. #include <asm/arch/lubbock.h>
  32. #include <asm/arch/udc.h>
  33. #include <asm/arch/pxafb.h>
  34. #include <asm/arch/mmc.h>
  35. #include "generic.h"
  36. #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
  37. void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
  38. {
  39. unsigned long flags;
  40. local_irq_save(flags);
  41. LUB_MISC_WR = (LUB_MISC_WR & ~mask) | (set & mask);
  42. local_irq_restore(flags);
  43. }
  44. EXPORT_SYMBOL(lubbock_set_misc_wr);
  45. static unsigned long lubbock_irq_enabled;
  46. static void lubbock_mask_irq(unsigned int irq)
  47. {
  48. int lubbock_irq = (irq - LUBBOCK_IRQ(0));
  49. LUB_IRQ_MASK_EN = (lubbock_irq_enabled &= ~(1 << lubbock_irq));
  50. }
  51. static void lubbock_unmask_irq(unsigned int irq)
  52. {
  53. int lubbock_irq = (irq - LUBBOCK_IRQ(0));
  54. /* the irq can be acknowledged only if deasserted, so it's done here */
  55. LUB_IRQ_SET_CLR &= ~(1 << lubbock_irq);
  56. LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq));
  57. }
  58. static struct irqchip lubbock_irq_chip = {
  59. .ack = lubbock_mask_irq,
  60. .mask = lubbock_mask_irq,
  61. .unmask = lubbock_unmask_irq,
  62. };
  63. static void lubbock_irq_handler(unsigned int irq, struct irqdesc *desc,
  64. struct pt_regs *regs)
  65. {
  66. unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
  67. do {
  68. GEDR(0) = GPIO_bit(0); /* clear our parent irq */
  69. if (likely(pending)) {
  70. irq = LUBBOCK_IRQ(0) + __ffs(pending);
  71. desc = irq_desc + irq;
  72. desc->handle(irq, desc, regs);
  73. }
  74. pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
  75. } while (pending);
  76. }
  77. static void __init lubbock_init_irq(void)
  78. {
  79. int irq;
  80. pxa_init_irq();
  81. /* setup extra lubbock irqs */
  82. for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) {
  83. set_irq_chip(irq, &lubbock_irq_chip);
  84. set_irq_handler(irq, do_level_IRQ);
  85. set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
  86. }
  87. set_irq_chained_handler(IRQ_GPIO(0), lubbock_irq_handler);
  88. set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
  89. }
  90. static int lubbock_udc_is_connected(void)
  91. {
  92. return (LUB_MISC_RD & (1 << 9)) == 0;
  93. }
  94. static struct pxa2xx_udc_mach_info udc_info __initdata = {
  95. .udc_is_connected = lubbock_udc_is_connected,
  96. // no D+ pullup; lubbock can't connect/disconnect in software
  97. };
  98. static struct resource sa1111_resources[] = {
  99. [0] = {
  100. .start = 0x10000000,
  101. .end = 0x10001fff,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. [1] = {
  105. .start = LUBBOCK_SA1111_IRQ,
  106. .end = LUBBOCK_SA1111_IRQ,
  107. .flags = IORESOURCE_IRQ,
  108. },
  109. };
  110. static struct platform_device sa1111_device = {
  111. .name = "sa1111",
  112. .id = -1,
  113. .num_resources = ARRAY_SIZE(sa1111_resources),
  114. .resource = sa1111_resources,
  115. };
  116. static struct resource smc91x_resources[] = {
  117. [0] = {
  118. .name = "smc91x-regs",
  119. .start = 0x0c000000,
  120. .end = 0x0c0fffff,
  121. .flags = IORESOURCE_MEM,
  122. },
  123. [1] = {
  124. .start = LUBBOCK_ETH_IRQ,
  125. .end = LUBBOCK_ETH_IRQ,
  126. .flags = IORESOURCE_IRQ,
  127. },
  128. [2] = {
  129. .name = "smc91x-attrib",
  130. .start = 0x0e000000,
  131. .end = 0x0e0fffff,
  132. .flags = IORESOURCE_MEM,
  133. },
  134. };
  135. static struct platform_device smc91x_device = {
  136. .name = "smc91x",
  137. .id = -1,
  138. .num_resources = ARRAY_SIZE(smc91x_resources),
  139. .resource = smc91x_resources,
  140. };
  141. static struct platform_device *devices[] __initdata = {
  142. &sa1111_device,
  143. &smc91x_device,
  144. };
  145. static struct pxafb_mach_info sharp_lm8v31 __initdata = {
  146. .pixclock = 270000,
  147. .xres = 640,
  148. .yres = 480,
  149. .bpp = 16,
  150. .hsync_len = 1,
  151. .left_margin = 3,
  152. .right_margin = 3,
  153. .vsync_len = 1,
  154. .upper_margin = 0,
  155. .lower_margin = 0,
  156. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  157. .cmap_greyscale = 0,
  158. .cmap_inverse = 0,
  159. .cmap_static = 0,
  160. .lccr0 = LCCR0_SDS,
  161. .lccr3 = LCCR3_PCP | LCCR3_Acb(255),
  162. };
  163. static int lubbock_mci_init(struct device *dev, irqreturn_t (*lubbock_detect_int)(int, void *, struct pt_regs *), void *data)
  164. {
  165. /* setup GPIO for PXA25x MMC controller */
  166. pxa_gpio_mode(GPIO6_MMCCLK_MD);
  167. pxa_gpio_mode(GPIO8_MMCCS0_MD);
  168. return 0;
  169. }
  170. static struct pxamci_platform_data lubbock_mci_platform_data = {
  171. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  172. .init = lubbock_mci_init,
  173. };
  174. static void __init lubbock_init(void)
  175. {
  176. pxa_set_udc_info(&udc_info);
  177. set_pxa_fb_info(&sharp_lm8v31);
  178. pxa_set_mci_info(&lubbock_mci_platform_data);
  179. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  180. }
  181. static struct map_desc lubbock_io_desc[] __initdata = {
  182. { LUBBOCK_FPGA_VIRT, LUBBOCK_FPGA_PHYS, 0x00100000, MT_DEVICE }, /* CPLD */
  183. };
  184. static void __init lubbock_map_io(void)
  185. {
  186. pxa_map_io();
  187. iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc));
  188. /* This enables the BTUART */
  189. pxa_gpio_mode(GPIO42_BTRXD_MD);
  190. pxa_gpio_mode(GPIO43_BTTXD_MD);
  191. pxa_gpio_mode(GPIO44_BTCTS_MD);
  192. pxa_gpio_mode(GPIO45_BTRTS_MD);
  193. /* This is for the SMC chip select */
  194. pxa_gpio_mode(GPIO79_nCS_3_MD);
  195. /* setup sleep mode values */
  196. PWER = 0x00000002;
  197. PFER = 0x00000000;
  198. PRER = 0x00000002;
  199. PGSR0 = 0x00008000;
  200. PGSR1 = 0x003F0202;
  201. PGSR2 = 0x0001C000;
  202. PCFR |= PCFR_OPDE;
  203. }
  204. MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
  205. MAINTAINER("MontaVista Software Inc.")
  206. BOOT_MEM(0xa0000000, 0x40000000, io_p2v(0x40000000))
  207. MAPIO(lubbock_map_io)
  208. INITIRQ(lubbock_init_irq)
  209. .timer = &pxa_timer,
  210. INIT_MACHINE(lubbock_init)
  211. MACHINE_END