From patchwork Thu Oct 19 05:34:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xingyu Wu X-Patchwork-Id: 15586 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2010:b0:403:3b70:6f57 with SMTP id fe16csp174619vqb; Wed, 18 Oct 2023 22:36:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFx2SkD3Ubd/+7QTW2UIo8rH1geZS7qtyBPdE1Kg0/3ZQgNzF2NMvFq/LFQzJEOXSdJRjKd X-Received: by 2002:a05:6a20:158b:b0:133:8784:15f7 with SMTP id h11-20020a056a20158b00b00133878415f7mr1398011pzj.14.1697693791358; Wed, 18 Oct 2023 22:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697693791; cv=none; d=google.com; s=arc-20160816; b=iyIPKqXPppo/HyHrVS2B5HFhKvNM8iFhI9VS5VAR+JCaOuwbjtZBPp/G3Ej+ktv5VG 0/oCPiZmuMBAbUo95iOxhuFLYP7uSqeeWpu5A9DqDSUIGMXCIeJBRSeW4hnMqGv9NKi8 lUWD0NKS14Ks3qERKdB4KutY0UIxzYYcUzJ6VqMUmkrLrlHroiJm8HOxWNqxqg+jpLLl X5TLkoCjx9NsYzS6zVKPNCx+tOuIKFa0r/Di0NFSIvU5J/V6yjpOkTQPMCqQu7jLYKDq sbcdWgD25f0REtgBtKnazukQWLjpV++vfjyMGC3oELjIo34elx2jbUTlRFpRSro8nA0h bdUg== 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; bh=liI7GlJ7waEDUGVdlgcv4DllxTtvuOuRa7NMOJFt39c=; fh=U35VaI2VhNr3pPNfgjXZzjzNImn7EzZodFPICcSprcI=; b=pVRTtNhDBZljccz+kgc6JDLCuMoWGeoQ4fd6Yc53oC1EOqC8ZWysWy10OVDuvw5YR9 2ieuDuWn4H3ybMk+avqol0VK7nKE+IXOK+Rxox0cU3Hsd9W7iMCe3fTWsuPp6tuitVAk I1IOFHqaG+Cop6DUufDaB759WVeV4AdeDwFWi4+EAQkyfKxpxQlNpyQ1qlFsCMVA9Cgb IxHZlFsz6g8lMZjnhkWMi66OHh9hNs/Q8gs3OGGl3R6l+30DiM93hJCAkkSSsUtteKz0 4Igd4rgXFQsQRJx9WXrKIdMTd6CPyj6Jr3YjloXu6FYidy5X0XiXceLHhm6qWXSJyYVk ot5Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id j187-20020a638bc4000000b00565f182839asi3204893pge.28.2023.10.18.22.36.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 22:36:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id A79FF80A430F; Wed, 18 Oct 2023 22:36:06 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232665AbjJSFfd convert rfc822-to-8bit (ORCPT + 24 others); Thu, 19 Oct 2023 01:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232673AbjJSFf0 (ORCPT ); Thu, 19 Oct 2023 01:35:26 -0400 Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3E7418C; Wed, 18 Oct 2023 22:35:23 -0700 (PDT) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by fd01.gateway.ufhost.com (Postfix) with ESMTP id D3A7C24E050; Thu, 19 Oct 2023 13:35:03 +0800 (CST) Received: from EXMBX061.cuchost.com (172.16.6.61) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 19 Oct 2023 13:35:03 +0800 Received: from localhost.localdomain (183.27.99.123) by EXMBX061.cuchost.com (172.16.6.61) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Thu, 19 Oct 2023 13:35:02 +0800 From: Xingyu Wu To: Daniel Lezcano , Thomas Gleixner , Emil Renner Berthing , Christophe JAILLET CC: , , "Rob Herring" , Krzysztof Kozlowski , Paul Walmsley , Palmer Dabbelt , Albert Ou , Philipp Zabel , Walker Chen , Xingyu Wu , "Samin Guo" , , "Conor Dooley" Subject: [PATCH v7 0/3] Add timer driver for StarFive JH7110 RISC-V SoC Date: Thu, 19 Oct 2023 13:34:58 +0800 Message-ID: <20231019053501.46899-1-xingyu.wu@starfivetech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Originating-IP: [183.27.99.123] X-ClientProxiedBy: EXCAS062.cuchost.com (172.16.6.22) To EXMBX061.cuchost.com (172.16.6.61) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 18 Oct 2023 22:36:06 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780160965277122272 X-GMAIL-MSGID: 1780160965277122272 This patch serises are to add timer driver for the StarFive JH7110 RISC-V SoC. The first patch adds documentation to describe device tree bindings. The subsequent patch adds timer driver and support JH7110 SoC. The last patch adds device node about timer in JH7110 dts. This timer has four free-running 32 bit counters and runs in 24MHz clock on StarFive JH7110 SoC. And each channel(counter) triggers an interrupt when timeout. They support one-shot mode and continuous-run mode. Changes since v6: - Rebased on 6.6-rc6. - Used sizeof() instead of the numbers of characters about names. - Added devm_add_action_or_reset() to release the resets and clocksources in the case of remove or error in the probe. - Added flags to check each clocksource is suceessfully registered and used in the release function. - Dropped the variable of irq in the jh7110_clkevt struct. - Dropped the wrappers and used enum definitions and writel() calls directly. v6: https://lore.kernel.org/all/20231012081015.33121-1-xingyu.wu@starfivetech.com/ Changes since v5: - Rebased on 6.6-rc5. - Changed the number about characters of name. - Made the clkevt->periodic to a local variable. - Dropped the variables of device and base. - Used clkevt->evt.irq directly and dropped the extra copy of irq. V5: https://lore.kernel.org/all/20230907053742.250444-1-xingyu.wu@starfivetech.com/ Changes since v4: - Rebased on 6.5. - Dropped the useless enum and used value directly when writing registers. - Modified the description in Kconfig. - Add the reviewed tag in patch 3. v4: https://lore.kernel.org/all/20230814101603.166951-1-xingyu.wu@starfivetech.com/ Changes since v3: - Rebased on 6.5-rc6 - Dropped the useless enum names like 'JH7110_TIMER_CH_0'. - Dropped the platform data about JH7110 and used the register offsets directly. - Drroped the useless functions of clk_disable_unprepare(). v3: https://lore.kernel.org/all/20230627055313.252519-1-xingyu.wu@starfivetech.com/ Changes since v2: - Rebased on 6.4-rc7. - Merged the header file into the c file. - Renamed the functions from 'starfive_' to 'jh7110_' - Used function 'clocksource_register_hz' instead of 'clocksource_mmio_init'. v2: https://lore.kernel.org/all/20230320135433.144832-1-xingyu.wu@starfivetech.com/ Changes since v1: - Added description about timer and modified properties' description in dt-bindings. - Dropped the 'interrupt-names' and 'clock-frequency' in dt-bindings. - Renamed the functions and added 'starfive_' - Modified that the driver probe by platform bus. v1: https://lore.kernel.org/all/20221223094801.181315-1-xingyu.wu@starfivetech.com/ Xingyu Wu (3): dt-bindings: timer: Add timer for StarFive JH7110 SoC clocksource: Add JH7110 timer driver riscv: dts: jh7110: starfive: Add timer node .../bindings/timer/starfive,jh7110-timer.yaml | 96 +++++ MAINTAINERS | 7 + arch/riscv/boot/dts/starfive/jh7110.dtsi | 20 + drivers/clocksource/Kconfig | 11 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-jh7110.c | 380 ++++++++++++++++++ 6 files changed, 515 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/starfive,jh7110-timer.yaml create mode 100644 drivers/clocksource/timer-jh7110.c