iop331-setup.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  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/platform_device.h>
  19. #include <linux/serial.h>
  20. #include <linux/tty.h>
  21. #include <linux/serial_8250.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. { /* mem mapped registers */
  38. .virtual = IOP331_VIRT_MEM_BASE,
  39. .pfn = __phys_to_pfn(IOP331_PHYS_MEM_BASE),
  40. .length = 0x00002000,
  41. .type = MT_DEVICE
  42. }, { /* PCI IO space */
  43. .virtual = IOP331_PCI_LOWER_IO_VA,
  44. .pfn = __phys_to_pfn(IOP331_PCI_LOWER_IO_PA),
  45. .length = IOP331_PCI_IO_WINDOW_SIZE,
  46. .type = MT_DEVICE
  47. }
  48. };
  49. static struct resource iop33x_uart0_resources[] = {
  50. [0] = {
  51. .start = IOP331_UART0_PHYS,
  52. .end = IOP331_UART0_PHYS + 0x3f,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. [1] = {
  56. .start = IRQ_IOP331_UART0,
  57. .end = IRQ_IOP331_UART0,
  58. .flags = IORESOURCE_IRQ
  59. }
  60. };
  61. static struct resource iop33x_uart1_resources[] = {
  62. [0] = {
  63. .start = IOP331_UART1_PHYS,
  64. .end = IOP331_UART1_PHYS + 0x3f,
  65. .flags = IORESOURCE_MEM,
  66. },
  67. [1] = {
  68. .start = IRQ_IOP331_UART1,
  69. .end = IRQ_IOP331_UART1,
  70. .flags = IORESOURCE_IRQ
  71. }
  72. };
  73. static struct plat_serial8250_port iop33x_uart0_data[] = {
  74. {
  75. .membase = (char*)(IOP331_UART0_VIRT),
  76. .mapbase = (IOP331_UART0_PHYS),
  77. .irq = IRQ_IOP331_UART0,
  78. .uartclk = IOP331_UART_XTAL,
  79. .regshift = 2,
  80. .iotype = UPIO_MEM,
  81. .flags = UPF_SKIP_TEST,
  82. },
  83. { },
  84. };
  85. static struct plat_serial8250_port iop33x_uart1_data[] = {
  86. {
  87. .membase = (char*)(IOP331_UART1_VIRT),
  88. .mapbase = (IOP331_UART1_PHYS),
  89. .irq = IRQ_IOP331_UART1,
  90. .uartclk = IOP331_UART_XTAL,
  91. .regshift = 2,
  92. .iotype = UPIO_MEM,
  93. .flags = UPF_SKIP_TEST,
  94. },
  95. { },
  96. };
  97. static struct platform_device iop33x_uart0 = {
  98. .name = "serial8250",
  99. .id = 0,
  100. .dev.platform_data = iop33x_uart0_data,
  101. .num_resources = 2,
  102. .resource = iop33x_uart0_resources,
  103. };
  104. static struct platform_device iop33x_uart1 = {
  105. .name = "serial8250",
  106. .id = 1,
  107. .dev.platform_data = iop33x_uart1_data,
  108. .num_resources = 2,
  109. .resource = iop33x_uart1_resources,
  110. };
  111. static struct resource iop33x_i2c_0_resources[] = {
  112. [0] = {
  113. .start = 0xfffff680,
  114. .end = 0xfffff698,
  115. .flags = IORESOURCE_MEM,
  116. },
  117. [1] = {
  118. .start = IRQ_IOP331_I2C_0,
  119. .end = IRQ_IOP331_I2C_0,
  120. .flags = IORESOURCE_IRQ
  121. }
  122. };
  123. static struct resource iop33x_i2c_1_resources[] = {
  124. [0] = {
  125. .start = 0xfffff6a0,
  126. .end = 0xfffff6b8,
  127. .flags = IORESOURCE_MEM,
  128. },
  129. [1] = {
  130. .start = IRQ_IOP331_I2C_1,
  131. .end = IRQ_IOP331_I2C_1,
  132. .flags = IORESOURCE_IRQ
  133. }
  134. };
  135. static struct platform_device iop33x_i2c_0_controller = {
  136. .name = "IOP3xx-I2C",
  137. .id = 0,
  138. .num_resources = 2,
  139. .resource = iop33x_i2c_0_resources
  140. };
  141. static struct platform_device iop33x_i2c_1_controller = {
  142. .name = "IOP3xx-I2C",
  143. .id = 1,
  144. .num_resources = 2,
  145. .resource = iop33x_i2c_1_resources
  146. };
  147. static struct platform_device *iop33x_devices[] __initdata = {
  148. &iop33x_uart0,
  149. &iop33x_uart1,
  150. &iop33x_i2c_0_controller,
  151. &iop33x_i2c_1_controller
  152. };
  153. void __init iop33x_init(void)
  154. {
  155. if(iop_is_331())
  156. {
  157. platform_add_devices(iop33x_devices,
  158. ARRAY_SIZE(iop33x_devices));
  159. }
  160. }
  161. void __init iop331_map_io(void)
  162. {
  163. iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
  164. }
  165. #ifdef CONFIG_ARCH_IOP331
  166. extern void iop331_init_irq(void);
  167. extern struct sys_timer iop331_timer;
  168. #endif
  169. #ifdef CONFIG_ARCH_IQ80331
  170. extern void iq80331_map_io(void);
  171. #endif
  172. #ifdef CONFIG_MACH_IQ80332
  173. extern void iq80332_map_io(void);
  174. #endif
  175. #if defined(CONFIG_ARCH_IQ80331)
  176. MACHINE_START(IQ80331, "Intel IQ80331")
  177. /* Maintainer: Intel Corp. */
  178. .phys_io = 0xfefff000,
  179. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  180. .map_io = iq80331_map_io,
  181. .init_irq = iop331_init_irq,
  182. .timer = &iop331_timer,
  183. .boot_params = 0x0100,
  184. .init_machine = iop33x_init,
  185. MACHINE_END
  186. #elif defined(CONFIG_MACH_IQ80332)
  187. MACHINE_START(IQ80332, "Intel IQ80332")
  188. /* Maintainer: Intel Corp. */
  189. .phys_io = 0xfefff000,
  190. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  191. .map_io = iq80332_map_io,
  192. .init_irq = iop331_init_irq,
  193. .timer = &iop331_timer,
  194. .boot_params = 0x0100,
  195. .init_machine = iop33x_init,
  196. MACHINE_END
  197. #else
  198. #error No machine descriptor defined for this IOP3XX implementation
  199. #endif