iop331-setup.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /*
  2. * linux/arch/arm/mach-iop3xx/iop331-setup.c
  3. *
  4. * Author: Dave Jiang (dave.jiang@intel.com)
  5. * Copyright (C) 2004 Intel Corporation.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. *
  11. */
  12. #include <linux/mm.h>
  13. #include <linux/init.h>
  14. #include <linux/config.h>
  15. #include <linux/init.h>
  16. #include <linux/major.h>
  17. #include <linux/fs.h>
  18. #include <linux/device.h>
  19. #include <linux/serial.h>
  20. #include <linux/tty.h>
  21. #include <linux/serial_core.h>
  22. #include <asm/io.h>
  23. #include <asm/pgtable.h>
  24. #include <asm/page.h>
  25. #include <asm/mach/map.h>
  26. #include <asm/setup.h>
  27. #include <asm/system.h>
  28. #include <asm/memory.h>
  29. #include <asm/hardware.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #define IOP331_UART_XTAL 33334000
  33. /*
  34. * Standard IO mapping for all IOP331 based systems
  35. */
  36. static struct map_desc iop331_std_desc[] __initdata = {
  37. /* virtual physical length type */
  38. /* mem mapped registers */
  39. { IOP331_VIRT_MEM_BASE, IOP331_PHYS_MEM_BASE, 0x00002000, MT_DEVICE },
  40. /* PCI IO space */
  41. { IOP331_PCI_LOWER_IO_VA, IOP331_PCI_LOWER_IO_PA, IOP331_PCI_IO_WINDOW_SIZE, MT_DEVICE }
  42. };
  43. static struct uart_port iop331_serial_ports[] = {
  44. {
  45. .membase = (char*)(IOP331_UART0_VIRT),
  46. .mapbase = (IOP331_UART0_PHYS),
  47. .irq = IRQ_IOP331_UART0,
  48. .flags = UPF_SKIP_TEST,
  49. .iotype = UPIO_MEM,
  50. .regshift = 2,
  51. .uartclk = IOP331_UART_XTAL,
  52. .line = 0,
  53. .type = PORT_XSCALE,
  54. .fifosize = 32
  55. } , {
  56. .membase = (char*)(IOP331_UART1_VIRT),
  57. .mapbase = (IOP331_UART1_PHYS),
  58. .irq = IRQ_IOP331_UART1,
  59. .flags = UPF_SKIP_TEST,
  60. .iotype = UPIO_MEM,
  61. .regshift = 2,
  62. .uartclk = IOP331_UART_XTAL,
  63. .line = 1,
  64. .type = PORT_XSCALE,
  65. .fifosize = 32
  66. }
  67. };
  68. static struct resource iop33x_i2c_0_resources[] = {
  69. [0] = {
  70. .start = 0xfffff680,
  71. .end = 0xfffff698,
  72. .flags = IORESOURCE_MEM,
  73. },
  74. [1] = {
  75. .start = IRQ_IOP331_I2C_0,
  76. .end = IRQ_IOP331_I2C_0,
  77. .flags = IORESOURCE_IRQ
  78. }
  79. };
  80. static struct resource iop33x_i2c_1_resources[] = {
  81. [0] = {
  82. .start = 0xfffff6a0,
  83. .end = 0xfffff6b8,
  84. .flags = IORESOURCE_MEM,
  85. },
  86. [1] = {
  87. .start = IRQ_IOP331_I2C_1,
  88. .end = IRQ_IOP331_I2C_1,
  89. .flags = IORESOURCE_IRQ
  90. }
  91. };
  92. static struct platform_device iop33x_i2c_0_controller = {
  93. .name = "IOP3xx-I2C",
  94. .id = 0,
  95. .num_resources = 2,
  96. .resource = iop33x_i2c_0_resources
  97. };
  98. static struct platform_device iop33x_i2c_1_controller = {
  99. .name = "IOP3xx-I2C",
  100. .id = 1,
  101. .num_resources = 2,
  102. .resource = iop33x_i2c_1_resources
  103. };
  104. static struct platform_device *iop33x_devices[] __initdata = {
  105. &iop33x_i2c_0_controller,
  106. &iop33x_i2c_1_controller
  107. };
  108. void __init iop33x_init(void)
  109. {
  110. if(iop_is_331())
  111. {
  112. platform_add_devices(iop33x_devices,
  113. ARRAY_SIZE(iop33x_devices));
  114. }
  115. }
  116. void __init iop331_map_io(void)
  117. {
  118. iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
  119. early_serial_setup(&iop331_serial_ports[0]);
  120. early_serial_setup(&iop331_serial_ports[1]);
  121. }
  122. #ifdef CONFIG_ARCH_IOP331
  123. extern void iop331_init_irq(void);
  124. extern struct sys_timer iop331_timer;
  125. #endif
  126. #ifdef CONFIG_ARCH_IQ80331
  127. extern void iq80331_map_io(void);
  128. #endif
  129. #ifdef CONFIG_MACH_IQ80332
  130. extern void iq80332_map_io(void);
  131. #endif
  132. #if defined(CONFIG_ARCH_IQ80331)
  133. MACHINE_START(IQ80331, "Intel IQ80331")
  134. /* Maintainer: Intel Corp. */
  135. .phys_ram = PHYS_OFFSET,
  136. .phys_io = 0xfefff000,
  137. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  138. .map_io = iq80331_map_io,
  139. .init_irq = iop331_init_irq,
  140. .timer = &iop331_timer,
  141. .boot_params = 0x0100,
  142. .init_machine = iop33x_init,
  143. MACHINE_END
  144. #elif defined(CONFIG_MACH_IQ80332)
  145. MACHINE_START(IQ80332, "Intel IQ80332")
  146. /* Maintainer: Intel Corp. */
  147. .phys_ram = PHYS_OFFSET,
  148. .phys_io = 0xfefff000,
  149. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  150. .map_io = iq80332_map_io,
  151. .init_irq = iop331_init_irq,
  152. .timer = &iop331_timer,
  153. .boot_params = 0x0100,
  154. .init_machine = iop33x_init,
  155. MACHINE_END
  156. #else
  157. #error No machine descriptor defined for this IOP3XX implementation
  158. #endif