Message ID | 20230518193613.15185-1-jm@ti.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp754603vqo; Thu, 18 May 2023 12:41:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6BVEH/+BziA9I/0u06K3DIpQOe8DwdM8qfUwooJ6J4qG2OLN7B+/WM0O5lDSDAQ19p7s6X X-Received: by 2002:a05:6a20:3c89:b0:105:fd78:cb50 with SMTP id b9-20020a056a203c8900b00105fd78cb50mr1118458pzj.42.1684438895469; Thu, 18 May 2023 12:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684438895; cv=none; d=google.com; s=arc-20160816; b=UgnXe7Xw50Dl+sUXYH5BxNMh3fyK7V3dpEpp215zYDEyona0xWZRLz6Wz8zhK5JuEZ EDReb6Fc5UCjUEy613uTn4p+1AzHh06jS7c1stWtbdC/v4dPix7E11dEcKUhGnJ7Xfvx F5ruiIy9aN1SJmxmJKWkOiSLCap4/b32/OXjd5dtzSVJOxjJBsWyy1gpeZLCCTn698zf +F3NlZM+O3ueNxW215i+WzJUGLDH9y/TlWbxoSYIg7JoeQP2Tj4hibWuWYTA0aHPwkQp Nk3rJOdOWxzPOAkP5E14BMIJyIQY/J8cLuphZ+LXGrK/3k8ZlWu7Nz12dMn8NoyiHqg5 JQzw== 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=SD8y2gafDdujxzLm4oJ2xXRRLyYIT05sQjn7ZYJf0F0=; b=orluGLEddRZbzh+IrcO5fXGF8/mdWYepG2aHS+19gsHvLpGC/ohDHi7w9r0HfLZz4o 1zIur7jzWaoLPozyYppOB1WTDogP6/+yAtSWd/p0Zclx+n+UqoDsOeWbzwUfhnJlmJCA yAVZfbyk+nY+19iBm39yzIHsbz8lP8q4eVQPHKeBAg4tUEJXZmyI/kXrayoeRGqD2q9G bPTCMfBpyao1l1SdFvY5XiIwhLxt1zBjOlhdrdipeHNVUPoiwUG+qhkwuKKd5SsUCaqd 4Mh/g3bccHnwtMbiEob9aROtpl9FI3Me0wGLFM9ppLP+0lgMEdLNxSPlC+omlNrhRSb6 Ineg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=O7Yrnd3b; 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 y16-20020a63b510000000b00534784002afsi1463341pge.807.2023.05.18.12.41.20; Thu, 18 May 2023 12:41:35 -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=O7Yrnd3b; 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 S230062AbjERTgx (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Thu, 18 May 2023 15:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230006AbjERTgv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 18 May 2023 15:36:51 -0400 Received: from lelv0143.ext.ti.com (lelv0143.ext.ti.com [198.47.23.248]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61D9EEE; Thu, 18 May 2023 12:36:49 -0700 (PDT) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 34IJaEN3076166; Thu, 18 May 2023 14:36:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1684438574; bh=SD8y2gafDdujxzLm4oJ2xXRRLyYIT05sQjn7ZYJf0F0=; h=From:To:CC:Subject:Date; b=O7Yrnd3bekefKOuBiqiQOz88aaxMDd6rO7jOn2bKJtSOCrYnxIuvuT5/Nl9M5ttQA jHq4qrZ5KEuYkdUYDlcIUiBJEIt4uBlQIv56NgNoyl+JN8/RPUhqs8MyM/8Jhr34/u c6g24smKDDzbzVc/WGAZuQgruZW7jCZzsbCzk7VQ= Received: from DLEE102.ent.ti.com (dlee102.ent.ti.com [157.170.170.32]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 34IJaE4E002970 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 18 May 2023 14:36:14 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE102.ent.ti.com (157.170.170.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 18 May 2023 14:36:13 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE115.ent.ti.com (157.170.170.26) 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; Thu, 18 May 2023 14:36:13 -0500 Received: from a0498204.dal.design.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 34IJaDvT053146; Thu, 18 May 2023 14:36:13 -0500 From: Judith Mendez <jm@ti.com> To: Chandrasekar Ramakrishnan <rcsekar@samsung.com>, <linux-can@vger.kernel.org> CC: Wolfgang Grandegger <wg@grandegger.com>, Marc Kleine-Budde <mkl@pengutronix.de>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, Schuyler Patton <spatton@ti.com>, Tero Kristo <kristo@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, <linux-arm-kernel@lists.infradead.org>, <devicetree@vger.kernel.org>, Oliver Hartkopp <socketcan@hartkopp.net>, Conor Dooley <conor+dt@kernel.org> Subject: [PATCH v6 0/2] Enable multiple MCAN on AM62x Date: Thu, 18 May 2023 14:36:11 -0500 Message-ID: <20230518193613.15185-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 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766262199035577407?= X-GMAIL-MSGID: =?utf-8?q?1766262199035577407?= |
Series |
Enable multiple MCAN on AM62x
|
|
Message
Judith Mendez
May 18, 2023, 7:36 p.m. UTC
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. 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: - 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 | 31 +++++++++++++++- drivers/net/can/m_can/m_can.h | 4 +++ drivers/net/can/m_can/m_can_platform.c | 35 +++++++++++++++++-- 4 files changed, 84 insertions(+), 6 deletions(-) base-commit: 798d276b39e984345d52b933a900a71fa0815928