blob: d25e2b37ce2d1410154a8a21a174308195b6ad7c [file] [log] [blame]
Otavio Salvador81ca8402013-01-23 10:30:34 +00001/*
2 * Freescale MX23EVK board
3 *
4 * (C) Copyright 2013 O.S. Systems Software LTDA.
5 *
6 * Author: Otavio Salvador <otavio@ossystems.com.br>
7 *
8 * Based on m28evk.c:
9 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
10 * on behalf of DENX Software Engineering GmbH
11 *
12 * See file CREDITS for list of people who contributed to this
13 * project.
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License as
17 * published by the Free Software Foundation; either version 2 of
18 * the License, or (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 */
25
26#include <common.h>
27#include <asm/gpio.h>
28#include <asm/arch/imx-regs.h>
29#include <asm/arch/clock.h>
30#include <asm/arch/iomux-mx23.h>
31#include <asm/arch/sys_proto.h>
32
33DECLARE_GLOBAL_DATA_PTR;
34
35/*
36 * Functions
37 */
38int board_early_init_f(void)
39{
40 /* IO0 clock at 480MHz */
41 mxs_set_ioclk(MXC_IOCLK0, 480000);
42
43 /* SSP0 clock at 96MHz */
44 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
45
Fabio Estevameadfc132013-05-10 09:14:10 +000046 /* Power on LCD */
47 gpio_direction_output(MX23_PAD_LCD_RESET__GPIO_1_18, 1);
48
49 /* Set contrast to maximum */
50 gpio_direction_output(MX23_PAD_PWM2__GPIO_1_28, 1);
51
Otavio Salvador81ca8402013-01-23 10:30:34 +000052 return 0;
53}
54
55int dram_init(void)
56{
57 return mxs_dram_init();
58}
59
60int board_init(void)
61{
62 /* Adress of boot parameters */
63 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
64
65 return 0;
66}
67
68#ifdef CONFIG_CMD_MMC
69static int mx23evk_mmc_wp(int id)
70{
71 if (id != 0) {
72 printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
73 return 1;
74 }
75
76 return gpio_get_value(MX23_PAD_PWM4__GPIO_1_30);
77}
78
79int board_mmc_init(bd_t *bis)
80{
81 /* Configure WP as input */
82 gpio_direction_input(MX23_PAD_PWM4__GPIO_1_30);
83
84 /* Configure MMC0 Power Enable */
85 gpio_direction_output(MX23_PAD_PWM3__GPIO_1_29, 0);
86
87 return mxsmmc_initialize(bis, 0, mx23evk_mmc_wp, NULL);
88}
89#endif