Commit 1e93ed26 authored by Andreas Larsson's avatar Andreas Larsson Committed by Marc Kleine-Budde

can: grcan: grcan_probe(): fix broken system id check for errata workaround needs

The systemid property was checked for in the wrong place of the device
tree and compared to the wrong value.

Fixes: 6cec9b07 ("can: grcan: Add device driver for GRCAN and GRHCAN cores")
Link: https://lore.kernel.org/all/20220429084656.29788-3-andreas@gaisler.com
Cc: stable@vger.kernel.org
Signed-off-by: default avatarAndreas Larsson <andreas@gaisler.com>
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 101da426
...@@ -241,7 +241,7 @@ struct grcan_device_config { ...@@ -241,7 +241,7 @@ struct grcan_device_config {
.rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \ .rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \
} }
#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 0x4100 #define GRCAN_TXBUG_SAFE_GRLIB_VERSION 4100
#define GRLIB_VERSION_MASK 0xffff #define GRLIB_VERSION_MASK 0xffff
/* GRCAN private data structure */ /* GRCAN private data structure */
...@@ -1643,6 +1643,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev, ...@@ -1643,6 +1643,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
static int grcan_probe(struct platform_device *ofdev) static int grcan_probe(struct platform_device *ofdev)
{ {
struct device_node *np = ofdev->dev.of_node; struct device_node *np = ofdev->dev.of_node;
struct device_node *sysid_parent;
u32 sysid, ambafreq; u32 sysid, ambafreq;
int irq, err; int irq, err;
void __iomem *base; void __iomem *base;
...@@ -1651,10 +1652,15 @@ static int grcan_probe(struct platform_device *ofdev) ...@@ -1651,10 +1652,15 @@ static int grcan_probe(struct platform_device *ofdev)
/* Compare GRLIB version number with the first that does not /* Compare GRLIB version number with the first that does not
* have the tx bug (see start_xmit) * have the tx bug (see start_xmit)
*/ */
err = of_property_read_u32(np, "systemid", &sysid); sysid_parent = of_find_node_by_path("/ambapp0");
if (!err && ((sysid & GRLIB_VERSION_MASK) if (sysid_parent) {
>= GRCAN_TXBUG_SAFE_GRLIB_VERSION)) of_node_get(sysid_parent);
txbug = false; err = of_property_read_u32(sysid_parent, "systemid", &sysid);
if (!err && ((sysid & GRLIB_VERSION_MASK) >=
GRCAN_TXBUG_SAFE_GRLIB_VERSION))
txbug = false;
of_node_put(sysid_parent);
}
err = of_property_read_u32(np, "freq", &ambafreq); err = of_property_read_u32(np, "freq", &ambafreq);
if (err) { if (err) {
......
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