From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.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 6CC032C21D4 for ; Wed, 17 Dec 2025 07:50:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765957819; cv=none; b=j/8r86Apc4gCSHBsIzmDODyLy8YhUUmaiUtLhoCwiB0MXVLZX/6d5+E1bejrWsUSyH864SYbzM0zRYzYTURBTqMhNqQkWDI3KUH7yyd7I5dCICBaKAmCgyaPnhF7c864hbAHef91dU/UN+DT7o+Ql4JP0pSfVEC+ZsUN6UCjGUE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765957819; c=relaxed/simple; bh=PUnnLOIItZtBkY06/aK3pdb7UGncSaLJK2ok4t8hj30=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iZMSc/js0J10ktgGmmXp1C42r6qgznlqnXAPE8xP+yhae6oz9gr5r9Igi3Q6WQuRIgHvxQm7G4KeJGcIAMUKePsxko9Gdp/96cCySQmYaPnn/ykGHW8Bt55uk4bo2nY3fe+FbUTpxvP1cekhvfu0mrgm3mI1vAyIpSF2GaHsQso= 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=vxAVFgQM; arc=none smtp.client-ip=209.85.128.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="vxAVFgQM" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-477a1c28778so59363035e9.3 for ; Tue, 16 Dec 2025 23:50:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1765957815; x=1766562615; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=5+O9e6W3Bxj05hKh2u9o2UOrQ5o4C+FvFWwacOPc+l0=; b=vxAVFgQM/GPBsijcA9RKtMYI7pBSD9D8RXWMAXFFwpN2D7e7uHXmU0DZ7/2axdjY4t EGmhik3+u6Ol9oybjoe8ABMSVR6i+y/lH3VNrjP+1qSZZgoAOlbaqe8zhgA6AWukG6ov bn8mWYgqPf+p77jQjqG8DIfnBE6Hi7CKwNfmjcAO6f1fLIkpLrNRZ4luX3EnOCv/+P8w YH81zNity/mcH2Y4fz8IwpBg4GA+7+/lzg1pFaHhEhTIeabb3dojt1sxsfmw/acbu3ba qTMyjoyoI617wGmBXg722aTtbSdJzmoYrJA1suISWeUkY/Ah8+7lI3ETSzKMHXBM7bZC RBdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765957815; x=1766562615; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5+O9e6W3Bxj05hKh2u9o2UOrQ5o4C+FvFWwacOPc+l0=; b=qUl0OO0+gJEMI6JW/7IZchGqviIXp7qVQRJM+9rgRxrwT26sq3gEpxWw5GjQxAQ9Hw fT+DY3VXwYB0VA5Scl3PVyZ6qGQduF6gXRbXSKcF6zIzKDlbpizCvBdLGQIZoGi6Lhy5 NZOXRs5aDNavgWIDjiwumBucZDyw4hkZpdS1VLi3W3o3iVpvq82yBW7qzV1t0SuYCZSr QKlhxb2rKBtXQE4O+VuFHdbqpJulFK5fi+bJ4CGMfPiVPERGg9eUYZY32wqXVnyoQ0Db 33KwZ43d7x9xR9Hhfylgl8BXAXj2wZOoqtxXfiN8tFPi44zAMnyajKcY/mgeHOwAGnmY xNZw== X-Forwarded-Encrypted: i=1; AJvYcCW61fCkU5QisgsQMKjTm5it0TEJfZr674HN6fdX+s62xgEhk8zcELcaXqXCe5rdkSxIBAII4TUl4S091Yo=@vger.kernel.org X-Gm-Message-State: AOJu0YzrHh+pz+zt7GwqkApvtJgp0PC1yG+07GqlVtcvtpxHfE0JY4Lr Nf3vKA8+kDpnbdgjpDFzY3iTgvey/zGn277106lWoHZ788SI59T3PnZKOSI6T65DY6s= X-Gm-Gg: AY/fxX7Po6/xlIMy1OnYQGkGYwiuIj6fhF4Pl7n6Tk+w5pbe21DputMApC+8uRXpyOx 7+0OecswyWFYZogTlvpWwakGqkE12r/5jKgc2QosWid0BfxNJqRQHEiDe+t6o37sWH7SJYCtqoj TACVLpANPzoZFwvsUs0y0sXMoUwak0S5vCDAiJtkrPtUNuRH1p3gS+7xx1h4wGMe/ha26e4zLCB 8Cunm1KnhMfTJBfPUhUh2pmBau6fSGhFEaDGNfVXOfLaULlINfjkfJeeyAL29O7M1KYhUq9Mb6i upjr1qZDPSfrX7qJwLsJyldiGWsS0CrP6vmvL+Wz0fozVw2EyT8AzlsvudY1COEw8+8QArpBf1t joO3VAEMnHpki8JOKpCudSL0C3PhDmdSbMbw0UqtJLdpvPd4dic136P1lCSTX+sgIWU6RKl78Bj h8gixvtnirl6iCpDy3cMBhne59TiIwSHs= X-Google-Smtp-Source: AGHT+IGRqDAO52fk8qcGmvcKhV3t5iObtMWHgo4/Y2HmbK1D8Q3NfF3+JenD756iAy8zS3sn7M9bFw== X-Received: by 2002:a05:600c:8b16:b0:477:7975:30ea with SMTP id 5b1f17b1804b1-47a8f90e81fmr180826235e9.29.1765957814792; Tue, 16 Dec 2025 23:50:14 -0800 (PST) Received: from mai.box.freepro.com ([2a05:6e02:1041:c10:37e6:ed62:3c8b:2621]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47bdc1edff5sm26094315e9.14.2025.12.16.23.50.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Dec 2025 23:50:14 -0800 (PST) From: Daniel Lezcano To: wbg@kernel.org, robh@kernel.org, conor+dt@kernel.org, krzk+dt@kernel.org Cc: s32@nxp.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH v3 0/3] Add the System Timer Module counter Date: Wed, 17 Dec 2025 08:49:54 +0100 Message-ID: <20251217075000.2592966-1-daniel.lezcano@linaro.org> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The NXP S32 family provides a System Timer Module (STM), a 32-bit free-running counter clocked from a peripheral clock. The STM includes a prescaler and one or more compare channels generating optional interrupts. When used as a generic hardware counter, only the main free-running counter is required, while the compare channels are typically unused. On S32G2 devices, the STM is exposed as a simple counter block that can operate continuously and be shared across subsystems such as the Linux kernel, firmware components running on Cortex-M7 cores, or other co-processors. The counter can be read atomically and provides a stable timestamp source to correlate events occurring in different execution contexts. The Linux kernel controls the STM through a memory-mapped interface, configuring the prescaler, enabling or disabling the counter, and accounting for wrap-arounds. Other subsystems access the counter in read-only mode, making it a shared timestamp reference across the platform. This driver adds support for the STM when used as a counter on S32G2 platforms. The device is described in the device tree using the following compatible: compatible = "nxp,s32g2-stm-cnt"; The driver exposes basic counter functionality: start, stop, reset, prescaler configuration, and overflow handling. Changelog: * v3 - Fixed compatible typo "nxp,s32g2-stm" to "nxp,s32g2-stm-cnt" * v2 - Added Rob's tag ** kbuild - Reordered alphabetically the headers - Added bitfield.h header - Use DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Daniel Lezcano (3): counters: Reorder the Makefile dt-bindings: counter: Add NXP System Timer Module Counter counter: Add STM based counter .../bindings/counter/nxp,s32g2-stm-cnt.yaml | 64 +++ drivers/counter/Kconfig | 10 + drivers/counter/Makefile | 21 +- drivers/counter/nxp-stm-cnt.c | 386 ++++++++++++++++++ 4 files changed, 472 insertions(+), 9 deletions(-) create mode 100644 Documentation/devicetree/bindings/counter/nxp,s32g2-stm-cnt.yaml create mode 100644 drivers/counter/nxp-stm-cnt.c -- 2.43.0