[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJsYDVJgUNxLhcO9iLKwRZHPQ9FT8XuKQq8ru_djD2nryT5o9A@mail.gmail.com>
Date: Thu, 7 Nov 2019 17:31:35 +0800
From: Chuanhong Guo <gch981213@...il.com>
To: Vignesh Raghavendra <vigneshr@...com>
Cc: linux-mtd@...ts.infradead.org,
David Woodhouse <dwmw2@...radead.org>,
Brian Norris <computersforpeace@...il.com>,
Miquel Raynal <miquel.raynal@...tlin.com>,
Richard Weinberger <richard@....at>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Matthias Brugger <matthias.bgg@...il.com>,
Tudor Ambarus <tudor.ambarus@...rochip.com>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [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@...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
Powered by blists - more mailing lists