nanoengine.c 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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/gpio/machine.h>
  15. #include <linux/kernel.h>
  16. #include <linux/platform_data/sa11x0-serial.h>
  17. #include <linux/mtd/mtd.h>
  18. #include <linux/mtd/partitions.h>
  19. #include <linux/root_dev.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/setup.h>
  22. #include <asm/page.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/flash.h>
  25. #include <asm/mach/map.h>
  26. #include <mach/hardware.h>
  27. #include <mach/nanoengine.h>
  28. #include <mach/irqs.h>
  29. #include "generic.h"
  30. /* Flash bank 0 */
  31. static struct mtd_partition nanoengine_partitions[] = {
  32. {
  33. .name = "nanoEngine boot firmware and parameter table",
  34. .size = 0x00010000, /* 32K */
  35. .offset = 0,
  36. .mask_flags = MTD_WRITEABLE,
  37. }, {
  38. .name = "kernel/initrd reserved",
  39. .size = 0x002f0000,
  40. .offset = 0x00010000,
  41. .mask_flags = MTD_WRITEABLE,
  42. }, {
  43. .name = "experimental filesystem allocation",
  44. .size = 0x00100000,
  45. .offset = 0x00300000,
  46. .mask_flags = MTD_WRITEABLE,
  47. }
  48. };
  49. static struct flash_platform_data nanoengine_flash_data = {
  50. .map_name = "jedec_probe",
  51. .parts = nanoengine_partitions,
  52. .nr_parts = ARRAY_SIZE(nanoengine_partitions),
  53. };
  54. static struct resource nanoengine_flash_resources[] = {
  55. DEFINE_RES_MEM(SA1100_CS0_PHYS, SZ_32M),
  56. DEFINE_RES_MEM(SA1100_CS1_PHYS, SZ_32M),
  57. };
  58. static struct map_desc nanoengine_io_desc[] __initdata = {
  59. {
  60. /* System Registers */
  61. .virtual = 0xf0000000,
  62. .pfn = __phys_to_pfn(0x10000000),
  63. .length = 0x00100000,
  64. .type = MT_DEVICE
  65. }, {
  66. /* Internal PCI Memory Read/Write */
  67. .virtual = NANO_PCI_MEM_RW_VIRT,
  68. .pfn = __phys_to_pfn(NANO_PCI_MEM_RW_PHYS),
  69. .length = NANO_PCI_MEM_RW_SIZE,
  70. .type = MT_DEVICE
  71. }, {
  72. /* Internal PCI Config Space */
  73. .virtual = NANO_PCI_CONFIG_SPACE_VIRT,
  74. .pfn = __phys_to_pfn(NANO_PCI_CONFIG_SPACE_PHYS),
  75. .length = NANO_PCI_CONFIG_SPACE_SIZE,
  76. .type = MT_DEVICE
  77. }
  78. };
  79. static void __init nanoengine_map_io(void)
  80. {
  81. sa1100_map_io();
  82. iotable_init(nanoengine_io_desc, ARRAY_SIZE(nanoengine_io_desc));
  83. sa1100_register_uart(0, 1);
  84. sa1100_register_uart(1, 2);
  85. sa1100_register_uart(2, 3);
  86. Ser1SDCR0 |= SDCR0_UART;
  87. /* disable IRDA -- UART2 is used as a normal serial port */
  88. Ser2UTCR4 = 0;
  89. Ser2HSCR0 = 0;
  90. }
  91. static struct gpiod_lookup_table nanoengine_pcmcia0_gpio_table = {
  92. .dev_id = "sa11x0-pcmcia.0",
  93. .table = {
  94. GPIO_LOOKUP("gpio", 11, "ready", GPIO_ACTIVE_HIGH),
  95. GPIO_LOOKUP("gpio", 13, "detect", GPIO_ACTIVE_LOW),
  96. GPIO_LOOKUP("gpio", 15, "reset", GPIO_ACTIVE_HIGH),
  97. { },
  98. },
  99. };
  100. static struct gpiod_lookup_table nanoengine_pcmcia1_gpio_table = {
  101. .dev_id = "sa11x0-pcmcia.1",
  102. .table = {
  103. GPIO_LOOKUP("gpio", 12, "ready", GPIO_ACTIVE_HIGH),
  104. GPIO_LOOKUP("gpio", 14, "detect", GPIO_ACTIVE_LOW),
  105. GPIO_LOOKUP("gpio", 16, "reset", GPIO_ACTIVE_HIGH),
  106. { },
  107. },
  108. };
  109. static void __init nanoengine_init(void)
  110. {
  111. sa11x0_register_pcmcia(0, &nanoengine_pcmcia0_gpio_table);
  112. sa11x0_register_pcmcia(1, &nanoengine_pcmcia1_gpio_table);
  113. sa11x0_register_mtd(&nanoengine_flash_data, nanoengine_flash_resources,
  114. ARRAY_SIZE(nanoengine_flash_resources));
  115. }
  116. MACHINE_START(NANOENGINE, "BSE nanoEngine")
  117. .atag_offset = 0x100,
  118. .map_io = nanoengine_map_io,
  119. .nr_irqs = SA1100_NR_IRQS,
  120. .init_irq = sa1100_init_irq,
  121. .init_time = sa1100_timer_init,
  122. .init_machine = nanoengine_init,
  123. .init_late = sa11x0_init_late,
  124. .restart = sa11x0_restart,
  125. MACHINE_END