summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorAlison Wang <b18965@freescale.com>2017-07-26 05:55:53 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-09-25 07:25:36 (GMT)
commit063df567b94ad594c633e85aef177d9b3bcdbe35 (patch)
tree24b3bcf1fd35f3f013cc4c24992d7798e165eb9d /drivers/mtd
parente9e31efadc78cff2cc8702208a6a056515c9b120 (diff)
downloadlinux-063df567b94ad594c633e85aef177d9b3bcdbe35.tar.xz
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 <prabhakar.kushwaha@nxp.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/maps/physmap_of.c4
1 files changed, 4 insertions, 0 deletions
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 <linux/mtd/map.h>
#include <linux/mtd/partitions.h>
#include <linux/mtd/concat.h>
+#include <linux/mtd/cfi_endian.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_platform.h>
@@ -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);