From patchwork Mon Nov 22 10:46:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12693306 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61B63C433EF for ; Mon, 22 Nov 2021 11:51:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nKV7RQZRwOpPUjm9TWCkLfKXNBGK5pozkaeb4cVqF1s=; b=sx+vVKPuv16UW4 nsBBSRX5n2psU1KpDAx8+d6laYcadrWizMySNAcLOYrFm2QWMcNKU1s34m+kcKyehcjphZeUheZi/ ksqdTc0Pg+vVRu73VZWf7aNO4idES5Oa/xdS2o+CkkiDmR42Clxk7o2O+AxChnoryKXgyiL3syzsj OLdVosM9PubpLxEwAh6iEQW0qiyn1XgdQrMsJ+8kLwczQXRsRopezut23/6CpqUbWggD6EHcSO0y/ o8qpCtn93xasFAL9ZG94zwUlP04pIYvAaALaH9zllve86Azjsgt0QKn1/G/7kbx63jX+e+6zRp43+ ZNGEKrYe+PCCJDfru8FQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp7pN-00G9gA-L8; Mon, 22 Nov 2021 11:49:42 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp6qS-00FuNX-Ij for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 10:46:46 +0000 Received: by mail-lf1-x12a.google.com with SMTP id bi37so78600771lfb.5 for ; Mon, 22 Nov 2021 02:46:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QNe6aTzR9gkb/+vCdyAp/Zw0YKIRP/v2w6mNVEQQPNA=; b=3OEh1zKxBUNBazeE8TXb6pak8tCqz0c4CoZMXS16AFtpOYDidMJVNek6ZxCUO5xeXx pMM9+KRg+aAxqMZwFgzqDlaFlYlyzKft6NLXHgMN09MOwyo8351V4S+X1V4pSbG01C4u ILcfBGnqeEcEVsYfK0w/qPXgTnVLn2linheH8b5nRbBR96L5A2ab/ObIfFQ0EuDUEcYI fAzVEmdBFCzWn8UiGcuHDgESMCLUTw8hKAn8NwZCktXMLXNTKDZ+j2mV1pRC9cO0/soY GPbXLHXzxb05ZlgrQg4DBAbPjRWXAubO8sOUI77c5bFf3bXery24v2vYgj7c5TNXiZph 5MyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QNe6aTzR9gkb/+vCdyAp/Zw0YKIRP/v2w6mNVEQQPNA=; b=iyJPCKRqdVtGnJAwBqA4ANjA5eWYgAdJ7HyWdUVGGJsPhncc6c6xceqJJxOD+BU+nG NMe/vKWc2jezc7cMJd8YaQAQSnYgEO3Aw44glNqU1O/AzafRyIlEpBuj66xLs/pPmjVy f34qiGOWr+oX5Nq9We4VdjMCTtINplhZJM4I4J4dz/3o0EkBhqO59dnM52K1Iq0TXDkV L/AC705DXRYGdj1AwN4xWXCgVxqUSZMwz+D0KN4Dpr5l1k6OgEDEaBiszL7SuRTBJKgm Q4lffj/pvVPjWhBoMWdzuHBb56RothtFZ14qeKvnKYeKjwMtdv/0tbKyqrN+KjUDPiMs L+7Q== X-Gm-Message-State: AOAM533K7UJtFKRB/dUNMNtta1hpR8DdNTNKZiaGWPD5jrdAHZt7m7Fj QfV6+Si+2Ti5MvgmzOvPrFn8JA== X-Google-Smtp-Source: ABdhPJzL4Pb/y4VHvTqNi3h3McYI6lp2gv8xX2z4vKS4OUiGMikVJcAVlJtMMmJ8yufQyTioFh7x+Q== X-Received: by 2002:a05:6512:1194:: with SMTP id g20mr52837084lfr.58.1637578001912; Mon, 22 Nov 2021 02:46:41 -0800 (PST) Received: from boger-laptop.lan (81.5.99.121.dhcp.mipt-telecom.ru. [81.5.99.121]) by smtp.gmail.com with ESMTPSA id bi24sm923538lfb.49.2021.11.22.02.46.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 02:46:41 -0800 (PST) From: Evgeny Boger To: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Cc: Evgeny Boger , devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-can@vger.kernel.org, Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , Jeroen Hofstee , Gerhard Bertelsmann Subject: [PATCH 1/3] dt-bindings: net: can: add support for Allwinner R40 CAN controller Date: Mon, 22 Nov 2021 13:46:14 +0300 Message-Id: <20211122104616.537156-2-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122104616.537156-1-boger@wirenboard.com> References: <20211122104616.537156-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_024644_665080_DD794085 X-CRM114-Status: GOOD ( 12.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allwinner R40 (also known as A40i, T3, V40) has a CAN controller. The controller is the same as in earlier A10 and A20 SoCs, but needs reset line to be deasserted before use. This patch Introduces new compatible for R40 CAN controller with required resets property. Signed-off-by: Evgeny Boger Reviewed-by: Rob Herring --- .../net/can/allwinner,sun4i-a10-can.yaml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Documentation/devicetree/bindings/net/can/allwinner,sun4i-a10-can.yaml b/Documentation/devicetree/bindings/net/can/allwinner,sun4i-a10-can.yaml index a95960ee3feb..c93fe9d3ea82 100644 --- a/Documentation/devicetree/bindings/net/can/allwinner,sun4i-a10-can.yaml +++ b/Documentation/devicetree/bindings/net/can/allwinner,sun4i-a10-can.yaml @@ -17,6 +17,7 @@ properties: - const: allwinner,sun7i-a20-can - const: allwinner,sun4i-a10-can - const: allwinner,sun4i-a10-can + - const: allwinner,sun8i-r40-can reg: maxItems: 1 @@ -27,6 +28,19 @@ properties: clocks: maxItems: 1 + resets: + maxItems: 1 + +if: + properties: + compatible: + contains: + const: allwinner,sun8i-r40-can + +then: + required: + - resets + required: - compatible - reg @@ -47,5 +61,15 @@ examples: interrupts = ; clocks = <&ccu CLK_APB1_CAN>; }; + - | + #define RST_BUS_CAN 68 + #define CLK_BUS_CAN 91 + can1: can@1c2bc00 { + compatible = "allwinner,sun8i-r40-can"; + reg = <0x01c2bc00 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_CAN>; + resets = <&ccu RST_BUS_CAN>; + }; ... From patchwork Mon Nov 22 10:46:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12693307 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 35B63C433F5 for ; Mon, 22 Nov 2021 11:52:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ifkhn47Hpkwn6OSI5hFlFhMqPME/eh13L6kDe/OAiNM=; b=2S16M9DdRTWSyn WJTEC21K/I16ApS08/O+7wi9RB8G0D1zEdTx/dL+/EX3/y/HyvxZPMhgeP5YEz0edSYjIWcA/9FlR xH3Tu6jti3Hwx/j1vqQ4FJTB2DWBpXRO7jAfv0O1yOClLL1RP4BeJztNQJ6JhqRKKAb0rqM5PVadW 88wlpFFfpvfFOlH5jQQ1NwZjktA7KGGU6TgfmP7zOR2HtDQDLGRHHsOXMu+koYtWtgJLgVaBkgkzI 6h5y8fwQEpFD5qgr3cdRRH51I7deQtzRwUkRMtsJ7fnCoH3osFxWENTZLCIV3qkCDIxHFsVTD/Cxd 8qBj1UYvRYWVKnl+vbGw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp7qE-00G9wu-GK; Mon, 22 Nov 2021 11:50:35 +0000 Received: from mail-lf1-x132.google.com ([2a00:1450:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp6qV-00FuOL-Pu for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 10:46:49 +0000 Received: by mail-lf1-x132.google.com with SMTP id f18so78759618lfv.6 for ; Mon, 22 Nov 2021 02:46:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xWB86lLShMOvVXpcj6liSWQMqibhlefo7YzIyCndAFs=; b=NVM2yTFkeI20Q17ovDrj/12XWRhFICmqXXeCPY8oMh10umlW6fbpZMxDGGQ87jtORt BLv8AnvRYkzyu0GleR/yDgT8qWBOiZBpt9oNZ1GtDjr91O2qTGeNhKoeoucFORc2NXlE DloY7LVP88u+RofuHEoSzNxtAy8yPHJivPsoyaYJoJnc5MSt+3PeS8FHOpnIOniw1prC M4EuyRDomnXXorpj83CQvLP32a2piT/4bY1j7tezricJbWXH5+SiVz2sBSTCRaWtO/kt tbcV15Zj5iYn1hnH78nKXe8YswxdE8pDCbqQtjqUmleuKV0yUjMzAwDXiWr7h7PFkP8C olhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xWB86lLShMOvVXpcj6liSWQMqibhlefo7YzIyCndAFs=; b=ApnCaU5TcurJRprMI4qnXE9fbUpj9v0MHcqks+guQ9oGaickjs0GZZMSK1GTdhnFFR VVdaQfaEM1Ya1JbWEfs2Op/qhIVQwRTK8cpKpQADvTzb5pGPWwTIBYVML39RhP5laBWE IypVm0weKhKuEXRfxB9aKHop4I5J+oHZ3CJjwx2vVluHLkyGtA6MjTBfRm/+0SetV6XC WT5b60IxlnUSZIZB9Jsk06ZboFQNTHWlRiBkcub6+fNAXsjZV3r+FTNz2pNjRVRNKyfI JkAjjAEWb4I4PUeiamhVpKMLsFvS7/qmdtV7OOSxc808yH21KD8EdFYvRrZuUwaJZlmZ bfFA== X-Gm-Message-State: AOAM5311dVyYZbB4vlXrD13raB+JWhc6XJj244BjSSWtRvM8zkZzrjx9 xDsRdTo4+nC0I2+wP4qupcC/HQ== X-Google-Smtp-Source: ABdhPJx4YYbm7oORJJDG5wdR7Lb/yZeMhbEKW46eG/jE1YOu/FIUK0eNoiG1RFd8p1LtgUk/2NIXmA== X-Received: by 2002:a05:651c:1787:: with SMTP id bn7mr47814602ljb.22.1637578005290; Mon, 22 Nov 2021 02:46:45 -0800 (PST) Received: from boger-laptop.lan (81.5.99.121.dhcp.mipt-telecom.ru. [81.5.99.121]) by smtp.gmail.com with ESMTPSA id bi24sm923538lfb.49.2021.11.22.02.46.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 02:46:44 -0800 (PST) From: Evgeny Boger To: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Cc: Evgeny Boger , devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-can@vger.kernel.org, Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , Jeroen Hofstee , Gerhard Bertelsmann Subject: [PATCH 2/3] can: sun4i_can: add support for R40 CAN controller Date: Mon, 22 Nov 2021 13:46:15 +0300 Message-Id: <20211122104616.537156-3-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122104616.537156-1-boger@wirenboard.com> References: <20211122104616.537156-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_024647_909708_006B1A21 X-CRM114-Status: GOOD ( 21.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allwinner R40 (also known as A40i, T3, V40) has a CAN controller. The controller is the same as in earlier A10 and A20 SoCs, but needs reset line to be deasserted before use. This patch adds a new compatible for R40 CAN controller. Depending on the compatible, reset line can be requested from DT. Signed-off-by: Evgeny Boger --- drivers/net/can/sun4i_can.c | 61 ++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 54aa7c25c4de..24a61326915e 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -61,6 +61,7 @@ #include #include #include +#include #define DRV_NAME "sun4i_can" @@ -200,10 +201,20 @@ #define SUN4I_CAN_MAX_IRQ 20 #define SUN4I_MODE_MAX_RETRIES 100 +/** + * struct sun4ican_quirks - Differences between SoC variants. + * + * @has_reset: SoC needs reset deasserted. + */ +struct sun4ican_quirks { + bool has_reset; +}; + struct sun4ican_priv { struct can_priv can; void __iomem *base; struct clk *clk; + struct reset_control *reset; spinlock_t cmdreg_lock; /* lock for concurrent cmd register writes */ }; @@ -702,6 +713,13 @@ static int sun4ican_open(struct net_device *dev) goto exit_irq; } + /* software reset deassert */ + err = reset_control_deassert(priv->reset); + if (err) { + netdev_err(dev, "could not deassert CAN reset\n"); + goto exit_soft_reset; + } + /* turn on clocking for CAN peripheral block */ err = clk_prepare_enable(priv->clk); if (err) { @@ -723,6 +741,8 @@ static int sun4ican_open(struct net_device *dev) exit_can_start: clk_disable_unprepare(priv->clk); exit_clock: + reset_control_assert(priv->reset); +exit_soft_reset: free_irq(dev->irq, dev); exit_irq: close_candev(dev); @@ -736,6 +756,7 @@ static int sun4ican_close(struct net_device *dev) netif_stop_queue(dev); sun4i_can_stop(dev); clk_disable_unprepare(priv->clk); + reset_control_assert(priv->reset); free_irq(dev->irq, dev); close_candev(dev); @@ -750,8 +771,27 @@ static const struct net_device_ops sun4ican_netdev_ops = { .ndo_start_xmit = sun4ican_start_xmit, }; +static const struct sun4ican_quirks sun4ican_quirks_a10 = { + .has_reset = false, +}; + +static const struct sun4ican_quirks sun4ican_quirks_r40 = { + .has_reset = true, +}; + static const struct of_device_id sun4ican_of_match[] = { - {.compatible = "allwinner,sun4i-a10-can"}, + { + .compatible = "allwinner,sun4i-a10-can", + .data = &sun4ican_quirks_a10 + }, + { + .compatible = "allwinner,sun7i-a20-can", + .data = &sun4ican_quirks_a10 + }, + { + .compatible = "allwinner,sun8i-r40-can", + .data = &sun4ican_quirks_r40 + }, {}, }; @@ -771,10 +811,28 @@ static int sun4ican_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct clk *clk; + struct reset_control *reset = NULL; void __iomem *addr; int err, irq; struct net_device *dev; struct sun4ican_priv *priv; + const struct sun4ican_quirks *quirks; + + quirks = of_device_get_match_data(&pdev->dev); + if (!quirks) { + dev_err(&pdev->dev, "failed to determine the quirks to use\n"); + err = -ENODEV; + goto exit; + } + + if (quirks->has_reset) { + reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); + if (IS_ERR(reset)) { + dev_err(&pdev->dev, "unable to request reset\n"); + err = PTR_ERR(reset); + goto exit; + } + } clk = of_clk_get(np, 0); if (IS_ERR(clk)) { @@ -818,6 +876,7 @@ static int sun4ican_probe(struct platform_device *pdev) CAN_CTRLMODE_3_SAMPLES; priv->base = addr; priv->clk = clk; + priv->reset = reset; spin_lock_init(&priv->cmdreg_lock); platform_set_drvdata(pdev, dev); From patchwork Mon Nov 22 10:46:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12693308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 70341C433F5 for ; Mon, 22 Nov 2021 11:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2uuLlVfdkzYSHmP0DLnpYmXBhybR0MwskOpQlPUK1xU=; b=aC8AsxcGEAxMYp HdeAlooz4Rj832UqJ9q2rxoo0LsKPnxm+k5M8tRUp9H+0cpzg8xaWc8kUCL6jMzhYjY2sKeRLxIVX Trc226UxzAtBM6nWMvQ4OopOQQL0XVrn7KkLQQQw5a4Oqm3+KeYxTCg31jHltImxybBgHBMYe0G/l XCJg25Ws8NDW1LCXDw5/uZgNAMBvJ8onKo0U2qm321CKja9TFeCYZPpeLDRze70Tp1aZZruqvvzIQ 6PtXkexqtkhezdb1QmrfKozZ98Q+PyW70zBt2nSGhpc5LZMxW2S3WuWdq0DhX3csYrhHejsP1vqYD lcLLl+JjhfI0xqDOsY4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp7rQ-00GAMF-GO; Mon, 22 Nov 2021 11:51:50 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mp6qZ-00FuP5-0S for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 10:46:52 +0000 Received: by mail-lf1-x136.google.com with SMTP id bu18so78850410lfb.0 for ; Mon, 22 Nov 2021 02:46:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=311GWPIXU+cwXxA7Ckz/STalbmM5HGKI3ZPI+zF+AxU=; b=C2vLaC6sb735/pasDKME38R6Mdg/XwVypZnM92+kTdhnoTIIwD6NID8mfskzt3zY4i tQVD7SoCmSHxZzczPBWXFwxxQZQ/CJXB6Krrn5wtGZ7X/6fJLsMp4fubBdtyzlajuy67 +Xb1Tonjg9CEbTEFd9Mz8cAbZGK06Q3ogCWH6OFkPS6SH5WyhgyCcIRBuXIZiYCg9iXz a/43nYsG/gm79Zeo7kLp3dZ/5m/ez+DSw0ZF5E0cJ1xj18ebuP9LbjqJOvkOm4tWzfQm 4djhqZSQLiSM9tWsfUpNIrBSIb85dMYx1QkRxn5Vp+jDMwliidA2azAJxTmZc7S8MRnf yE5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=311GWPIXU+cwXxA7Ckz/STalbmM5HGKI3ZPI+zF+AxU=; b=Xu3P9A3ikHD0WgU+o6Rl+uDbQxFbsG7NEaEzx4mhEoIsul2E8J+Kt+zks6+bx84PhA Ul1ccPxjF+QiWsXCmDxBpMgEHc0P94YhMhdK6yMc3cTGGbAzlLQxSMcJsS54wFvA8I1A pbp72C875klIe7kp62aOV4JUGgtWUjMBxW/dlOiJRCkJt89PMJtyDK9kuc2EStnTf/+7 lZoehq5mUbe4Sz0ezickkCtILGFT4RgQ2f+LsqFKqEGFzXJLLVczPnUat4NasQOOARM7 4Q1QP4SbhLo5b+uZG59BpHyNKKTNwA446osCW1KfTRxcycg3IXTsa4UbsnbnN7huZtr6 cdMw== X-Gm-Message-State: AOAM533tSRhH6/GjVVQumtEu7fOGiCaeuQcB2A0v8OQIgUV7K15hmuUd /u36IuDjoF9+rOi0udKGSDK9LEAJORMwKw== X-Google-Smtp-Source: ABdhPJwJHm4/CL7dIRX3Q10ViHuUVbbGK/y0BysXvqEG1YX0vYPX8lTD4tzA8QuiDlgZJiU/X6NPOw== X-Received: by 2002:a2e:9b01:: with SMTP id u1mr51418465lji.379.1637578006428; Mon, 22 Nov 2021 02:46:46 -0800 (PST) Received: from boger-laptop.lan (81.5.99.121.dhcp.mipt-telecom.ru. [81.5.99.121]) by smtp.gmail.com with ESMTPSA id bi24sm923538lfb.49.2021.11.22.02.46.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 02:46:46 -0800 (PST) From: Evgeny Boger To: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Cc: Evgeny Boger , devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev, linux-can@vger.kernel.org, Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , Jeroen Hofstee , Gerhard Bertelsmann Subject: [PATCH 3/3] ARM: dts: sun8i: r40: add node for CAN controller Date: Mon, 22 Nov 2021 13:46:16 +0300 Message-Id: <20211122104616.537156-4-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122104616.537156-1-boger@wirenboard.com> References: <20211122104616.537156-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_024651_120236_FD77AF80 X-CRM114-Status: GOOD ( 12.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Allwinner R40 (also known as A40i, T3, V40) has a CAN controller. The controller is the same as in earlier A10 and A20 SoCs, but needs reset line to be deasserted before use. This patch adds a CAN node and the corresponding pinctrl descriptions. Signed-off-by: Evgeny Boger --- arch/arm/boot/dts/sun8i-r40.dtsi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index 1d87fc0c24ee..c99c92f008a0 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -511,6 +511,16 @@ pio: pinctrl@1c20800 { #interrupt-cells = <3>; #gpio-cells = <3>; + can_ph_pins: can-ph-pins { + pins = "PH20", "PH21"; + function = "can"; + }; + + can_pa_pins: can-pa-pins { + pins = "PA16", "PA17"; + function = "can"; + }; + clk_out_a_pin: clk-out-a-pin { pins = "PI12"; function = "clk_out_a"; @@ -926,6 +936,15 @@ i2c3: i2c@1c2b800 { #size-cells = <0>; }; + can0: can@1c2bc00 { + compatible = "allwinner,sun8i-r40-can"; + reg = <0x01c2bc00 0x400>; + interrupts = ; + clocks = <&ccu CLK_BUS_CAN>; + resets = <&ccu RST_BUS_CAN>; + status = "disabled"; + }; + i2c4: i2c@1c2c000 { compatible = "allwinner,sun6i-a31-i2c"; reg = <0x01c2c000 0x400>;