blob: 8913b21924f7769a875ea5e821ea00d0a5238597 [file] [log] [blame]
Fabio Estevamafe20bf2012-09-24 08:09:33 +00001/*
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
20#include <common.h>
21#include <asm/io.h>
22#include <asm/arch/clock.h>
23#include <asm/arch/imx-regs.h>
24#include <asm/arch/iomux.h>
25#include <asm/arch/mx6x_pins.h>
26#include <asm/errno.h>
27#include <asm/gpio.h>
28#include <asm/imx-common/iomux-v3.h>
29#include <mmc.h>
30#include <fsl_esdhc.h>
31DECLARE_GLOBAL_DATA_PTR;
32
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
37#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
38 PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
39 PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
40
41int dram_init(void)
42{
43 gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
44
45 return 0;
46}
47
48iomux_v3_cfg_t uart4_pads[] = {
49 MX6Q_PAD_KEY_COL0__UART4_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
50 MX6Q_PAD_KEY_ROW0__UART4_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
51};
52
53iomux_v3_cfg_t usdhc3_pads[] = {
54 MX6Q_PAD_SD3_CLK__USDHC3_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL),
55 MX6Q_PAD_SD3_CMD__USDHC3_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL),
56 MX6Q_PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
57 MX6Q_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
58 MX6Q_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
59 MX6Q_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
60 MX6Q_PAD_SD3_DAT4__USDHC3_DAT4 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
61 MX6Q_PAD_SD3_DAT5__USDHC3_DAT5 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
62 MX6Q_PAD_SD3_DAT6__USDHC3_DAT6 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
63 MX6Q_PAD_SD3_DAT7__USDHC3_DAT7 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
64 MX6Q_PAD_GPIO_18__USDHC3_VSELECT | MUX_PAD_CTRL(USDHC_PAD_CTRL),
65 MX6Q_PAD_NANDF_CS2__GPIO_6_15 | MUX_PAD_CTRL(NO_PAD_CTRL),
66};
67
68static void setup_iomux_uart(void)
69{
70 imx_iomux_v3_setup_multiple_pads(uart4_pads, ARRAY_SIZE(uart4_pads));
71}
72
73#ifdef CONFIG_FSL_ESDHC
74struct fsl_esdhc_cfg usdhc_cfg[1] = {
75 {USDHC3_BASE_ADDR},
76};
77
78int board_mmc_getcd(struct mmc *mmc)
79{
80 gpio_direction_input(IMX_GPIO_NR(6, 15));
81 return !gpio_get_value(IMX_GPIO_NR(6, 15));
82}
83
84int board_mmc_init(bd_t *bis)
85{
86 imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
87
88 return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
89}
90#endif
91
92u32 get_board_rev(void)
93{
94 return 0x63000;
95}
96
97int board_early_init_f(void)
98{
99 setup_iomux_uart();
100
101 return 0;
102}
103
104int board_init(void)
105{
106 /* address of boot parameters */
107 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
108
109 return 0;
110}
111
112int checkboard(void)
113{
114 puts("Board: MX6Q-Sabreauto\n");
115
116 return 0;
117}