cns3420vb.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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. #include "devices.h"
  35. /*
  36. * NOR Flash
  37. */
  38. static struct mtd_partition cns3420_nor_partitions[] = {
  39. {
  40. .name = "uboot",
  41. .size = 0x00040000,
  42. .offset = 0,
  43. .mask_flags = MTD_WRITEABLE,
  44. }, {
  45. .name = "kernel",
  46. .size = 0x004C0000,
  47. .offset = MTDPART_OFS_APPEND,
  48. }, {
  49. .name = "filesystem",
  50. .size = 0x7000000,
  51. .offset = MTDPART_OFS_APPEND,
  52. }, {
  53. .name = "filesystem2",
  54. .size = 0x0AE0000,
  55. .offset = MTDPART_OFS_APPEND,
  56. }, {
  57. .name = "ubootenv",
  58. .size = MTDPART_SIZ_FULL,
  59. .offset = MTDPART_OFS_APPEND,
  60. },
  61. };
  62. static struct physmap_flash_data cns3420_nor_pdata = {
  63. .width = 2,
  64. .parts = cns3420_nor_partitions,
  65. .nr_parts = ARRAY_SIZE(cns3420_nor_partitions),
  66. };
  67. static struct resource cns3420_nor_res = {
  68. .start = CNS3XXX_FLASH_BASE,
  69. .end = CNS3XXX_FLASH_BASE + SZ_128M - 1,
  70. .flags = IORESOURCE_MEM | IORESOURCE_MEM_32BIT,
  71. };
  72. static struct platform_device cns3420_nor_pdev = {
  73. .name = "physmap-flash",
  74. .id = 0,
  75. .resource = &cns3420_nor_res,
  76. .num_resources = 1,
  77. .dev = {
  78. .platform_data = &cns3420_nor_pdata,
  79. },
  80. };
  81. /*
  82. * UART
  83. */
  84. static void __init cns3420_early_serial_setup(void)
  85. {
  86. #ifdef CONFIG_SERIAL_8250_CONSOLE
  87. static struct uart_port cns3420_serial_port = {
  88. .membase = (void __iomem *)CNS3XXX_UART0_BASE_VIRT,
  89. .mapbase = CNS3XXX_UART0_BASE,
  90. .irq = IRQ_CNS3XXX_UART0,
  91. .iotype = UPIO_MEM,
  92. .flags = UPF_BOOT_AUTOCONF | UPF_FIXED_TYPE,
  93. .regshift = 2,
  94. .uartclk = 24000000,
  95. .line = 0,
  96. .type = PORT_16550A,
  97. .fifosize = 16,
  98. };
  99. early_serial_setup(&cns3420_serial_port);
  100. #endif
  101. }
  102. /*
  103. * Initialization
  104. */
  105. static struct platform_device *cns3420_pdevs[] __initdata = {
  106. &cns3420_nor_pdev,
  107. };
  108. static void __init cns3420_init(void)
  109. {
  110. platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
  111. cns3xxx_ahci_init();
  112. cns3xxx_sdhci_init();
  113. pm_power_off = cns3xxx_power_off;
  114. }
  115. static struct map_desc cns3420_io_desc[] __initdata = {
  116. {
  117. .virtual = CNS3XXX_UART0_BASE_VIRT,
  118. .pfn = __phys_to_pfn(CNS3XXX_UART0_BASE),
  119. .length = SZ_4K,
  120. .type = MT_DEVICE,
  121. },
  122. };
  123. static void __init cns3420_map_io(void)
  124. {
  125. cns3xxx_map_io();
  126. iotable_init(cns3420_io_desc, ARRAY_SIZE(cns3420_io_desc));
  127. cns3420_early_serial_setup();
  128. }
  129. MACHINE_START(CNS3420VB, "Cavium Networks CNS3420 Validation Board")
  130. .boot_params = 0x00000100,
  131. .map_io = cns3420_map_io,
  132. .init_irq = cns3xxx_init_irq,
  133. .timer = &cns3xxx_timer,
  134. .init_machine = cns3420_init,
  135. MACHINE_END