mx6qsabresd.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  3. *
  4. * Author: Fabio Estevam <fabio.estevam@freescale.com>
  5. *
  6. * See file CREDITS for list of people who contributed to this
  7. * project.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License as
  11. * published by the Free Software Foundation; either version 2 of
  12. * the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. */
  19. #include <common.h>
  20. #include <asm/io.h>
  21. #include <asm/arch/clock.h>
  22. #include <asm/arch/imx-regs.h>
  23. #include <asm/arch/iomux.h>
  24. #include <asm/arch/mx6x_pins.h>
  25. #include <asm/errno.h>
  26. #include <asm/gpio.h>
  27. #include <asm/imx-common/iomux-v3.h>
  28. #include <mmc.h>
  29. #include <fsl_esdhc.h>
  30. #include <miiphy.h>
  31. #include <netdev.h>
  32. DECLARE_GLOBAL_DATA_PTR;
  33. #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  34. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  35. PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
  36. #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  37. PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
  38. PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
  39. #define ENET_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  40. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  41. PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
  42. int dram_init(void)
  43. {
  44. gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
  45. return 0;
  46. }
  47. iomux_v3_cfg_t uart1_pads[] = {
  48. MX6Q_PAD_CSI0_DAT10__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
  49. MX6Q_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
  50. };
  51. iomux_v3_cfg_t usdhc3_pads[] = {
  52. MX6Q_PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
  53. MX6Q_PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
  54. MX6Q_PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
  55. MX6Q_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
  56. MX6Q_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
  57. MX6Q_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
  58. MX6Q_PAD_NANDF_D0__GPIO_2_0 | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
  59. };
  60. static void setup_iomux_uart(void)
  61. {
  62. imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
  63. }
  64. #ifdef CONFIG_FSL_ESDHC
  65. struct fsl_esdhc_cfg usdhc_cfg[1] = {
  66. {USDHC3_BASE_ADDR},
  67. };
  68. int board_mmc_getcd(struct mmc *mmc)
  69. {
  70. gpio_direction_input(IMX_GPIO_NR(2, 0));
  71. return !gpio_get_value(IMX_GPIO_NR(2, 0));
  72. }
  73. int board_mmc_init(bd_t *bis)
  74. {
  75. imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
  76. return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
  77. }
  78. #endif
  79. u32 get_board_rev(void)
  80. {
  81. return 0x63000;
  82. }
  83. int board_early_init_f(void)
  84. {
  85. setup_iomux_uart();
  86. return 0;
  87. }
  88. int board_init(void)
  89. {
  90. /* address of boot parameters */
  91. gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
  92. return 0;
  93. }
  94. int checkboard(void)
  95. {
  96. puts("Board: MX6Q-SabreSD\n");
  97. return 0;
  98. }