From patchwork Tue Dec 19 14:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xingyu Wu X-Patchwork-Id: 18306 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1991754dyi; Tue, 19 Dec 2023 06:55:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFUpynbXxkPOfMzltntvlMPbmlaz5smEjaGukxENDosKd6C1/0IJ1HvC5o2KSuQGQuSaSWB X-Received: by 2002:a05:6870:5594:b0:203:ba99:7710 with SMTP id qj20-20020a056870559400b00203ba997710mr4204618oac.17.1702997700417; Tue, 19 Dec 2023 06:55:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702997700; cv=none; d=google.com; s=arc-20160816; b=Ykp18c7fcvF640LZJrlNGWb3MvAlwfg114AbAJO+Ll/Bni7YaY8ACoZizc149SiLYa o1h9mI6dhKAvLLJfIxP68X35QgjXLpfUOjbs9JW4rPJfM/1OiFPKqZXQJigLnxCvM4Oa sVq8zEmouPJ+uVfWlkB/k+3nR2LS8UT9Luu09KMHWXwkzPpD3EDsJWry/VFTtgpPHWMo M7TQDyAI14pyg769WfLGYq5vLKUKG3yTBUanSjm9ReNZ/REDOOuUMFVwfFYLhnyX7UAV 1v3fQ+803P7CSwLrI9ZQl6oUq0fAkCmoLKAKB2WJN5LUx/YAPaFMPgSLxXMs+/PpmpIy S2LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=ggExz46zxa2nu/at5kcpoZitVCWXK7FH9izQRsX2GI4=; fh=6IUnnv9uwkBrfAtoVniyYWJWHbkQfzj6U5gW0z7Gy4M=; b=N/N9U4CDhtL/1XOam4H/zDt4cwRQ+++AkQxnwxNzmyUa0UPREPMIyR9x0fzTMn4oNL 79q7WLVb6Sz28KYn8f4nBZwKh+WHOgr5/76wk38VlXh6wGyXy4bqRTTFVYRbylbrJP/U EHczNUOPYjhk8OaGnjt1mctk/3/9uv8FlMwxX8jl3uKryyN+F6rYSWELV5Cc4PfRJI4+ Vw0I9Ttucfftqb55c0cd6Fv+N4CnlJMK5ZYgjeMLRPQj7zM6I0qhgroLZ2S7gDzmNEfW 0YabvybgVQ+xK2enx1RTKPsW8LBRR3jKl46nmr9/Ng5K+AUvbAg/WZSNqfT+pMqOqJ4v 7OVQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5417-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5417-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id w8-20020a05620a424800b00767e30f501asi12731794qko.402.2023.12.19.06.55.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 06:55:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5417-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-5417-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5417-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0B0961C21006 for ; Tue, 19 Dec 2023 14:54:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D9551CF86; Tue, 19 Dec 2023 14:54:19 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from fd01.gateway.ufhost.com (fd01.gateway.ufhost.com [61.152.239.71]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FE0A1C6B5; Tue, 19 Dec 2023 14:54:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=starfivetech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=starfivetech.com 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 950F78132; Tue, 19 Dec 2023 22:54: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; Tue, 19 Dec 2023 22:54:03 +0800 Received: from localhost.localdomain (113.72.145.47) by EXMBX061.cuchost.com (172.16.6.61) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Tue, 19 Dec 2023 22:54: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 , , Conor Dooley Subject: [PATCH v8 0/3] Add timer driver for StarFive JH7110 RISC-V SoC Date: Tue, 19 Dec 2023 22:53:59 +0800 Message-ID: <20231219145402.7879-1-xingyu.wu@starfivetech.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: EXCAS061.cuchost.com (172.16.6.21) To EXMBX061.cuchost.com (172.16.6.61) X-YovoleRuleAgent: yovoleflag X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785722516846066180 X-GMAIL-MSGID: 1785722516846066180 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. This timer is used as global timer and register clockevent for each CPU core after riscv-timer registration on the StarFive JH7110 SoC. Changes since v7: - Rebased on 6.7-rc6. - Modified the Kconfig file and added selection in SOC_STARFIVE. - Used the timer as a global timer and registered as clockevent for each CPU core. - Dropped the timeout function in the interrupt handler callback. - Changed the way in the functions of jh7110_timer_tick_resume() and jh7110_timer_resume(). - Dropped the registration of clocksource in the probe. v7: https://lore.kernel.org/all/20231019053501.46899-1-xingyu.wu@starfivetech.com/ 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/Kconfig.socs | 1 + arch/riscv/boot/dts/starfive/jh7110.dtsi | 20 + drivers/clocksource/Kconfig | 9 + drivers/clocksource/Makefile | 1 + drivers/clocksource/timer-jh7110.c | 360 ++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 8 files changed, 495 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/starfive,jh7110-timer.yaml create mode 100644 drivers/clocksource/timer-jh7110.c