diff options
author | Pavel Machek <pavel@denx.de> | 2014-05-06 09:57:02 -0400 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2014-05-19 03:38:22 -0400 |
commit | ccbc5357db3098c57176945f677b0af37f5e87e6 (patch) | |
tree | 9200ce6c25f8bb2ec94c42fe8d0b2260105f9913 /drivers/net/can/c_can/c_can_pci.c | |
parent | e07e83ae600ea51b857e02132220eb7b7e52e928 (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.c | 19 |
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, | |||
83 | iowrite32((u32)val, priv->base + 2 * priv->regs[index]); | 83 | iowrite32((u32)val, priv->base + 2 * priv->regs[index]); |
84 | } | 84 | } |
85 | 85 | ||
86 | static u32 c_can_pci_read_reg32(const struct c_can_priv *priv, enum reg index) | ||
87 | { | ||
88 | u32 val; | ||
89 | |||
90 | val = priv->read_reg(priv, index); | ||
91 | val |= ((u32) priv->read_reg(priv, index + 1)) << 16; | ||
92 | |||
93 | return val; | ||
94 | } | ||
95 | |||
96 | static void c_can_pci_write_reg32(const struct c_can_priv *priv, enum reg index, | ||
97 | u32 val) | ||
98 | { | ||
99 | priv->write_reg(priv, index + 1, val >> 16); | ||
100 | priv->write_reg(priv, index, val); | ||
101 | } | ||
102 | |||
86 | static void c_can_pci_reset_pch(const struct c_can_priv *priv, bool enable) | 103 | static void c_can_pci_reset_pch(const struct c_can_priv *priv, bool enable) |
87 | { | 104 | { |
88 | if (enable) { | 105 | if (enable) { |
@@ -187,6 +204,8 @@ static int c_can_pci_probe(struct pci_dev *pdev, | |||
187 | ret = -EINVAL; | 204 | ret = -EINVAL; |
188 | goto out_free_c_can; | 205 | goto out_free_c_can; |
189 | } | 206 | } |
207 | priv->read_reg32 = c_can_pci_read_reg32; | ||
208 | priv->write_reg32 = c_can_pci_write_reg32; | ||
190 | 209 | ||
191 | priv->raminit = c_can_pci_data->init; | 210 | priv->raminit = c_can_pci_data->init; |
192 | 211 | ||