From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2B0B920A5F3 for ; Mon, 4 Aug 2025 15:23:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321035; cv=none; b=MjWVJbtiebkGngTncatpI8chfmwJWPRZmQ3pIYtYZCpDOX6NGBPMb92CK+MaE14DeH61g1mYzD9n8TwW9OGCZWtACZdIDGuN1Fohn7k849fK8ANqiF2auTej9dvkj/xItk6qfCQYL50EohiL84jX+5mJ3rMcj7jptiSC2EujxXM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321035; c=relaxed/simple; bh=w2xwY+psk//OZwbddelgesU6on196c+FTOi3IN1ZjdY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pxqw4Q335OzgC1y5tFPrQlGgfj8KAFqWBZEfyjEswbsNYyDEgW9s9uJ4vAizwnXP2foK3BpV07ShF02HVJAvP90lv3764/zbYlyMECUlpcaePDTG9r78addvAvr02st9+hLoTV+5uC1wikRrNpANKKArBbULoLdbDPaWFhWrFSQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Js6J9wUB; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Js6J9wUB" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3b8d0f1fb49so2295439f8f.2 for ; Mon, 04 Aug 2025 08:23:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321032; x=1754925832; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=matpD/z9zLwTTC5HhjXOMGtKe1AMVVauG6MOZr7zlg4=; b=Js6J9wUB2aQF5MW3YOprKsje+OtzaLoW+Ce0Mkvy3ANNZT6T/Lik7rFCJ/Se6OdFV2 YLjfNqP7WEd16x2h4Wxq+FoIxTp6ZJQFc3grZPN9O0hDDVhH3PtGsAVbDEJro9yfi2KE ij0aGSPgLj8b4rwlchaQWBtVsl2IYMbVEGBS3xgDPmFMl2YBwLj6ktdOlNs8Q1oWFMk2 UAd4ocS2LQo9H6qOv0TrLwg84TCm6IPeCsjS4+ljTgsPQc2wc8fonSuhDjDKeRWxsa/E n/ohMAux+JwlZGVxDbjzqaoTZGcfX/FQU+K34RyawG8kRk7pLYWvqHTpBr3u9R3wfJh3 zXuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321032; x=1754925832; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=matpD/z9zLwTTC5HhjXOMGtKe1AMVVauG6MOZr7zlg4=; b=HTG3PdL6X5YtZ0F0+530TMLUP2bqJRCEMexPA+yhj0KL8FTVVVhOEKBVSNt6DgJ3zQ KPlBeQQQCy+6AbmWYrHMitaxzR3wzNZEofVP6brLCvUr5OIxqcHzR6gISEkhKUdaqLPb AtKMfFso0wgbFb+t78HtjZEc9KjhjpWME79dl/7fnxaz3dFy5XgCQbVTdJXnRBtGAunR yswDL39QYlynPB5VZF4/u6LCBvil9FzpfBpjzBx0P5wimfIAV+izLqcIHNuItsZ8tY3B e1P1Tma8X5BeI0KiGGWj6RLV60jH6BmSTHKye8m9ERP1omjiCNcY8qZURIRc6RBkvuqq NxRw== X-Forwarded-Encrypted: i=1; AJvYcCVtgrO7IRGm+AYbYTFiv//vuzisMmf92d7RJTvDU9mG9txLctr/dXKELmr8tTsni+Zgr7hIHVFtA0X4Nv4=@vger.kernel.org X-Gm-Message-State: AOJu0YxO01MpCFS30CTgZj0NXVV2AFb5SjysSmUymMCh/ihubr7rkYQE ZpSGZFpoizYVjnX1vNS4i0XodjQfTfDfNYipLIBaXzI1ch7FaXf5+B1dcbHcMvgCFdE= X-Gm-Gg: ASbGnctigXqcQSN5rW66F3/N781h29f0taSrmKhfHq88SjsKp+i5VpAWOiuLoXqu8wb Daiu1WdgdhOMtdAMhahwJp9p24ziwUpcM0XKCB/GzSive1ymEaME4VDXlz+xOjptCeW5hg7d5Hx tUd1Vh6Qb78AOtMEOFwZLBNLirwxRQ2yCymbrFw6nd4mg/FLJfASU0WVKzRczWnwW/a/Gy/9Yyt eOV2CXTTzKcS4bVMaV9rKz1JUXwFIk/s72vucdX3Y+ainTovd+PRx7/PeqFXDP2DZsuPVpkDc3d pYn7YDzzfIeeYiC/OhFXrem37atFDwWHzmD8ze+o8b1E4OS4u8d6upqJXh2W+S4Sr6TaPd1SOTN cCC1GJ02MQfb58pl5Lxk8qmQDNZv8zAKawKQVxXyJKoHthkc8bs2fuGW4Kzo= X-Google-Smtp-Source: AGHT+IGWChRN2/+XWXtsi2FwLoygeuYyWX1mxoWnvowOLH62wFgKm8z/bkkeYAbEgus1Kcp86OfX8w== X-Received: by 2002:a5d:64e8:0:b0:3b7:93df:39d0 with SMTP id ffacd0b85a97d-3b8d9470d14mr7168034f8f.15.1754321032479; Mon, 04 Aug 2025 08:23:52 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:52 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com, Arnd Bergmann Subject: [PATCH v3 01/20] clocksource/drivers/vf-pit: Replace raw_readl/writel to reald/writel Date: Mon, 4 Aug 2025 17:23:19 +0200 Message-ID: <20250804152344.1109310-2-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The driver uses the raw_readl() and raw_writel() functions. Those are not for MMIO devices. Replace them with readl() and writel() Signed-off-by: Daniel Lezcano Cc: Arnd Bergmann Acked-by: Arnd Bergmann --- drivers/clocksource/timer-vf-pit.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 911c92146eca..8041a8f62d1f 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -35,30 +35,30 @@ static unsigned long cycle_per_jiffy; =20 static inline void pit_timer_enable(void) { - __raw_writel(PITTCTRL_TEN | PITTCTRL_TIE, clkevt_base + PITTCTRL); + writel(PITTCTRL_TEN | PITTCTRL_TIE, clkevt_base + PITTCTRL); } =20 static inline void pit_timer_disable(void) { - __raw_writel(0, clkevt_base + PITTCTRL); + writel(0, clkevt_base + PITTCTRL); } =20 static inline void pit_irq_acknowledge(void) { - __raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG); + writel(PITTFLG_TIF, clkevt_base + PITTFLG); } =20 static u64 notrace pit_read_sched_clock(void) { - return ~__raw_readl(clksrc_base + PITCVAL); + return ~readl(clksrc_base + PITCVAL); } =20 static int __init pit_clocksource_init(unsigned long rate) { /* set the max load value and start the clock source counter */ - __raw_writel(0, clksrc_base + PITTCTRL); - __raw_writel(~0UL, clksrc_base + PITLDVAL); - __raw_writel(PITTCTRL_TEN, clksrc_base + PITTCTRL); + writel(0, clksrc_base + PITTCTRL); + writel(~0UL, clksrc_base + PITLDVAL); + writel(PITTCTRL_TEN, clksrc_base + PITTCTRL); =20 sched_clock_register(pit_read_sched_clock, 32, rate); return clocksource_mmio_init(clksrc_base + PITCVAL, "vf-pit", rate, @@ -76,7 +76,7 @@ static int pit_set_next_event(unsigned long delta, * hardware requirement. */ pit_timer_disable(); - __raw_writel(delta - 1, clkevt_base + PITLDVAL); + writel(delta - 1, clkevt_base + PITLDVAL); pit_timer_enable(); =20 return 0; @@ -125,8 +125,8 @@ static struct clock_event_device clockevent_pit =3D { =20 static int __init pit_clockevent_init(unsigned long rate, int irq) { - __raw_writel(0, clkevt_base + PITTCTRL); - __raw_writel(PITTFLG_TIF, clkevt_base + PITTFLG); + writel(0, clkevt_base + PITTCTRL); + writel(PITTFLG_TIF, clkevt_base + PITTFLG); =20 BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, "VF pit timer", &clockevent_pit)); @@ -183,7 +183,7 @@ static int __init pit_timer_init(struct device_node *np) cycle_per_jiffy =3D clk_rate / (HZ); =20 /* enable the pit module */ - __raw_writel(~PITMCR_MDIS, timer_base + PITMCR); + writel(~PITMCR_MDIS, timer_base + PITMCR); =20 ret =3D pit_clocksource_init(clk_rate); if (ret) --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4784D21882F for ; Mon, 4 Aug 2025 15:23:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321037; cv=none; b=QwciWpxeOZR68nCP1coAWQGIVKeaLlKydZJT0mowRvMto8Ewd5UzbUWuVOuDexvjdvq/TTQFSM5sfCIE8CcPfPmp3SVYwZRXRrYSmif/l0g42XVHjCFYgUmuEb9tqaYO5syukEivMkulNhonQacR57vYphci0tSm/YF+D9ifckg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321037; c=relaxed/simple; bh=jK9R1dnUwKGI3zGLQm75/1AN+GpBkqgb//hlItvir0c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=B5BV3LySvjpzioMtIz+hi268FcJ2GxCmiYJjbgdHK8VZos5VjBVyO1odsDm2ODm97F3u+7rturH0DG9ZXk+0Q6pgKdQCy0Uc7obR1qmNvnA+RqyvdD4YsqEh1nXAOsSg+a8lFtaZFXXv8E3Xq2uBKSaoDTLLF3r1ll+0GvwRrl0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=tts1qsLu; arc=none smtp.client-ip=209.85.221.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="tts1qsLu" Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-3a6cd1a6fecso3957598f8f.3 for ; Mon, 04 Aug 2025 08:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321033; x=1754925833; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4Bx6PIe+EYTqF7HuIJczhS/0SNZn3oEqyjSCB05qzyk=; b=tts1qsLuQWyPwfeD+NmPQNgd/A8FYtDXNu6chWZSgzZY08KgWCpYszacIKJS1XM4+e XYEpUaritSjZvPGkGwTfYoTCq6EEjMhUytTwgdwyRSzCmnFLcqOdwsZmLaHwe6TASZ1g /0jJ3kZvZURdPw2ckd6J5VzjXC4JFNyzAhfEbxGNTp87C2v/ArdS3ESV+/Dq6FuIlcK1 wk5ZuN/nRiA73ypCIxaKhDNyzmMzIZPBLznEc4ek1ue+zl78+Uh5ovnmFJsgxI76o/te HxYRq1a+GNsKKzSdJVk7uFUaNG/JE4Z1Oae6b8RNaCqMd3O/q/wLUfHNCbTj30yq6oju 0k8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321033; x=1754925833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4Bx6PIe+EYTqF7HuIJczhS/0SNZn3oEqyjSCB05qzyk=; b=sS1UnXqwj+9z3UIKoNveQZvmsKSeVfqYfViysRmWggWuCAeqgRRuGJ8h+62jGaH8iM o0ie3pikS/rglVl9OicO2l4tGKGFzbtfntcTo/AL+TjoE9LFEAqJYnhiLYUekbYC0FmC 2nT9d1Qh8lWJMKMzcKh1xAlMtGNc6R1iilVZ7AIlkj/8pJwap9uJI8h7B/l9w3tNZJ2X 2+uzX1gwRr+KVK9YCdlSIOKjJzKZ+qBnXl68hO2QTbTrfOE661oeDwUzomOB8cxHb3sD qOAl+zkHioRBNM8U+UddVUzh0Qie3mkpAUzbA5w1X5HkjQGDHlX4yIbZ4cKt2QTbcR+p Q3xw== X-Forwarded-Encrypted: i=1; AJvYcCXlaibXZDS7TlaSjOs2Gghgr0CuQxnTu6BHOIwU//ajxgJZkCdSWxmQ80+q8mfmLKF+h4NilXyggyAsbWk=@vger.kernel.org X-Gm-Message-State: AOJu0YwoGMwhSQMpMj8T/Apf9mBoYR07TkzrQUDROOtVfLJ10EO1q8za KrenqTN+N4EuNcfXsCqbliHG48uN/g+ExCu3FGgWCfzvM9P4ggpuPiUYYCTDI3UfPyY= X-Gm-Gg: ASbGncu2ssd1P6tiR1ocJNTZVB04o9ZDlvqvl90jlP1jLp/+EsYSNblI7K5yvzdrXpG WMLunwMKrcgGSgqqlFMGxPEVh/OQr0t48+6HALo37SZ1K+bd55a0rKKeMhQJo9q2O7PNocyQaZt ZBcJYOr1gi3ipJzlEcd1Fv3R7qoxjdNMiETG7lTgpna5vapLxngUS2DjI7oHcZL+JjZ/+fYque4 Poo7iarNtj5ayIq++wP3XmFo3sCwg//TGPG5XBEOcTniWrWhLxC/mUnPTA2qQH+DIYCwCfmt3Au EHzCV7MUyr48B9YqAKvl3QrsmckBXI4KkRbavNXbstnSAUub8fzItXwyKjl26BonMod8gn6OqX+ 50MuV5FtleXQqsubeqMOq5ukPeaY8jDBeBaU8rxLYZQlTavMgrOdBuASIPRU= X-Google-Smtp-Source: AGHT+IEKV7p4h75mL1zWMoNWH8MyfVf/nrpUD4AlS1EgbjOqj8AzMO37fhNuEgrorQQTWP/OUjrfRg== X-Received: by 2002:a5d:584c:0:b0:3b7:8a49:eed0 with SMTP id ffacd0b85a97d-3b8d9472882mr7926118f8f.22.1754321033503; Mon, 04 Aug 2025 08:23:53 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:52 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 02/20] clocksource/drivers/vf-pit: Add COMPILE_TEST option Date: Mon, 4 Aug 2025 17:23:20 +0200 Message-ID: <20250804152344.1109310-3-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The VF PIT driver is a silent koption. In order to allow a better compilation test coverage, let's add the COMPILE_TEST option so it can be selected on other platforms than the Vybrid Family. Signed-off-by: Daniel Lezcano --- drivers/clocksource/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 645f517a1ac2..6f7d371904df 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -475,7 +475,7 @@ config FSL_FTM_TIMER Support for Freescale FlexTimer Module (FTM) timer. =20 config VF_PIT_TIMER - bool + bool "Vybrid Family Programmable timer" if COMPILE_TEST select CLKSRC_MMIO help Support for Periodic Interrupt Timer on Freescale Vybrid Family SoCs. --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3D8621D5BC for ; Mon, 4 Aug 2025 15:23:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321038; cv=none; b=ITols3T97Jnue17jMPFmoK2Uolktyt2/fDIOHvmlV9o/Nhj9ELr19gGZlFFtlfukSbujvgtMDvRgfjr3IcZytCKRNsT3jvemdvRCs70yXq3o4gL4oZ97NIvRIztCrQ3MeQsUW65ZADofKtSwZV87kfx+CCfMF+Z/KV99ulCxcmI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321038; c=relaxed/simple; bh=lB1+NV5iSNlFSlhTC8Xxt8kaeBogF43m8ZXjdWSORVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qa4lAnvi0Eie0SLN21lcMkz1HbPacim3wGGxRJT+8a6q6wrNu8J3CDZtjkL0IU1FvA4TmJszO7zxnQ14Pr81+s/6MQXFtHNazvenBEKyTRp35VctCVYbNLchTH/aMd7Xy54iUlefEDGBgvRU7zEmjZboBTd4dDeolLEFLh5ZYIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Qw+fSbL6; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qw+fSbL6" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-458ba079338so15186495e9.1 for ; Mon, 04 Aug 2025 08:23:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321035; x=1754925835; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oF76aiNEz7qF+G8H8HzTyPMCcCc+/sIEb5cmvblT5b4=; b=Qw+fSbL69yzBYAEnlvwSZhaP7Ffes6lWomb9sM9jU8NbL5aimE/GaVhNBrsgsC3DTi fdjV+qYpFBOtyyY237Le9dHGdPSeyww2qqLkaF6YxpIPairIb2/EVmDJeH64qIwNPAxG NT1hWpYbo/i33i5FbYPacij9q92IZhEAeRMryHfsC4/18VnLaxSc+/LEjC4EM8E6sept NtwvRBiCVpBi0d5apHTaKVUZZSTneyCWj55QdSVoH2XiQsHnFsF5UyyR/FW0u++NacxO 5TZu1oObbsSwQNOKtRWsyibQwaZ7gQJq83MecJ1/qHm1Jh4jqMME9P9DPHdYqhl4ZZ3G ZwzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321035; x=1754925835; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oF76aiNEz7qF+G8H8HzTyPMCcCc+/sIEb5cmvblT5b4=; b=a3TfjnHDKPUKuybT/bYaSKDlN7tuSMzF+P1j81Vg9OqzObQ5lxFI6bBL0kSsF2QV76 ohXJRhmQHspg8Jkf9HP4JUJ7wO2GGPXUWuvNnbfd3BxVAzk+j9+vxUUJg5gbfzLFdrul frUGKJzZmSE7EV0MigDJPcfdZz7yWSKraNnNbxbr0LiQG3lrVXBxuqwR/mkj9YkRtWwj oVXXLq0VlXsbu56yVytVXhaZfCSZuP07Z+zR1Xg09p3A18CIkd0qHpABp2PQKKbc2EGV yn8QHoK9TyviIzT9p65VYScFw6QrcH7BCX2+XZrrFjLzJtTK2hF3NDymcRGly87P7RH2 Ok8w== X-Forwarded-Encrypted: i=1; AJvYcCXk/FMEMYqnqphIKDz1R+vFtSgbAYbKWBZWuxdcxhWAN8kydgb6jGkYVgWiYOS0vZM0cJEr2lL8k05v2L0=@vger.kernel.org X-Gm-Message-State: AOJu0YyNybUYIs2xKACdLlUDUZIND4H52rRfAe+t60dkrnSmfqbHg0P+ WamY5i07pCM5FRSONHPrMT3/L3chZR9ixLuNu3jVReOdXLhxfyWlfGIwABCPUH2Bm3g= X-Gm-Gg: ASbGnctHqi4jiw+TkNDeUtlbxr8kVn9/x3ulNhnocMF61lHW2N+4dIWxLrfjdLnGBYk uJPpPzFTQzA5sSuWAMX5nnRFCuZp3PO94hlGvC1NXzKV1XmM070AvMpMSnSu/b05rWK3EiwfhO1 GUp6+KmGKKLKGJH8L5P4ePfAwMRqTMvbZohGWQqjbPzwbm4uSFZWEP/Uy0YC6hesh2R3fXzEefp pOo5MWUjPSlZQeUOm9E/LjjnYUHdd7jdGC4q5JpVrv4NAg/CxqEhydDFX8Ts4x9Zkmcchv8HzmH QC32t8ETbXzTI6yJfo7wdCm0wDz9tqWaXsOgP/FjzztNmdaNJ+htL7JULeYaVPqWB1bb1Q7aoen 1D5Pz1fSb8eOqbtKfRU46Sxzm1sKnyo2EtGwgSjb1iOQCC9ay X-Google-Smtp-Source: AGHT+IFKc7LwesVt9uJkLHJ8k+ws+EQFPkzFbAin22xt9Ktm/uEoPL1ofRDegqafF+CW7h9wuloJPA== X-Received: by 2002:a05:600c:3d97:b0:459:df1c:a13f with SMTP id 5b1f17b1804b1-459df1ca46emr20297845e9.15.1754321034891; Mon, 04 Aug 2025 08:23:54 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:54 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 03/20] clocksource/drivers/vf-pit: Set the scene for multiple timers Date: Mon, 4 Aug 2025 17:23:21 +0200 Message-ID: <20250804152344.1109310-4-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The driver is implemented as using a single timer and a single clocksource. In order to take advantage of the multiple timers supported in the PIT hardware and introduce different setup for a new platform, let's encapsulate the data into a structure and pass this structure around in the function parameter. The structure will be a per timer instansiation in the next changes. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 121 +++++++++++++++++------------ 1 file changed, 72 insertions(+), 49 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 8041a8f62d1f..e4a8b32fff75 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -15,7 +15,7 @@ */ #define PITMCR 0x00 #define PIT0_OFFSET 0x100 -#define PITn_OFFSET(n) (PIT0_OFFSET + 0x10 * (n)) +#define PIT_CH(n) (PIT0_OFFSET + 0x10 * (n)) #define PITLDVAL 0x00 #define PITCVAL 0x04 #define PITTCTRL 0x08 @@ -29,23 +29,36 @@ =20 #define PITTFLG_TIF 0x1 =20 +struct pit_timer { + void __iomem *clksrc_base; + void __iomem *clkevt_base; + unsigned long cycle_per_jiffy; + struct clock_event_device ced; + struct clocksource cs; +}; + +static struct pit_timer pit_timer; + static void __iomem *clksrc_base; -static void __iomem *clkevt_base; -static unsigned long cycle_per_jiffy; =20 -static inline void pit_timer_enable(void) +static inline struct pit_timer *ced_to_pit(struct clock_event_device *ced) { - writel(PITTCTRL_TEN | PITTCTRL_TIE, clkevt_base + PITTCTRL); + return container_of(ced, struct pit_timer, ced); } =20 -static inline void pit_timer_disable(void) +static inline void pit_timer_enable(struct pit_timer *pit) { - writel(0, clkevt_base + PITTCTRL); + writel(PITTCTRL_TEN | PITTCTRL_TIE, pit->clkevt_base + PITTCTRL); } =20 -static inline void pit_irq_acknowledge(void) +static inline void pit_timer_disable(struct pit_timer *pit) { - writel(PITTFLG_TIF, clkevt_base + PITTFLG); + writel(0, pit->clkevt_base + PITTCTRL); +} + +static inline void pit_irq_acknowledge(struct pit_timer *pit) +{ + writel(PITTFLG_TIF, pit->clkevt_base + PITTFLG); } =20 static u64 notrace pit_read_sched_clock(void) @@ -53,21 +66,24 @@ static u64 notrace pit_read_sched_clock(void) return ~readl(clksrc_base + PITCVAL); } =20 -static int __init pit_clocksource_init(unsigned long rate) +static int __init pit_clocksource_init(struct pit_timer *pit, unsigned lon= g rate) { /* set the max load value and start the clock source counter */ - writel(0, clksrc_base + PITTCTRL); - writel(~0UL, clksrc_base + PITLDVAL); - writel(PITTCTRL_TEN, clksrc_base + PITTCTRL); + writel(0, pit->clksrc_base + PITTCTRL); + writel(~0, pit->clksrc_base + PITLDVAL); + writel(PITTCTRL_TEN, pit->clksrc_base + PITTCTRL); + + clksrc_base =3D pit->clksrc_base; =20 sched_clock_register(pit_read_sched_clock, 32, rate); - return clocksource_mmio_init(clksrc_base + PITCVAL, "vf-pit", rate, + return clocksource_mmio_init(pit->clksrc_base + PITCVAL, "vf-pit", rate, 300, 32, clocksource_mmio_readl_down); } =20 -static int pit_set_next_event(unsigned long delta, - struct clock_event_device *unused) +static int pit_set_next_event(unsigned long delta, struct clock_event_devi= ce *ced) { + struct pit_timer *pit =3D ced_to_pit(ced); + /* * set a new value to PITLDVAL register will not restart the timer, * to abort the current cycle and start a timer period with the new @@ -75,30 +91,37 @@ static int pit_set_next_event(unsigned long delta, * and the PITLAVAL should be set to delta minus one according to pit * hardware requirement. */ - pit_timer_disable(); - writel(delta - 1, clkevt_base + PITLDVAL); - pit_timer_enable(); + pit_timer_disable(pit); + writel(delta - 1, pit->clkevt_base + PITLDVAL); + pit_timer_enable(pit); =20 return 0; } =20 -static int pit_shutdown(struct clock_event_device *evt) +static int pit_shutdown(struct clock_event_device *ced) { - pit_timer_disable(); + struct pit_timer *pit =3D ced_to_pit(ced); + + pit_timer_disable(pit); + return 0; } =20 -static int pit_set_periodic(struct clock_event_device *evt) +static int pit_set_periodic(struct clock_event_device *ced) { - pit_set_next_event(cycle_per_jiffy, evt); + struct pit_timer *pit =3D ced_to_pit(ced); + + pit_set_next_event(pit->cycle_per_jiffy, ced); + return 0; } =20 static irqreturn_t pit_timer_interrupt(int irq, void *dev_id) { - struct clock_event_device *evt =3D dev_id; + struct clock_event_device *ced =3D dev_id; + struct pit_timer *pit =3D ced_to_pit(ced); =20 - pit_irq_acknowledge(); + pit_irq_acknowledge(pit); =20 /* * pit hardware doesn't support oneshot, it will generate an interrupt @@ -106,33 +129,33 @@ static irqreturn_t pit_timer_interrupt(int irq, void = *dev_id) * and start the counter again. So software need to disable the timer * to stop the counter loop in ONESHOT mode. */ - if (likely(clockevent_state_oneshot(evt))) - pit_timer_disable(); + if (likely(clockevent_state_oneshot(ced))) + pit_timer_disable(pit); =20 - evt->event_handler(evt); + ced->event_handler(ced); =20 return IRQ_HANDLED; } =20 -static struct clock_event_device clockevent_pit =3D { - .name =3D "VF pit timer", - .features =3D CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT, - .set_state_shutdown =3D pit_shutdown, - .set_state_periodic =3D pit_set_periodic, - .set_next_event =3D pit_set_next_event, - .rating =3D 300, -}; - -static int __init pit_clockevent_init(unsigned long rate, int irq) +static int __init pit_clockevent_init(struct pit_timer *pit, unsigned long= rate, int irq) { - writel(0, clkevt_base + PITTCTRL); - writel(PITTFLG_TIF, clkevt_base + PITTFLG); + writel(0, pit->clkevt_base + PITTCTRL); + + writel(PITTFLG_TIF, pit->clkevt_base + PITTFLG); =20 BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, - "VF pit timer", &clockevent_pit)); + "VF pit timer", &pit->ced)); + + pit->ced.cpumask =3D cpumask_of(0); + pit->ced.irq =3D irq; + + pit->ced.name =3D "VF pit timer"; + pit->ced.features =3D CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; + pit->ced.set_state_shutdown =3D pit_shutdown; + pit->ced.set_state_periodic =3D pit_set_periodic; + pit->ced.set_next_event =3D pit_set_next_event; + pit->ced.rating =3D 300; =20 - clockevent_pit.cpumask =3D cpumask_of(0); - clockevent_pit.irq =3D irq; /* * The value for the LDVAL register trigger is calculated as: * LDVAL trigger =3D (period / clock period) - 1 @@ -141,7 +164,7 @@ static int __init pit_clockevent_init(unsigned long rat= e, int irq) * LDVAL trigger value is 1. And then the min_delta is * minimal LDVAL trigger value + 1, and the max_delta is full 32-bit. */ - clockevents_config_and_register(&clockevent_pit, rate, 2, 0xffffffff); + clockevents_config_and_register(&pit->ced, rate, 2, 0xffffffff); =20 return 0; } @@ -164,8 +187,8 @@ static int __init pit_timer_init(struct device_node *np) * so choose PIT2 as clocksource, PIT3 as clockevent device, * and leave PIT0 and PIT1 unused for anyone else who needs them. */ - clksrc_base =3D timer_base + PITn_OFFSET(2); - clkevt_base =3D timer_base + PITn_OFFSET(3); + pit_timer.clksrc_base =3D timer_base + PIT_CH(2); + pit_timer.clkevt_base =3D timer_base + PIT_CH(3); =20 irq =3D irq_of_parse_and_map(np, 0); if (irq <=3D 0) @@ -180,15 +203,15 @@ static int __init pit_timer_init(struct device_node *= np) return ret; =20 clk_rate =3D clk_get_rate(pit_clk); - cycle_per_jiffy =3D clk_rate / (HZ); + pit_timer.cycle_per_jiffy =3D clk_rate / (HZ); =20 /* enable the pit module */ writel(~PITMCR_MDIS, timer_base + PITMCR); =20 - ret =3D pit_clocksource_init(clk_rate); + ret =3D pit_clocksource_init(&pit_timer, clk_rate); if (ret) return ret; =20 - return pit_clockevent_init(clk_rate, irq); + return pit_clockevent_init(&pit_timer, clk_rate, irq); } TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DF3A8221DB6 for ; Mon, 4 Aug 2025 15:23:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321039; cv=none; b=DRU/2Z0Rk4P5iYe4J1CHY2OBput4S14bUy8+6DO/7St+PycK6tQY79Q9c3cy8A/Hlod63gJJiFgTk184ct4VNkMPZBbxcCz8lf1vUjdPGaazQ/DmIl8WnFD5Q8gkyVv1Flvl+IrNqLMXp2QeBWqewiCvrHspbTGYjY2r4BQSVkA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321039; c=relaxed/simple; bh=0KuB3AybAjcPPMcV1rgQ1SlzNiGtShCdSCBHySW+pEQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MFcvyvaS/qi3YKcTqt+/NOdgbMxqZLTcZI6b8w9xfX5/yttS1HQnMluyZZ67PbqWvluwwFBKGiiIg5qlpUWNRtYB2GRhjEnR8t9Zi94Sw49WqcA6SjJschHpb5WQusWPTTC6vRZrRpi8ftTVeaCSViG34tnEaMpzwG93+BBOToc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=f1Ml/XY2; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="f1Ml/XY2" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-45994a72356so12786525e9.0 for ; Mon, 04 Aug 2025 08:23:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321036; x=1754925836; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JX9UHWpArLRDJEf0tCoCLNi/F9HBfmQyxuSXNQbke7w=; b=f1Ml/XY2IhLGBamo1mvXVnDsGP5qIqS0cA/q5r3UHoAJWcOiewrRm3hpsArO17zU4j l/jVf3PP5HAbHeO5CPwgiy/Y/1tPnnMOWTbbtXYha/FVyQtnb/V73gSck0aX0zcFWvKz HMJfMUYIMq2MGKJ1tK9UG5GupRva34SmfKQpBe8FOVVTCx68y5DPfpKNKe7MW4zY16V/ pCdQOKPNfI2GDwpAp4yLxShKZpfE3ubJRYLivLYdTG4iWIwntevt19lKWVjd8f+Dhq1J H924lav0BK//GBxof2eATmQeiRi/APmw2Afcdt9/jM/nLftpHw3hiLGh8SprD/aZi2dM wNcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321036; x=1754925836; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JX9UHWpArLRDJEf0tCoCLNi/F9HBfmQyxuSXNQbke7w=; b=dV+XSocp2QXdCK7FVFoPhjBMdD2eOEgD5EVeHEVa1Erizod9RVYIP7CkMJnQcl9SMv F0Lfh5dXE4O3vu6cpj/eSOXg1uvCiWmoJ3Tl6y03OBa6qT3tcGj8JLvj4HV1tmLyWwwm pPf23Svam0VraQgtlfAciAE6A8udWybCGiCS34zFaox8BsIW7eX9F114lpGCvJ8smTDf Dd8tUV4uF72jd7xGFZkdBlhqa10YPCw2Az1LuGYlMSCzj+WkQnViuxbVGRc82CvBscUN ++5CuXs7CfYDiANGcpF7DHgpxafI6cbswrPnOQIGIzKzhKzhxlzNG+I80lFMm5W9Hm9p DO9A== X-Forwarded-Encrypted: i=1; AJvYcCXsypwGwHpqwKuF/rvNLPB9QyX2LM11wJ9rGXMYw0PnFW23kfDcAVt+kqBaLcqnVgDcGThKsguP7UBb6tE=@vger.kernel.org X-Gm-Message-State: AOJu0YwZ5qWCpWALHQQlk1P/MzbsLPie0gQLLFi1UQeZhlTNhJIV87N3 zu9fl6Yg51GXxD1Gs/vepA1VQYpx5eUuLowB4qbqLAbvbrqViBrwtyxSup6+xJiVhrM= X-Gm-Gg: ASbGnctx4jHNv3Z3jDrp6lbqJIh7RMXcZaym0auzj5pI7c4VdNh7Q0uiD0fQO81xrD2 5IJySg382fFiBeDxrQ0y+VrIESZdkFxUe61+cJmdtyCO6UAsB4N4+vcA2jMxhdWJDm2/bDt9GbO ihQjSrAxPPdXtWsAiO4+qr7RbgLRGpYQROktVNYXMn+eUFMWjYVM4bnbxkE4ZHqHddNdxhKwo49 fA6U0GKNLg6HxzMsCz4VW5PIEZeFfSZ2lELPNVLpA12Vwm0Z5vmmmdu4xtYZBqAWFhhDCIdqjTe vhbm8XdMj51/K/zZrD6j/Oq6raQTpdEPgcwBjnCrCQRYQZspGNc8n9NA8wEm4MAcekhucMS/BFz B1ZcURIuLLeGsJfriMHBiL6rMDu+y0WZkc3iPIaCYxT7M6WJK X-Google-Smtp-Source: AGHT+IHBBm75qtH/5q49rzEs2X0rQ2Qe1eQuzRyWsZFIgX6JXKzK6/Uw83nQn5Mhhlqu8QIZ0WlEIw== X-Received: by 2002:a05:600c:444d:b0:456:1157:59ac with SMTP id 5b1f17b1804b1-458b59ed217mr81147485e9.7.1754321036168; Mon, 04 Aug 2025 08:23:56 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:55 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 04/20] clocksource/drivers/vf-pit: Rework the base address usage Date: Mon, 4 Aug 2025 17:23:22 +0200 Message-ID: <20250804152344.1109310-5-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" This change passes the base address to the clockevent and clocksource initialization functions in order to use different base address in the next changes. No functional changes intended. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 35 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index e4a8b32fff75..6a5f940ad0bc 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -66,8 +66,16 @@ static u64 notrace pit_read_sched_clock(void) return ~readl(clksrc_base + PITCVAL); } =20 -static int __init pit_clocksource_init(struct pit_timer *pit, unsigned lon= g rate) +static int __init pit_clocksource_init(struct pit_timer *pit, void __iomem= *base, + unsigned long rate) { + /* + * The channels 0 and 1 can be chained to build a 64-bit + * timer. Let's use the channel 2 as a clocksource and leave + * the channels 0 and 1 unused for anyone else who needs them + */ + pit->clksrc_base =3D base + PIT_CH(2); + /* set the max load value and start the clock source counter */ writel(0, pit->clksrc_base + PITTCTRL); writel(~0, pit->clksrc_base + PITLDVAL); @@ -76,8 +84,9 @@ static int __init pit_clocksource_init(struct pit_timer *= pit, unsigned long rate clksrc_base =3D pit->clksrc_base; =20 sched_clock_register(pit_read_sched_clock, 32, rate); + return clocksource_mmio_init(pit->clksrc_base + PITCVAL, "vf-pit", rate, - 300, 32, clocksource_mmio_readl_down); + 300, 32, clocksource_mmio_readl_down); } =20 static int pit_set_next_event(unsigned long delta, struct clock_event_devi= ce *ced) @@ -137,8 +146,16 @@ static irqreturn_t pit_timer_interrupt(int irq, void *= dev_id) return IRQ_HANDLED; } =20 -static int __init pit_clockevent_init(struct pit_timer *pit, unsigned long= rate, int irq) +static int __init pit_clockevent_init(struct pit_timer *pit, void __iomem = *base, + unsigned long rate, int irq) { + /* + * The channels 0 and 1 can be chained to build a 64-bit + * timer. Let's use the channel 3 as a clockevent and leave + * the channels 0 and 1 unused for anyone else who needs them + */ + pit->clkevt_base =3D base + PIT_CH(3); + writel(0, pit->clkevt_base + PITTCTRL); =20 writel(PITTFLG_TIF, pit->clkevt_base + PITTFLG); @@ -182,14 +199,6 @@ static int __init pit_timer_init(struct device_node *n= p) return -ENXIO; } =20 - /* - * PIT0 and PIT1 can be chained to build a 64-bit timer, - * so choose PIT2 as clocksource, PIT3 as clockevent device, - * and leave PIT0 and PIT1 unused for anyone else who needs them. - */ - pit_timer.clksrc_base =3D timer_base + PIT_CH(2); - pit_timer.clkevt_base =3D timer_base + PIT_CH(3); - irq =3D irq_of_parse_and_map(np, 0); if (irq <=3D 0) return -EINVAL; @@ -208,10 +217,10 @@ static int __init pit_timer_init(struct device_node *= np) /* enable the pit module */ writel(~PITMCR_MDIS, timer_base + PITMCR); =20 - ret =3D pit_clocksource_init(&pit_timer, clk_rate); + ret =3D pit_clocksource_init(&pit_timer, timer_base, clk_rate); if (ret) return ret; =20 - return pit_clockevent_init(&pit_timer, clk_rate, irq); + return pit_clockevent_init(&pit_timer, timer_base, clk_rate, irq); } TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B2BF267AF6 for ; Mon, 4 Aug 2025 15:23:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321042; cv=none; b=GS4m91FxVZJqAuRhRmrp8ECVjjxBtn9c9GSjtRJsIO6HzoAwptScx6B9MtLQ85ztalU/dOaIE5uIyy3bhIY1HX4iOqwABxtDznCdRwdWwN+SN+iXv7InVRw1HbZPLtF1TqiZemJkzDebwVaCN5BZ3Bi4PTJSAcA2N7WA1i/wRSg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321042; c=relaxed/simple; bh=RqZFdNtgTbZf0m6I4ZXD8TU1jqwKhepTi0HwZSZTuJI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FJiiVitOL9ausA02tILDf5c+r0m9+5SEyZV1CpfwaSoruWegAysUMfEPPff7bTsuPI0pIdr8DSoaXEnHD6FjD3yp94N/qKAhy0/zi7hS57unazxObsuqzL8XibU/jAkOYwbIrQiWVb9S/6juJILRDZ7195KD7cbHIc1MUw6TDWw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nHTobpeg; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nHTobpeg" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-3b7825e2775so3764351f8f.2 for ; Mon, 04 Aug 2025 08:23:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321037; x=1754925837; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lbDzZtNaADWutB54k3WAXEO5erD5I8WcIHEbONLpqUM=; b=nHTobpegZT//04r+MGWtsG06r8fHt1jf9TvIo7B4LwVo17kMgf3bhaqJ6xPSAOIgAv 6jp+qxc2sRO655fRwzqnAcICaRf/TBbASG+qgaY9Z8HkjxbHXNRIsJqpViSNmpKvoZZU Z2qSedjAl5oM0skJ9wrxpPReZheuzJRfZMgK4cYn3dr74ogLJjlKFXzBuyNexK8j85Ml SORWE4xBVF5qfG1wAdp9gKKv0Ek3OAZ5Wxq3nFkrTgwfQhzULvMKU4ok2mxs1yFJvUpx vMomGYSRlo68KDlRyeB4mYNIYAkpSO0s45llVAYgvq43qOsWu1Y4Rs3Y4S1VSmGOpUjU S6Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321037; x=1754925837; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lbDzZtNaADWutB54k3WAXEO5erD5I8WcIHEbONLpqUM=; b=ONPegicvVtF66mEBVPyI1jKrjQqnNT5zXDKkdddu5YbL5P3eGcVH673hlf4bT/YRBQ 4u7Cr0l6yUeCC4GvAXJTa6k0GDJDa2Z5/PaCOPNvuJf+nLthwdA4BZINUkopOKpbOStP RdYIVCGScuVXgSE3ISd8EZFHhd9GMFlm2UjVwnFhITCL9gN2HlOqln3uCF75IZGyUnRL yMHPnSOx13eMTLpvnVdwdKOgfY29jjZdtU4SWwQA3PX7vtzeTAQvLa4UWg2T1j3wiv6N WEK+yw6zY7rYDRU5IqyozYL02Pj3AhJ7pqAb6yZ+Y2e+8OjEwGf3h4zMONMWidqbspFP 62kw== X-Forwarded-Encrypted: i=1; AJvYcCUkvWlotpC9u+PPGHKY1OhNhhAnf3RzSJbJkavTQhs4n1vm3BEWyDqv6vf45XWOrJEWpnJeS09ycgOFm2w=@vger.kernel.org X-Gm-Message-State: AOJu0YyZvHE/23oQOLK3lq8Ibo6ehCzW1IzlCG9HKvJYTf90YdLjM2g4 656FqIc2SaDggrBS/DCitKfuErYd8OHT330EepUjVD5aZVOl3ucQ6qTxhu1PFTIMKU8= X-Gm-Gg: ASbGncuU4WIwpzglYm7FoLx7DUCDCdVZguYxViGphQnEJ77jl0KFufV4lKBsgO10+oj jXR+wuIa3tf2r3G28Zhj1BRutU4JJIaCSCiNPg6Em+Wc52tSLeZfBXxQOfAaUc4fN5F5Ot5uJ80 UcsIBnxHet5l8oHzuHam9o/g3RWneUwI7wvPIb+X1n/8OeJs7Fs+y/UccZba7CZS10pPu8ereeS E8ZuNuac8Zz/IZ023mkF8HbwFHDlx/+lIw3viUm57KLSSedOEGZdNtCGqdeLDl3qwxgrvefgin7 fc2liwDQO9I1W46gCZOlvtWZGzwPa+7HJKEVZWpFha58nFbBmKCZptgZ3mWfnV7DtnSL7I29744 6aj9Jlyo866UpV4w46P1nwGMx/9JPbmsFUr6PxqXV/v+As5Up X-Google-Smtp-Source: AGHT+IHJXK0mSLjyEkfuTl4XdI4DSkbbxXrgTfTNPzXUrXNgQ+P2f64aslfA/kt/ALMiaYbCoLuUJw== X-Received: by 2002:a05:6000:1a88:b0:3a4:f644:95f0 with SMTP id ffacd0b85a97d-3b8d94ceb8emr7515523f8f.54.1754321037256; Mon, 04 Aug 2025 08:23:57 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:56 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 05/20] clocksource/drivers/vf-pit: Pass the cpu number as parameter Date: Mon, 4 Aug 2025 17:23:23 +0200 Message-ID: <20250804152344.1109310-6-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to initialize the timer with a cpumask tied to a cpu, let's pass it as a parameter instead of hardwiring it in the init function. No functional changes intended. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 6a5f940ad0bc..9f3b72be987a 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -147,7 +147,7 @@ static irqreturn_t pit_timer_interrupt(int irq, void *d= ev_id) } =20 static int __init pit_clockevent_init(struct pit_timer *pit, void __iomem = *base, - unsigned long rate, int irq) + unsigned long rate, int irq, unsigned int cpu) { /* * The channels 0 and 1 can be chained to build a 64-bit @@ -163,7 +163,7 @@ static int __init pit_clockevent_init(struct pit_timer = *pit, void __iomem *base, BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, "VF pit timer", &pit->ced)); =20 - pit->ced.cpumask =3D cpumask_of(0); + pit->ced.cpumask =3D cpumask_of(cpu); pit->ced.irq =3D irq; =20 pit->ced.name =3D "VF pit timer"; @@ -221,6 +221,6 @@ static int __init pit_timer_init(struct device_node *np) if (ret) return ret; =20 - return pit_clockevent_init(&pit_timer, timer_base, clk_rate, irq); + return pit_clockevent_init(&pit_timer, timer_base, clk_rate, irq, 0); } TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2870D25F99B for ; Mon, 4 Aug 2025 15:24:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321041; cv=none; b=gpGt+TPcGJCx339sauPhVrWEm6eff3vdHXQPOjtyrzw09PI+RS8niKwD3u5mqvOQ4xIRcXERkLl7I+2wKabopqrAJyew1GXSxufcofUzsthF28rPhNsG6XF/txSt0FAxSl3NvOU4TeZMHUoK6OPXBF96DUV/ePFIZwafseue3Ic= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321041; c=relaxed/simple; bh=AX6yILrFa1zP7h7FqhjoMp5tbPuYWJFvn6a3J1bZV4w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VBAi9yxgHkDruEVqam5Svx3y3hSlD46EqxKbI7HwxfLXGztLROl7nsn0+/phKuIgFNU4O30WS5H6EI8gEgVL11cZfdH0MRrM2XiK0Y+bC8MuEEY+10eT93gnedCzCNuYNME7b1+nSVCsolccpDFhAYrZ0rX55pnkEzYXexn/kFg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xZwQznGT; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xZwQznGT" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-459ddada9b1so7211405e9.0 for ; Mon, 04 Aug 2025 08:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321038; x=1754925838; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=E0wimr9Kz7VoEl2fdp9icMi7AEIiaxz3Fb8BOi3TtHk=; b=xZwQznGT99a8PNu1fZtGTUpQS2kRcOLcw2FUDgqGcIR/Lu1CFVKtISYeZ0oiDRghN3 sCzbuu8TTcToz+p14LX0AYgxDnMBYLgR2hrXjDUpAe5aZfQAyHHbuL5Y2ClTKo/Th41C 238iopPFb4xquG4apxKdpHh0NXn4SJj7ohp+Qs3D1Nw93UL5ISoOOylsKzDMZcqUigj4 IQYInQ3AdeE9TJJpw9O4VgUDoyBvVb8ACewSPksLtuBqHg2iEWEH00y9VrSVPLze6lYL f8AChpdyUSrA1dc6/XCvaEhme7gv0qp19Hn+UbuX7ocqREYt/wJOsrtyE9s2rzy84M45 7p9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321038; x=1754925838; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=E0wimr9Kz7VoEl2fdp9icMi7AEIiaxz3Fb8BOi3TtHk=; b=uHRQ6tdoQVTn4icssjFVChymwPfMbz85FgmGQ3Fzw6XjeHf53ytRX76D57wsBQV+Hy aUPUlpwx5L9tzvpVBY50zuUeKRpzZI2eLyAoW3jddlctbFwA6We6Rz+OSiqH2MW/b6Fg be3SXO73X3F3QX/lGP9Eb0gROSzw/35deMfAq3MzbGAcpRDObLfbS+H8G1I+Oes7fC9w MYVifvIjyybH8jlNEBKjdmQr0dt22GG21IYrmQfc+kBxcB/4/F+FRUwPyzmWjS2CT/2q jA0Jpiu1r68NJR9JklCjFBg29wBHw3jL3N3sqW5k8eXZCCldXWTktDvVMqidkl/HYtct /J5Q== X-Forwarded-Encrypted: i=1; AJvYcCUky5vrmkWP2v7l3GMxTBQ/AtjV7s5if472C8aElS7qDGS5t1sPO7rgqNRspi2ixHkYGGnT2F9rC4RcWxE=@vger.kernel.org X-Gm-Message-State: AOJu0YwafYZKDCpqqjfjerrEPsbccGiQDDPvS80mtRMH0j1bRsvbYMaq c6IwHfY2ORq/HfqrvgLRLWbriiu5AjwILBgXQf2kdcuiTFAj+TtEZLdjzEtYcFPVC0o= X-Gm-Gg: ASbGncsWPG6LJejjpWh0fQswJjOVXx9SWFR4rJJr0BlEZan4mxlSerI+vsvyvn5o1Mx 8YHwLl9hUJ1Y+VFUYVKQzZo689v5S1U1T0bCczLaKLIPn5nB7JeMefOKJ1Ln65YiMl0hW/eIJ9/ IHIdVb/yLOqBMxPNUy1JLvceQUXG34DmyOm/hbitrkbnErBR6YmjgXwIAMRVZILe8tGpLMZ6Ant nExtZ3GI38hDHw2MSIhhOGGQIXc9Nt+kpJHM+X5vA3rIQc5CeX4hfXSJMk1g8ARF2Jna+eywa2x sbbmhHkMR1eDYy0TKHp5BtcViZ+dr4uDqMLLgB4juSQYxdI9UH9u5vc0K1cN8vldMCFZusT2cu8 umOhuSogTlf9BvtrlpQPnC7cMbrJDPP5IZ5JwU2YpT5ttAasw X-Google-Smtp-Source: AGHT+IGS1haFR8n57b5EnZAX8GWR/rUVuyC6gUQsf2MFP6K41PzESE4GTc6lJEPdQu1HeiB96aMNsw== X-Received: by 2002:a05:600c:1e87:b0:458:b01c:9d with SMTP id 5b1f17b1804b1-458b69dec92mr70916555e9.11.1754321038480; Mon, 04 Aug 2025 08:23:58 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:57 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 06/20] clocksource/drivers/vf-pit: Encapsulate the initialization of the cycles_per_jiffy Date: Mon, 4 Aug 2025 17:23:24 +0200 Message-ID: <20250804152344.1109310-7-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move the cycles_per_jiffy initialization to the same place where the other pit timer fields are initialized. No functional changes intended. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 9f3b72be987a..a11e6a63c79f 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -155,6 +155,7 @@ static int __init pit_clockevent_init(struct pit_timer = *pit, void __iomem *base, * the channels 0 and 1 unused for anyone else who needs them */ pit->clkevt_base =3D base + PIT_CH(3); + pit->cycle_per_jiffy =3D rate / (HZ); =20 writel(0, pit->clkevt_base + PITTCTRL); =20 @@ -212,7 +213,6 @@ static int __init pit_timer_init(struct device_node *np) return ret; =20 clk_rate =3D clk_get_rate(pit_clk); - pit_timer.cycle_per_jiffy =3D clk_rate / (HZ); =20 /* enable the pit module */ writel(~PITMCR_MDIS, timer_base + PITMCR); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54FAF26A1C9 for ; Mon, 4 Aug 2025 15:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321043; cv=none; b=LOT79ITiZwz6Fh/4L7Mw/HGc4BhQO6a/lVNyuciHQLr5Y4LPVFPonXmx5Qd1xYVpbNbtlIIUOH0Rj0s2prtywH4e7BzhX502OsyLwwDpNMrca219i1h6PUyHVF4JDPlmMy1q9NiUSgvlabNYgwHc78IyBUVA5NeCMgCxYZQIP8U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321043; c=relaxed/simple; bh=06rifj8MWfYgbrnM4LhpqBskPUPXikO5B7seRZV1jtE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UZ9U9iAKDO3GTQ9g0fzutN+Y/M/9K3xYbPRN9TC8tvmW+rZZxJD78h1I2oTtl4ZytlgASEETh43U4zyx92DecCY5oGM8yTpexrHt0ceEswo7J93gdXGU5XtAjYWT8c2TW1WYpjQHxtnCO94BrI4oUhLwZeQ5UVy01UuDCK/Wznw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=AVpfkqXp; arc=none smtp.client-ip=209.85.221.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="AVpfkqXp" Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-3b783ea5014so2005070f8f.0 for ; Mon, 04 Aug 2025 08:24:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321039; x=1754925839; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1V0TxbQkV1uVYSYK2Miyy3vCujOd6QCIFmu+E5maDJc=; b=AVpfkqXp956Sp4rOSfHil/FSV6Ii/KEiTCx/kSUHyYDcMQIlr1qJtYtzESeNUM5pC6 NkudxnTi9/C44NytEMpfLnRYns1ooOSZ3FUCEIxQZXPvWeueeoy+XzY7u73viAFlwigs GtwRNlQmNGeBzd+tfoJLvI5DkGk7oQAJt8TCDWUQN5ByIY0Kv7wxLVJxzX7j+dCNVAEY svsGe/rMqpLs27QNXrXsRDwcy5WgIsHqFrG+sHcISkIfBoQSE/SXghVLp7+QKFUH5Xun iFIf3wDfmei02HKZvsuYmQz5dPDViOECEZ1O5cJNQwJPBna20Lr2DIOiXMNlvfTTz2TN NdIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321039; x=1754925839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1V0TxbQkV1uVYSYK2Miyy3vCujOd6QCIFmu+E5maDJc=; b=iMFmPIz7oHrmssOEWsd/Zvp0R78WnlBkVMhOBqvRoRq9+j6sUIRdjpsMG6peorqTWH ycKnmVQJJ/u5ce+ZrN6qP3/sRXaHtGDPpQiiz210Oi7GmUH/9p2Vz6WPKM5n6GeVuv9E GCc1Q/B8i6+uk1h9exR6el5w4aXMzE1XSLz5KoBXWUgesZWTyXX7Z6svz3bT3dEVMHtg fGyZe6gDLpB4wYv0fRctFplkfVq4QL+3RfWhit/tny3aXGwbp5TO6gX8/Pjy5Zn71q4D L8FUrvkBF9ibXBZihV6keccNDMQQp5FuBZ77SMY8ANnScHOovF/ztbV8DOETPlCeNxR8 al/w== X-Forwarded-Encrypted: i=1; AJvYcCWlufhy/U2jwZMWOQTReTuh6h3d+X8Hwygd0hcdWlg3gGr1armIpGAUEHRiFYug8rXKhKgBBHk7amGuvIo=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9/vusMLJwI5qfcjMRRWvo+oUycUoE3ZwBRBTL+VOMMICpa/tz ImaQTOkTm6KHHQSpz+IdIckB2LTzDXiUgBCyH59Tdq7F1wh/QSwdGIVidjKjlSxvoUAbNrTQyme K9h47 X-Gm-Gg: ASbGnctw16+pZFF6PLvyR4P+33mpKO22z9W4sXn6GLhigLIL5x9d8V0Iec2lVtiu/EK PFJhAsMGd2O8mNvlrswdJ43XZ3DAuXtp4N1+P5EZbiXHYlP8SLD4G7WiTmikItMZL50VtQjHWuW TH/wRIoXuu/V2L2RcLHp5QibJAsbIvjgT2cu6pj9gG4zZR0N57x7JKLPJ3Xi+2P45f3408y1HNv 4Zlum8ORTimtNZHgb7thF3xvbkkJ7GfnoOdlq2TMHUdaSDxYAdcYDP+V0S/2fF1xttMqQj7rHRV Kv0ucmhWf/H7dkEPGD5X3pSCUJf2iFyfInfgEQc7gWNmxwP23lM+ldjP/tzp+ydzdTYIndCutEV k3gdIdXZGLHnS1gBGkHeQTAVOmfQmuIjha0q0qUNAKCl49Nf1 X-Google-Smtp-Source: AGHT+IHAJ1jjB0asHcbTf5oUf9fJYyZmwjRKmnudmwERLFJo7oUSpblye2tkSQq2HhtZNT9c6y8CWg== X-Received: by 2002:a5d:64ce:0:b0:3b8:d115:e6c7 with SMTP id ffacd0b85a97d-3b8d94aaac5mr7135812f8f.33.1754321039532; Mon, 04 Aug 2025 08:23:59 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:23:59 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 07/20] clocksource/drivers/vf-pit: Allocate the struct timer at init time Date: Mon, 4 Aug 2025 17:23:25 +0200 Message-ID: <20250804152344.1109310-8-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Instead of having a static global structure for a timer, let's allocate it dynamically so we can create multiple instances in the future to support multiple timers. At the same time, add the rollbacking code in case of error. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 48 +++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index a11e6a63c79f..d408dcddb4e9 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -37,8 +37,6 @@ struct pit_timer { struct clocksource cs; }; =20 -static struct pit_timer pit_timer; - static void __iomem *clksrc_base; =20 static inline struct pit_timer *ced_to_pit(struct clock_event_device *ced) @@ -189,38 +187,66 @@ static int __init pit_clockevent_init(struct pit_time= r *pit, void __iomem *base, =20 static int __init pit_timer_init(struct device_node *np) { + struct pit_timer *pit; struct clk *pit_clk; void __iomem *timer_base; unsigned long clk_rate; int irq, ret; =20 + pit =3D kzalloc(sizeof(*pit), GFP_KERNEL); + if (!pit) + return -ENOMEM; + + ret =3D -ENXIO; timer_base =3D of_iomap(np, 0); if (!timer_base) { pr_err("Failed to iomap\n"); - return -ENXIO; + goto out_kfree; } =20 + ret =3D -EINVAL; irq =3D irq_of_parse_and_map(np, 0); - if (irq <=3D 0) - return -EINVAL; + if (irq <=3D 0) { + pr_err("Failed to irq_of_parse_and_map\n"); + goto out_iounmap; + } =20 pit_clk =3D of_clk_get(np, 0); - if (IS_ERR(pit_clk)) - return PTR_ERR(pit_clk); + if (IS_ERR(pit_clk)) { + ret =3D PTR_ERR(pit_clk); + goto out_iounmap; + } =20 ret =3D clk_prepare_enable(pit_clk); if (ret) - return ret; + goto out_clk_put; =20 clk_rate =3D clk_get_rate(pit_clk); =20 /* enable the pit module */ writel(~PITMCR_MDIS, timer_base + PITMCR); =20 - ret =3D pit_clocksource_init(&pit_timer, timer_base, clk_rate); + ret =3D pit_clocksource_init(pit, timer_base, clk_rate); if (ret) - return ret; + goto out_disable_unprepare; + + ret =3D pit_clockevent_init(pit, timer_base, clk_rate, irq, 0); + if (ret) + goto out_pit_clocksource_unregister; + + return 0; =20 - return pit_clockevent_init(&pit_timer, timer_base, clk_rate, irq, 0); +out_pit_clocksource_unregister: + clocksource_unregister(&pit->cs); +out_disable_unprepare: + clk_disable_unprepare(pit_clk); +out_clk_put: + clk_put(pit_clk); +out_iounmap: + iounmap(timer_base); +out_kfree: + kfree(pit); + + return ret; } TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6897A26E6E4 for ; Mon, 4 Aug 2025 15:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321044; cv=none; b=QFW0+OcEz7uMN4ooBVk9aOsHFUUaFNyoDfHZS26cmfKVsmtsNSq2uq7Qz/byceMYSeC9Qdzibgi9EBufAAU/Y5Vy2q26s42cHWuJDcU3ysDjT42mwuie+Z3Rm0vm4x2D0YLUCV5Z18BOjCzNJYJMwpJ8VuMreNqDhZmCYM7HfHQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321044; c=relaxed/simple; bh=Ox0mffAq7VFxjLAQ00uA0Jp408fW3ZGQroAD694ufgI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o6h1/eKo1jeSu+jz8zZn9BuGx+qY6ePNLDSlSkuxrkXz75D9JDkv1Pgdbio9N3enzIwt8voWZbEBlTRWCef4fez+7iximTsA/GTdWYRLkHHqAoqqvnwxwu7rUQXNMSN/p2ZEjYHbdQVzkZlaWcyjhIbSbOpBnb6xbVVUl3PG0S4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=k9QD/WTA; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="k9QD/WTA" Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-3b7961cf660so3463249f8f.1 for ; Mon, 04 Aug 2025 08:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321041; x=1754925841; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WpZCEzRp6axYcNR29ZqHh8YXgG+TKuUWU3bsudMRByw=; b=k9QD/WTA2JsYGQxA3GfWm+PvNrU7hSTUkXICAYUjZvTTWzNLDE2kJlWhxBp1MPfU5G PgXZ1ChokpZ0HdJFzPHtM7m7xMfsvwaJcDQWMZx9QFOjYiqdXVCdtDRR3NsDRpCUwfe4 L8LjmnQkdhK2AAnf/TU8JhmOQ5Dv9hAUaZrvYLs8JMZpCaixnYBLqi7pNMYiFesU1Hht /g7It/eYDXegrHQQu5YsrZTLjLZU3paLgYH32ZiKO2CVbAaUmJVKo9K2VLutnff32eM0 5UA452IDRbpEV9fUdlhoqqiixNtqbhuVOqbv82wPZ47290SwmqTVcGkasI9B9JvdHCP+ gqaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321041; x=1754925841; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WpZCEzRp6axYcNR29ZqHh8YXgG+TKuUWU3bsudMRByw=; b=eib2GuGnMWhYYlyC+mU0F2h8cfvAkg+oALPqcCB6mbsdiLsaIPnPoPX3nEtBP3ZLRE B7VJGdgoD5+zIoWE8vb6tJPKjc5J+2uki5J1iXKZb2fGMBCLX+2N5KNwbKyIaLtK+CMQ Y0NNvSlHp+VCyUQCp1vdPEd11Lnix/fjDjOYNJlfj04YXcRpXlOrsomOoIBKB+JR1Sz7 uzsimNwFFCcJDaFna0BrbbgZ5lflrliCIHUv9Y9NE7KYoNrNYB9koVEZNw6jngKSTR2C v2WJkL2LWiHsHffJjbfpB7kyO42Idk4URkEEnIKb5WZfRBaryHqcbMtglmoXtVB+MxKD /7jQ== X-Forwarded-Encrypted: i=1; AJvYcCXrGPDwR7Ngcv0TD1xL5VRXd5HY8q3548p+Vf5AZGq0ODwB46kVOLwfESglWA8EC2E6DuZM1xzJ4rnQaQk=@vger.kernel.org X-Gm-Message-State: AOJu0YyNd8tcrM+0jTOCi25vjvJgZPSXtOHTl+ZJZJV8zZYlEKMiWLIh eCdKRYh+WGCmGzAI4WZE7uHSG77a5W935lxG3MLEwTSYfvrz+yZ0IaQQdkfFJOcBPAQ= X-Gm-Gg: ASbGncvd9PNrtiq3GJdtg3nafSgMxALCkUta3jAZ2NAVEgCNd2xPFKRXti3+Dv16ZPz rjYHElscklpYxkGAGd6TOVXUhSd+PU+K0yMW1jXK1YbSja7yiZ3ZOxirKvVHPlxXqo06HkXlE43 RjD66zoaOXKYF5n9T+Bk2MpYppcjAqOm0cemTbwfZKuh0gVcZsMwwpINPnLS4x6NKtY+ddA0JG1 hkZJeFZtjnxsISCVWVZ6d6jyrrYoMMnHDWGnxAKxiM/4Q7M9P3rhcCS3+grwksmI80nr7c5Xfu+ kyreQZFOzI7chk+bYR1VHqNEfHl3ZM1nVKNJy4rTr25Bdb7OYimYzDI+rituvqr9aI5rn+ATGhT Ujnx9uiUmJKTc29eN4M6BKB5toIIG1ZGjDJ1Sl6ZTHHq1VqIp X-Google-Smtp-Source: AGHT+IFnYxGxMKMSKoEvbWIFxguEfVGN3C98aTj47xZnYXpt7yIbGnnsyHqLFs1fTnM5pyLyixo+bw== X-Received: by 2002:a05:6000:1a85:b0:3b7:8832:fde5 with SMTP id ffacd0b85a97d-3b8d94707d8mr7367018f8f.13.1754321040746; Mon, 04 Aug 2025 08:24:00 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.23.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:00 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 08/20] clocksource/drivers/vf-pit: Convert raw values to BIT macros Date: Mon, 4 Aug 2025 17:23:26 +0200 Message-ID: <20250804152344.1109310-9-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use the BIT macros instead of the shifting syntax. No functional change intended. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index d408dcddb4e9..d1aec6aaeb02 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -21,11 +21,11 @@ #define PITTCTRL 0x08 #define PITTFLG 0x0c =20 -#define PITMCR_MDIS (0x1 << 1) +#define PITMCR_MDIS BIT(1) =20 -#define PITTCTRL_TEN (0x1 << 0) -#define PITTCTRL_TIE (0x1 << 1) -#define PITCTRL_CHN (0x1 << 2) +#define PITTCTRL_TEN BIT(0) +#define PITTCTRL_TIE BIT(1) +#define PITCTRL_CHN BIT(2) =20 #define PITTFLG_TIF 0x1 =20 --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9043272E51 for ; Mon, 4 Aug 2025 15:24:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321045; cv=none; b=f1pzdTw/4pFwGeGlprQXjHiRicgKdCSjW1zgey9NFEiIn4+eb22MDuvbtNA4Hiqj/dFTeMfMAPofRxctpbyOmby3VAsi8f0RTVids/FHCJ3/sF5s1wYnTHhtVk0IhAVRJ6UMtz+FjJ2IRrwapEWfHzqCz0qRg6IdzWwAIBojnKk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321045; c=relaxed/simple; bh=GfQzwNUl/+3omCCkQkujjBdEzx8xgVxwbwy3bH02h/E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VUi6I8RTyheJD/TyGTLqFtAjgTRM5nXAokn44fnC/E6PnL63J/Jw8jXet9nCwX9D8bM2U4F9ytww73P5Jsaqbn9e7GUGEejvilT4ICD0VueZgxuVk42R3WPmzK9Y2o4EhenZv7380wxCpg0kw2muFhf5LtHA9vt9wZnHRt9RhGs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MuhFDI8c; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MuhFDI8c" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3b78a034f17so3014607f8f.2 for ; Mon, 04 Aug 2025 08:24:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321042; x=1754925842; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8Kg1N7IKrT0Nex/PfaqDl7XqOb3/89XK53bW16WuXbM=; b=MuhFDI8cIRrWJ+N2fmg24A0vFztys8Jvh/siNBe+R/optZTfKrX8BsJeKoPNbrnbOr k0GI2ZfiinvHEBeQNKo117EIemS8oKhEVDvcBRnlITVnWvXmjbz7zqStAqlLFbli+D51 M83DuVp7kg8v9PMVqO25hEWGLvbwRYrJz5UBvOFWStEXyRnNSekV3URcA0kF5ciWGPFM jH7HKwRDKFZD8nA5jNQIXw/EMC+yTJyojWGc2/84RvPrev/19QafVATxpg9GcDbs/OW0 0rYqRjpRZxZw4Bam7V++Ib1j1UJiJf+mUC8zcr4hcw63DwW+7jujyIJKkCpwXNPS11xm sNYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321042; x=1754925842; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8Kg1N7IKrT0Nex/PfaqDl7XqOb3/89XK53bW16WuXbM=; b=WIXON0xeTzN4XgtKcVC7qoNWDipqkOH6vw4oRRMWCKYAIwWG42yrBJYvxMxXIbvYzL eO+i6QK5zrgMLjISa0Yb9+z+QGIqPMEouprDtN3+698pZWIyauLG4pN5ItqlN/K3DDTC AQCiBpT6GwD0MUVyqVxsQpzMwgj5Cwi7WNkJC282hWxrAeMhGVEVn4+CGSHpIkUGXl6p gTKmDPnc9in+UOzB/isY8MQv5Ao4VUtACSCnLbnYi+ovqBC1u/DaDwNq1m6/3KidbqaO I4hRdEu97h9O/qkiKciQWOcAvgLDpxog/VZznRYD9pY8txrEFyJ+/pweGeynjeuDk7Qd x+SA== X-Forwarded-Encrypted: i=1; AJvYcCXpI2rJYo0k7Q2u83d+anOd8DpCLh0fnzOgTJ0M2oEEzfHtVSB2B1vdst2eQgds1SrnBaAJZ/9KeLTaYRU=@vger.kernel.org X-Gm-Message-State: AOJu0Yx981u8mp8/QyToYll4MXQBD2ZMcoMd1z+c9Md8csfg5YjohooV 0tqcTc/8P0gNuRiM3tNMN3hW+JU+nhgwEBt/j29Y5mkK5d90wBYi6S0Vbn5IrFUkW+Tzh3WUBZf CKCLr X-Gm-Gg: ASbGnctC0RWDPLiEuiJbwBNvkuenSdTT867wxdhfMviyDmK468sIVJ2w4ltUXfBt3sT YJezZo2E0S92AjDh0uft8QjXZpk8q1uAvcOiyB7av8yOwUdKMIOnEeVv9yZm8qr7+D21UdVQL0X oCIgklASS069ZBH9XKoThX+3iebsL7gACueT5RH9ac6lNPo8BVXfttChaHplJRJv4Deu9T3zjgQ obdA2GYwJtVoMtGH2Hq0Sg9Hl/cvv+HjANR/NQH0VG9BSGfkkLdFF0ffVJKWq51FSUL/5DVa0uV n7MfqRvBYCRZQ8piBnURVjMXEa1M+HJ+zUWi61CbPxQub21RuXUmUr0rSLQn7wGXHV3uP/kgWl/ FfGqJsLdSUj6iuvlFr+uXpe/E/Hsr5OtM1ZIl4tD/Vr3jzP7N X-Google-Smtp-Source: AGHT+IEv2dEIaL52OIz1KREMgSPPHXbVeDJe7Lg9CT6xVaOAJZivBpbM2SMOf36IVQo3stIHc7XFTQ== X-Received: by 2002:a05:6000:25c5:b0:3b7:8880:184a with SMTP id ffacd0b85a97d-3b8d94ce777mr7517919f8f.54.1754321042090; Mon, 04 Aug 2025 08:24:02 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:01 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 09/20] clocksource/drivers/vf-pit: Register the clocksource from the driver Date: Mon, 4 Aug 2025 17:23:27 +0200 Message-ID: <20250804152344.1109310-10-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The function clocksource_mmio_init() uses its own global static clocksource variable making no possible to have several instances of a clocksource using this function. In order to support that, let's add the clocksource structure to the pit structure and use the clocksource_register_hz() function instead. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index d1aec6aaeb02..6a4043801eeb 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -44,6 +44,11 @@ static inline struct pit_timer *ced_to_pit(struct clock_= event_device *ced) return container_of(ced, struct pit_timer, ced); } =20 +static inline struct pit_timer *cs_to_pit(struct clocksource *cs) +{ + return container_of(cs, struct pit_timer, cs); +} + static inline void pit_timer_enable(struct pit_timer *pit) { writel(PITTCTRL_TEN | PITTCTRL_TIE, pit->clkevt_base + PITTCTRL); @@ -64,6 +69,13 @@ static u64 notrace pit_read_sched_clock(void) return ~readl(clksrc_base + PITCVAL); } =20 +static u64 pit_timer_clocksource_read(struct clocksource *cs) +{ + struct pit_timer *pit =3D cs_to_pit(cs); + + return (u64)~readl(pit->clksrc_base + PITCVAL); +} + static int __init pit_clocksource_init(struct pit_timer *pit, void __iomem= *base, unsigned long rate) { @@ -73,6 +85,11 @@ static int __init pit_clocksource_init(struct pit_timer = *pit, void __iomem *base * the channels 0 and 1 unused for anyone else who needs them */ pit->clksrc_base =3D base + PIT_CH(2); + pit->cs.name =3D "vf-pit"; + pit->cs.rating =3D 300; + pit->cs.read =3D pit_timer_clocksource_read; + pit->cs.mask =3D CLOCKSOURCE_MASK(32); + pit->cs.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; =20 /* set the max load value and start the clock source counter */ writel(0, pit->clksrc_base + PITTCTRL); @@ -83,8 +100,7 @@ static int __init pit_clocksource_init(struct pit_timer = *pit, void __iomem *base =20 sched_clock_register(pit_read_sched_clock, 32, rate); =20 - return clocksource_mmio_init(pit->clksrc_base + PITCVAL, "vf-pit", rate, - 300, 32, clocksource_mmio_readl_down); + return clocksource_register_hz(&pit->cs, rate); } =20 static int pit_set_next_event(unsigned long delta, struct clock_event_devi= ce *ced) --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E3366273D6D for ; Mon, 4 Aug 2025 15:24:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321046; cv=none; b=n+kitVtBeUqAT5T/+JKdrBPX9DvKYMMzYtsxqjClUEkAoT+s7AE3xScqQ6uJzHCI5OVHmt7qMZixLdthx+6kS60YbuBiX/SSt/2tkwoyZt7GrXK6Tj6Tf86pTJoc+OtPdSEvIvclvd7616tWdwykcLcYq377eVu5wSSz7QrrUac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321046; c=relaxed/simple; bh=p8WBw72jORHjB8Wav4gRj5O+Wjqbm7FC+T0R8t/syZU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PYSu+jwebvNmK+Sm4yM2zj0GiJeuSY3bGjbVSqyXUk4M9JHS/eyibFXKnoaDbJqEU43Om+v2bwJtxBdYCDu9X/+sjpyXIX4yrwyBzWLjHxVQW/yFMZ9f7v0khdRShsUs82CFPEwrNAH5wlkIvDoXdFSq/JGhcrE7Noq8XL0b29I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=datgrqCj; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="datgrqCj" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-3b7848df30cso3412026f8f.0 for ; Mon, 04 Aug 2025 08:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321043; x=1754925843; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=49SBgH0dvGKLVUo3X5GPpzjEpvrbCAuFfLsOEegCQto=; b=datgrqCjOQATRcQkWGdg8YEYtp6jUMwKqdMA0aYC5AOTpN0ofpcqBFTFBjzGzw4582 i+7Jrj2SVeLkktelrpl1gIgP6lT2UuxpFpEQENwwZqfPKdKLDv05Yxg0BIfBGBEiLOXn ZvAxXls7yhcWjBpaSX2EEi9wMwTSTO6SzO+YD7KOctDWPT0FxjJovJG3ghP6lu1wrzue X5sBExtlay9FSYcc560l2n4BZCo4C0ABVFwnoBLJmgYzOoaaFRDknn/D3qbO+jipXumX 1UHeIWCeKo3NrjMLo98N4mAPEsGnYD8B6h7DTdpVZKgqxgvNfFF16IiwRpOogtJlbRDz r8og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321043; x=1754925843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=49SBgH0dvGKLVUo3X5GPpzjEpvrbCAuFfLsOEegCQto=; b=Gop9+zpofWI2Fy/lHoVKYGdKHJKn/0w/5ZsaIvGLbXc6iUwNLp21Y/6glAgnzyf5Re o3eVky4LmtcdAoZajWm4oV/mnAoPr20wns6p+F141GNgsenEWP36DPyJIFTJgg+RAhcI /aeVbxBkNtZJcVpCsgf02bE78Ue0YJN4j8O/iTxj1/7NxAWps37VfYadOOUeDQqk8Us5 dasiIZURD7YJLtur2/ohnnBx5uAhky36HuglymUiL4ojCRQUnEOQomcCSNypxh2x2q7N TAWT2+Zz095dywB7K29X5BJotzc6Kv7hU3qOrvZ/1sSxWIE94oauD7RSxPg0yVoVfoHD KtNg== X-Forwarded-Encrypted: i=1; AJvYcCUcQfMarRJTt2suwMTYOfb8qYl21sri2konV68tRiSaWjLtZ24WBB6iPTeJIGDbxdimbCOvhDuLDW3CnXM=@vger.kernel.org X-Gm-Message-State: AOJu0Yx9K8/eBI7XIaOuPXJnRLNCS1kKcmXse/sRLn5L9RnVbVbrqqqn fzrcnQlPn5oFulvjzfvBsT3ypknC0XKsuGBPTwSTHeIQvaOfMq5FjapJx4XzKdij6qC9dKoHKsk i7hpc X-Gm-Gg: ASbGncspnUhomFXW1GJwUN5pRuT51hSVnHhzOIX5wvkjkbKz3gHLZR8EEYUNkNyujGZ RQLKEi395zowNzTADKTaf8tKNHA/uHHfQSd/kJVsvKRhKFiGvThdOkz2loSlDz39JJULl6vOQsZ lUUuB8A42GzNsXq/cx5NIhdq2RBDrBkJ2A7+nF0ZJ/sv+lRQXjiv4p/RuVkOhgdfTEsDQAMICCd CrGeWlGd9oacWxgILl/We6nTbVevsA6o5mE/6f+9f+yD7+14wt7btBgThdpXDLbQRAIpC3biZZ9 kR2MT0oZH2jgsUv28WqH78FsxkjqMHD5oiSLpmZATWFggCCPXdRJ2Hm3wodqKsyCDlJ+rNiew4U ArACPiCFpATDzoB/9Xv/dTbmj4YBA/crXAQsEfGrcIz1JhJ6Ix8hU+dcIxz0= X-Google-Smtp-Source: AGHT+IGYj9QRWBDYcEke4KqcCYTctis2SDDhoX8NtZGr99sVQAfal2OaVHdh01hcyUuq/RmZNjdmxw== X-Received: by 2002:a5d:64ed:0:b0:3b7:590d:ac7d with SMTP id ffacd0b85a97d-3b8d9561d86mr8517416f8f.1.1754321043089; Mon, 04 Aug 2025 08:24:03 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:02 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 10/20] clocksource/drivers/vf-pit: Encapsulate the macros Date: Mon, 4 Aug 2025 17:23:28 +0200 Message-ID: <20250804152344.1109310-11-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Pass the base address to the macro, so we can use the macro with multiple instances of the timer because we deal with different base address. At the same time, change writes to the register to the existing corresponding functions. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 34 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 6a4043801eeb..c81c68b826a0 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -16,18 +16,20 @@ #define PITMCR 0x00 #define PIT0_OFFSET 0x100 #define PIT_CH(n) (PIT0_OFFSET + 0x10 * (n)) -#define PITLDVAL 0x00 + #define PITCVAL 0x04 -#define PITTCTRL 0x08 -#define PITTFLG 0x0c =20 #define PITMCR_MDIS BIT(1) =20 -#define PITTCTRL_TEN BIT(0) -#define PITTCTRL_TIE BIT(1) -#define PITCTRL_CHN BIT(2) +#define PITLDVAL(__base) (__base) +#define PITTCTRL(__base) ((__base) + 0x08) + +#define PITTCTRL_TEN BIT(0) +#define PITTCTRL_TIE BIT(1) + +#define PITTFLG(__base) ((__base) + 0x0c) =20 -#define PITTFLG_TIF 0x1 +#define PITTFLG_TIF BIT(0) =20 struct pit_timer { void __iomem *clksrc_base; @@ -51,17 +53,17 @@ static inline struct pit_timer *cs_to_pit(struct clocks= ource *cs) =20 static inline void pit_timer_enable(struct pit_timer *pit) { - writel(PITTCTRL_TEN | PITTCTRL_TIE, pit->clkevt_base + PITTCTRL); + writel(PITTCTRL_TEN | PITTCTRL_TIE, PITTCTRL(pit->clkevt_base)); } =20 static inline void pit_timer_disable(struct pit_timer *pit) { - writel(0, pit->clkevt_base + PITTCTRL); + writel(0, PITTCTRL(pit->clkevt_base)); } =20 static inline void pit_irq_acknowledge(struct pit_timer *pit) { - writel(PITTFLG_TIF, pit->clkevt_base + PITTFLG); + writel(PITTFLG_TIF, PITTFLG(pit->clkevt_base)); } =20 static u64 notrace pit_read_sched_clock(void) @@ -92,9 +94,9 @@ static int __init pit_clocksource_init(struct pit_timer *= pit, void __iomem *base pit->cs.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; =20 /* set the max load value and start the clock source counter */ - writel(0, pit->clksrc_base + PITTCTRL); - writel(~0, pit->clksrc_base + PITLDVAL); - writel(PITTCTRL_TEN, pit->clksrc_base + PITTCTRL); + pit_timer_disable(pit); + writel(~0, PITLDVAL(pit->clksrc_base)); + writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); =20 clksrc_base =3D pit->clksrc_base; =20 @@ -115,7 +117,7 @@ static int pit_set_next_event(unsigned long delta, stru= ct clock_event_device *ce * hardware requirement. */ pit_timer_disable(pit); - writel(delta - 1, pit->clkevt_base + PITLDVAL); + writel(delta - 1, PITLDVAL(pit->clkevt_base)); pit_timer_enable(pit); =20 return 0; @@ -171,9 +173,9 @@ static int __init pit_clockevent_init(struct pit_timer = *pit, void __iomem *base, pit->clkevt_base =3D base + PIT_CH(3); pit->cycle_per_jiffy =3D rate / (HZ); =20 - writel(0, pit->clkevt_base + PITTCTRL); + pit_timer_disable(pit); =20 - writel(PITTFLG_TIF, pit->clkevt_base + PITTFLG); + pit_irq_acknowledge(pit); =20 BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, "VF pit timer", &pit->ced)); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF6E327464F for ; Mon, 4 Aug 2025 15:24:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321047; cv=none; b=oLQq1maceUlglsgHjLAnvJ2IxtHfp9iB3z2tOGtcS242Ed9qLQ0s6+zl/AoIEBv6UH82mHF+v7jm7JqT8RjLF34/0dwlzFPtO7E/2VXDDGd5TC0A/C1e7fnFpWo5uZH63/HVa9X0Rt9HtrLAECPGpfE3/O96UG4ZuqR3KadfKbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321047; c=relaxed/simple; bh=UkocLxl6KmGpyXqw/UjroA7pk7iJGcfWJQV5wB1Pnl4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=stLbGeyLfvyF1tZvmDmknpGAwS/GvbpEhtMf0EUWG2P79cU15uqpI2JDzmTcDpOXXmQ6oLC70vvwQTDY219qZdLYMNLZKwYliJGQr5vrIw+HAgJ/IlNjqre0sJX7Eb8e4/DTj5AizrZlAvofnDfj3K0j8NJW+4BVxuGv/vV5vFI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wKLhpi4c; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="wKLhpi4c" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-458bdde7dedso14647545e9.0 for ; Mon, 04 Aug 2025 08:24:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321044; x=1754925844; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9QRyMK0c0loCDg4KVJ63CMEBDC8n7yMy+IKreloteQQ=; b=wKLhpi4cpkXexwfMAnV9PFtrxLIpDk0re+9oI/DO8zmqYqrFdFewkxu6QQNBf1X/Es g++Ctinog+dL+kkUdE69NR3OZduxQBEHwKYS5+37EQ+aYBjP+232gw+maWyOUPdAHige P38sCuuU5q2UjMnYZVAzXlubKGEFzoSfxE58FYa/9vV3stcwg/VGERyv4kNWy9OXMLPl udg5VV5RdCmf+v5EzrqXLRIyo8fYZrhxZYZ+I35taauot7HiEcIeiLsIPF8RA6V39/F+ BkKFwoG3kqwhYhz1kxCWK/0gRJ+cGx5dkdnFypu28U5A5KNLB/C25h4w/AKveCfXuc2Q uKyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321044; x=1754925844; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9QRyMK0c0loCDg4KVJ63CMEBDC8n7yMy+IKreloteQQ=; b=I8UZr515vCr/9F0ujtPGqj10UAMnGek/DY/15G78gWGtua2gRT11KdNKnm8GNQ+5Ya O2UD+kL0hnsd6coCvl4RxXPFecx57Wx8nkRbsTzZG2AFTnXd2+y71ZKmy5v7Tstm9/Z7 51IbjXQSPql1GPZaFqASipau/BKNKMFyjhdTL5szYrlR7Thzyb5cI465TthXA97Tf8Ic P5a2cynNZeNPJ+18SobRzJc3yfcjYEt69ivdMiwfArwK53ak+0+IAmy6onTxlAN2IZYJ k9dkhEkzZf5HvcMnjCmUfWgXZE7m/YeUCM1n0oBwl9h3PUxtmYUzSq2SHX0k6Dz5ApU4 84Wg== X-Forwarded-Encrypted: i=1; AJvYcCUe32a5hmAI/GxJW4s4TzS+ZU9melYYBjh6MPw5+JQCK32PiqsSZe6NWjz3k9nnuItVEz/b0HoWu1IxU6Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yynu3xnFTXvyBTGzqXgWfa8GbKnh6rKEzuKUr25MOIH6bgPMNdc qRPbacBlv54olprIK1GN37RB0ChHlZjTx2xtEeMiTl0SpGw2Wi3h5aVc76lnoFrDnOs= X-Gm-Gg: ASbGncvvf/gw/nasp6i1HfS675AAAcFGchaT31gXsnWo3CVTnwnX1yhtJVBlpMjZ0X/ gD2tw75Hw+2MsEKuqiiyqDMsLHSKY8UNCOMTfqVoZd27luMSRCZjuXUPXJ38FBK0x2o+L8kLBDs ysx0dRfB4urgK1Ymhg0pw+WXnQtUOCPLEViupsskzCPxgJHjoXXDjPhybpo86Qp4xrAxYVxcBhZ 5vzgqn/IStIV0D0gCWn8GhhakPaNz5gHm51mRT0kGuSXr8feE+9dTrnT5DYsJQiYabuX5On9TRK yg1RGeJFoElHs9ZK2/hLzvTSgfw7epghRNXAKdd6FCUxS4V7i5dJs/N1Cv4w1NTzv6FT3fvzUmv rfLVQnuonWImg4W0xblBc1S6++dH/SOLSLNRh0t1kzP66hDUL X-Google-Smtp-Source: AGHT+IHEfwloso642iQTiWgkMpJd2rbRGk0HwSfiR+10tktyKvaA1EvfyyNvbNeUpfgRsBGbnO++XQ== X-Received: by 2002:a05:6000:2409:b0:3a6:c923:bc5f with SMTP id ffacd0b85a97d-3b8d94740c9mr6917450f8f.17.1754321044178; Mon, 04 Aug 2025 08:24:04 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:03 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 11/20] clocksource/drivers/vf-pit: Encapsulate the PTLCVAL macro Date: Mon, 4 Aug 2025 17:23:29 +0200 Message-ID: <20250804152344.1109310-12-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Pass the channel and the base address to the PITLCVAL macro so it is possible to use multiple instances of the timer with the macro. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index c81c68b826a0..4f1b85ba5de3 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -17,13 +17,14 @@ #define PIT0_OFFSET 0x100 #define PIT_CH(n) (PIT0_OFFSET + 0x10 * (n)) =20 -#define PITCVAL 0x04 - #define PITMCR_MDIS BIT(1) =20 #define PITLDVAL(__base) (__base) #define PITTCTRL(__base) ((__base) + 0x08) =20 +#define PITCVAL_OFFSET 0x04 +#define PITCVAL(__base) ((__base) + 0x04) + #define PITTCTRL_TEN BIT(0) #define PITTCTRL_TIE BIT(1) =20 @@ -39,7 +40,7 @@ struct pit_timer { struct clocksource cs; }; =20 -static void __iomem *clksrc_base; +static void __iomem *sched_clock_base; =20 static inline struct pit_timer *ced_to_pit(struct clock_event_device *ced) { @@ -68,14 +69,14 @@ static inline void pit_irq_acknowledge(struct pit_timer= *pit) =20 static u64 notrace pit_read_sched_clock(void) { - return ~readl(clksrc_base + PITCVAL); + return ~readl(sched_clock_base); } =20 static u64 pit_timer_clocksource_read(struct clocksource *cs) { struct pit_timer *pit =3D cs_to_pit(cs); =20 - return (u64)~readl(pit->clksrc_base + PITCVAL); + return (u64)~readl(PITCVAL(pit->clksrc_base)); } =20 static int __init pit_clocksource_init(struct pit_timer *pit, void __iomem= *base, @@ -98,8 +99,7 @@ static int __init pit_clocksource_init(struct pit_timer *= pit, void __iomem *base writel(~0, PITLDVAL(pit->clksrc_base)); writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); =20 - clksrc_base =3D pit->clksrc_base; - + sched_clock_base =3D pit->clksrc_base + PITCVAL_OFFSET; sched_clock_register(pit_read_sched_clock, 32, rate); =20 return clocksource_register_hz(&pit->cs, rate); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E767B2749CA for ; Mon, 4 Aug 2025 15:24:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321048; cv=none; b=HRbEkn2KdVLgahVavjr9NLkTiLKvfGRgO8nrg7OwW+S4XA214ONNkDjoJdHocAfGUqbmDeq9paN7SxZP1AjHxE6tGCYuIOSQGhjOb8eGw30Ul5kgIBwaBTTap4oFunkbF12qre1ZDoqoL6lLEWEaXRYvoXveH9dPyoi0Knkyv7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321048; c=relaxed/simple; bh=4Vq6f8GD2mA4WRyWaYsGXrIFn7Q9er+rg8/kSAhjspw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OU4Xfyc5yWwdzhp3lE5wNXpjFq2BhjcLc3aUoEKTTcEx4AnpUtOTktvMVTsvmZVMBwOhl9fCj4TMcvFSF4/Qty5SXbR72i8SSV6wh4Ovc+DQf0sEZ3n2cJNcg3wf6R93gzzqhJqR3qzYnVJ9DUarq3IYyAcFzPisbzylM2tPlZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=C91Th1ps; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="C91Th1ps" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4561ed868b5so29987755e9.0 for ; Mon, 04 Aug 2025 08:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321045; x=1754925845; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=z+cH/sZvNKu0NSHCUkuHwC3VCEIw4lvAIUfnj3iQdiM=; b=C91Th1ps7mt7vrDL8qaUk6IF0oFF1QvkA2XSMRJhDDyRTNXv4f02LqPw2XW0CpkTwF A+l1mr93NQSUbdR6D/huzYDcl1vA7gWzM8a/U3yMN72ChgtWNFLNV9vgzU93fgqvdNrq QjUaBoydRGTgmsNH+RwyFf+6nfasN94lUGVOJy1HQmGYbbbLLeYzabRG8yji+LrPcWxE TNtnTzCwhbJukYrl82RN0Y60pTN1tvQQiLGpnCyC0R/V0QYw+ESgetpY7L/P2LVuuDF2 mmW9sO5PubzGXz4aqECYsv9bQfo9syM5VVgy8TTRBn0ENvdB14u9fikVeBNiJBVI7HyB 77Fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321045; x=1754925845; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=z+cH/sZvNKu0NSHCUkuHwC3VCEIw4lvAIUfnj3iQdiM=; b=DGg5UOk10q1MHYNuaR/KP+8arViobNJKlTR45SqfzxCNEcQ++Q22ijGn5BsN3+1YV8 M6v6YzDElF+sp5UE39DRjzXqX8AWn9NjCgksxjb21pNolnbYYj+2X4E69H4KwFpYdKpb UK3YPLbxySDFqsXaAI/vE9N5NsR1RII9qyJzUQR/ZwRXUZ0fCADsrzQxMq5S9CMh34BP Y6mbJ+bm01vvPKlkwiTKFx3yY+d+YdMlZRPlGBo08Inx0ar5Lv7N9JixXAkmhaAIAe6q VfPMWAZeRQJUQmm4xEFp4ZVpin9bHKZ1y7N56xVym602dRzpvqChmIrl2T4i1I12miD7 dbYQ== X-Forwarded-Encrypted: i=1; AJvYcCW7/VRtiPQ1u0VGBFWoC3dhe0MFyig9MsJGVKdD8xr1P8/DUTtq1FWPZ4J07tpvEbDfV4B8RXDKlPMEM0c=@vger.kernel.org X-Gm-Message-State: AOJu0Yww33vtS+1eFTmCTtdc/o7RZE1/l5YbdqxFqIuKquoaTKF3eHz6 iC/rSK2ZshdnkAYQGGNEEStzf6DgqtkoxViCy10/HYTEOEDVOuU9fZAJnN0JqxpNlIw= X-Gm-Gg: ASbGncui3c/Mq2g0KmBfno+QTatMN+WquMB1vLBH0cOxCB/dhm85z8EmihpcUGTKk/z 6D5QPZoeU/qaK0pUt+/kv4SBFsMjMaXRrhNfYp28mdx45YHQnotxW4arUXoIwuugeI8jk94M+7y uKTDNv23X23BjqMpFefajPJdOfTHLM5QP37dr0BdTEzHMii2ihNNmWAUm/d6+QzfAUZQz5GuWWT 9S6yCgMgFqXiGeLJiuebBi+eYtE4TVtlim9VfH7LwpvET8uASZcDFnZ0nU94LK1oKoZs1AH4Gm0 2CrRSammD72cUFX7aeUsNd6sJIuw6MIoO2EqUBwFjDY/eCbp5CNLhdQGvfN+J+MZhgT2pez5foH LbemTtZKaMRuCVMp+Pz09SEFTXj+boKJyfmqsoR3ubvjCTIxHAlENmgLyqlQ= X-Google-Smtp-Source: AGHT+IGGClohuwM4eZZNeboHrsguQadNJzvZGAgcOeVJ9FpE3p0p5SKfrNu6L3Y9/q0vSA4jhgxvJw== X-Received: by 2002:a05:6000:401f:b0:3b7:9b4d:70e9 with SMTP id ffacd0b85a97d-3b8d94c1058mr6446338f8f.43.1754321045280; Mon, 04 Aug 2025 08:24:05 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:04 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 12/20] clocksource/drivers/vf-pit: Use the node name for the interrupt and timer names Date: Mon, 4 Aug 2025 17:23:30 +0200 Message-ID: <20250804152344.1109310-13-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In order to differentiate from userspace the pit timer given the device tree, let's use the node name for the interrupt and the timer names. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 4f1b85ba5de3..2a255b45561d 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -79,8 +79,8 @@ static u64 pit_timer_clocksource_read(struct clocksource = *cs) return (u64)~readl(PITCVAL(pit->clksrc_base)); } =20 -static int __init pit_clocksource_init(struct pit_timer *pit, void __iomem= *base, - unsigned long rate) +static int __init pit_clocksource_init(struct pit_timer *pit, const char *= name, + void __iomem *base, unsigned long rate) { /* * The channels 0 and 1 can be chained to build a 64-bit @@ -88,7 +88,7 @@ static int __init pit_clocksource_init(struct pit_timer *= pit, void __iomem *base * the channels 0 and 1 unused for anyone else who needs them */ pit->clksrc_base =3D base + PIT_CH(2); - pit->cs.name =3D "vf-pit"; + pit->cs.name =3D name; pit->cs.rating =3D 300; pit->cs.read =3D pit_timer_clocksource_read; pit->cs.mask =3D CLOCKSOURCE_MASK(32); @@ -162,8 +162,9 @@ static irqreturn_t pit_timer_interrupt(int irq, void *d= ev_id) return IRQ_HANDLED; } =20 -static int __init pit_clockevent_init(struct pit_timer *pit, void __iomem = *base, - unsigned long rate, int irq, unsigned int cpu) +static int __init pit_clockevent_init(struct pit_timer *pit, const char *n= ame, + void __iomem *base, unsigned long rate, + int irq, unsigned int cpu) { /* * The channels 0 and 1 can be chained to build a 64-bit @@ -178,12 +179,12 @@ static int __init pit_clockevent_init(struct pit_time= r *pit, void __iomem *base, pit_irq_acknowledge(pit); =20 BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, - "VF pit timer", &pit->ced)); + name, &pit->ced)); =20 pit->ced.cpumask =3D cpumask_of(cpu); pit->ced.irq =3D irq; =20 - pit->ced.name =3D "VF pit timer"; + pit->ced.name =3D name; pit->ced.features =3D CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; pit->ced.set_state_shutdown =3D pit_shutdown; pit->ced.set_state_periodic =3D pit_set_periodic; @@ -208,6 +209,7 @@ static int __init pit_timer_init(struct device_node *np) struct pit_timer *pit; struct clk *pit_clk; void __iomem *timer_base; + const char *name =3D of_node_full_name(np); unsigned long clk_rate; int irq, ret; =20 @@ -244,11 +246,11 @@ static int __init pit_timer_init(struct device_node *= np) /* enable the pit module */ writel(~PITMCR_MDIS, timer_base + PITMCR); =20 - ret =3D pit_clocksource_init(pit, timer_base, clk_rate); + ret =3D pit_clocksource_init(pit, name, timer_base, clk_rate); if (ret) goto out_disable_unprepare; =20 - ret =3D pit_clockevent_init(pit, timer_base, clk_rate, irq, 0); + ret =3D pit_clockevent_init(pit, name, timer_base, clk_rate, irq, 0); if (ret) goto out_pit_clocksource_unregister; =20 --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 300662749F9 for ; Mon, 4 Aug 2025 15:24:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321049; cv=none; b=TmO2CeY5SyV6wGCsCNusEP/R5s7ovUPU16KZe8z5JIWpfdRLiqObPClxnFy6JfFhqCDR79L4EMMFuQPqF1YKyiX/JNuO4jS2H8CWhGwz4n1Vlf7/zrLE95Z7nuuUoGahVOsCaw132qdd7AetGeB5gt4AyS2s/F5+CDqdgGmrWak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321049; c=relaxed/simple; bh=p81EulUS9kF/MLITjT7DPvMr6vmlQKnAjjWftNap1A0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=acy32YnmgAf/XZzB/731oRNQSeH5pxIyxId15z3uvSgAdqs4cxQYCojca5SkBHuCsV4Msw9rn9DzlJspsNuIVwXDxHntlSz2GIyKOkEKKmqjkWosNSfuC0ucFXww7pYks95C0c8iQvG7YgIw0EyPu6//ghI96ieC4UdRYADigtA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R3NBGhPo; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R3NBGhPo" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-459d7726ee6so8578635e9.2 for ; Mon, 04 Aug 2025 08:24:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321046; x=1754925846; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=3ryA9faGluqwB9+UiJW8cuMQhTuvfpb1HZM4cTkE7E8=; b=R3NBGhPoO8MDihGQ/EyL1XyRPQUy7WIaNxUzD3/LdtjjNLPQJacVPJxm2CCT0tQW22 Rwdig019rezyy5/DNkE55b7BxllybH5mcGF7ZsoGm88KVfhVF9+fyft4HaLEWysuMmi7 7olGOZUzxrQpBdyZwIhCVz/Ox2i0yKc/FJLhMouKkGj2DMeL5rWUI79SYqRIxz5coUlS KiJwzGlBRxREE3SucSjOExBTrD1pdmUWxZUmCmn5hJjs8xuJlRz3hmorCbiLAodZp15n f9gTxC845QPd80lBbzrYZL6d8X8yisjJjLbhnhSLQQ2L4C5pNuD47CUT9FO1V6l5oV54 Ur5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321046; x=1754925846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3ryA9faGluqwB9+UiJW8cuMQhTuvfpb1HZM4cTkE7E8=; b=ZVKNEzROJdHA1nPzyERrf4gvclME37kXn1TuKi+aqvM4z24HOQp+9TkEskGTwhij8t Nb+HgyB9xRfbOkIeJICZf5kq+VFtsvmVodDBsKNmDKvwfD23TzdZdqMdovMn7keA38Jx B+LCZpCl4r0FY1WGnaSrTDBuocx0u5zhBxp7mBMTZxbwuMG1pJyVa/2Fr24tcZkJwi7M XCg3gncXteLIli3WFIjZ3fsH4tp0X932v+PCTQrsjfucBSoYaSb4HqMJgrfZi8C/K+DJ XQx0z1fHZ1G6FcBICX3AvUkT4+U4+LplGRW2v7FhPSsD9v+H2oqi9IMarl5ASIvMVeVn JE1A== X-Forwarded-Encrypted: i=1; AJvYcCUo7w9H1rCcQ1WW39JZss9sGSsF3ykZeNQcs6biBmYJcexepSO1AiVUs3m02hyhhCXeeIjIrlx/onSfrQc=@vger.kernel.org X-Gm-Message-State: AOJu0YwGqSTsUAoAlXuftt8J/QWvlRafF5M8cI+d3ONkDaBu5X6XDGy3 dDmwWSGDBkXqwVmQ35iRo5rxO9UCj8IzbtueyoNvTF8MPzYTZmVZ06+569L38J58odk= X-Gm-Gg: ASbGncsRiQF3e3GPwDqfYTqouCxBaWM3JgxQdbwEeX/5Uel6Ma4t2ulEeG6lkRYMdAj wokMBU0xgj9ctZYxomP4WQjvMlImcdZXMv0+oYOTfyk9tD+eM6o+03lyaIK6vcLyPVUBM3eQl71 7/6XsehPilpOTlvb8yxHgZmHC0pfFTvFT91j3HaP9YYhkAll18cQSmcCT+le5uebfLFCD/2hPky p1iHxVqxD1nZ5Nj+FjInSZ7vvQFv3fcUmdE37phccf3pdI3g5/S2+gCLufTmu52TKd1Hr1t3AtT 9d0ovwDqvr6mDez8S8kd0jQA0NrLJmb4wz8zT5JMTAVdcOCQtCG9gqzlLS0/RjkgoiZizLHdmQ9 WxrlCB5hDWwtDalQcOYnJKy8xjdWaI4ja0wd6GwPkfGcHC+5u1cSGowykccE= X-Google-Smtp-Source: AGHT+IFxG1Eo7rfaHiizXIP1eu697RM/vr50az4fqJh/5bcsgHVfbKdR3IFWapwDi1gk5j4t6+xBtQ== X-Received: by 2002:a05:6000:4305:b0:3b7:940e:6529 with SMTP id ffacd0b85a97d-3b8d9465fa5mr6199348f8f.10.1754321046486; Mon, 04 Aug 2025 08:24:06 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:05 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 13/20] clocksource/drivers/vf-pit: Encapsulate clocksource enable / disable Date: Mon, 4 Aug 2025 17:23:31 +0200 Message-ID: <20250804152344.1109310-14-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For the sake of lisibility, let's encapsulate the writel calls to enable and disable the timer into a function with a self-explainatory name. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 2a255b45561d..96377088a048 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -62,6 +62,16 @@ static inline void pit_timer_disable(struct pit_timer *p= it) writel(0, PITTCTRL(pit->clkevt_base)); } =20 +static inline void pit_clocksource_enable(struct pit_timer *pit) +{ + writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); +} + +static inline void pit_clocksource_disable(struct pit_timer *pit) +{ + pit_timer_disable(pit); +} + static inline void pit_irq_acknowledge(struct pit_timer *pit) { writel(PITTFLG_TIF, PITTFLG(pit->clkevt_base)); @@ -95,9 +105,9 @@ static int __init pit_clocksource_init(struct pit_timer = *pit, const char *name, pit->cs.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; =20 /* set the max load value and start the clock source counter */ - pit_timer_disable(pit); + pit_clocksource_disable(pit); writel(~0, PITLDVAL(pit->clksrc_base)); - writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); + pit_clocksource_enable(pit); =20 sched_clock_base =3D pit->clksrc_base + PITCVAL_OFFSET; sched_clock_register(pit_read_sched_clock, 32, rate); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 56897274B50 for ; Mon, 4 Aug 2025 15:24:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321051; cv=none; b=LSVuRFiQEz1HbwU4RXSY7PNN4+iZz3djvkzO2IW0uhsvL6Dhp9cIolsvdEseFzEUyfziZDe7xFKbuqHhprsqOrpaNX1mzj9+8q0WobwSDRW4/7VAIl/CyFHRWfdEFx10NxpoenlGaToREqaxeCinm9mtnsZD7G2C7z7QdMcEke4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321051; c=relaxed/simple; bh=Wk97buN0o0oO5Pg6mh3j5DzY8MUEjrw8kChllVB2Vhg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aF1XIUgB28Pbr1BpNJtggpNbRDmRY0J1YZ7hQdCYEoNHniGwuGB92Oz0VddFByDh1BIk144fEj1mrF0p6xDqB6C8Pd4E3lAos4LWAVjvhwvo9LwRPcZ6wXI051jt4EZk5STMbMWw+SRY1q4DsIWz2iUZfw+7cCnZfdhRU31/c2c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=XUn+GNYL; arc=none smtp.client-ip=209.85.221.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XUn+GNYL" Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-3b79bddd604so2970694f8f.0 for ; Mon, 04 Aug 2025 08:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321048; x=1754925848; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zNIZRPL/aYSMg8EX0aeqcrIzm6PwgSE5iRtD2jvvxVY=; b=XUn+GNYLiJScE2CvjKCkJvo0napo9ap2VES39wo3/0aE79FzQav2yBNWDuZxMqm5ej LPpmzlc1vMu8ry60C9nexDUzBvFg6UsHDpUltqmznctC89mU/QHxWMljGhSx0iN9qNRl HfMWywD4ZNnPlxx5nQUR7qKHefhpL0fxNB1BMsH6kpDkc+erm5eMhlGG5VVK+sg+m3Zk bIv1cg+cxclke49TDYZuuPH7FfRdUAUp6FUotTKvgQfyUkaOEINl5gpZxUKrJ2tZVedh wsa8GwKcaIQiGgmxAk2I2gf8xJDaQ/LapygQAfpn1D8NC5T2QzRRMviNaZypfOKgsltE M6mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321048; x=1754925848; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zNIZRPL/aYSMg8EX0aeqcrIzm6PwgSE5iRtD2jvvxVY=; b=JyHXjPySSZIB7AaIkwSbJ5Ae/HEfYQDpTQQuaF9SFTvFsm7s9nYmdVS52XxoNWjLjt W45FM5Orz0G7F6dZaGDourApc+cF+bF0dPHyTvZK4W6YmQR6WpIf9/gz1O1eXMwoI4K0 PPxOuQAt9Ksxtn2rZ/GuLbF60d6BWFpf/wIZ7aSN5UXmj0QOShsny2Q6/uNlvTn6CiaU 5vE+yXVMJBcyicMlmkLv0KcCBJORzXtpyvegyVNIV0uRelqZwmHSHqmUAyWX0h2WiKOS yN+zJGxsNDS19GDjFCJrujahE5jwL1CHVVhm/Za55nqMBxFZWo8nmw5dDi/a35nqcTKp pJuQ== X-Forwarded-Encrypted: i=1; AJvYcCUPtbdmgwy5MsNabV6GYNXchHnNjYvtIvi+59/LH/t6AhsO7k2LQSRGqIKlK9em58DAuCI1Ii12QH6UqHY=@vger.kernel.org X-Gm-Message-State: AOJu0YwhTv6Uo+SpS4m0bH/VV4vpd7Ky/gsJkCpFKenuZO+SAGWtLaA7 d3Jya2L7mTyo9nfXCr8qjVZDkhno81m3jAnJhIDcOElFWfl5rmOrt0GyNcdqE/O0qqXtOOJsG6C LX/ah X-Gm-Gg: ASbGncsmtt2FGIJCqnZG5fybiwOEodiCieRwZG5wTTFbhcdE0efdlMqiGDOkD1TZjnZ Kex9NChKz7xlq36hJgmbyFzf7bQcfwPFO98ilCSarNoDwRI6zRfXqTAIvZlV5fE9xbzFNQLFg1m AHGh3N5eqa26HClVaIRxzu3oxKXhh3Bgh0jmg7KdvINXb++0KfBk/RHcQHdKZybzYPmQ/79o0ST fWrLSAh0TuHU485mpOSZkIYRoPf/5zw5d+gRteT1rHSM2P7wj0yviEacP27UsqDm/0njn0YuQ/n ODgKwFmgbmnh4qY1MEnE3iCPvtrMl63PnReZdcUtiVe7LyTXX4JNtpJF4pzpSHr0Papodab98EE HK9dfAyFah65D53mFa/+gXlc7GX9OnvJV9CZ6Fr6bl0djczY5 X-Google-Smtp-Source: AGHT+IFgXBG0bwfd21xHT+0pHFBUO4DlZytD31YXGFW6NGTAxSSO3sX4k62sohLMZl5R6Qp+q00o9w== X-Received: by 2002:adf:a30e:0:b0:3b8:dabe:bd78 with SMTP id ffacd0b85a97d-3b8dabebeb6mr4342668f8f.54.1754321047532; Mon, 04 Aug 2025 08:24:07 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:07 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 14/20] clocksource/drivers/vf-pit: Enable and disable module on error Date: Mon, 4 Aug 2025 17:23:32 +0200 Message-ID: <20250804152344.1109310-15-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Encapsulate the calls to writel to enable and disable the PIT module and make use of them. Add the missing module disablement in case of error. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 96377088a048..609a4d9deb64 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -13,10 +13,12 @@ /* * Each pit takes 0x10 Bytes register space */ -#define PITMCR 0x00 #define PIT0_OFFSET 0x100 #define PIT_CH(n) (PIT0_OFFSET + 0x10 * (n)) =20 +#define PITMCR(__base) (__base) + +#define PITMCR_FRZ BIT(0) #define PITMCR_MDIS BIT(1) =20 #define PITLDVAL(__base) (__base) @@ -52,6 +54,16 @@ static inline struct pit_timer *cs_to_pit(struct clockso= urce *cs) return container_of(cs, struct pit_timer, cs); } =20 +static inline void pit_module_enable(void __iomem *base) +{ + writel(0, PITMCR(base)); +} + +static inline void pit_module_disable(void __iomem *base) +{ + writel(PITMCR_MDIS, PITMCR(base)); +} + static inline void pit_timer_enable(struct pit_timer *pit) { writel(PITTCTRL_TEN | PITTCTRL_TIE, PITTCTRL(pit->clkevt_base)); @@ -254,11 +266,11 @@ static int __init pit_timer_init(struct device_node *= np) clk_rate =3D clk_get_rate(pit_clk); =20 /* enable the pit module */ - writel(~PITMCR_MDIS, timer_base + PITMCR); + pit_module_enable(timer_base); =20 ret =3D pit_clocksource_init(pit, name, timer_base, clk_rate); if (ret) - goto out_disable_unprepare; + goto out_pit_module_disable; =20 ret =3D pit_clockevent_init(pit, name, timer_base, clk_rate, irq, 0); if (ret) @@ -268,7 +280,8 @@ static int __init pit_timer_init(struct device_node *np) =20 out_pit_clocksource_unregister: clocksource_unregister(&pit->cs); -out_disable_unprepare: +out_pit_module_disable: + pit_module_disable(timer_base); clk_disable_unprepare(pit_clk); out_clk_put: clk_put(pit_clk); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 669A0273D6D for ; Mon, 4 Aug 2025 15:24:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321052; cv=none; b=YuQDUkt+y+SYNar603JymwLqfyR10O5m1O5lalkF4DO/Xl1Nbh/m+nBtb655IMNVSnVHpMyPt4b5PKONsRyhqFMBgC7qbZCUo5pDc3fC/rGmDMq2PadkDxQTZmi9t1wWZ8slKq5kphPvqCfk/P3Ce1KKU6Ks9YxuTOtXle607DQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321052; c=relaxed/simple; bh=ZQF+EVPqcx9QLRXKTr1LjG0h/R3IyHQPuhVCVCcAuO0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aL2399/a/4fpGrCC7YdQXOMtVZf8YG8kVd5Ajf3K75AVuV94gu+x+lt2SBKe4KZtGe/NvuNeDHsJLmFiKIt3b7WHxsbMvgC7NorMaOYqH7ta3tyumSXz1TsvL/2gUpjMgcM0/IQHHxZtixG9Uhq6TAlHf/c3P0LivR78pWZ+Llw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZJZLomdB; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZJZLomdB" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-3b783ea502eso3473758f8f.1 for ; Mon, 04 Aug 2025 08:24:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321049; x=1754925849; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TbVaJyUO7GiEiEqdQljEO7vQiGP467HVmO08HdyjiFo=; b=ZJZLomdBESzUkef4PmvP0BofUqRmHsIRA/wE2Wgdyxu4NniSvvk7nf3wUYeC8rs8nF hFBVg8dwWkVUpZVwuIz57e8INRlV9qQyZfn+wg2Jg5Fb7QUtkBTSH8ud0V8TtuUiZJMH kEHC9yqZyQBOSHUqH/+PWXGm+somQOVdFnQ9xdQPfVSHLTXn8oe/IpU54nvPaZPJPtM7 u8uuuUk55OmugfsBIjcl+VJC9FuZC6ENJZ8F+T6mJLj5Hmkg19SA4W1RAFIOisy8hkL5 FyLJZeviDfVQhJBVwcsIhQFwA5EelaHKzrmfAgNIGgVErYh3+qNHMjkY0eSuD3YV5kCA N7Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321049; x=1754925849; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TbVaJyUO7GiEiEqdQljEO7vQiGP467HVmO08HdyjiFo=; b=mLUY9w1K+UCRSVonHTFn8LsCcq1URAdoWUklFRXeRS7p3koy67EY8AD2fyLLMcBMHc VmShOKVCZGiRXm2swmzBSpezWfCPPI8xSB3QqliYbkYzMRDz+Petnre6FLfTqBjdg4LO E9bcw9Y/Qsz8z1beIPa9XAaIw2Wa+xx/0SU7qBkx5TSSErofxHIAdAI8ngR5uUcKteSQ R6PH6eXCA4cx4zf5Onzt8S1jwuQUp07GEVmADEyzGkYzBVaS6wR/J4BY3sfrm9NB1qve in05NX6Pu/Wz9gzWWMy4Mgq3eHXL2vbnN1Am+xNqK+kLtsiqH/0G+y4H9++yKOnhB/og eF1Q== X-Forwarded-Encrypted: i=1; AJvYcCWz1RjMReNnT7vYn4tELwsSL6YxFTK02P7n2qYh4IJVEh9llwqyKPr4Sqq5lZdRfXGmKBbUHMf7f02MmvA=@vger.kernel.org X-Gm-Message-State: AOJu0YytIYeso2GCetbKafxjXpt9+/NGEHWFjpLem+OkYggDMWdiQOP5 IztnxBHj6PAbAQGRxftZ8o+r90VP0Hq1fWjcDJ9kh6DyH4EY4XdOdeUjwVtpVWSd/a8= X-Gm-Gg: ASbGncswbnJ59C6XLpH3r0dPuNJ3t/aZGDJDlhJifOEn418di/gh7IgBSyLliHS+5O8 1P8IU0aSJgzU21NaDg2ysl0HUJoctvhaLIxt1Olhdwo4Ui4qaNpgmtquEAQEKvLSi1GmjXr6fjd BYZQFyzsgu6HxLPFmGe4j21ESFqosYhfK4FiZSAnAKM61FfVrSooqzC4tsqJDll1VZSLEARV7XM P7hNpJO+O0dqAja9MoaftDI1KUBxRiSx2+s69xBSmMkoxF339GUn7LrDwN5GG5M/QCAymXxlfro p50HaXTunjb+pfY4peq7ccAkLYRCGNZXL+gJrYjGDjqu4lNy12jHK1lQRtmxqkz9793kzEmIWuB o1s8GlVsq0fB84WWSKygDkPSwNaSbeXn4cLUYhGJag5hy4yJPGKBo4PnOxSI= X-Google-Smtp-Source: AGHT+IFd0H5wUKE2CqwTEY+Ymp/L1RtxUK98szZDSTTw1G0toLs97LvobwJthRM7hQELBF1NlxYolg== X-Received: by 2002:a05:6000:2f85:b0:3b8:d8d1:1e72 with SMTP id ffacd0b85a97d-3b8d95a4250mr7256538f8f.19.1754321048822; Mon, 04 Aug 2025 08:24:08 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:08 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 15/20] clocksource/drivers/vf-pit: Encapsulate set counter function Date: Mon, 4 Aug 2025 17:23:33 +0200 Message-ID: <20250804152344.1109310-16-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Encapsulate the writel() calls to set the counter into a self-explainatory function. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 609a4d9deb64..5551b61483f8 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -74,6 +74,11 @@ static inline void pit_timer_disable(struct pit_timer *p= it) writel(0, PITTCTRL(pit->clkevt_base)); } =20 +static inline void pit_timer_set_counter(void __iomem *base, unsigned int = cnt) +{ + writel(cnt, PITLDVAL(base)); +} + static inline void pit_clocksource_enable(struct pit_timer *pit) { writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); @@ -118,7 +123,7 @@ static int __init pit_clocksource_init(struct pit_timer= *pit, const char *name, =20 /* set the max load value and start the clock source counter */ pit_clocksource_disable(pit); - writel(~0, PITLDVAL(pit->clksrc_base)); + pit_timer_set_counter(pit->clksrc_base, ~0); pit_clocksource_enable(pit); =20 sched_clock_base =3D pit->clksrc_base + PITCVAL_OFFSET; @@ -139,7 +144,7 @@ static int pit_set_next_event(unsigned long delta, stru= ct clock_event_device *ce * hardware requirement. */ pit_timer_disable(pit); - writel(delta - 1, PITLDVAL(pit->clkevt_base)); + pit_timer_set_counter(pit->clkevt_base, delta - 1); pit_timer_enable(pit); =20 return 0; --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8458027586C for ; Mon, 4 Aug 2025 15:24:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321055; cv=none; b=F7Z35kH3qu0z4BmqgUWYlb68XWXSnvs69irsDDn0amOwv34G19TG4fHqe1+T5T6Puy2nKj6reXwwwkZcL3iZMJin5oOtXyiIzW0Hwh5L9kRhdGj7tRJUe4KO/zZtMrKVzAVBG2wEhH01IjnF1z93wvIgapy3BL+1Fcm0SJnGXiI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321055; c=relaxed/simple; bh=a/0AWWMness0DJLQiPSyAnIrS474aFqX0oXu3a+rSvU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FQL/srKKUHbhuYTVkBEthPMzrFQbRmTFzFIoNfbwLQE1PsYhjZWZf9eRKwH1QCze1vihWhHjLP+BQH45XRtmdm5VuH3tY42NaEnNk8poZTfGjWlHB9FJaUUeHA1kPetYJm5w4ELjqIdJkzefSf7epWPw25AQAKx4V2B0f1J3o6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qMyNXFdp; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qMyNXFdp" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-458b2d9dba5so17393415e9.1 for ; Mon, 04 Aug 2025 08:24:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321050; x=1754925850; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=x4Ph6ku9ijHHnHFIPYcIGsTrs1zpXNFz3v5KP1gyjEA=; b=qMyNXFdpk2a9UqHsYj58NX1hUImK/r9X/h5n9Dl1F/18UOzIkfiweKegfEu5Mbpm5o Pxv/4z7MMB6f+QimIe1kXCTngMp6gfCst2sIwhXBN+DRn2pAaUZwYx2f9kOceQl3Nplb x8iGlQmVI+AsUwWN/9vbRKhPHoh47i8KbnHY5vXVgB9T8vO22TVThHOmOSHXRrA+fIxN V+eG8mokCo1EWVXxw3KvdrJBxQFsr+KHahW4JqwFCl20V5f+tSk5VT3+y3BTmlooRzJV eAGVR1F6tFOXUso1QHeAgnS2V3ZiGUXK1Z7x8JwxbvkzHbHbbOa+i+6AjjplZ7MAvEpv tJiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321050; x=1754925850; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=x4Ph6ku9ijHHnHFIPYcIGsTrs1zpXNFz3v5KP1gyjEA=; b=FQhi1/VNW1RVmg6dkmKIMajHMR4R1M9NF8pXuHYPBV/9eu54S9pmY0z2tkHWBjGsP8 SAEb9QoBUeFLBmvDMQ4sUglwzJF7gUQLeDgerg7SRo+YwO/MH3m9Rn3TKrs8GPIVzLyI 0gupGbFtqnpNe59RqjUgFRCP1bgoaqgPzXWq5ter1alj8pSWpD8GmNcRAlkb6i5B90sj +oWjCWJ5evYIC9kjsCKekP066IGBgHwIjs66yjaGXaN/WhgL4kHm4/J38wk70dECCkDP XTYyOFkrOrmFrYPm30B/7lVzAR65E8Fc6h0eZFfHybmICm9vo3RfaK9sDjRZOGGq1pOi NMaA== X-Forwarded-Encrypted: i=1; AJvYcCWRz1ezMng+AuAAWdXkexXWRg3btn5m8WBAR1t2GLWPpVX14aO5nDAg/9VNuwXlhPYaDefo5C3d3ikeoso=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4A7HB+7086F4CrNLjthw9tHN72OomZhVGjcWQXUsiXRPyxvM9 2QG6YbZQiIxVVsiA0mwSVKo0lYOHLIRL+nG7ugHr0+EPsHnOXS19CzIVuNJ4HVT2HGRsOT7i9+r 9xqS4 X-Gm-Gg: ASbGncsGV60RC+2tKleJXLljGdtBgW+7QH44apVMTHYVTybzh8G6oTDuCAcGdfrPGcl miz2z5vovdTsIZWddM7Lxx/7fwsrIhoL7g74NQ34U0U96gQ67VvxCrOziXb31TOLHmk50qKc4Hh LW2U34wpeAypKOgwf1BNQ8HjtT+DEW5iO+O0DtuEluIAs4pX+1IlmrLPQGnqmRgS7lqhyF4VyHk VRc+wan22g2m5rAiBWuvPhlU9vdS3jtctLL1apmHLgV0zvKo+cCVz56FvfyGDEYplWWEgoQvNSJ Z4TFlBWoIcraIZn48/0yW7teTjcvAcz8XH+O7YPDLJksnJ3h4Xxb/EIjxKEHrWYemrLuBH/dxSE RCn3w5u3A79TztXOVRtb/AlOODw8w6VphC07Dkp2kgBhn1PlB X-Google-Smtp-Source: AGHT+IFLiw0abncDIQoCIfWy1e2kQx7l1+rj5+Ucr9VZRji5apq9grs1kL9zECCipTh/lT5MCS1zaA== X-Received: by 2002:a05:600c:3109:b0:459:d3d0:6507 with SMTP id 5b1f17b1804b1-459d3d06751mr43244675e9.32.1754321049718; Mon, 04 Aug 2025 08:24:09 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:09 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 16/20] clocksource/drivers/vf-pit: Consolidate calls to pit_*_disable/enable Date: Mon, 4 Aug 2025 17:23:34 +0200 Message-ID: <20250804152344.1109310-17-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The difference between the pit_clocksource_enable() and pit_clocksource_disable() is only setting the TIF flag for the clockevent. Let's group them and pass the TIF flag parameter to the function so we save some lines of code. But as the base address is different regarding if it is a clocksource or a clockevent, we pass the base address in parameter instead of the struct pit_timer. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 34 ++++++++++++------------------ 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 5551b61483f8..3825159a0ca7 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -64,14 +64,16 @@ static inline void pit_module_disable(void __iomem *bas= e) writel(PITMCR_MDIS, PITMCR(base)); } =20 -static inline void pit_timer_enable(struct pit_timer *pit) +static inline void pit_timer_enable(void __iomem *base, bool tie) { - writel(PITTCTRL_TEN | PITTCTRL_TIE, PITTCTRL(pit->clkevt_base)); + u32 val =3D PITTCTRL_TEN | (tie ? PITTCTRL_TIE : 0); + + writel(val, PITTCTRL(base)); } =20 -static inline void pit_timer_disable(struct pit_timer *pit) +static inline void pit_timer_disable(void __iomem *base) { - writel(0, PITTCTRL(pit->clkevt_base)); + writel(0, PITTCTRL(base)); } =20 static inline void pit_timer_set_counter(void __iomem *base, unsigned int = cnt) @@ -79,16 +81,6 @@ static inline void pit_timer_set_counter(void __iomem *b= ase, unsigned int cnt) writel(cnt, PITLDVAL(base)); } =20 -static inline void pit_clocksource_enable(struct pit_timer *pit) -{ - writel(PITTCTRL_TEN, PITTCTRL(pit->clksrc_base)); -} - -static inline void pit_clocksource_disable(struct pit_timer *pit) -{ - pit_timer_disable(pit); -} - static inline void pit_irq_acknowledge(struct pit_timer *pit) { writel(PITTFLG_TIF, PITTFLG(pit->clkevt_base)); @@ -122,9 +114,9 @@ static int __init pit_clocksource_init(struct pit_timer= *pit, const char *name, pit->cs.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; =20 /* set the max load value and start the clock source counter */ - pit_clocksource_disable(pit); + pit_timer_disable(pit->clksrc_base); pit_timer_set_counter(pit->clksrc_base, ~0); - pit_clocksource_enable(pit); + pit_timer_enable(pit->clksrc_base, 0); =20 sched_clock_base =3D pit->clksrc_base + PITCVAL_OFFSET; sched_clock_register(pit_read_sched_clock, 32, rate); @@ -143,9 +135,9 @@ static int pit_set_next_event(unsigned long delta, stru= ct clock_event_device *ce * and the PITLAVAL should be set to delta minus one according to pit * hardware requirement. */ - pit_timer_disable(pit); + pit_timer_disable(pit->clkevt_base); pit_timer_set_counter(pit->clkevt_base, delta - 1); - pit_timer_enable(pit); + pit_timer_enable(pit->clkevt_base, true); =20 return 0; } @@ -154,7 +146,7 @@ static int pit_shutdown(struct clock_event_device *ced) { struct pit_timer *pit =3D ced_to_pit(ced); =20 - pit_timer_disable(pit); + pit_timer_disable(pit->clkevt_base); =20 return 0; } @@ -182,7 +174,7 @@ static irqreturn_t pit_timer_interrupt(int irq, void *d= ev_id) * to stop the counter loop in ONESHOT mode. */ if (likely(clockevent_state_oneshot(ced))) - pit_timer_disable(pit); + pit_timer_disable(pit->clkevt_base); =20 ced->event_handler(ced); =20 @@ -201,7 +193,7 @@ static int __init pit_clockevent_init(struct pit_timer = *pit, const char *name, pit->clkevt_base =3D base + PIT_CH(3); pit->cycle_per_jiffy =3D rate / (HZ); =20 - pit_timer_disable(pit); + pit_timer_disable(pit->clkevt_base); =20 pit_irq_acknowledge(pit); =20 --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 977AC275AE7 for ; Mon, 4 Aug 2025 15:24:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321054; cv=none; b=nwE8C4xqYS4Job5hTYPr/qb5l0EshEmdo9cocRo9D3OhojQFTjRLsTgEWyXwBujWzSbQ52umJRdSPtCpOMm76uUxATy/SQYGwY9+on94a81tbPpl7Or9mfGgOSdrTS5a9aNsRgSmnDt0f81i73a/WlQzz0sZkpgm2KleGgPZY8o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321054; c=relaxed/simple; bh=4wUMG106laRuIHpbrM4t5F3/jxrsablQ7YM7IMrfxTg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BlG8o5x1A4CEQiE+MbfXp8l6n6gtUb7wVMNZi2CZDRR+TCyox1wIGj75V8kBbvzd7ryacW/3jEDAupQVJqYvQ6Tbk2epzqK+th3w/iXozqqk+IFtgFaDUt6vHlZ7UFgKrtscuJHO81IvS2z9uiG2Avgy0y6TF6o1d1PcqJf+l0k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Qow4Wy3R; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qow4Wy3R" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3b8db5e9b35so1580091f8f.1 for ; Mon, 04 Aug 2025 08:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321051; x=1754925851; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gdWn//c212Ti3HpbT8pEOaw/we9iaNvG2SciGLwX7ak=; b=Qow4Wy3RPsXA8Jn74NfPM/znYrdb7BvOVULs1Z8GdWsdYn1cmkpcFWWT840B+qpXGu QLKT2D3Ln1EOXZzAcRSfpc5o711Kyj8xTn/cOq8SmuHubFH5V5shnqIa647Isze/VoBh oNPD/JuWzv9xYvM9a6Ba2JpRk/F/dMhfvZubEnu9mGrtDhEQJee8cwuaMmzR+qgBG7d9 BqJ3gCwNynyZ85f4763qbOsnD1gFN0dg9AF2DVD1lzm63M+wOjSac8ZN7x7BdOW0yDe0 0tF2n+SA90l40rU7/TEnPfnSO4uZ4ggTABG0yP4BHb7+xlCpxyNW9ZvL2H8NHtHYk0LO 4SGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321051; x=1754925851; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gdWn//c212Ti3HpbT8pEOaw/we9iaNvG2SciGLwX7ak=; b=fkgiAvudfXzB8Oag7ICxAM4fyZBNFqqK7VqYAP/Y+SGR91dgWSo+e4ZB1APNEQ9a71 ayHvUdhb8KR4W11VnGIF7kIXIWibzKAPkt5BjFr73QqtH1IX72Akwme2j9uw7Pfi51Ls 8wN8fRLxvoH8Mlk5dO8ZnlkDIXYyOc4icxQDsXVzo6znK91BeA7Zgj7kF7gjjswV0lFm v5K/svHbFbgt2eKP4RZ7t2uv5yF96w3YhLUtsba9Ua7hNTO5vUhfUupC8vDbdMSiuxIo i8VIhQfqrj3XBpJKypf16cRxPCncpwEqZFu9DHs+VfI0z6kNn3ZAax+oRK19pQuCmdC2 eI2w== X-Forwarded-Encrypted: i=1; AJvYcCXgK5pTfnAzSGXn4FaQ0Vv5TcS2zkqiNulB7LYEhOs2DwLfpkAl7u8Y5EZulKCFKY5DHKlW4jGbXHuPNtI=@vger.kernel.org X-Gm-Message-State: AOJu0YyVR/j/IaOAqPwDmCQdMkLjSrJj4XZmsp02Pfhha4roO/URtfOM p3USxwiVtbbvhlGnwVzcjWIwqQRG5kcBsCSFO+jhqevw5bXM7sDumbnN90R5VZVU1iQ= X-Gm-Gg: ASbGncu9MzsIUdKxsriuWyteUr3ruelyfWnCXOoTrBwRfQJq8UPSv7ib9BCVcGc+Y+P hORE4gdw6NgpKb2j8gLk29ABc8peyV60iVccSq1DxjIV3rWHJfb+jU1OiBioqH7e/uucTL663TT KW1mjbneYUekurEgfW4uLOPCSlR8rgAByfRASgC/+PMOX68Tv23sNfEMyHPW0J+MIBcGyL1xrO/ 7B3aqBVPD6DXXpIW+ajYjJEqxATK3Qn+JghsrA9RFyEGCW1RCSr9vmUv9W6BoZMTQAUQiUlbZGP UMzVrqCkNvCAZfA4QVRIdOkpz3ubsx63erbpDCnr6rcsjDAKyCBLXvq0ny06ySHGCqU1YLwN2qi f6lZATjHWts+IwQDnQKfCbAlDZRNC0GOfDNq4IuADIuMKUMja4769wmwAxGY= X-Google-Smtp-Source: AGHT+IH5f+9LZNBrPQYkYXLRM0ZOVndeywyqyYYPF/dMlXp+s0WJGrfW5CLFB6uOvk9rzZsgIP5Fww== X-Received: by 2002:a05:6000:2303:b0:3b7:911c:83f with SMTP id ffacd0b85a97d-3b8d9469a23mr7183871f8f.9.1754321050876; Mon, 04 Aug 2025 08:24:10 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:10 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 17/20] clocksource/drivers/vf-pit: Unify the function name for irq ack Date: Mon, 4 Aug 2025 17:23:35 +0200 Message-ID: <20250804152344.1109310-18-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Most the function are under the form pit_timer_*, let's change the interrupt acknowledgment function name to have the same format. No functional changes intended. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-vf-pit.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -vf-pit.c index 3825159a0ca7..2a0ee4109ead 100644 --- a/drivers/clocksource/timer-vf-pit.c +++ b/drivers/clocksource/timer-vf-pit.c @@ -81,7 +81,7 @@ static inline void pit_timer_set_counter(void __iomem *ba= se, unsigned int cnt) writel(cnt, PITLDVAL(base)); } =20 -static inline void pit_irq_acknowledge(struct pit_timer *pit) +static inline void pit_timer_irqack(struct pit_timer *pit) { writel(PITTFLG_TIF, PITTFLG(pit->clkevt_base)); } @@ -165,7 +165,7 @@ static irqreturn_t pit_timer_interrupt(int irq, void *d= ev_id) struct clock_event_device *ced =3D dev_id; struct pit_timer *pit =3D ced_to_pit(ced); =20 - pit_irq_acknowledge(pit); + pit_timer_irqack(pit); =20 /* * pit hardware doesn't support oneshot, it will generate an interrupt @@ -195,7 +195,7 @@ static int __init pit_clockevent_init(struct pit_timer = *pit, const char *name, =20 pit_timer_disable(pit->clkevt_base); =20 - pit_irq_acknowledge(pit); + pit_timer_irqack(pit); =20 BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, name, &pit->ced)); --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3D6E27604B for ; Mon, 4 Aug 2025 15:24:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321055; cv=none; b=C+9rD6zei8GowBNuA3JRlNG2cvTl2tcjN3ztccep/yRctd6mj4MF1Od89cGLLZr+Bd4kpp9zHqQhJRJTcdKmCJsnPPSeSYEDYa4ysFdt26I3Y+2Z3j9bzMBakhUtNLjbO6K4BUTJrTjUuvCXw/mhi5MqrLprMgKfDG1E84r/r7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321055; c=relaxed/simple; bh=hZs4sz8oMPEiGhhqApXBtCYQcDxESo4pq1mV1+Z7Z2w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TQlKxEZBt5NdSGWUYQqdpmjyoci6oWEfkxu+zVXL8amEvBgn2eXRIFScMOV3BsaZNN1BIswGVtGQ8d0B4ZptE87aRzL0txY8wF8JUWW5IYxTbR0APyFgyVHURQwhasEAjvpgqvBBzhRhshff77TeaqDJImo5s90DF4MXs9bWGlA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ciHaP/1e; arc=none smtp.client-ip=209.85.221.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ciHaP/1e" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3b78310b296so2757804f8f.2 for ; Mon, 04 Aug 2025 08:24:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321052; x=1754925852; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=epJPa/pBL6IXn229DAd6lGt1WeXWNm9UUZm5IBc/kEc=; b=ciHaP/1ee2ApYZA1BkL5GV/UyHaoSXHEdgR1yCE4+oqJycambTOZUZddV7lRiGGNdx Uwn6h55WIqiPFP6t7guMY0KpEMO9spaeVYS6exot2B+KGQWIISm41355t2ItZ7TlZA1h aJyLSL7BFjnKLqtD8uToMJdWJVXjko1T+XtdProD9sFx1gAQmR2vO+WX0/o4QLAGe0Jh DsagjgtQTKWGanvS4U5tPJd59WORxV6aOkLf9uqVWKYXnCFJgoSDmoFNDGDkQi26MA7Y 2jdcp0UKxHBRZ+WaQ+8SpHmipJs7lGfti7qdGRKK3ze2/dlAvSmQB3CwTN9CKSbLcVub RQOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321052; x=1754925852; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=epJPa/pBL6IXn229DAd6lGt1WeXWNm9UUZm5IBc/kEc=; b=p1WkEZJ36dqRt5zc26pwfuABKxsbo3CZLq68Lu+XdYHEjmIBd8aon3YDm+rAWJUZno C7cxRHnvFLPE9OMgOD6uAnX+Tg2fdXXN3oLKe6o1nWjRi2jjLG2tritGvF/J9OvFqSn8 dwcANVPjk/2leaFAkvL7yexq0x85LTzPida34s46AJEvja8NgNfDvRr04svTkREg9yyA LbMdvFrLxkQpmpcI0GJI25+PkspQPW0IWhGtU0I+pm4u1Pp/XzNLfTHqUMT3hSENSjg8 KMkgSnOr3vw7vzWLBsjzDVH4eIKNKgK07qnl5bAcxMZnSkh597HV6NP2H+rIxyk4Hv6Z HukA== X-Forwarded-Encrypted: i=1; AJvYcCUxw4zQwww5uoIrM6/vgkiJ9rbmNX6FN+Tf9kvKwgXTwS80zQw2Db3+d7hhLtAf5TUTO1bOkBhdLrEB3kI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx1qX+YzyM29/7H0+nd1n0JdSTB1fRIbXPUQei/5X8k1StonHND MsaotSihgyGmh+y9fMLiI0CWmdsCahvsSkpfqygAD7v1kqAorctzlODqbWnmBPuwibE= X-Gm-Gg: ASbGncuzuJsmB/Ux/8FBiSpqOOWoE82J82Eqa4BB6Yp2RGuc6u3pbYCppZtvsdimVBK gPwVA6loWtePLFk221eQk6fPZX71TJb/i07lng+s0rPsJkKD/zzpCjtAq9p0DH45fouWhn79Gm+ MPATODGjdVKfCW+nOl0kLlUOTCx54mpr/bnfVj6TdiPyT/gB3Lpca/Lxfj5K4cme2UC8cytMPVQ E6chXATNP7kELdiJs5ElLOnelDk1Osoh8byRrIPmAz5DFFDe/QICsJez9pmadwA8IUGRzfV+OQD wEQfS/unsk+mc3di8kHcT9grVIa1Xz5fx72TIsQIOrSGOValdYbRoyvxBzGPLVapCT7xMeXVUEb k7MSAC44wb/b+EXlVmkq0ugWxYQzs1OHmhpxjhzLVEKci/kZ4 X-Google-Smtp-Source: AGHT+IFibEWqFegvsCz6rZMliZ7HJUvwpm/Ifdy3spX/uA3z9andkaQ/IQkKbXAJrvckO5Sf1K1pLA== X-Received: by 2002:a05:6000:2289:b0:3b7:8d80:e382 with SMTP id ffacd0b85a97d-3b8d94698f1mr6918659f8f.4.1754321051978; Mon, 04 Aug 2025 08:24:11 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:11 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 18/20] clocksource/drivers/vf-pit: Rename the VF PIT to NXP PIT Date: Mon, 4 Aug 2025 17:23:36 +0200 Message-ID: <20250804152344.1109310-19-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The PIT acronym stands for Periodic Interrupt Timer which is found on different NXP platforms not only on the Vybrid Family. Change the name to be more generic for the NXP platforms in general. That will be consistent with the NXP STM driver naming convention. Signed-off-by: Daniel Lezcano --- drivers/clocksource/Kconfig | 9 ++++++--- drivers/clocksource/Makefile | 2 +- drivers/clocksource/{timer-vf-pit.c =3D> timer-nxp-pit.c} | 0 3 files changed, 7 insertions(+), 4 deletions(-) rename drivers/clocksource/{timer-vf-pit.c =3D> timer-nxp-pit.c} (100%) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 6f7d371904df..0fd662f67d29 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -474,11 +474,14 @@ config FSL_FTM_TIMER help Support for Freescale FlexTimer Module (FTM) timer. =20 -config VF_PIT_TIMER - bool "Vybrid Family Programmable timer" if COMPILE_TEST +config NXP_PIT_TIMER + bool "NXP Periodic Interrupt Timer" if COMPILE_TEST select CLKSRC_MMIO help - Support for Periodic Interrupt Timer on Freescale Vybrid Family SoCs. + Support for Periodic Interrupt Timer on Freescale / NXP + SoCs. This periodic timer is found on the Vybrid Family and + the Automotive S32G2/3 platforms. It contains 4 channels + where two can be coupled to form a 64 bits channel. =20 config SYS_SUPPORTS_SH_CMT bool diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index 205bf3b0a8f3..77a0f08eb43b 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -49,7 +49,7 @@ obj-$(CONFIG_CLKSRC_LPC32XX) +=3D timer-lpc32xx.o obj-$(CONFIG_CLKSRC_MPS2) +=3D mps2-timer.o obj-$(CONFIG_CLKSRC_SAMSUNG_PWM) +=3D samsung_pwm_timer.o obj-$(CONFIG_FSL_FTM_TIMER) +=3D timer-fsl-ftm.o -obj-$(CONFIG_VF_PIT_TIMER) +=3D timer-vf-pit.o +obj-$(CONFIG_NXP_PIT_TIMER) +=3D timer-nxp-pit.o obj-$(CONFIG_CLKSRC_QCOM) +=3D timer-qcom.o obj-$(CONFIG_MTK_TIMER) +=3D timer-mediatek.o obj-$(CONFIG_MTK_CPUX_TIMER) +=3D timer-mediatek-cpux.o diff --git a/drivers/clocksource/timer-vf-pit.c b/drivers/clocksource/timer= -nxp-pit.c similarity index 100% rename from drivers/clocksource/timer-vf-pit.c rename to drivers/clocksource/timer-nxp-pit.c --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f49.google.com (mail-wr1-f49.google.com [209.85.221.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B6AE6277017 for ; Mon, 4 Aug 2025 15:24:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321056; cv=none; b=im6nTqPSZWTttBDJaxQWLnZJLQ62mQwYApdHVc4MEFJXidRJPv6mxljFVQJbvGx97hElfueQDKVqSfjgW8YGocQoPmMlz0+UDKfz7QBkLtjbyUAefcux33MYTtaSLYqn498mMHa+nghWYLfregHLfDyT8idSQJjAl/ZyEp7ZBIw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321056; c=relaxed/simple; bh=0UvZE3k+XFIsWL7U4sT1dC/irQDhudNW/Glb0WMicdM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X1GPFqCQKIoMUiQghEprkIvMFi9ta7y76vCOoKRlzx/5FhfUHaW1wE3Z3nVK0sZbab6U7xM0hA1Hq91TiDKfYVWlqIxvUt4KGY30qtzyXk2pQLaFrpdW31Guxgxj/xrrIpToRMWdmPrfBHq/UYTrvVfzLuQcNe6cBgjpGhOc6ec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=e7nVCRSY; arc=none smtp.client-ip=209.85.221.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="e7nVCRSY" Received: by mail-wr1-f49.google.com with SMTP id ffacd0b85a97d-3b78d337dd9so2157421f8f.3 for ; Mon, 04 Aug 2025 08:24:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321053; x=1754925853; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MSMHDKm2fVBb5I+HzgHVkcktydoNZjtlzbBXl5Tc0aw=; b=e7nVCRSY/DwxDc0ow8FMCuAZ2rfNNrTmPb67oCsnoEz4mcv4ffR1cfX+L5Hxgmlu/W 47F64ulDzA+gHsUlaJ+dzNDn1Ibc2Od36XkrzpWk1eLqmXYBOYVfztxIKEp/vG0i7LK0 MmkNO7POnBLcXZg1lvHxpYdvzRxibvs4ZRDgh2fBGT0YjihXBqhvAJmh6zkcsIY7A8/j aPcKpenefvveIsqQUmSaneBdbEeVYAtic2DB0bCz/reQdPvywdHOt/Q+u35MhJheh9jb E0UIzHlBLE8O2+FyaNJF+nfNGEM1BNsPo9N8CUVvCo8MkJznq3nk7N2ku9AkhheWzq6+ efhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321053; x=1754925853; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MSMHDKm2fVBb5I+HzgHVkcktydoNZjtlzbBXl5Tc0aw=; b=VTHMqW80Bm3SiBXSwO0pyl+P9rjK+ITpFUMnpd9GcMkkoeP1Xw14ZZZDs8GAOhrHVp 5lfBz/EjAr58V7DYu8g1rO7wQSlYc6nB3TQE+wVzsDxGzDxwRCULYAfBoXQ9mOYi2guG JmMsVI5ZGJBy7g8227dDAuzKgH1N4SHuphX41g6IZ0NpPZ+WZvOZCp8Bik9TXV4fpuO8 TKA7M2Y8WYUY4YsUrpJuTeCZNTLzIFI7+RX8VXa0TPgeu80SaYrYtfMFm9K6xvixFbL7 I+M5f6MwX1WoFygzr6Q0jhje6BIRaMoVaMyTIUbGgvI401azcgilMIr2N3B354Ug3NOJ fqYA== X-Forwarded-Encrypted: i=1; AJvYcCWZjDVt4gHBYttGm3OF0odp/5htDaUAVsSDZkFEMCGP1GaYsol+3AUMG+08xKlS1jK6mvhNrZKkq9ej3Ws=@vger.kernel.org X-Gm-Message-State: AOJu0Yz1iUOy/9NosFn2pn3lmht0kqDU4hojD3EuESdDD3ggWhrA6uds wapjG429vp/EfBiv6v7XcDxQLtLuTmHHILfxHbMIATWJ6PWjboc4scEWjIgmhPRYry4= X-Gm-Gg: ASbGncsYRUVGJht28xBgThcN7EkaszVlu+QZ83YDDOae50rnuU19Csnyy737/bry+/2 OjBYFa7a0KeckS1h5YhlQhACw8p5S+5iiBC0Qs0pF86/ZTZBXg6wepZ0NmM4V4qnNJFvJk6F7EQ DgBTGtDlXstEHOy/b+DYnTQuJvdBu7IbUXAbznyo1iCKM+G4IYjhZEjYeAmxjs3bE4+JQ0tb3AY naAgLs0CydojYpFtv90UrhqfYZkXAJr0+MsQ0m7lWewKrS2dClAdet2/tPPKq/CKLbzUZzFOtyv TNoeDgzn69qCKKfZFNayvFh7ZypLffPjoOOWWyIVs6SF0wnsCeCGNdl0VNs6SkYymeWqV7yToET N23U+6BA3NFr8nypv+BxquQmDTHTMvk2dnYbtuHFQZhVL1hvX X-Google-Smtp-Source: AGHT+IHHSKgAOk2QSQQTS8KtsNeLFrmfp5jVQGwgWUaRhP71DYG7ooscPk+f2g4vk2n5Dyr8OqNoYg== X-Received: by 2002:a05:6000:2381:b0:3b7:9c79:32bb with SMTP id ffacd0b85a97d-3b8d94bacc9mr7805669f8f.44.1754321053029; Mon, 04 Aug 2025 08:24:13 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:12 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com, Rob Herring , Krzysztof Kozlowski , Conor Dooley , devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS) Subject: [PATCH v3 19/20] dt: bindings: fsl,vf610-pit: Add compatible for s32g2 and s32g3 Date: Mon, 4 Aug 2025 17:23:37 +0200 Message-ID: <20250804152344.1109310-20-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The Vybrid Family is a NXP (formerly Freescale) platform having a Programmable Interrupt Timer (PIT). This timer is an IP found also on the NXP Automotive platform S32G2 and S32G3. Add the compatible for those platforms to describe the timer. Signed-off-by: Daniel Lezcano --- .../devicetree/bindings/timer/fsl,vf610-pit.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/timer/fsl,vf610-pit.yaml b/D= ocumentation/devicetree/bindings/timer/fsl,vf610-pit.yaml index bee2c35bd0e2..42e130654d58 100644 --- a/Documentation/devicetree/bindings/timer/fsl,vf610-pit.yaml +++ b/Documentation/devicetree/bindings/timer/fsl,vf610-pit.yaml @@ -15,8 +15,13 @@ description: =20 properties: compatible: - enum: - - fsl,vf610-pit + oneOf: + - enum: + - fsl,vf610-pit + - nxp,s32g2-pit + - items: + - const: nxp,s32g3-pit + - const: nxp,s32g2-pit =20 reg: maxItems: 1 --=20 2.43.0 From nobody Sun Oct 5 12:49:00 2025 Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1891277C9A for ; Mon, 4 Aug 2025 15:24:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321059; cv=none; b=ObW9bzct5I97/KlyJO6YHZCnCf38qeBCLI+K9dRv3i9i6QppDl9gjrtwSlZTGNeBKIf3nMWH3CLX/X+gyNVjil3sDKsSjJSRhVplp7w3oRa9xpXcu7Y4EG114J6ODUjajVcrfUDkA7KYZ4nokg3zso2qAxsL8sY2Q1Ac2CAiqJc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754321059; c=relaxed/simple; bh=SxSdDuOd/saSwqxbdaTkThxkcFHiMlCdeoHVKc1v12g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Lsnck81ZbUyT4c5Hiy/JASSa4Z0/IaWYmPrEN5gsz/Q5tWK61KfMsrK2zkQTXITddGcoDC5j61p1niQklJA8cvvXNgMwZSSHL+iH4zJTH+c4uUgfh/3Mfk3Uu6+XaLfw4g/JginLESr2dXKTCxgX23J9oqSWXpebOJ3XHSNzi38= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R4qPIAul; arc=none smtp.client-ip=209.85.221.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R4qPIAul" Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-3b78294a233so3600646f8f.3 for ; Mon, 04 Aug 2025 08:24:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1754321054; x=1754925854; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9Tni21YLH9b+7e/VOhKpLNMRnejjKTgmzrSKVqGkVtM=; b=R4qPIAulVLhI6t4kwhCaX1oRmaNH2iSl5Jzg/NYX+6lKER++82a9gHDEqzZP7cZDkb VcYKBGRi1DeJxeCckcQ49nF/mHKjcmhEg6ZfPqvhgH56NbGEbBs95aarQKiwfz156gv7 au+ENo9qLckUmInWV+aPHIuywGwNjiwFiYAszBzL7yPvhajS9ulEOCRtBUn92A9ILM7W 76I0SMm3RsVJLRwQmFjJxo2+o03m/c+SSns5A+huvOK9Hn6tar+coOtLYnBK2k39j8yl UTBuLWU1SSyGtZCRyVyGlMJw3fHM8y4wRFSGrZXRM8HYjBpM/7bJ5nQAoG9G+CMM18cw cRzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1754321054; x=1754925854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Tni21YLH9b+7e/VOhKpLNMRnejjKTgmzrSKVqGkVtM=; b=Gm7cqVamaAsbVodiDAChSXUR2ZfhK629veul7/DKMpAt9M6xedRsl3QwnmvznRmSjo swYIV4pAFkupqmbfhgiwI5Ci1j0rFWgTskE5z14++cTBgGWzXjRiAh9rwMFtSdcULZdq 8zFGhF9kbFOTE+YVA9HVGC1J4x2NKofcVVs3jihQFk74/yr3Mf0pdrKoTm4bJj95JWgg Y2n7HOsliKG4bW0S7Vl9a3baguexprjYcaDbP6mZmuM+nsmiUzCrGHUdeWmy/rN+YY8Z K+akAGwkhxVs9Ah24ExTdDFvZCZcy6NkJ1cdXyxZgSK3hpoZ4tT7/AORxiHuoizY08Dm bulQ== X-Forwarded-Encrypted: i=1; AJvYcCU1PXf6MaRafKfdKDhTXdIzDUj24e1XRyrjymdQ8PsK41M5u8a9gyvxdWuJ+SN+cvpNpafCaqhmHyX+DX0=@vger.kernel.org X-Gm-Message-State: AOJu0Yyx3b8eD6yUFMGQAjjv87BQwjC3I4wWjkGLNPvnZZ60mQVaR+I+ jK5f0UpJPUIlddkAT/O83iwePcte8lT14K9NdAfIA9D2boedmeNuRL08cfaO+iRzZB8= X-Gm-Gg: ASbGncupMORu1nyacw3CAeZMnnQ9bTtB2FSUb3fLyzKE0IPBqFJ+xau0qrIjqGCrCRG fgggPrQOO03mzpHfARyESZadYqkAoGdULbc/+YAjCHpO6FJ8y9C60QZzeKLv7N9Uc036LxrUjqO r8LqzKvwUIfXTRAMiredAGLNG3r7vFIPHPMn2c5YHG65v/MTGhu9Bp6fJqXh6xCa1jfvftPxMOG F3ldjfHBrVnTVSyNMxveA7W5Wvl7SvBfeOQfg7RVq6M6Bftq+5edvmdTmNMfS/AGd6QLN54PnrB rE9leH/YTWrnYhw2PI32Od1C/+2eEUkGKpA4mcYIrrM/8Anq8SGqIrUO50zdIeJ37px6VCTb6FK 6P72WmD/dNrvS4V2vajJl5Apf4S3XIHmCJlZVRd21cjcMBSwH X-Google-Smtp-Source: AGHT+IGdQDf3AGGIIQma73kvQFrp2lXLoGChUyWc5yEILcqzb6RWnGKTCRdlJagG2NMmvWU7piCXAQ== X-Received: by 2002:a05:6000:420d:b0:3b7:8af8:b91d with SMTP id ffacd0b85a97d-3b8d94bb49amr7783554f8f.35.1754321054032; Mon, 04 Aug 2025 08:24:14 -0700 (PDT) Received: from mai.. (146725694.box.freepro.com. [130.180.211.218]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b79c4530b3sm16335579f8f.34.2025.08.04.08.24.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Aug 2025 08:24:13 -0700 (PDT) From: Daniel Lezcano To: daniel.lezcano@linaro.org, tglx@linutronix.de Cc: S32@nxp.com, linux-kernel@vger.kernel.org, ghennadi.procopciuc@oss.nxp.com Subject: [PATCH v3 20/20] clocksource/drivers/nxp-pit: Add NXP Automotive s32g2 / s32g3 support Date: Mon, 4 Aug 2025 17:23:38 +0200 Message-ID: <20250804152344.1109310-21-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250804152344.1109310-1-daniel.lezcano@linaro.org> References: <20250804152344.1109310-1-daniel.lezcano@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The previous changes put in place the encapsulation of the code in order to allow multiple instances of the driver. The S32G platform has two Periodic Interrupt Timer (PIT). The IP is exactly the same as the VF platform. Each PIT has four channels which are 32 bits wide and counting down. The two first channels can be chained to implement a 64 bits counter. The channel usage is kept unchanged with the original driver, channel 2 is used as a clocksource, channel 3 is used as a clockevent. Other channels are unused. In order to support the S32G platform which has two PIT, we initialize the timer and bind it to a CPU. The S32G platforms can have 2, 4 or 8 CPUs and this kind of configuration can appear unusual as we may endup with two PIT used as a clockevent for the two first CPUs while the other CPUs use the architected timers. However, in the context of the automotive, the platform can be partioned to assign 2 CPUs for Linux and the others CPUs to third party OS. The PIT is then used with their specifities like the ability to freeze the time which is needed for instance for debugging purpose. The setup found for this platform is each timer instance is bound to CPU0 and CPU1. A counter is incremented when a timer is successfully initialized and assigned to a CPU. This counter is used as an index for the CPU number and to detect when we reach the maximum possible instances for the platform. That in turn triggers the CPU hotplug callbacks to achieve the per CPU setup. It is the exact same mechanism found in the NXP STM driver. If the timers must be bound to different CPUs, it would require an additionnal mechanism which is not part of these changes. Tested on a s32g274a-rdb2. Signed-off-by: Daniel Lezcano --- drivers/clocksource/timer-nxp-pit.c | 128 +++++++++++++++++++++++----- 1 file changed, 109 insertions(+), 19 deletions(-) diff --git a/drivers/clocksource/timer-nxp-pit.c b/drivers/clocksource/time= r-nxp-pit.c index 2a0ee4109ead..2d0a3554b6bf 100644 --- a/drivers/clocksource/timer-nxp-pit.c +++ b/drivers/clocksource/timer-nxp-pit.c @@ -1,14 +1,16 @@ // SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright 2012-2013 Freescale Semiconductor, Inc. + * Copyright 2018,2021-2025 NXP */ - #include #include +#include #include #include #include #include +#include =20 /* * Each pit takes 0x10 Bytes register space @@ -37,11 +39,23 @@ struct pit_timer { void __iomem *clksrc_base; void __iomem *clkevt_base; - unsigned long cycle_per_jiffy; struct clock_event_device ced; struct clocksource cs; + int rate; +}; + +struct pit_timer_data { + int max_pit_instances; }; =20 +static DEFINE_PER_CPU(struct pit_timer *, pit_timers); + +/* + * Global structure for multiple PITs initialization + */ +static int pit_instances; +static int max_pit_instances =3D 1; + static void __iomem *sched_clock_base; =20 static inline struct pit_timer *ced_to_pit(struct clock_event_device *ced) @@ -98,8 +112,8 @@ static u64 pit_timer_clocksource_read(struct clocksource= *cs) return (u64)~readl(PITCVAL(pit->clksrc_base)); } =20 -static int __init pit_clocksource_init(struct pit_timer *pit, const char *= name, - void __iomem *base, unsigned long rate) +static int pit_clocksource_init(struct pit_timer *pit, const char *name, + void __iomem *base, unsigned long rate) { /* * The channels 0 and 1 can be chained to build a 64-bit @@ -155,7 +169,7 @@ static int pit_set_periodic(struct clock_event_device *= ced) { struct pit_timer *pit =3D ced_to_pit(ced); =20 - pit_set_next_event(pit->cycle_per_jiffy, ced); + pit_set_next_event(pit->rate / HZ, ced); =20 return 0; } @@ -181,24 +195,28 @@ static irqreturn_t pit_timer_interrupt(int irq, void = *dev_id) return IRQ_HANDLED; } =20 -static int __init pit_clockevent_init(struct pit_timer *pit, const char *n= ame, - void __iomem *base, unsigned long rate, - int irq, unsigned int cpu) +static int pit_clockevent_per_cpu_init(struct pit_timer *pit, const char *= name, + void __iomem *base, unsigned long rate, + int irq, unsigned int cpu) { + int ret; + /* * The channels 0 and 1 can be chained to build a 64-bit * timer. Let's use the channel 3 as a clockevent and leave * the channels 0 and 1 unused for anyone else who needs them */ pit->clkevt_base =3D base + PIT_CH(3); - pit->cycle_per_jiffy =3D rate / (HZ); + pit->rate =3D rate; =20 pit_timer_disable(pit->clkevt_base); =20 pit_timer_irqack(pit); =20 - BUG_ON(request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_IRQPOLL, - name, &pit->ced)); + ret =3D request_irq(irq, pit_timer_interrupt, IRQF_TIMER | IRQF_NOBALANCI= NG, + name, &pit->ced); + if (ret) + return ret; =20 pit->ced.cpumask =3D cpumask_of(cpu); pit->ced.irq =3D irq; @@ -210,6 +228,32 @@ static int __init pit_clockevent_init(struct pit_timer= *pit, const char *name, pit->ced.set_next_event =3D pit_set_next_event; pit->ced.rating =3D 300; =20 + per_cpu(pit_timers, cpu) =3D pit; + + return 0; +} + +static void pit_clockevent_per_cpu_exit(struct pit_timer *pit, unsigned in= t cpu) +{ + pit_timer_disable(pit->clkevt_base); + free_irq(pit->ced.irq, &pit->ced); + per_cpu(pit_timers, cpu) =3D NULL; +} + +static int pit_clockevent_starting_cpu(unsigned int cpu) +{ + struct pit_timer *pit =3D per_cpu(pit_timers, cpu); + int ret; + + if (!pit) + return 0; + + ret =3D irq_force_affinity(pit->ced.irq, cpumask_of(cpu)); + if (ret) { + pit_clockevent_per_cpu_exit(pit, cpu); + return ret; + } + /* * The value for the LDVAL register trigger is calculated as: * LDVAL trigger =3D (period / clock period) - 1 @@ -218,12 +262,12 @@ static int __init pit_clockevent_init(struct pit_time= r *pit, const char *name, * LDVAL trigger value is 1. And then the min_delta is * minimal LDVAL trigger value + 1, and the max_delta is full 32-bit. */ - clockevents_config_and_register(&pit->ced, rate, 2, 0xffffffff); + clockevents_config_and_register(&pit->ced, pit->rate, 2, 0xffffffff); =20 return 0; } =20 -static int __init pit_timer_init(struct device_node *np) +static int pit_timer_init(struct device_node *np) { struct pit_timer *pit; struct clk *pit_clk; @@ -253,7 +297,7 @@ static int __init pit_timer_init(struct device_node *np) pit_clk =3D of_clk_get(np, 0); if (IS_ERR(pit_clk)) { ret =3D PTR_ERR(pit_clk); - goto out_iounmap; + goto out_irq_dispose_mapping; } =20 ret =3D clk_prepare_enable(pit_clk); @@ -262,16 +306,31 @@ static int __init pit_timer_init(struct device_node *= np) =20 clk_rate =3D clk_get_rate(pit_clk); =20 - /* enable the pit module */ - pit_module_enable(timer_base); + pit_module_disable(timer_base); =20 ret =3D pit_clocksource_init(pit, name, timer_base, clk_rate); - if (ret) + if (ret) { + pr_err("Failed to initialize clocksource '%pOF'\n", np); goto out_pit_module_disable; + } =20 - ret =3D pit_clockevent_init(pit, name, timer_base, clk_rate, irq, 0); - if (ret) + ret =3D pit_clockevent_per_cpu_init(pit, name, timer_base, clk_rate, irq,= pit_instances); + if (ret) { + pr_err("Failed to initialize clockevent '%pOF'\n", np); goto out_pit_clocksource_unregister; + } + + /* enable the pit module */ + pit_module_enable(timer_base); + + pit_instances++; + + if (pit_instances =3D=3D max_pit_instances) { + ret =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "PIT timer:starting", + pit_clockevent_starting_cpu, NULL); + if (ret < 0) + goto out_pit_clocksource_unregister; + } =20 return 0; =20 @@ -282,6 +341,8 @@ static int __init pit_timer_init(struct device_node *np) clk_disable_unprepare(pit_clk); out_clk_put: clk_put(pit_clk); +out_irq_dispose_mapping: + irq_dispose_mapping(irq); out_iounmap: iounmap(timer_base); out_kfree: @@ -289,4 +350,33 @@ static int __init pit_timer_init(struct device_node *n= p) =20 return ret; } + +static int pit_timer_probe(struct platform_device *pdev) +{ + const struct pit_timer_data *pit_timer_data; + + pit_timer_data =3D of_device_get_match_data(&pdev->dev); + if (pit_timer_data) + max_pit_instances =3D pit_timer_data->max_pit_instances; + + return pit_timer_init(pdev->dev.of_node); +} + +static struct pit_timer_data s32g2_data =3D { .max_pit_instances =3D 2 }; + +static const struct of_device_id pit_timer_of_match[] =3D { + { .compatible =3D "nxp,s32g2-pit", .data =3D &s32g2_data }, + { } +}; +MODULE_DEVICE_TABLE(of, pit_timer_of_match); + +static struct platform_driver nxp_pit_driver =3D { + .driver =3D { + .name =3D "nxp-pit", + .of_match_table =3D pit_timer_of_match, + }, + .probe =3D pit_timer_probe, +}; +module_platform_driver(nxp_pit_driver); + TIMER_OF_DECLARE(vf610, "fsl,vf610-pit", pit_timer_init); --=20 2.43.0