summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-03-28 08:24:01 -0400
committerTom Rini <trini@ti.com>2014-03-28 08:24:01 -0400
commit82b9547387389cc4147596cb45609bf29d3fdbdb (patch)
tree76e2566eaa67e09e7c2262bdc2354d81b8523ecd /include
parent81b196bed881e3f38d7b1eabe1b60d9b86c7bb7b (diff)
parenteea4e6fe82fef9975e0153644935b89882890450 (diff)
downloadu-boot-imx-82b9547387389cc4147596cb45609bf29d3fdbdb.zip
u-boot-imx-82b9547387389cc4147596cb45609bf29d3fdbdb.tar.gz
u-boot-imx-82b9547387389cc4147596cb45609bf29d3fdbdb.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-mmc
Diffstat (limited to 'include')
-rw-r--r--include/dwmmc.h2
-rw-r--r--include/fsl_esdhc.h4
-rw-r--r--include/mmc.h48
-rw-r--r--include/sdhci.h2
4 files changed, 42 insertions, 14 deletions
diff --git a/include/dwmmc.h b/include/dwmmc.h
index b641558..c9bdf51 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -143,6 +143,8 @@ struct dwmci_host {
void (*clksel)(struct dwmci_host *host);
void (*board_init)(struct dwmci_host *host);
unsigned int (*get_mmc_clk)(struct dwmci_host *host);
+
+ struct mmc_config cfg;
};
struct dwmci_idmac {
diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h
index 89bcbd1..a6e3a5d 100644
--- a/include/fsl_esdhc.h
+++ b/include/fsl_esdhc.h
@@ -13,6 +13,9 @@
#include <asm/errno.h>
#include <asm/byteorder.h>
+/* needed for the mmc_cfg definition */
+#include <mmc.h>
+
/* FSL eSDHC-specific constants */
#define SYSCTL 0x0002e02c
#define SYSCTL_INITA 0x08000000
@@ -155,6 +158,7 @@ struct fsl_esdhc_cfg {
u32 esdhc_base;
u32 sdhc_clk;
u8 max_bus_width;
+ struct mmc_config cfg;
};
/* Select the correct accessors depending on endianess */
diff --git a/include/mmc.h b/include/mmc.h
index e95a237..0172979 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -250,20 +250,40 @@ struct mmc_data {
uint blocksize;
};
+/* forward decl. */
+struct mmc;
+
+struct mmc_ops {
+ int (*send_cmd)(struct mmc *mmc,
+ struct mmc_cmd *cmd, struct mmc_data *data);
+ void (*set_ios)(struct mmc *mmc);
+ int (*init)(struct mmc *mmc);
+ int (*getcd)(struct mmc *mmc);
+ int (*getwp)(struct mmc *mmc);
+};
+
+struct mmc_config {
+ const char *name;
+ const struct mmc_ops *ops;
+ uint host_caps;
+ uint voltages;
+ uint f_min;
+ uint f_max;
+ uint b_max;
+ unsigned char part_type;
+};
+
+/* TODO struct mmc should be in mmc_private but it's hard to fix right now */
struct mmc {
struct list_head link;
- char name[32];
- void *priv;
- uint voltages;
+ const struct mmc_config *cfg; /* provided configuration */
uint version;
+ void *priv;
uint has_init;
- uint f_min;
- uint f_max;
int high_capacity;
uint bus_width;
uint clock;
uint card_caps;
- uint host_caps;
uint ocr;
uint dsr;
uint dsr_imp;
@@ -283,13 +303,6 @@ struct mmc {
u64 capacity_rpmb;
u64 capacity_gp[4];
block_dev_desc_t block_dev;
- int (*send_cmd)(struct mmc *mmc,
- struct mmc_cmd *cmd, struct mmc_data *data);
- void (*set_ios)(struct mmc *mmc);
- int (*init)(struct mmc *mmc);
- int (*getcd)(struct mmc *mmc);
- int (*getwp)(struct mmc *mmc);
- uint b_max;
char op_cond_pending; /* 1 if we are waiting on an op_cond command */
char init_in_progress; /* 1 if we have done mmc_start_init() */
char preinit; /* start init as early as possible */
@@ -297,6 +310,8 @@ struct mmc {
};
int mmc_register(struct mmc *mmc);
+struct mmc *mmc_create(const struct mmc_config *cfg, void *priv);
+void mmc_destroy(struct mmc *mmc);
int mmc_initialize(bd_t *bis);
int mmc_init(struct mmc *mmc);
int mmc_read(struct mmc *mmc, u64 src, uchar *dst, int size);
@@ -345,7 +360,7 @@ void mmc_set_preinit(struct mmc *mmc, int preinit);
#ifdef CONFIG_GENERIC_MMC
#ifdef CONFIG_MMC_SPI
-#define mmc_host_is_spi(mmc) ((mmc)->host_caps & MMC_MODE_SPI)
+#define mmc_host_is_spi(mmc) ((mmc)->cfg.host_caps & MMC_MODE_SPI)
#else
#define mmc_host_is_spi(mmc) 0
#endif
@@ -354,4 +369,9 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
int mmc_legacy_init(int verbose);
#endif
+/* Set block count limit because of 16 bit register limit on some hardware*/
+#ifndef CONFIG_SYS_MMC_MAX_BLK_COUNT
+#define CONFIG_SYS_MMC_MAX_BLK_COUNT 65535
+#endif
+
#endif /* _MMC_H_ */
diff --git a/include/sdhci.h b/include/sdhci.h
index 74d06ae..2c480d0 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -247,6 +247,8 @@ struct sdhci_host {
void (*set_control_reg)(struct sdhci_host *host);
void (*set_clock)(int dev_index, unsigned int div);
uint voltages;
+
+ struct mmc_config cfg;
};
#ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS