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