micro9.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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/mtd/physmap.h>
  17. #include <linux/io.h>
  18. #include <mach/hardware.h>
  19. #include <asm/mach-types.h>
  20. #include <asm/mach/arch.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 seperate 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 struct physmap_flash_data micro9_flash_data;
  30. static struct resource micro9_flash_resource = {
  31. .start = EP93XX_CS1_PHYS_BASE,
  32. .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
  33. .flags = IORESOURCE_MEM,
  34. };
  35. static struct platform_device micro9_flash = {
  36. .name = "physmap-flash",
  37. .id = 0,
  38. .dev = {
  39. .platform_data = &micro9_flash_data,
  40. },
  41. .num_resources = 1,
  42. .resource = &micro9_flash_resource,
  43. };
  44. static void __init __micro9_register_flash(unsigned int width)
  45. {
  46. micro9_flash_data.width = width;
  47. platform_device_register(&micro9_flash);
  48. }
  49. static unsigned int __init micro9_detect_bootwidth(void)
  50. {
  51. u32 v;
  52. /* Detect the bus width of the external flash memory */
  53. v = __raw_readl(EP93XX_SYSCON_SYSCFG);
  54. if (v & EP93XX_SYSCON_SYSCFG_LCSN7)
  55. return 4; /* 32-bit */
  56. else
  57. return 2; /* 16-bit */
  58. }
  59. static void __init micro9_register_flash(void)
  60. {
  61. if (machine_is_micro9())
  62. __micro9_register_flash(4);
  63. else if (machine_is_micro9m() || machine_is_micro9s())
  64. __micro9_register_flash(micro9_detect_bootwidth());
  65. }
  66. /*************************************************************************
  67. * Micro9 Ethernet
  68. *************************************************************************/
  69. static struct ep93xx_eth_data micro9_eth_data = {
  70. .phy_id = 0x1f,
  71. };
  72. static void __init micro9_init_machine(void)
  73. {
  74. ep93xx_init_devices();
  75. ep93xx_register_eth(&micro9_eth_data, 1);
  76. micro9_register_flash();
  77. }
  78. #ifdef CONFIG_MACH_MICRO9H
  79. MACHINE_START(MICRO9, "Contec Micro9-High")
  80. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  81. .phys_io = EP93XX_APB_PHYS_BASE,
  82. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  83. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  84. .map_io = ep93xx_map_io,
  85. .init_irq = ep93xx_init_irq,
  86. .timer = &ep93xx_timer,
  87. .init_machine = micro9_init_machine,
  88. MACHINE_END
  89. #endif
  90. #ifdef CONFIG_MACH_MICRO9M
  91. MACHINE_START(MICRO9M, "Contec Micro9-Mid")
  92. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  93. .phys_io = EP93XX_APB_PHYS_BASE,
  94. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  95. .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
  96. .map_io = ep93xx_map_io,
  97. .init_irq = ep93xx_init_irq,
  98. .timer = &ep93xx_timer,
  99. .init_machine = micro9_init_machine,
  100. MACHINE_END
  101. #endif
  102. #ifdef CONFIG_MACH_MICRO9L
  103. MACHINE_START(MICRO9L, "Contec Micro9-Lite")
  104. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  105. .phys_io = EP93XX_APB_PHYS_BASE,
  106. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  107. .boot_params = EP93XX_SDCE3_PHYS_BASE_SYNC + 0x100,
  108. .map_io = ep93xx_map_io,
  109. .init_irq = ep93xx_init_irq,
  110. .timer = &ep93xx_timer,
  111. .init_machine = micro9_init_machine,
  112. MACHINE_END
  113. #endif
  114. #ifdef CONFIG_MACH_MICRO9S
  115. MACHINE_START(MICRO9S, "Contec Micro9-Slim")
  116. /* Maintainer: Hubert Feurstein <hubert.feurstein@contec.at> */
  117. .phys_io = EP93XX_APB_PHYS_BASE,
  118. .io_pg_offst = ((EP93XX_APB_VIRT_BASE) >> 18) & 0xfffc,
  119. .boot_params = EP93XX_SDCE3_PHYS_BASE_ASYNC + 0x100,
  120. .map_io = ep93xx_map_io,
  121. .init_irq = ep93xx_init_irq,
  122. .timer = &ep93xx_timer,
  123. .init_machine = micro9_init_machine,
  124. MACHINE_END
  125. #endif