blob: 605cdec218a39e9ae475972985fcedf085b2e18f [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Otavio Salvador50e60902013-01-23 10:30:34 +00002/*
3 * Freescale MX23EVK board
4 *
5 * (C) Copyright 2013 O.S. Systems Software LTDA.
6 *
7 * Author: Otavio Salvador <otavio@ossystems.com.br>
8 *
9 * Based on m28evk.c:
10 * Copyright (C) 2011 Marek Vasut <marek.vasut@gmail.com>
11 * on behalf of DENX Software Engineering GmbH
Otavio Salvador50e60902013-01-23 10:30:34 +000012 */
13
14#include <common.h>
Simon Glass97589732020-05-10 11:40:02 -060015#include <init.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060016#include <asm/global_data.h>
Otavio Salvador50e60902013-01-23 10:30:34 +000017#include <asm/gpio.h>
18#include <asm/arch/imx-regs.h>
19#include <asm/arch/clock.h>
20#include <asm/arch/iomux-mx23.h>
21#include <asm/arch/sys_proto.h>
22
23DECLARE_GLOBAL_DATA_PTR;
24
25/*
26 * Functions
27 */
28int board_early_init_f(void)
29{
30 /* IO0 clock at 480MHz */
31 mxs_set_ioclk(MXC_IOCLK0, 480000);
32
33 /* SSP0 clock at 96MHz */
34 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
35
Fabio Estevame6fa5dc2013-05-10 09:14:10 +000036 /* Power on LCD */
37 gpio_direction_output(MX23_PAD_LCD_RESET__GPIO_1_18, 1);
38
39 /* Set contrast to maximum */
40 gpio_direction_output(MX23_PAD_PWM2__GPIO_1_28, 1);
41
Otavio Salvador50e60902013-01-23 10:30:34 +000042 return 0;
43}
44
45int dram_init(void)
46{
47 return mxs_dram_init();
48}
49
50int board_init(void)
51{
52 /* Adress of boot parameters */
53 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
54
55 return 0;
56}
57
58#ifdef CONFIG_CMD_MMC
59static int mx23evk_mmc_wp(int id)
60{
61 if (id != 0) {
62 printf("MXS MMC: Invalid card selected (card id = %d)\n", id);
63 return 1;
64 }
65
66 return gpio_get_value(MX23_PAD_PWM4__GPIO_1_30);
67}
68
Masahiro Yamadaf7ed78b2020-06-26 15:13:33 +090069int board_mmc_init(struct bd_info *bis)
Otavio Salvador50e60902013-01-23 10:30:34 +000070{
71 /* Configure WP as input */
72 gpio_direction_input(MX23_PAD_PWM4__GPIO_1_30);
73
74 /* Configure MMC0 Power Enable */
75 gpio_direction_output(MX23_PAD_PWM3__GPIO_1_29, 0);
76
77 return mxsmmc_initialize(bis, 0, mx23evk_mmc_wp, NULL);
78}
79#endif