]> git.sur5r.net Git - u-boot/blob - board/freescale/mx6qsabresd/mx6qsabresd.c
mx6: Add basic support for mx6qsabresd board.
[u-boot] / board / freescale / mx6qsabresd / mx6qsabresd.c
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
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>
31 #include <miiphy.h>
32 #include <netdev.h>
33 DECLARE_GLOBAL_DATA_PTR;
34
35 #define UART_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |            \
36         PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |               \
37         PAD_CTL_DSE_40ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
38
39 #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE |            \
40         PAD_CTL_PUS_47K_UP  | PAD_CTL_SPEED_LOW |               \
41         PAD_CTL_DSE_80ohm   | PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
42
43 #define ENET_PAD_CTRL  (PAD_CTL_PKE | PAD_CTL_PUE |             \
44         PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED   |             \
45         PAD_CTL_DSE_40ohm   | PAD_CTL_HYS)
46
47 int dram_init(void)
48 {
49         gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
50
51         return 0;
52 }
53
54 iomux_v3_cfg_t uart1_pads[] = {
55         MX6Q_PAD_CSI0_DAT10__UART1_TXD | MUX_PAD_CTRL(UART_PAD_CTRL),
56         MX6Q_PAD_CSI0_DAT11__UART1_RXD | MUX_PAD_CTRL(UART_PAD_CTRL),
57 };
58
59 iomux_v3_cfg_t usdhc3_pads[] = {
60         MX6Q_PAD_SD3_CLK__USDHC3_CLK   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
61         MX6Q_PAD_SD3_CMD__USDHC3_CMD   | MUX_PAD_CTRL(USDHC_PAD_CTRL),
62         MX6Q_PAD_SD3_DAT0__USDHC3_DAT0 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
63         MX6Q_PAD_SD3_DAT1__USDHC3_DAT1 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
64         MX6Q_PAD_SD3_DAT2__USDHC3_DAT2 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
65         MX6Q_PAD_SD3_DAT3__USDHC3_DAT3 | MUX_PAD_CTRL(USDHC_PAD_CTRL),
66         MX6Q_PAD_NANDF_D0__GPIO_2_0    | MUX_PAD_CTRL(NO_PAD_CTRL), /* CD */
67 };
68
69 static void setup_iomux_uart(void)
70 {
71         imx_iomux_v3_setup_multiple_pads(uart1_pads, ARRAY_SIZE(uart1_pads));
72 }
73
74 #ifdef CONFIG_FSL_ESDHC
75 struct fsl_esdhc_cfg usdhc_cfg[1] = {
76         {USDHC3_BASE_ADDR},
77 };
78
79 int board_mmc_getcd(struct mmc *mmc)
80 {
81         gpio_direction_input(IMX_GPIO_NR(2, 0));
82         return !gpio_get_value(IMX_GPIO_NR(2, 0));
83 }
84
85 int board_mmc_init(bd_t *bis)
86 {
87         imx_iomux_v3_setup_multiple_pads(usdhc3_pads, ARRAY_SIZE(usdhc3_pads));
88
89         return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
90 }
91 #endif
92
93 u32 get_board_rev(void)
94 {
95         return 0x63000;
96 }
97
98 int board_early_init_f(void)
99 {
100         setup_iomux_uart();
101
102         return 0;
103 }
104
105 int board_init(void)
106 {
107         /* address of boot parameters */
108         gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
109
110         return 0;
111 }
112
113 int checkboard(void)
114 {
115         puts("Board: MX6Q-SabreSD\n");
116
117         return 0;
118 }