nanoengine.c 3.5 KB

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