mach-apf9328.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * linux/arch/arm/mach-imx/mach-apf9328.c
  3. *
  4. * Copyright (c) 2005-2011 ARMadeus systems <support@armadeus.com>
  5. *
  6. * This work is based on mach-scb9328.c which is:
  7. * Copyright (c) 2004 Sascha Hauer <saschahauer@web.de>
  8. * Copyright (c) 2006-2008 Juergen Beisert <jbeisert@netscape.net>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License version 2 as
  12. * published by the Free Software Foundation.
  13. *
  14. */
  15. #include <linux/init.h>
  16. #include <linux/kernel.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/mtd/physmap.h>
  19. #include <linux/dm9000.h>
  20. #include <linux/i2c.h>
  21. #include <asm/mach-types.h>
  22. #include <asm/mach/arch.h>
  23. #include <asm/mach/time.h>
  24. #include <mach/common.h>
  25. #include <mach/hardware.h>
  26. #include <mach/irqs.h>
  27. #include <mach/iomux-mx1.h>
  28. #include "devices-imx1.h"
  29. static const int apf9328_pins[] __initconst = {
  30. /* UART1 */
  31. PC9_PF_UART1_CTS,
  32. PC10_PF_UART1_RTS,
  33. PC11_PF_UART1_TXD,
  34. PC12_PF_UART1_RXD,
  35. /* UART2 */
  36. PB28_PF_UART2_CTS,
  37. PB29_PF_UART2_RTS,
  38. PB30_PF_UART2_TXD,
  39. PB31_PF_UART2_RXD,
  40. /* I2C */
  41. PA15_PF_I2C_SDA,
  42. PA16_PF_I2C_SCL,
  43. };
  44. /*
  45. * The APF9328 can have up to 32MB NOR Flash
  46. */
  47. static struct resource flash_resource = {
  48. .start = MX1_CS0_PHYS,
  49. .end = MX1_CS0_PHYS + SZ_32M - 1,
  50. .flags = IORESOURCE_MEM,
  51. };
  52. static struct physmap_flash_data apf9328_flash_data = {
  53. .width = 2,
  54. };
  55. static struct platform_device apf9328_flash_device = {
  56. .name = "physmap-flash",
  57. .id = 0,
  58. .dev = {
  59. .platform_data = &apf9328_flash_data,
  60. },
  61. .resource = &flash_resource,
  62. .num_resources = 1,
  63. };
  64. /*
  65. * APF9328 has a DM9000 Ethernet controller
  66. */
  67. static struct dm9000_plat_data dm9000_setup = {
  68. .flags = DM9000_PLATF_16BITONLY
  69. };
  70. static struct resource dm9000_resources[] = {
  71. {
  72. .start = MX1_CS4_PHYS + 0x00C00000,
  73. .end = MX1_CS4_PHYS + 0x00C00001,
  74. .flags = IORESOURCE_MEM,
  75. }, {
  76. .start = MX1_CS4_PHYS + 0x00C00002,
  77. .end = MX1_CS4_PHYS + 0x00C00003,
  78. .flags = IORESOURCE_MEM,
  79. }, {
  80. .start = IRQ_GPIOB(14),
  81. .end = IRQ_GPIOB(14),
  82. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL,
  83. },
  84. };
  85. static struct platform_device dm9000x_device = {
  86. .name = "dm9000",
  87. .id = 0,
  88. .num_resources = ARRAY_SIZE(dm9000_resources),
  89. .resource = dm9000_resources,
  90. .dev = {
  91. .platform_data = &dm9000_setup,
  92. }
  93. };
  94. static const struct imxuart_platform_data uart1_pdata __initconst = {
  95. .flags = IMXUART_HAVE_RTSCTS,
  96. };
  97. static const struct imxi2c_platform_data apf9328_i2c_data __initconst = {
  98. .bitrate = 100000,
  99. };
  100. static struct platform_device *devices[] __initdata = {
  101. &apf9328_flash_device,
  102. &dm9000x_device,
  103. };
  104. static void __init apf9328_init(void)
  105. {
  106. imx1_soc_init();
  107. mxc_gpio_setup_multiple_pins(apf9328_pins,
  108. ARRAY_SIZE(apf9328_pins),
  109. "APF9328");
  110. imx1_add_imx_uart0(NULL);
  111. imx1_add_imx_uart1(&uart1_pdata);
  112. imx1_add_imx_i2c(&apf9328_i2c_data);
  113. platform_add_devices(devices, ARRAY_SIZE(devices));
  114. }
  115. static void __init apf9328_timer_init(void)
  116. {
  117. mx1_clocks_init(32768);
  118. }
  119. static struct sys_timer apf9328_timer = {
  120. .init = apf9328_timer_init,
  121. };
  122. MACHINE_START(APF9328, "Armadeus APF9328")
  123. /* Maintainer: Gwenhael Goavec-Merou, ARMadeus Systems */
  124. .map_io = mx1_map_io,
  125. .init_early = imx1_init_early,
  126. .init_irq = mx1_init_irq,
  127. .handle_irq = imx1_handle_irq,
  128. .timer = &apf9328_timer,
  129. .init_machine = apf9328_init,
  130. .restart = mxc_restart,
  131. MACHINE_END