Advertisement
robertd

linux/arch/arm/mach-mp200/mp200_board.c

Jul 24th, 2016
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.60 KB | None | 0 0
  1. /*
  2. * File Name : linux/arch/arm/mach-mp200/mp200_board.c
  3. * Function : mp200_board
  4. * Release Version : Ver 1.02
  5. * Release Date : 2006/09/22
  6. *
  7. * Copyright (C) NEC Electronics Corporation 2005-2006
  8. *
  9. *
  10. * This program is free software;you can redistribute it and/or modify it under the terms of
  11. * the GNU General Public License as published by Free Softwere Foundation; either version 2
  12. * of License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  15. * without even the implied warrnty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  16. * See the GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with this program;
  19. * If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  20. * MA 02111-1307, USA.
  21. *
  22. */
  23.  
  24. #include <linux/device.h>
  25. #include <linux/init.h>
  26. #include <linux/interrupt.h>
  27. #include <linux/types.h>
  28. #include <linux/mtd/nand.h>
  29. #include <linux/mtd/partitions.h>
  30.  
  31. #include <asm/hardware.h>
  32. #include <asm/io.h>
  33. #include <asm/setup.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/mach/arch.h>
  36. #include <asm/mach/map.h>
  37. #include <asm/mach/flash.h>
  38.  
  39. #include <asm/arch/gio.h>
  40. #include <asm/arch/gpiocore.h>
  41.  
  42. #include "generic.h"
  43. #include "time.h"
  44.  
  45. #define GPIO_INPORT 0xFFFFFFDFFFFFFE7FULL /* GPIO input */
  46.  
  47. static struct map_desc mp200_board_io_desc[] __initdata = {
  48. /* BANK2 */
  49. MP200_MAP_DESC(MP200_EXTDEVICE_BASE, MP200_EXTDEVICE_SIZE),
  50. MP200_MAP_DESC(MP200_ASYNC0_BASE, MP200_ASYNC0_SIZE),
  51. };
  52.  
  53. static struct resource smc91x_resources[] = {
  54. [0] = {
  55. .start = MP200_ETHER_BASE,
  56. .end = MP200_ETHER_BASE + MP200_ETHER_SIZE - 1,
  57. .flags = IORESOURCE_MEM,
  58. },
  59. [1] = {
  60. .start = INT_GPIO_ETHER_INT,
  61. .end = INT_GPIO_ETHER_INT,
  62. .flags = IORESOURCE_IRQ,
  63. },
  64. };
  65. static struct platform_device smc91x_device = {
  66. .name = "smc91x",
  67. .id = -1,
  68. .num_resources = ARRAY_SIZE(smc91x_resources),
  69. .resource = smc91x_resources,
  70. };
  71.  
  72. static struct mtd_partition mp200_nand_partition[] = {
  73. {
  74. .name = "nand boot",
  75. .offset = 0,
  76. .size = 0x00200000,
  77. },
  78. {
  79. .name = "nand kernel",
  80. .offset = MTDPART_OFS_APPEND,
  81. .size = 0x00400000,
  82. },
  83. {
  84. .name = "nand rootfs",
  85. .offset = MTDPART_OFS_APPEND,
  86. .size = 0x01A00000,
  87. },
  88. {
  89. .name = "nand data",
  90. .offset = MTDPART_OFS_APPEND,
  91. .size = MTDPART_SIZ_FULL,
  92. },
  93. };
  94. static struct flash_platform_data mp200_nand_data = {
  95. .map_name = "mp200_nand",
  96. .parts = mp200_nand_partition,
  97. .nr_parts = ARRAY_SIZE(mp200_nand_partition),
  98. };
  99. static struct platform_device mp200_nand_device = {
  100. .name = "mp200_nand",
  101. .id = -1,
  102. .dev = {
  103. .platform_data = &mp200_nand_data,
  104. },
  105. };
  106.  
  107. static struct mtd_partition mp200_flash0_partitions[] = {
  108. {
  109. .name = "Boot",
  110. .offset = 0,
  111. .size = 0x00200000,
  112. .mask_flags = MTD_WRITEABLE, /* force read-only */
  113. },
  114. {
  115. .name = "Kernel",
  116. .offset = MTDPART_OFS_APPEND,
  117. .size = 0x00400000,
  118. .mask_flags = MTD_WRITEABLE, /* force read-only */
  119. },
  120. {
  121. .name = "Root",
  122. .offset = MTDPART_OFS_APPEND,
  123. .size = 0x01a00000,
  124. .mask_flags = MTD_WRITEABLE, /* force read-only */
  125. },
  126. };
  127. static struct flash_platform_data mp200_flash0_data = {
  128. .map_name = "cfi_probe",
  129. .width = 2,
  130. .parts = mp200_flash0_partitions,
  131. .nr_parts = ARRAY_SIZE(mp200_flash0_partitions),
  132. };
  133. static struct resource mp200_flash0_resource = {
  134. .start = MP200_FLASH_BASE,
  135. .end = MP200_FLASH_BASE + SZ_32M - 1,
  136. .flags = IORESOURCE_MEM,
  137. };
  138. static struct platform_device mp200_flash0_device = {
  139. .name = "mp200_flash",
  140. .id = 0,
  141. .dev = {
  142. .platform_data = &mp200_flash0_data,
  143. },
  144. .num_resources = 1,
  145. .resource = &mp200_flash0_resource,
  146. };
  147.  
  148. static struct platform_device mp200_touchscreen_device = {
  149. .name = "mp200_touchscreen",
  150. .id = -1,
  151. };
  152.  
  153. static struct platform_device *devs[] __initdata = {
  154. &smc91x_device,
  155. &mp200_nand_device,
  156. &mp200_flash0_device,
  157. &mp200_touchscreen_device,
  158. };
  159.  
  160. static void __init fixup_mp200_board(struct machine_desc *desc,
  161. struct tag *tags, char **cmdline,
  162. struct meminfo *mi)
  163. {
  164. /* none */
  165. }
  166.  
  167. static void __init mp200_board_map_io(void)
  168. {
  169. mp200_map_io();
  170. iotable_init(mp200_board_io_desc, ARRAY_SIZE(mp200_board_io_desc));
  171. mp200_serial_init();
  172. }
  173.  
  174. static void __init mp200_board_init(void)
  175. {
  176. /* initialize GPIO register */
  177. /* GPIO set output port */
  178. mp200_gio_set_mode_output(~GPIO_INPORT);
  179.  
  180. /* GPIO set input port */
  181. mp200_gio_set_mode_input(GPIO_INPORT);
  182. }
  183.  
  184. static int __init mp200_board_device_init(void)
  185. {
  186. return platform_add_devices(devs, ARRAY_SIZE(devs));
  187. }
  188.  
  189. arch_initcall(mp200_board_device_init);
  190.  
  191. MACHINE_START(MP200, "MP200")
  192. MAINTAINER("NEC Electronics Corp.")
  193. BOOT_MEM(PHYS_OFFSET, MP200_BANK5_BASE, IO_ADDRESS(MP200_BANK5_BASE))
  194. BOOT_PARAMS(PHYS_OFFSET + 0x100)
  195. FIXUP(fixup_mp200_board)
  196. MAPIO(mp200_board_map_io)
  197. INITIRQ(mp200_init_irq)
  198. INIT_MACHINE(mp200_board_init)
  199. .timer = &mp200_timer, MACHINE_END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement