blob: dd473c8ecd3d6c504b32f17013bc7334dd336a6c [file] [log] [blame]
Minkyu Kang12760ab2010-07-06 20:26:06 +09001/*
2 * (C) Copyright 2009 SAMSUNG Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
4 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02005 * SPDX-License-Identifier: GPL-2.0+
Minkyu Kang12760ab2010-07-06 20:26:06 +09006 */
7
8#ifndef __ASM_ARCH_MMC_H_
9#define __ASM_ARCH_MMC_H_
10
Przemyslaw Marczak1b9457e2013-09-03 14:57:52 +020011#define S5P_MMC_DEV_OFFSET 0x100000
12
Jaehoon Chungb0b0c9d2012-04-23 02:36:28 +000013#define SDHCI_CONTROL2 0x80
14#define SDHCI_CONTROL3 0x84
15#define SDHCI_CONTROL4 0x8C
Minkyu Kang12760ab2010-07-06 20:26:06 +090016
Jaehoon Chungb0b0c9d2012-04-23 02:36:28 +000017#define SDHCI_CTRL2_ENSTAASYNCCLR (1 << 31)
18#define SDHCI_CTRL2_ENCMDCNFMSK (1 << 30)
19#define SDHCI_CTRL2_CDINVRXD3 (1 << 29)
20#define SDHCI_CTRL2_SLCARDOUT (1 << 28)
Minkyu Kang12760ab2010-07-06 20:26:06 +090021
Jaehoon Chungb0b0c9d2012-04-23 02:36:28 +000022#define SDHCI_CTRL2_FLTCLKSEL_MASK (0xf << 24)
23#define SDHCI_CTRL2_FLTCLKSEL_SHIFT (24)
24#define SDHCI_CTRL2_FLTCLKSEL(_x) ((_x) << 24)
25
26#define SDHCI_CTRL2_LVLDAT_MASK (0xff << 16)
27#define SDHCI_CTRL2_LVLDAT_SHIFT (16)
28#define SDHCI_CTRL2_LVLDAT(_x) ((_x) << 16)
29
30#define SDHCI_CTRL2_ENFBCLKTX (1 << 15)
31#define SDHCI_CTRL2_ENFBCLKRX (1 << 14)
32#define SDHCI_CTRL2_SDCDSEL (1 << 13)
33#define SDHCI_CTRL2_SDSIGPC (1 << 12)
34#define SDHCI_CTRL2_ENBUSYCHKTXSTART (1 << 11)
35
36#define SDHCI_CTRL2_DFCNT_MASK(_x) ((_x) << 9)
37#define SDHCI_CTRL2_DFCNT_SHIFT (9)
38
39#define SDHCI_CTRL2_ENCLKOUTHOLD (1 << 8)
40#define SDHCI_CTRL2_RWAITMODE (1 << 7)
41#define SDHCI_CTRL2_DISBUFRD (1 << 6)
42#define SDHCI_CTRL2_SELBASECLK_MASK(_x) ((_x) << 4)
43#define SDHCI_CTRL2_SELBASECLK_SHIFT (4)
44#define SDHCI_CTRL2_PWRSYNC (1 << 3)
45#define SDHCI_CTRL2_ENCLKOUTMSKCON (1 << 1)
46#define SDHCI_CTRL2_HWINITFIN (1 << 0)
47
48#define SDHCI_CTRL3_FCSEL3 (1 << 31)
49#define SDHCI_CTRL3_FCSEL2 (1 << 23)
50#define SDHCI_CTRL3_FCSEL1 (1 << 15)
51#define SDHCI_CTRL3_FCSEL0 (1 << 7)
52
53#define SDHCI_CTRL4_DRIVE_MASK(_x) ((_x) << 16)
54#define SDHCI_CTRL4_DRIVE_SHIFT (16)
55
Jaehoon Chunge26123b2012-08-30 16:24:10 +000056int s5p_sdhci_init(u32 regbase, int index, int bus_width);
Minkyu Kang12760ab2010-07-06 20:26:06 +090057
Jaehoon Chung891843c2013-12-03 14:01:06 +090058static inline int s5p_mmc_init(int index, int bus_width)
Jaehoon Chungb0b0c9d2012-04-23 02:36:28 +000059{
Przemyslaw Marczak1b9457e2013-09-03 14:57:52 +020060 unsigned int base = samsung_get_base_mmc() +
61 (S5P_MMC_DEV_OFFSET * index);
62
Jaehoon Chunge26123b2012-08-30 16:24:10 +000063 return s5p_sdhci_init(base, index, bus_width);
Jaehoon Chungb0b0c9d2012-04-23 02:36:28 +000064}
Minkyu Kang12760ab2010-07-06 20:26:06 +090065#endif