platform.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  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. .irq = EMMA2RH_IRQ_PFUR0,
  104. .uartclk = EMMA2RH_SERIAL_CLOCK,
  105. .regshift = 4,
  106. .iotype = UPIO_MEM,
  107. .flags = EMMA2RH_SERIAL_FLAGS,
  108. }, [1] = {
  109. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
  110. .irq = EMMA2RH_IRQ_PFUR1,
  111. .uartclk = EMMA2RH_SERIAL_CLOCK,
  112. .regshift = 4,
  113. .iotype = UPIO_MEM,
  114. .flags = EMMA2RH_SERIAL_FLAGS,
  115. }, [2] = {
  116. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
  117. .irq = EMMA2RH_IRQ_PFUR2,
  118. .uartclk = EMMA2RH_SERIAL_CLOCK,
  119. .regshift = 4,
  120. .iotype = UPIO_MEM,
  121. .flags = EMMA2RH_SERIAL_FLAGS,
  122. }, [3] = {
  123. .flags = 0,
  124. },
  125. };
  126. static struct platform_device serial_emma = {
  127. .name = "serial8250",
  128. .dev = {
  129. .platform_data = &platform_serial_ports,
  130. },
  131. };
  132. static struct platform_device *devices[] = {
  133. &i2c_emma_devices[0],
  134. &i2c_emma_devices[1],
  135. &i2c_emma_devices[2],
  136. &serial_emma,
  137. };
  138. static struct mtd_partition markeins_parts[] = {
  139. [0] = {
  140. .name = "RootFS",
  141. .offset = 0x00000000,
  142. .size = 0x00c00000,
  143. },
  144. [1] = {
  145. .name = "boot code area",
  146. .offset = MTDPART_OFS_APPEND,
  147. .size = 0x00100000,
  148. },
  149. [2] = {
  150. .name = "kernel image",
  151. .offset = MTDPART_OFS_APPEND,
  152. .size = 0x00300000,
  153. },
  154. [3] = {
  155. .name = "RootFS2",
  156. .offset = MTDPART_OFS_APPEND,
  157. .size = 0x00c00000,
  158. },
  159. [4] = {
  160. .name = "boot code area2",
  161. .offset = MTDPART_OFS_APPEND,
  162. .size = 0x00100000,
  163. },
  164. [5] = {
  165. .name = "kernel image2",
  166. .offset = MTDPART_OFS_APPEND,
  167. .size = MTDPART_SIZ_FULL,
  168. },
  169. };
  170. static int __init platform_devices_setup(void)
  171. {
  172. physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
  173. return platform_add_devices(devices, ARRAY_SIZE(devices));
  174. }
  175. arch_initcall(platform_devices_setup);