aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Frysinger <vapier.adi@gmail.com>2009-03-04 15:01:29 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2009-03-20 08:16:24 -0400
commit08d2503ecc2337275942c1f52822b7a464c0c0a3 (patch)
treef4a27a18a92ca62117cb1b6ba492888899796602
parent65c24491b4fef017c64e39ec64384fde5e05e0a0 (diff)
[MTD] [NAND] Blackfin NFC Driver: do not clobber DMAC1_PERIMUX
Only set DMAC1_PERIMUX once we have requested and been granted the dma channel to prevent breaking other peripherals in the error case Signed-off-by: Mike Frysinger <vapier.adi@gmail.com> Signed-off-by: Bryan Wu <cooloney@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/nand/bf5xx_nand.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 9af2a2cc1153..5c6056e02426 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -552,7 +552,6 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd,
552static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info) 552static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
553{ 553{
554 int ret; 554 int ret;
555 unsigned short val;
556 555
557 /* Do not use dma */ 556 /* Do not use dma */
558 if (!hardware_ecc) 557 if (!hardware_ecc)
@@ -560,13 +559,6 @@ static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
560 559
561 init_completion(&info->dma_completion); 560 init_completion(&info->dma_completion);
562 561
563#ifdef CONFIG_BF54x
564 /* Setup DMAC1 channel mux for NFC which shared with SDH */
565 val = bfin_read_DMAC1_PERIMUX();
566 val &= 0xFFFE;
567 bfin_write_DMAC1_PERIMUX(val);
568 SSYNC();
569#endif
570 /* Request NFC DMA channel */ 562 /* Request NFC DMA channel */
571 ret = request_dma(CH_NFC, "BF5XX NFC driver"); 563 ret = request_dma(CH_NFC, "BF5XX NFC driver");
572 if (ret < 0) { 564 if (ret < 0) {
@@ -574,6 +566,12 @@ static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
574 return ret; 566 return ret;
575 } 567 }
576 568
569#ifdef CONFIG_BF54x
570 /* Setup DMAC1 channel mux for NFC which shared with SDH */
571 bfin_write_DMAC1_PERIMUX(bfin_read_DMAC1_PERIMUX() & ~1);
572 SSYNC();
573#endif
574
577 set_dma_callback(CH_NFC, (void *) bf5xx_nand_dma_irq, (void *) info); 575 set_dma_callback(CH_NFC, (void *) bf5xx_nand_dma_irq, (void *) info);
578 576
579 /* Turn off the DMA channel first */ 577 /* Turn off the DMA channel first */