mx1ads.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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/hardware.h>
  22. #include <mach/common.h>
  23. #include <mach/imx-uart.h>
  24. #include <mach/iomux-mx1-mx2.h>
  25. #include "devices.h"
  26. /*
  27. * UARTs platform data
  28. */
  29. static int mxc_uart1_pins[] = {
  30. PC9_PF_UART1_CTS,
  31. PC10_PF_UART1_RTS,
  32. PC11_PF_UART1_TXD,
  33. PC12_PF_UART1_RXD,
  34. };
  35. static int uart1_mxc_init(struct platform_device *pdev)
  36. {
  37. return mxc_gpio_setup_multiple_pins(mxc_uart1_pins,
  38. ARRAY_SIZE(mxc_uart1_pins), "UART1");
  39. }
  40. static int uart1_mxc_exit(struct platform_device *pdev)
  41. {
  42. mxc_gpio_release_multiple_pins(mxc_uart1_pins,
  43. ARRAY_SIZE(mxc_uart1_pins));
  44. return 0;
  45. }
  46. static int mxc_uart2_pins[] = {
  47. PB28_PF_UART2_CTS,
  48. PB29_PF_UART2_RTS,
  49. PB30_PF_UART2_TXD,
  50. PB31_PF_UART2_RXD,
  51. };
  52. static int uart2_mxc_init(struct platform_device *pdev)
  53. {
  54. return mxc_gpio_setup_multiple_pins(mxc_uart2_pins,
  55. ARRAY_SIZE(mxc_uart2_pins), "UART2");
  56. }
  57. static int uart2_mxc_exit(struct platform_device *pdev)
  58. {
  59. mxc_gpio_release_multiple_pins(mxc_uart2_pins,
  60. ARRAY_SIZE(mxc_uart2_pins));
  61. return 0;
  62. }
  63. static struct imxuart_platform_data uart_pdata[] = {
  64. {
  65. .init = uart1_mxc_init,
  66. .exit = uart1_mxc_exit,
  67. .flags = IMXUART_HAVE_RTSCTS,
  68. }, {
  69. .init = uart2_mxc_init,
  70. .exit = uart2_mxc_exit,
  71. .flags = IMXUART_HAVE_RTSCTS,
  72. },
  73. };
  74. /*
  75. * Physmap flash
  76. */
  77. static struct physmap_flash_data mx1ads_flash_data = {
  78. .width = 4, /* bankwidth in bytes */
  79. };
  80. static struct resource flash_resource = {
  81. .start = IMX_CS0_PHYS,
  82. .end = IMX_CS0_PHYS + SZ_32M - 1,
  83. .flags = IORESOURCE_MEM,
  84. };
  85. static struct platform_device flash_device = {
  86. .name = "physmap-flash",
  87. .id = 0,
  88. .resource = &flash_resource,
  89. .num_resources = 1,
  90. };
  91. /*
  92. * Board init
  93. */
  94. static void __init mx1ads_init(void)
  95. {
  96. /* UART */
  97. mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
  98. mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
  99. /* Physmap flash */
  100. mxc_register_device(&flash_device, &mx1ads_flash_data);
  101. }
  102. static void __init mx1ads_timer_init(void)
  103. {
  104. mxc_clocks_init(32000);
  105. mxc_timer_init("gpt_clk");
  106. }
  107. struct sys_timer mx1ads_timer = {
  108. .init = mx1ads_timer_init,
  109. };
  110. MACHINE_START(MX1ADS, "Freescale MX1ADS")
  111. /* Maintainer: Sascha Hauer, Pengutronix */
  112. .phys_io = IMX_IO_PHYS,
  113. .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
  114. .boot_params = PHYS_OFFSET + 0x100,
  115. .map_io = mxc_map_io,
  116. .init_irq = mxc_init_irq,
  117. .timer = &mx1ads_timer,
  118. .init_machine = mx1ads_init,
  119. MACHINE_END
  120. MACHINE_START(MXLADS, "Freescale MXLADS")
  121. .phys_io = IMX_IO_PHYS,
  122. .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
  123. .boot_params = PHYS_OFFSET + 0x100,
  124. .map_io = mxc_map_io,
  125. .init_irq = mxc_init_irq,
  126. .timer = &mx1ads_timer,
  127. .init_machine = mx1ads_init,
  128. MACHINE_END