aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/can
diff options
context:
space:
mode:
authorDong Aisheng <b29396@freescale.com>2014-11-07 03:45:14 -0500
committerMarc Kleine-Budde <mkl@pengutronix.de>2014-11-18 15:35:03 -0500
commit962845da54afe2fc7ebf64c2d8bb5aa65a826b2f (patch)
treeed12bbff1d3a12e9861020b5ec7ff3f52ed2d356 /drivers/net/can
parentefe22286e05751e9913a8002fefdb45cdb7361ad (diff)
can: m_can: add missing message RAM initialization
The M_CAN message RAM is usually equipped with a parity or ECC functionality. But RAM cells suffer a hardware reset and can therefore hold arbitrary content at startup - including parity and/or ECC bits. To prevent the M_CAN controller detecting checksum errors when reading potentially uninitialized TX message RAM content to transmit CAN frames the TX message RAM has to be written with (any kind of) initial data. Signed-off-by: Dong Aisheng <b29396@freescale.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can')
-rw-r--r--drivers/net/can/m_can/m_can.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index e61886bf1bb3..268ad5064c47 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1010,7 +1010,7 @@ static int m_can_of_parse_mram(struct platform_device *pdev,
1010 struct resource *res; 1010 struct resource *res;
1011 void __iomem *addr; 1011 void __iomem *addr;
1012 u32 out_val[MRAM_CFG_LEN]; 1012 u32 out_val[MRAM_CFG_LEN];
1013 int ret; 1013 int i, start, end, ret;
1014 1014
1015 /* message ram could be shared */ 1015 /* message ram could be shared */
1016 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram"); 1016 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "message_ram");
@@ -1061,6 +1061,15 @@ static int m_can_of_parse_mram(struct platform_device *pdev,
1061 priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num, 1061 priv->mcfg[MRAM_TXE].off, priv->mcfg[MRAM_TXE].num,
1062 priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num); 1062 priv->mcfg[MRAM_TXB].off, priv->mcfg[MRAM_TXB].num);
1063 1063
1064 /* initialize the entire Message RAM in use to avoid possible
1065 * ECC/parity checksum errors when reading an uninitialized buffer
1066 */
1067 start = priv->mcfg[MRAM_SIDF].off;
1068 end = priv->mcfg[MRAM_TXB].off +
1069 priv->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE;
1070 for (i = start; i < end; i += 4)
1071 writel(0x0, priv->mram_base + i);
1072
1064 return 0; 1073 return 0;
1065} 1074}
1066 1075