Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Otavio Salvador | 50e6090 | 2013-01-23 10:30:34 +0000 | [diff] [blame] | 2 | /* |
| 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 Salvador | 50e6090 | 2013-01-23 10:30:34 +0000 | [diff] [blame] | 12 | */ |
| 13 | |
| 14 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame^] | 15 | #include <init.h> |
Otavio Salvador | 50e6090 | 2013-01-23 10:30:34 +0000 | [diff] [blame] | 16 | #include <asm/gpio.h> |
| 17 | #include <asm/arch/imx-regs.h> |
| 18 | #include <asm/arch/clock.h> |
| 19 | #include <asm/arch/iomux-mx23.h> |
| 20 | #include <asm/arch/sys_proto.h> |
| 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
| 24 | /* |
| 25 | * Functions |
| 26 | */ |
| 27 | int board_early_init_f(void) |
| 28 | { |
| 29 | /* IO0 clock at 480MHz */ |
| 30 | mxs_set_ioclk(MXC_IOCLK0, 480000); |
| 31 | |
| 32 | /* SSP0 clock at 96MHz */ |
| 33 | mxs_set_sspclk(MXC_SSPCLK0, 96000, 0); |
| 34 | |
Fabio Estevam | e6fa5dc | 2013-05-10 09:14:10 +0000 | [diff] [blame] | 35 | /* Power on LCD */ |
| 36 | gpio_direction_output(MX23_PAD_LCD_RESET__GPIO_1_18, 1); |
| 37 | |
| 38 | /* Set contrast to maximum */ |
| 39 | gpio_direction_output(MX23_PAD_PWM2__GPIO_1_28, 1); |
| 40 | |
Otavio Salvador | 50e6090 | 2013-01-23 10:30:34 +0000 | [diff] [blame] | 41 | return 0; |
| 42 | } |
| 43 | |
| 44 | int dram_init(void) |
| 45 | { |
| 46 | return mxs_dram_init(); |
| 47 | } |
| 48 | |
| 49 | int board_init(void) |
| 50 | { |
| 51 | /* Adress of boot parameters */ |
| 52 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; |
| 53 | |
| 54 | return 0; |
| 55 | } |
| 56 | |
| 57 | #ifdef CONFIG_CMD_MMC |
| 58 | static int mx23evk_mmc_wp(int id) |
| 59 | { |
| 60 | if (id != 0) { |
| 61 | printf("MXS MMC: Invalid card selected (card id = %d)\n", id); |
| 62 | return 1; |
| 63 | } |
| 64 | |
| 65 | return gpio_get_value(MX23_PAD_PWM4__GPIO_1_30); |
| 66 | } |
| 67 | |
| 68 | int board_mmc_init(bd_t *bis) |
| 69 | { |
| 70 | /* Configure WP as input */ |
| 71 | gpio_direction_input(MX23_PAD_PWM4__GPIO_1_30); |
| 72 | |
| 73 | /* Configure MMC0 Power Enable */ |
| 74 | gpio_direction_output(MX23_PAD_PWM3__GPIO_1_29, 0); |
| 75 | |
| 76 | return mxsmmc_initialize(bis, 0, mx23evk_mmc_wp, NULL); |
| 77 | } |
| 78 | #endif |