]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
mmc: dw_mmc: Add fifo watermark alignment property
authorJun Nie <jun.nie@linaro.org>
Wed, 11 Jan 2017 06:37:26 +0000 (15:37 +0900)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 13 Feb 2017 12:20:02 +0000 (13:20 +0100)
Data done irq is expected if data length is less than
watermark in PIO mode. But fifo watermark is requested
to be aligned with data length in some SoC so that TX/RX
irq can be generated with data done irq. Add the
watermark alignment to mark this requirement and force
fifo watermark setting accordingly.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h

index 94d8fe32126013281e1a0901b549cf550734952a..c04a5769e2ead5b436466f7a4aa4780ef98a010f 100644 (file)
@@ -1112,11 +1112,15 @@ static void dw_mci_submit_data(struct dw_mci *host, struct mmc_data *data)
                mci_writel(host, CTRL, temp);
 
                /*
-                * Use the initial fifoth_val for PIO mode.
+                * Use the initial fifoth_val for PIO mode. If wm_algined
+                * is set, we set watermark same as data size.
                 * If next issued data may be transfered by DMA mode,
                 * prev_blksz should be invalidated.
                 */
-               mci_writel(host, FIFOTH, host->fifoth_val);
+               if (host->wm_aligned)
+                       dw_mci_adjust_fifoth(host, data);
+               else
+                       mci_writel(host, FIFOTH, host->fifoth_val);
                host->prev_blksz = 0;
        } else {
                /*
@@ -2978,6 +2982,9 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host)
 
        of_property_read_u32(np, "data-addr", &host->data_addr_override);
 
+       if (of_get_property(np, "fifo-watermark-aligned", NULL))
+               host->wm_aligned = true;
+
        if (!of_property_read_u32(np, "clock-frequency", &clock_frequency))
                pdata->bus_hz = clock_frequency;
 
index e08e3272a5ad82a110ba5dcc0bc7e0b9ec8ae504..ce347361f3dcb435e7bd5b9dccf06319b4a8d18a 100644 (file)
@@ -115,6 +115,8 @@ struct dw_mci_dma_slave {
  * @slot: Slots sharing this MMC controller.
  * @fifo_depth: depth of FIFO.
  * @data_addr_override: override fifo reg offset with this value.
+ * @wm_aligned: force fifo watermark equal with data length in PIO mode.
+ *     Set as true if alignment is needed.
  * @data_shift: log2 of FIFO item size.
  * @part_buf_start: Start index in part_buf.
  * @part_buf_count: Bytes of partial data in part_buf.
@@ -163,6 +165,7 @@ struct dw_mci {
        void __iomem            *regs;
        void __iomem            *fifo_reg;
        u32                     data_addr_override;
+       bool                    wm_aligned;
 
        struct scatterlist      *sg;
        struct sg_mapping_iter  sg_miter;