board-mx53_loco.c 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 LOCO_FEC_PHY_RST IMX_GPIO_NR(7, 6)
  32. static iomux_v3_cfg_t mx53_loco_pads[] = {
  33. MX53_PAD_CSI0_DAT10__UART1_TXD_MUX,
  34. MX53_PAD_CSI0_DAT11__UART1_RXD_MUX,
  35. };
  36. static inline void mx53_loco_fec_reset(void)
  37. {
  38. int ret;
  39. /* reset FEC PHY */
  40. ret = gpio_request(LOCO_FEC_PHY_RST, "fec-phy-reset");
  41. if (ret) {
  42. printk(KERN_ERR"failed to get GPIO_FEC_PHY_RESET: %d\n", ret);
  43. return;
  44. }
  45. gpio_direction_output(LOCO_FEC_PHY_RST, 0);
  46. msleep(1);
  47. gpio_set_value(LOCO_FEC_PHY_RST, 1);
  48. }
  49. static struct fec_platform_data mx53_loco_fec_data = {
  50. .phy = PHY_INTERFACE_MODE_RMII,
  51. };
  52. static void __init mx53_loco_board_init(void)
  53. {
  54. mxc_iomux_v3_setup_multiple_pads(mx53_loco_pads,
  55. ARRAY_SIZE(mx53_loco_pads));
  56. imx53_add_imx_uart(0, NULL);
  57. mx53_loco_fec_reset();
  58. imx53_add_fec(&mx53_loco_fec_data);
  59. }
  60. static void __init mx53_loco_timer_init(void)
  61. {
  62. mx53_clocks_init(32768, 24000000, 0, 0);
  63. }
  64. static struct sys_timer mx53_loco_timer = {
  65. .init = mx53_loco_timer_init,
  66. };
  67. MACHINE_START(MX53_LOCO, "Freescale MX53 LOCO Board")
  68. .map_io = mx53_map_io,
  69. .init_irq = mx53_init_irq,
  70. .init_machine = mx53_loco_board_init,
  71. .timer = &mx53_loco_timer,
  72. MACHINE_END