nanoengine.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * linux/arch/arm/mach-sa1100/nanoengine.c
  3. *
  4. * Bright Star Engineering's nanoEngine board init code.
  5. *
  6. * Copyright (C) 2010 Marcelo Roberto Jimenez <mroberto@cpti.cetuc.puc-rio.br>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/init.h>
  14. #include <linux/kernel.h>
  15. #include <linux/platform_data/sa11x0-serial.h>
  16. #include <linux/mtd/mtd.h>
  17. #include <linux/mtd/partitions.h>
  18. #include <linux/root_dev.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/setup.h>
  21. #include <asm/page.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/flash.h>
  24. #include <asm/mach/map.h>
  25. #include <mach/hardware.h>
  26. #include <mach/nanoengine.h>
  27. #include <mach/irqs.h>
  28. #include "generic.h"
  29. /* Flash bank 0 */
  30. static struct mtd_partition nanoengine_partitions[] = {
  31. {
  32. .name = "nanoEngine boot firmware and parameter table",
  33. .size = 0x00010000, /* 32K */
  34. .offset = 0,
  35. .mask_flags = MTD_WRITEABLE,
  36. }, {
  37. .name = "kernel/initrd reserved",
  38. .size = 0x002f0000,
  39. .offset = 0x00010000,
  40. .mask_flags = MTD_WRITEABLE,
  41. }, {
  42. .name = "experimental filesystem allocation",
  43. .size = 0x00100000,
  44. .offset = 0x00300000,
  45. .mask_flags = MTD_WRITEABLE,
  46. }
  47. };
  48. static struct flash_platform_data nanoengine_flash_data = {
  49. .map_name = "jedec_probe",
  50. .parts = nanoengine_partitions,
  51. .nr_parts = ARRAY_SIZE(nanoengine_partitions),
  52. };
  53. static struct resource nanoengine_flash_resources[] = {
  54. DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M),
  55. DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_32M),
  56. };
  57. static struct map_desc nanoengine_io_desc[] __initdata = {
  58. {
  59. /* System Registers */
  60. .virtual = 0xf0000000,
  61. .pfn = __phys_to_pfn(0x10000000),
  62. .length = 0x00100000,
  63. .type = MT_DEVICE
  64. }, {
  65. /* Internal PCI Memory Read/Write */
  66. .virtual = NANO_PCI_MEM_RW_VIRT,
  67. .pfn = __phys_to_pfn(NANO_PCI_MEM_RW_PHYS),
  68. .length = NANO_PCI_MEM_RW_SIZE,
  69. .type = MT_DEVICE
  70. }, {
  71. /* Internal PCI Config Space */
  72. .virtual = NANO_PCI_CONFIG_SPACE_VIRT,
  73. .pfn = __phys_to_pfn(NANO_PCI_CONFIG_SPACE_PHYS),
  74. .length = NANO_PCI_CONFIG_SPACE_SIZE,
  75. .type = MT_DEVICE
  76. }
  77. };
  78. static void __init nanoengine_map_io(void)
  79. {
  80. sa1100_map_io();
  81. iotable_init(nanoengine_io_desc, ARRAY_SIZE(nanoengine_io_desc));
  82. sa1100_register_uart(0, 1);
  83. sa1100_register_uart(1, 2);
  84. sa1100_register_uart(2, 3);
  85. Ser1SDCR0 |= SDCR0_UART;
  86. /* disable IRDA -- UART2 is used as a normal serial port */
  87. Ser2UTCR4 = 0;
  88. Ser2HSCR0 = 0;
  89. }
  90. static void __init nanoengine_init(void)
  91. {
  92. sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources,
  93. ARRAY_SIZE(nanoengine_flash_resources));
  94. }
  95. MACHINE_START(NANOENGINE, "BSE nanoEngine")
  96. .atag_offset = 0x100,
  97. .map_io = nanoengine_map_io,
  98. .nr_irqs = SA1100_NR_IRQS,
  99. .init_irq = sa1100_init_irq,
  100. .init_time = sa1100_timer_init,
  101. .init_machine = nanoengine_init,
  102. .init_late = sa11x0_init_late,
  103. .restart = sa11x0_restart,
  104. MACHINE_END