diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-31 15:09:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-07-31 15:09:22 -0400 |
commit | d27d4e2a660939f1bdf74f0e24c4c109f90cd98d (patch) | |
tree | 6e25f5e9f62d60589734ee0e8539c24123c1340a | |
parent | dbe63a2cde07f4bccb2b2e4b35241491d8e096f6 (diff) | |
parent | 3822a0e38c329a598cb6f5baa16be7504e0db8d9 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
mmc: orphan subsystem
imxmmc: Remove unnecessary semicolons
cb710: use SG_MITER_TO_SG/SG_MITER_FROM_SG
sdhci: use SG_MITER_TO_SG/SG_MITER_FROM_SG
lib/scatterlist: add a flags to signalize mapping direction
-rw-r--r-- | MAINTAINERS | 3 | ||||
-rw-r--r-- | drivers/misc/cb710/sgbuf2.c | 4 | ||||
-rw-r--r-- | drivers/mmc/host/cb710-mmc.c | 6 | ||||
-rw-r--r-- | drivers/mmc/host/imxmmc.c | 2 | ||||
-rw-r--r-- | drivers/mmc/host/sdhci.c | 10 | ||||
-rw-r--r-- | include/linux/cb710.h | 29 | ||||
-rw-r--r-- | include/linux/scatterlist.h | 2 | ||||
-rw-r--r-- | lib/scatterlist.c | 16 |
8 files changed, 30 insertions, 42 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 79471ba4981b..d6befb2c470f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3420,8 +3420,7 @@ S: Supported | |||
3420 | F: drivers/mfd/ | 3420 | F: drivers/mfd/ |
3421 | 3421 | ||
3422 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM | 3422 | MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM |
3423 | M: Pierre Ossman <pierre@ossman.eu> | 3423 | S: Orphan |
3424 | S: Maintained | ||
3425 | F: drivers/mmc/ | 3424 | F: drivers/mmc/ |
3426 | F: include/linux/mmc/ | 3425 | F: include/linux/mmc/ |
3427 | 3426 | ||
diff --git a/drivers/misc/cb710/sgbuf2.c b/drivers/misc/cb710/sgbuf2.c index d38a7acdb6ec..d019746551f3 100644 --- a/drivers/misc/cb710/sgbuf2.c +++ b/drivers/misc/cb710/sgbuf2.c | |||
@@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data) | |||
114 | if (!left) | 114 | if (!left) |
115 | return; | 115 | return; |
116 | addr += len; | 116 | addr += len; |
117 | flush_kernel_dcache_page(miter->page); | ||
118 | } while (sg_dwiter_next(miter)); | 117 | } while (sg_dwiter_next(miter)); |
119 | } | 118 | } |
120 | 119 | ||
@@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da | |||
142 | return; | 141 | return; |
143 | } else | 142 | } else |
144 | sg_dwiter_write_slow(miter, data); | 143 | sg_dwiter_write_slow(miter, data); |
145 | |||
146 | if (miter->length == miter->consumed) | ||
147 | flush_kernel_dcache_page(miter->page); | ||
148 | } | 144 | } |
149 | EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block); | 145 | EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block); |
150 | 146 | ||
diff --git a/drivers/mmc/host/cb710-mmc.c b/drivers/mmc/host/cb710-mmc.c index 11efefb1af51..4e72964a7b43 100644 --- a/drivers/mmc/host/cb710-mmc.c +++ b/drivers/mmc/host/cb710-mmc.c | |||
@@ -278,7 +278,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) | |||
278 | if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8))) | 278 | if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8))) |
279 | return -EINVAL; | 279 | return -EINVAL; |
280 | 280 | ||
281 | sg_miter_start(&miter, data->sg, data->sg_len, 0); | 281 | sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_TO_SG); |
282 | 282 | ||
283 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, | 283 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, |
284 | 15, CB710_MMC_C2_READ_PIO_SIZE_MASK); | 284 | 15, CB710_MMC_C2_READ_PIO_SIZE_MASK); |
@@ -307,7 +307,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) | |||
307 | goto out; | 307 | goto out; |
308 | } | 308 | } |
309 | out: | 309 | out: |
310 | cb710_sg_miter_stop_writing(&miter); | 310 | sg_miter_stop(&miter); |
311 | return err; | 311 | return err; |
312 | } | 312 | } |
313 | 313 | ||
@@ -322,7 +322,7 @@ static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data) | |||
322 | if (unlikely(data->blocks > 1 && data->blksz & 15)) | 322 | if (unlikely(data->blocks > 1 && data->blksz & 15)) |
323 | return -EINVAL; | 323 | return -EINVAL; |
324 | 324 | ||
325 | sg_miter_start(&miter, data->sg, data->sg_len, 0); | 325 | sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_FROM_SG); |
326 | 326 | ||
327 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, | 327 | cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, |
328 | 0, CB710_MMC_C2_READ_PIO_SIZE_MASK); | 328 | 0, CB710_MMC_C2_READ_PIO_SIZE_MASK); |
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c index e0be21a4a696..bf98d7cc928a 100644 --- a/drivers/mmc/host/imxmmc.c +++ b/drivers/mmc/host/imxmmc.c | |||
@@ -652,7 +652,7 @@ static irqreturn_t imxmci_irq(int irq, void *devid) | |||
652 | set_bit(IMXMCI_PEND_STARTED_b, &host->pending_events); | 652 | set_bit(IMXMCI_PEND_STARTED_b, &host->pending_events); |
653 | tasklet_schedule(&host->tasklet); | 653 | tasklet_schedule(&host->tasklet); |
654 | 654 | ||
655 | return IRQ_RETVAL(handled);; | 655 | return IRQ_RETVAL(handled); |
656 | } | 656 | } |
657 | 657 | ||
658 | static void imxmci_tasklet_fnc(unsigned long data) | 658 | static void imxmci_tasklet_fnc(unsigned long data) |
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 62041c7e9246..fc96f8cb9c0b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c | |||
@@ -773,8 +773,14 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) | |||
773 | } | 773 | } |
774 | 774 | ||
775 | if (!(host->flags & SDHCI_REQ_USE_DMA)) { | 775 | if (!(host->flags & SDHCI_REQ_USE_DMA)) { |
776 | sg_miter_start(&host->sg_miter, | 776 | int flags; |
777 | data->sg, data->sg_len, SG_MITER_ATOMIC); | 777 | |
778 | flags = SG_MITER_ATOMIC; | ||
779 | if (host->data->flags & MMC_DATA_READ) | ||
780 | flags |= SG_MITER_TO_SG; | ||
781 | else | ||
782 | flags |= SG_MITER_FROM_SG; | ||
783 | sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags); | ||
778 | host->blocks = data->blocks; | 784 | host->blocks = data->blocks; |
779 | } | 785 | } |
780 | 786 | ||
diff --git a/include/linux/cb710.h b/include/linux/cb710.h index 63bc9a4d2926..8cc10411bab2 100644 --- a/include/linux/cb710.h +++ b/include/linux/cb710.h | |||
@@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump); | |||
140 | #include <linux/highmem.h> | 140 | #include <linux/highmem.h> |
141 | #include <linux/scatterlist.h> | 141 | #include <linux/scatterlist.h> |
142 | 142 | ||
143 | /** | ||
144 | * cb710_sg_miter_stop_writing - stop mapping iteration after writing | ||
145 | * @miter: sg mapping iter to be stopped | ||
146 | * | ||
147 | * Description: | ||
148 | * Stops mapping iterator @miter. @miter should have been started | ||
149 | * started using sg_miter_start(). A stopped iteration can be | ||
150 | * resumed by calling sg_miter_next() on it. This is useful when | ||
151 | * resources (kmap) need to be released during iteration. | ||
152 | * | ||
153 | * This is a convenience wrapper that will be optimized out for arches | ||
154 | * that don't need flush_kernel_dcache_page(). | ||
155 | * | ||
156 | * Context: | ||
157 | * IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise. | ||
158 | */ | ||
159 | static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter) | ||
160 | { | ||
161 | if (miter->page) | ||
162 | flush_kernel_dcache_page(miter->page); | ||
163 | sg_miter_stop(miter); | ||
164 | } | ||
165 | |||
166 | /* | 143 | /* |
167 | * 32-bit PIO mapping sg iterator | 144 | * 32-bit PIO mapping sg iterator |
168 | * | 145 | * |
@@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter) | |||
171 | * without DMA support). | 148 | * without DMA support). |
172 | * | 149 | * |
173 | * Best-case reading (transfer from device): | 150 | * Best-case reading (transfer from device): |
174 | * sg_miter_start(); | 151 | * sg_miter_start(, SG_MITER_TO_SG); |
175 | * cb710_sg_dwiter_write_from_io(); | 152 | * cb710_sg_dwiter_write_from_io(); |
176 | * cb710_sg_miter_stop_writing(); | 153 | * sg_miter_stop(); |
177 | * | 154 | * |
178 | * Best-case writing (transfer to device): | 155 | * Best-case writing (transfer to device): |
179 | * sg_miter_start(); | 156 | * sg_miter_start(, SG_MITER_FROM_SG); |
180 | * cb710_sg_dwiter_read_to_io(); | 157 | * cb710_sg_dwiter_read_to_io(); |
181 | * sg_miter_stop(); | 158 | * sg_miter_stop(); |
182 | */ | 159 | */ |
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index e5996984ddd0..9aaf5bfdad1a 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -242,6 +242,8 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, | |||
242 | */ | 242 | */ |
243 | 243 | ||
244 | #define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */ | 244 | #define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */ |
245 | #define SG_MITER_TO_SG (1 << 1) /* flush back to phys on unmap */ | ||
246 | #define SG_MITER_FROM_SG (1 << 2) /* nop */ | ||
245 | 247 | ||
246 | struct sg_mapping_iter { | 248 | struct sg_mapping_iter { |
247 | /* the following three fields can be accessed directly */ | 249 | /* the following three fields can be accessed directly */ |
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index a295e404e908..0d475d8167bf 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c | |||
@@ -314,6 +314,7 @@ void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, | |||
314 | miter->__sg = sgl; | 314 | miter->__sg = sgl; |
315 | miter->__nents = nents; | 315 | miter->__nents = nents; |
316 | miter->__offset = 0; | 316 | miter->__offset = 0; |
317 | WARN_ON(!(flags & (SG_MITER_TO_SG | SG_MITER_FROM_SG))); | ||
317 | miter->__flags = flags; | 318 | miter->__flags = flags; |
318 | } | 319 | } |
319 | EXPORT_SYMBOL(sg_miter_start); | 320 | EXPORT_SYMBOL(sg_miter_start); |
@@ -394,6 +395,9 @@ void sg_miter_stop(struct sg_mapping_iter *miter) | |||
394 | if (miter->addr) { | 395 | if (miter->addr) { |
395 | miter->__offset += miter->consumed; | 396 | miter->__offset += miter->consumed; |
396 | 397 | ||
398 | if (miter->__flags & SG_MITER_TO_SG) | ||
399 | flush_kernel_dcache_page(miter->page); | ||
400 | |||
397 | if (miter->__flags & SG_MITER_ATOMIC) { | 401 | if (miter->__flags & SG_MITER_ATOMIC) { |
398 | WARN_ON(!irqs_disabled()); | 402 | WARN_ON(!irqs_disabled()); |
399 | kunmap_atomic(miter->addr, KM_BIO_SRC_IRQ); | 403 | kunmap_atomic(miter->addr, KM_BIO_SRC_IRQ); |
@@ -426,8 +430,14 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, | |||
426 | unsigned int offset = 0; | 430 | unsigned int offset = 0; |
427 | struct sg_mapping_iter miter; | 431 | struct sg_mapping_iter miter; |
428 | unsigned long flags; | 432 | unsigned long flags; |
433 | unsigned int sg_flags = SG_MITER_ATOMIC; | ||
434 | |||
435 | if (to_buffer) | ||
436 | sg_flags |= SG_MITER_FROM_SG; | ||
437 | else | ||
438 | sg_flags |= SG_MITER_TO_SG; | ||
429 | 439 | ||
430 | sg_miter_start(&miter, sgl, nents, SG_MITER_ATOMIC); | 440 | sg_miter_start(&miter, sgl, nents, sg_flags); |
431 | 441 | ||
432 | local_irq_save(flags); | 442 | local_irq_save(flags); |
433 | 443 | ||
@@ -438,10 +448,8 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, | |||
438 | 448 | ||
439 | if (to_buffer) | 449 | if (to_buffer) |
440 | memcpy(buf + offset, miter.addr, len); | 450 | memcpy(buf + offset, miter.addr, len); |
441 | else { | 451 | else |
442 | memcpy(miter.addr, buf + offset, len); | 452 | memcpy(miter.addr, buf + offset, len); |
443 | flush_kernel_dcache_page(miter.page); | ||
444 | } | ||
445 | 453 | ||
446 | offset += len; | 454 | offset += len; |
447 | } | 455 | } |