regmap: Switch to use fwnode instead of OF one
Make regmap firmware node type agnostic by switching it to use fwnode. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20200708161232.17914-1-andriy.shevchenko@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
31cf2c3b6f
commit
c916d6ef53
@@ -11,7 +11,7 @@
|
|||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/of.h>
|
#include <linux/property.h>
|
||||||
#include <linux/rbtree.h>
|
#include <linux/rbtree.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
@@ -631,7 +631,7 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
|
|||||||
const struct regmap_bus *bus,
|
const struct regmap_bus *bus,
|
||||||
const struct regmap_config *config)
|
const struct regmap_config *config)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct fwnode_handle *fwnode = dev ? dev_fwnode(dev) : NULL;
|
||||||
enum regmap_endian endian;
|
enum regmap_endian endian;
|
||||||
|
|
||||||
/* Retrieve the endianness specification from the regmap config */
|
/* Retrieve the endianness specification from the regmap config */
|
||||||
@@ -641,22 +641,17 @@ enum regmap_endian regmap_get_val_endian(struct device *dev,
|
|||||||
if (endian != REGMAP_ENDIAN_DEFAULT)
|
if (endian != REGMAP_ENDIAN_DEFAULT)
|
||||||
return endian;
|
return endian;
|
||||||
|
|
||||||
/* If the dev and dev->of_node exist try to get endianness from DT */
|
/* If the firmware node exist try to get endianness from it */
|
||||||
if (dev && dev->of_node) {
|
if (fwnode_property_read_bool(fwnode, "big-endian"))
|
||||||
np = dev->of_node;
|
endian = REGMAP_ENDIAN_BIG;
|
||||||
|
else if (fwnode_property_read_bool(fwnode, "little-endian"))
|
||||||
|
endian = REGMAP_ENDIAN_LITTLE;
|
||||||
|
else if (fwnode_property_read_bool(fwnode, "native-endian"))
|
||||||
|
endian = REGMAP_ENDIAN_NATIVE;
|
||||||
|
|
||||||
/* Parse the device's DT node for an endianness specification */
|
/* If the endianness was specified in fwnode, use that */
|
||||||
if (of_property_read_bool(np, "big-endian"))
|
if (endian != REGMAP_ENDIAN_DEFAULT)
|
||||||
endian = REGMAP_ENDIAN_BIG;
|
return endian;
|
||||||
else if (of_property_read_bool(np, "little-endian"))
|
|
||||||
endian = REGMAP_ENDIAN_LITTLE;
|
|
||||||
else if (of_property_read_bool(np, "native-endian"))
|
|
||||||
endian = REGMAP_ENDIAN_NATIVE;
|
|
||||||
|
|
||||||
/* If the endianness was specified in DT, use that */
|
|
||||||
if (endian != REGMAP_ENDIAN_DEFAULT)
|
|
||||||
return endian;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Retrieve the endianness specification from the bus config */
|
/* Retrieve the endianness specification from the bus config */
|
||||||
if (bus && bus->val_format_endian_default)
|
if (bus && bus->val_format_endian_default)
|
||||||
|
|||||||
Reference in New Issue
Block a user