diff options
Diffstat (limited to 'drivers/mmc')
-rw-r--r-- | drivers/mmc/sdhci.c | 11 | ||||
-rw-r--r-- | drivers/mmc/sdhci.h | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index 95fe0fdac484..302dd5bde751 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c | |||
@@ -328,6 +328,8 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) | |||
328 | 328 | ||
329 | /* Sanity checks */ | 329 | /* Sanity checks */ |
330 | BUG_ON(data->blksz * data->blocks > 524288); | 330 | BUG_ON(data->blksz * data->blocks > 524288); |
331 | BUG_ON(data->blksz > host->max_block); | ||
332 | BUG_ON(data->blocks > 65535); | ||
331 | 333 | ||
332 | /* timeout in us */ | 334 | /* timeout in us */ |
333 | target_timeout = data->timeout_ns / 1000 + | 335 | target_timeout = data->timeout_ns / 1000 + |
@@ -1158,6 +1160,15 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot) | |||
1158 | if (caps & SDHCI_TIMEOUT_CLK_UNIT) | 1160 | if (caps & SDHCI_TIMEOUT_CLK_UNIT) |
1159 | host->timeout_clk *= 1000; | 1161 | host->timeout_clk *= 1000; |
1160 | 1162 | ||
1163 | host->max_block = (caps & SDHCI_MAX_BLOCK_MASK) >> SDHCI_MAX_BLOCK_SHIFT; | ||
1164 | if (host->max_block >= 3) { | ||
1165 | printk(KERN_ERR "%s: Invalid maximum block size.\n", | ||
1166 | host->slot_descr); | ||
1167 | ret = -ENODEV; | ||
1168 | goto unmap; | ||
1169 | } | ||
1170 | host->max_block = 512 << host->max_block; | ||
1171 | |||
1161 | /* | 1172 | /* |
1162 | * Set host parameters. | 1173 | * Set host parameters. |
1163 | */ | 1174 | */ |
diff --git a/drivers/mmc/sdhci.h b/drivers/mmc/sdhci.h index 8ed2a8973db6..b1aa3acf0906 100644 --- a/drivers/mmc/sdhci.h +++ b/drivers/mmc/sdhci.h | |||
@@ -131,6 +131,8 @@ | |||
131 | #define SDHCI_TIMEOUT_CLK_UNIT 0x00000080 | 131 | #define SDHCI_TIMEOUT_CLK_UNIT 0x00000080 |
132 | #define SDHCI_CLOCK_BASE_MASK 0x00003F00 | 132 | #define SDHCI_CLOCK_BASE_MASK 0x00003F00 |
133 | #define SDHCI_CLOCK_BASE_SHIFT 8 | 133 | #define SDHCI_CLOCK_BASE_SHIFT 8 |
134 | #define SDHCI_MAX_BLOCK_MASK 0x00030000 | ||
135 | #define SDHCI_MAX_BLOCK_SHIFT 16 | ||
134 | #define SDHCI_CAN_DO_DMA 0x00400000 | 136 | #define SDHCI_CAN_DO_DMA 0x00400000 |
135 | #define SDHCI_CAN_VDD_330 0x01000000 | 137 | #define SDHCI_CAN_VDD_330 0x01000000 |
136 | #define SDHCI_CAN_VDD_300 0x02000000 | 138 | #define SDHCI_CAN_VDD_300 0x02000000 |
@@ -161,6 +163,7 @@ struct sdhci_host { | |||
161 | 163 | ||
162 | unsigned int max_clk; /* Max possible freq (MHz) */ | 164 | unsigned int max_clk; /* Max possible freq (MHz) */ |
163 | unsigned int timeout_clk; /* Timeout freq (KHz) */ | 165 | unsigned int timeout_clk; /* Timeout freq (KHz) */ |
166 | unsigned int max_block; /* Max block size (bytes) */ | ||
164 | 167 | ||
165 | unsigned int clock; /* Current clock (MHz) */ | 168 | unsigned int clock; /* Current clock (MHz) */ |
166 | unsigned short power; /* Current voltage */ | 169 | unsigned short power; /* Current voltage */ |