platform.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /*
  2. * arch/mips/emma2rh/markeins/platofrm.c
  3. * This file sets up platform devices for EMMA2RH Mark-eins.
  4. *
  5. * Copyright(C) MontaVista Software Inc, 2006
  6. *
  7. * Author: dmitry pervushin <dpervushin@ru.mvista.com>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. */
  23. #include <linux/init.h>
  24. #include <linux/kernel.h>
  25. #include <linux/types.h>
  26. #include <linux/ioport.h>
  27. #include <linux/serial_8250.h>
  28. #include <linux/mtd/physmap.h>
  29. #include <asm/cpu.h>
  30. #include <asm/bootinfo.h>
  31. #include <asm/addrspace.h>
  32. #include <asm/time.h>
  33. #include <asm/bcache.h>
  34. #include <asm/irq.h>
  35. #include <asm/reboot.h>
  36. #include <asm/traps.h>
  37. #include <asm/emma/emma2rh.h>
  38. #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
  39. static struct resource i2c_emma_resources_0[] = {
  40. {
  41. .name = NULL,
  42. .start = EMMA2RH_IRQ_PIIC0,
  43. .end = EMMA2RH_IRQ_PIIC0,
  44. .flags = IORESOURCE_IRQ
  45. }, {
  46. .name = NULL,
  47. .start = EMMA2RH_PIIC0_BASE,
  48. .end = EMMA2RH_PIIC0_BASE + 0x1000,
  49. .flags = 0
  50. },
  51. };
  52. struct resource i2c_emma_resources_1[] = {
  53. {
  54. .name = NULL,
  55. .start = EMMA2RH_IRQ_PIIC1,
  56. .end = EMMA2RH_IRQ_PIIC1,
  57. .flags = IORESOURCE_IRQ
  58. }, {
  59. .name = NULL,
  60. .start = EMMA2RH_PIIC1_BASE,
  61. .end = EMMA2RH_PIIC1_BASE + 0x1000,
  62. .flags = 0
  63. },
  64. };
  65. struct resource i2c_emma_resources_2[] = {
  66. {
  67. .name = NULL,
  68. .start = EMMA2RH_IRQ_PIIC2,
  69. .end = EMMA2RH_IRQ_PIIC2,
  70. .flags = IORESOURCE_IRQ
  71. }, {
  72. .name = NULL,
  73. .start = EMMA2RH_PIIC2_BASE,
  74. .end = EMMA2RH_PIIC2_BASE + 0x1000,
  75. .flags = 0
  76. },
  77. };
  78. struct platform_device i2c_emma_devices[] = {
  79. [0] = {
  80. .name = I2C_EMMA2RH,
  81. .id = 0,
  82. .resource = i2c_emma_resources_0,
  83. .num_resources = ARRAY_SIZE(i2c_emma_resources_0),
  84. },
  85. [1] = {
  86. .name = I2C_EMMA2RH,
  87. .id = 1,
  88. .resource = i2c_emma_resources_1,
  89. .num_resources = ARRAY_SIZE(i2c_emma_resources_1),
  90. },
  91. [2] = {
  92. .name = I2C_EMMA2RH,
  93. .id = 2,
  94. .resource = i2c_emma_resources_2,
  95. .num_resources = ARRAY_SIZE(i2c_emma_resources_2),
  96. },
  97. };
  98. #define EMMA2RH_SERIAL_CLOCK 18544000
  99. #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
  100. static struct plat_serial8250_port platform_serial_ports[] = {
  101. [0] = {
  102. .membase= (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),
  103. .mapbase = EMMA2RH_PFUR0_BASE + 3,
  104. .irq = EMMA2RH_IRQ_PFUR0,
  105. .uartclk = EMMA2RH_SERIAL_CLOCK,
  106. .regshift = 4,
  107. .iotype = UPIO_MEM,
  108. .flags = EMMA2RH_SERIAL_FLAGS,
  109. }, [1] = {
  110. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
  111. .mapbase = EMMA2RH_PFUR1_BASE + 3,
  112. .irq = EMMA2RH_IRQ_PFUR1,
  113. .uartclk = EMMA2RH_SERIAL_CLOCK,
  114. .regshift = 4,
  115. .iotype = UPIO_MEM,
  116. .flags = EMMA2RH_SERIAL_FLAGS,
  117. }, [2] = {
  118. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
  119. .mapbase = EMMA2RH_PFUR2_BASE + 3,
  120. .irq = EMMA2RH_IRQ_PFUR2,
  121. .uartclk = EMMA2RH_SERIAL_CLOCK,
  122. .regshift = 4,
  123. .iotype = UPIO_MEM,
  124. .flags = EMMA2RH_SERIAL_FLAGS,
  125. }, [3] = {
  126. .flags = 0,
  127. },
  128. };
  129. static struct platform_device serial_emma = {
  130. .name = "serial8250",
  131. .dev = {
  132. .platform_data = &platform_serial_ports,
  133. },
  134. };
  135. static struct mtd_partition markeins_parts[] = {
  136. [0] = {
  137. .name = "RootFS",
  138. .offset = 0x00000000,
  139. .size = 0x00c00000,
  140. },
  141. [1] = {
  142. .name = "boot code area",
  143. .offset = MTDPART_OFS_APPEND,
  144. .size = 0x00100000,
  145. },
  146. [2] = {
  147. .name = "kernel image",
  148. .offset = MTDPART_OFS_APPEND,
  149. .size = 0x00300000,
  150. },
  151. [3] = {
  152. .name = "RootFS2",
  153. .offset = MTDPART_OFS_APPEND,
  154. .size = 0x00c00000,
  155. },
  156. [4] = {
  157. .name = "boot code area2",
  158. .offset = MTDPART_OFS_APPEND,
  159. .size = 0x00100000,
  160. },
  161. [5] = {
  162. .name = "kernel image2",
  163. .offset = MTDPART_OFS_APPEND,
  164. .size = MTDPART_SIZ_FULL,
  165. },
  166. };
  167. static struct physmap_flash_data markeins_flash_data = {
  168. .width = 2,
  169. .nr_parts = ARRAY_SIZE(markeins_parts),
  170. .parts = markeins_parts
  171. };
  172. static struct resource markeins_flash_resource = {
  173. .start = 0x1e000000,
  174. .end = 0x02000000,
  175. .flags = IORESOURCE_MEM
  176. };
  177. static struct platform_device markeins_flash_device = {
  178. .name = "physmap-flash",
  179. .id = 0,
  180. .dev = {
  181. .platform_data = &markeins_flash_data,
  182. },
  183. .num_resources = 1,
  184. .resource = &markeins_flash_resource,
  185. };
  186. static struct platform_device *devices[] = {
  187. i2c_emma_devices,
  188. i2c_emma_devices + 1,
  189. i2c_emma_devices + 2,
  190. &serial_emma,
  191. &markeins_flash_device,
  192. };
  193. static int __init platform_devices_setup(void)
  194. {
  195. return platform_add_devices(devices, ARRAY_SIZE(devices));
  196. }
  197. arch_initcall(platform_devices_setup);