blob: ab134d06c5740796c4e43841676add029f9268cc [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stefano Babicc67bee12010-02-05 15:11:27 +01002/*
3 * (C) Copyright 2000-2003
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 *
6 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
7 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
Stefano Babicc67bee12010-02-05 15:11:27 +01008 */
9
10#include <common.h>
11#include <asm/arch/imx-regs.h>
Stefano Babice4d34492010-03-05 17:54:37 +010012#include <asm/arch/clock.h>
Stefano Babicc67bee12010-02-05 15:11:27 +010013
John Rigby29565322010-12-20 18:27:51 -070014#ifdef CONFIG_FSL_ESDHC
15DECLARE_GLOBAL_DATA_PTR;
16#endif
17
Stefano Babicc67bee12010-02-05 15:11:27 +010018int get_clocks(void)
19{
Stefano Babicc67bee12010-02-05 15:11:27 +010020#ifdef CONFIG_FSL_ESDHC
Michael Langer5c237122012-06-14 03:44:33 +000021#ifdef CONFIG_FSL_USDHC
Benoît Thébaudeau32384652012-09-27 10:24:37 +000022#if CONFIG_SYS_FSL_ESDHC_ADDR == USDHC2_BASE_ADDR
Simon Glasse9adeca2012-12-13 20:49:05 +000023 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000024#elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC3_BASE_ADDR
Simon Glasse9adeca2012-12-13 20:49:05 +000025 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000026#elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC4_BASE_ADDR
Simon Glasse9adeca2012-12-13 20:49:05 +000027 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
Michael Langer5c237122012-06-14 03:44:33 +000028#else
Simon Glasse9adeca2012-12-13 20:49:05 +000029 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000030#endif
31#else
32#if CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC2_BASE_ADDR
Simon Glasse9adeca2012-12-13 20:49:05 +000033 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000034#elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC3_BASE_ADDR
Simon Glasse9adeca2012-12-13 20:49:05 +000035 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000036#elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC4_BASE_ADDR
Simon Glasse9adeca2012-12-13 20:49:05 +000037 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000038#else
Simon Glasse9adeca2012-12-13 20:49:05 +000039 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
Benoît Thébaudeau32384652012-09-27 10:24:37 +000040#endif
Stefano Babicc67bee12010-02-05 15:11:27 +010041#endif
Michael Langer5c237122012-06-14 03:44:33 +000042#endif
Stefano Babicc67bee12010-02-05 15:11:27 +010043 return 0;
44}