Skip to content

Commit cb27239

Browse files
Sivaprakash Murugesanmiquelraynal
authored andcommitted
mtd: rawnand: qcom: set BAM mode only if not set already
BAM is DMA controller on QCOM ipq platforms, BAM mode on NAND driver is set by writing BAM_MODE_EN bit on NAND_CTRL register. NAND_CTRL is an operational register and in BAM mode operational registers are read only. So, before enabling BAM mode by writing the NAND_CTRL register, check if BAM mode was already enabled by the bootloader, and enable BAM mode only if it is not enabled already. Signed-off-by: Sivaprakash Murugesan <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent 443440c commit cb27239

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/mtd/nand/raw/qcom_nandc.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2784,7 +2784,16 @@ static int qcom_nandc_setup(struct qcom_nand_controller *nandc)
27842784
/* enable ADM or BAM DMA */
27852785
if (nandc->props->is_bam) {
27862786
nand_ctrl = nandc_read(nandc, NAND_CTRL);
2787-
nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
2787+
2788+
/*
2789+
*NAND_CTRL is an operational registers, and CPU
2790+
* access to operational registers are read only
2791+
* in BAM mode. So update the NAND_CTRL register
2792+
* only if it is not in BAM mode. In most cases BAM
2793+
* mode will be enabled in bootloader
2794+
*/
2795+
if (!(nand_ctrl & BAM_MODE_EN))
2796+
nandc_write(nandc, NAND_CTRL, nand_ctrl | BAM_MODE_EN);
27882797
} else {
27892798
nandc_write(nandc, NAND_FLASH_CHIP_SELECT, DM_EN);
27902799
}

0 commit comments

Comments
 (0)