setup.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. /*
  2. * linux/arch/arm/mach-iop33x/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. #include <asm/hardware/iop3xx.h>
  31. #define IOP331_UART_XTAL 33334000
  32. static struct resource iop33x_uart0_resources[] = {
  33. [0] = {
  34. .start = IOP331_UART0_PHYS,
  35. .end = IOP331_UART0_PHYS + 0x3f,
  36. .flags = IORESOURCE_MEM,
  37. },
  38. [1] = {
  39. .start = IRQ_IOP331_UART0,
  40. .end = IRQ_IOP331_UART0,
  41. .flags = IORESOURCE_IRQ
  42. }
  43. };
  44. static struct resource iop33x_uart1_resources[] = {
  45. [0] = {
  46. .start = IOP331_UART1_PHYS,
  47. .end = IOP331_UART1_PHYS + 0x3f,
  48. .flags = IORESOURCE_MEM,
  49. },
  50. [1] = {
  51. .start = IRQ_IOP331_UART1,
  52. .end = IRQ_IOP331_UART1,
  53. .flags = IORESOURCE_IRQ
  54. }
  55. };
  56. static struct plat_serial8250_port iop33x_uart0_data[] = {
  57. {
  58. .membase = (char*)(IOP331_UART0_VIRT),
  59. .mapbase = (IOP331_UART0_PHYS),
  60. .irq = IRQ_IOP331_UART0,
  61. .uartclk = IOP331_UART_XTAL,
  62. .regshift = 2,
  63. .iotype = UPIO_MEM,
  64. .flags = UPF_SKIP_TEST,
  65. },
  66. { },
  67. };
  68. static struct plat_serial8250_port iop33x_uart1_data[] = {
  69. {
  70. .membase = (char*)(IOP331_UART1_VIRT),
  71. .mapbase = (IOP331_UART1_PHYS),
  72. .irq = IRQ_IOP331_UART1,
  73. .uartclk = IOP331_UART_XTAL,
  74. .regshift = 2,
  75. .iotype = UPIO_MEM,
  76. .flags = UPF_SKIP_TEST,
  77. },
  78. { },
  79. };
  80. static struct platform_device iop33x_uart0 = {
  81. .name = "serial8250",
  82. .id = PLAT8250_DEV_PLATFORM,
  83. .dev.platform_data = iop33x_uart0_data,
  84. .num_resources = 2,
  85. .resource = iop33x_uart0_resources,
  86. };
  87. static struct platform_device iop33x_uart1 = {
  88. .name = "serial8250",
  89. .id = PLAT8250_DEV_PLATFORM1,
  90. .dev.platform_data = iop33x_uart1_data,
  91. .num_resources = 2,
  92. .resource = iop33x_uart1_resources,
  93. };
  94. static struct resource iop33x_i2c_0_resources[] = {
  95. [0] = {
  96. .start = 0xfffff680,
  97. .end = 0xfffff698,
  98. .flags = IORESOURCE_MEM,
  99. },
  100. [1] = {
  101. .start = IRQ_IOP331_I2C_0,
  102. .end = IRQ_IOP331_I2C_0,
  103. .flags = IORESOURCE_IRQ
  104. }
  105. };
  106. static struct resource iop33x_i2c_1_resources[] = {
  107. [0] = {
  108. .start = 0xfffff6a0,
  109. .end = 0xfffff6b8,
  110. .flags = IORESOURCE_MEM,
  111. },
  112. [1] = {
  113. .start = IRQ_IOP331_I2C_1,
  114. .end = IRQ_IOP331_I2C_1,
  115. .flags = IORESOURCE_IRQ
  116. }
  117. };
  118. static struct platform_device iop33x_i2c_0_controller = {
  119. .name = "IOP3xx-I2C",
  120. .id = 0,
  121. .num_resources = 2,
  122. .resource = iop33x_i2c_0_resources
  123. };
  124. static struct platform_device iop33x_i2c_1_controller = {
  125. .name = "IOP3xx-I2C",
  126. .id = 1,
  127. .num_resources = 2,
  128. .resource = iop33x_i2c_1_resources
  129. };
  130. static struct platform_device *iop33x_devices[] __initdata = {
  131. &iop33x_uart0,
  132. &iop33x_uart1,
  133. &iop33x_i2c_0_controller,
  134. &iop33x_i2c_1_controller
  135. };
  136. void __init iop33x_init(void)
  137. {
  138. if(iop_is_331())
  139. {
  140. platform_add_devices(iop33x_devices,
  141. ARRAY_SIZE(iop33x_devices));
  142. }
  143. }
  144. #ifdef CONFIG_ARCH_IOP33X
  145. extern void iop331_init_irq(void);
  146. extern struct sys_timer iop331_timer;
  147. #endif
  148. #if defined(CONFIG_ARCH_IQ80331)
  149. MACHINE_START(IQ80331, "Intel IQ80331")
  150. /* Maintainer: Intel Corp. */
  151. .phys_io = 0xfefff000,
  152. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  153. .map_io = iop3xx_map_io,
  154. .init_irq = iop331_init_irq,
  155. .timer = &iop331_timer,
  156. .boot_params = 0x0100,
  157. .init_machine = iop33x_init,
  158. MACHINE_END
  159. #elif defined(CONFIG_MACH_IQ80332)
  160. MACHINE_START(IQ80332, "Intel IQ80332")
  161. /* Maintainer: Intel Corp. */
  162. .phys_io = 0xfefff000,
  163. .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
  164. .map_io = iop3xx_map_io,
  165. .init_irq = iop331_init_irq,
  166. .timer = &iop331_timer,
  167. .boot_params = 0x0100,
  168. .init_machine = iop33x_init,
  169. MACHINE_END
  170. #else
  171. #error No machine descriptor defined for this IOP3XX implementation
  172. #endif