iop331-setup.c 5.0 KB

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