iq80321.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*
  2. * arch/arm/mach-iop32x/iq80321.c
  3. *
  4. * Board support code for the Intel IQ80321 platform.
  5. *
  6. * Author: Rory Bolt <rorybolt@pacbell.net>
  7. * Copyright (C) 2002 Rory Bolt
  8. * Copyright (C) 2004 Intel Corp.
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. */
  15. #include <linux/mm.h>
  16. #include <linux/init.h>
  17. #include <linux/kernel.h>
  18. #include <linux/pci.h>
  19. #include <linux/string.h>
  20. #include <linux/slab.h>
  21. #include <linux/serial_core.h>
  22. #include <linux/serial_8250.h>
  23. #include <linux/mtd/physmap.h>
  24. #include <linux/platform_device.h>
  25. #include <linux/io.h>
  26. #include <mach/hardware.h>
  27. #include <asm/irq.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/mach/pci.h>
  31. #include <asm/mach/time.h>
  32. #include <asm/mach-types.h>
  33. #include <asm/page.h>
  34. #include <asm/pgtable.h>
  35. #include <mach/time.h>
  36. /*
  37. * IQ80321 timer tick configuration.
  38. */
  39. static void __init iq80321_timer_init(void)
  40. {
  41. /* 33.333 MHz crystal. */
  42. iop_init_time(200000000);
  43. }
  44. static struct sys_timer iq80321_timer = {
  45. .init = iq80321_timer_init,
  46. .offset = iop_gettimeoffset,
  47. };
  48. /*
  49. * IQ80321 I/O.
  50. */
  51. static struct map_desc iq80321_io_desc[] __initdata = {
  52. { /* on-board devices */
  53. .virtual = IQ80321_UART,
  54. .pfn = __phys_to_pfn(IQ80321_UART),
  55. .length = 0x00100000,
  56. .type = MT_DEVICE,
  57. },
  58. };
  59. void __init iq80321_map_io(void)
  60. {
  61. iop3xx_map_io();
  62. iotable_init(iq80321_io_desc, ARRAY_SIZE(iq80321_io_desc));
  63. }
  64. /*
  65. * IQ80321 PCI.
  66. */
  67. static int __init
  68. iq80321_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
  69. {
  70. int irq;
  71. if ((slot == 2 || slot == 6) && pin == 1) {
  72. /* PCI-X Slot INTA */
  73. irq = IRQ_IOP32X_XINT2;
  74. } else if ((slot == 2 || slot == 6) && pin == 2) {
  75. /* PCI-X Slot INTA */
  76. irq = IRQ_IOP32X_XINT3;
  77. } else if ((slot == 2 || slot == 6) && pin == 3) {
  78. /* PCI-X Slot INTA */
  79. irq = IRQ_IOP32X_XINT0;
  80. } else if ((slot == 2 || slot == 6) && pin == 4) {
  81. /* PCI-X Slot INTA */
  82. irq = IRQ_IOP32X_XINT1;
  83. } else if (slot == 4 || slot == 8) {
  84. /* Gig-E */
  85. irq = IRQ_IOP32X_XINT0;
  86. } else {
  87. printk(KERN_ERR "iq80321_pci_map_irq() called for unknown "
  88. "device PCI:%d:%d:%d\n", dev->bus->number,
  89. PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
  90. irq = -1;
  91. }
  92. return irq;
  93. }
  94. static struct hw_pci iq80321_pci __initdata = {
  95. .swizzle = pci_std_swizzle,
  96. .nr_controllers = 1,
  97. .setup = iop3xx_pci_setup,
  98. .preinit = iop3xx_pci_preinit_cond,
  99. .scan = iop3xx_pci_scan_bus,
  100. .map_irq = iq80321_pci_map_irq,
  101. };
  102. static int __init iq80321_pci_init(void)
  103. {
  104. if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
  105. machine_is_iq80321())
  106. pci_common_init(&iq80321_pci);
  107. return 0;
  108. }
  109. subsys_initcall(iq80321_pci_init);
  110. /*
  111. * IQ80321 machine initialisation.
  112. */
  113. static struct physmap_flash_data iq80321_flash_data = {
  114. .width = 1,
  115. };
  116. static struct resource iq80321_flash_resource = {
  117. .start = 0xf0000000,
  118. .end = 0xf07fffff,
  119. .flags = IORESOURCE_MEM,
  120. };
  121. static struct platform_device iq80321_flash_device = {
  122. .name = "physmap-flash",
  123. .id = 0,
  124. .dev = {
  125. .platform_data = &iq80321_flash_data,
  126. },
  127. .num_resources = 1,
  128. .resource = &iq80321_flash_resource,
  129. };
  130. static struct plat_serial8250_port iq80321_serial_port[] = {
  131. {
  132. .mapbase = IQ80321_UART,
  133. .membase = (char *)IQ80321_UART,
  134. .irq = IRQ_IOP32X_XINT1,
  135. .flags = UPF_SKIP_TEST,
  136. .iotype = UPIO_MEM,
  137. .regshift = 0,
  138. .uartclk = 1843200,
  139. },
  140. { },
  141. };
  142. static struct resource iq80321_uart_resource = {
  143. .start = IQ80321_UART,
  144. .end = IQ80321_UART + 7,
  145. .flags = IORESOURCE_MEM,
  146. };
  147. static struct platform_device iq80321_serial_device = {
  148. .name = "serial8250",
  149. .id = PLAT8250_DEV_PLATFORM,
  150. .dev = {
  151. .platform_data = iq80321_serial_port,
  152. },
  153. .num_resources = 1,
  154. .resource = &iq80321_uart_resource,
  155. };
  156. static void __init iq80321_init_machine(void)
  157. {
  158. platform_device_register(&iop3xx_i2c0_device);
  159. platform_device_register(&iop3xx_i2c1_device);
  160. platform_device_register(&iq80321_flash_device);
  161. platform_device_register(&iq80321_serial_device);
  162. platform_device_register(&iop3xx_dma_0_channel);
  163. platform_device_register(&iop3xx_dma_1_channel);
  164. platform_device_register(&iop3xx_aau_channel);
  165. }
  166. MACHINE_START(IQ80321, "Intel IQ80321")
  167. /* Maintainer: Intel Corp. */
  168. .phys_io = IQ80321_UART,
  169. .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc,
  170. .boot_params = 0xa0000100,
  171. .map_io = iq80321_map_io,
  172. .init_irq = iop32x_init_irq,
  173. .timer = &iq80321_timer,
  174. .init_machine = iq80321_init_machine,
  175. MACHINE_END