1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+ 264a93860SMarek Vasut /* 364a93860SMarek Vasut * Olimex MX23 Olinuxino board 464a93860SMarek Vasut * 564a93860SMarek Vasut * Copyright (C) 2013 Marek Vasut <marex@denx.de> 664a93860SMarek Vasut */ 764a93860SMarek Vasut 864a93860SMarek Vasut #include <common.h> 97315e3bfSOtavio Salvador #include <asm/gpio.h> 1013b1ebdeSMarek Vasut #include <asm/io.h> 1113b1ebdeSMarek Vasut #include <asm/arch/iomux-mx23.h> 1264a93860SMarek Vasut #include <asm/arch/imx-regs.h> 1313b1ebdeSMarek Vasut #include <asm/arch/clock.h> 1464a93860SMarek Vasut #include <asm/arch/sys_proto.h> 152d8d190cSUri Mashiach #ifdef CONFIG_LED_STATUS 1636c7c925SOtavio Salvador #include <status_led.h> 1736c7c925SOtavio Salvador #endif 1864a93860SMarek Vasut 1964a93860SMarek Vasut DECLARE_GLOBAL_DATA_PTR; 2064a93860SMarek Vasut 2164a93860SMarek Vasut /* 2264a93860SMarek Vasut * Functions 2364a93860SMarek Vasut */ board_early_init_f(void)2464a93860SMarek Vasutint board_early_init_f(void) 2564a93860SMarek Vasut { 2613b1ebdeSMarek Vasut /* IO0 clock at 480MHz */ 2713b1ebdeSMarek Vasut mxs_set_ioclk(MXC_IOCLK0, 480000); 2813b1ebdeSMarek Vasut 2913b1ebdeSMarek Vasut /* SSP0 clock at 96MHz */ 3013b1ebdeSMarek Vasut mxs_set_sspclk(MXC_SSPCLK0, 96000, 0); 3113b1ebdeSMarek Vasut 3264a93860SMarek Vasut return 0; 3364a93860SMarek Vasut } 3464a93860SMarek Vasut 35ca11db26SMarek Vasut #ifdef CONFIG_CMD_USB board_ehci_hcd_init(int port)36ca11db26SMarek Vasutint board_ehci_hcd_init(int port) 37ca11db26SMarek Vasut { 38ca11db26SMarek Vasut /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */ 39ca11db26SMarek Vasut gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 1); 40ca11db26SMarek Vasut udelay(100); 41ca11db26SMarek Vasut return 0; 42ca11db26SMarek Vasut } 43ca11db26SMarek Vasut board_ehci_hcd_exit(int port)44ca11db26SMarek Vasutint board_ehci_hcd_exit(int port) 45ca11db26SMarek Vasut { 46ca11db26SMarek Vasut /* Enable LAN9512 (Maxi) or GL850G (Mini) USB HUB power. */ 47ca11db26SMarek Vasut gpio_direction_output(MX23_PAD_GPMI_ALE__GPIO_0_17, 0); 48ca11db26SMarek Vasut return 0; 49ca11db26SMarek Vasut } 50ca11db26SMarek Vasut #endif 51ca11db26SMarek Vasut dram_init(void)5264a93860SMarek Vasutint dram_init(void) 5364a93860SMarek Vasut { 5464a93860SMarek Vasut return mxs_dram_init(); 5564a93860SMarek Vasut } 5664a93860SMarek Vasut 5713b1ebdeSMarek Vasut #ifdef CONFIG_CMD_MMC mx23_olx_mmc_cd(int id)5813b1ebdeSMarek Vasutstatic int mx23_olx_mmc_cd(int id) 5913b1ebdeSMarek Vasut { 6013b1ebdeSMarek Vasut return 1; /* Card always present */ 6113b1ebdeSMarek Vasut } 6213b1ebdeSMarek Vasut board_mmc_init(bd_t * bis)6313b1ebdeSMarek Vasutint board_mmc_init(bd_t *bis) 6413b1ebdeSMarek Vasut { 6513b1ebdeSMarek Vasut return mxsmmc_initialize(bis, 0, NULL, mx23_olx_mmc_cd); 6613b1ebdeSMarek Vasut } 6713b1ebdeSMarek Vasut #endif 6813b1ebdeSMarek Vasut board_init(void)6964a93860SMarek Vasutint board_init(void) 7064a93860SMarek Vasut { 7164a93860SMarek Vasut /* Adress of boot parameters */ 7264a93860SMarek Vasut gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; 7364a93860SMarek Vasut 742d8d190cSUri Mashiach #if defined(CONFIG_LED_STATUS) && defined(CONFIG_LED_STATUS_BOOT_ENABLE) 752d8d190cSUri Mashiach status_led_set(CONFIG_LED_STATUS_BOOT, CONFIG_LED_STATUS_STATE); 7636c7c925SOtavio Salvador #endif 7736c7c925SOtavio Salvador 7864a93860SMarek Vasut return 0; 7964a93860SMarek Vasut } 80