micro9.c 4.1 KB

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