mx1ads.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /*
  2. * arch/arm/mach-imx/mx1ads.c
  3. *
  4. * Initially based on:
  5. * linux-2.6.7-imx/arch/arm/mach-imx/scb9328.c
  6. * Copyright (c) 2004 Sascha Hauer <sascha@saschahauer.de>
  7. *
  8. * 2004 (c) MontaVista Software, Inc.
  9. *
  10. * This file is licensed under the terms of the GNU General Public
  11. * License version 2. This program is licensed "as is" without any
  12. * warranty of any kind, whether express or implied.
  13. */
  14. #include <linux/kernel.h>
  15. #include <linux/init.h>
  16. #include <linux/platform_device.h>
  17. #include <linux/mtd/physmap.h>
  18. #include <asm/mach-types.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach/time.h>
  21. #include <mach/irqs.h>
  22. #include <mach/hardware.h>
  23. #include <mach/common.h>
  24. #include <mach/imx-uart.h>
  25. #include <mach/iomux-mx1-mx2.h>
  26. #include "devices.h"
  27. /*
  28. * UARTs platform data
  29. */
  30. static int mxc_uart1_pins[] = {
  31. PC9_PF_UART1_CTS,
  32. PC10_PF_UART1_RTS,
  33. PC11_PF_UART1_TXD,
  34. PC12_PF_UART1_RXD,
  35. };
  36. static int uart1_mxc_init(struct platform_device *pdev)
  37. {
  38. return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
  39. ARRAY_SIZE(mxc_uart1_pins), "UART1");
  40. }
  41. static int uart1_mxc_exit(struct platform_device *pdev)
  42. {
  43. mxc_gpio_release_multiple_pins(mxc_uart1_pins,
  44. ARRAY_SIZE(mxc_uart1_pins));
  45. return 0;
  46. }
  47. static int mxc_uart2_pins[] = {
  48. PB28_PF_UART2_CTS,
  49. PB29_PF_UART2_RTS,
  50. PB30_PF_UART2_TXD,
  51. PB31_PF_UART2_RXD,
  52. };
  53. static int uart2_mxc_init(struct platform_device *pdev)
  54. {
  55. return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
  56. ARRAY_SIZE(mxc_uart2_pins), "UART2");
  57. }
  58. static int uart2_mxc_exit(struct platform_device *pdev)
  59. {
  60. mxc_gpio_release_multiple_pins(mxc_uart2_pins,
  61. ARRAY_SIZE(mxc_uart2_pins));
  62. return 0;
  63. }
  64. static struct imxuart_platform_data uart_pdata[] = {
  65. {
  66. .init = uart1_mxc_init,
  67. .exit = uart1_mxc_exit,
  68. .flags = IMXUART_HAVE_RTSCTS,
  69. }, {
  70. .init = uart2_mxc_init,
  71. .exit = uart2_mxc_exit,
  72. .flags = IMXUART_HAVE_RTSCTS,
  73. },
  74. };
  75. /*
  76. * Physmap flash
  77. */
  78. static struct physmap_flash_data mx1ads_flash_data = {
  79. .width = 4, /* bankwidth in bytes */
  80. };
  81. static struct resource flash_resource = {
  82. .start = IMX_CS0_PHYS,
  83. .end = IMX_CS0_PHYS + SZ_32M - 1,
  84. .flags = IORESOURCE_MEM,
  85. };
  86. static struct platform_device flash_device = {
  87. .name = "physmap-flash",
  88. .id = 0,
  89. .resource = &flash_resource,
  90. .num_resources = 1,
  91. };
  92. /*
  93. * Board init
  94. */
  95. static void __init mx1ads_init(void)
  96. {
  97. /* UART */
  98. mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
  99. mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
  100. /* Physmap flash */
  101. mxc_register_device(&flash_device, &mx1ads_flash_data);
  102. }
  103. static void __init mx1ads_timer_init(void)
  104. {
  105. mxc_clocks_init(32000);
  106. mxc_timer_init("gpt_clk");
  107. }
  108. struct sys_timer mx1ads_timer = {
  109. .init = mx1ads_timer_init,
  110. };
  111. MACHINE_START(MX1ADS, "Freescale MX1ADS")
  112. /* Maintainer: Sascha Hauer, Pengutronix */
  113. .phys_io = IMX_IO_PHYS,
  114. .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
  115. .boot_params = PHYS_OFFSET + 0x100,
  116. .map_io = mxc_map_io,
  117. .init_irq = mxc_init_irq,
  118. .timer = &mx1ads_timer,
  119. .init_machine = mx1ads_init,
  120. MACHINE_END
  121. MACHINE_START(MXLADS, "Freescale MXLADS")
  122. .phys_io = IMX_IO_PHYS,
  123. .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
  124. .boot_params = PHYS_OFFSET + 0x100,
  125. .map_io = mxc_map_io,
  126. .init_irq = mxc_init_irq,
  127. .timer = &mx1ads_timer,
  128. .init_machine = mx1ads_init,
  129. MACHINE_END