[PATCH v2] MTD: lantiq: handle NO_XIP on cfi0001 flash
John Crispin
john at phrozen.org
Mon Jun 6 22:15:42 PDT 2016
On 06/06/2016 23:54, Jonas Gorski wrote:
> On 6 June 2016 at 23:38, Hauke Mehrtens <hauke at hauke-m.de> wrote:
>> On 06/06/2016 11:10 PM, Jonas Gorski wrote:
>>> Hi,
>>>
>>> On 6 June 2016 at 22:35, Hauke Mehrtens <hauke at hauke-m.de> wrote:
>>>> From: John Crispin <john at phrozen.org>
>>>>
>>>> This uses the same device tree attribute as physmap_of.c
>>>>
>>>> Signed-off-by: John Crispin <john at phrozen.org>
>>>> Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
>>>> ---
>>>> drivers/mtd/maps/lantiq-flash.c | 6 +++++-
>>>> 1 file changed, 5 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
>>>> index c8febb3..88fc6d9 100644
>>>> --- a/drivers/mtd/maps/lantiq-flash.c
>>>> +++ b/drivers/mtd/maps/lantiq-flash.c
>>>> @@ -137,7 +137,11 @@ ltq_mtd_probe(struct platform_device *pdev)
>>>> if (!ltq_mtd->map)
>>>> return -ENOMEM;
>>>>
>>>> - ltq_mtd->map->phys = ltq_mtd->res->start;
>>>> + if (of_find_property(pdev->dev.of_node, "no-unaligned-direct-access",
>>>> + NULL))
>>>> + ltq_mtd->map->phys = NO_XIP;
>>>
>>> This does not what you think it does; i.e. preventing unaligned io
>>> memory accesses. All it's used for is in two drivers
>>> (cfi_cmdset_0001.c, lpddr_cmds.c) as a check whether to populate
>>> _point/_unpoint. But it does not prevent the map_read/map_write
>>> accessors from doing memcpy_{from,to}_io() with unaligned addresses,
>>> which at least on MIPS results in unaligned accesses with LWL/LWR.
>>> Which is what I assume you want to prevent.
>>
>> Hi Jonas,
>>
>> I want to upstream the patch from OpenWrt:
>> https://dev.openwrt.org/changeset/35992
>>
>> I want to deactivate the execute-in-place (XIP) which this property does.
>
> I understand that, but I wanted to point out that setting NO_XIP does
> neither prevent XIP*, nor does it prevent unaligned direct accesses.
> Which are also IMHO two different concepts.
>
> NO_XIP is checked at exactly one place, by mtd_is_linear()[1] (and
> only if CONFIG_MTD_COMPLEX_MAPPINGS is enabled). And mtd_is_linear()
> is only used by the two mentioned drivers, nothing more. Unless I'm
> overlooking something, this patch has no obvservebal effect, as the
> mtd code doesn't actually do anything meaningful with NO_XIP.
>
this patch makes the chip use the fixup_use_point() code. adding matti
to the loop, this patch was originally written by him if i am not mistaken
John
More information about the linux-mtd
mailing list