From: Prabhakar Kushwaha Date: Wed, 28 Mar 2018 05:45:52 +0000 (+0530) Subject: mtd: physmap_of: update struct map_info's swap as per map requirement X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=7d5cba597dbfc55c43761e255f1be646ef3ab633;p=openwrt%2Fstaging%2Fblogic.git mtd: physmap_of: 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: Jagdish Gediya Signed-off-by: Prabhakar Kushwaha Signed-off-by: Boris Brezillon --- diff --git a/drivers/mtd/maps/physmap_of_core.c b/drivers/mtd/maps/physmap_of_core.c index b1bd4faecfb2..527b1682381f 100644 --- a/drivers/mtd/maps/physmap_of_core.c +++ b/drivers/mtd/maps/physmap_of_core.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -233,6 +234,11 @@ static int of_flash_probe(struct platform_device *dev) info->list[i].map.bankwidth = be32_to_cpup(width); info->list[i].map.device_node = dp; + if (of_property_read_bool(dp, "big-endian")) + info->list[i].map.swap = CFI_BIG_ENDIAN; + else if (of_property_read_bool(dp, "little-endian")) + info->list[i].map.swap = CFI_LITTLE_ENDIAN; + err = of_flash_probe_gemini(dev, dp, &info->list[i].map); if (err) goto err_out;