From nobody Sun Feb 8 07:08:26 2026 Received: from mail-pj1-f74.google.com (mail-pj1-f74.google.com [209.85.216.74]) (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 83A732D0298 for ; Thu, 23 Oct 2025 20:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761252664; cv=none; b=a9ts4J4EmLBehggVn2+ySg5XwhTLHvpd+e/bA7oRxTKEDTYAwMHpGIwPwLeEW9MHwgT0hxpq2sdIfWz5Q7ZrzmpgYVwYpC8vfPYgU7E4wd4tCMjF0SGJS7EF/rJ2RQ2FiF/+2Azk2xhb2nrBvFBgVlf9E32a4P1Pyh/ynz/72ks= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761252664; c=relaxed/simple; bh=CESpfuQKSTARvsi02223z0qLzhBNqlIQPJ9hcvIXEto=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=UUQNkfUYTNVq6CzgzGuzWvCDIhsiloHcObDy4Cpa9LcO/II+63ZNwjomKYtTDXApVxj3vcuBib18Cmbzk0V+NoUiJRH7QwrZCLvRLh1h53n1Hp4WNgcBQrM3g+v6xU+1+u8qn2+hM6JwxpP6C72Vr7v8HsUflvIc8XG0I7VIriM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--willmcvicker.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=iCfyKqwg; arc=none smtp.client-ip=209.85.216.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--willmcvicker.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="iCfyKqwg" Received: by mail-pj1-f74.google.com with SMTP id 98e67ed59e1d1-33428befbbaso1469049a91.0 for ; Thu, 23 Oct 2025 13:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1761252661; x=1761857461; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=t8LUdY9Gbr3c9MBtkrMrb9ELOUUlz3DwF1vW+da8Cus=; b=iCfyKqwghetGnOVwe7cBH63Hi/oXTxTk56X3X4HIV9cJ8JN7tGwppDNdGoGmCUDOro e9SZ295apS49mWIqy1E2g6tIVvYqmpr7ZUuNDFaKwj+Ej4z91eJD9wEst1+FdUVVOyQw EZ/sZz30avVCQGWvSA081AxNZDlmAAJJLbfwzIIF6GmDtwyJq7EgQ+TsNQhWHnT3Mm2I ZPOY6X8njyFQNcpGpiczXs2T+o9MRsncUbywgyncvo/eIgHXiq9+DQWt2eo4gcqcGUOd Zg9t1QA13SynhHE1dXcy8DC6Acxo4SP1vBWkHtkRWLi9hgz9RQmzcDhp0LYzDCwHJSEp eTuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1761252661; x=1761857461; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=t8LUdY9Gbr3c9MBtkrMrb9ELOUUlz3DwF1vW+da8Cus=; b=bIRe/xvPlVoxDHEdx8M/DDfep81T6D1lsgEbTMR8HFv/kA9g0Ev6+q952/aOlaMxVg g+1BsUux1Hm3xRIRUyAcGwx3g96yaVOeeJC1RFDPhHbpDExA86pc4xapjMgAHjiZDQ5d ssfpoGe8largJNwhAxluXOjGodIyqMdt+YOpOB66fM4taQSqNljVLMNKx8ueYDQjDcBx ifH5Ukl7HJmDXta195n9mMyb/wagTObgKPRPI14nyt7MHADB/iqj9znqxPL0MbWXg2HF WUCYnG1/oNTjJ97JMPZJ2ri4Z2ri/Si0wuxBFnjlFrLo6XEaR9wrUkBc3iEnDnh7kHvz KHBQ== X-Forwarded-Encrypted: i=1; AJvYcCV38cFshNsyEpdtg8evSCvbNklcyi8LV3h037D3AmPfhY09N3Kf5ylF3/2frTmX9pb1f58+YXYyQawDoZk=@vger.kernel.org X-Gm-Message-State: AOJu0YzTSofmte1GilSyOGprjGZI0EkYOMDMSL4R+qdIYU4PwREX3i8K X+vdjwFfMuy8eR2tl8jtL6EoMAMajWCtLCYYAculZnq178vZcyw//ybUexbg7Gt6x36Hvvd3l5N PoY21Z7WBY0EPK/BjpnaAhJ1ixq3lbg== X-Google-Smtp-Source: AGHT+IGZwCLIN0qBdss7bwnQG0xdzE5CJ3qy6ePDJaDdI1o3uYJcy1pIi0nEoqY8x0tKoW4cyHmd0aXb3yasAgkkA78= X-Received: from pjnj13.prod.google.com ([2002:a17:90a:840d:b0:329:7261:93b6]) (user=willmcvicker job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:28c4:b0:330:852e:2bcc with SMTP id 98e67ed59e1d1-33bcf8e6348mr33498556a91.21.1761252660734; Thu, 23 Oct 2025 13:51:00 -0700 (PDT) Date: Thu, 23 Oct 2025 20:50:32 +0000 In-Reply-To: <20251023205041.2027336-1-willmcvicker@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20251023205041.2027336-1-willmcvicker@google.com> X-Mailer: git-send-email 2.51.1.821.gb6fe4d2222-goog Message-ID: <20251023205041.2027336-7-willmcvicker@google.com> Subject: [PATCH 6/7] clocksource/drivers/exynos_mct: Add module support From: Will McVicker To: Russell King , Catalin Marinas , Will Deacon , Daniel Lezcano , Thomas Gleixner , Krzysztof Kozlowski , Alim Akhtar , Peter Griffin , Ingo Molnar , Youngmin Nam , Will McVicker , Hosung Kim Cc: Donghoon Yu , Rob Herring , Saravana Kannan , John Stultz , Tudor Ambarus , "=?UTF-8?q?Andr=C3=A9=20Draszik?=" , Conor Dooley , Marek Szyprowski , linux-samsung-soc@vger.kernel.org, kernel-team@android.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Donghoon Yu On Arm64 platforms the Exynos MCT driver can be built as a module. On boot (and even after boot) the arch_timer is used as the clocksource and tick timer. Once the MCT driver is loaded, it can be used as the wakeup source for the arch_timer. Signed-off-by: Donghoon Yu Signed-off-by: Youngmin Nam Signed-off-by: Will McVicker Signed-off-by: Daniel Lezcano [original commit from https://android.googlesource.com/kernel/gs/+/8a52a828= 8ec7d88ff78f0b37480dbb0e9c65bbfd] Reviewed-by: Youngmin Nam # AOSP -> Linux port Tested-by: Youngmin Nam # AOSP -> Linux port --- drivers/clocksource/Kconfig | 3 +- drivers/clocksource/exynos_mct.c | 56 +++++++++++++++++++++++++++----- 2 files changed, 49 insertions(+), 10 deletions(-) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index ffcd23668763..9450cfaf982f 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -451,7 +451,8 @@ config ATMEL_TCB_CLKSRC Support for Timer Counter Blocks on Atmel SoCs. =20 config CLKSRC_EXYNOS_MCT - bool "Exynos multi core timer driver" if COMPILE_TEST + tristate "Exynos multi core timer driver" if ARM64 + default y if ARCH_EXYNOS || COMPILE_TEST depends on ARM || ARM64 depends on ARCH_ARTPEC || ARCH_EXYNOS || COMPILE_TEST help diff --git a/drivers/clocksource/exynos_mct.c b/drivers/clocksource/exynos_= mct.c index fece6bbc190e..a87caf3928ef 100644 --- a/drivers/clocksource/exynos_mct.c +++ b/drivers/clocksource/exynos_mct.c @@ -15,9 +15,11 @@ #include #include #include +#include #include #include #include +#include #include #include =20 @@ -217,6 +219,7 @@ static struct clocksource mct_frc =3D { .mask =3D CLOCKSOURCE_MASK(32), .flags =3D CLOCK_SOURCE_IS_CONTINUOUS, .resume =3D exynos4_frc_resume, + .owner =3D THIS_MODULE, }; =20 /* @@ -241,7 +244,7 @@ static cycles_t exynos4_read_current_timer(void) } #endif =20 -static int __init exynos4_clocksource_init(bool frc_shared) +static int exynos4_clocksource_init(bool frc_shared) { /* * When the frc is shared, the main processor should have already @@ -336,6 +339,7 @@ static struct clock_event_device mct_comp_device =3D { .set_state_oneshot =3D mct_set_state_shutdown, .set_state_oneshot_stopped =3D mct_set_state_shutdown, .tick_resume =3D mct_set_state_shutdown, + .owner =3D THIS_MODULE, }; =20 static irqreturn_t exynos4_mct_comp_isr(int irq, void *dev_id) @@ -476,6 +480,7 @@ static int exynos4_mct_starting_cpu(unsigned int cpu) evt->features =3D CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERCPU; evt->rating =3D MCT_CLKEVENTS_RATING; + evt->owner =3D THIS_MODULE; =20 exynos4_mct_write(TICK_BASE_CNT, mevt->base + MCT_L_TCNTB_OFFSET); =20 @@ -511,7 +516,7 @@ static int exynos4_mct_dying_cpu(unsigned int cpu) return 0; } =20 -static int __init exynos4_timer_resources(struct device_node *np) +static int exynos4_timer_resources(struct device_node *np) { struct clk *mct_clk, *tick_clk; =20 @@ -539,7 +544,7 @@ static int __init exynos4_timer_resources(struct device= _node *np) * @local_idx: array mapping CPU numbers to local timer indices * @nr_local: size of @local_idx array */ -static int __init exynos4_timer_interrupts(struct device_node *np, +static int exynos4_timer_interrupts(struct device_node *np, unsigned int int_type, const u32 *local_idx, size_t nr_local) @@ -653,7 +658,7 @@ static int __init exynos4_timer_interrupts(struct devic= e_node *np, return err; } =20 -static int __init mct_init_dt(struct device_node *np, unsigned int int_typ= e) +static int mct_init_dt(struct device_node *np, unsigned int int_type) { bool frc_shared =3D of_property_read_bool(np, "samsung,frc-shared"); u32 local_idx[MCT_NR_LOCAL] =3D {0}; @@ -701,15 +706,48 @@ static int __init mct_init_dt(struct device_node *np,= unsigned int int_type) return exynos4_clockevent_init(); } =20 - -static int __init mct_init_spi(struct device_node *np) +static int mct_init_spi(struct device_node *np) { return mct_init_dt(np, MCT_INT_SPI); } =20 -static int __init mct_init_ppi(struct device_node *np) +static int mct_init_ppi(struct device_node *np) { return mct_init_dt(np, MCT_INT_PPI); } -TIMER_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", mct_init_spi); -TIMER_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", mct_init_ppi); + +static int exynos4_mct_probe(struct platform_device *pdev) +{ + struct device *dev =3D &pdev->dev; + int (*mct_init)(struct device_node *np); + + mct_init =3D of_device_get_match_data(dev); + if (!mct_init) + return -EINVAL; + + return mct_init(dev->of_node); +} + +static const struct of_device_id exynos4_mct_match_table[] =3D { + { .compatible =3D "samsung,exynos4210-mct", .data =3D &mct_init_spi, }, + { .compatible =3D "samsung,exynos4412-mct", .data =3D &mct_init_ppi, }, + {} +}; +MODULE_DEVICE_TABLE(of, exynos4_mct_match_table); + +static struct platform_driver exynos4_mct_driver =3D { + .probe =3D exynos4_mct_probe, + .driver =3D { + .name =3D "exynos-mct", + .of_match_table =3D exynos4_mct_match_table, + }, +}; + +static __init int exynos_mct_init(void) +{ + return platform_driver_register(&exynos4_mct_driver); +} +module_init(exynos_mct_init); + +MODULE_DESCRIPTION("Exynos Multi Core Timer Driver"); +MODULE_LICENSE("GPL"); --=20 2.51.1.821.gb6fe4d2222-goog