Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Minkyu Kang | b1b2468 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2009 SAMSUNG Electronics |
| 4 | * Minkyu Kang <mk7.kang@samsung.com> |
Minkyu Kang | b1b2468 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 5 | */ |
| 6 | |
| 7 | #ifndef __ASM_ARCH_MMC_H_ |
| 8 | #define __ASM_ARCH_MMC_H_ |
| 9 | |
Przemyslaw Marczak | 1b9457e | 2013-09-03 14:57:52 +0200 | [diff] [blame] | 10 | #define S5P_MMC_DEV_OFFSET 0x10000 |
| 11 | |
Jaehoon Chung | b0b0c9d | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 12 | #define SDHCI_CONTROL2 0x80 |
| 13 | #define SDHCI_CONTROL3 0x84 |
| 14 | #define SDHCI_CONTROL4 0x8C |
Minkyu Kang | b1b2468 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 15 | |
Jaehoon Chung | b0b0c9d | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 16 | #define SDHCI_CTRL2_ENSTAASYNCCLR (1 << 31) |
| 17 | #define SDHCI_CTRL2_ENCMDCNFMSK (1 << 30) |
| 18 | #define SDHCI_CTRL2_CDINVRXD3 (1 << 29) |
| 19 | #define SDHCI_CTRL2_SLCARDOUT (1 << 28) |
Minkyu Kang | b1b2468 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 20 | |
Jaehoon Chung | b0b0c9d | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 21 | #define SDHCI_CTRL2_FLTCLKSEL_MASK (0xf << 24) |
| 22 | #define SDHCI_CTRL2_FLTCLKSEL_SHIFT (24) |
| 23 | #define SDHCI_CTRL2_FLTCLKSEL(_x) ((_x) << 24) |
| 24 | |
| 25 | #define SDHCI_CTRL2_LVLDAT_MASK (0xff << 16) |
| 26 | #define SDHCI_CTRL2_LVLDAT_SHIFT (16) |
| 27 | #define SDHCI_CTRL2_LVLDAT(_x) ((_x) << 16) |
| 28 | |
| 29 | #define SDHCI_CTRL2_ENFBCLKTX (1 << 15) |
| 30 | #define SDHCI_CTRL2_ENFBCLKRX (1 << 14) |
| 31 | #define SDHCI_CTRL2_SDCDSEL (1 << 13) |
| 32 | #define SDHCI_CTRL2_SDSIGPC (1 << 12) |
| 33 | #define SDHCI_CTRL2_ENBUSYCHKTXSTART (1 << 11) |
| 34 | |
| 35 | #define SDHCI_CTRL2_DFCNT_MASK(_x) ((_x) << 9) |
| 36 | #define SDHCI_CTRL2_DFCNT_SHIFT (9) |
| 37 | |
| 38 | #define SDHCI_CTRL2_ENCLKOUTHOLD (1 << 8) |
| 39 | #define SDHCI_CTRL2_RWAITMODE (1 << 7) |
| 40 | #define SDHCI_CTRL2_DISBUFRD (1 << 6) |
| 41 | #define SDHCI_CTRL2_SELBASECLK_MASK(_x) ((_x) << 4) |
| 42 | #define SDHCI_CTRL2_SELBASECLK_SHIFT (4) |
| 43 | #define SDHCI_CTRL2_PWRSYNC (1 << 3) |
| 44 | #define SDHCI_CTRL2_ENCLKOUTMSKCON (1 << 1) |
| 45 | #define SDHCI_CTRL2_HWINITFIN (1 << 0) |
| 46 | |
| 47 | #define SDHCI_CTRL3_FCSEL3 (1 << 31) |
| 48 | #define SDHCI_CTRL3_FCSEL2 (1 << 23) |
| 49 | #define SDHCI_CTRL3_FCSEL1 (1 << 15) |
| 50 | #define SDHCI_CTRL3_FCSEL0 (1 << 7) |
| 51 | |
| 52 | #define SDHCI_CTRL4_DRIVE_MASK(_x) ((_x) << 16) |
| 53 | #define SDHCI_CTRL4_DRIVE_SHIFT (16) |
| 54 | |
Piotr Wilczek | 12cf19e | 2014-03-07 14:59:41 +0100 | [diff] [blame] | 55 | #define SDHCI_MAX_HOSTS 4 |
| 56 | |
Jaehoon Chung | e26123b | 2012-08-30 16:24:10 +0000 | [diff] [blame] | 57 | int s5p_sdhci_init(u32 regbase, int index, int bus_width); |
Minkyu Kang | b1b2468 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 58 | |
Jaehoon Chung | 891843c | 2013-12-03 14:01:06 +0900 | [diff] [blame] | 59 | static inline int s5p_mmc_init(int index, int bus_width) |
Jaehoon Chung | b0b0c9d | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 60 | { |
Przemyslaw Marczak | 1b9457e | 2013-09-03 14:57:52 +0200 | [diff] [blame] | 61 | unsigned int base = samsung_get_base_mmc() + |
| 62 | (S5P_MMC_DEV_OFFSET * index); |
| 63 | |
Jaehoon Chung | e26123b | 2012-08-30 16:24:10 +0000 | [diff] [blame] | 64 | return s5p_sdhci_init(base, index, bus_width); |
Jaehoon Chung | b0b0c9d | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 65 | } |
Piotr Wilczek | 12cf19e | 2014-03-07 14:59:41 +0100 | [diff] [blame] | 66 | |
Minkyu Kang | b1b2468 | 2011-01-24 15:22:23 +0900 | [diff] [blame] | 67 | #endif |