micro9.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * linux/arch/arm/mach-ep93xx/micro9.c
  4. *
  5. * Copyright (C) 2006 Contec Steuerungstechnik & Automation GmbH
  6. * Manfred Gruber <m.gruber@tirol.com>
  7. * Copyright (C) 2009 Contec Steuerungstechnik & Automation GmbH
  8. * Hubert Feurstein <hubert.feurstein@contec.at>
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/init.h>
  12. #include <linux/platform_device.h>
  13. #include <linux/io.h>
  14. #include "hardware.h"
  15. #include <asm/mach-types.h>
  16. #include <asm/mach/arch.h>
  17. #include "soc.h"
  18. /*************************************************************************
  19. * Micro9 NOR Flash
  20. *
  21. * Micro9-High has up to 64MB of 32-bit flash on CS1
  22. * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
  23. * Micro9-Lite uses a separate MTD map driver for flash support
  24. * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
  25. *************************************************************************/
  26. static unsigned int __init micro9_detect_bootwidth(void)
  27. {
  28. u32 v;
  29. /* Detect the bus width of the external flash memory */
  30. v = __raw_readl(EP93XX_SYSCON_SYSCFG);
  31. if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
  32. return 4; /* 32-bit */
  33. else
  34. return 2; /* 16-bit */
  35. }
  36. static void __init micro9_register_flash(void)
  37. {
  38. unsigned int width;
  39. if (machine_is_micro9())
  40. width = 4;
  41. else if (machine_is_micro9m() || machine_is_micro9s())
  42. width = micro9_detect_bootwidth();
  43. else
  44. width = 0;
  45. if (width)
  46. ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
  47. }
  48. /*************************************************************************
  49. * Micro9 Ethernet
  50. *************************************************************************/
  51. static struct ep93xx_eth_data __initdata micro9_eth_data = {
  52. .phy_id = 0x1f,
  53. };
  54. static void __init micro9_init_machine(void)
  55. {
  56. ep93xx_init_devices();
  57. ep93xx_register_eth(&micro9_eth_data, 1);
  58. micro9_register_flash();
  59. }
  60. #ifdef CONFIG_MACH_MICRO9H
  61. MACHINE_START(MICRO9, "Contec Micro9-High")
  62. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  63. .atag_offset = 0x100,
  64. .map_io = ep93xx_map_io,
  65. .init_irq = ep93xx_init_irq,
  66. .init_time = ep93xx_timer_init,
  67. .init_machine = micro9_init_machine,
  68. .init_late = ep93xx_init_late,
  69. .restart = ep93xx_restart,
  70. MACHINE_END
  71. #endif
  72. #ifdef CONFIG_MACH_MICRO9M
  73. MACHINE_START(MICRO9M, "Contec Micro9-Mid")
  74. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  75. .atag_offset = 0x100,
  76. .map_io = ep93xx_map_io,
  77. .init_irq = ep93xx_init_irq,
  78. .init_time = ep93xx_timer_init,
  79. .init_machine = micro9_init_machine,
  80. .init_late = ep93xx_init_late,
  81. .restart = ep93xx_restart,
  82. MACHINE_END
  83. #endif
  84. #ifdef CONFIG_MACH_MICRO9L
  85. MACHINE_START(MICRO9L, "Contec Micro9-Lite")
  86. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  87. .atag_offset = 0x100,
  88. .map_io = ep93xx_map_io,
  89. .init_irq = ep93xx_init_irq,
  90. .init_time = ep93xx_timer_init,
  91. .init_machine = micro9_init_machine,
  92. .init_late = ep93xx_init_late,
  93. .restart = ep93xx_restart,
  94. MACHINE_END
  95. #endif
  96. #ifdef CONFIG_MACH_MICRO9S
  97. MACHINE_START(MICRO9S, "Contec Micro9-Slim")
  98. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  99. .atag_offset = 0x100,
  100. .map_io = ep93xx_map_io,
  101. .init_irq = ep93xx_init_irq,
  102. .init_time = ep93xx_timer_init,
  103. .init_machine = micro9_init_machine,
  104. .init_late = ep93xx_init_late,
  105. .restart = ep93xx_restart,
  106. MACHINE_END
  107. #endif