driver: mtd: update struct map_info's swap as per map requirement
PATCH v7 2/2 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.
---
Changes for v2: Incorporated review comments from Boris Brezillon
http://patchwork.ozlabs.org/patch/758381/
Changes for v3: None
Changes for v4: Updated code as per new defined binding of physmap.txt Changes for v5: Avoid map.swap set in case of endiannes not defined in dts file Changes for v6: Sending as it is
Changes for v7: Sending as it is
drivers/mtd/maps/physmap_of_core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mtd/maps/physmap_of_core.c +6 -0
@@ -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;
Signature · 1 line
2.14.1
Boris Brezillon
AppliedPATCH v7 2/2 driver: mtd: update struct map_info's swap as per map requirement
Quoted 11 lines · On Wed, 28 Mar 2018 11:15:52 +0530 Prabhakar Kushwaha…
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_SWAPorCONFIG_MTD_CFI_BE_BYTE_SWAPi.e. compile time.Now update struct map_info's swap field based on device characteristics defined in device tree.
Signed-off-by Jagdish Gediya <[email protected]>Signed-off-by Prabhakar Kushwaha <[email protected]>
Applied.
Thanks,
Boris
Quoted 36 lines
---
Changes for v2: Incorporated review comments from Boris Brezillon
http://patchwork.ozlabs.org/patch/758381/
Changes for v3: None
Changes for v4: Updated code as per new defined binding of physmap.txt Changes for v5: Avoid map.swap set in case of endiannes not defined in dts file Changes for v6: Sending as it is
Changes for v7: Sending as it isdrivers/mtd/maps/physmap_of_core.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mtd/maps/physmap_of_core.c +6
-0@@ -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;
Signature · 3 lines
Boris Brezillon, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com