platform.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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/gdb-stub.h>
  37. #include <asm/traps.h>
  38. #include <asm/debug.h>
  39. #include <asm/emma2rh/emma2rh.h>
  40. #define I2C_EMMA2RH "emma2rh-iic" /* must be in sync with IIC driver */
  41. static struct resource i2c_emma_resources_0[] = {
  42. { NULL, EMMA2RH_IRQ_PIIC0, EMMA2RH_IRQ_PIIC0, IORESOURCE_IRQ },
  43. { NULL, KSEG1ADDR(EMMA2RH_PIIC0_BASE), KSEG1ADDR(EMMA2RH_PIIC0_BASE + 0x1000), 0 },
  44. };
  45. struct resource i2c_emma_resources_1[] = {
  46. { NULL, EMMA2RH_IRQ_PIIC1, EMMA2RH_IRQ_PIIC1, IORESOURCE_IRQ },
  47. { NULL, KSEG1ADDR(EMMA2RH_PIIC1_BASE), KSEG1ADDR(EMMA2RH_PIIC1_BASE + 0x1000), 0 },
  48. };
  49. struct resource i2c_emma_resources_2[] = {
  50. { NULL, EMMA2RH_IRQ_PIIC2, EMMA2RH_IRQ_PIIC2, IORESOURCE_IRQ },
  51. { NULL, KSEG1ADDR(EMMA2RH_PIIC2_BASE), KSEG1ADDR(EMMA2RH_PIIC2_BASE + 0x1000), 0 },
  52. };
  53. struct platform_device i2c_emma_devices[] = {
  54. [0] = {
  55. .name = I2C_EMMA2RH,
  56. .id = 0,
  57. .resource = i2c_emma_resources_0,
  58. .num_resources = ARRAY_SIZE(i2c_emma_resources_0),
  59. },
  60. [1] = {
  61. .name = I2C_EMMA2RH,
  62. .id = 1,
  63. .resource = i2c_emma_resources_1,
  64. .num_resources = ARRAY_SIZE(i2c_emma_resources_1),
  65. },
  66. [2] = {
  67. .name = I2C_EMMA2RH,
  68. .id = 2,
  69. .resource = i2c_emma_resources_2,
  70. .num_resources = ARRAY_SIZE(i2c_emma_resources_2),
  71. },
  72. };
  73. #define EMMA2RH_SERIAL_CLOCK 18544000
  74. #define EMMA2RH_SERIAL_FLAGS UPF_BOOT_AUTOCONF | UPF_SKIP_TEST
  75. static struct plat_serial8250_port platform_serial_ports[] = {
  76. [0] = {
  77. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR0_BASE + 3),
  78. .irq = EMMA2RH_IRQ_PFUR0,
  79. .uartclk = EMMA2RH_SERIAL_CLOCK,
  80. .regshift = 4,
  81. .iotype = UPIO_MEM,
  82. .flags = EMMA2RH_SERIAL_FLAGS,
  83. },
  84. [1] = {
  85. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR1_BASE + 3),
  86. .irq = EMMA2RH_IRQ_PFUR1,
  87. .uartclk = EMMA2RH_SERIAL_CLOCK,
  88. .regshift = 4,
  89. .iotype = UPIO_MEM,
  90. .flags = EMMA2RH_SERIAL_FLAGS,
  91. },
  92. [2] = {
  93. .membase = (void __iomem*)KSEG1ADDR(EMMA2RH_PFUR2_BASE + 3),
  94. .irq = EMMA2RH_IRQ_PFUR2,
  95. .uartclk = EMMA2RH_SERIAL_CLOCK,
  96. .regshift = 4,
  97. .iotype = UPIO_MEM,
  98. .flags = EMMA2RH_SERIAL_FLAGS,
  99. },
  100. [3] = {
  101. .flags = 0,
  102. },
  103. };
  104. static struct platform_device serial_emma = {
  105. .name = "serial8250",
  106. .dev = {
  107. .platform_data = &platform_serial_ports,
  108. },
  109. };
  110. static struct platform_device *devices[] = {
  111. &i2c_emma_devices[0],
  112. &i2c_emma_devices[1],
  113. &i2c_emma_devices[2],
  114. &serial_emma,
  115. };
  116. static struct mtd_partition markeins_parts[] = {
  117. [0] = {
  118. .name = "RootFS",
  119. .offset = 0x00000000,
  120. .size = 0x00c00000,
  121. },
  122. [1] = {
  123. .name = "boot code area",
  124. .offset = MTDPART_OFS_APPEND,
  125. .size = 0x00100000,
  126. },
  127. [2] = {
  128. .name = "kernel image",
  129. .offset = MTDPART_OFS_APPEND,
  130. .size = 0x00300000,
  131. },
  132. [3] = {
  133. .name = "RootFS2",
  134. .offset = MTDPART_OFS_APPEND,
  135. .size = 0x00c00000,
  136. },
  137. [4] = {
  138. .name = "boot code area2",
  139. .offset = MTDPART_OFS_APPEND,
  140. .size = 0x00100000,
  141. },
  142. [5] = {
  143. .name = "kernel image2",
  144. .offset = MTDPART_OFS_APPEND,
  145. .size = MTDPART_SIZ_FULL,
  146. },
  147. };
  148. static int __init platform_devices_setup(void)
  149. {
  150. physmap_set_partitions(markeins_parts, ARRAY_SIZE(markeins_parts));
  151. return platform_add_devices(devices, ARRAY_SIZE(devices));
  152. }
  153. arch_initcall(platform_devices_setup);