blob: 26132bf71daac8924b663841b494fe4523e8449d [file] [log] [blame]
Stefano Babicff7a5ca2010-02-05 15:11:27 +01001/*
2 * (C) Copyright 2000-2003
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * Copyright (C) 2004-2007 Freescale Semiconductor, Inc.
6 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
7 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02008 * SPDX-License-Identifier: GPL-2.0+
Stefano Babicff7a5ca2010-02-05 15:11:27 +01009 */
10
11#include <common.h>
12#include <asm/arch/imx-regs.h>
Stefano Babicac41d4d2010-03-05 17:54:37 +010013#include <asm/arch/clock.h>
Stefano Babicff7a5ca2010-02-05 15:11:27 +010014
John Rigby0d21ed02010-12-20 18:27:51 -070015#ifdef CONFIG_FSL_ESDHC
16DECLARE_GLOBAL_DATA_PTR;
17#endif
18
Stefano Babicff7a5ca2010-02-05 15:11:27 +010019int get_clocks(void)
20{
Stefano Babicff7a5ca2010-02-05 15:11:27 +010021#ifdef CONFIG_FSL_ESDHC
Michael Langerb2ec8162012-06-14 03:44:33 +000022#ifdef CONFIG_FSL_USDHC
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000023#if CONFIG_SYS_FSL_ESDHC_ADDR == USDHC2_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000024 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000025#elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC3_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000026 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000027#elif CONFIG_SYS_FSL_ESDHC_ADDR == USDHC4_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000028 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000029#else
Simon Glass9e247d12012-12-13 20:49:05 +000030 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000031#endif
Michael Langerb2ec8162012-06-14 03:44:33 +000032#else
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000033#if CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC2_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000034 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000035#elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC3_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000036 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000037#elif CONFIG_SYS_FSL_ESDHC_ADDR == MMC_SDHC4_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000038 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000039#else
Simon Glass9e247d12012-12-13 20:49:05 +000040 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000041#endif
Stefano Babicff7a5ca2010-02-05 15:11:27 +010042#endif
Michael Langerb2ec8162012-06-14 03:44:33 +000043#endif
Stefano Babicff7a5ca2010-02-05 15:11:27 +010044 return 0;
45}