iop331-setup.c 5.0 KB

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