Hi! On Thu, Nov 7, 2019 at 2:05 PM Vignesh Raghavendra <vigneshr@xxxxxx> wrote: > > @@ -272,6 +273,11 @@ static ssize_t mtk_nor_read(struct spi_nor *nor, loff_t from, size_t length, > > mtk_nor_set_read_mode(mtk_nor); > > mtk_nor_set_addr(mtk_nor, addr); > > > > + if (mtk_nor->flash_base) { > > + memcpy_fromio(buffer, mtk_nor->flash_base + from, length); > > + return length; > > + } > > + > > Don't you need to check if access is still within valid memory mapped > window? The mapped area is 256MB and I don't quite believe there will be such a big NOR flash. I'll add a check here in the next version. > > > for (i = 0; i < length; i++) { > > ret = mtk_nor_execute_cmd(mtk_nor, MTK_NOR_PIO_READ_CMD); > > if (ret < 0) > > @@ -475,6 +481,11 @@ static int mtk_nor_drv_probe(struct platform_device *pdev) > > if (IS_ERR(mtk_nor->base)) > > return PTR_ERR(mtk_nor->base); > > > > + res = platform_get_resource(pdev, IORESOURCE_MEM, 1); > > + mtk_nor->flash_base = devm_ioremap_resource(&pdev->dev, res); > > There is a single API now: devm_platform_ioremap_resource(). Cool. I'll change it. Should I add another patch to change the same mapping operation right above this piece of code? Regards, Chuanhong Guo