From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4231DC433EF for ; Fri, 29 Apr 2022 08:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356113AbiD2Iui (ORCPT ); Fri, 29 Apr 2022 04:50:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356054AbiD2Iue (ORCPT ); Fri, 29 Apr 2022 04:50:34 -0400 Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D33AA57179 for ; Fri, 29 Apr 2022 01:47:16 -0700 (PDT) X-Halon-ID: f6a103d4-c798-11ec-9627-0050569116f7 Authorized-sender: andreas@gaisler.com Received: from andreas.got.gaisler.com (h-98-128-223-123.na.cust.bahnhof.se [98.128.223.123]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id f6a103d4-c798-11ec-9627-0050569116f7; Fri, 29 Apr 2022 10:47:14 +0200 (CEST) From: Andreas Larsson To: linux-can@vger.kernel.org Cc: Wolfgang Grandegger , Marc Kleine-Budde , Oliver Hartkopp , linux-kernel@vger.kernel.org, software@gaisler.com Subject: [PATCH v2 2/3] can: grcan: Fix broken system id check for errata workaround needs Date: Fri, 29 Apr 2022 10:46:55 +0200 Message-Id: <20220429084656.29788-3-andreas@gaisler.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220429084656.29788-1-andreas@gaisler.com> References: <20220429084656.29788-1-andreas@gaisler.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The systemid property was checked for in the wrong place of the devicetree and compared to the wrong value. Fixes: 6cec9b07fe6a ("can: grcan: Add device driver for GRCAN and GRHCAN cores") Signed-off-by: Andreas Larsson --- drivers/net/can/grcan.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/grcan.c b/drivers/net/can/grcan.c index f7c3cf941f61..2f56d4bbb65c 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c @@ -241,7 +241,7 @@ struct grcan_device_config { .rxsize = GRCAN_DEFAULT_BUFFER_SIZE, \ } -#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 0x4100 +#define GRCAN_TXBUG_SAFE_GRLIB_VERSION 4100 #define GRLIB_VERSION_MASK 0xffff /* GRCAN private data structure */ @@ -1642,6 +1642,7 @@ static int grcan_setup_netdev(struct platform_device *ofdev, static int grcan_probe(struct platform_device *ofdev) { struct device_node *np = ofdev->dev.of_node; + struct device_node *sysid_parent; u32 sysid, ambafreq; int irq, err; void __iomem *base; @@ -1650,10 +1651,15 @@ static int grcan_probe(struct platform_device *ofdev) /* Compare GRLIB version number with the first that does not * have the tx bug (see start_xmit) */ - err = of_property_read_u32(np, "systemid", &sysid); - if (!err && ((sysid & GRLIB_VERSION_MASK) - >= GRCAN_TXBUG_SAFE_GRLIB_VERSION)) - txbug = false; + sysid_parent = of_find_node_by_path("/ambapp0"); + if (sysid_parent) { + of_node_get(sysid_parent); + 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); if (err) { -- 2.17.1