/arch/arm/mach-cns3xxx/cns3420vb.c

https://bitbucket.org/sammyz/iscream_thunderc-2.6.35-rebase · C · 148 lines · 111 code · 14 blank · 23 comment · 0 complexity · ca805dfea569f9d204a5e764d280b8fe MD5 · raw file

  1. /*
  2. * Cavium Networks CNS3420 Validation Board
  3. *
  4. * Copyright 2000 Deep Blue Solutions Ltd
  5. * Copyright 2008 ARM Limited
  6. * Copyright 2008 Cavium Networks
  7. * Scott Shu
  8. * Copyright 2010 MontaVista Software, LLC.
  9. * Anton Vorontsov <avorontsov@mvista.com>
  10. *
  11. * This file is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License, Version 2, as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/init.h>
  16. #include <linux/kernel.h>
  17. #include <linux/compiler.h>
  18. #include <linux/io.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/serial_8250.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/mtd/mtd.h>
  23. #include <linux/mtd/physmap.h>
  24. #include <linux/mtd/partitions.h>
  25. #include <asm/setup.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/time.h>
  30. #include <mach/hardware.h>
  31. #include <mach/cns3xxx.h>
  32. #include <mach/irqs.h>
  33. #include "core.h"
  34. /*
  35. * NOR Flash
  36. */
  37. static struct mtd_partition cns3420_nor_partitions[] = {
  38. {
  39. .name = "uboot",
  40. .size = 0x00040000,
  41. .offset = 0,
  42. .mask_flags = MTD_WRITEABLE,
  43. }, {
  44. .name = "kernel",
  45. .size = 0x004C0000,
  46. .offset = MTDPART_OFS_APPEND,
  47. }, {
  48. .name = "filesystem",
  49. .size = 0x7000000,
  50. .offset = MTDPART_OFS_APPEND,
  51. }, {
  52. .name = "filesystem2",
  53. .size = 0x0AE0000,
  54. .offset = MTDPART_OFS_APPEND,
  55. }, {
  56. .name = "ubootenv",
  57. .size = MTDPART_SIZ_FULL,
  58. .offset = MTDPART_OFS_APPEND,
  59. },
  60. };
  61. static struct physmap_flash_data cns3420_nor_pdata = {
  62. .width = 2,
  63. .parts = cns3420_nor_partitions,
  64. .nr_parts = ARRAY_SIZE(cns3420_nor_partitions),
  65. };
  66. static struct resource cns3420_nor_res = {
  67. .start = CNS3XXX_FLASH_BASE,
  68. .end = CNS3XXX_FLASH_BASE + SZ_128M - 1,
  69. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  70. };
  71. static struct platform_device cns3420_nor_pdev = {
  72. .name = "physmap-flash",
  73. .id = 0,
  74. .resource = &cns3420_nor_res,
  75. .num_resources = 1,
  76. .dev = {
  77. .platform_data = &cns3420_nor_pdata,
  78. },
  79. };
  80. /*
  81. * UART
  82. */
  83. static void __init cns3420_early_serial_setup(void)
  84. {
  85. #ifdef CONFIG_SERIAL_8250_CONSOLE
  86. static struct uart_port cns3420_serial_port = {
  87. .membase = (void __iomem *)CNS3XXX_UART0_BASE_VIRT,
  88. .mapbase = CNS3XXX_UART0_BASE,
  89. .irq = IRQ_CNS3XXX_UART0,
  90. .iotype = UPIO_MEM,
  91. .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
  92. .regshift = 2,
  93. .uartclk = 24000000,
  94. .line = 0,
  95. .type = PORT_16550A,
  96. .fifosize = 16,
  97. };
  98. early_serial_setup(&cns3420_serial_port);
  99. #endif
  100. }
  101. /*
  102. * Initialization
  103. */
  104. static struct platform_device *cns3420_pdevs[] __initdata = {
  105. &cns3420_nor_pdev,
  106. };
  107. static void __init cns3420_init(void)
  108. {
  109. platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
  110. pm_power_off = cns3xxx_power_off;
  111. }
  112. static struct map_desc cns3420_io_desc[] __initdata = {
  113. {
  114. .virtual = CNS3XXX_UART0_BASE_VIRT,
  115. .pfn = __phys_to_pfn(CNS3XXX_UART0_BASE),
  116. .length = SZ_4K,
  117. .type = MT_DEVICE,
  118. },
  119. };
  120. static void __init cns3420_map_io(void)
  121. {
  122. cns3xxx_map_io();
  123. iotable_init(cns3420_io_desc, ARRAY_SIZE(cns3420_io_desc));
  124. cns3420_early_serial_setup();
  125. }
  126. MACHINE_START(CNS3420VB, "Cavium Networks CNS3420 Validation Board")
  127. .phys_io = CNS3XXX_UART0_BASE,
  128. .io_pg_offst = (CNS3XXX_UART0_BASE_VIRT >> 18) & 0xfffc,
  129. .boot_params = 0x00000100,
  130. .map_io = cns3420_map_io,
  131. .init_irq = cns3xxx_init_irq,
  132. .timer = &cns3xxx_timer,
  133. .init_machine = cns3420_init,
  134. MACHINE_END