summaryrefslogtreecommitdiff
path: root/drivers/net/can/c_can/c_can_pci.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@denx.de>2014-05-06 15:57:02 +0200
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-05-19 09:38:22 +0200
commitccbc5357db3098c57176945f677b0af37f5e87e6 (patch)
tree9200ce6c25f8bb2ec94c42fe8d0b2260105f9913 /drivers/net/can/c_can/c_can_pci.c
parente07e83ae600ea51b857e02132220eb7b7e52e928 (diff)
can: c_can: Add and make use of 32-bit accesses functions
Add helpers for 32-bit accesses and replace open-coded 32-bit access with calls to helpers. Minimum changes are done to the pci case, as I don't have access to that hardware. Tested-by: Thor Thayer <tthayer@altera.com> Signed-off-by: Thor Thayer <tthayer@altera.com> Signed-off-by: Pavel Machek <pavel@denx.de> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/c_can/c_can_pci.c')
-rw-r--r--drivers/net/can/c_can/c_can_pci.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/can/c_can/c_can_pci.c b/drivers/net/can/c_can/c_can_pci.c
index b901a798f7e2..5d11e0e4225b 100644
--- a/drivers/net/can/c_can/c_can_pci.c
+++ b/drivers/net/can/c_can/c_can_pci.c
@@ -83,6 +83,23 @@ static void c_can_pci_write_reg_32bit(const struct c_can_priv *priv,
iowrite32((u32)val, priv->base + 2 * priv->regs[index]);
}
+static u32 c_can_pci_read_reg32(const struct c_can_priv *priv, enum reg index)
+{
+ u32 val;
+
+ val = priv->read_reg(priv, index);
+ val |= ((u32) priv->read_reg(priv, index + 1)) << 16;
+
+ return val;
+}
+
+static void c_can_pci_write_reg32(const struct c_can_priv *priv, enum reg index,
+ u32 val)
+{
+ priv->write_reg(priv, index + 1, val >> 16);
+ priv->write_reg(priv, index, val);
+}
+
static void c_can_pci_reset_pch(const struct c_can_priv *priv, bool enable)
{
if (enable) {
@@ -187,6 +204,8 @@ static int c_can_pci_probe(struct pci_dev *pdev,
ret = -EINVAL;
goto out_free_c_can;
}
+ priv->read_reg32 = c_can_pci_read_reg32;
+ priv->write_reg32 = c_can_pci_write_reg32;
priv->raminit = c_can_pci_data->init;