From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59E36C7EE26 for ; Tue, 23 May 2023 02:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234715AbjEWCiU (ORCPT ); Mon, 22 May 2023 22:38:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232332AbjEWCiS (ORCPT ); Mon, 22 May 2023 22:38:18 -0400 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8F16CA; Mon, 22 May 2023 19:38:16 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34N2bpBK020737; Mon, 22 May 2023 21:37:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1684809471; bh=hkhGcEhPR6UPrPlDGiGXc7Ka/ldbgk7SCCgn8nIuQ/w=; h=From:To:CC:Subject:Date; b=dO3Y73RSaVoMXz/rqUArHKOiuaKYOCbU+Y5ciJxtAdcrC1V0yFh/4Wq8QfQi0rUoF Y7JuBIedqMDOiwXSdcF5tuhZFyXnBmVjf2oJWuRRLcV51cEILu7AMcR028EAvEaCG8 kiU5/zqzXcxkhu9+vmWh09cuMVhhmu8FUnUIJ/IE= Received: from DLEE100.ent.ti.com (dlee100.ent.ti.com [157.170.170.30]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34N2bpMc032579 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 22 May 2023 21:37:51 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE100.ent.ti.com (157.170.170.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 22 May 2023 21:37:50 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) 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.23 via Frontend Transport; Mon, 22 May 2023 21:37:50 -0500 Received: from a0498204.dal.design.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34N2bnsW031957; Mon, 22 May 2023 21:37:50 -0500 From: Judith Mendez To: Chandrasekar Ramakrishnan , CC: Wolfgang Grandegger , Marc Kleine-Budde , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , , , Schuyler Patton , Tero Kristo , Rob Herring , Krzysztof Kozlowski , Conor Dooley , , Oliver Hartkopp , Tony Lindgren Subject: [PATCH v7 0/2] Enable multiple MCAN on AM62x Date: Mon, 22 May 2023 21:37:47 -0500 Message-ID: <20230523023749.4526-1-jm@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-can@vger.kernel.org On AM62x there are two MCANs 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 MCAN device when there is no hardware interrupt property in DTB MCAN node. The 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. 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. 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. v6: Link: https://lore.kernel.org/linux-can/20230518193613.15185-1-jm@ti.com/T/#t v5: Link: https://lore.kernel.org/linux-can/20230510202952.27111-1-jm@ti.com/T/#t v4: Link: https://lore.kernel.org/linux-can/c3395692-7dbf-19b2-bd3f-31ba86fa4ac9@linaro.org/T/#t v2: Link: https://lore.kernel.org/linux-can/20230424195402.516-1-jm@ti.com/T/#t V1: Link: https://lore.kernel.org/linux-can/19d8ae7f-7b74-a869-a818-93b74d106709@ti.com/T/#t RFC: Link: https://lore.kernel.org/linux-can/52a37e51-4143-9017-42ee-8d17c67028e3@ti.com/T/#t v6: - Clean up m_can_platform.c after removing poll-interval v6: - Move hrtimer stop/start function calls to m_can_open and m_can_close to support power suspend/resume v5: - Remove poll-interval in bindings - Change dev_dbg to dev_info if hardware int exists and polling is enabled v4: - Wrong patches sent v3: - Update binding poll-interval description - Add oneOf to select either interrupts/interrupt-names or poll-interval - Create a define for 1 ms polling interval - Change plarform_get_irq to optional to not print error msg v2: - Add poll-interval property to bindings and MCAN DTB node - Add functionality to check for 'poll-interval' property in MCAN node - Bindings: add an example using poll-interval - Add 'polling' flag in driver to check if device is using polling method - Check for timer polling and hardware interrupt cases, default to hardware interrupt method - Change ns_to_ktime() to ms_to_ktime() Judith Mendez (2): dt-bindings: net: can: Remove interrupt properties for MCAN can: m_can: Add hrtimer to generate software interrupt .../bindings/net/can/bosch,m_can.yaml | 20 +++++++++-- drivers/net/can/m_can/m_can.c | 33 +++++++++++++++++-- drivers/net/can/m_can/m_can.h | 4 +++ drivers/net/can/m_can/m_can_platform.c | 25 ++++++++++++-- 4 files changed, 75 insertions(+), 7 deletions(-) base-commit: 9f258af06b6268be8e960f63c3f66e88bdbbbdb0 -- 2.17.1