From 063df567b94ad594c633e85aef177d9b3bcdbe35 Mon Sep 17 00:00:00 2001 From: Alison Wang Date: Wed, 26 Jul 2017 13:55:53 +0800 Subject: driver: mtd: update struct map_info's swap as per map requirement It is not necessary for all device's maps to be CFI_HOST_ENDIAN. Maps device can be big endian or little endian. Currently it is being taken care using CONFIG_MTD_CFI_LE_BYTE_SWAP or CONFIG_MTD_CFI_BE_BYTE_SWAP i.e. compile time. Now update struct map_info's swap field based on device characteristics defined in device tree. Signed-off-by: Prabhakar Kushwaha diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 3fad359..f720a96 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -247,6 +248,9 @@ static int of_flash_probe(struct platform_device *dev) return err; } + if (of_property_read_bool(dp->parent, "big-endian")) + info->list[i].map.swap = CFI_BIG_ENDIAN; + err = -ENOMEM; info->list[i].map.virt = ioremap(info->list[i].map.phys, info->list[i].map.size); -- cgit v0.10.2