From patchwork Wed Nov 10 08:31:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 12692146 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0563C433F5 for ; Wed, 10 Nov 2021 08:33:33 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6F33361076 for ; Wed, 10 Nov 2021 08:33:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 6F33361076 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wAZ5az9i7afiJwfE7ImzckrurgZsPTumW9ZfSfknO/I=; b=R5KqMJ3jfwp4Ch JYRRaJSTj+KRo+i7bAse37ZHaCSH9GfBfayQaePzuvi4EFhrZTuEJtmtzSgIzPvjGOZXEBI9mcGwY gj2LvX+hpSH5QYDYvHZZLPEkvVNEcgcivUEpnPY3B4broTy7+Wfg6V7oAj/7LAit/5N9TmrDzbJGl gF6K+hV+FxpjckGnHi8GoCJvOCgsiHMfc/qlbhqtcryp0ta/I7L8yb/sS1MANL1FAfb8EdcRPt9ql ldsdHBKZHJRsfhd4DYfjqIIwj6H2cWNEVCZyS64QbctEoDQjBNClu/EDsbYUxuR+uCao+9Jc3ySEv rCuiRt8QxDTyiaAerT9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkj1w-004oHy-1V; Wed, 10 Nov 2021 08:32:28 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkj1a-004oDM-2V for linux-arm-kernel@lists.infradead.org; Wed, 10 Nov 2021 08:32:07 +0000 X-IronPort-AV: E=Sophos;i="5.87,223,1631545200"; d="scan'208";a="99778047" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 10 Nov 2021 17:32:05 +0900 Received: from localhost.localdomain (unknown [10.226.92.40]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 52DB6400C4E7; Wed, 10 Nov 2021 17:32:02 +0900 (JST) From: Biju Das To: Maxime Coquelin , Alexandre Torgue , Philipp Zabel Cc: Biju Das , Daniel Lezcano , Thomas Gleixner , Chris Brandt , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Geert Uytterhoeven , Chris Paterson , Biju Das , Prabhakar Mahadev Lad , linux-renesas-soc@vger.kernel.org Subject: [PATCH 2/2] clocksource/drivers/renesas-ostm: Add RZ/G2L OSTM support Date: Wed, 10 Nov 2021 08:31:52 +0000 Message-Id: <20211110083152.31144-3-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211110083152.31144-1-biju.das.jz@bp.renesas.com> References: <20211110083152.31144-1-biju.das.jz@bp.renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211110_003206_264651_0CEAF909 X-CRM114-Status: GOOD ( 13.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org RZ/G2L SoC has Generic Timer Module(a.k.a OSTM) which needs to deassert the reset line before accessing any registers. This patch adds an entry point for RZ/G2L so that we can deassert the reset line in probe callback. Signed-off-by: Biju Das Reviewed-by: Lad Prabhakar Reviewed-by: Philipp Zabel --- drivers/clocksource/renesas-ostm.c | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/drivers/clocksource/renesas-ostm.c b/drivers/clocksource/renesas-ostm.c index 3d06ba66008c..6b28c45c86f7 100644 --- a/drivers/clocksource/renesas-ostm.c +++ b/drivers/clocksource/renesas-ostm.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include @@ -209,3 +211,39 @@ static int __init ostm_init(struct device_node *np) } TIMER_OF_DECLARE(ostm, "renesas,ostm", ostm_init); + +#ifdef CONFIG_ARCH_R9A07G044 +static int __init ostm_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct reset_control *rstc; + int ret; + + rstc = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), "failed to get reset"); + + reset_control_deassert(rstc); + + ret = ostm_init(dev->of_node); + if (ret) { + reset_control_assert(rstc); + return ret; + } + + return 0; +} + +static const struct of_device_id ostm_of_table[] = { + { .compatible = "renesas,rzg2l-ostm", }, + { } +}; + +static struct platform_driver ostm_device_driver = { + .driver = { + .name = "rzg2l_ostm", + .of_match_table = of_match_ptr(ostm_of_table), + }, +}; +builtin_platform_driver_probe(ostm_device_driver, ostm_probe); +#endif