Commit d27d4e2a authored by Linus Torvalds's avatar Linus Torvalds

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
parents dbe63a2c 3822a0e3
...@@ -3420,8 +3420,7 @@ S: Supported ...@@ -3420,8 +3420,7 @@ S: Supported
F: drivers/mfd/ F: drivers/mfd/
MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM MULTIMEDIA CARD (MMC), SECURE DIGITAL (SD) AND SDIO SUBSYSTEM
M: Pierre Ossman <pierre@ossman.eu> S: Orphan
S: Maintained
F: drivers/mmc/ F: drivers/mmc/
F: include/linux/mmc/ F: include/linux/mmc/
......
...@@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data) ...@@ -114,7 +114,6 @@ static void sg_dwiter_write_slow(struct sg_mapping_iter *miter, uint32_t data)
if (!left) if (!left)
return; return;
addr += len; addr += len;
flush_kernel_dcache_page(miter->page);
} while (sg_dwiter_next(miter)); } while (sg_dwiter_next(miter));
} }
...@@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da ...@@ -142,9 +141,6 @@ void cb710_sg_dwiter_write_next_block(struct sg_mapping_iter *miter, uint32_t da
return; return;
} else } else
sg_dwiter_write_slow(miter, data); sg_dwiter_write_slow(miter, data);
if (miter->length == miter->consumed)
flush_kernel_dcache_page(miter->page);
} }
EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block); EXPORT_SYMBOL_GPL(cb710_sg_dwiter_write_next_block);
...@@ -278,7 +278,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data) ...@@ -278,7 +278,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data)
if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8))) if (unlikely(data->blksz & 15 && (data->blocks != 1 || data->blksz != 8)))
return -EINVAL; return -EINVAL;
sg_miter_start(&miter, data->sg, data->sg_len, 0); sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_TO_SG);
cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT,
15, CB710_MMC_C2_READ_PIO_SIZE_MASK); 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,7 +307,7 @@ static int cb710_mmc_receive(struct cb710_slot *slot, struct mmc_data *data)
goto out; goto out;
} }
out: out:
cb710_sg_miter_stop_writing(&miter); sg_miter_stop(&miter);
return err; return err;
} }
...@@ -322,7 +322,7 @@ static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data) ...@@ -322,7 +322,7 @@ static int cb710_mmc_send(struct cb710_slot *slot, struct mmc_data *data)
if (unlikely(data->blocks > 1 && data->blksz & 15)) if (unlikely(data->blocks > 1 && data->blksz & 15))
return -EINVAL; return -EINVAL;
sg_miter_start(&miter, data->sg, data->sg_len, 0); sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_FROM_SG);
cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT, cb710_modify_port_8(slot, CB710_MMC_CONFIG2_PORT,
0, CB710_MMC_C2_READ_PIO_SIZE_MASK); 0, CB710_MMC_C2_READ_PIO_SIZE_MASK);
......
...@@ -652,7 +652,7 @@ static irqreturn_t imxmci_irq(int irq, void *devid) ...@@ -652,7 +652,7 @@ static irqreturn_t imxmci_irq(int irq, void *devid)
set_bit(IMXMCI_PEND_STARTED_b, &host->pending_events); set_bit(IMXMCI_PEND_STARTED_b, &host->pending_events);
tasklet_schedule(&host->tasklet); tasklet_schedule(&host->tasklet);
return IRQ_RETVAL(handled);; return IRQ_RETVAL(handled);
} }
static void imxmci_tasklet_fnc(unsigned long data) static void imxmci_tasklet_fnc(unsigned long data)
......
...@@ -773,8 +773,14 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) ...@@ -773,8 +773,14 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
} }
if (!(host->flags & SDHCI_REQ_USE_DMA)) { if (!(host->flags & SDHCI_REQ_USE_DMA)) {
sg_miter_start(&host->sg_miter, int flags;
data->sg, data->sg_len, SG_MITER_ATOMIC);
flags = SG_MITER_ATOMIC;
if (host->data->flags & MMC_DATA_READ)
flags |= SG_MITER_TO_SG;
else
flags |= SG_MITER_FROM_SG;
sg_miter_start(&host->sg_miter, data->sg, data->sg_len, flags);
host->blocks = data->blocks; host->blocks = data->blocks;
} }
......
...@@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump); ...@@ -140,29 +140,6 @@ void cb710_dump_regs(struct cb710_chip *chip, unsigned dump);
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/scatterlist.h> #include <linux/scatterlist.h>
/**
* cb710_sg_miter_stop_writing - stop mapping iteration after writing
* @miter: sg mapping iter to be stopped
*
* Description:
* Stops mapping iterator @miter. @miter should have been started
* started using sg_miter_start(). A stopped iteration can be
* resumed by calling sg_miter_next() on it. This is useful when
* resources (kmap) need to be released during iteration.
*
* This is a convenience wrapper that will be optimized out for arches
* that don't need flush_kernel_dcache_page().
*
* Context:
* IRQ disabled if the SG_MITER_ATOMIC is set. Don't care otherwise.
*/
static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
{
if (miter->page)
flush_kernel_dcache_page(miter->page);
sg_miter_stop(miter);
}
/* /*
* 32-bit PIO mapping sg iterator * 32-bit PIO mapping sg iterator
* *
...@@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter) ...@@ -171,12 +148,12 @@ static inline void cb710_sg_miter_stop_writing(struct sg_mapping_iter *miter)
* without DMA support). * without DMA support).
* *
* Best-case reading (transfer from device): * Best-case reading (transfer from device):
* sg_miter_start(); * sg_miter_start(, SG_MITER_TO_SG);
* cb710_sg_dwiter_write_from_io(); * cb710_sg_dwiter_write_from_io();
* cb710_sg_miter_stop_writing(); * sg_miter_stop();
* *
* Best-case writing (transfer to device): * Best-case writing (transfer to device):
* sg_miter_start(); * sg_miter_start(, SG_MITER_FROM_SG);
* cb710_sg_dwiter_read_to_io(); * cb710_sg_dwiter_read_to_io();
* sg_miter_stop(); * sg_miter_stop();
*/ */
......
...@@ -242,6 +242,8 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, ...@@ -242,6 +242,8 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents,
*/ */
#define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */ #define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */
#define SG_MITER_TO_SG (1 << 1) /* flush back to phys on unmap */
#define SG_MITER_FROM_SG (1 << 2) /* nop */
struct sg_mapping_iter { struct sg_mapping_iter {
/* the following three fields can be accessed directly */ /* the following three fields can be accessed directly */
......
...@@ -314,6 +314,7 @@ void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, ...@@ -314,6 +314,7 @@ void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl,
miter->__sg = sgl; miter->__sg = sgl;
miter->__nents = nents; miter->__nents = nents;
miter->__offset = 0; miter->__offset = 0;
WARN_ON(!(flags & (SG_MITER_TO_SG | SG_MITER_FROM_SG)));
miter->__flags = flags; miter->__flags = flags;
} }
EXPORT_SYMBOL(sg_miter_start); EXPORT_SYMBOL(sg_miter_start);
...@@ -394,6 +395,9 @@ void sg_miter_stop(struct sg_mapping_iter *miter) ...@@ -394,6 +395,9 @@ void sg_miter_stop(struct sg_mapping_iter *miter)
if (miter->addr) { if (miter->addr) {
miter->__offset += miter->consumed; miter->__offset += miter->consumed;
if (miter->__flags & SG_MITER_TO_SG)
flush_kernel_dcache_page(miter->page);
if (miter->__flags & SG_MITER_ATOMIC) { if (miter->__flags & SG_MITER_ATOMIC) {
WARN_ON(!irqs_disabled()); WARN_ON(!irqs_disabled());
kunmap_atomic(miter->addr, KM_BIO_SRC_IRQ); 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,8 +430,14 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents,
unsigned int offset = 0; unsigned int offset = 0;
struct sg_mapping_iter miter; struct sg_mapping_iter miter;
unsigned long flags; unsigned long flags;
unsigned int sg_flags = SG_MITER_ATOMIC;
if (to_buffer)
sg_flags |= SG_MITER_FROM_SG;
else
sg_flags |= SG_MITER_TO_SG;
sg_miter_start(&miter, sgl, nents, SG_MITER_ATOMIC); sg_miter_start(&miter, sgl, nents, sg_flags);
local_irq_save(flags); local_irq_save(flags);
...@@ -438,10 +448,8 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents, ...@@ -438,10 +448,8 @@ static size_t sg_copy_buffer(struct scatterlist *sgl, unsigned int nents,
if (to_buffer) if (to_buffer)
memcpy(buf + offset, miter.addr, len); memcpy(buf + offset, miter.addr, len);
else { else
memcpy(miter.addr, buf + offset, len); memcpy(miter.addr, buf + offset, len);
flush_kernel_dcache_page(miter.page);
}
offset += len; offset += len;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment