Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp448920rwe; Wed, 19 Apr 2023 00:55:37 -0700 (PDT) X-Google-Smtp-Source: AKy350adPUpVQtmTkG4prI4aP0neux/AAb8dYPnGhsTydQ778RsoSWkWYf644CiSnnpbIm6/Mig/ X-Received: by 2002:a17:902:ecc8:b0:1a5:2e19:bc40 with SMTP id a8-20020a170902ecc800b001a52e19bc40mr4859499plh.26.1681890937221; Wed, 19 Apr 2023 00:55:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681890937; cv=none; d=google.com; s=arc-20160816; b=XnO9H5h8gnAHjXp7FL+tuxOooUEzg0+dPleo4+6mHs3rgYTWLMkth0kHrKG+mcV3XC S6kWLcSZy2gUKh8U/tAb+ynAzycXSuJXjNEQ0KzLKyAinu8oBw1XDizEjPvruLUjT/5Z g3mf8YG1Vcg9Il7n4zGiarmqOm/TvI0w9Sg15ZHucPHU/QX0JWNym0frtCrCPoCYCCNf wqdfQZ+3Fb6z1IGmId/l2QKK9pBt9EPfv4xDzlYqJW8uyBpUyndk04RajhvvU388BtgN pbXfLuFXvEU07hY46gywXjlAZnpnCr1iqGg01yUp+iq1JNdQIOVrJoWHVgcF58a9gWk8 WNUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=IHhBOfUYeT77YquBREt22vcfy911MiykLSdiMpD9Yo0=; b=N11bWPgrUvUyTuEiMODJ38AwJraL+Cnj6b5S5YV42kn8PkLpqJDKtC/xCGIQATTfjF oAcqi5uTDtCVHue/I0mPXPeF0o2XMnrpXPK14yBStp2Z5bNSyZF6hZb1cuCcG4lilgi8 hLRoeDCPEuogxo+Nu6jl2OsI+3SDjfe7+7IdB8Q+qmtV3R3VVPtKYMnjkOLU1I2dnlKU pV34e6D4kTlHj7cYkwLvnZEDPsTp2DKoPU2cIfJIHd/HuhDcAxq1On1wHWcxQIdEl08Y PCxx4nse1IxQOmOJx3suGupCuQcJMGPO0yBoQjxoACjxYZRsRUyETsdTF2wVeRo0KBey rKkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rFcmb5xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw18-20020a170903045200b0019f269f06fbsi15275109plb.3.2023.04.19.00.55.25; Wed, 19 Apr 2023 00:55:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=rFcmb5xM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232527AbjDSHuH (ORCPT + 99 others); Wed, 19 Apr 2023 03:50:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232526AbjDSHt4 (ORCPT ); Wed, 19 Apr 2023 03:49:56 -0400 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31FE67AB9 for ; Wed, 19 Apr 2023 00:49:54 -0700 (PDT) X-UUID: c34bfc68de8611eda9a90f0bb45854f4-20230419 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=IHhBOfUYeT77YquBREt22vcfy911MiykLSdiMpD9Yo0=; b=rFcmb5xMxej7NRtBhk/SzLJTLmt+c2Cxowdk2S98KjpUHk/hl3u3dgms1J8fArLLXPBArfSgMsIVTmKL8Z/T6KtjEdQ3T2dnc1q2RUzc74U9qW+wGBlDGYxDqGE4PJJ87Q2u3ENhbzzqcwikCgY1EjGD2zsBserZ7wyITvAqafk=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.22,REQID:b47f5395-83c6-4a88-954c-d51b21018799,IP:0,U RL:0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTI ON:release,TS:70 X-CID-INFO: VERSION:1.1.22,REQID:b47f5395-83c6-4a88-954c-d51b21018799,IP:0,URL :0,TC:0,Content:-25,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTI ON:quarantine,TS:70 X-CID-META: VersionHash:120426c,CLOUDID:b0429084-cd9c-45f5-8134-710979e3df0e,B ulkID:23041915495126IH8NNF,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: c34bfc68de8611eda9a90f0bb45854f4-20230419 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 668331487; Wed, 19 Apr 2023 15:49:50 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n1.mediatek.inc (172.21.101.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Wed, 19 Apr 2023 15:49:48 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.25 via Frontend Transport; Wed, 19 Apr 2023 15:49:48 +0800 From: To: Daniel Lezcano , Thomas Gleixner , Matthias Brugger , AngeloGioacchino Del Regno , "Maciej W . Rozycki" , John Stultz CC: , , , , , Chun-Hung Wu , , , Subject: [PATCH linux-next v3 4/4] clocksource/drivers/timer-mediatek: Make timer-mediatek become loadable module Date: Wed, 19 Apr 2023 15:49:08 +0800 Message-ID: <20230419074910.10809-5-walter.chang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20230419074910.10809-1-walter.chang@mediatek.com> References: <20230419074910.10809-1-walter.chang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chun-Hung Wu Make the timer-mediatek driver which can register an always-on timer as tick_broadcast_device on MediaTek SoCs become loadable module in GKI. Tested-by: Walter Chang Signed-off-by: Chun-Hung Wu --- drivers/clocksource/Kconfig | 2 +- drivers/clocksource/timer-mediatek.c | 39 ++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 526382dc7482..a7413ad7b6ad 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -472,7 +472,7 @@ config SYS_SUPPORTS_SH_CMT bool config MTK_TIMER - bool "Mediatek timer driver" if COMPILE_TEST + tristate "Mediatek timer driver" depends on HAS_IOMEM select TIMER_OF select CLKSRC_MMIO diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c index 7bcb4a3f26fb..3448848682c0 100644 --- a/drivers/clocksource/timer-mediatek.c +++ b/drivers/clocksource/timer-mediatek.c @@ -13,6 +13,9 @@ #include #include #include +#include +#include +#include #include #include #include "timer-of.h" @@ -337,5 +340,41 @@ static int __init mtk_gpt_init(struct device_node *node) return 0; } + +#ifdef MODULE +static int mtk_timer_probe(struct platform_device *pdev) +{ + int (*timer_init)(struct device_node *node); + struct device_node *np = pdev->dev.of_node; + + timer_init = of_device_get_match_data(&pdev->dev); + return timer_init(np); +} + +static const struct of_device_id mtk_timer_match_table[] = { + { + .compatible = "mediatek,mt6577-timer", + .data = mtk_gpt_init, + }, + { + .compatible = "mediatek,mt6765-timer", + .data = mtk_syst_init, + }, + {} +}; + +static struct platform_driver mtk_timer_driver = { + .probe = mtk_timer_probe, + .driver = { + .name = "mtk-timer", + .of_match_table = mtk_timer_match_table, + }, +}; +module_platform_driver(mtk_timer_driver); + +MODULE_DESCRIPTION("MediaTek Module Timer driver"); +MODULE_LICENSE("GPL v2"); +#else TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init); TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init); +#endif -- 2.18.0