iop321-setup.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * linux/arch/arm/mach-iop3xx/iop321-setup.c
  3. *
  4. * Author: Nicolas Pitre <nico@cam.org>
  5. * Copyright (C) 2001 MontaVista Software, Inc.
  6. * Copyright (C) 2004 Intel Corporation.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/mm.h>
  14. #include <linux/init.h>
  15. #include <linux/config.h>
  16. #include <linux/init.h>
  17. #include <linux/major.h>
  18. #include <linux/fs.h>
  19. #include <linux/device.h>
  20. #include <linux/serial.h>
  21. #include <linux/tty.h>
  22. #include <linux/serial_core.h>
  23. #include <asm/io.h>
  24. #include <asm/pgtable.h>
  25. #include <asm/page.h>
  26. #include <asm/mach/map.h>
  27. #include <asm/setup.h>
  28. #include <asm/system.h>
  29. #include <asm/memory.h>
  30. #include <asm/hardware.h>
  31. #include <asm/mach-types.h>
  32. #include <asm/mach/arch.h>
  33. #define IOP321_UART_XTAL 1843200
  34. /*
  35. * Standard IO mapping for all IOP321 based systems
  36. */
  37. static struct map_desc iop321_std_desc[] __initdata = {
  38. /* virtual physical length type */
  39. /* mem mapped registers */
  40. { IOP321_VIRT_MEM_BASE, IOP321_PHYS_MEM_BASE, 0x00002000, MT_DEVICE },
  41. /* PCI IO space */
  42. { IOP321_PCI_LOWER_IO_VA, IOP321_PCI_LOWER_IO_PA, IOP321_PCI_IO_WINDOW_SIZE, MT_DEVICE }
  43. };
  44. #ifdef CONFIG_ARCH_IQ80321
  45. #define UARTBASE IQ80321_UART
  46. #define IRQ_UART IRQ_IQ80321_UART
  47. #endif
  48. #ifdef CONFIG_ARCH_IQ31244
  49. #define UARTBASE IQ31244_UART
  50. #define IRQ_UART IRQ_IQ31244_UART
  51. #endif
  52. static struct uart_port iop321_serial_ports[] = {
  53. {
  54. .membase = (char*)(UARTBASE),
  55. .mapbase = (UARTBASE),
  56. .irq = IRQ_UART,
  57. .flags = UPF_SKIP_TEST,
  58. .iotype = UPIO_MEM,
  59. .regshift = 0,
  60. .uartclk = IOP321_UART_XTAL,
  61. .line = 0,
  62. .type = PORT_16550A,
  63. .fifosize = 16
  64. }
  65. };
  66. static struct resource iop32x_i2c_0_resources[] = {
  67. [0] = {
  68. .start = 0xfffff680,
  69. .end = 0xfffff698,
  70. .flags = IORESOURCE_MEM,
  71. },
  72. [1] = {
  73. .start = IRQ_IOP321_I2C_0,
  74. .end = IRQ_IOP321_I2C_0,
  75. .flags = IORESOURCE_IRQ
  76. }
  77. };
  78. static struct resource iop32x_i2c_1_resources[] = {
  79. [0] = {
  80. .start = 0xfffff6a0,
  81. .end = 0xfffff6b8,
  82. .flags = IORESOURCE_MEM,
  83. },
  84. [1] = {
  85. .start = IRQ_IOP321_I2C_1,
  86. .end = IRQ_IOP321_I2C_1,
  87. .flags = IORESOURCE_IRQ
  88. }
  89. };
  90. static struct platform_device iop32x_i2c_0_controller = {
  91. .name = "IOP3xx-I2C",
  92. .id = 0,
  93. .num_resources = 2,
  94. .resource = iop32x_i2c_0_resources
  95. };
  96. static struct platform_device iop32x_i2c_1_controller = {
  97. .name = "IOP3xx-I2C",
  98. .id = 1,
  99. .num_resources = 2,
  100. .resource = iop32x_i2c_1_resources
  101. };
  102. static struct platform_device *iop32x_devices[] __initdata = {
  103. &iop32x_i2c_0_controller,
  104. &iop32x_i2c_1_controller
  105. };
  106. void __init iop32x_init(void)
  107. {
  108. if(iop_is_321())
  109. {
  110. platform_add_devices(iop32x_devices,
  111. ARRAY_SIZE(iop32x_devices));
  112. }
  113. }
  114. void __init iop321_map_io(void)
  115. {
  116. iotable_init(iop321_std_desc, ARRAY_SIZE(iop321_std_desc));
  117. early_serial_setup(&iop321_serial_ports[0]);
  118. }
  119. #ifdef CONFIG_ARCH_IQ80321
  120. extern void iq80321_map_io(void);
  121. extern struct sys_timer iop321_timer;
  122. extern void iop321_init_time(void);
  123. #endif
  124. #ifdef CONFIG_ARCH_IQ31244
  125. extern void iq31244_map_io(void);
  126. extern struct sys_timer iop321_timer;
  127. extern void iop321_init_time(void);
  128. #endif
  129. #if defined(CONFIG_ARCH_IQ80321)
  130. MACHINE_START(IQ80321, "Intel IQ80321")
  131. /* Maintainer: Intel Corporation */
  132. .phys_ram = PHYS_OFFSET,
  133. .phys_io = IQ80321_UART,
  134. .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc,
  135. .map_io = iq80321_map_io,
  136. .init_irq = iop321_init_irq,
  137. .timer = &iop321_timer,
  138. .boot_params = 0xa0000100,
  139. .init_machine = iop32x_init,
  140. MACHINE_END
  141. #elif defined(CONFIG_ARCH_IQ31244)
  142. MACHINE_START(IQ31244, "Intel IQ31244")
  143. /* Maintainer: Intel Corp. */
  144. .phys_ram = PHYS_OFFSET,
  145. .phys_io = IQ31244_UART,
  146. .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
  147. .map_io = iq31244_map_io,
  148. .init_irq = iop321_init_irq,
  149. .timer = &iop321_timer,
  150. .boot_params = 0xa0000100,
  151. .init_machine = iop32x_init,
  152. MACHINE_END
  153. #else
  154. #error No machine descriptor defined for this IOP3XX implementation
  155. #endif