Skip to content

Commit 1e93ed2

Browse files
andreas-gaislermarckleinebudde
authored andcommitted
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: 6cec9b0 ("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: Andreas Larsson <andreas@gaisler.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
1 parent 101da42 commit 1e93ed2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/net/can/grcan.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ struct grcan_device_config {
241241
.rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \
242242
}
243243

244-
#define GRCAN_TXBUG_SAFE_GRLIB_VERSION0x4100
244+
#define GRCAN_TXBUG_SAFE_GRLIB_VERSION4100
245245
#define GRLIB_VERSION_MASK0xffff
246246

247247
/* GRCAN private data structure */
@@ -1643,6 +1643,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev,
16431643
static int grcan_probe(struct platform_device *ofdev)
16441644
{
16451645
struct device_node *np = ofdev->dev.of_node;
1646+
struct device_node *sysid_parent;
16461647
u32 sysid, ambafreq;
16471648
int irq, err;
16481649
void __iomem *base;
@@ -1651,10 +1652,15 @@ static int grcan_probe(struct platform_device *ofdev)
16511652
/* Compare GRLIB version number with the first that does not
16521653
* have the tx bug (see start_xmit)
16531654
*/
1654-
err = of_property_read_u32(np, "systemid", &sysid);
1655-
if (!err && ((sysid & GRLIB_VERSION_MASK)
1656-
>= GRCAN_TXBUG_SAFE_GRLIB_VERSION))
1657-
txbug = false;
1655+
sysid_parent = of_find_node_by_path("/ambapp0");
1656+
if (sysid_parent) {
1657+
of_node_get(sysid_parent);
1658+
err = of_property_read_u32(sysid_parent, "systemid", &sysid);
1659+
if (!err && ((sysid & GRLIB_VERSION_MASK) >=
1660+
GRCAN_TXBUG_SAFE_GRLIB_VERSION))
1661+
txbug = false;
1662+
of_node_put(sysid_parent);
1663+
}
16581664

16591665
err = of_property_read_u32(np, "freq", &ambafreq);
16601666
if (err) {

0 commit comments

Comments
 (0)