tizen 2.3.1 release
[platform/kernel/u-boot.git] / arch / arm / include / asm / arch-s5pc1xx / mmc.h
index dd473c8..fac0ec9 100644 (file)
@@ -2,64 +2,86 @@
  * (C) Copyright 2009 SAMSUNG Electronics
  * Minkyu Kang <mk7.kang@samsung.com>
  *
- * SPDX-License-Identifier:    GPL-2.0+
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
  */
 
 #ifndef __ASM_ARCH_MMC_H_
 #define __ASM_ARCH_MMC_H_
 
-#define S5P_MMC_DEV_OFFSET     0x100000
-
-#define SDHCI_CONTROL2         0x80
-#define SDHCI_CONTROL3         0x84
-#define SDHCI_CONTROL4         0x8C
-
-#define SDHCI_CTRL2_ENSTAASYNCCLR      (1 << 31)
-#define SDHCI_CTRL2_ENCMDCNFMSK                (1 << 30)
-#define SDHCI_CTRL2_CDINVRXD3          (1 << 29)
-#define SDHCI_CTRL2_SLCARDOUT          (1 << 28)
-
-#define SDHCI_CTRL2_FLTCLKSEL_MASK     (0xf << 24)
-#define SDHCI_CTRL2_FLTCLKSEL_SHIFT    (24)
-#define SDHCI_CTRL2_FLTCLKSEL(_x)      ((_x) << 24)
+#define RX_DELAY1      ((0 << 15) | (1 << 7))
+#define RX_DELAY2      ((1 << 15) | (1 << 7))
+#define RX_DELAY3      ((0 << 15) | (0 << 7))
+#define RX_DELAY4      ((1 << 15) | (0 << 7))
 
-#define SDHCI_CTRL2_LVLDAT_MASK                (0xff << 16)
-#define SDHCI_CTRL2_LVLDAT_SHIFT       (16)
-#define SDHCI_CTRL2_LVLDAT(_x)         ((_x) << 16)
+#define TX_DELAY1      (RX_DELAY1 << 16)
+#define TX_DELAY2      (RX_DELAY2 << 16)
+#define TX_DELAY3      (RX_DELAY3 << 16)
+#define TX_DELAY4      (RX_DELAY4 << 16)
 
-#define SDHCI_CTRL2_ENFBCLKTX          (1 << 15)
-#define SDHCI_CTRL2_ENFBCLKRX          (1 << 14)
-#define SDHCI_CTRL2_SDCDSEL            (1 << 13)
-#define SDHCI_CTRL2_SDSIGPC            (1 << 12)
-#define SDHCI_CTRL2_ENBUSYCHKTXSTART   (1 << 11)
+#ifndef __ASSEMBLY__
+struct s5p_mmc {
+       unsigned int    sysad;
+       unsigned short  blksize;
+       unsigned short  blkcnt;
+       unsigned int    argument;
+       unsigned short  trnmod;
+       unsigned short  cmdreg;
+       unsigned int    rspreg0;
+       unsigned int    rspreg1;
+       unsigned int    rspreg2;
+       unsigned int    rspreg3;
+       unsigned int    bdata;
+       unsigned int    prnsts;
+       unsigned char   hostctl;
+       unsigned char   pwrcon;
+       unsigned char   blkgap;
+       unsigned char   wakcon;
+       unsigned short  clkcon;
+       unsigned char   timeoutcon;
+       unsigned char   swrst;
+       unsigned int    norintsts;      /* errintsts */
+       unsigned int    norintstsen;    /* errintstsen */
+       unsigned int    norintsigen;    /* errintsigen */
+       unsigned short  acmd12errsts;
+       unsigned char   res1[2];
+       unsigned int    capareg;
+       unsigned char   res2[4];
+       unsigned int    maxcurr;
+       unsigned char   res3[0x34];
+       unsigned int    control2;
+       unsigned int    control3;
+       unsigned char   res4[4];
+       unsigned int    control4;
+       unsigned char   res5[0x6e];
+       unsigned short  hcver;
+       unsigned char   res6[0xFFF00];
+};
 
-#define SDHCI_CTRL2_DFCNT_MASK(_x)     ((_x) << 9)
-#define SDHCI_CTRL2_DFCNT_SHIFT                (9)
-
-#define SDHCI_CTRL2_ENCLKOUTHOLD       (1 << 8)
-#define SDHCI_CTRL2_RWAITMODE          (1 << 7)
-#define SDHCI_CTRL2_DISBUFRD           (1 << 6)
-#define SDHCI_CTRL2_SELBASECLK_MASK(_x)        ((_x) << 4)
-#define SDHCI_CTRL2_SELBASECLK_SHIFT   (4)
-#define SDHCI_CTRL2_PWRSYNC            (1 << 3)
-#define SDHCI_CTRL2_ENCLKOUTMSKCON     (1 << 1)
-#define SDHCI_CTRL2_HWINITFIN          (1 << 0)
-
-#define SDHCI_CTRL3_FCSEL3             (1 << 31)
-#define SDHCI_CTRL3_FCSEL2             (1 << 23)
-#define SDHCI_CTRL3_FCSEL1             (1 << 15)
-#define SDHCI_CTRL3_FCSEL0             (1 << 7)
-
-#define SDHCI_CTRL4_DRIVE_MASK(_x)     ((_x) << 16)
-#define SDHCI_CTRL4_DRIVE_SHIFT                (16)
-
-int s5p_sdhci_init(u32 regbase, int index, int bus_width);
+struct mmc_host {
+       struct s5p_mmc *reg;
+       unsigned int version;   /* SDHCI spec. version */
+       unsigned int clock;     /* Current clock (MHz) */
+       int dev_index;
+#ifdef CONFIG_MMC_ASYNC_WRITE
+       int async_write;
+       int async_on;
+#endif
+};
 
-static inline int s5p_mmc_init(int index, int bus_width)
-{
-       unsigned int base = samsung_get_base_mmc() +
-                                (S5P_MMC_DEV_OFFSET * index);
+int s5p_mmc_init(int dev_index, int bus_width);
 
-       return s5p_sdhci_init(base, index, bus_width);
-}
+#endif /* __ASSEMBLY__ */
 #endif