micro9.c 3.5 KB

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