lkml.org 
[lkml]   [2019]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 1/2] mtd: mtk-quadspi: add support for memory-mapped flash reading
Hi!

On Thu, Nov 7, 2019 at 2:05 PM Vignesh Raghavendra <vigneshr@ti.com> 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

\
 
 \ /
  Last update: 2019-11-07 10:32    [W:0.090 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site