From patchwork Mon May 6 05:59:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Herburger X-Patchwork-Id: 13654969 X-Patchwork-Delegate: kuba@kernel.org Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A95D947F4A; Mon, 6 May 2024 06:00:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975210; cv=none; b=imjSvUPssesB6a4akkioBXdpb/yrOprx52HaqUdQ3ePRgGnBJepxWARZx8RZKJXuQ9Wltq2b/s5+aq730UKfILOAyoj3p9BMNLOQG94f1wHycq9bqfIMXjqCn9eCOXRKGbcThjOfe7JkOOO9MJjJbB4qVvpRhKssu4Wrnp25J74= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975210; c=relaxed/simple; bh=MPRjo3xSqwSZ3ODY9ZbYTjHgadAb+Mo9aZdSRQIKs7k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RU6dxMQkFIuHlc9wKoEd7nKlVeHTF1q6ckRwwipr31caHofxYEOcQWK+KwM+M7lv9lVh6GHZL44CuL9gP0oyPcylke6+D1xeK7i7Kvquu8hygp+pBuDbFwKxTe6ZL/JpZ0eCjvDLgb2YUaL3CZsftrnWLSZ996zUHkO+h5H+T5o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=kWwGrPib; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=ZQ1ozOPs reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="kWwGrPib"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="ZQ1ozOPs" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1714975207; x=1746511207; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=WajCcGPR+XaLVy0+/PLXqXPoOJ+RABV89d9ErK4h1rw=; b=kWwGrPibIoIUljlICVDOjzF4KktMGdTcOEXUBeNANMynjmtH9GCqAchK bGpnm6bC44vXvQ7cvwm0hrdXmJQvEfE0kkvMUfv3zTPfux+GIz9XW2iUt TW6QdqnyjbowRpwaYjungk64ooZdQvid0uIycehJ/cc3dIDaN/XgmVWsF mAC1M9k/SeidDYbnlWcz2s18jwbjn8RiN5JZ9Te3WGHKTF3Hy8ZMG5O1w /76hwFt0xA2BfQGodFmT5tXo3KecLS55Z7bJ0B7LEvxrK9sFXLee2ULuM DXSHZftEneFjsY4Gof322WKNIbKUPjRt9V2reb07FRcfFcbgkF3LFVPe4 Q==; X-CSE-ConnectionGUID: 1j21jt35T0GDXonLDJC10g== X-CSE-MsgGUID: V5N8EoOdRkG1nuUySIf0Uw== X-IronPort-AV: E=Sophos;i="6.07,257,1708383600"; d="scan'208";a="36751417" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 06 May 2024 07:59:59 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id EDDE5176087; Mon, 6 May 2024 07:59:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1714975195; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=WajCcGPR+XaLVy0+/PLXqXPoOJ+RABV89d9ErK4h1rw=; b=ZQ1ozOPszUzyO5NFashdlmaG62d/kfs2JjFzkhH/nqVenZc02N0uuoDkSqctyA/dluFWb+ 1EROpPxeefuHYFL6CJGHWgvWV+BvRxv6Hmgfb1+nWHf0iREfmSFa6DqiLOk5DX6d3cydX5 /yQ6gXPjeGn2GDOwKDo9jH5jntV5vRkuv4pAh1acx/TV2QjiPs5a04Mo3gzyUPCmK1gwZ3 hWuIUhcwspFjX4KfWTSt3h6/9HWJWP0hQOjXRPmw4EZ024/4/9teK/+o538BqUo6csH9PO f69KMxkldPE8KBm1oh9SAReBQmPplTBO155Yw0AyBu3D6TT7bS6AL4vUmU5d3A== From: Gregor Herburger Date: Mon, 06 May 2024 07:59:43 +0200 Subject: [PATCH v2 1/6] can: mcp251xfd: properly indent labels Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240506-mcp251xfd-gpio-feature-v2-1-615b16fa8789@ew.tq-group.com> References: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> In-Reply-To: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> To: Marc Kleine-Budde , Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, gregor.herburger@ew.tq-group.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714975188; l=5033; i=gregor.herburger@ew.tq-group.com; s=20230829; h=from:subject:message-id; bh=gO6/5ijSzXnepRokXmTnWbPe921o+sFsXHZ3i0oOKek=; b=HB7n4dA6mRzbuUhF6y9LcEDXwB+DfzRQ1kmF99O+6aHI/g0Ttp1zSGEl8V0f+VMY6yvi6RyHR ilyIlcJBc+QAQ8O5Bmis4/cdu2nI9LwjxhYIeY8TFs6DzVDZRHzN+yU X-Developer-Key: i=gregor.herburger@ew.tq-group.com; a=ed25519; pk=+eRxwX7ikXwazcRjlOjj2/tbDmfVZdDLoW+xLZbQ4h4= X-Last-TLS-Session-Version: TLSv1.3 X-Patchwork-Delegate: kuba@kernel.org From: Marc Kleine-Budde To fix the coding style, remove the whitespace in front of labels. Signed-off-by: Marc Kleine-Budde --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 32 ++++++++++++------------ drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c | 2 +- drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c | 2 +- drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c | 2 +- drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index 1d9057dc44f2..e3c791f562d2 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -791,7 +791,7 @@ static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv) return 0; - out_chip_stop: +out_chip_stop: mcp251xfd_dump(priv); mcp251xfd_chip_stop(priv, CAN_STATE_STOPPED); @@ -1576,7 +1576,7 @@ static irqreturn_t mcp251xfd_irq(int irq, void *dev_id) handled = IRQ_HANDLED; } while (1); - out_fail: +out_fail: can_rx_offload_threaded_irq_finish(&priv->offload); netdev_err(priv->ndev, "IRQ handler returned %d (intf=0x%08x).\n", @@ -1632,20 +1632,20 @@ static int mcp251xfd_open(struct net_device *ndev) return 0; - out_free_irq: +out_free_irq: free_irq(spi->irq, priv); - out_can_rx_offload_disable: +out_can_rx_offload_disable: can_rx_offload_disable(&priv->offload); set_bit(MCP251XFD_FLAGS_DOWN, priv->flags); mcp251xfd_timestamp_stop(priv); - out_transceiver_disable: +out_transceiver_disable: mcp251xfd_transceiver_disable(priv); - out_mcp251xfd_ring_free: +out_mcp251xfd_ring_free: mcp251xfd_ring_free(priv); - out_pm_runtime_put: +out_pm_runtime_put: mcp251xfd_chip_stop(priv, CAN_STATE_STOPPED); pm_runtime_put(ndev->dev.parent); - out_close_candev: +out_close_candev: close_candev(ndev); return err; @@ -1808,9 +1808,9 @@ mcp251xfd_register_get_dev_id(const struct mcp251xfd_priv *priv, u32 *dev_id, *effective_speed_hz_slow = xfer[0].effective_speed_hz; *effective_speed_hz_fast = xfer[1].effective_speed_hz; - out_kfree_buf_tx: +out_kfree_buf_tx: kfree(buf_tx); - out_kfree_buf_rx: +out_kfree_buf_rx: kfree(buf_rx); return err; @@ -1924,13 +1924,13 @@ static int mcp251xfd_register(struct mcp251xfd_priv *priv) return 0; - out_unregister_candev: +out_unregister_candev: unregister_candev(ndev); - out_chip_sleep: +out_chip_sleep: mcp251xfd_chip_sleep(priv); - out_runtime_disable: +out_runtime_disable: pm_runtime_disable(ndev->dev.parent); - out_runtime_put_noidle: +out_runtime_put_noidle: pm_runtime_put_noidle(ndev->dev.parent); mcp251xfd_clks_and_vdd_disable(priv); @@ -2150,9 +2150,9 @@ static int mcp251xfd_probe(struct spi_device *spi) return 0; - out_can_rx_offload_del: +out_can_rx_offload_del: can_rx_offload_del(&priv->offload); - out_free_candev: +out_free_candev: spi->max_speed_hz = priv->spi_max_speed_hz_orig; free_candev(ndev); diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c index 004eaf96262b..050321345304 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-dump.c @@ -94,7 +94,7 @@ static void mcp251xfd_dump_registers(const struct mcp251xfd_priv *priv, kfree(buf); } - out: +out: mcp251xfd_dump_header(iter, MCP251XFD_DUMP_OBJECT_TYPE_REG, reg); } diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c index 92b7bc7f14b9..65150e762007 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c @@ -397,7 +397,7 @@ mcp251xfd_regmap_crc_read(void *context, return err; } - out: +out: memcpy(val_buf, buf_rx->data, val_len); return 0; diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c index e5bd57b65aaf..ee7028c027b5 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tef.c @@ -216,7 +216,7 @@ int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv) total_frame_len += frame_len; } - out_netif_wake_queue: +out_netif_wake_queue: len = i; /* number of handled goods TEFs */ if (len) { struct mcp251xfd_tef_ring *ring = priv->tef; diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c index 160528d3cc26..9d81eeb98432 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-tx.c @@ -198,7 +198,7 @@ netdev_tx_t mcp251xfd_start_xmit(struct sk_buff *skb, return NETDEV_TX_OK; - out_err: +out_err: netdev_err(priv->ndev, "ERROR in %s: %d\n", __func__, err); return NETDEV_TX_OK; From patchwork Mon May 6 05:59:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Herburger X-Patchwork-Id: 13654970 X-Patchwork-Delegate: kuba@kernel.org Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9C224AEE6; Mon, 6 May 2024 06:00:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975212; cv=none; b=fFWfJ4Zx7cxdT/kGchjwZ7fapEKs+5jIGzuRxZpSaJrlxH7U0JsG0wn/Qt5+UYrxsEgcjwFxhHJHdRSIR1K3AuU3XyJ4/nwct7c9Az0YzGxP2S8d6EiXfInDpyC2ct9IkQu0cW8tbiSsrcAZrkbmL9vylnEjjGHFuIFbYN6d/Ww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975212; c=relaxed/simple; bh=+Qveyuu1v4FvIUSFlIEA/3OG3zhEu/ongopJVNgfTKs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jnHwuSF+FIBfKmxr2BCGLmE+N0Qxwh6HbkCJ3QHFG+qL03F0HhrwY2kO6rNxTi654TyT/8xHFT+4YcAs+IGUDSF9NiAdMSCEhq5Vz63XuEr9k9nt5Qr10gPd7UmfQQqHoJDP5Pz//LMrnyom+GdtD7I+/9+DLv/R7GfbMdFFlOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=dn1OdOHy; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=ZaKSeGAg reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="dn1OdOHy"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="ZaKSeGAg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1714975209; x=1746511209; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=OBGFkZtBUY6CLcCH997A3eA6xZRxVGzOp58tM2v/Y8w=; b=dn1OdOHyO65A63YXB7qGFNDtf7mXerqDCtfh0eVikAeClB5aYQHTfbVw tJ1ikZLFZY9AR1dbvd6vkmhPda2UFWreVukwwxWVr4JpIrkaXwTTwIKls A8dFfQ+HofE4Zv/U0AjP0PEtxZKnMmiZmusU/gHIdxi4XJXIWlIoWXlfC 64rKfQFGl3TZ9ZUz2UWCW+Zd/weEh1v8za42lupjf07hsryCYuWps0PVv dR9NqogQZ9qcXFPVg8P2YP9dpuSokWyR5bbbaExvhyRw7QgEU7IcWrcGn NmNGyTZ/o+L35+m2Egufnx0VdnfsuNASN45nnoTaFePQ8+aT9eEuaF3NU w==; X-CSE-ConnectionGUID: sgBXbvymT4y4igDa5k0Jyw== X-CSE-MsgGUID: V/d2EelCSA6NHRq6xiLK3w== X-IronPort-AV: E=Sophos;i="6.07,257,1708383600"; d="scan'208";a="36751423" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 06 May 2024 08:00:04 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 7BA0A173CC9; Mon, 6 May 2024 07:59:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1714975200; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=OBGFkZtBUY6CLcCH997A3eA6xZRxVGzOp58tM2v/Y8w=; b=ZaKSeGAgjc16OMLdTm8ytJj47Vn3ZQHARvmtURcBEdpq3fYcKJzzUtWPjp8rwgilKnTlY8 pSBRcgIHl//GbCrd3+ndX/QytXC+CGaf9vamwX0BoD5q6aQQJHQE2h4zmD3rGVeHRJ203R whq9V5dt6sOIPSg9rkke6dRuoOdeALdHPdk2YPqLTMAHZtKbfg+q2HIBqc88ZUxeGef+EC WwP0PgZTCYYWb8alg7ClkicNHbPQiCHFkQqKDMgMVHCwNF+aaJCl0x/OKz1XBre5Vx39// ytwI3YTn46u9ZHlBcmxH8JHtONsJO76BAwIrpngNjgnqPGkaxYyDSs0IkUVZ+g== From: Gregor Herburger Date: Mon, 06 May 2024 07:59:44 +0200 Subject: [PATCH v2 2/6] can: mcp251xfd: move mcp251xfd_timestamp_start()/stop() into mcp251xfd_chip_start/stop() Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240506-mcp251xfd-gpio-feature-v2-2-615b16fa8789@ew.tq-group.com> References: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> In-Reply-To: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> To: Marc Kleine-Budde , Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, gregor.herburger@ew.tq-group.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714975188; l=4143; i=gregor.herburger@ew.tq-group.com; s=20230829; h=from:subject:message-id; bh=5MNSUMJdhUcvqjyxAlN8mXO8gFpKVp+awDVJ/95Fxcc=; b=IhuWCKnDnD8tF2eOnbfbBclnTuuXZ8LjNKc1iuG79DCBOyX+R1jlJfhqj7z28uHpgsIRTUr5Q XO6Gy/YRZBFBYFSAvMlYXthbMb0+jkH161g2W11+LPVysM6UPV9FFGd X-Developer-Key: i=gregor.herburger@ew.tq-group.com; a=ed25519; pk=+eRxwX7ikXwazcRjlOjj2/tbDmfVZdDLoW+xLZbQ4h4= X-Last-TLS-Session-Version: TLSv1.3 X-Patchwork-Delegate: kuba@kernel.org From: Marc Kleine-Budde The mcp251xfd wakes up from Low Power or Sleep Mode when SPI activity is detected. To avoid this, make sure that the timestamp worker is stopped before shutting down the chip. Split the starting of the timestamp worker out of mcp251xfd_timestamp_init() into the separate function mcp251xfd_timestamp_start(). Call mcp251xfd_timestamp_init() before mcp251xfd_chip_start(), move mcp251xfd_timestamp_start() to mcp251xfd_chip_start(). In this way, mcp251xfd_timestamp_stop() can be called unconditionally by mcp251xfd_chip_stop(). Signed-off-by: Marc Kleine-Budde --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 8 +++++--- drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c | 7 +++++-- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index e3c791f562d2..4ae201426a46 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -744,6 +744,7 @@ static void mcp251xfd_chip_stop(struct mcp251xfd_priv *priv, mcp251xfd_chip_interrupts_disable(priv); mcp251xfd_chip_rx_int_disable(priv); + mcp251xfd_timestamp_stop(priv); mcp251xfd_chip_sleep(priv); } @@ -763,6 +764,8 @@ static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv) if (err) goto out_chip_stop; + mcp251xfd_timestamp_start(priv); + err = mcp251xfd_set_bittiming(priv); if (err) goto out_chip_stop; @@ -1610,11 +1613,12 @@ static int mcp251xfd_open(struct net_device *ndev) if (err) goto out_mcp251xfd_ring_free; + mcp251xfd_timestamp_init(priv); + err = mcp251xfd_chip_start(priv); if (err) goto out_transceiver_disable; - mcp251xfd_timestamp_init(priv); clear_bit(MCP251XFD_FLAGS_DOWN, priv->flags); can_rx_offload_enable(&priv->offload); @@ -1637,7 +1641,6 @@ static int mcp251xfd_open(struct net_device *ndev) out_can_rx_offload_disable: can_rx_offload_disable(&priv->offload); set_bit(MCP251XFD_FLAGS_DOWN, priv->flags); - mcp251xfd_timestamp_stop(priv); out_transceiver_disable: mcp251xfd_transceiver_disable(priv); out_mcp251xfd_ring_free: @@ -1662,7 +1665,6 @@ static int mcp251xfd_stop(struct net_device *ndev) mcp251xfd_chip_interrupts_disable(priv); free_irq(ndev->irq, priv); can_rx_offload_disable(&priv->offload); - mcp251xfd_timestamp_stop(priv); mcp251xfd_chip_stop(priv, CAN_STATE_STOPPED); mcp251xfd_transceiver_disable(priv); mcp251xfd_ring_free(priv); diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c index 712e09186987..7bbf4603038b 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-timestamp.c @@ -58,9 +58,12 @@ void mcp251xfd_timestamp_init(struct mcp251xfd_priv *priv) cc->shift = 1; cc->mult = clocksource_hz2mult(priv->can.clock.freq, cc->shift); - timecounter_init(&priv->tc, &priv->cc, ktime_get_real_ns()); - INIT_DELAYED_WORK(&priv->timestamp, mcp251xfd_timestamp_work); +} + +void mcp251xfd_timestamp_start(struct mcp251xfd_priv *priv) +{ + timecounter_init(&priv->tc, &priv->cc, ktime_get_real_ns()); schedule_delayed_work(&priv->timestamp, MCP251XFD_TIMESTAMP_WORK_DELAY_SEC * HZ); } diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h index 24510b3b8020..75d5a8a25415 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h @@ -950,6 +950,7 @@ int mcp251xfd_handle_tefif(struct mcp251xfd_priv *priv); void mcp251xfd_skb_set_timestamp(const struct mcp251xfd_priv *priv, struct sk_buff *skb, u32 timestamp); void mcp251xfd_timestamp_init(struct mcp251xfd_priv *priv); +void mcp251xfd_timestamp_start(struct mcp251xfd_priv *priv); void mcp251xfd_timestamp_stop(struct mcp251xfd_priv *priv); netdev_tx_t mcp251xfd_start_xmit(struct sk_buff *skb, From patchwork Mon May 6 05:59:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Herburger X-Patchwork-Id: 13654971 X-Patchwork-Delegate: kuba@kernel.org Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C5B9F4EB4C; Mon, 6 May 2024 06:00:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975213; cv=none; b=Dkjc2jgFMHkdeJIFXdkb3GAsqkrOHnMv4UCjV7x6U3I5ar1HbILbhgStp2wPkoPn/+FTqeUhsb6f+hBVX/ofoP1boCkYUbvjbACxgQD+FLY+NP1Ezosb8gHaWSyA45LGUYKVMH5iEGFX2KxwlwbHtsRw3H7St9RXE92Db/NGo/0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975213; c=relaxed/simple; bh=u0TscTqRVB+PaARLJJf9VxgcmIZJt6T9GhtInOa1pmE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=PQQ8tIZZdttx2swNEkPCQzz/q/yVr2ImiUbwm/Bz1+wXeV+Qve5wicYrme7MgXiat3m3mn7L9VppCJsmYD0xc+cYKIKB8noKakLunxzg1XBCatan8o/QaPflvY3LTRvYmdq85aItuzmYQxkfKEP/5+yqNzW8W3naB3hGM2xlCzI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=n2gwXd7V; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=HJYQwDy1 reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="n2gwXd7V"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="HJYQwDy1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1714975211; x=1746511211; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=6uFIYNjLjgqsV+0RlynG6403IRJSRImrwePI2LAt+58=; b=n2gwXd7VsKWbcXjMl1fTTmgtOGH3p1/8N+sBPgrGn6cgYc3LjmisDmgW o0lAnbtZamin2CVM5T+TKuC/KxPsISv1Sc8uTELhH52SMADHLElbIqmOG Z93AoEbm8guv6OxqGH9VJLDQu0k1lnlpldFxXOD1dWKRIuTn+0g/YF/Ny PQxnVioH4RaDSFx9rJpkzEF3PRZ5NUnIOk8CxmHtIAnn8l12sG9LBMYlt YlUmI/fSJHP38DcA5dZFNnuiCncOtKoeDF4+K2VNIZ2zgrFEAbBRt2+5E GUCQp3o6PqFEg3OHK6bKPpaE3EUjscyDBRlluM9a3biGVIyCnJiZ3VdpS A==; X-CSE-ConnectionGUID: tDB/3IjRQs+MI0zQEFaaLQ== X-CSE-MsgGUID: fvFBUf2nTmGXsEO1AJ+N9w== X-IronPort-AV: E=Sophos;i="6.07,257,1708383600"; d="scan'208";a="36751428" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 06 May 2024 08:00:09 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4249B1760EA; Mon, 6 May 2024 08:00:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1714975204; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=6uFIYNjLjgqsV+0RlynG6403IRJSRImrwePI2LAt+58=; b=HJYQwDy1TwkRQey7qqkBin5GWd2ftWauvXT93E70SvptGxNqSW/qiGBWRiHpFbuOs0Tf8N hRh965mF/w9+IruMGSN7CLmZ7hv9j54Sy5aPBvDe3AKMhnF8Ms+N7CpDBMxxvd4plkFvgL 914FytGuYZIg7Zwp+B6rl0hzAgw23Hc/+m9pvneTCHGZws7kfdgabH39txqp8Kvu3v6bCt W+8lACr1Ahix+ESnzX7ODJr5SttYbKOYlHV61r3OPyDEdLy0usENlgxur86/IuM3L2r/nP sqOh+wiofnZp4GGO73pDB+tcvYkRs9wD5P2//J30WBAqDkJgAC4gY96tP2xFbQ== From: Gregor Herburger Date: Mon, 06 May 2024 07:59:45 +0200 Subject: [PATCH v2 3/6] can: mcp251xfd: move chip sleep mode into runtime pm Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240506-mcp251xfd-gpio-feature-v2-3-615b16fa8789@ew.tq-group.com> References: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> In-Reply-To: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> To: Marc Kleine-Budde , Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, gregor.herburger@ew.tq-group.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714975188; l=6388; i=gregor.herburger@ew.tq-group.com; s=20230829; h=from:subject:message-id; bh=DRB9jsz/bqQMPMBVtSXa2ZhvPJdm2qGH29HGCGexllI=; b=eMElllRfKEDqO6OBtiNWH00apyDw0sjZ0YHBxYmhMoLkVR9r2DFo5l1uZk9XWXZ/sxjKbIBrT Y0C7kS1oB0sCqxIFKqibipQNPd38rc9cmFuHWn//NIcZKeEm3hihOd+ X-Developer-Key: i=gregor.herburger@ew.tq-group.com; a=ed25519; pk=+eRxwX7ikXwazcRjlOjj2/tbDmfVZdDLoW+xLZbQ4h4= X-Last-TLS-Session-Version: TLSv1.3 X-Patchwork-Delegate: kuba@kernel.org From: Marc Kleine-Budde This is a preparation patch to add GPIO support. Up to now, the Vdd regulator and the clocks have been managed by Runtime-PM (on systems without CONFIG_PM these remain permanently switched on). During the mcp251xfd_open() callback the mcp251xfd is powered, soft-reset and configured. In mcp251xfd_stop() the chip is shut down again. To support the on-chip GPIOs, the chip must be supplied with power while GPIOs are being requested, even if the networking interface ist down. To support this, move the functions mcp251xfd_chip_softreset() and mcp251xfd_chip_clock_init() from mcp251xfd_chip_start() to mcp251xfd_runtime_resume(). Instead of setting the controller to sleep mode in mcp251xfd_chip_stop(), bring it into configuration mode. This way it doesn't take part in bus activity and doesn't enter sleep mode. Signed-off-by: Marc Kleine-Budde --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 99 ++++++++++++++++---------- 1 file changed, 61 insertions(+), 38 deletions(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index 4ae201426a46..4739ad80ef2a 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -745,21 +745,13 @@ static void mcp251xfd_chip_stop(struct mcp251xfd_priv *priv, mcp251xfd_chip_interrupts_disable(priv); mcp251xfd_chip_rx_int_disable(priv); mcp251xfd_timestamp_stop(priv); - mcp251xfd_chip_sleep(priv); + mcp251xfd_chip_set_mode(priv, MCP251XFD_REG_CON_MODE_CONFIG); } static int mcp251xfd_chip_start(struct mcp251xfd_priv *priv) { int err; - err = mcp251xfd_chip_softreset(priv); - if (err) - goto out_chip_stop; - - err = mcp251xfd_chip_clock_init(priv); - if (err) - goto out_chip_stop; - err = mcp251xfd_chip_timestamp_init(priv); if (err) goto out_chip_stop; @@ -1602,8 +1594,11 @@ static int mcp251xfd_open(struct net_device *ndev) return err; err = pm_runtime_resume_and_get(ndev->dev.parent); - if (err) + if (err) { + if (err == -ETIMEDOUT || err == -ENODEV) + pm_runtime_set_suspended(ndev->dev.parent); goto out_close_candev; + } err = mcp251xfd_ring_alloc(priv); if (err) @@ -1872,53 +1867,53 @@ static int mcp251xfd_register(struct mcp251xfd_priv *priv) struct net_device *ndev = priv->ndev; int err; + mcp251xfd_register_quirks(priv); + err = mcp251xfd_clks_and_vdd_enable(priv); if (err) return err; + err = mcp251xfd_chip_softreset(priv); + if (err == -ENODEV) + goto out_clks_and_vdd_disable; + if (err) + goto out_chip_sleep; + + err = mcp251xfd_chip_clock_init(priv); + if (err == -ENODEV) + goto out_clks_and_vdd_disable; + if (err) + goto out_chip_sleep; + pm_runtime_get_noresume(ndev->dev.parent); err = pm_runtime_set_active(ndev->dev.parent); if (err) goto out_runtime_put_noidle; pm_runtime_enable(ndev->dev.parent); - mcp251xfd_register_quirks(priv); - - err = mcp251xfd_chip_softreset(priv); - if (err == -ENODEV) - goto out_runtime_disable; - if (err) - goto out_chip_sleep; - - err = mcp251xfd_chip_clock_init(priv); - if (err == -ENODEV) - goto out_runtime_disable; - if (err) - goto out_chip_sleep; - err = mcp251xfd_register_chip_detect(priv); if (err) - goto out_chip_sleep; + goto out_runtime_disable; err = mcp251xfd_register_check_rx_int(priv); if (err) - goto out_chip_sleep; + goto out_runtime_disable; mcp251xfd_ethtool_init(priv); err = register_candev(ndev); if (err) - goto out_chip_sleep; + goto out_runtime_disable; err = mcp251xfd_register_done(priv); if (err) goto out_unregister_candev; - /* Put controller into sleep mode and let pm_runtime_put() - * disable the clocks and vdd. If CONFIG_PM is not enabled, - * the clocks and vdd will stay powered. + /* Put controller into Config mode and let pm_runtime_put() + * put in sleep mode, disable the clocks and vdd. If CONFIG_PM + * is not enabled, the clocks and vdd will stay powered. */ - err = mcp251xfd_chip_sleep(priv); + err = mcp251xfd_chip_set_mode(priv, MCP251XFD_REG_CON_MODE_CONFIG); if (err) goto out_unregister_candev; @@ -1928,12 +1923,13 @@ static int mcp251xfd_register(struct mcp251xfd_priv *priv) out_unregister_candev: unregister_candev(ndev); -out_chip_sleep: - mcp251xfd_chip_sleep(priv); out_runtime_disable: pm_runtime_disable(ndev->dev.parent); out_runtime_put_noidle: pm_runtime_put_noidle(ndev->dev.parent); +out_chip_sleep: + mcp251xfd_chip_sleep(priv); +out_clks_and_vdd_disable: mcp251xfd_clks_and_vdd_disable(priv); return err; @@ -1945,10 +1941,12 @@ static inline void mcp251xfd_unregister(struct mcp251xfd_priv *priv) unregister_candev(ndev); - if (pm_runtime_enabled(ndev->dev.parent)) + if (pm_runtime_enabled(ndev->dev.parent)) { pm_runtime_disable(ndev->dev.parent); - else + } else { + mcp251xfd_chip_sleep(priv); mcp251xfd_clks_and_vdd_disable(priv); + } } static const struct of_device_id mcp251xfd_of_match[] = { @@ -2175,16 +2173,41 @@ static void mcp251xfd_remove(struct spi_device *spi) static int __maybe_unused mcp251xfd_runtime_suspend(struct device *device) { - const struct mcp251xfd_priv *priv = dev_get_drvdata(device); + struct mcp251xfd_priv *priv = dev_get_drvdata(device); + mcp251xfd_chip_sleep(priv); return mcp251xfd_clks_and_vdd_disable(priv); } static int __maybe_unused mcp251xfd_runtime_resume(struct device *device) { - const struct mcp251xfd_priv *priv = dev_get_drvdata(device); + struct mcp251xfd_priv *priv = dev_get_drvdata(device); + int err; - return mcp251xfd_clks_and_vdd_enable(priv); + err = mcp251xfd_clks_and_vdd_enable(priv); + if (err) + return err; + + err = mcp251xfd_chip_softreset(priv); + if (err == -ENODEV) + goto out_clks_and_vdd_disable; + if (err) + goto out_chip_sleep; + + err = mcp251xfd_chip_clock_init(priv); + if (err == -ENODEV) + goto out_clks_and_vdd_disable; + if (err) + goto out_chip_sleep; + + return 0; + +out_chip_sleep: + mcp251xfd_chip_sleep(priv); +out_clks_and_vdd_disable: + mcp251xfd_clks_and_vdd_disable(priv); + + return err; } static const struct dev_pm_ops mcp251xfd_pm_ops = { From patchwork Mon May 6 05:59:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Herburger X-Patchwork-Id: 13654972 X-Patchwork-Delegate: kuba@kernel.org Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14246140399; Mon, 6 May 2024 06:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975216; cv=none; b=ruKbrjPb307R8QpTu9HEsh+zB2tzpBNFlXeIv03JcotZCJaR3Sryhqd1FZp8N/KobXW5t6BTTZa1PexZ92xp/imYMR8qWS5BGuQpISQUS5ceAITPwJPx5HtdgZKo3yUguOfv1NNzbmr0eZZzopNcAZpPOCdu4cjqrTvY8+rMj+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975216; c=relaxed/simple; bh=P3Mk5PcWaUP6+Gg05tBidf+kKVuQMiV3cqlnF284O3Q=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WHaAu9Rv0Avvz0aDK/s3eZfIVXOy7EU1KF2t6iGT1CK3s04Z2q+O06D70x10ALnf0VOlfvjKq8r1Ad4b//gv2Y/oyIfZ4r6ZSNLJOHv65/xo4twj85Ve+014lMQM0l1PPMZDjBe5yi12C9WF+qgnTsbegRQ7rpFMPq2oRMFMpyQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=jfsTUgTg; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=TDMTAPzw reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="jfsTUgTg"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="TDMTAPzw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1714975214; x=1746511214; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=SYaQjnkNSCI9zkCW8eSDRCydILiZmUATxYlt6TM0kmc=; b=jfsTUgTgpbpLo5441zbj0L0UQV6TqK0hLUid4O2EEJ2xz6luvhON3a/3 ENzVoUqEkeD2pS6NN9/1Ptsrl1pt+a6QoP7si2rU7xMKzZHUkvRKVyvyc Hk1Hejljeuk39lke/A0s6ubhqsXpi5trkO5ETzADOwQP8i9QFlS4M5bS5 UwbtPFyppsef4P1Ynpb1xARAjrwixpl3aIiW0FngO5l0kma4XSM4L2BZh 9o6z81bGNtildQCWQjEOPDg+buSOIhjJwdxQ32FQ5EQhXov3q2/OiQrQo qmz3/nSzI5S/upy/YrPowWfVF2h424Icrdef0x4kdnVUSoNMqg2dtUqu5 w==; X-CSE-ConnectionGUID: U0H5sdNPTtqyvWWgQfGZJw== X-CSE-MsgGUID: 0NHtdPBoS5ixY7usv3UEgw== X-IronPort-AV: E=Sophos;i="6.07,257,1708383600"; d="scan'208";a="36751433" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 06 May 2024 08:00:13 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C32511760D9; Mon, 6 May 2024 08:00:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1714975209; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=SYaQjnkNSCI9zkCW8eSDRCydILiZmUATxYlt6TM0kmc=; b=TDMTAPzwXWqGh70t6UEY0kKIWbD4bUcAwXfgyblnhfi7QBnKWJj4feG27xWvB9l+ndvoSM QL57IZKc5bR4kYqLyfGvkCyBXVr2sforEzCBLlNEv/Y8xxnJIStjHiiIkF99/2jJ+xvl3I 9yqWIig1G5k2hPVTIPojkl6loQKFt/0er50B+pt27syNPxpmFAT/8jT7vrHbZttKgz99lL LQks9QleslPpuTjoYw3rS0o8tWWh46/DI6e0aSKjzi8JEO37fthsm234q3W3L+DHJDU+gN lrY1OCTImjMXTIFsup6MWLWsBxQ3l3rkWucafw6DWYQNiOoySfBjux7HqT8Pvw== From: Gregor Herburger Date: Mon, 06 May 2024 07:59:46 +0200 Subject: [PATCH v2 4/6] can: mcp251xfd: mcp251xfd_regmap_crc_write(): workaround for errata 5 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240506-mcp251xfd-gpio-feature-v2-4-615b16fa8789@ew.tq-group.com> References: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> In-Reply-To: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> To: Marc Kleine-Budde , Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, gregor.herburger@ew.tq-group.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714975188; l=2328; i=gregor.herburger@ew.tq-group.com; s=20230829; h=from:subject:message-id; bh=P3Mk5PcWaUP6+Gg05tBidf+kKVuQMiV3cqlnF284O3Q=; b=Vl2+Twm8j5RsvrhL+nbEqe4dNJvFb9F3+BQMZkmc/QN5cYeX3C1hsQNvpFTjs0koT7+On0BmO DvnZVX1JoZEAeI+Rv2Z1hadEFVlwYA6UDcCTOg1evnmQedPaSSFLtQk X-Developer-Key: i=gregor.herburger@ew.tq-group.com; a=ed25519; pk=+eRxwX7ikXwazcRjlOjj2/tbDmfVZdDLoW+xLZbQ4h4= X-Last-TLS-Session-Version: TLSv1.3 X-Patchwork-Delegate: kuba@kernel.org According to Errata DS80000789E 5 writing IOCON register using one SPI write command clears LAT0/LAT1. Errata Fix/Work Around suggests to write registers with single byte write instructions. However, it seems that every write to the second byte causes the overwrite of LAT0/LAT1. Never write byte 2 of IOCON register to avoid clearing of LAT0/LAT1. Signed-off-by: Gregor Herburger --- drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c | 29 +++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c index 65150e762007..43fcf7f50591 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-regmap.c @@ -229,14 +229,41 @@ mcp251xfd_regmap_crc_gather_write(void *context, return spi_sync_transfer(spi, xfer, ARRAY_SIZE(xfer)); } +static int mcp251xfd_regmap_crc_write_iocon(void *context, const void *data) +{ + u16 reg = MCP251XFD_REG_IOCON; + + /* Never write to bits 16..23 of IOCON register to avoid clearing of LAT0/LAT1 + * + * According to Errata DS80000789E 5 writing IOCON register using one + * SPI write command clears LAT0/LAT1. + * + * Errata Fix/Work Around suggests to write registers with single byte + * write instructions. However, it seems that the byte at 0xe06(IOCON[23:16]) + * is for read-only access and writing to it causes the clearing of LAT0/LAT1. + */ + + /* Write IOCON[15:0] */ + mcp251xfd_regmap_crc_gather_write(context, ®, 1, data, 2); + reg += 3; + /* Write IOCON[31:24] */ + mcp251xfd_regmap_crc_gather_write(context, ®, 1, data + 3, 1); + + return 0; +} + static int mcp251xfd_regmap_crc_write(void *context, const void *data, size_t count) { const size_t data_offset = sizeof(__be16) + mcp251xfd_regmap_crc.pad_bits / BITS_PER_BYTE; + u16 reg = *(u16 *)data; - return mcp251xfd_regmap_crc_gather_write(context, + if (reg == MCP251XFD_REG_IOCON) + return mcp251xfd_regmap_crc_write_iocon(context, data + data_offset); + else + return mcp251xfd_regmap_crc_gather_write(context, data, data_offset, data + data_offset, count - data_offset); From patchwork Mon May 6 05:59:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Herburger X-Patchwork-Id: 13654973 X-Patchwork-Delegate: kuba@kernel.org Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 460164AEF7; Mon, 6 May 2024 06:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975223; cv=none; b=AX9L2dirMWpx2z1CR3ZWahlsyjAgcPB4bCQXp/pxzf6bBwM1Q03gN2+JXBHvdnS4HJwn1+W0QzxkSlNbHxXB9UE61yyr2pWAeEVlGpzr7SrwMOSwcG0WFeaV684rp87t2MQnfeRp4+HYAjTBca2GqdziLNfodqY7n4GJf89xGtY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975223; c=relaxed/simple; bh=zpReWPDWnJPZSQwgBcrBsplUbkSPT5bkXuwcoqiJqBQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hQul/R7U5kioTiI+2RDxXGL2lhyChiGeW5DsMLkZeOSynjrj5hgMoKipMrfFFiBwdadZBX6evrJwSzjyUprB7ZV09MHsrdnZLw7nIuneXcX4nN4oKVw6Wv2VTzezyA2K7V2q4tkc11xE+vQwz4uzktWU0sslzvQLVCwLy53i+Uo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=cRLHDwwN; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=K4FA/6j2 reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="cRLHDwwN"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="K4FA/6j2" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1714975221; x=1746511221; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=K1sB7lPF4/uybKuMuPZ9LkiESZoBBU5NzfBLROum6sU=; b=cRLHDwwNrqosoVWcYQr8IHc/XzwhRc0/gA5s75h09pZ7jE24/0cpcSmx JQTXtpXjbMvn1FP+oDFSgOJbBPnuqeVsQMsF19fuomxDtipfIJmHRI/XB TRu/OL/ZOwVGNz4AMazykTS9tkh5IX1oUaCWNFpVvsI5X+lY2KQA6UPPk RGTFqkgtNuu2J04w4dK0rXXAmuCZLEb/+8bnlauIE1k8tQ5l3RXBLsJep cYyVcOQCkSCV8kW2O0VnwcI/aC8zHiFQn1SJyb8ylSIzUVjdl0MkXXTLv Q5vYQhTsSMjeLSmoGMqMpgIHMFg3WZb2JLWT9+ZDWkiK94o7v+1v5rMbg g==; X-CSE-ConnectionGUID: pJ5CULIuTC2tWYCOi3ux9g== X-CSE-MsgGUID: 2ib0oUWRSg6MH36KZOJf1w== X-IronPort-AV: E=Sophos;i="6.07,257,1708383600"; d="scan'208";a="36751435" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 06 May 2024 08:00:18 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 52F1617014C; Mon, 6 May 2024 08:00:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1714975213; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=K1sB7lPF4/uybKuMuPZ9LkiESZoBBU5NzfBLROum6sU=; b=K4FA/6j2zJaRKN79OcbHg0pTAmez0iZnSFfvdOCJyb1fHUP9anUjCFaERLOhQA2aJBS+H7 KywpJEfStye7dpxbVKh7ZcA3lKiyjlu2WYdwYO5nDLzNvlJ+gr5IBKhaswkUlBmgiUJ0+z hVvoubmH1kVOetLq10w8h3Mp0lIdT1gEPU0d04MWsH4QvZ4a7KjeQX+4VRG8OpjzUtOCG3 xHQEqggC2cr4CuW57TEbOHOxwgH1MbZa9nGQFaBY8D4/rZSoExjg/kkWrT9sHpmF7TFxbb Lltgw1gRSdfAjF8Tw0RtKY3mlorpBGikOdkAA7Mor+L+jYtvlwrmAD1oGv9etA== From: Gregor Herburger Date: Mon, 06 May 2024 07:59:47 +0200 Subject: [PATCH v2 5/6] can: mcp251xfd: add gpio functionality Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240506-mcp251xfd-gpio-feature-v2-5-615b16fa8789@ew.tq-group.com> References: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> In-Reply-To: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> To: Marc Kleine-Budde , Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, gregor.herburger@ew.tq-group.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714975188; l=7313; i=gregor.herburger@ew.tq-group.com; s=20230829; h=from:subject:message-id; bh=zpReWPDWnJPZSQwgBcrBsplUbkSPT5bkXuwcoqiJqBQ=; b=Ga1cVakJe+rZqOztI7bS9fr99sD6mW+FFFiYUhJICnSRppL89NGHazD9/BSDIafWK+zIpEYV6 iz+4n+xKgnMAYRtp8pNNeEmej/7RUCTlzTPOPCdviuj5jcicF586bwA X-Developer-Key: i=gregor.herburger@ew.tq-group.com; a=ed25519; pk=+eRxwX7ikXwazcRjlOjj2/tbDmfVZdDLoW+xLZbQ4h4= X-Last-TLS-Session-Version: TLSv1.3 X-Patchwork-Delegate: kuba@kernel.org The mcp251xfd devices allow two pins to be configured as gpio. Add this functionality to driver. Signed-off-by: Gregor Herburger --- drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c | 173 +++++++++++++++++++++++++ drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 6 + 2 files changed, 179 insertions(+) diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c index 4739ad80ef2a..de301f3a2f4e 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd-core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -1768,6 +1769,172 @@ static int mcp251xfd_register_check_rx_int(struct mcp251xfd_priv *priv) return 0; } +#ifdef CONFIG_GPIOLIB +static const char * const mcp251xfd_gpio_names[] = {"GPIO0", "GPIO1"}; + +static int mcp251xfd_gpio_request(struct gpio_chip *chip, unsigned int offset) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 pin_mask = MCP251XFD_REG_IOCON_PM0 << offset; + int ret; + + if (priv->rx_int && offset == 1) { + netdev_err(priv->ndev, "Can't use GPIO 1 with RX-INT!\n"); + return -EINVAL; + } + + ret = pm_runtime_resume_and_get(priv->ndev->dev.parent); + if (ret) + return ret; + + return regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON, + pin_mask, pin_mask); +} + +static void mcp251xfd_gpio_free(struct gpio_chip *chip, unsigned int offset) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + + pm_runtime_put(priv->ndev->dev.parent); +} + +static int mcp251xfd_gpio_get_direction(struct gpio_chip *chip, + unsigned int offset) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 mask = MCP251XFD_REG_IOCON_TRIS0 << offset; + u32 val; + + regmap_read(priv->map_reg, MCP251XFD_REG_IOCON, &val); + + if (mask & val) + return GPIO_LINE_DIRECTION_IN; + + return GPIO_LINE_DIRECTION_OUT; +} + +static int mcp251xfd_gpio_get(struct gpio_chip *chip, unsigned int offset) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 mask = MCP251XFD_REG_IOCON_GPIO0 << offset; + u32 val; + + regmap_read(priv->map_reg, MCP251XFD_REG_IOCON, &val); + + return !!(mask & val); +} + +static int mcp251xfd_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask, + unsigned long *bit) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 val; + int ret; + + ret = regmap_read(priv->map_reg, MCP251XFD_REG_IOCON, &val); + if (ret) + return ret; + + *bit = FIELD_GET(MCP251XFD_REG_IOCON_GPIO_MASK, val) & *mask; + + return 0; +} + +static int mcp251xfd_gpio_direction_output(struct gpio_chip *chip, + unsigned int offset, int value) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 dir_mask = MCP251XFD_REG_IOCON_TRIS0 << offset; + u32 val_mask = MCP251XFD_REG_IOCON_LAT0 << offset; + u32 val; + + if (value) + val = val_mask; + else + val = 0; + + return regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON, + dir_mask | val_mask, val); +} + +static int mcp251xfd_gpio_direction_input(struct gpio_chip *chip, + unsigned int offset) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 dir_mask = MCP251XFD_REG_IOCON_TRIS0 << offset; + + return regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON, + dir_mask, dir_mask); +} + +static void mcp251xfd_gpio_set(struct gpio_chip *chip, unsigned int offset, + int value) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 val_mask = MCP251XFD_REG_IOCON_LAT0 << offset; + u32 val; + int ret; + + if (value) + val = val_mask; + else + val = 0; + + ret = regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON, + val_mask, val); + if (ret) + dev_warn(&priv->spi->dev, + "Failed to set GPIO %u: %d\n", offset, ret); +} + +static void mcp251xfd_gpio_set_multiple(struct gpio_chip *chip, unsigned long *mask, + unsigned long *bits) +{ + struct mcp251xfd_priv *priv = gpiochip_get_data(chip); + u32 val; + int ret; + + val = FIELD_PREP(MCP251XFD_REG_IOCON_LAT_MASK, *bits); + + ret = regmap_update_bits(priv->map_reg, MCP251XFD_REG_IOCON, + MCP251XFD_REG_IOCON_LAT_MASK, val); + if (ret) + dev_warn(&priv->spi->dev, "Failed to set GPIOs %d\n", ret); +} + +static int mcp251fdx_gpio_setup(struct mcp251xfd_priv *priv) +{ + struct gpio_chip *gc = &priv->gc; + + if (!device_property_present(&priv->spi->dev, "gpio-controller")) + return 0; + + gc->label = dev_name(&priv->spi->dev); + gc->parent = &priv->spi->dev; + gc->owner = THIS_MODULE; + gc->request = mcp251xfd_gpio_request; + gc->free = mcp251xfd_gpio_free; + gc->get_direction = mcp251xfd_gpio_get_direction; + gc->direction_output = mcp251xfd_gpio_direction_output; + gc->direction_input = mcp251xfd_gpio_direction_input; + gc->get = mcp251xfd_gpio_get; + gc->get_multiple = mcp251xfd_gpio_get_multiple; + gc->set = mcp251xfd_gpio_set; + gc->set_multiple = mcp251xfd_gpio_set_multiple; + gc->base = -1; + gc->can_sleep = true; + gc->ngpio = ARRAY_SIZE(mcp251xfd_gpio_names); + gc->names = mcp251xfd_gpio_names; + + return devm_gpiochip_add_data(&priv->spi->dev, gc, priv); +} +#else +static inline int mcp251fdx_gpio_setup(struct mcp251xfd_priv *priv) +{ + return 0; +} +#endif + static int mcp251xfd_register_get_dev_id(const struct mcp251xfd_priv *priv, u32 *dev_id, u32 *effective_speed_hz_slow, @@ -2141,6 +2308,12 @@ static int mcp251xfd_probe(struct spi_device *spi) if (err) goto out_free_candev; + err = mcp251fdx_gpio_setup(priv); + if (err) { + dev_err_probe(&spi->dev, err, "Failed to register gpio-controller.\n"); + goto out_free_candev; + } + err = mcp251xfd_register(priv); if (err) { dev_err_probe(&spi->dev, err, "Failed to detect %s.\n", diff --git a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h index 75d5a8a25415..dc34da848f00 100644 --- a/drivers/net/can/spi/mcp251xfd/mcp251xfd.h +++ b/drivers/net/can/spi/mcp251xfd/mcp251xfd.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -337,8 +338,10 @@ #define MCP251XFD_REG_IOCON_PM0 BIT(24) #define MCP251XFD_REG_IOCON_GPIO1 BIT(17) #define MCP251XFD_REG_IOCON_GPIO0 BIT(16) +#define MCP251XFD_REG_IOCON_GPIO_MASK GENMASK(17, 16) #define MCP251XFD_REG_IOCON_LAT1 BIT(9) #define MCP251XFD_REG_IOCON_LAT0 BIT(8) +#define MCP251XFD_REG_IOCON_LAT_MASK GENMASK(9, 8) #define MCP251XFD_REG_IOCON_XSTBYEN BIT(6) #define MCP251XFD_REG_IOCON_TRIS1 BIT(1) #define MCP251XFD_REG_IOCON_TRIS0 BIT(0) @@ -660,6 +663,9 @@ struct mcp251xfd_priv { struct mcp251xfd_devtype_data devtype_data; struct can_berr_counter bec; +#ifdef CONFIG_GPIOLIB + struct gpio_chip gc; +#endif }; #define MCP251XFD_IS(_model) \ From patchwork Mon May 6 05:59:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregor Herburger X-Patchwork-Id: 13654974 X-Patchwork-Delegate: kuba@kernel.org Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 795971422A5; Mon, 6 May 2024 06:00:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.104.207.81 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975226; cv=none; b=dq/B8XCuVMmh1L02JK22JpKVCSmxPts7rZbVK4yBg0CtYxEHqOJnuobX6ASDnH3DAT5ETU3jPsecPPjhT9K3Gt98EzO0GKZoWS7ahsa81icBXcKV2Z3/lU3iRSDzpD194FdWCKpoZszR+WmdPS8Tr8FBOl6JQObpj2sntgzcPHU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714975226; c=relaxed/simple; bh=n7tWG1Z1TtD2JkeZjnmsbv83buLI5moDMRobi/fvv8g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=u0UXgnaTpo+UFS1t7U3Q/QzqhA3FYuCjDXZhT9AGFaIw/Bm+LuA1d+znLo3MAziU3bPl1f8aco/8vIwOhK4wKUutrXwIldtcCwWbpCMvHE3nBe2WHcm18/SO67ySoWxekzU7jglMRv2cYDodu/pd7TTJIwAVpaZ4jE3+86209Wg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com; spf=pass smtp.mailfrom=ew.tq-group.com; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b=WztB5EON; dkim=fail (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b=tN+vi0+5 reason="key not found in DNS"; arc=none smtp.client-ip=93.104.207.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ew.tq-group.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tq-group.com header.i=@tq-group.com header.b="WztB5EON"; dkim=fail reason="key not found in DNS" (0-bit key) header.d=ew.tq-group.com header.i=@ew.tq-group.com header.b="tN+vi0+5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1714975224; x=1746511224; h=from:date:subject:mime-version:content-transfer-encoding: message-id:references:in-reply-to:to:cc; bh=TuuhNbNaeBjZJdztCfrNpOfP6WkWLiHnIjQUOHBmfhU=; b=WztB5EONc3Da/02nW1M81zpf9x/xkGimf2BCcD4ky8Lhl5xkOqXCLJS+ +eaJrfa/ssh0y4pb4a6VHJ9+QORowsIFIyGNLkQnOo5fLwTFJ2O3rAvw5 buZpJzCNOr6iSlTyzQsyVzVgtecwyKzf/fpOxBVoDt5oe/SK2b8CUeNhO Rj2FWctPSiZeDt+WPeEVAEX/ydCLvYMn7vfh/ac9UTneNIEdO1CeRyWZo VR34Bk/cWf7eXwRp1s2lMLO101qk8BikR3PuOBjUSaT4xR5MBVsB06GGl 6vVvXGRqtZmk4kCNi2JwZOdYPvtIQlCV0S/yxRdn3nDSTF2n+nDqv8sxe Q==; X-CSE-ConnectionGUID: jymlU0qzThSQkwTrQANGVw== X-CSE-MsgGUID: Opmh6Y8zRiqfQbQZkUjm4A== X-IronPort-AV: E=Sophos;i="6.07,257,1708383600"; d="scan'208";a="36751440" Received: from vmailcow01.tq-net.de ([10.150.86.48]) by mx1.tq-group.com with ESMTP; 06 May 2024 08:00:22 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id D7D7E176045; Mon, 6 May 2024 08:00:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ew.tq-group.com; s=dkim; t=1714975218; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:references; bh=TuuhNbNaeBjZJdztCfrNpOfP6WkWLiHnIjQUOHBmfhU=; b=tN+vi0+5spL8tPphYS2QIHsQij8hBxxKwXPJgIvlvjo126l0Wbayc2aa9acCvUJiRps7xU DOX+MyZmL4rrXiaUbqInKmL/jpHDKtIuoMLiRfMlbO24YJzvm+65QWjEfYJqvOQfCm6vsq PbbSkJjKSXLzQceXTz3JBIY0+TW79vJseUQyM1Isd7WQrOXpYf6daUMZlbbg18x68G0BzU 5cH+ikx0Pi6ZPO92d3SW0tEu+d/MErx9gNVDEyWQ9tLZupBNlWrXkyfuPBevWms6QEVS5m u+waVzqt/nkYabiLt8urfbZfHP2xTwQ6zOjHLAZQKCntqrBVg/YSdmrXpSuXvg== From: Gregor Herburger Date: Mon, 06 May 2024 07:59:48 +0200 Subject: [PATCH v2 6/6] dt-bindings: can: mcp251xfd: add gpio-controller property Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240506-mcp251xfd-gpio-feature-v2-6-615b16fa8789@ew.tq-group.com> References: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> In-Reply-To: <20240506-mcp251xfd-gpio-feature-v2-0-615b16fa8789@ew.tq-group.com> To: Marc Kleine-Budde , Manivannan Sadhasivam , Thomas Kopp , Vincent Mailhol , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: linux-can@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux@ew.tq-group.com, gregor.herburger@ew.tq-group.com X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1714975188; l=868; i=gregor.herburger@ew.tq-group.com; s=20230829; h=from:subject:message-id; bh=n7tWG1Z1TtD2JkeZjnmsbv83buLI5moDMRobi/fvv8g=; b=dtcIIW/3/ZUobrP0XJ3wzYGoDatR8SHllfuJ7lfpO349HQBXJKFgwdWH5TGBleBeWLyImiclG Vcn8gRK/YuaCBQJM3TEIsxYGR4EwWkvfKnsYzKOAkXNpU0RnFdJkpf9 X-Developer-Key: i=gregor.herburger@ew.tq-group.com; a=ed25519; pk=+eRxwX7ikXwazcRjlOjj2/tbDmfVZdDLoW+xLZbQ4h4= X-Last-TLS-Session-Version: TLSv1.3 X-Patchwork-Delegate: kuba@kernel.org The mcp251xfd has two pins that can be used as gpio. Add gpio-controller property to binding description. Signed-off-by: Gregor Herburger Acked-by: Krzysztof Kozlowski --- Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml b/Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml index 2a98b26630cb..e9605a75c45b 100644 --- a/Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml +++ b/Documentation/devicetree/bindings/net/can/microchip,mcp251xfd.yaml @@ -49,6 +49,11 @@ properties: Must be half or less of "clocks" frequency. maximum: 20000000 + gpio-controller: true + + "#gpio-cells": + const: 2 + required: - compatible - reg