diff options
| author | Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com> | 2018-03-28 11:15:52 +0530 | 
|---|---|---|
| committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-03-29 09:31:37 +0200 | 
| commit | 7d5cba597dbfc55c43761e255f1be646ef3ab633 (patch) | |
| tree | a4376cb1ba0197dab5fb145c405af070f6764f5f /drivers/mtd/maps | |
| parent | 147395ea40b36b8652b6df3e50a1cb745be75c93 (diff) | |
| download | linux-7d5cba597dbfc55c43761e255f1be646ef3ab633.tar.bz2 | |
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 <jagdish.gediya@nxp.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd/maps')
| -rw-r--r-- | drivers/mtd/maps/physmap_of_core.c | 6 | 
1 files changed, 6 insertions, 0 deletions
| 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 <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> @@ -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; |