Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Olimex MX23 Olinuxino board |
| 4 | * |
| 5 | * Copyright (C) 2013 Marek Vasut <marex@denx.de> |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 9 | #include <init.h> |
Simon Glass | 3ba929a | 2020-10-30 21:38:53 -0600 | [diff] [blame^] | 10 | #include <asm/global_data.h> |
Otavio Salvador | 3600ec3 | 2013-03-07 07:32:53 +0000 | [diff] [blame] | 11 | #include <asm/gpio.h> |
Marek Vasut | 73f2b03 | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 12 | #include <asm/io.h> |
| 13 | #include <asm/arch/iomux-mx23.h> |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 14 | #include <asm/arch/imx-regs.h> |
Marek Vasut | 73f2b03 | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 15 | #include <asm/arch/clock.h> |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 16 | #include <asm/arch/sys_proto.h> |
Uri Mashiach | 4892d39 | 2017-01-19 10:51:45 +0200 | [diff] [blame] | 17 | #ifdef CONFIG_LED_STATUS |
Otavio Salvador | fcc7689 | 2013-02-23 02:43:09 +0000 | [diff] [blame] | 18 | #include <status_led.h> |
| 19 | #endif |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 20 | #include <linux/delay.h> |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 21 | |
| 22 | DECLARE_GLOBAL_DATA_PTR; |
| 23 | |
| 24 | /* |
| 25 | * Functions |
| 26 | */ |
| 27 | int board_early_init_f(void) |
| 28 | { |
Marek Vasut | 73f2b03 | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 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 | |
Marek Vasut | 3f302a7 | 2014-04-28 03:38:42 +0200 | [diff] [blame] | 35 | return 0; |
| 36 | } |
| 37 | |
Otavio Salvador | 801fa15 | 2013-03-02 05:17:29 +0000 | [diff] [blame] | 38 | #ifdef CONFIG_CMD_USB |
Marek Vasut | 3f302a7 | 2014-04-28 03:38:42 +0200 | [diff] [blame] | 39 | int board_ehci_hcd_init(int port) |
| 40 | { |
| 41 | /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */ |
Otavio Salvador | 801fa15 | 2013-03-02 05:17:29 +0000 | [diff] [blame] | 42 | gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1); |
Marek Vasut | 3f302a7 | 2014-04-28 03:38:42 +0200 | [diff] [blame] | 43 | udelay(100); |
| 44 | return 0; |
| 45 | } |
Otavio Salvador | 801fa15 | 2013-03-02 05:17:29 +0000 | [diff] [blame] | 46 | |
Marek Vasut | 3f302a7 | 2014-04-28 03:38:42 +0200 | [diff] [blame] | 47 | int board_ehci_hcd_exit(int port) |
| 48 | { |
| 49 | /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */ |
| 50 | gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0); |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 51 | return 0; |
| 52 | } |
Marek Vasut | 3f302a7 | 2014-04-28 03:38:42 +0200 | [diff] [blame] | 53 | #endif |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 54 | |
| 55 | int dram_init(void) |
| 56 | { |
| 57 | return mxs_dram_init(); |
| 58 | } |
Marek Vasut | 73f2b03 | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 59 | |
| 60 | #ifdef CONFIG_CMD_MMC |
| 61 | static int mx23_olx_mmc_cd(int id) |
| 62 | { |
| 63 | return 1; /* Card always present */ |
| 64 | } |
| 65 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 66 | int board_mmc_init(struct bd_info *bis) |
Marek Vasut | 73f2b03 | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 67 | { |
| 68 | return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd); |
| 69 | } |
| 70 | #endif |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 71 | |
| 72 | int board_init(void) |
| 73 | { |
| 74 | /* Adress of boot parameters */ |
| 75 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; |
| 76 | |
Uri Mashiach | 4892d39 | 2017-01-19 10:51:45 +0200 | [diff] [blame] | 77 | #if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE) |
| 78 | status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE); |
Otavio Salvador | fcc7689 | 2013-02-23 02:43:09 +0000 | [diff] [blame] | 79 | #endif |
| 80 | |
Marek Vasut | 189e35b | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 81 | return 0; |
| 82 | } |