]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/mtd/nand/tango_nand.c
mtd: nand: Pass the CS line to ->setup_data_interface()
[karo-tx-linux.git] / drivers / mtd / nand / tango_nand.c
index 4a5e948c62df1b7d29ff9fe78b50e7d0858b01d5..85e0d97593e84fd34ba75df6ed46d98fa04f8321 100644 (file)
@@ -223,12 +223,13 @@ static void tango_dma_callback(void *arg)
        complete(arg);
 }
 
-static int do_dma(struct tango_nfc *nfc, int dir, int cmd, const void *buf,
-                 int len, int page)
+static int do_dma(struct tango_nfc *nfc, enum dma_data_direction dir, int cmd,
+                 const void *buf, int len, int page)
 {
        void __iomem *addr = nfc->reg_base + NFC_STATUS;
        struct dma_chan *chan = nfc->chan;
        struct dma_async_tx_descriptor *desc;
+       enum dma_transfer_direction tdir;
        struct scatterlist sg;
        struct completion tx_done;
        int err = -EIO;
@@ -238,7 +239,8 @@ static int do_dma(struct tango_nfc *nfc, int dir, int cmd, const void *buf,
        if (dma_map_sg(chan->device->dev, &sg, 1, dir) != 1)
                return -EIO;
 
-       desc = dmaengine_prep_slave_sg(chan, &sg, 1, dir, DMA_PREP_INTERRUPT);
+       tdir = dir == DMA_TO_DEVICE ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
+       desc = dmaengine_prep_slave_sg(chan, &sg, 1, tdir, DMA_PREP_INTERRUPT);
        if (!desc)
                goto dma_unmap;
 
@@ -474,9 +476,8 @@ static u32 to_ticks(int kHz, int ps)
        return DIV_ROUND_UP_ULL((u64)kHz * ps, NSEC_PER_SEC);
 }
 
-static int tango_set_timings(struct mtd_info *mtd,
-                            const struct nand_data_interface *conf,
-                            bool check_only)
+static int tango_set_timings(struct mtd_info *mtd, int csline,
+                            const struct nand_data_interface *conf)
 {
        const struct nand_sdr_timings *sdr = nand_get_sdr_timings(conf);
        struct nand_chip *chip = mtd_to_nand(mtd);
@@ -488,7 +489,7 @@ static int tango_set_timings(struct mtd_info *mtd,
        if (IS_ERR(sdr))
                return PTR_ERR(sdr);
 
-       if (check_only)
+       if (csline == NAND_DATA_IFACE_CHECK_ONLY)
                return 0;
 
        Trdy = to_ticks(kHz, sdr->tCEA_max - sdr->tREA_max);