micro9.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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/hardware/vic.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.h>
  21. #include "soc.h"
  22. /*************************************************************************
  23. * Micro9 NOR Flash
  24. *
  25. * Micro9-High has up to 64MB of 32-bit flash on CS1
  26. * Micro9-Mid has up to 64MB of either 32-bit or 16-bit flash on CS1
  27. * Micro9-Lite uses a separate MTD map driver for flash support
  28. * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
  29. *************************************************************************/
  30. static unsigned int __init micro9_detect_bootwidth(void)
  31. {
  32. u32 v;
  33. /* Detect the bus width of the external flash memory */
  34. v = __raw_readl(EP93XX_SYSCON_SYSCFG);
  35. if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
  36. return 4; /* 32-bit */
  37. else
  38. return 2; /* 16-bit */
  39. }
  40. static void __init micro9_register_flash(void)
  41. {
  42. unsigned int width;
  43. if (machine_is_micro9())
  44. width = 4;
  45. else if (machine_is_micro9m() || machine_is_micro9s())
  46. width = micro9_detect_bootwidth();
  47. else
  48. width = 0;
  49. if (width)
  50. ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
  51. }
  52. /*************************************************************************
  53. * Micro9 Ethernet
  54. *************************************************************************/
  55. static struct ep93xx_eth_data __initdata micro9_eth_data = {
  56. .phy_id = 0x1f,
  57. };
  58. static void __init micro9_init_machine(void)
  59. {
  60. ep93xx_init_devices();
  61. ep93xx_register_eth(&micro9_eth_data, 1);
  62. micro9_register_flash();
  63. }
  64. #ifdef CONFIG_MACH_MICRO9H
  65. MACHINE_START(MICRO9, "Contec Micro9-High")
  66. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  67. .atag_offset = 0x100,
  68. .map_io = ep93xx_map_io,
  69. .init_irq = ep93xx_init_irq,
  70. .handle_irq = vic_handle_irq,
  71. .timer = &ep93xx_timer,
  72. .init_machine = micro9_init_machine,
  73. .restart = ep93xx_restart,
  74. MACHINE_END
  75. #endif
  76. #ifdef CONFIG_MACH_MICRO9M
  77. MACHINE_START(MICRO9M, "Contec Micro9-Mid")
  78. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  79. .atag_offset = 0x100,
  80. .map_io = ep93xx_map_io,
  81. .init_irq = ep93xx_init_irq,
  82. .handle_irq = vic_handle_irq,
  83. .timer = &ep93xx_timer,
  84. .init_machine = micro9_init_machine,
  85. .restart = ep93xx_restart,
  86. MACHINE_END
  87. #endif
  88. #ifdef CONFIG_MACH_MICRO9L
  89. MACHINE_START(MICRO9L, "Contec Micro9-Lite")
  90. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  91. .atag_offset = 0x100,
  92. .map_io = ep93xx_map_io,
  93. .init_irq = ep93xx_init_irq,
  94. .handle_irq = vic_handle_irq,
  95. .timer = &ep93xx_timer,
  96. .init_machine = micro9_init_machine,
  97. .restart = ep93xx_restart,
  98. MACHINE_END
  99. #endif
  100. #ifdef CONFIG_MACH_MICRO9S
  101. MACHINE_START(MICRO9S, "Contec Micro9-Slim")
  102. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  103. .atag_offset = 0x100,
  104. .map_io = ep93xx_map_io,
  105. .init_irq = ep93xx_init_irq,
  106. .handle_irq = vic_handle_irq,
  107. .timer = &ep93xx_timer,
  108. .init_machine = micro9_init_machine,
  109. .restart = ep93xx_restart,
  110. MACHINE_END
  111. #endif