Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Olimex MX23 Olinuxino board |
| 3 | * |
| 4 | * Copyright (C) 2013 Marek Vasut <marex@denx.de> |
| 5 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 6 | * SPDX-License-Identifier: GPL-2.0+ |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | #include <common.h> |
Otavio Salvador | 7315e3b | 2013-03-07 07:32:53 +0000 | [diff] [blame] | 10 | #include <asm/gpio.h> |
Marek Vasut | 13b1ebd | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 11 | #include <asm/io.h> |
| 12 | #include <asm/arch/iomux-mx23.h> |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 13 | #include <asm/arch/imx-regs.h> |
Marek Vasut | 13b1ebd | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 14 | #include <asm/arch/clock.h> |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 15 | #include <asm/arch/sys_proto.h> |
Otavio Salvador | 36c7c92 | 2013-02-23 02:43:09 +0000 | [diff] [blame] | 16 | #ifdef CONFIG_STATUS_LED |
| 17 | #include <status_led.h> |
| 18 | #endif |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 19 | |
| 20 | DECLARE_GLOBAL_DATA_PTR; |
| 21 | |
| 22 | /* |
| 23 | * Functions |
| 24 | */ |
| 25 | int board_early_init_f(void) |
| 26 | { |
Marek Vasut | 13b1ebd | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 27 | /* IO0 clock at 480MHz */ |
| 28 | mxs_set_ioclk(MXC_IOCLK0, 480000); |
| 29 | |
| 30 | /* SSP0 clock at 96MHz */ |
| 31 | mxs_set_sspclk(MXC_SSPCLK0, 96000, 0); |
| 32 | |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 33 | return 0; |
| 34 | } |
| 35 | |
Marek Vasut | ca11db2 | 2014-04-28 03:38:42 +0200 | [diff] [blame] | 36 | #ifdef CONFIG_CMD_USB |
| 37 | int board_ehci_hcd_init(int port) |
| 38 | { |
| 39 | /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */ |
| 40 | gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1); |
| 41 | udelay(100); |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | int board_ehci_hcd_exit(int port) |
| 46 | { |
| 47 | /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */ |
| 48 | gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0); |
| 49 | return 0; |
| 50 | } |
| 51 | #endif |
| 52 | |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 53 | int dram_init(void) |
| 54 | { |
| 55 | return mxs_dram_init(); |
| 56 | } |
| 57 | |
Marek Vasut | 13b1ebd | 2013-01-22 15:01:05 +0000 | [diff] [blame] | 58 | #ifdef CONFIG_CMD_MMC |
| 59 | static int mx23_olx_mmc_cd(int id) |
| 60 | { |
| 61 | return 1; /* Card always present */ |
| 62 | } |
| 63 | |
| 64 | int board_mmc_init(bd_t *bis) |
| 65 | { |
| 66 | return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd); |
| 67 | } |
| 68 | #endif |
| 69 | |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 70 | int board_init(void) |
| 71 | { |
| 72 | /* Adress of boot parameters */ |
| 73 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; |
| 74 | |
Otavio Salvador | 36c7c92 | 2013-02-23 02:43:09 +0000 | [diff] [blame] | 75 | #if defined(CONFIG_STATUS_LED) && defined(STATUS_LED_BOOT) |
| 76 | status_led_set(STATUS_LED_BOOT, STATUS_LED_STATE); |
| 77 | #endif |
| 78 | |
Marek Vasut | 64a9386 | 2013-01-12 07:11:11 +0000 | [diff] [blame] | 79 | return 0; |
| 80 | } |