From patchwork Wed Aug 17 14:35:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 2298 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C85913F03E for ; Wed, 17 Aug 2022 16:36:22 +0200 (CEST) Received: by mail-ej1-f69.google.com with SMTP id gb41-20020a170907962900b00730961131a7sf3023502ejc.1 for ; Wed, 17 Aug 2022 07:36:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1660746982; cv=pass; d=google.com; s=arc-20160816; b=fm8ipeWrBKnEs+K6NRDBDgXQ1DYGNv2AuJc9bxivelnDorPl2VJa8a6OwWamZWGDqB EGRyBcHmhfieoDDymHUqR3XgG8S4PeL4JttCEMUf/5cMJ1BvzED9eN1KLNXY14vpjuIJ o8iLZ5UX8aflCiGoZ33eMBcB95b7hYp9BY26lSaX5MYrs1Rno/VlSovHgCHh12zthxiz TaIiU0VdrLMHuGGK3QuTJ1w3FNRav1u22Nsc6XeSwFnkcHMFKcSQoDoFfIssFk1fof67 PT/nKx13MtfcjJZZRJXq5/l/l8W9HbD3AfiQUg2Ub2RQesKt8uxAdL9IeTHk6TdLb/yb yK2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:dkim-signature; bh=WPPiYBk00KeaXhOIVWd9h3l2yxRbPQ8kgeXwexDkwyI=; b=L7gOr7Et3egnvqdimViMKFH0IUX02vigfwxcSsNvl2QX3ucGwW/bqTYJosA9fYf9pV SvHDyBE1icP0bZvdi98tTHwKVkEckDz8uWR31WFbsK2V8s6amQqTuQkqMimP25iazscI 9DUmvkEUbH5RFuU5LEhiE1fK53Mtig5Cz1ZQyd65GuWkba4biToB6pBFQVY6itUL7WLR 4g678OQcqrrdWkCs5dXdgDPO3ZvUJLK7WPIJIpDpPnOeyXsZoN21kw9u5c06PReuyx0x CROh/Q0imtm3FWho+CEPT0puyCNVDKmbk0mxcc1mwvNmWxK2eNOMFR2Cjz5YAZQ4d8CP dy0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BUBqid1m; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc; bh=WPPiYBk00KeaXhOIVWd9h3l2yxRbPQ8kgeXwexDkwyI=; b=eIqXBPVTrQkf0oZqAhI4ioXDJPl/yTOfL/8YJh6KHcVysxqJbJCX23g+sz4UDNaEu/ AKo8bo4YM6tVY9AG8k0BV1a6bx4ssfGUdFSUFMkyETjQ5vyHeZIvqxf1B9vCgkSZzOwn 3DCyty/m12ydAQZlBM4Rkzvv0OuR61FNz4kSs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=WPPiYBk00KeaXhOIVWd9h3l2yxRbPQ8kgeXwexDkwyI=; b=owFaw1nVn70o5aJK0ilt3E9lD7wifAI8WisBeuk/A241371wG7jGnffY/pQT7g29iu d4tUw7lz5y0/hJVSnCUhkLJM1FrUZ4moK3up/cwJdZ9w1bEol/EHp4K5xuaelm1HRb2k +/TTrHAoXpF8RMQt+OhjWhv0cBg9ra6DCQcw6hP6lcRh8+MPl4tRGZbfDvJwX95bZ2Qb hiaP6vSQPHnyD+ZBD8oBtXGIa/Vfm73jrDIHEQ9CHcWBWh/3PGMuZ4V3sSoc1mZGdhQ4 2YEUgS9De4PC08RpOrXLRMaEPsl6uxtpZO8tYJdDxEm7u7NURyG+QeIYM/iuim5gLf59 RUPQ== X-Gm-Message-State: ACgBeo02lfzJwiRKuQb4YWSs2FKvLSFE4S+DXwpDE4JCQzuNvUgMo63P 8BgFR+OKEs/gYTifVk1ZPC078C3w X-Google-Smtp-Source: AA6agR4Gq2g+R/9m92yeiQFIChQP2APzMHxbJN6vN99Mupz3K3oytbRfLBnnLePKjPuPn47b6IZlqw== X-Received: by 2002:a05:6402:1d51:b0:41f:cf6c:35a5 with SMTP id dz17-20020a0564021d5100b0041fcf6c35a5mr24061747edb.25.1660746982419; Wed, 17 Aug 2022 07:36:22 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:906:f846:b0:730:6d43:91d with SMTP id ks6-20020a170906f84600b007306d43091dls6079164ejb.6.-pod-prod-gmail; Wed, 17 Aug 2022 07:36:21 -0700 (PDT) X-Received: by 2002:a17:907:97d2:b0:730:657f:bef5 with SMTP id js18-20020a17090797d200b00730657fbef5mr17080737ejc.757.1660746981158; Wed, 17 Aug 2022 07:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660746981; cv=none; d=google.com; s=arc-20160816; b=IwZxFgzGnwEvAH6YZN322xZ5vGvMH7ggJblDyJGESUP7zXMnHCro5stfzxTRXXxO5e HoCCGs50UY+Vcm8mabMYgFYgY7+KvEnmMHCSBxlCF/WAe7o6kVweXD5n8Rb92HJKsCuj aEhSj/srsaRShccjsIVCuRAUZoC0iE4K3Kt1pDC/o7/uKjcIbaVBRE9rjY+lPCSh7y2+ mRmYxGJf3ISqAJ4EhcQkza+ryk8LR+9Q7M4Hnlr3vfmPyOJwPHXa0BthFPl4uZ8sRS+s 0wQWaz0gYldOiOhh7j2mXSaCj0DMKslA4bA9QDNa48YQTVK4S3d4TPGRS6lSA5pY4Dkt Jm7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=v2QQ7Uff4GoH2848IKCxUQX2XDpeKAuPtOB6PZeLpak=; b=HHgCiQpZAC0dWCCS5WtQ3JRFHmgagKI2bEXSfiEPAlJMSDLguzaOnzQH140fCVuaef Nww4c5xzLlA0GmcUc3fun++5C1uZ6CJh6MDpcjYEy5rN7uvdryXCcdgtbUpWJuNvGq4v 6MvUR2UglzJCeCKDypc5NyXnJlBwEQelFKjrKkzMI7/ooorrP8IYrXz4hoCb7iauQA9l 8V8iXkHDTLQk8tX/cisI1yz944bk6Bp29ZL0iTmmEH2WFA6PSzCLuzbhsglkqmlShedb P0j+ihm2ALKYN2Yi2tNBIx0ob+2ZA8UDoucShyXIZQLpVDpzXqcessuldHKQY9dolc5G 683g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BUBqid1m; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id q16-20020a1709064c9000b00734d33ad263sor5055907eju.82.2022.08.17.07.36.21 for (Google Transport Security); Wed, 17 Aug 2022 07:36:21 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:7609:b0:730:d70a:1efc with SMTP id jx9-20020a170907760900b00730d70a1efcmr16930699ejc.766.1660746980935; Wed, 17 Aug 2022 07:36:20 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-31-31-9.retail.telecomitalia.it. [79.31.31.9]) by smtp.gmail.com with ESMTPSA id o9-20020aa7c7c9000000b0043cab10f702sm10711982eds.90.2022.08.17.07.36.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Aug 2022 07:36:20 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: Alexandre Torgue , Amarula patchwork , michael@amarulasolutions.com, Marc Kleine-Budde , Dario Binacchi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Krzysztof Kozlowski , Maxime Coquelin , Paolo Abeni , Rob Herring , Wolfgang Grandegger , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-can@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, netdev@vger.kernel.org Subject: [RFC PATCH 0/4] can: bxcan: add support for ST bxCAN controller Date: Wed, 17 Aug 2022 16:35:25 +0200 Message-Id: <20220817143529.257908-1-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BUBqid1m; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The series adds support for the basic extended CAN controller (bxCAN) found in many low- to middle-end STM32 SoCs. The driver has been tested on the stm32f469i-discovery board with a kernel version 5.19.0-rc2 in loopback + silent mode: ip link set can0 type can bitrate 125000 loopback on listen-only on ip link set up can0 candump can0 -L & cansend can0 300#AC.AB.AD.AE.75.49.AD.D1 For uboot and kernel compilation, as well as for rootfs creation I used buildroot: make stm32f469_disco_sd_defconfig make but I had to patch can-utils and busybox as can-utils and iproute are not compiled for MMU-less microcotrollers. In the case of can-utils, replacing the calls to fork() with vfork(), I was able to compile the package with working candump and cansend applications, while in the case of iproute, I ran into more than one problem and finally I decided to extend busybox's ip link command for CAN-type devices. I'm still wondering if it was really necessary, but this way I was able to test the driver. Dario Binacchi (4): dt-bindings: net: can: add STM32 bxcan DT bindings ARM: dts: stm32: add CAN support on stm32f429 ARM: dts: stm32: add pin map for CAN controller on stm32f4 can: bxcan: add support for ST bxCAN controller .../devicetree/bindings/net/can/st,bxcan.yaml | 139 +++ arch/arm/boot/dts/stm32f4-pinctrl.dtsi | 32 + arch/arm/boot/dts/stm32f429.dtsi | 30 + drivers/net/can/Kconfig | 1 + drivers/net/can/Makefile | 1 + drivers/net/can/bxcan/Kconfig | 34 + drivers/net/can/bxcan/Makefile | 4 + drivers/net/can/bxcan/bxcan-core.c | 201 ++++ drivers/net/can/bxcan/bxcan-core.h | 33 + drivers/net/can/bxcan/bxcan-drv.c | 980 ++++++++++++++++++ 10 files changed, 1455 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/can/st,bxcan.yaml create mode 100644 drivers/net/can/bxcan/Kconfig create mode 100644 drivers/net/can/bxcan/Makefile create mode 100644 drivers/net/can/bxcan/bxcan-core.c create mode 100644 drivers/net/can/bxcan/bxcan-core.h create mode 100644 drivers/net/can/bxcan/bxcan-drv.c