1 // SPDX-License-Identifier: GPL-2.0+
2 /*
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)
8  */
9 
10 #include <common.h>
11 #include <clock_legacy.h>
12 #include <asm/arch/imx-regs.h>
13 #include <asm/arch/clock.h>
14 #include <asm/global_data.h>
15 
16 #ifdef CONFIG_FSL_ESDHC_IMX
17 DECLARE_GLOBAL_DATA_PTR;
18 #endif
19 
get_clocks(void)20 int get_clocks(void)
21 {
22 #ifdef CONFIG_FSL_ESDHC_IMX
23 #ifdef CONFIG_FSL_USDHC
24 #if CONFIG_SYS_FSL_ESDHC_ADDR == USDHC2_BASE_ADDR
25 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
26 #elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC3_BASE_ADDR
27 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
28 #elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC4_BASE_ADDR
29 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
30 #else
31 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
32 #endif
33 #else
34 #if CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC2_BASE_ADDR
35 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
36 #elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC3_BASE_ADDR
37 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
38 #elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC4_BASE_ADDR
39 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
40 #else
41 	gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
42 #endif
43 #endif
44 #endif
45 	return 0;
46 }
47