Commit d737de2d authored by Matthias Schiffer's avatar Matthias Schiffer Committed by Marc Kleine-Budde

can: m_can: pci: fix iomap_read_fifo() and iomap_write_fifo()

The same fix that was previously done in m_can_platform in commit
99d173fb ("can: m_can: fix iomap_read_fifo() and iomap_write_fifo()")
is required in m_can_pci as well to make iomap_read_fifo() and
iomap_write_fifo() work for val_count > 1.

Fixes: 812270e5 ("can: m_can: Batch FIFO writes during CAN transmit")
Fixes: 1aa6772f ("can: m_can: Batch FIFO reads during CAN receive")
Link: https://lore.kernel.org/all/20211118144011.10921-1-matthias.schiffer@ew.tq-group.com
Cc: stable@vger.kernel.org
Cc: Matt Kline <matt@bitbashing.io>
Signed-off-by: default avatarMatthias Schiffer <matthias.schiffer@ew.tq-group.com>
Tested-by: default avatarJarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 31cb32a5
...@@ -42,8 +42,13 @@ static u32 iomap_read_reg(struct m_can_classdev *cdev, int reg) ...@@ -42,8 +42,13 @@ static u32 iomap_read_reg(struct m_can_classdev *cdev, int reg)
static int iomap_read_fifo(struct m_can_classdev *cdev, int offset, void *val, size_t val_count) static int iomap_read_fifo(struct m_can_classdev *cdev, int offset, void *val, size_t val_count)
{ {
struct m_can_pci_priv *priv = cdev_to_priv(cdev); struct m_can_pci_priv *priv = cdev_to_priv(cdev);
void __iomem *src = priv->base + offset;
ioread32_rep(priv->base + offset, val, val_count); while (val_count--) {
*(unsigned int *)val = ioread32(src);
val += 4;
src += 4;
}
return 0; return 0;
} }
...@@ -61,8 +66,13 @@ static int iomap_write_fifo(struct m_can_classdev *cdev, int offset, ...@@ -61,8 +66,13 @@ static int iomap_write_fifo(struct m_can_classdev *cdev, int offset,
const void *val, size_t val_count) const void *val, size_t val_count)
{ {
struct m_can_pci_priv *priv = cdev_to_priv(cdev); struct m_can_pci_priv *priv = cdev_to_priv(cdev);
void __iomem *dst = priv->base + offset;
iowrite32_rep(priv->base + offset, val, val_count); while (val_count--) {
iowrite32(*(unsigned int *)val, dst);
val += 4;
dst += 4;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment