iq80331.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /*
  2. * arch/arm/mach-iop33x/iq80331.c
  3. *
  4. * Board support code for the Intel IQ80331 platform.
  5. *
  6. * Author: Dave Jiang <dave.jiang@intel.com>
  7. * Copyright (C) 2003 Intel Corp.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  14. #include <linux/mm.h>
  15. #include <linux/init.h>
  16. #include <linux/kernel.h>
  17. #include <linux/pci.h>
  18. #include <linux/string.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/serial_8250.h>
  21. #include <linux/mtd/physmap.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/io.h>
  24. #include <mach/hardware.h>
  25. #include <asm/irq.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/pci.h>
  29. #include <asm/mach/time.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/page.h>
  32. #include <asm/pgtable.h>
  33. #include <mach/time.h>
  34. /*
  35. * IQ80331 timer tick configuration.
  36. */
  37. static void __init iq80331_timer_init(void)
  38. {
  39. /* D-Step parts run at a higher internal bus frequency */
  40. if (*IOP3XX_ATURID >= 0xa)
  41. iop_init_time(333000000);
  42. else
  43. iop_init_time(266000000);
  44. }
  45. /*
  46. * IQ80331 PCI.
  47. */
  48. static int __init
  49. iq80331_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  50. {
  51. int irq;
  52. if (slot == 1 && pin == 1) {
  53. /* PCI-X Slot INTA */
  54. irq = IRQ_IOP33X_XINT1;
  55. } else if (slot == 1 && pin == 2) {
  56. /* PCI-X Slot INTB */
  57. irq = IRQ_IOP33X_XINT2;
  58. } else if (slot == 1 && pin == 3) {
  59. /* PCI-X Slot INTC */
  60. irq = IRQ_IOP33X_XINT3;
  61. } else if (slot == 1 && pin == 4) {
  62. /* PCI-X Slot INTD */
  63. irq = IRQ_IOP33X_XINT0;
  64. } else if (slot == 2) {
  65. /* GigE */
  66. irq = IRQ_IOP33X_XINT2;
  67. } else {
  68. printk(KERN_ERR "iq80331_pci_map_irq() called for unknown "
  69. "device PCI:%d:%d:%d\n", dev->bus->number,
  70. PCI_SLOT(dev->devfn), PCI_FUNC(dev->devfn));
  71. irq = -1;
  72. }
  73. return irq;
  74. }
  75. static struct hw_pci iq80331_pci __initdata = {
  76. .nr_controllers = 1,
  77. .ops = &iop3xx_ops,
  78. .setup = iop3xx_pci_setup,
  79. .preinit = iop3xx_pci_preinit_cond,
  80. .map_irq = iq80331_pci_map_irq,
  81. };
  82. static int __init iq80331_pci_init(void)
  83. {
  84. if ((iop3xx_get_init_atu() == IOP3XX_INIT_ATU_ENABLE) &&
  85. machine_is_iq80331())
  86. pci_common_init(&iq80331_pci);
  87. return 0;
  88. }
  89. subsys_initcall(iq80331_pci_init);
  90. /*
  91. * IQ80331 machine initialisation.
  92. */
  93. static struct physmap_flash_data iq80331_flash_data = {
  94. .width = 1,
  95. };
  96. static struct resource iq80331_flash_resource = {
  97. .start = 0xc0000000,
  98. .end = 0xc07fffff,
  99. .flags = IORESOURCE_MEM,
  100. };
  101. static struct platform_device iq80331_flash_device = {
  102. .name = "physmap-flash",
  103. .id = 0,
  104. .dev = {
  105. .platform_data = &iq80331_flash_data,
  106. },
  107. .num_resources = 1,
  108. .resource = &iq80331_flash_resource,
  109. };
  110. static struct resource iq80331_gpio_res[] = {
  111. DEFINE_RES_MEM((IOP3XX_PERIPHERAL_PHYS_BASE + 0x1780), 0x10),
  112. };
  113. static void __init iq80331_init_machine(void)
  114. {
  115. platform_device_register_simple("gpio-iop", 0,
  116. iq80331_gpio_res,
  117. ARRAY_SIZE(iq80331_gpio_res));
  118. platform_device_register(&iop3xx_i2c0_device);
  119. platform_device_register(&iop3xx_i2c1_device);
  120. platform_device_register(&iop33x_uart0_device);
  121. platform_device_register(&iop33x_uart1_device);
  122. platform_device_register(&iq80331_flash_device);
  123. platform_device_register(&iop3xx_dma_0_channel);
  124. platform_device_register(&iop3xx_dma_1_channel);
  125. platform_device_register(&iop3xx_aau_channel);
  126. }
  127. MACHINE_START(IQ80331, "Intel IQ80331")
  128. /* Maintainer: Intel Corp. */
  129. .atag_offset = 0x100,
  130. .map_io = iop3xx_map_io,
  131. .init_irq = iop33x_init_irq,
  132. .init_time = iq80331_timer_init,
  133. .init_machine = iq80331_init_machine,
  134. .restart = iop3xx_restart,
  135. MACHINE_END