1 /* linux/arch/arm/mach-exynos4/setup-sdhci.c
3 * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd.
4 * http://www.samsung.com
6 * EXYNOS4 - Helper functions for settign up SDHCI device(s) (HSMMC)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
13 #include <linux/kernel.h>
14 #include <linux/types.h>
15 #include <linux/interrupt.h>
16 #include <linux/platform_device.h>
19 #include <linux/mmc/card.h>
20 #include <linux/mmc/host.h>
22 #include <plat/regs-sdhci.h>
24 /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
26 char *exynos4_hsmmc_clksrcs
[4] = {
29 [2] = "sclk_mmc", /* mmc_bus */
33 void exynos4_setup_sdhci_cfg_card(struct platform_device
*dev
, void __iomem
*r
,
34 struct mmc_ios
*ios
, struct mmc_card
*card
)
38 /* don't need to alter anything according to card-type */
40 ctrl2
= readl(r
+ S3C_SDHCI_CONTROL2
);
42 /* select base clock source to HCLK */
44 ctrl2
&= S3C_SDHCI_CTRL2_SELBASECLK_MASK
;
47 * clear async mode, enable conflict mask, rx feedback ctrl, SD
48 * clk hold and no use debounce count
51 ctrl2
|= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR
|
52 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK
|
53 S3C_SDHCI_CTRL2_ENFBCLKRX
|
54 S3C_SDHCI_CTRL2_DFCNT_NONE
|
55 S3C_SDHCI_CTRL2_ENCLKOUTHOLD
);
57 /* Tx and Rx feedback clock delay control */
59 if (ios
->clock
< 25 * 1000000)
60 ctrl3
= (S3C_SDHCI_CTRL3_FCSEL3
|
61 S3C_SDHCI_CTRL3_FCSEL2
|
62 S3C_SDHCI_CTRL3_FCSEL1
|
63 S3C_SDHCI_CTRL3_FCSEL0
);
65 ctrl3
= (S3C_SDHCI_CTRL3_FCSEL1
| S3C_SDHCI_CTRL3_FCSEL0
);
67 writel(ctrl2
, r
+ S3C_SDHCI_CONTROL2
);
68 writel(ctrl3
, r
+ S3C_SDHCI_CONTROL3
);