lubbock.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  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/sysdev.h>
  19. #include <linux/major.h>
  20. #include <linux/fb.h>
  21. #include <linux/interrupt.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/mach/irq.h>
  30. #include <asm/hardware/sa1111.h>
  31. #include <asm/arch/pxa-regs.h>
  32. #include <asm/arch/lubbock.h>
  33. #include <asm/arch/udc.h>
  34. #include <asm/arch/pxafb.h>
  35. #include <asm/arch/mmc.h>
  36. #include "generic.h"
  37. #define LUB_MISC_WR __LUB_REG(LUBBOCK_FPGA_PHYS + 0x080)
  38. void lubbock_set_misc_wr(unsigned int mask, unsigned int set)
  39. {
  40. unsigned long flags;
  41. local_irq_save(flags);
  42. LUB_MISC_WR = (LUB_MISC_WR & ~mask) | (set & mask);
  43. local_irq_restore(flags);
  44. }
  45. EXPORT_SYMBOL(lubbock_set_misc_wr);
  46. static unsigned long lubbock_irq_enabled;
  47. static void lubbock_mask_irq(unsigned int irq)
  48. {
  49. int lubbock_irq = (irq - LUBBOCK_IRQ(0));
  50. LUB_IRQ_MASK_EN = (lubbock_irq_enabled &= ~(1 << lubbock_irq));
  51. }
  52. static void lubbock_unmask_irq(unsigned int irq)
  53. {
  54. int lubbock_irq = (irq - LUBBOCK_IRQ(0));
  55. /* the irq can be acknowledged only if deasserted, so it's done here */
  56. LUB_IRQ_SET_CLR &= ~(1 << lubbock_irq);
  57. LUB_IRQ_MASK_EN = (lubbock_irq_enabled |= (1 << lubbock_irq));
  58. }
  59. static struct irqchip lubbock_irq_chip = {
  60. .ack = lubbock_mask_irq,
  61. .mask = lubbock_mask_irq,
  62. .unmask = lubbock_unmask_irq,
  63. };
  64. static void lubbock_irq_handler(unsigned int irq, struct irqdesc *desc,
  65. struct pt_regs *regs)
  66. {
  67. unsigned long pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
  68. do {
  69. GEDR(0) = GPIO_bit(0); /* clear our parent irq */
  70. if (likely(pending)) {
  71. irq = LUBBOCK_IRQ(0) + __ffs(pending);
  72. desc = irq_desc + irq;
  73. desc_handle_irq(irq, desc, regs);
  74. }
  75. pending = LUB_IRQ_SET_CLR & lubbock_irq_enabled;
  76. } while (pending);
  77. }
  78. static void __init lubbock_init_irq(void)
  79. {
  80. int irq;
  81. pxa_init_irq();
  82. /* setup extra lubbock irqs */
  83. for (irq = LUBBOCK_IRQ(0); irq <= LUBBOCK_LAST_IRQ; irq++) {
  84. set_irq_chip(irq, &lubbock_irq_chip);
  85. set_irq_handler(irq, do_level_IRQ);
  86. set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
  87. }
  88. set_irq_chained_handler(IRQ_GPIO(0), lubbock_irq_handler);
  89. set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
  90. }
  91. #ifdef CONFIG_PM
  92. static int lubbock_irq_resume(struct sys_device *dev)
  93. {
  94. LUB_IRQ_MASK_EN = lubbock_irq_enabled;
  95. return 0;
  96. }
  97. static struct sysdev_class lubbock_irq_sysclass = {
  98. set_kset_name("cpld_irq"),
  99. .resume = lubbock_irq_resume,
  100. };
  101. static struct sys_device lubbock_irq_device = {
  102. .cls = &lubbock_irq_sysclass,
  103. };
  104. static int __init lubbock_irq_device_init(void)
  105. {
  106. int ret = sysdev_class_register(&lubbock_irq_sysclass);
  107. if (ret == 0)
  108. ret = sysdev_register(&lubbock_irq_device);
  109. return ret;
  110. }
  111. device_initcall(lubbock_irq_device_init);
  112. #endif
  113. static int lubbock_udc_is_connected(void)
  114. {
  115. return (LUB_MISC_RD & (1 << 9)) == 0;
  116. }
  117. static struct pxa2xx_udc_mach_info udc_info __initdata = {
  118. .udc_is_connected = lubbock_udc_is_connected,
  119. // no D+ pullup; lubbock can't connect/disconnect in software
  120. };
  121. static struct resource sa1111_resources[] = {
  122. [0] = {
  123. .start = 0x10000000,
  124. .end = 0x10001fff,
  125. .flags = IORESOURCE_MEM,
  126. },
  127. [1] = {
  128. .start = LUBBOCK_SA1111_IRQ,
  129. .end = LUBBOCK_SA1111_IRQ,
  130. .flags = IORESOURCE_IRQ,
  131. },
  132. };
  133. static struct platform_device sa1111_device = {
  134. .name = "sa1111",
  135. .id = -1,
  136. .num_resources = ARRAY_SIZE(sa1111_resources),
  137. .resource = sa1111_resources,
  138. };
  139. static struct resource smc91x_resources[] = {
  140. [0] = {
  141. .name = "smc91x-regs",
  142. .start = 0x0c000000,
  143. .end = 0x0c0fffff,
  144. .flags = IORESOURCE_MEM,
  145. },
  146. [1] = {
  147. .start = LUBBOCK_ETH_IRQ,
  148. .end = LUBBOCK_ETH_IRQ,
  149. .flags = IORESOURCE_IRQ,
  150. },
  151. [2] = {
  152. .name = "smc91x-attrib",
  153. .start = 0x0e000000,
  154. .end = 0x0e0fffff,
  155. .flags = IORESOURCE_MEM,
  156. },
  157. };
  158. static struct platform_device smc91x_device = {
  159. .name = "smc91x",
  160. .id = -1,
  161. .num_resources = ARRAY_SIZE(smc91x_resources),
  162. .resource = smc91x_resources,
  163. };
  164. static struct platform_device *devices[] __initdata = {
  165. &sa1111_device,
  166. &smc91x_device,
  167. };
  168. static struct pxafb_mach_info sharp_lm8v31 __initdata = {
  169. .pixclock = 270000,
  170. .xres = 640,
  171. .yres = 480,
  172. .bpp = 16,
  173. .hsync_len = 1,
  174. .left_margin = 3,
  175. .right_margin = 3,
  176. .vsync_len = 1,
  177. .upper_margin = 0,
  178. .lower_margin = 0,
  179. .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
  180. .cmap_greyscale = 0,
  181. .cmap_inverse = 0,
  182. .cmap_static = 0,
  183. .lccr0 = LCCR0_SDS,
  184. .lccr3 = LCCR3_PCP | LCCR3_Acb(255),
  185. };
  186. static int lubbock_mci_init(struct device *dev, irqreturn_t (*lubbock_detect_int)(int, void *, struct pt_regs *), void *data)
  187. {
  188. /* setup GPIO for PXA25x MMC controller */
  189. pxa_gpio_mode(GPIO6_MMCCLK_MD);
  190. pxa_gpio_mode(GPIO8_MMCCS0_MD);
  191. return 0;
  192. }
  193. static struct pxamci_platform_data lubbock_mci_platform_data = {
  194. .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
  195. .init = lubbock_mci_init,
  196. };
  197. static void __init lubbock_init(void)
  198. {
  199. pxa_set_udc_info(&udc_info);
  200. set_pxa_fb_info(&sharp_lm8v31);
  201. pxa_set_mci_info(&lubbock_mci_platform_data);
  202. (void) platform_add_devices(devices, ARRAY_SIZE(devices));
  203. }
  204. static struct map_desc lubbock_io_desc[] __initdata = {
  205. { LUBBOCK_FPGA_VIRT, LUBBOCK_FPGA_PHYS, 0x00100000, MT_DEVICE }, /* CPLD */
  206. };
  207. static void __init lubbock_map_io(void)
  208. {
  209. pxa_map_io();
  210. iotable_init(lubbock_io_desc, ARRAY_SIZE(lubbock_io_desc));
  211. /* This enables the BTUART */
  212. pxa_gpio_mode(GPIO42_BTRXD_MD);
  213. pxa_gpio_mode(GPIO43_BTTXD_MD);
  214. pxa_gpio_mode(GPIO44_BTCTS_MD);
  215. pxa_gpio_mode(GPIO45_BTRTS_MD);
  216. /* This is for the SMC chip select */
  217. pxa_gpio_mode(GPIO79_nCS_3_MD);
  218. /* setup sleep mode values */
  219. PWER = 0x00000002;
  220. PFER = 0x00000000;
  221. PRER = 0x00000002;
  222. PGSR0 = 0x00008000;
  223. PGSR1 = 0x003F0202;
  224. PGSR2 = 0x0001C000;
  225. PCFR |= PCFR_OPDE;
  226. }
  227. MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
  228. /* Maintainer: MontaVista Software Inc. */
  229. .phys_ram = 0xa0000000,
  230. .phys_io = 0x40000000,
  231. .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
  232. .map_io = lubbock_map_io,
  233. .init_irq = lubbock_init_irq,
  234. .timer = &pxa_timer,
  235. .init_machine = lubbock_init,
  236. MACHINE_END