Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp6688358iob; Wed, 11 May 2022 03:14:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyH3cXVBSHtW9MrIJLhejt+D2veUJh1+rkPuMt2+mpBU4R57okqnX5dI9QabOg3Y3s2WK0C X-Received: by 2002:a17:907:2ce4:b0:6f4:3519:b771 with SMTP id hz4-20020a1709072ce400b006f43519b771mr22145341ejc.178.1652264052005; Wed, 11 May 2022 03:14:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652264051; cv=none; d=google.com; s=arc-20160816; b=uo3GmhEM15952/TPwkEEXPtrte+fH35v6b4+75LDU53VFpCjfPd/8soyAJPSfpcGui 43aKiV7J061837IOlTD3ghc9EqcMChMscMUMEuZeeOAnnVoR5vDq7YU1PzlpgHxW2RU2 7QFjivqmifdpR8AD9t7HDTB3rLHhu/SSzXB/zxKpQMhNtpzsJtMzwL/cXa5ThMuGbFjM 0IyH7X2Di+CJ2tq3Fr15/j0EazCm/btXua62XlYkcl1ay2Rkbn9DVH52A8VRtS5cr3zR /I9m8PVh7cAwS+jM1hb30I4O6p358I2gzBmacElLrmTEDx12ogRblBKcZB27+a9M1Txs lw5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :authorized-sender; bh=rpE86ORqXc6EE+IjypGsOz4HCmSu9aDOYkzYp2SBGEg=; b=uAqy17P33uBXfFtWURs/7biEcR24EUib831Z//169DOxzygyeDm0oFi0nqLma9qRlx DNq+eU9KWfX5WHrZ64w654OcxTZauT50qrjWhvdGYUSp5M+T+1XWpcDKFnCF2nnlg9QU iw21QNzKQwtF0bFkTDEkzpWfgunFbILzkJSGDSPxvLx4ekCyQmIJyqOxhbvDt/aOSTDT yNH0vSS3GEfVn12+hZuRq7zydyuxsfPHo5OHDvIW2yN5/4Kd8h3Jcys9GrRU02EyaTyH L7zMZce8d9SjELtU7kTWV/DehEPHr82oIML9Clemotn4uKMF9rd6dmoTq9JvWGlZyqIA NOpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ne33-20020a1709077ba100b006f39e0cbe8esi2399152ejc.227.2022.05.11.03.13.45; Wed, 11 May 2022 03:14:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230319AbiEKJeZ (ORCPT + 99 others); Wed, 11 May 2022 05:34:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238614AbiEKJeW (ORCPT ); Wed, 11 May 2022 05:34:22 -0400 Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F27CF19FF64 for ; Wed, 11 May 2022 02:34:19 -0700 (PDT) X-Halon-ID: 85b12fb9-d10d-11ec-9628-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 85b12fb9-d10d-11ec-9628-0050569116f7; Wed, 11 May 2022 11:34:18 +0200 (CEST) From: Andreas Larsson To: stable@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Marc Kleine-Budde Subject: [PATCH 4.14 1/2] can: grcan: grcan_probe(): fix broken system id check for errata workaround needs Date: Wed, 11 May 2022 11:34:09 +0200 Message-Id: <20220511093410.13946-1-andreas@gaisler.com> X-Mailer: git-send-email 2.17.1 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org backport of commit 1e93ed26acf03fe6c97c6d573a10178596aadd43 upstream. The systemid property was checked for in the wrong place of the device tree and compared to the wrong value. Fixes: 6cec9b07fe6a ("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 Signed-off-by: Marc Kleine-Budde --- 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 a2dbd7ae9db2..e126516ba648 100644 --- a/drivers/net/can/grcan.c +++ b/drivers/net/can/grcan.c @@ -245,7 +245,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 */ @@ -1665,6 +1665,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; struct resource *res; u32 sysid, ambafreq; int irq, err; @@ -1674,10 +1675,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