Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: lpc32xx_slc: Make driver independent of AMBA DMA engine driver

This patch makes the SLC NAND driver independent of the single AMBA DMA engine
driver by using the platform data provided dma_filter callback.

Signed-off-by: Roland Stigge <stigge@antcom.de>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Roland Stigge and committed by
David Woodhouse
de20c22d af69dcd3

+31 -2
+11 -2
drivers/mtd/nand/lpc32xx_slc.c
··· 37 37 #include <linux/of.h> 38 38 #include <linux/of_mtd.h> 39 39 #include <linux/of_gpio.h> 40 - #include <linux/amba/pl08x.h> 40 + #include <linux/mtd/lpc32xx_slc.h> 41 41 42 42 #define LPC32XX_MODNAME "lpc32xx-nand" 43 43 ··· 199 199 200 200 struct lpc32xx_nand_host { 201 201 struct nand_chip nand_chip; 202 + struct lpc32xx_slc_platform_data *pdata; 202 203 struct clk *clk; 203 204 struct mtd_info mtd; 204 205 void __iomem *io_base; ··· 720 719 struct mtd_info *mtd = &host->mtd; 721 720 dma_cap_mask_t mask; 722 721 722 + if (!host->pdata || !host->pdata->dma_filter) { 723 + dev_err(mtd->dev.parent, "no DMA platform data\n"); 724 + return -ENOENT; 725 + } 726 + 723 727 dma_cap_zero(mask); 724 728 dma_cap_set(DMA_SLAVE, mask); 725 - host->dma_chan = dma_request_channel(mask, pl08x_filter_id, "nand-slc"); 729 + host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, 730 + "nand-slc"); 726 731 if (!host->dma_chan) { 727 732 dev_err(mtd->dev.parent, "Failed to request DMA channel\n"); 728 733 return -EBUSY; ··· 825 818 return -EBUSY; 826 819 } 827 820 lpc32xx_wp_disable(host); 821 + 822 + host->pdata = pdev->dev.platform_data; 828 823 829 824 mtd = &host->mtd; 830 825 chip = &host->nand_chip;
+20
include/linux/mtd/lpc32xx_slc.h
··· 1 + /* 2 + * Platform data for LPC32xx SoC SLC NAND controller 3 + * 4 + * Copyright © 2012 Roland Stigge 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + 11 + #ifndef __LINUX_MTD_LPC32XX_SLC_H 12 + #define __LINUX_MTD_LPC32XX_SLC_H 13 + 14 + #include <linux/dmaengine.h> 15 + 16 + struct lpc32xx_slc_platform_data { 17 + bool (*dma_filter)(struct dma_chan *chan, void *filter_param); 18 + }; 19 + 20 + #endif /* __LINUX_MTD_LPC32XX_SLC_H */