From patchwork Wed Jun 21 09:30:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 110914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4240692vqr; Wed, 21 Jun 2023 02:49:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6NOrN3EHO8AK/nMvpKkom3eKq5EFIpQHW2bH/dMyz1G75Rvv6HWqe1Xj9YEemiYgxDb94p X-Received: by 2002:a05:6a20:748d:b0:10c:89cc:bc5f with SMTP id p13-20020a056a20748d00b0010c89ccbc5fmr18644567pzd.20.1687340981333; Wed, 21 Jun 2023 02:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687340981; cv=none; d=google.com; s=arc-20160816; b=jhn4XhVAc5QJqYJqNy/K3ckLnp57qxJmlXVcbs5Y5/Xu8Dcnho1lhD2Fn142G8uYBb Rprbak0L3Ih/JbSdhgU44QZMCzEkDY8OjIUnLMqbWqlkxZYriR3aPoEU+o7jwFytTCQm y3eE7mJm/aiTy9tMHiGNorktDwZCsvHWrMKrKaM25UG8I0kGlSVVegVttJJbeInnnarK mfcTyBBIviYjGjveueLbCd8kbOEn40/JHtG0ZJVEbc4Y4eddFX/Fo7T80P9cj64jTOns Sjad1VeFVMURHhtueVt/sOM/FJcPx+Lf09KtCHtaSZIagk2Y+PeoGI82Nfw8CrmJ/Lcy Mfbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iUVZalfP6V27NAYz5kQTxrxcxQh7F8OqnR+1IuXKgno=; b=i6ckLqmUh9h6x+aEy8nBVU+rcOudHj26gDtb5ZzbIM2ySh0cGI9gwBBJbj0XmS01G/ anMK4SH+jOVjKCN/gDR5Lpxrw/8Tb0F2pkCDPc3UkYS+Xok6/ityYtiw9JW6gp207wrf eMIVCYbSglczZTydIsxqBK0RZH8a9++iWOgD3Vz4uWY4u8q7jqJZeH7QTA+oXNi5an2J rV+D5wJv4OVs1shj42cdIhzc1b9uqAadQxosPjuUiaJk8BlPZH9qTx/9XQdrRpH3BWya zriMzky0RQXzVQAZs1yvXBkXmLHxENo+4WQtCE7EnZ257WsM8G1mbqDUlDmXNkiuILNV 8onQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=1NSCmre2; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c187-20020a624ec4000000b006561e6f6603si3736317pfb.106.2023.06.21.02.49.24; Wed, 21 Jun 2023 02:49:41 -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; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=1NSCmre2; 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 S230339AbjFUJcb (ORCPT + 99 others); Wed, 21 Jun 2023 05:32:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231861AbjFUJbP (ORCPT ); Wed, 21 Jun 2023 05:31:15 -0400 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5683510F8 for ; Wed, 21 Jun 2023 02:31:11 -0700 (PDT) Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b46a06c553so63823711fa.1 for ; Wed, 21 Jun 2023 02:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687339869; x=1689931869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iUVZalfP6V27NAYz5kQTxrxcxQh7F8OqnR+1IuXKgno=; b=1NSCmre2p7CtkNBkBJvdszJkRwwGaioXWZdO9EoPmJnoKNEGXXEu6EFvU6OgprI5xc tNLkv1dB9ERCHrEUpnTmLZDBzjMzhSVv4UdIs49WCyTKl8Kh/tuD9bFDYntp0pq77pkh rAo12jFi/yvwkjV6rGqstr6iqTzJgJ65dZl8q2XnC53Duoonqw3IhHvngOffXYqqEG3N Xm0SbOk8kbFQCK3y7GZwC8TlYnRblyaNUE2ptaLDzkOoXlopaD4qC8VTiVYh/iUbrdSJ Fp3M3vuvPtPIWQV/Hz+KWNLxB8jMJSZf0+6FxPzEv16pO8LfN7RRV2bpfV9JQl2eBTws 2q/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687339869; x=1689931869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iUVZalfP6V27NAYz5kQTxrxcxQh7F8OqnR+1IuXKgno=; b=DaTOMGSk6WaKMnfmflxs0OmR1c7H04jqJjJjpeY/VYam+lqLfHCPLa7+o+pzps0rei CheiUZc4PlqTOoPj0Iju+p4lcnogPy0FHJ6f7vPHjojMyyCMj98hWRdaLWr8dyxd1Xqv gtXFzQ1FqPa9aCgmRAqBp6o6YInNClb03CgKiXN1lufgYrRJ9Z8Dj+4PQfC2ClKktkzr ZWu6paJuHSArmdpfB3tMjBc0ZUPCsaqhidgmAwNzQM+IIqZ+vgaURI985BQ6MQcDUJye 2FHgsoDiBVORW+Jj/OGIva7V9nIQAR0v5tTMiDnyTPSG/0YIzPeTNpCc/wleN8R89njY cSwA== X-Gm-Message-State: AC+VfDxekIfQirWz3bIlbrFh8FdOnybe09OnJBtaByvxZAyBsziY+zBt rbSldhdej1pV8CwLNq3M9OsevA== X-Received: by 2002:a19:5053:0:b0:4f9:5519:78b8 with SMTP id z19-20020a195053000000b004f9551978b8mr2520136lfj.63.1687339869403; Wed, 21 Jun 2023 02:31:09 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b002fe96f0b3acsm3977344wrs.63.2023.06.21.02.31.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:31:08 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v2 1/6] dt-bindings: can: tcan4x5x: Add tcan4552 and tcan4553 variants Date: Wed, 21 Jun 2023 11:30:58 +0200 Message-Id: <20230621093103.3134655-2-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621093103.3134655-1-msp@baylibre.com> References: <20230621093103.3134655-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769305256858835475?= X-GMAIL-MSGID: =?utf-8?q?1769305256858835475?= These two new chips do not have state or wake pins. Signed-off-by: Markus Schneider-Pargmann Acked-by: Krzysztof Kozlowski --- .../devicetree/bindings/net/can/tcan4x5x.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt index e3501bfa22e9..170e23f0610d 100644 --- a/Documentation/devicetree/bindings/net/can/tcan4x5x.txt +++ b/Documentation/devicetree/bindings/net/can/tcan4x5x.txt @@ -4,7 +4,10 @@ Texas Instruments TCAN4x5x CAN Controller This file provides device node information for the TCAN4x5x interface contains. Required properties: - - compatible: "ti,tcan4x5x" + - compatible: + "ti,tcan4552", "ti,tcan4x5x" + "ti,tcan4553", "ti,tcan4x5x" or + "ti,tcan4x5x" - reg: 0 - #address-cells: 1 - #size-cells: 0 @@ -21,8 +24,10 @@ Optional properties: - reset-gpios: Hardwired output GPIO. If not defined then software reset. - device-state-gpios: Input GPIO that indicates if the device is in - a sleep state or if the device is active. - - device-wake-gpios: Wake up GPIO to wake up the TCAN device. + a sleep state or if the device is active. Not + available with tcan4552/4553. + - device-wake-gpios: Wake up GPIO to wake up the TCAN device. Not + available with tcan4552/4553. Example: tcan4x5x: tcan4x5x@0 { From patchwork Wed Jun 21 09:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 110913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4240641vqr; Wed, 21 Jun 2023 02:49:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SRqpNDOqojwZwS9ex/EATtDW6qC2ahd/A8xNU7K6ORkyOoQO7D0zOCgtwH/qbB/NHzgtx X-Received: by 2002:a17:902:efc5:b0:1b3:e6ba:1575 with SMTP id ja5-20020a170902efc500b001b3e6ba1575mr8459274plb.16.1687340971817; Wed, 21 Jun 2023 02:49:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687340971; cv=none; d=google.com; s=arc-20160816; b=tQj14qZYaJOjE5QFQNQMy8qpUb9zY4YhZtVP4KzJKfZ4MKMJ05/NkMj7QfW8HSUoEJ DOA9bXBJNGmnw3mKhkXtg3/cmuoCdh/B2PuLSBzxIxwPwSK5qYjgpVnc15pxx4ABFSyA PHrF7FnuNO99iQqpwRU2g36+wpXgYCeTdAJHeScmcqcCNwhfOSqYuTYQXykldEyZajL5 2IGeQeKgvypVPYKaC0nQtRF+19AKnuTmrjFXgAAfyxmxtXEXCKoVI4jZ5cRH8Sb86QfL e/0sDllzSQQGDZJOOWscXqUhTMuiKuKuM+gMJQoPWUkr4U2WlTWggq+P0EnvmMaxYTDf rl7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aOPR69iAQ16PRI3TWa1E2gZcgSDBVpUe2mB3Tg7XdFY=; b=01kM/Hm15IjhUoi840VhU2l2H+TgDELCPReXds2uI5SdiTBqBokDD7R1CVdePbHYFe g5A2TiJnruiWRBJldnvkPB/59MU6SIKAS8ZcPoFUGCcKv2rQhgLi3vwvD29x7m/L5kHk 4SZI0fyYlpwxGoxTknnCUQIlOl08Nr/LDvXMaP+z9SqSZaRIXDG36QKqnkV1RBCjNqvh SMiJndejUMvzvSLES20zYFlaDGe3Ltmu+t3qr6Q0ZRAYZ/w72QAXxsjJcX/GKMCVmaMI O/SNF63I1FsypweTkxYWr3UvQbnclMb2KoX/Zk4CNQVmxBLU9/fAMrUqi9t4vsDQO0lV MahQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=p6VfhCsZ; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g12-20020a170902e38c00b001b02e044c87si2615420ple.320.2023.06.21.02.49.18; Wed, 21 Jun 2023 02:49:31 -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; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=p6VfhCsZ; 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 S231933AbjFUJce (ORCPT + 99 others); Wed, 21 Jun 2023 05:32:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230124AbjFUJbP (ORCPT ); Wed, 21 Jun 2023 05:31:15 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7323AE6C for ; Wed, 21 Jun 2023 02:31:12 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-31121494630so6568230f8f.3 for ; Wed, 21 Jun 2023 02:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687339871; x=1689931871; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aOPR69iAQ16PRI3TWa1E2gZcgSDBVpUe2mB3Tg7XdFY=; b=p6VfhCsZ1XQVk+UFLTJRo9cf3iTipfn7+MBuZGX/3xu99DkZWmG8tzt/4QEiu0vdoP SwlKwJZpil8SEzBGic9Sdgl41L2ROAyA7fjHmwCysGNFyiJ2HXeo4xDhFyiizQzpbGAb pFEwDePat4OO5iNIvyfT6kCa1Y1wwPfNVqWTUay+XSTDaay8iLXaiNAWpNJosnHvR002 85B6egNdHCN4pFH1hnrVd2eyXbxaTHobsIy0GYO0HIrF0qrfTKXUZWMqa3bWv6qy4XO8 Fmtgt9r0knq3H5Xf8bnbXgXrDmp7C2UqP5JkHSCkA99CZSH22vhgwzEkEOE5iahxQgJf FIAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687339871; x=1689931871; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aOPR69iAQ16PRI3TWa1E2gZcgSDBVpUe2mB3Tg7XdFY=; b=TmgnAKvA8XMsJjxIOuuQ5vTmNaLxz1GQE/wbvlr4bU5tuTnQUGw527hAU+2fZVeCXH Sio5urrnGpncIRHdi4jxs60nppFL4t1hf/7LRudLpfODeh0JdXtKOIQU4Bm7v/i4Ci8R 27cMCcT+veojuHvErdlrlLr+TviPS9O8KcplsqI4KJ7QWAqZnugXvMk8zTlm7sYANRpd GNUMdIYPAPNMElygafpWfi1w2VYsHvKol2NmilT1dKOc4/K4jDJFV39oH5bV+eK5O5yL 08vsmPRhZjGx6jgC3KXKJL135nVSQC14nFkAE0o3dT2xUF2dB3EKYhDTopYBcDF+K5tK LvIQ== X-Gm-Message-State: AC+VfDyvQeOnXN2SQaOoMjYJbbY7le9ZD+F/OSXJI1VL4TeY3MTYvYfQ 25hF4x6dGwD+Ln+AYnDAGOtr3A== X-Received: by 2002:adf:f287:0:b0:311:13e6:650a with SMTP id k7-20020adff287000000b0031113e6650amr12500326wro.28.1687339870910; Wed, 21 Jun 2023 02:31:10 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b002fe96f0b3acsm3977344wrs.63.2023.06.21.02.31.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:31:10 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v2 2/6] can: tcan4x5x: Remove reserved register 0x814 from writable table Date: Wed, 21 Jun 2023 11:30:59 +0200 Message-Id: <20230621093103.3134655-3-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621093103.3134655-1-msp@baylibre.com> References: <20230621093103.3134655-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769305246865287775?= X-GMAIL-MSGID: =?utf-8?q?1769305246865287775?= The mentioned register is not writable. It is reserved and should not be written. Fixes: 39dbb21b6a29 ("can: tcan4x5x: Specify separate read/write ranges") Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Michal Kubiak --- drivers/net/can/m_can/tcan4x5x-regmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/can/m_can/tcan4x5x-regmap.c b/drivers/net/can/m_can/tcan4x5x-regmap.c index 2b218ce04e9f..fafa6daa67e6 100644 --- a/drivers/net/can/m_can/tcan4x5x-regmap.c +++ b/drivers/net/can/m_can/tcan4x5x-regmap.c @@ -95,7 +95,6 @@ static const struct regmap_range tcan4x5x_reg_table_wr_range[] = { regmap_reg_range(0x000c, 0x0010), /* Device configuration registers and Interrupt Flags*/ regmap_reg_range(0x0800, 0x080c), - regmap_reg_range(0x0814, 0x0814), regmap_reg_range(0x0820, 0x0820), regmap_reg_range(0x0830, 0x0830), /* M_CAN */ From patchwork Wed Jun 21 09:31:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 110941 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4252835vqr; Wed, 21 Jun 2023 03:14:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6z5IjjtMFAWmdCMfW3kYFjTq4YCYf4jhpfzSJFVo7kUWFrC4GQbZKqhuVmbClzHISF1kmq X-Received: by 2002:a05:6a20:7f95:b0:11e:7ced:3360 with SMTP id d21-20020a056a207f9500b0011e7ced3360mr24256572pzj.4.1687342468851; Wed, 21 Jun 2023 03:14:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687342468; cv=none; d=google.com; s=arc-20160816; b=dQks5aNfEXue7L9oAKPaTPNzyN4rGIo+0s+XESngD8kmyuK0mJTBC22fgEfZksMaia panC2Yy9h9qngCaPjHyOKSiz3iAisMsWfmtg8INPvGjrsU+6l4DC2iY1aPafcQYqY350 JzSNHfDc1ekG5l3vqntpQUwWGDvHv85w4xxGg0OURn0GVn0oyHGT7iqT4O8EWz0tljVB MVUAZZnCRIRfCgEyYxdI6pU/VK9gqvyZR4rdrf48iJ8U4i9CCNplelWwLhXQopbTHQKF s5JF57XWjixa/fvOQ8QG+efFHNjgt9LmaLB2Bg5WZWfVvglJek7jli5VT4HsLD8Zqfzj Ytrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ybtO4Wog7AXA+LuJ7ppZ2BwN9dyYZ5NmmDbgKQHeLHM=; b=NIWUkRyvoQZaQSzeVu0Quk3VxTOK/EWbwDUcj8U8oMZWXM4qY/NTmaOalsal90J4Rd IQrFGjXNiZckw5iiIFS9zLp9sQ1xkO/7tDKxwUp/09QP5jHnTno8O6e39f4taF701mhC J9RlkUpGQbo0iexGuEHlbEx4jS9l6eJsv4igq9RexfZ/g9+GUU39vw7QpOV63YpEUqBx Q1UcvDLKvpxcN3PzmsOTM5JHDh6pEm+NJDXv8PqKhihZrgiVXpC6iC0sww/c/TBccWUf T/MTuFnbFlUzMfb5CA+XXkmDk0ojQIwXCZS8ZFHTBDQpX/mlTOH5uI+1HbvDq8MyFC1b ndyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=GbEYPR52; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h193-20020a636cca000000b005030925d31asi3613319pgc.203.2023.06.21.03.14.15; Wed, 21 Jun 2023 03:14:28 -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; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=GbEYPR52; 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 S231251AbjFUJci (ORCPT + 99 others); Wed, 21 Jun 2023 05:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231607AbjFUJbP (ORCPT ); Wed, 21 Jun 2023 05:31:15 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 959AC1718 for ; Wed, 21 Jun 2023 02:31:13 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id ffacd0b85a97d-311153ec442so4551017f8f.1 for ; Wed, 21 Jun 2023 02:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687339872; x=1689931872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ybtO4Wog7AXA+LuJ7ppZ2BwN9dyYZ5NmmDbgKQHeLHM=; b=GbEYPR52b9eyHWmMfQU9tvxe081wY8nIF6gJ+LgJ2SlgFQ61zD+2NzGNljuXKeWy24 LICZ2j4cIUIqB4M9uHH9OBqCAf81admdZooSMEzGnVTZlENGAJArH+OU0feZq4wZJOIJ Vvmyp1jnZUar0x3VDO97AP/HdoH9AoCKcyIa/32nekVLkhrKozliSJQmm6MdckAS7A1d 43G5aKpBfnpfF8e4HGgwvkwzwk0ERyZ/t+jxxVJGFEiSAhKR7nkVegtGqXe0vJySt9CZ Z0BZB4msJpteWeG4DHueVVr5CfwIUnYQExTnPDUsxSv8vYpYVsW6e2jl8xXbVPL4Qhu4 tNWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687339872; x=1689931872; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ybtO4Wog7AXA+LuJ7ppZ2BwN9dyYZ5NmmDbgKQHeLHM=; b=j2n75eRO1PQky560vgU+tZTMIRkBaQeIaKJuM8P221feHXOIdqofbiN0oayMszajjm 6SbWZh3a0Wqt2IOWWICEJ3tsUp+f/Zkb1CQg4Wo3XoiLnwG7SfCsAPMlFxP607uwHiFz abKed74cQcJwDbyJhaiRzrkL140JqOla79OWzut3J23+YJTYqULgDh//PZOxwbwTBmu8 jBrJGp8PR1Smds2HQFJ8GpFspGLNmAg8tURmOlofhBDR3TamRSOTgT6EhnelUqJthCUy SxOVzaJftuRIJ0o4N1k+MfDOxNgrks1r7N2AgpIWcSV+qP1yAWhEuD4lnfCra7JZk3WH j3oQ== X-Gm-Message-State: AC+VfDz5yeG+s2YclFkGvuXqMCZmcR756+nJzYsVsv5YYxkBi6SUeD17 9ZMuSLY1WcsuoCXME23F5GnL8g== X-Received: by 2002:a5d:6501:0:b0:30f:c420:1743 with SMTP id x1-20020a5d6501000000b0030fc4201743mr12562307wru.26.1687339872182; Wed, 21 Jun 2023 02:31:12 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b002fe96f0b3acsm3977344wrs.63.2023.06.21.02.31.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:31:11 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v2 3/6] can: tcan4x5x: Check size of mram configuration Date: Wed, 21 Jun 2023 11:31:00 +0200 Message-Id: <20230621093103.3134655-4-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621093103.3134655-1-msp@baylibre.com> References: <20230621093103.3134655-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769306816769840667?= X-GMAIL-MSGID: =?utf-8?q?1769306816769840667?= To reduce debugging effort in case the mram is misconfigured, add this size check of the DT configuration. Currently if the mram configuration doesn't fit into the available MRAM it just overwrites other areas of the MRAM. Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Michal Kubiak --- drivers/net/can/m_can/m_can.c | 16 ++++++++++++++++ drivers/net/can/m_can/m_can.h | 1 + drivers/net/can/m_can/tcan4x5x-core.c | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index a5003435802b..1cdd2675f022 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -1887,6 +1887,22 @@ static int register_m_can_dev(struct net_device *dev) return register_candev(dev); } +int m_can_check_mram_cfg(struct m_can_classdev *cdev, u32 mram_max_size) +{ + u32 total_size; + + total_size = cdev->mcfg[MRAM_TXB].off - cdev->mcfg[MRAM_SIDF].off + + cdev->mcfg[MRAM_TXB].num * TXB_ELEMENT_SIZE; + if (total_size > mram_max_size) { + dev_err(cdev->dev, "Total size of mram config(%u) exceeds mram(%u)\n", + total_size, mram_max_size); + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL_GPL(m_can_check_mram_cfg); + static void m_can_of_parse_mram(struct m_can_classdev *cdev, const u32 *mram_config_vals) { diff --git a/drivers/net/can/m_can/m_can.h b/drivers/net/can/m_can/m_can.h index a839dc71dc9b..d8150d8128e7 100644 --- a/drivers/net/can/m_can/m_can.h +++ b/drivers/net/can/m_can/m_can.h @@ -101,6 +101,7 @@ int m_can_class_register(struct m_can_classdev *cdev); void m_can_class_unregister(struct m_can_classdev *cdev); int m_can_class_get_clocks(struct m_can_classdev *cdev); int m_can_init_ram(struct m_can_classdev *priv); +int m_can_check_mram_cfg(struct m_can_classdev *cdev, u32 mram_max_size); int m_can_class_suspend(struct device *dev); int m_can_class_resume(struct device *dev); diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index 2342aa011647..e706518176e4 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -80,6 +80,7 @@ TCAN4X5X_MCAN_IR_RF1F) #define TCAN4X5X_MRAM_START 0x8000 +#define TCAN4X5X_MRAM_SIZE 0x800 #define TCAN4X5X_MCAN_OFFSET 0x1000 #define TCAN4X5X_CLEAR_ALL_INT 0xffffffff @@ -307,6 +308,10 @@ static int tcan4x5x_can_probe(struct spi_device *spi) if (!mcan_class) return -ENOMEM; + ret = m_can_check_mram_cfg(mcan_class, TCAN4X5X_MRAM_SIZE); + if (ret) + goto out_m_can_class_free_dev; + priv = cdev_to_priv(mcan_class); priv->power = devm_regulator_get_optional(&spi->dev, "vsup"); From patchwork Wed Jun 21 09:31:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 110918 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4243299vqr; Wed, 21 Jun 2023 02:56:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ78jIaa62AhGuUJtJqfvKu3qO/1ug/rVfJxa68/L1c8/MJCjcnLHuKmkuc0u1D7XXzIKlJj X-Received: by 2002:a17:90a:bb85:b0:25c:1655:157d with SMTP id v5-20020a17090abb8500b0025c1655157dmr15245504pjr.34.1687341395638; Wed, 21 Jun 2023 02:56:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687341395; cv=none; d=google.com; s=arc-20160816; b=stry1f6YWvYQ/1orRKtVtJ4u2zAzGN6lldv2EKVNIQFoRDe+KtoTO/HO44ldeqibll zBZYE3i6mhWli1G3PZSt/JfqKfE4pUW/n+uF85DAY82g+PO8lCSBLAl+t636+bMGEur6 zvZzwCIFURJLkmcKeal8lhyCsniruIzvPBIDIJU7hYvm9XkW+C8Nz3QWrBZVQclCzAd4 hl2ciMZdIvBqTexsP+a2ctkb/OZs500qTlevztMGudgf/5WEUqEXg8FIeC9V5OKGrFfc 4urj6rbHENRIn/oKAGnCkeX8igFw9wHU5OI8mie828QVXYpwzIHdUBbZ9PHKVFhThdFs gBnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tK3XW9CvIKNotY0VMKRibuYSfqNfjSdewyrI1jRS2zM=; b=cUx9JUkyVacuiTLkvq4gR80B3o4R+RJNZOd7c4s/bItk6maNvMLtr3m9x82HUADZ7L Y6nhRp/yLbgVaVP2TzEdLDFrHURssUOu22IKKbj8SZ/YnyQTmp49YpV6eZT/4seMQsxj tVltYnMSi2BRXqhHiG80uGbWakyy7+bg7VRuU8Ty7aMPNYt4kQpQdfD9Ssgj0jr6CCO0 S5v9B3jQgaTP8ijhSb6I7g5EQOqdOsXNXc1eSkTeGkBBSTAMCuhufnPfeRHILV+LscxU mn6BJjcteHL/gAWVjzf/0Vwt9LS+YKIZ/8oy51yUUyexeD+0zGulf6KdOUXCYIdes5bS +kfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=vvdnouFD; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t188-20020a6378c5000000b0054febefe103si3432508pgc.437.2023.06.21.02.56.20; Wed, 21 Jun 2023 02:56:35 -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; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=vvdnouFD; 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 S231574AbjFUJcs (ORCPT + 99 others); Wed, 21 Jun 2023 05:32:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231880AbjFUJbR (ORCPT ); Wed, 21 Jun 2023 05:31:17 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB541199E for ; Wed, 21 Jun 2023 02:31:14 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f8f3786f1dso62309855e9.2 for ; Wed, 21 Jun 2023 02:31:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687339873; x=1689931873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tK3XW9CvIKNotY0VMKRibuYSfqNfjSdewyrI1jRS2zM=; b=vvdnouFDr5rb5PrRGsiwpdR9r3jMNwu2DJKvMiB+TZcBK9nVZqtjy4UYTSQ4p9v/VP AquDpYPH11jrF5fDASMF0QD9sJEtSrMVtpn4yTrfXcrzYRXBVSUfh2j8cqsfBFxl6wTQ LmmUZA3e3tI2GkjWfMnNEG3XGt5EgaGGOhZA6bzTEwgGegB/VylAiRHrvVfHS0fVbHuQ bfIUDZN+XP5AHAn0UFS+tCcSTpqsif6XY8g0v6JNt3OixPHVV2E/2if5qputFSnY8AkV w5dl7UPoPIRGpkOn5p4VxIO1FmgwCj7Lu+5VB0Ymn7gcjmTddwZD9HzLFJBnZ0KPr8G8 dL7Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687339873; x=1689931873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tK3XW9CvIKNotY0VMKRibuYSfqNfjSdewyrI1jRS2zM=; b=RD16FrI0NPLFsiKMwgHTrciEU0weEVhEbGm2NY0P12IX15Ec5MqPt+xHVa8wRexLed 4hqlwovTp9NJjPEuX5mUdyw320d6IKtx7Sy+8F6gteMDivyDY0MklaMcqvgXlvGoDzct 2jdp1+OmqZqgjO7FFkd+VEl+TJNj1+d5yjwQd+3J4BrScm1gucTguIHpOuYh3Lw/lBKY Znr6hLZRKpqTP6Ni9O0jdagF8lbAQ5PJ1H9urXeyJpEbZk7eGohDnXA3ij+1nr5aa8Ot DOjSk+bCS080aag9OETb2aPHN/krgxs+uMGZNoC0bQA9NrHaGOS9bAM3n6trXhDAY3k1 jpsA== X-Gm-Message-State: AC+VfDy5m3pyRaSG2Nk6M69iCJ6x6+ldTn1GVWddIU6Q7eC3DcuFea9w xGuswZE4qVDLuyW9YU3pKqO16g== X-Received: by 2002:a05:600c:2051:b0:3f7:3545:4630 with SMTP id p17-20020a05600c205100b003f735454630mr15189344wmg.20.1687339873364; Wed, 21 Jun 2023 02:31:13 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b002fe96f0b3acsm3977344wrs.63.2023.06.21.02.31.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:31:12 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v2 4/6] can: tcan4x5x: Rename ID registers to match datasheet Date: Wed, 21 Jun 2023 11:31:01 +0200 Message-Id: <20230621093103.3134655-5-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621093103.3134655-1-msp@baylibre.com> References: <20230621093103.3134655-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769305691570672549?= X-GMAIL-MSGID: =?utf-8?q?1769305691570672549?= The datasheet calls these registers ID1 and ID2. Rename these to avoid confusion. Signed-off-by: Markus Schneider-Pargmann Reviewed-by: Michal Kubiak --- drivers/net/can/m_can/tcan4x5x-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index e706518176e4..fb9375fa20ec 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -6,8 +6,8 @@ #define TCAN4X5X_EXT_CLK_DEF 40000000 -#define TCAN4X5X_DEV_ID0 0x00 -#define TCAN4X5X_DEV_ID1 0x04 +#define TCAN4X5X_DEV_ID1 0x00 +#define TCAN4X5X_DEV_ID2 0x04 #define TCAN4X5X_REV 0x08 #define TCAN4X5X_STATUS 0x0C #define TCAN4X5X_ERROR_STATUS_MASK 0x10 From patchwork Wed Jun 21 09:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 110922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4246420vqr; Wed, 21 Jun 2023 03:02:32 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7h9UdgGvNDAYSmkg6c/a29ogDMvQC7E4EKRXp97CVEVRyG77q1rNeoHgCDFFNKTzd5n7Di X-Received: by 2002:a05:6a20:8e1b:b0:122:231c:32d6 with SMTP id y27-20020a056a208e1b00b00122231c32d6mr5780002pzj.61.1687341751936; Wed, 21 Jun 2023 03:02:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687341751; cv=none; d=google.com; s=arc-20160816; b=OxdSbw3X6nBoErcLE60j4gQUpB/EWnjUezABVF2aMDNjALJWi8ogezo2C4FHwy4wCV I92xC4zfWH3dzcDy0X28rROOnmBPIprR3ZogHQDTr65KeHgler2clEO5wFjkq06qD5EB sDxipMpL0mLKq02WwVDQMYBU+QxQ9qVTMc6e99Ptyw+KTi2Ew++3juWSAX5j3syKw+f/ q0LI839T9bWm+gdCOaedfWjtZ+XoaP6wh5tRFZp320eOWNaqQnHnOwxSL/p+WidQ7cpM XOGb35pk/pebVJJx3Gyj4bGuzUyJQVciUjRy6cDWn16SqxXbalA9+/EEubN0/7h2IabP N8sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=r9i7Uk9aCK3lESxenmpxDJxkyZ2pr8k/0UfT23fdTCU=; b=jZypTjsiX99/xJ0Si6OQ/4oA0pFMwNBWZUFTgPFRY7+V3tLRe/VeMWc7j0pO8yudqh l8lNBXqqzlDeqXugWPIB2UN3uDoQd4PW6EiOvsdhc1/Si2NqNEF4PLYfmfI7L2A3ty+k 4g+o5bGann6f+AWEI0KMHdFqyxnWW7bHjFb53ZbA6yJHzSEokD7aWuhmDYmX6ykUWedb fVEP8uXfw1qcAYXIGk45KhoCuf00ft4nB2Xdfb9QlXt65sL7X7BG3qYIXVc9Kc76KMtS s6qHRpzK6Z2aTYCcVkUEaBaBejPIT1kcWw4X9pgXILNCbrsx/pg4BRwYFFd/wADvYJM5 nW/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=HMgfcToT; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v16-20020aa799d0000000b00660278b8422si3642734pfi.158.2023.06.21.03.02.16; Wed, 21 Jun 2023 03:02:31 -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; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=HMgfcToT; 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 S230201AbjFUJcw (ORCPT + 99 others); Wed, 21 Jun 2023 05:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231256AbjFUJbS (ORCPT ); Wed, 21 Jun 2023 05:31:18 -0400 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32C2319AF for ; Wed, 21 Jun 2023 02:31:16 -0700 (PDT) Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-3112f256941so3627681f8f.1 for ; Wed, 21 Jun 2023 02:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687339874; x=1689931874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=r9i7Uk9aCK3lESxenmpxDJxkyZ2pr8k/0UfT23fdTCU=; b=HMgfcToT+99atd0bEiOKT3uanwqjHO/q5VjUGAtCm8HErnMups9azwMX8fcFcKdIQl 6lyWoxMdiAxsrjuZTTGn98YG1dCeeQRiGOqr6gcjASDjukONjjHPxvtsQfhUiVcBIDcY EhtHaUF0BIw8TWhppvIrNxdkl48e7fD9VY+rn6oEwpktSkLwEeiq5G3B+KIle89b2Q8+ UTI0aXxydtrWn6JMb2tGM/tdzMRShsIpVFgravjjptsWm3WaWZxCU1BvlU75zWFr2llR vNltpYb/766oVwx5ICst7gjtM02ZNO79qA822hHN0W0MyEPHUzfKsTiIWeX3RXkHxh+8 wmxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687339874; x=1689931874; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=r9i7Uk9aCK3lESxenmpxDJxkyZ2pr8k/0UfT23fdTCU=; b=kLDFXVkVSdTw3VzbChcBPDZq6/jCflqhHKXwpmFzbByHJbdXvQlQnGyel/5mAMkPjZ un/sesB+w86GUBZYQn2qFZ8qV/MDZm3uUcFHKnMy7Hu+iuap2e0MNKNRtAlRjOg77uq5 xggiNtKtn1KYXcGeBYF2g6A3T2cktuZri8W/He1DG7rzW/PgUa8JP7oMDsm0D1hI4Pzw yY6XkZwOJC5Pgl5CICx0SglKZCSXk5k5QN4CyVjN7S/fiw5N7ZP53o9wevlMhkteT6yA qiCOp7+S8+EaSKLnaK1kSemGpkdnojWn6rGmQGNWES9Nxi7gV9m298hChGcNjbxgn1Ue eqpg== X-Gm-Message-State: AC+VfDz5l3uLeEhjEmwC6f3iq91RJN36nGRzmT7um/3UcCz9pZ6ItDNu 0r0Gc1rLxNx4jXPZ6RNX4ZYflg== X-Received: by 2002:adf:e489:0:b0:311:d3c:df0 with SMTP id i9-20020adfe489000000b003110d3c0df0mr9514734wrm.43.1687339874666; Wed, 21 Jun 2023 02:31:14 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b002fe96f0b3acsm3977344wrs.63.2023.06.21.02.31.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:31:14 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v2 5/6] can: tcan4x5x: Add support for tcan4552/4553 Date: Wed, 21 Jun 2023 11:31:02 +0200 Message-Id: <20230621093103.3134655-6-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621093103.3134655-1-msp@baylibre.com> References: <20230621093103.3134655-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769306065146104257?= X-GMAIL-MSGID: =?utf-8?q?1769306065146104257?= tcan4552 and tcan4553 do not have wake or state pins, so they are currently not compatible with the generic driver. The generic driver uses tcan4x5x_disable_state() and tcan4x5x_disable_wake() if the gpios are not defined. These functions use register bits that are not available in tcan4552/4553. This patch adds support by introducing version information to reflect if the chip has wake and state pins. Also the version is now checked. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/tcan4x5x-core.c | 128 +++++++++++++++++++++----- 1 file changed, 104 insertions(+), 24 deletions(-) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index fb9375fa20ec..756acd122075 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -7,6 +7,7 @@ #define TCAN4X5X_EXT_CLK_DEF 40000000 #define TCAN4X5X_DEV_ID1 0x00 +#define TCAN4X5X_DEV_ID1_TCAN 0x4e414354 /* ASCII TCAN */ #define TCAN4X5X_DEV_ID2 0x04 #define TCAN4X5X_REV 0x08 #define TCAN4X5X_STATUS 0x0C @@ -103,6 +104,13 @@ #define TCAN4X5X_WD_3_S_TIMER BIT(29) #define TCAN4X5X_WD_6_S_TIMER (BIT(28) | BIT(29)) +struct tcan4x5x_version_info { + u32 id2_register; + + bool has_wake_pin; + bool has_state_pin; +}; + static inline struct tcan4x5x_priv *cdev_to_priv(struct m_can_classdev *cdev) { return container_of(cdev, struct tcan4x5x_priv, cdev); @@ -254,18 +262,68 @@ static int tcan4x5x_disable_state(struct m_can_classdev *cdev) TCAN4X5X_DISABLE_INH_MSK, 0x01); } -static int tcan4x5x_get_gpios(struct m_can_classdev *cdev) +static const struct tcan4x5x_version_info tcan4x5x_generic; +static const struct of_device_id tcan4x5x_of_match[]; + +static const struct tcan4x5x_version_info +*tcan4x5x_find_version_info(struct tcan4x5x_priv *priv, u32 id2_value) +{ + for (int i = 0; tcan4x5x_of_match[i].data; ++i) { + const struct tcan4x5x_version_info *vinfo = + tcan4x5x_of_match[i].data; + if (!vinfo->id2_register || id2_value == vinfo->id2_register) { + dev_warn(&priv->spi->dev, "TCAN device is %s, please use it in DT\n", + tcan4x5x_of_match[i].compatible); + return vinfo; + } + } + + return &tcan4x5x_generic; +} + +static int tcan4x5x_verify_version(struct tcan4x5x_priv *priv, + const struct tcan4x5x_version_info **info) +{ + u32 val; + int ret; + + ret = regmap_read(priv->regmap, TCAN4X5X_DEV_ID1, &val); + if (ret) + return ret; + + if (val != TCAN4X5X_DEV_ID1_TCAN) { + dev_err(&priv->spi->dev, "Not a tcan device %x\n", val); + return -ENODEV; + } + + if (!(*info)->id2_register) + return 0; + + ret = regmap_read(priv->regmap, TCAN4X5X_DEV_ID2, &val); + if (ret) + return ret; + + if ((*info)->id2_register != val) + *info = tcan4x5x_find_version_info(priv, val); + + return 0; +} + +static int tcan4x5x_get_gpios(struct m_can_classdev *cdev, + const struct tcan4x5x_version_info *version_info) { struct tcan4x5x_priv *tcan4x5x = cdev_to_priv(cdev); int ret; - tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", - GPIOD_OUT_HIGH); - if (IS_ERR(tcan4x5x->device_wake_gpio)) { - if (PTR_ERR(tcan4x5x->device_wake_gpio) == -EPROBE_DEFER) - return -EPROBE_DEFER; + if (version_info->has_wake_pin) { + tcan4x5x->device_wake_gpio = devm_gpiod_get(cdev->dev, "device-wake", + GPIOD_OUT_HIGH); + if (IS_ERR(tcan4x5x->device_wake_gpio)) { + if (PTR_ERR(tcan4x5x->device_wake_gpio) == -EPROBE_DEFER) + return -EPROBE_DEFER; - tcan4x5x_disable_wake(cdev); + tcan4x5x_disable_wake(cdev); + } } tcan4x5x->reset_gpio = devm_gpiod_get_optional(cdev->dev, "reset", @@ -277,12 +335,14 @@ static int tcan4x5x_get_gpios(struct m_can_classdev *cdev) if (ret) return ret; - tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, - "device-state", - GPIOD_IN); - if (IS_ERR(tcan4x5x->device_state_gpio)) { - tcan4x5x->device_state_gpio = NULL; - tcan4x5x_disable_state(cdev); + if (version_info->has_state_pin) { + tcan4x5x->device_state_gpio = devm_gpiod_get_optional(cdev->dev, + "device-state", + GPIOD_IN); + if (IS_ERR(tcan4x5x->device_state_gpio)) { + tcan4x5x->device_state_gpio = NULL; + tcan4x5x_disable_state(cdev); + } } return 0; @@ -299,10 +359,15 @@ static struct m_can_ops tcan4x5x_ops = { static int tcan4x5x_can_probe(struct spi_device *spi) { + const struct tcan4x5x_version_info *version_info; struct tcan4x5x_priv *priv; struct m_can_classdev *mcan_class; int freq, ret; + version_info = of_device_get_match_data(&spi->dev); + if (!version_info) + version_info = (void *)spi_get_device_id(spi)->driver_data; + mcan_class = m_can_class_allocate_dev(&spi->dev, sizeof(struct tcan4x5x_priv)); if (!mcan_class) @@ -361,7 +426,11 @@ static int tcan4x5x_can_probe(struct spi_device *spi) if (ret) goto out_m_can_class_free_dev; - ret = tcan4x5x_get_gpios(mcan_class); + ret = tcan4x5x_verify_version(priv, &version_info); + if (ret) + goto out_power; + + ret = tcan4x5x_get_gpios(mcan_class, version_info); if (ret) goto out_power; @@ -394,21 +463,32 @@ static void tcan4x5x_can_remove(struct spi_device *spi) m_can_class_free_dev(priv->cdev.net); } +static const struct tcan4x5x_version_info tcan4x5x_generic = { + .has_state_pin = true, + .has_wake_pin = true, +}; + +static const struct tcan4x5x_version_info tcan4x5x_tcan4552 = { + .id2_register = 0x32353534, /* ASCII = 4552 */ +}; + +static const struct tcan4x5x_version_info tcan4x5x_tcan4553 = { + .id2_register = 0x33353534, /* ASCII = 4553 */ +}; + static const struct of_device_id tcan4x5x_of_match[] = { - { - .compatible = "ti,tcan4x5x", - }, { - /* sentinel */ - }, + { .compatible = "ti,tcan4552", .data = &tcan4x5x_tcan4552 }, + { .compatible = "ti,tcan4553", .data = &tcan4x5x_tcan4553 }, + { .compatible = "ti,tcan4x5x", .data = &tcan4x5x_generic }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, tcan4x5x_of_match); static const struct spi_device_id tcan4x5x_id_table[] = { - { - .name = "tcan4x5x", - }, { - /* sentinel */ - }, + { .name = "tcan4x5x", .driver_data = (unsigned long)&tcan4x5x_generic, }, + { .name = "tcan4552", .driver_data = (unsigned long)&tcan4x5x_tcan4552, }, + { .name = "tcan4553", .driver_data = (unsigned long)&tcan4x5x_tcan4553, }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(spi, tcan4x5x_id_table); From patchwork Wed Jun 21 09:31:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Schneider-Pargmann X-Patchwork-Id: 110958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp4253956vqr; Wed, 21 Jun 2023 03:16:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4/NKxKSEeDWTujJ0/Y9BDHr6BXD3fsvK5XwNCOB6OPBgy7B0hnwYi+ArCfmQidZQ9DIl1h X-Received: by 2002:a05:6a20:734e:b0:10c:dd4f:faa7 with SMTP id v14-20020a056a20734e00b0010cdd4ffaa7mr15348600pzc.1.1687342605582; Wed, 21 Jun 2023 03:16:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687342605; cv=none; d=google.com; s=arc-20160816; b=kkDLvqvfJ1kRmWP5+jE7/Y9TTsDJPk4Nk9I7mJ4n/C5Ox9zCGxic7HCsx5hxLLQSuu npLMOG40iQhcOF65KtB9ZnuQ4INwy5VIOx7TzeuFuFR6ozKAY/+z6hPuk/V8lbvy9pNO e0e3AdSnVCxLLvmDlNyYchoKZLXiZvLeAEcBrYeGaOtHMetBKX4jbr7IFc0O0lCjxUen f6shaz7kKREoubQRZY0oj2dicBTYUeMOaeGZ6M8OeJehc0mmFbmzsUj8/8DXX/4BVy4L /hE/x+ynFy3MFVmoXGMuZlo1rIkf0FSaJWdRxt4EMI/pyT63wRwKTw5jzYWu3WCSaIz4 ep3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iCNYj/86/5sdpI0dqVl7psoKKhFSLSkxZDdeHiB+vfs=; b=gNs4yUFiE03SvPlVuIOCZt/wQ+RkOpGsGKUMw8jEq1YtW5kcLqQXrHzhgacwoUjYQ6 elpLkjK4ikRLyrsrZ6EiODwuroOBImSRQxq2U1mI158DJs8Ztcs252pNqXXuCFfNT1jX XfFVdrmEV8dXHVccbjBNQBNq6SUmWZxlLdL/jfX5PZHNpSBhS4SOq81cCDDsrYJTeNuw Km5yoaWzVFlDHN90pDisRuWS2lQSmGDLpnv/DMoV7ZWrq5kbTDc0n/BbnY7yyGSuww7G PSdl6fuAjGskjiTCd6EvZaScCNZiNDbxZHecqahWx4mG1Qi7ot8oaM1RzhbEzvPQ1+Qw C2WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=zKBvUDeu; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l17-20020a637011000000b005533ded45c5si4093638pgc.17.2023.06.21.03.16.33; Wed, 21 Jun 2023 03:16:45 -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; dkim=pass header.i=@baylibre-com.20221208.gappssmtp.com header.s=20221208 header.b=zKBvUDeu; 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 S229803AbjFUJc6 (ORCPT + 99 others); Wed, 21 Jun 2023 05:32:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231366AbjFUJbc (ORCPT ); Wed, 21 Jun 2023 05:31:32 -0400 Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 477DC19B6 for ; Wed, 21 Jun 2023 02:31:17 -0700 (PDT) Received: by mail-wm1-x330.google.com with SMTP id 5b1f17b1804b1-3f9c2913133so2871495e9.1 for ; Wed, 21 Jun 2023 02:31:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20221208.gappssmtp.com; s=20221208; t=1687339876; x=1689931876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iCNYj/86/5sdpI0dqVl7psoKKhFSLSkxZDdeHiB+vfs=; b=zKBvUDeuh/AFGKGg1KW0cPS/Z+YJwgyTetO5WMcCNXlsdpA6DjdA+JCVw45yfuzOQ7 +ggePlPV3BBZnFVirubbyFlazU9n8ZAQj0zkNJ/DD+8+2atf/UTfto6Um/z+4M4Zq6B9 EjBubPtKj/umzTqO5cGA7NrHohxZE4BCTl1MBpXkc8BnPRZwr9YUtV/s4CYuyxjCbokc P5vyN9h0L5kRalzYsd99rB177VmsDdNE8fI4EFcRb8+b6tJOlJ8DZiTvy3pnH0pRaWcZ tHRdrkMTSwHYtYfyih96fQ+/L8iuf0mZH0mZ5GaI7ysumftvk8TaZMPd5kO9ke+Ysz0U X8aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687339876; x=1689931876; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iCNYj/86/5sdpI0dqVl7psoKKhFSLSkxZDdeHiB+vfs=; b=GRQp2yFpvayDgr+E+/BaD0Pkt3fujgBD17VMDX9PKA6jGHRtXQyzn0bRvf2+4W0vyM 3XZQJ5SouyRj0YZ4M0NeHomNBbqdhbI1eUn1W8KSXc1BZdXgeUhMumnAWFnQ29NSQYiZ OgeW6jrzNrrlSY+9ZygVz9zpXB2Thl3xC2sgoel5LMnIaoMXluHn3y4iofAIqjWSkBWq Nd35ORuOipKhDwmCLrXd7oNLnpRIwpCqNchPYr8C2hYW1tFaeT6R/cxuBCL1Yf5nPRMR 9RRBY0iOUgIlgcZ0WEXbjd6hPVrhVEW+3JrdIvPRuRU3gG8m2nGshOVxFzvgqWTZwrBW VJuA== X-Gm-Message-State: AC+VfDz9JIPh1C+OkERCfl5d//mul6FOqHwa4Szz1mqskVNAU5deBHav zsQEyTdwpO/0TX7wOQtucUgBMA== X-Received: by 2002:a05:600c:248:b0:3f9:b3b4:4367 with SMTP id 8-20020a05600c024800b003f9b3b44367mr5036089wmj.15.1687339875812; Wed, 21 Jun 2023 02:31:15 -0700 (PDT) Received: from blmsp.fritz.box ([2001:4091:a247:82fa:b762:4f68:e1ed:5041]) by smtp.gmail.com with ESMTPSA id t10-20020a5d49ca000000b002fe96f0b3acsm3977344wrs.63.2023.06.21.02.31.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 02:31:15 -0700 (PDT) From: Markus Schneider-Pargmann To: Wolfgang Grandegger , Marc Kleine-Budde , Rob Herring , Krzysztof Kozlowski Cc: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Conor Dooley , Chandrasekar Ramakrishnan , Michal Kubiak , Vivek Yadav , linux-can@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman , Markus Schneider-Pargmann Subject: [PATCH v2 6/6] can: tcan4x5x: Add error messages in probe Date: Wed, 21 Jun 2023 11:31:03 +0200 Message-Id: <20230621093103.3134655-7-msp@baylibre.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621093103.3134655-1-msp@baylibre.com> References: <20230621093103.3134655-1-msp@baylibre.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769306959827653373?= X-GMAIL-MSGID: =?utf-8?q?1769306959827653373?= To be able to understand issues during probe easier, add error messages if something fails. Signed-off-by: Markus Schneider-Pargmann --- drivers/net/can/m_can/tcan4x5x-core.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/net/can/m_can/tcan4x5x-core.c b/drivers/net/can/m_can/tcan4x5x-core.c index 756acd122075..e30faa1cf893 100644 --- a/drivers/net/can/m_can/tcan4x5x-core.c +++ b/drivers/net/can/m_can/tcan4x5x-core.c @@ -397,6 +397,8 @@ static int tcan4x5x_can_probe(struct spi_device *spi) /* Sanity check */ if (freq < 20000000 || freq > TCAN4X5X_EXT_CLK_DEF) { + dev_err(&spi->dev, "Clock frequency is out of supported range %d\n", + freq); ret = -ERANGE; goto out_m_can_class_free_dev; } @@ -415,32 +417,44 @@ static int tcan4x5x_can_probe(struct spi_device *spi) /* Configure the SPI bus */ spi->bits_per_word = 8; ret = spi_setup(spi); - if (ret) + if (ret) { + dev_err(&spi->dev, "SPI setup failed %d\n", ret); goto out_m_can_class_free_dev; + } ret = tcan4x5x_regmap_init(priv); - if (ret) + if (ret) { + dev_err(&spi->dev, "regmap init failed %d\n", ret); goto out_m_can_class_free_dev; + } ret = tcan4x5x_power_enable(priv->power, 1); - if (ret) + if (ret) { + dev_err(&spi->dev, "Enabling regulator failed %d\n", ret); goto out_m_can_class_free_dev; + } ret = tcan4x5x_verify_version(priv, &version_info); if (ret) goto out_power; ret = tcan4x5x_get_gpios(mcan_class, version_info); - if (ret) + if (ret) { + dev_err(&spi->dev, "Getting gpios failed %d\n", ret); goto out_power; + } ret = tcan4x5x_init(mcan_class); - if (ret) + if (ret) { + dev_err(&spi->dev, "tcan initialization failed %d\n", ret); goto out_power; + } ret = m_can_class_register(mcan_class); - if (ret) + if (ret) { + dev_err(&spi->dev, "Failed registering m_can device %d\n", ret); goto out_power; + } netdev_info(mcan_class->net, "TCAN4X5X successfully initialized.\n"); return 0;