1111#include <linux/export.h>
1212#include <linux/mutex.h>
1313#include <linux/err.h>
14- #include <linux/of .h>
14+ #include <linux/property .h>
1515#include <linux/rbtree.h>
1616#include <linux/sched.h>
1717#include <linux/delay.h>
@@ -631,7 +631,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
631631 const struct regmap_bus * bus ,
632632 const struct regmap_config * config )
633633{
634- struct device_node * np ;
634+ struct fwnode_handle * fwnode = dev ? dev_fwnode ( dev ) : NULL ;
635635 enum regmap_endian endian ;
636636
637637 /* Retrieve the endianness specification from the regmap config */
@@ -641,22 +641,17 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
641641 if (endian != REGMAP_ENDIAN_DEFAULT )
642642 return endian ;
643643
644- /* If the dev and dev->of_node exist try to get endianness from DT */
645- if (dev && dev -> of_node ) {
646- np = dev -> of_node ;
647-
648- /* Parse the device's DT node for an endianness specification */
649- if (of_property_read_bool (np , "big-endian" ))
650- endian = REGMAP_ENDIAN_BIG ;
651- else if (of_property_read_bool (np , "little-endian" ))
652- endian = REGMAP_ENDIAN_LITTLE ;
653- else if (of_property_read_bool (np , "native-endian" ))
654- endian = REGMAP_ENDIAN_NATIVE ;
655-
656- /* If the endianness was specified in DT, use that */
657- if (endian != REGMAP_ENDIAN_DEFAULT )
658- return endian ;
659- }
644+ /* If the firmware node exist try to get endianness from it */
645+ if (fwnode_property_read_bool (fwnode , "big-endian" ))
646+ endian = REGMAP_ENDIAN_BIG ;
647+ else if (fwnode_property_read_bool (fwnode , "little-endian" ))
648+ endian = REGMAP_ENDIAN_LITTLE ;
649+ else if (fwnode_property_read_bool (fwnode , "native-endian" ))
650+ endian = REGMAP_ENDIAN_NATIVE ;
651+
652+ /* If the endianness was specified in fwnode, use that */
653+ if (endian != REGMAP_ENDIAN_DEFAULT )
654+ return endian ;
660655
661656 /* Retrieve the endianness specification from the bus config */
662657 if (bus && bus -> val_format_endian_default )
0 commit comments