blob: 0e81cc880a1a15b0415f0c7b9fc105a87983a36c [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Stefano Babicff7a5ca2010-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 Babicff7a5ca2010-02-05 15:11:27 +01008 */
9
Tom Riniabb9a042024-05-18 20:20:43 -060010#include <common.h>
Simon Glass85d65312019-12-28 10:44:58 -070011#include <clock_legacy.h>
Stefano Babicff7a5ca2010-02-05 15:11:27 +010012#include <asm/arch/imx-regs.h>
Stefano Babicac41d4d2010-03-05 17:54:37 +010013#include <asm/arch/clock.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060014#include <asm/global_data.h>
Stefano Babicff7a5ca2010-02-05 15:11:27 +010015
Yangbo Lu73340382019-06-21 11:42:28 +080016#ifdef CONFIG_FSL_ESDHC_IMX
John Rigby0d21ed02010-12-20 18:27:51 -070017DECLARE_GLOBAL_DATA_PTR;
18#endif
19
Stefano Babicff7a5ca2010-02-05 15:11:27 +010020int get_clocks(void)
21{
Yangbo Lu73340382019-06-21 11:42:28 +080022#ifdef CONFIG_FSL_ESDHC_IMX
Michael Langerb2ec8162012-06-14 03:44:33 +000023#ifdef CONFIG_FSL_USDHC
Tom Rini376b88a2022-10-28 20:27:13 -040024#if CFG_SYS_FSL_ESDHC_ADDR == USDHC2_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000025 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
Tom Rini376b88a2022-10-28 20:27:13 -040026#elif CFG_SYS_FSL_ESDHC_ADDR == USDHC3_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000027 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
Tom Rini376b88a2022-10-28 20:27:13 -040028#elif CFG_SYS_FSL_ESDHC_ADDR == USDHC4_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000029 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000030#else
Simon Glass9e247d12012-12-13 20:49:05 +000031 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000032#endif
Michael Langerb2ec8162012-06-14 03:44:33 +000033#else
Tom Rini376b88a2022-10-28 20:27:13 -040034#if CFG_SYS_FSL_ESDHC_ADDR == MMC_SDHC2_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000035 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
Tom Rini376b88a2022-10-28 20:27:13 -040036#elif CFG_SYS_FSL_ESDHC_ADDR == MMC_SDHC3_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000037 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
Tom Rini376b88a2022-10-28 20:27:13 -040038#elif CFG_SYS_FSL_ESDHC_ADDR == MMC_SDHC4_BASE_ADDR
Simon Glass9e247d12012-12-13 20:49:05 +000039 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000040#else
Simon Glass9e247d12012-12-13 20:49:05 +000041 gd->arch.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK);
Benoît Thébaudeaueb9c2552012-09-27 10:24:37 +000042#endif
Stefano Babicff7a5ca2010-02-05 15:11:27 +010043#endif
Michael Langerb2ec8162012-06-14 03:44:33 +000044#endif
Stefano Babicff7a5ca2010-02-05 15:11:27 +010045 return 0;
46}