From patchwork Wed Apr 19 22:33:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Judith Mendez X-Patchwork-Id: 8454 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp728643vqo; Wed, 19 Apr 2023 16:23:40 -0700 (PDT) X-Google-Smtp-Source: AKy350Y2i4u9++DSZPiQ+qcx4EumVLJ46JZB6OKwu08cCnzoE9y+pBRy9hrJV02gw4oFnbjvJ791 X-Received: by 2002:a17:902:da81:b0:1a9:236d:2fd3 with SMTP id j1-20020a170902da8100b001a9236d2fd3mr2974243plx.53.1681946619839; Wed, 19 Apr 2023 16:23:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681946619; cv=none; d=google.com; s=arc-20160816; b=Phe2F+2DDPfohA7b5UHT/zEWj+VLfZQ7gKkKZ2dIlsfBTXkCIXQa7x8dqhcNj+mSzD B4ZVlQfAFpajgkPfV2AfuUbJ4z9BBiR9d2R62DKyfQRBETpLIltdROLmEHhmgTx38hNM V3k3olyU/tOJltCgoVUxYAMHSVl5Z4CSEdCJNqKS0eupmbic4dA8W7exR+e5I+qboe7z 9rWO0cGd3vNu8xq2u+PUT2kFQW5YtGZUOnZzu/PXV3OqJerPy3hG9PoHsU43pXCp1WSY neIilKqwQN6ZJlKaMxyfqu2IkRPpf0KCLGZ9A0D+FVnObI1a89vmVCfwCME4sHJwUT7T vbJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=qSHxA2JuD9iVuHUIsjmZUVoAD15PhbOU9uLN9c3n25g=; b=U2EFzWbvBJitKkJ4ydAD9zkMc0WslC+B3mJ0P3gGi5tGt+WGt6X9Jkc9VT/Wcdt31j HP9F6Sm5ZuIiUjTlVF+V/or5BUgiinG3q0mrnmpkWm3/dwO6AwmbDYn8YGa68xWPFM6U 04/vF7TSk+2iPdDZMhXVtBaKY4aUV0UdwPhYg/XwNd0vS5Kq7D/lGeTp6Ql2y2SRm/Rm KBlEx2i0AcNlULJn3g0ng2INUGmTtICLyQQ9T+IPwrvsh5puzLef8eKDBipexTzG8now PHQFbxcFYCPc05v2rvZ+O2iZLgBpnaPIQ2epImisnunYOfkuD5wONrw1CbxEmTFJ2QTR YPdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=ng6lnJQq; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a170902e55200b0019e67626276si5421plf.392.2023.04.19.16.23.27; Wed, 19 Apr 2023 16:23: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=@ti.com header.s=ti-com-17Q1 header.b=ng6lnJQq; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbjDSWrQ (ORCPT + 99 others); Wed, 19 Apr 2023 18:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229583AbjDSWrO (ORCPT ); Wed, 19 Apr 2023 18:47:14 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11F79AB; Wed, 19 Apr 2023 15:47:09 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 33JMXOTX088934; Wed, 19 Apr 2023 17:33:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1681943604; bh=qSHxA2JuD9iVuHUIsjmZUVoAD15PhbOU9uLN9c3n25g=; h=From:To:CC:Subject:Date; b=ng6lnJQqlOjY+0biJJDivbVoW2wOfHYT26DJcfg/sbVkwss1AhUTmpuZeQ/i1bqJV 3RslBeMDaY2fu+ZDgKtF4j3fFwvsvgocK54/dEP10NUBOM+afMoWBhoPgGISYj+4zg 4Gws3A1rawdVHqtXXQI0S+mIKcAqbZSHgOuMHYAI= Received: from DLEE101.ent.ti.com (dlee101.ent.ti.com [157.170.170.31]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 33JMXOlh059400 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 19 Apr 2023 17:33:24 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16; Wed, 19 Apr 2023 17:33:24 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.16 via Frontend Transport; Wed, 19 Apr 2023 17:33:23 -0500 Received: from a0498204.dal.design.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 33JMXNLV015736; Wed, 19 Apr 2023 17:33:23 -0500 From: Judith Mendez To: Chandrasekar Ramakrishnan , Wolfgang Grandegger , Marc Kleine-Budde CC: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Schuyler Patton , Nishanth Menon , Vignesh Raghavendra , Tero Kristo , Rob Herring , Krzysztof Kozlowski , Oliver Hartkopp , Judith Mendez , , , , , Subject: [PATCH 0/4] Enable multiple MCAN on AM62x Date: Wed, 19 Apr 2023 17:33:19 -0500 Message-ID: <20230419223323.20384-1-jm@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763102051417367168?= X-GMAIL-MSGID: =?utf-8?q?1763648858716687425?= On AM62x there is one MCAN in MAIN domain and two in MCU domain. The MCANs in MCU domain were not enabled since there is no hardware interrupt routed to A53 GIC interrupt controller. Therefore A53 Linux cannot be interrupted by MCU MCANs. This solution instantiates a hrtimer with 1 ms polling interval for a MCAN when there is no hardware interrupt. This hrtimer generates a recurring software interrupt which allows to call the isr. The isr will check if there is pending transaction by reading a register and proceed normally if there is. On AM62x this series enables two MCU MCAN which will use the hrtimer implementation. MCANs with hardware interrupt routed to A53 Linux will continue to use the hardware interrupt as expected. Timer polling method was tested on both classic CAN and CAN-FD at 125 KBPS, 250 KBPS, 1 MBPS and 2.5 MBPS with 4 MBPS bitrate switching. Letency and CPU load benchmarks were tested on 3x MCAN on AM62x. 1 MBPS timer polling interval is the better timer polling interval since it has comparable latency to hardware interrupt with the worse case being 1ms + CAN frame propagation time and CPU load is not substantial. Latency can be improved further with less than 1 ms polling intervals, howerver it is at the cost of CPU usage since CPU load increases at 0.5 ms and lower polling periods than 1ms. Note that in terms of power, enabling MCU MCANs with timer-polling implementation might have negative impact since we will have to wake up every 1 ms whether there are CAN packets pending in the RX FIFO or not. This might prevent the CPU from entering into deeper idle states for extended periods of time. This patch series depends on 'Enable CAN PHY transceiver driver': https://lore.kernel.org/lkml/775ec9ce-7668-429c-a977-6c8995968d6e@app.fastmail.com/T/ Previously sent an RFC: https://lore.kernel.org/linux-can/52a37e51-4143-9017-42ee-8d17c67028e3@ti.com/T/#t Judith Mendez (4): can: m_can: Add hrtimer to generate software interrupt dt-bindings: net: can: Make interrupt attributes optional for MCAN arm64: dts: ti: Add AM62x MCAN MAIN domain transceiver overlay arm64: dts: ti: Enable MCU MCANs for AM62x .../bindings/net/can/bosch,m_can.yaml | 2 - arch/arm64/boot/dts/ti/Makefile | 2 + arch/arm64/boot/dts/ti/k3-am62-mcu.dtsi | 24 ++++++++ .../boot/dts/ti/k3-am625-sk-mcan-main.dtso | 35 ++++++++++++ .../boot/dts/ti/k3-am625-sk-mcan-mcu.dtso | 55 +++++++++++++++++++ drivers/net/can/m_can/m_can.c | 30 +++++++++- drivers/net/can/m_can/m_can.h | 3 + drivers/net/can/m_can/m_can_platform.c | 13 ++++- 8 files changed, 158 insertions(+), 6 deletions(-) create mode 100644 arch/arm64/boot/dts/ti/k3-am625-sk-mcan-main.dtso create mode 100644 arch/arm64/boot/dts/ti/k3-am625-sk-mcan-mcu.dtso