Skip to content

Commit

Permalink
can: sja1000: of: add reg-io-width property for 8, 16 and 32-bit regi…
Browse files Browse the repository at this point in the history
…ster 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>
  • Loading branch information
Florian Vaussard authored and Marc Kleine-Budde committed Feb 6, 2014
1 parent 73c90d9 commit b18ec27
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions drivers/net/can/sja1000/sja1000_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b18ec27

Please sign in to comment.