| Message ID | 20220817143529.257908-1-dario.binacchi@amarulasolutions.com |
|---|---|
| Headers |
Return-Path: <linux-amarula+bncBCQ4XFG47UFRBZXZ6OLQMGQEEWFLAZI@amarulasolutions.com> 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 <linux-amarula@patchwork.amarulasolutions.com>; Wed, 17 Aug 2022 16:36:22 +0200 (CEST) Received: by mail-ej1-f69.google.com with SMTP id gb41-20020a170907962900b00730961131a7sf3023502ejc.1 for <linux-amarula@patchwork.amarulasolutions.com>; 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 <linux-amarula@amarulasolutions.com> (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 <dario.binacchi@amarulasolutions.com> To: linux-kernel@vger.kernel.org Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>, Amarula patchwork <linux-amarula@amarulasolutions.com>, michael@amarulasolutions.com, Marc Kleine-Budde <mkl@pengutronix.de>, Dario Binacchi <dario.binacchi@amarulasolutions.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Maxime Coquelin <mcoquelin.stm32@gmail.com>, Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh+dt@kernel.org>, Wolfgang Grandegger <wg@grandegger.com>, 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: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
can: bxcan: add support for ST bxCAN controller
|
|
Message
Dario Binacchi
Aug. 17, 2022, 2:35 p.m. UTC
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
Comments
I've stripped down the Cc list a bit... On 17.08.2022 16:35:25, Dario Binacchi wrote: > 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: I've had no time for a in depth review, but here are some warnings by the standard checker tools: Please fix these sparse errors: | drivers/net/can/bxcan/bxcan-drv.c:641:39: warning: incorrect type in initializer (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:641:39: expected struct bxcan_regs *regs | drivers/net/can/bxcan/bxcan-drv.c:641:39: got struct bxcan_regs [noderef] __iomem *regs | drivers/net/can/bxcan/bxcan-drv.c:650:15: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:650:15: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:650:15: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:667:20: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:667:20: expected void volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:667:20: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:672:17: warning: incorrect type in argument 2 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:672:17: expected void volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:672:17: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:675:9: warning: incorrect type in argument 2 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:675:9: expected void volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:675:9: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:677:15: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:677:15: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:677:15: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:703:14: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:703:14: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:703:14: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:709:15: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:709:15: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:709:15: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:718:50: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:718:50: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:718:50: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:730:39: warning: incorrect type in initializer (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:730:39: expected struct bxcan_regs *regs | drivers/net/can/bxcan/bxcan-drv.c:730:39: got struct bxcan_regs [noderef] __iomem *regs | drivers/net/can/bxcan/bxcan-drv.c:735:24: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:735:24: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:735:24: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:742:17: warning: incorrect type in argument 2 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:742:17: expected void volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:742:17: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:747:28: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:747:28: expected void volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:747:28: got unsigned int * | drivers/net/can/bxcan/bxcan-drv.c:802:39: warning: incorrect type in initializer (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:802:39: expected struct bxcan_regs *regs | drivers/net/can/bxcan/bxcan-drv.c:802:39: got struct bxcan_regs [noderef] __iomem *regs | drivers/net/can/bxcan/bxcan-drv.c:810:15: warning: incorrect type in argument 1 (different address spaces) | drivers/net/can/bxcan/bxcan-drv.c:810:15: expected void const volatile [noderef] __iomem *addr | drivers/net/can/bxcan/bxcan-drv.c:810:15: got unsigned int * (To enable sparse checking, do a "make C=1" to compile.) Please fix these checkpatch warnings: | WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? | #74: | new file mode 100644 Please create a MAINTAINERS entry. | WARNING: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'. | #307: FILE: drivers/net/can/bxcan/bxcan-core.c:179: | + dev_info(&pdev->dev, "regs: %px\n", priv->base); Please remove the print of the base address. | WARNING: Use of volatile is usually wrong: see Documentation/process/volatile-considered-harmful.rst | #356: FILE: drivers/net/can/bxcan/bxcan-core.h:21: | +static inline void bxcan_rmw(volatile void __iomem *addr, u32 clear, u32 set) remove the volatile. | WARNING: Using vsprintf specifier '%px' potentially exposes the kernel memory layout, if you don't really need the address please consider using '%p'. | #1273: FILE: drivers/net/can/bxcan/bxcan-drv.c:899: | + } | + | + dev_info(dev, "regs: %px, clk: %d Hz, IRQs: %d, %d, %d\n", | + priv->regs, priv->can.clock.freq, tx_irq, rx_irq, | + sce_irq); Remote the print of the regs. regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |