mx1ads.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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/i2c.h>
  15. #include <linux/i2c/pcf857x.h>
  16. #include <linux/init.h>
  17. #include <linux/kernel.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/mtd/physmap.h>
  20. #include <asm/mach-types.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/time.h>
  23. #include <mach/common.h>
  24. #include <mach/hardware.h>
  25. #include <mach/i2c.h>
  26. #include <mach/imx-uart.h>
  27. #include <mach/iomux.h>
  28. #include <mach/irqs.h>
  29. #include "devices.h"
  30. static int mx1ads_pins[] = {
  31. /* UART1 */
  32. PC9_PF_UART1_CTS,
  33. PC10_PF_UART1_RTS,
  34. PC11_PF_UART1_TXD,
  35. PC12_PF_UART1_RXD,
  36. /* UART2 */
  37. PB28_PF_UART2_CTS,
  38. PB29_PF_UART2_RTS,
  39. PB30_PF_UART2_TXD,
  40. PB31_PF_UART2_RXD,
  41. /* I2C */
  42. PA15_PF_I2C_SDA,
  43. PA16_PF_I2C_SCL,
  44. /* SPI */
  45. PC13_PF_SPI1_SPI_RDY,
  46. PC14_PF_SPI1_SCLK,
  47. PC15_PF_SPI1_SS,
  48. PC16_PF_SPI1_MISO,
  49. PC17_PF_SPI1_MOSI,
  50. };
  51. /*
  52. * UARTs platform data
  53. */
  54. static struct imxuart_platform_data uart_pdata[] = {
  55. {
  56. .flags = IMXUART_HAVE_RTSCTS,
  57. }, {
  58. .flags = IMXUART_HAVE_RTSCTS,
  59. },
  60. };
  61. /*
  62. * Physmap flash
  63. */
  64. static struct physmap_flash_data mx1ads_flash_data = {
  65. .width = 4, /* bankwidth in bytes */
  66. };
  67. static struct resource flash_resource = {
  68. .start = IMX_CS0_PHYS,
  69. .end = IMX_CS0_PHYS + SZ_32M - 1,
  70. .flags = IORESOURCE_MEM,
  71. };
  72. static struct platform_device flash_device = {
  73. .name = "physmap-flash",
  74. .id = 0,
  75. .resource = &flash_resource,
  76. .num_resources = 1,
  77. };
  78. /*
  79. * I2C
  80. */
  81. static struct pcf857x_platform_data pcf857x_data[] = {
  82. {
  83. .gpio_base = 4 * 32,
  84. }, {
  85. .gpio_base = 4 * 32 + 16,
  86. }
  87. };
  88. static struct imxi2c_platform_data mx1ads_i2c_data = {
  89. .bitrate = 100000,
  90. };
  91. static struct i2c_board_info mx1ads_i2c_devices[] = {
  92. {
  93. I2C_BOARD_INFO("pcf8575", 0x22),
  94. .platform_data = &pcf857x_data[0],
  95. }, {
  96. I2C_BOARD_INFO("pcf8575", 0x24),
  97. .platform_data = &pcf857x_data[1],
  98. },
  99. };
  100. /*
  101. * Board init
  102. */
  103. static void __init mx1ads_init(void)
  104. {
  105. mxc_gpio_setup_multiple_pins(mx1ads_pins,
  106. ARRAY_SIZE(mx1ads_pins), "mx1ads");
  107. /* UART */
  108. mxc_register_device(&imx_uart1_device, &uart_pdata[0]);
  109. mxc_register_device(&imx_uart2_device, &uart_pdata[1]);
  110. /* Physmap flash */
  111. mxc_register_device(&flash_device, &mx1ads_flash_data);
  112. /* I2C */
  113. i2c_register_board_info(0, mx1ads_i2c_devices,
  114. ARRAY_SIZE(mx1ads_i2c_devices));
  115. mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data);
  116. }
  117. static void __init mx1ads_timer_init(void)
  118. {
  119. mx1_clocks_init(32000);
  120. }
  121. struct sys_timer mx1ads_timer = {
  122. .init = mx1ads_timer_init,
  123. };
  124. MACHINE_START(MX1ADS, "Freescale MX1ADS")
  125. /* Maintainer: Sascha Hauer, Pengutronix */
  126. .phys_io = IMX_IO_PHYS,
  127. .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
  128. .boot_params = PHYS_OFFSET + 0x100,
  129. .map_io = mx1_map_io,
  130. .init_irq = mx1_init_irq,
  131. .timer = &mx1ads_timer,
  132. .init_machine = mx1ads_init,
  133. MACHINE_END
  134. MACHINE_START(MXLADS, "Freescale MXLADS")
  135. .phys_io = IMX_IO_PHYS,
  136. .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc,
  137. .boot_params = PHYS_OFFSET + 0x100,
  138. .map_io = mx1_map_io,
  139. .init_irq = mx1_init_irq,
  140. .timer = &mx1ads_timer,
  141. .init_machine = mx1ads_init,
  142. MACHINE_END