Skip to content

Commit 4782118

Browse files
pwojtaszczyk-tsmiquelraynal
authored andcommitted
mtd: rawnand: lpx32xx: Request DMA channels using DT entries
Move away from pl08x platform data towards device tree. Signed-off-by: Piotr Wojtaszczyk <piotr.wojtaszczyk@timesys.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/linux-mtd/20240627150046.258795-11-piotr.wojtaszczyk@timesys.com
1 parent 14427d4 commit 4782118

File tree

2 files changed

+30
-22
lines changed

2 files changed

+30
-22
lines changed

drivers/mtd/nand/raw/lpc32xx_mlc.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -574,18 +574,22 @@ static int lpc32xx_dma_setup(struct lpc32xx_nand_host *host)
574574
struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
575575
dma_cap_mask_t mask;
576576

577-
if (!host->pdata || !host->pdata->dma_filter) {
578-
dev_err(mtd->dev.parent, "no DMA platform data\n");
579-
return -ENOENT;
580-
}
581-
582-
dma_cap_zero(mask);
583-
dma_cap_set(DMA_SLAVE, mask);
584-
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
585-
"nand-mlc");
577+
host->dma_chan = dma_request_chan(mtd->dev.parent, "rx-tx");
586578
if (!host->dma_chan) {
587-
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
588-
return -EBUSY;
579+
/* fallback to request using platform data */
580+
if (!host->pdata || !host->pdata->dma_filter) {
581+
dev_err(mtd->dev.parent, "no DMA platform data\n");
582+
return -ENOENT;
583+
}
584+
585+
dma_cap_zero(mask);
586+
dma_cap_set(DMA_SLAVE, mask);
587+
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, "nand-mlc");
588+
589+
if (!host->dma_chan) {
590+
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
591+
return -EBUSY;
592+
}
589593
}
590594

591595
/*

drivers/mtd/nand/raw/lpc32xx_slc.c

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -721,18 +721,22 @@ static int lpc32xx_nand_dma_setup(struct lpc32xx_nand_host *host)
721721
struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
722722
dma_cap_mask_t mask;
723723

724-
if (!host->pdata || !host->pdata->dma_filter) {
725-
dev_err(mtd->dev.parent, "no DMA platform data\n");
726-
return -ENOENT;
727-
}
728-
729-
dma_cap_zero(mask);
730-
dma_cap_set(DMA_SLAVE, mask);
731-
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter,
732-
"nand-slc");
724+
host->dma_chan = dma_request_chan(mtd->dev.parent, "rx-tx");
733725
if (!host->dma_chan) {
734-
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
735-
return -EBUSY;
726+
/* fallback to request using platform data */
727+
if (!host->pdata || !host->pdata->dma_filter) {
728+
dev_err(mtd->dev.parent, "no DMA platform data\n");
729+
return -ENOENT;
730+
}
731+
732+
dma_cap_zero(mask);
733+
dma_cap_set(DMA_SLAVE, mask);
734+
host->dma_chan = dma_request_channel(mask, host->pdata->dma_filter, "nand-slc");
735+
736+
if (!host->dma_chan) {
737+
dev_err(mtd->dev.parent, "Failed to request DMA channel\n");
738+
return -EBUSY;
739+
}
736740
}
737741

738742
return 0;

0 commit comments

Comments
 (0)