/arch/arm/mach-iop3xx/iop321-setup.c

https://bitbucket.org/evzijst/gittest · C · 169 lines · 133 code · 18 blank · 18 comment · 2 complexity · 5d2dfafdaa08e83d41d28dd114c5c245 MD5 · raw file

  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. BOOT_MEM(PHYS_OFFSET, IQ80321_UART, IQ80321_UART)
  133. MAPIO(iq80321_map_io)
  134. INITIRQ(iop321_init_irq)
  135. .timer = &iop321_timer,
  136. BOOT_PARAMS(0xa0000100)
  137. INIT_MACHINE(iop32x_init)
  138. MACHINE_END
  139. #elif defined(CONFIG_ARCH_IQ31244)
  140. MACHINE_START(IQ31244, "Intel IQ31244")
  141. MAINTAINER("Intel Corp.")
  142. BOOT_MEM(PHYS_OFFSET, IQ31244_UART, IQ31244_UART)
  143. MAPIO(iq31244_map_io)
  144. INITIRQ(iop321_init_irq)
  145. .timer = &iop321_timer,
  146. BOOT_PARAMS(0xa0000100)
  147. INIT_MACHINE(iop32x_init)
  148. MACHINE_END
  149. #else
  150. #error No machine descriptor defined for this IOP3XX implementation
  151. #endif