diff options
author | 2014-01-31 14:34:37 +0100 | |
---|---|---|
committer | 2014-02-06 11:50:57 +0100 | |
commit | b18ec27c6502b79e22d5b51ae66e81d683ae686c (patch) | |
tree | d48d01f2ec73bfdf426decaf35230a1e52183c97 /drivers/net/can | |
parent | Documentation: devicetree: sja1000: add reg-io-width binding (diff) | |
download | linux-b18ec27c6502b79e22d5b51ae66e81d683ae686c.tar.gz linux-b18ec27c6502b79e22d5b51ae66e81d683ae686c.tar.bz2 linux-b18ec27c6502b79e22d5b51ae66e81d683ae686c.zip |
can: sja1000: of: add reg-io-width property for 8, 16 and 32-bit register access
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@epfl.ch>
Tested-by: Andreas Larsson <andreas@gaisler.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r-- | drivers/net/can/sja1000/sja1000_platform.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c index b7fbe4f57720..95a844a7ee7b 100644 --- a/drivers/net/can/sja1000/sja1000_platform.c +++ b/drivers/net/can/sja1000/sja1000_platform.c @@ -101,8 +101,24 @@ 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; /* 8 bit is default */ + + switch (prop) { + case 4: + priv->read_reg = sp_read_reg32; + priv->write_reg = sp_write_reg32; + break; + case 2: + priv->read_reg = sp_read_reg16; + priv->write_reg = sp_write_reg16; + break; + case 1: /* fallthrough */ + default: + priv->read_reg = sp_read_reg8; + priv->write_reg = sp_write_reg8; + } err = of_property_read_u32(of, "nxp,external-clock-frequency", &prop); if (!err) |