Path: blob/master/arch/arm/mach-exynos4/setup-sdhci.c
10817 views
/* linux/arch/arm/mach-exynos4/setup-sdhci.c1*2* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.3* http://www.samsung.com4*5* EXYNOS4 - Helper functions for settign up SDHCI device(s) (HSMMC)6*7* This program is free software; you can redistribute it and/or modify8* it under the terms of the GNU General Public License version 2 as9* published by the Free Software Foundation.10*/1112#include <linux/kernel.h>13#include <linux/types.h>14#include <linux/interrupt.h>15#include <linux/platform_device.h>16#include <linux/io.h>1718#include <linux/mmc/card.h>19#include <linux/mmc/host.h>2021#include <plat/regs-sdhci.h>2223/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */2425char *exynos4_hsmmc_clksrcs[4] = {26[0] = NULL,27[1] = NULL,28[2] = "sclk_mmc", /* mmc_bus */29[3] = NULL,30};3132void exynos4_setup_sdhci_cfg_card(struct platform_device *dev, void __iomem *r,33struct mmc_ios *ios, struct mmc_card *card)34{35u32 ctrl2, ctrl3;3637/* don't need to alter anything according to card-type */3839ctrl2 = readl(r + S3C_SDHCI_CONTROL2);4041/* select base clock source to HCLK */4243ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;4445/*46* clear async mode, enable conflict mask, rx feedback ctrl, SD47* clk hold and no use debounce count48*/4950ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |51S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |52S3C_SDHCI_CTRL2_ENFBCLKRX |53S3C_SDHCI_CTRL2_DFCNT_NONE |54S3C_SDHCI_CTRL2_ENCLKOUTHOLD);5556/* Tx and Rx feedback clock delay control */5758if (ios->clock < 25 * 1000000)59ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |60S3C_SDHCI_CTRL3_FCSEL2 |61S3C_SDHCI_CTRL3_FCSEL1 |62S3C_SDHCI_CTRL3_FCSEL0);63else64ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);6566writel(ctrl2, r + S3C_SDHCI_CONTROL2);67writel(ctrl3, r + S3C_SDHCI_CONTROL3);68}697071