board-mx53_smd.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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_D10__UART1_TXD,
  34. MX53_PAD_CSI0_D11__UART1_RXD,
  35. MX53_PAD_ATA_DIOW__UART1_TXD,
  36. MX53_PAD_ATA_DMACK__UART1_RXD,
  37. MX53_PAD_ATA_BUFFER_EN__UART2_RXD,
  38. MX53_PAD_ATA_DMARQ__UART2_TXD,
  39. MX53_PAD_ATA_DIOR__UART2_RTS,
  40. MX53_PAD_ATA_INTRQ__UART2_CTS,
  41. MX53_PAD_ATA_CS_0__UART3_TXD,
  42. MX53_PAD_ATA_CS_1__UART3_RXD,
  43. MX53_PAD_ATA_DA_1__UART3_CTS,
  44. MX53_PAD_ATA_DA_2__UART3_RTS,
  45. };
  46. static const struct imxuart_platform_data mx53_smd_uart_data __initconst = {
  47. .flags = IMXUART_HAVE_RTSCTS,
  48. };
  49. static inline void mx53_smd_init_uart(void)
  50. {
  51. imx53_add_imx_uart(0, &mx53_smd_uart_data);
  52. imx53_add_imx_uart(1, &mx53_smd_uart_data);
  53. imx53_add_imx_uart(2, &mx53_smd_uart_data);
  54. }
  55. static inline void mx53_smd_fec_reset(void)
  56. {
  57. int ret;
  58. /* reset FEC PHY */
  59. ret = gpio_request(SMD_FEC_PHY_RST, "fec-phy-reset");
  60. if (ret) {
  61. printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
  62. return;
  63. }
  64. gpio_direction_output(SMD_FEC_PHY_RST, 0);
  65. msleep(1);
  66. gpio_set_value(SMD_FEC_PHY_RST, 1);
  67. }
  68. static struct fec_platform_data mx53_smd_fec_data = {
  69. .phy = PHY_INTERFACE_MODE_RMII,
  70. };
  71. static void __init mx53_smd_board_init(void)
  72. {
  73. mxc_iomux_v3_setup_multiple_pads(mx53_smd_pads,
  74. ARRAY_SIZE(mx53_smd_pads));
  75. mx53_smd_init_uart();
  76. mx53_smd_fec_reset();
  77. imx53_add_fec(&mx53_smd_fec_data);
  78. }
  79. static void __init mx53_smd_timer_init(void)
  80. {
  81. mx53_clocks_init(32768, 24000000, 22579200, 0);
  82. }
  83. static struct sys_timer mx53_smd_timer = {
  84. .init = mx53_smd_timer_init,
  85. };
  86. MACHINE_START(MX53_SMD, "Freescale MX53 SMD Board")
  87. .map_io = mx53_map_io,
  88. .init_irq = mx53_init_irq,
  89. .init_machine = mx53_smd_board_init,
  90. .timer = &mx53_smd_timer,
  91. MACHINE_END