[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <efd471a6-daad-a191-5528-62313dd4e4a4@ti.com>
Date: Thu, 7 Nov 2019 17:55:40 +0530
From: Vignesh Raghavendra <vigneshr@...com>
To: Chuanhong Guo <gch981213@...il.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
On 07/11/19 3:01 PM, Chuanhong Guo wrote:
> 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.
>
There are 256MB (2GiB) NORs out there in market already. So, pretty
soon, 256MB window won't be big enough :)
>>
>>> 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?
>
That would be nice to do too, please send a separate patch.
--
Regards
Vignesh
Powered by blists - more mailing lists