Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp4902889rwb; Wed, 17 Aug 2022 07:54:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR5LaHdSU9P/fcK5pniLtmzG8qPCtEO7lKIXsXjmhQcaFXBWPamj85ZKXrYh9hF0DIjPPA4a X-Received: by 2002:a05:6402:26c2:b0:43d:d885:451a with SMTP id x2-20020a05640226c200b0043dd885451amr23696270edd.287.1660748079585; Wed, 17 Aug 2022 07:54:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660748079; cv=none; d=google.com; s=arc-20160816; b=GGmvdV7v/NJEO/5xweBaybrRAvZ/80vmIlduQ25i8fJiAJflriL7u6n1RnaYZoVYR1 Yc717rvdr19EhH7cadTnTvlrTSadUQ3ocS1k4/PVzsIxRAyjJjE+4J9UTzKP17t7rVSF EKlVFdfkyrcwZBc1A/0GkLEsAnMlcsfaD6I8FIqepf3mOjml4Uety4XSWciTTicvYzPW q/UphpvhOGUOBGbomSkdTQDNomHi6J4vDOzEIfCyP+E2wte9UscvI6VxvZD6zJhMj/CG 5/4F+9Y4fzsjDG0x/dBO0ORFK8YOb/D7IFL0a5FYOF7SdKqWfIePv2B6Ke797HDxW5fW NGkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=v2QQ7Uff4GoH2848IKCxUQX2XDpeKAuPtOB6PZeLpak=; b=seG8xQxvSytrgSjhTni1GLcYBIFOXDJHu0fqE77c2f/9R9/wa1ZBqKofPQykihCO1V aXL34JZsXGjQIdECwNcrZEttWPeEqQLoTK+TjbOybzPVHMTqP4FEDDtCCm2pcVfS/Uy3 j+QwUKBsGPs9pyVeNby+rMWdpy51pGGVXzl8MQa4WeTk6L7SH9c0ztUEZ8mD8dKf9qWf gP9cRhUh968X9PHquH7XJxLg7PcQz6Uvq30LFROAoBv7AEiOvxzL/2PDbzf0hT3nCyNW zWyF7KPuhpEBNcwfnS8nQlVAv35Ff1LIlO+PzE99C/V1lRGgQXgEc/5PL87AUhFfFZde hDWw== 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 linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g8-20020a056402428800b004437a9fcc07si10467471edc.361.2022.08.17.07.54.13; Wed, 17 Aug 2022 07:54:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BUBqid1m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240162AbiHQOhK (ORCPT + 99 others); Wed, 17 Aug 2022 10:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239941AbiHQOgo (ORCPT ); Wed, 17 Aug 2022 10:36:44 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F9D79C218 for ; Wed, 17 Aug 2022 07:36:23 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id tl27so24911255ejc.1 for ; Wed, 17 Aug 2022 07:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=v2QQ7Uff4GoH2848IKCxUQX2XDpeKAuPtOB6PZeLpak=; b=BUBqid1m+LsLr2gz85xHUy+sqUiJRXFfzq8DQbh9692q8D5hYkQR/AXZMx2yNvg2BF kpYK78ofw8qiX49x58to7+p26d/YmXLzidby5943Y2BYBEZVdBAkkDu1k1+81Xgpiz2L a/EI5qETsF1LBhveYT/3UZCqwVmWXcJoNCoMg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=v2QQ7Uff4GoH2848IKCxUQX2XDpeKAuPtOB6PZeLpak=; b=Cp87xPEazEsxU4+Si6S7hLO4xkmIeSUyJUJ4QX8eVhoq05hEePfptAK62JtzMUkRwF suzjSiSdwCm6s2LfUrOIPKEVWviwnMOZbHShFrVaB8Mfwb9rlA7qYuFDY8DCm+PR5GqL 8px6jCukkG8++/bCl8s8ZGiG0Ob1rtBQmMXXvXeodz0+AzrY8It+cZ2xeirqqoRhcFIJ 3AmbZfkqq8FiTTjzDlY/eCxcx99a5AUEvBmBKVHlQNK2MeWiq0fL9Ca2cpTpNwwF1qPa gO7mHh9c4ErTI7/p2KH0hvfcL/UR1mO6wsrZP8bPpadel0/7wcLLItZarJJQXgO5K9gj F7Wg== X-Gm-Message-State: ACgBeo2zNFgbp4s27FS+IOGL78xIQMEwKOZJ03dUO1zJM45NtIPHS5+O eUrMu4GtYMNnSQ+7zGWbQtJayITPt/ve2Q== 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.32.0