Commit ce8148d7 authored by Miquel Raynal's avatar Miquel Raynal

mtd: rawnand: Rename a NAND chip option

NAND controller drivers can set the NAND_USE_BOUNCE_BUFFER flag to a
chip 'option' field. With this flag, the core is responsible of
providing DMA-able buffers.

The current behavior is to not force the use of a bounce buffer when
the core thinks this is not needed. So in the end the name is a bit
misleading, because in theory we will always have a DMA buffer but in
practice it will not always be a bounce buffer.

Rename this flag NAND_USES_DMA to be more accurate.
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@collabora.com>
Link: https://lore.kernel.org/linux-mtd/20200507105241.14299-4-miquel.raynal@bootlin.com
parent 96d627bd
...@@ -1494,7 +1494,7 @@ static void atmel_nand_init(struct atmel_nand_controller *nc, ...@@ -1494,7 +1494,7 @@ static void atmel_nand_init(struct atmel_nand_controller *nc,
* suitable for DMA. * suitable for DMA.
*/ */
if (nc->dmac) if (nc->dmac)
chip->options |= NAND_USE_BOUNCE_BUFFER; chip->options |= NAND_USES_DMA;
/* Default to HW ECC if pmecc is available. */ /* Default to HW ECC if pmecc is available. */
if (nc->pmecc) if (nc->pmecc)
......
...@@ -2576,7 +2576,7 @@ static int brcmnand_attach_chip(struct nand_chip *chip) ...@@ -2576,7 +2576,7 @@ static int brcmnand_attach_chip(struct nand_chip *chip)
* to/from, and have nand_base pass us a bounce buffer instead, as * to/from, and have nand_base pass us a bounce buffer instead, as
* needed. * needed.
*/ */
chip->options |= NAND_USE_BOUNCE_BUFFER; chip->options |= NAND_USES_DMA;
if (chip->bbt_options & NAND_BBT_USE_FLASH) if (chip->bbt_options & NAND_BBT_USE_FLASH)
chip->bbt_options |= NAND_BBT_NO_OOB; chip->bbt_options |= NAND_BBT_NO_OOB;
......
...@@ -1226,7 +1226,7 @@ int denali_chip_init(struct denali_controller *denali, ...@@ -1226,7 +1226,7 @@ int denali_chip_init(struct denali_controller *denali,
mtd->name = "denali-nand"; mtd->name = "denali-nand";
if (denali->dma_avail) { if (denali->dma_avail) {
chip->options |= NAND_USE_BOUNCE_BUFFER; chip->options |= NAND_USES_DMA;
chip->buf_align = 16; chip->buf_align = 16;
} }
......
...@@ -1269,7 +1269,7 @@ meson_nfc_nand_chip_init(struct device *dev, ...@@ -1269,7 +1269,7 @@ meson_nfc_nand_chip_init(struct device *dev,
nand_set_flash_node(nand, np); nand_set_flash_node(nand, np);
nand_set_controller_data(nand, nfc); nand_set_controller_data(nand, nfc);
nand->options |= NAND_USE_BOUNCE_BUFFER; nand->options |= NAND_USES_DMA;
mtd = nand_to_mtd(nand); mtd = nand_to_mtd(nand);
mtd->owner = THIS_MODULE; mtd->owner = THIS_MODULE;
mtd->dev.parent = dev; mtd->dev.parent = dev;
......
...@@ -1380,7 +1380,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc, ...@@ -1380,7 +1380,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
nand_set_flash_node(nand, np); nand_set_flash_node(nand, np);
nand_set_controller_data(nand, nfc); nand_set_controller_data(nand, nfc);
nand->options |= NAND_USE_BOUNCE_BUFFER | NAND_SUBPAGE_READ; nand->options |= NAND_USES_DMA | NAND_SUBPAGE_READ;
nand->legacy.dev_ready = mtk_nfc_dev_ready; nand->legacy.dev_ready = mtk_nfc_dev_ready;
nand->legacy.select_chip = mtk_nfc_select_chip; nand->legacy.select_chip = mtk_nfc_select_chip;
nand->legacy.write_byte = mtk_nfc_write_byte; nand->legacy.write_byte = mtk_nfc_write_byte;
......
...@@ -3241,7 +3241,7 @@ static int nand_do_read_ops(struct nand_chip *chip, loff_t from, ...@@ -3241,7 +3241,7 @@ static int nand_do_read_ops(struct nand_chip *chip, loff_t from,
if (!aligned) if (!aligned)
use_bufpoi = 1; use_bufpoi = 1;
else if (chip->options & NAND_USE_BOUNCE_BUFFER) else if (chip->options & NAND_USES_DMA)
use_bufpoi = !virt_addr_valid(buf) || use_bufpoi = !virt_addr_valid(buf) ||
!IS_ALIGNED((unsigned long)buf, !IS_ALIGNED((unsigned long)buf,
chip->buf_align); chip->buf_align);
...@@ -4067,7 +4067,7 @@ static int nand_do_write_ops(struct nand_chip *chip, loff_t to, ...@@ -4067,7 +4067,7 @@ static int nand_do_write_ops(struct nand_chip *chip, loff_t to,
if (part_pagewr) if (part_pagewr)
use_bufpoi = 1; use_bufpoi = 1;
else if (chip->options & NAND_USE_BOUNCE_BUFFER) else if (chip->options & NAND_USES_DMA)
use_bufpoi = !virt_addr_valid(buf) || use_bufpoi = !virt_addr_valid(buf) ||
!IS_ALIGNED((unsigned long)buf, !IS_ALIGNED((unsigned long)buf,
chip->buf_align); chip->buf_align);
......
...@@ -2836,7 +2836,7 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc, ...@@ -2836,7 +2836,7 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc,
chip->legacy.block_markbad = qcom_nandc_block_markbad; chip->legacy.block_markbad = qcom_nandc_block_markbad;
chip->controller = &nandc->controller; chip->controller = &nandc->controller;
chip->options |= NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER | chip->options |= NAND_NO_SUBPAGE_WRITE | NAND_USES_DMA |
NAND_SKIP_BBTSCAN; NAND_SKIP_BBTSCAN;
/* set up initial status value */ /* set up initial status value */
......
...@@ -1987,7 +1987,7 @@ static int stm32_fmc2_probe(struct platform_device *pdev) ...@@ -1987,7 +1987,7 @@ static int stm32_fmc2_probe(struct platform_device *pdev)
chip->controller = &fmc2->base; chip->controller = &fmc2->base;
chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE | chip->options |= NAND_BUSWIDTH_AUTO | NAND_NO_SUBPAGE_WRITE |
NAND_USE_BOUNCE_BUFFER; NAND_USES_DMA;
/* Default ECC settings */ /* Default ECC settings */
chip->ecc.mode = NAND_ECC_HW; chip->ecc.mode = NAND_ECC_HW;
......
...@@ -1698,7 +1698,7 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand, ...@@ -1698,7 +1698,7 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
ecc->read_page = sunxi_nfc_hw_ecc_read_page_dma; ecc->read_page = sunxi_nfc_hw_ecc_read_page_dma;
ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage_dma; ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage_dma;
ecc->write_page = sunxi_nfc_hw_ecc_write_page_dma; ecc->write_page = sunxi_nfc_hw_ecc_write_page_dma;
nand->options |= NAND_USE_BOUNCE_BUFFER; nand->options |= NAND_USES_DMA;
} else { } else {
ecc->read_page = sunxi_nfc_hw_ecc_read_page; ecc->read_page = sunxi_nfc_hw_ecc_read_page;
ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage; ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage;
......
...@@ -568,7 +568,7 @@ static int chip_init(struct device *dev, struct device_node *np) ...@@ -568,7 +568,7 @@ static int chip_init(struct device *dev, struct device_node *np)
chip->legacy.select_chip = tango_select_chip; chip->legacy.select_chip = tango_select_chip;
chip->legacy.cmd_ctrl = tango_cmd_ctrl; chip->legacy.cmd_ctrl = tango_cmd_ctrl;
chip->legacy.dev_ready = tango_dev_ready; chip->legacy.dev_ready = tango_dev_ready;
chip->options = NAND_USE_BOUNCE_BUFFER | chip->options = NAND_USES_DMA |
NAND_NO_SUBPAGE_WRITE | NAND_NO_SUBPAGE_WRITE |
NAND_WAIT_TCCS; NAND_WAIT_TCCS;
chip->controller = &nfc->hw; chip->controller = &nfc->hw;
......
...@@ -1115,7 +1115,7 @@ static int tegra_nand_chips_init(struct device *dev, ...@@ -1115,7 +1115,7 @@ static int tegra_nand_chips_init(struct device *dev,
if (!mtd->name) if (!mtd->name)
mtd->name = "tegra_nand"; mtd->name = "tegra_nand";
chip->options = NAND_NO_SUBPAGE_WRITE | NAND_USE_BOUNCE_BUFFER; chip->options = NAND_NO_SUBPAGE_WRITE | NAND_USES_DMA;
ret = nand_scan(chip, 1); ret = nand_scan(chip, 1);
if (ret) if (ret)
......
...@@ -185,7 +185,7 @@ enum nand_ecc_algo { ...@@ -185,7 +185,7 @@ enum nand_ecc_algo {
* This option could be defined by controller drivers to protect against * This option could be defined by controller drivers to protect against
* kmap'ed, vmalloc'ed highmem buffers being passed from upper layers * kmap'ed, vmalloc'ed highmem buffers being passed from upper layers
*/ */
#define NAND_USE_BOUNCE_BUFFER BIT(20) #define NAND_USES_DMA BIT(20)
/* /*
* In case your controller is implementing ->legacy.cmd_ctrl() and is relying * In case your controller is implementing ->legacy.cmd_ctrl() and is relying
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment