Minkyu Kang | 5000284 | 2010-07-06 20:26:06 +0900 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2009 SAMSUNG Electronics |
| 3 | * Minkyu Kang <mk7.kang@samsung.com> |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef __ASM_ARCH_MMC_H_ |
| 22 | #define __ASM_ARCH_MMC_H_ |
| 23 | |
Jaehoon Chung | 442d556 | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 24 | #define SDHCI_CONTROL2 0x80 |
| 25 | #define SDHCI_CONTROL3 0x84 |
| 26 | #define SDHCI_CONTROL4 0x8C |
Minkyu Kang | 5000284 | 2010-07-06 20:26:06 +0900 | [diff] [blame] | 27 | |
Jaehoon Chung | 442d556 | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 28 | #define SDHCI_CTRL2_ENSTAASYNCCLR (1 << 31) |
| 29 | #define SDHCI_CTRL2_ENCMDCNFMSK (1 << 30) |
| 30 | #define SDHCI_CTRL2_CDINVRXD3 (1 << 29) |
| 31 | #define SDHCI_CTRL2_SLCARDOUT (1 << 28) |
Minkyu Kang | 5000284 | 2010-07-06 20:26:06 +0900 | [diff] [blame] | 32 | |
Jaehoon Chung | 442d556 | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 33 | #define SDHCI_CTRL2_FLTCLKSEL_MASK (0xf << 24) |
| 34 | #define SDHCI_CTRL2_FLTCLKSEL_SHIFT (24) |
| 35 | #define SDHCI_CTRL2_FLTCLKSEL(_x) ((_x) << 24) |
Minkyu Kang | 5000284 | 2010-07-06 20:26:06 +0900 | [diff] [blame] | 36 | |
Jaehoon Chung | 442d556 | 2012-04-23 02:36:28 +0000 | [diff] [blame] | 37 | #define SDHCI_CTRL2_LVLDAT_MASK (0xff << 16) |
| 38 | #define SDHCI_CTRL2_LVLDAT_SHIFT (16) |
| 39 | #define SDHCI_CTRL2_LVLDAT(_x) ((_x) << 16) |
| 40 | |
| 41 | #define SDHCI_CTRL2_ENFBCLKTX (1 << 15) |
| 42 | #define SDHCI_CTRL2_ENFBCLKRX (1 << 14) |
| 43 | #define SDHCI_CTRL2_SDCDSEL (1 << 13) |
| 44 | #define SDHCI_CTRL2_SDSIGPC (1 << 12) |
| 45 | #define SDHCI_CTRL2_ENBUSYCHKTXSTART (1 << 11) |
| 46 | |
| 47 | #define SDHCI_CTRL2_DFCNT_MASK(_x) ((_x) << 9) |
| 48 | #define SDHCI_CTRL2_DFCNT_SHIFT (9) |
| 49 | |
| 50 | #define SDHCI_CTRL2_ENCLKOUTHOLD (1 << 8) |
| 51 | #define SDHCI_CTRL2_RWAITMODE (1 << 7) |
| 52 | #define SDHCI_CTRL2_DISBUFRD (1 << 6) |
| 53 | #define SDHCI_CTRL2_SELBASECLK_MASK(_x) ((_x) << 4) |
| 54 | #define SDHCI_CTRL2_SELBASECLK_SHIFT (4) |
| 55 | #define SDHCI_CTRL2_PWRSYNC (1 << 3) |
| 56 | #define SDHCI_CTRL2_ENCLKOUTMSKCON (1 << 1) |
| 57 | #define SDHCI_CTRL2_HWINITFIN (1 << 0) |
| 58 | |
| 59 | #define SDHCI_CTRL3_FCSEL3 (1 << 31) |
| 60 | #define SDHCI_CTRL3_FCSEL2 (1 << 23) |
| 61 | #define SDHCI_CTRL3_FCSEL1 (1 << 15) |
| 62 | #define SDHCI_CTRL3_FCSEL0 (1 << 7) |
| 63 | |
| 64 | #define SDHCI_CTRL4_DRIVE_MASK(_x) ((_x) << 16) |
| 65 | #define SDHCI_CTRL4_DRIVE_SHIFT (16) |
| 66 | |
| 67 | int s5p_sdhci_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks); |
| 68 | |
| 69 | static inline unsigned int s5p_mmc_init(int index, int bus_width) |
| 70 | { |
| 71 | unsigned int base = samsung_get_base_mmc() + (0x10000 * index); |
| 72 | return s5p_sdhci_init(base, 52000000, 400000, index); |
| 73 | } |
Minkyu Kang | 5000284 | 2010-07-06 20:26:06 +0900 | [diff] [blame] | 74 | #endif |