mx25pdk.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*
  2. * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor,
  16. * Boston, MA 02110-1301, USA.
  17. */
  18. #include <linux/types.h>
  19. #include <linux/init.h>
  20. #include <linux/delay.h>
  21. #include <linux/clk.h>
  22. #include <linux/irq.h>
  23. #include <linux/gpio.h>
  24. #include <linux/fec.h>
  25. #include <linux/platform_device.h>
  26. #include <mach/hardware.h>
  27. #include <asm/mach-types.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/time.h>
  30. #include <asm/memory.h>
  31. #include <asm/mach/map.h>
  32. #include <mach/common.h>
  33. #include <mach/imx-uart.h>
  34. #include <mach/mx25.h>
  35. #include <mach/mxc_nand.h>
  36. #include "devices.h"
  37. #include <mach/iomux.h>
  38. static struct imxuart_platform_data uart_pdata = {
  39. .flags = IMXUART_HAVE_RTSCTS,
  40. };
  41. static struct pad_desc mx25pdk_pads[] = {
  42. MX25_PAD_FEC_MDC__FEC_MDC,
  43. MX25_PAD_FEC_MDIO__FEC_MDIO,
  44. MX25_PAD_FEC_TDATA0__FEC_TDATA0,
  45. MX25_PAD_FEC_TDATA1__FEC_TDATA1,
  46. MX25_PAD_FEC_TX_EN__FEC_TX_EN,
  47. MX25_PAD_FEC_RDATA0__FEC_RDATA0,
  48. MX25_PAD_FEC_RDATA1__FEC_RDATA1,
  49. MX25_PAD_FEC_RX_DV__FEC_RX_DV,
  50. MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
  51. MX25_PAD_A17__GPIO_2_3, /* FEC_EN, GPIO 35 */
  52. MX25_PAD_D12__GPIO_4_8, /* FEC_RESET_B, GPIO 104 */
  53. };
  54. static struct fec_platform_data mx25_fec_pdata = {
  55. .phy = PHY_INTERFACE_MODE_RMII,
  56. };
  57. #define FEC_ENABLE_GPIO 35
  58. #define FEC_RESET_B_GPIO 104
  59. static void __init mx25pdk_fec_reset(void)
  60. {
  61. gpio_request(FEC_ENABLE_GPIO, "FEC PHY enable");
  62. gpio_request(FEC_RESET_B_GPIO, "FEC PHY reset");
  63. gpio_direction_output(FEC_ENABLE_GPIO, 0); /* drop PHY power */
  64. gpio_direction_output(FEC_RESET_B_GPIO, 0); /* assert reset */
  65. udelay(2);
  66. /* turn on PHY power and lift reset */
  67. gpio_set_value(FEC_ENABLE_GPIO, 1);
  68. gpio_set_value(FEC_RESET_B_GPIO, 1);
  69. }
  70. static void __init mx25pdk_init(void)
  71. {
  72. mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
  73. ARRAY_SIZE(mx25pdk_pads));
  74. mxc_register_device(&mxc_uart_device0, &uart_pdata);
  75. mxc_register_device(&mxc_usbh2, NULL);
  76. mx25pdk_fec_reset();
  77. mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
  78. }
  79. static void __init mx25pdk_timer_init(void)
  80. {
  81. mx25_clocks_init(26000000);
  82. }
  83. static struct sys_timer mx25pdk_timer = {
  84. .init = mx25pdk_timer_init,
  85. };
  86. MACHINE_START(MX25_3DS, "Freescale MX25PDK (3DS)")
  87. /* Maintainer: Freescale Semiconductor, Inc. */
  88. .phys_io = MX25_AIPS1_BASE_ADDR,
  89. .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
  90. .boot_params = PHYS_OFFSET + 0x100,
  91. .map_io = mx25_map_io,
  92. .init_irq = mx25_init_irq,
  93. .init_machine = mx25pdk_init,
  94. .timer = &mx25pdk_timer,
  95. MACHINE_END