Add the 'reg-io-width' property for 8, 16 and 32-bit access, like
what is currently done with IORESOURCE_MEM_{8,16,32}BIT for non-OF
boot.
Signed-off-by: Florian Vaussard <florian.vaussard@xxxxxxx>
---
drivers/net/can/sja1000/sja1000_platform.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index 50dece8..25122bf 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -102,8 +102,20 @@ static void sp_populate_of(struct sja1000_priv *priv, struct device_node *of)
int err;
u32 prop;
- priv->read_reg = sp_read_reg8;
- priv->write_reg = sp_write_reg8;
+ err = of_property_read_u32(of, "reg-io-width", &prop);
+ if (err)
+ prop = 1;
+
+ if (prop == 4) {
+ priv->read_reg = sp_read_reg32;
+ priv->write_reg = sp_write_reg32;
+ } else if (prop == 2) {
+ priv->read_reg = sp_read_reg16;
+ priv->write_reg = sp_write_reg16;
+ } else {
+ priv->read_reg = sp_read_reg8;
+ priv->write_reg = sp_write_reg8;
+ }