board-mx53_smd.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved.
  3. */
  4. /*
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. * You should have received a copy of the GNU General Public License along
  14. * with this program; if not, write to the Free Software Foundation, Inc.,
  15. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  16. */
  17. #include <linux/init.h>
  18. #include <linux/clk.h>
  19. #include <linux/fec.h>
  20. #include <linux/delay.h>
  21. #include <linux/gpio.h>
  22. #include <mach/common.h>
  23. #include <mach/hardware.h>
  24. #include <mach/imx-uart.h>
  25. #include <mach/iomux-mx53.h>
  26. #include <asm/mach-types.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/time.h>
  29. #include "crm_regs.h"
  30. #include "devices-imx53.h"
  31. #define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6)
  32. static iomux_v3_cfg_t mx53_smd_pads[] = {
  33. MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
  34. MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,
  35. MX53_PAD_PATA_BUFFER_EN__UART2_RXD_MUX,
  36. MX53_PAD_PATA_DMARQ__UART2_TXD_MUX,
  37. MX53_PAD_PATA_CS_0__UART3_TXD_MUX,
  38. MX53_PAD_PATA_CS_1__UART3_RXD_MUX,
  39. MX53_PAD_PATA_DA_1__UART3_CTS,
  40. MX53_PAD_PATA_DA_2__UART3_RTS,
  41. /* I2C1 */
  42. MX53_PAD_CSI0_DAT8__I2C1_SDA,
  43. MX53_PAD_CSI0_DAT9__I2C1_SCL,
  44. };
  45. static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
  46. .flags = IMXUART_HAVE_RTSCTS,
  47. };
  48. static inline void mx53_smd_init_uart(void)
  49. {
  50. imx53_add_imx_uart(0, NULL);
  51. imx53_add_imx_uart(1, NULL);
  52. imx53_add_imx_uart(2, &mx53_smd_uart_data);
  53. }
  54. static inline void mx53_smd_fec_reset(void)
  55. {
  56. int ret;
  57. /* reset FEC PHY */
  58. ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
  59. if (ret) {
  60. printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
  61. return;
  62. }
  63. gpio_direction_output(SMD_FEC_PHY_RST, 0);
  64. msleep(1);
  65. gpio_set_value(SMD_FEC_PHY_RST, 1);
  66. }
  67. static struct fec_platform_data mx53_smd_fec_data = {
  68. .phy = PHY_INTERFACE_MODE_RMII,
  69. };
  70. static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = {
  71. .bitrate = 100000,
  72. };
  73. static void __init mx53_smd_board_init(void)
  74. {
  75. mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
  76. ARRAY_SIZE(mx53_smd_pads));
  77. mx53_smd_init_uart();
  78. mx53_smd_fec_reset();
  79. imx53_add_fec(&mx53_smd_fec_data);
  80. imx53_add_imx2_wdt(0, NULL);
  81. imx53_add_imx_i2c(0, &mx53_smd_i2c_data);
  82. }
  83. static void __init mx53_smd_timer_init(void)
  84. {
  85. mx53_clocks_init(32768, 24000000, 22579200, 0);
  86. }
  87. static struct sys_timer mx53_smd_timer = {
  88. .init = mx53_smd_timer_init,
  89. };
  90. MACHINE_START(MX53_SMD, "Freescale MX53 SMD Board")
  91. .map_io = mx53_map_io,
  92. .init_early = imx53_init_early,
  93. .init_irq = mx53_init_irq,
  94. .timer = &mx53_smd_timer,
  95. .init_machine = mx53_smd_board_init,
  96. MACHINE_END