From patchwork Mon Jun 24 13:13:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE90E13B4 for ; Mon, 24 Jun 2019 13:15:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9ED0C28683 for ; Mon, 24 Jun 2019 13:15:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9311328BDA; Mon, 24 Jun 2019 13:15:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5D0BA28BC1 for ; Mon, 24 Jun 2019 13:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7gUnBdjznnfmoheBh/8XI0+xB94kE/itSz7AwYrpso8=; b=We7zutHwM9zlEE GL+zYvWdP6/zqLN0m4gHLOi/eEQC7F+8OgBsFgFMA9UCg+gbneOK9XCdlbwNjsjma+0iO8cwkYTt6 FpUpIpjWdUEOgRg8e11bouDK7glaxAlxPL8RKJw0EHxtWfO+lbbS2UDKhreihr8F6nr7scrHNVRC9 soSPaR7ph6nAfOt4bOmGGpPEl17LLY43Lt+SmaJtl+oAnn8fRvChHWiitTKsQrr6LHpMt7gIg4cOp 5oVP7f6bJrSWDOucGk9BHdtHezwhMt3z/+Pxv3i7RxGkQtTFe3KX2Ue5e/7EJHbpjygnUNUGWleRL iI451sb0b9LqT38HXAjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOob-0000tG-PF; Mon, 24 Jun 2019 13:15:22 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnM-00081i-7v for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:06 +0000 Received: by mail-wm1-x342.google.com with SMTP id h19so14249434wme.0 for ; Mon, 24 Jun 2019 06:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hgoJkj0j+DeXgOTwWsaQ9czRgkH7ct8k79BzMkAo21I=; b=ahro5UIyPK+V1/+XQ2wF7f8dq6Vslp14qbgOTRuMo9dats4tus9ss1qzOMDpHq7YZW JxRpH74WRxkquoVN9IdhpOk2FO+VJhm40EotHiWfXWXpk8ZQxqj1wfCZeamdcI36zIJB u/UxYzud+mnd2X/n2spcFq24O66oodb9QUTTxnLG3UQF/Df5C7V6zWiBe3n2s5ZBjn1y FcZCNiMXQHTZjty72LH/la2kkoabnM2vx/uRTIOIVaxHPG0QoXTktQiTMd5yHfoBOgJD fV0AMIoIZk3SINq02FJLkol+S8VW8JByvnWRU9LPAzM3b7oYBMj2t50d7JTVMW2Ohk8p XFaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hgoJkj0j+DeXgOTwWsaQ9czRgkH7ct8k79BzMkAo21I=; b=NvVKa7Pg2TXOp57ZCYxQyiFl1l3Fx2T2ZlH20+h/emosk6H8VGHoDtZF+DK0RvrvUl dlVJWvgpmXGyEIxbrYJEtS4KowhH9XG6xlkUJj0FLM6YJ/kMCIkYX8y6s86gsAS819Zb /dEQAe/AbjR/j7+w5Min0IbB9bXfyrud52BeEYo/mEZjT6ExVeeFOVOx5uWBod5zFG2a wKsNgoratookHryaK4cEug5IEqRkKBg8y31M8GV7XNuk/B9/WrKfCAyQ2xMmO2BtoYBs cFHvJN0fRoMyEZzvopoEuIaybPJlo1VYv1+hjoSQ3b1Ur1hwlE9cP0LbtolXMzF3R7Zc CPiQ== X-Gm-Message-State: APjAAAXx7d6UFcpdSEBiwkSFMe0+WJqsGo4O2Z1QIqIli3PCFEI8muf1 eJg7Wenu/NoRGB6mYTbnL9JDTQ== X-Google-Smtp-Source: APXvYqwgIQca7idKo9ymapE3T5OO8x8pqigBLy9eB93kM1E6PWHv6ixEWkOsB241y9HTz4OBWoSVzA== X-Received: by 2002:a1c:6a06:: with SMTP id f6mr15926580wmc.159.1561382042502; Mon, 24 Jun 2019 06:14:02 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:01 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 01/10] ARM: davinci: enable the clocksource driver for DT mode Date: Mon, 24 Jun 2019 15:13:42 +0200 Message-Id: <20190624131351.3732-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061404_559938_B5F411C1 X-CRM114-Status: GOOD ( 12.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Switch all davinci boards supporting device tree to using the new clocksource driver: remove the previous OF_TIMER_DECLARE() from mach-davinci and select davinci-timer for ARCH_DAVINCI. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/Kconfig | 1 + arch/arm/mach-davinci/time.c | 14 -------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 8869742a85df..9fa546ec6c1c 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -588,6 +588,7 @@ config ARCH_DAVINCI select ARCH_HAS_HOLES_MEMORYMODEL select COMMON_CLK select CPU_ARM926T + select DAVINCI_TIMER select GENERIC_ALLOCATOR select GENERIC_CLOCKEVENTS select GENERIC_IRQ_CHIP diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c index 5a6de5368ab0..740410a3bb6a 100644 --- a/arch/arm/mach-davinci/time.c +++ b/arch/arm/mach-davinci/time.c @@ -398,17 +398,3 @@ void __init davinci_timer_init(struct clk *timer_clk) for (i=0; i< ARRAY_SIZE(timers); i++) timer32_config(&timers[i]); } - -static int __init of_davinci_timer_init(struct device_node *np) -{ - struct clk *clk; - - clk = of_clk_get(np, 0); - if (IS_ERR(clk)) - return PTR_ERR(clk); - - davinci_timer_init(clk); - - return 0; -} -TIMER_OF_DECLARE(davinci_timer, "ti,da830-timer", of_davinci_timer_init); From patchwork Mon Jun 24 13:13:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013075 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0942E1580 for ; Mon, 24 Jun 2019 13:16:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC9F2279E0 for ; Mon, 24 Jun 2019 13:16:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E02D028802; Mon, 24 Jun 2019 13:16:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 787C9279E0 for ; Mon, 24 Jun 2019 13:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=H5onO6pP0o2wdAPGFEZSmHtAD5NPqgS7zuT/p6Dx61g=; b=XSzcLVjm/SLc33 eusu9XVa8G6QS7+ydwvswo8gyRpdbRWk+pse25r9c145YxLiwGOG32cMBE0+Etnwf4PXOfdoiBt5s XTRYpXRvpsu96BM8xsXX1qebFPS7MpJojRX9/Z2iCybAkjemRP2O9aGpS1RgihfUtfxuONWATtB5c eCCGwhg8QD1vJXUWuLbRYRopp8DmujzAsibPlGmDAw6EOjDkCjdnMhgWsPoABQU9NGZnJi80krEPN WeHjZsZvE3aj4WNwGrSENxGpQ1HCqv0PuumPEP/Uc8Jni9pUh42/EXGX/41L8yC1HHUAoTe1KxiQr G+SPPpSuTx+CfQYdN1Mw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOpi-0001pB-4c; Mon, 24 Jun 2019 13:16:30 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnN-00081l-FO for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:08 +0000 Received: by mail-wr1-x443.google.com with SMTP id x17so13845394wrl.9 for ; Mon, 24 Jun 2019 06:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hwJfFyhhvRsina5sbst5ytafYocQofbOLZV0dXVMw8Y=; b=znbgMB7xt0WVpnamMVqZHdETd0ihHMGExjiUFxlp3G9YizldIBWaQef0fCDjATzk7M EVTNoxTKq+/igSlV4eX9kX+hEUS9N8gviLhbBXIMEurndfUIAME4iXOSfbPhtBWwwgFr Qnsv7C8vw6GwxS935vlQak9VAGoXE3F6YYw2V7fU708c7KvCjZcug4DhXWNM3YeJdnC5 KnuUwMLAQ2J07qlSzuv+vRBoOPpso5tDyyXGui+DwMINLsYfZgxbp8Y374tnO6iDrn+C DVI6mIuH/FqflhIHSjw9RBPJWEA3PbGLIoN9Qz/N8xpv2uqCaF8E49mt8TprrgUYgTVK jp5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hwJfFyhhvRsina5sbst5ytafYocQofbOLZV0dXVMw8Y=; b=FSUJ5wOHmIr42ZFwkXmNwLbaU78u6Spg5GVpxVLDy8bGpam7632YIMls18lbK1ex3q ZfPMWNbUF8GQP3wQGR/2QkiJ+BeW0FU7CISIXFUsxgGvch+mdI9FvJPCOJT7rkvz0yT+ uQfw4GSACu1p4OZtrnJoWseq0/cZ/VvhgFbx+2XbCNG7HX2sJXdiepI9O/pBTMVb15Mi ofg84bZbZ1EO07UAHnwlzHINeqUsa9YQoOYRsGipziexXJOtxrJS/9bAja5Y2y8MWGuL Emno1aw6K5QmOUqYkdWXnZe0XoVEpRwzM9BtdACpeZgPqsaF2j0DtRpXt1RORag/tQBj Wcnw== X-Gm-Message-State: APjAAAUfmr/aWvp41lO+liZjxNk/sIsVeAjlcCO6wBH9M11doZvgAtGW 05Mi342X7PVZt033I9Yi3cijiQ== X-Google-Smtp-Source: APXvYqz6IEyF22X4CA4PFAUz9/IJDUYISVDGCvMm/IKKad7O/BeUf/my1+zJNFPwjydPUUXwUBk4xg== X-Received: by 2002:a5d:53c2:: with SMTP id a2mr59111958wrw.8.1561382043483; Mon, 24 Jun 2019 06:14:03 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:02 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 02/10] ARM: davinci: WARN_ON() if clk_get() fails Date: Mon, 24 Jun 2019 15:13:43 +0200 Message-Id: <20190624131351.3732-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061405_538962_3147942D X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Currently the timer code checks if the clock pointer passed to it is good (!IS_ERR(clk)). The new clocksource driver expects the clock to be functional and doesn't perform any checks so emit a warning if clk_get() fails. Apply this to all davinci platforms. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/da830.c | 4 ++++ arch/arm/mach-davinci/da850.c | 4 ++++ arch/arm/mach-davinci/dm355.c | 4 ++++ arch/arm/mach-davinci/dm365.c | 4 ++++ arch/arm/mach-davinci/dm644x.c | 4 ++++ arch/arm/mach-davinci/dm646x.c | 4 ++++ 6 files changed, 24 insertions(+) diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index e6b8ffd934a1..220e99438ae0 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c @@ -751,6 +751,10 @@ void __init da830_init_time(void) da830_pll_init(NULL, pll, NULL); clk = clk_get(NULL, "timer0"); + if (WARN_ON(IS_ERR(clk))) { + pr_err("Unable to get the timer clock\n"); + return; + } davinci_timer_init(clk); } diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index 77bc64d6e39b..dcf3536c46bc 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -681,6 +681,10 @@ void __init da850_init_time(void) da850_pll0_init(NULL, pll0, cfgchip); clk = clk_get(NULL, "timer0"); + if (WARN_ON(IS_ERR(clk))) { + pr_err("Unable to get the timer clock\n"); + return; + } davinci_timer_init(clk); } diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index c6073326be2e..a38a3648345b 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c @@ -743,6 +743,10 @@ void __init dm355_init_time(void) dm355_psc_init(NULL, psc); clk = clk_get(NULL, "timer0"); + if (WARN_ON(IS_ERR(clk))) { + pr_err("Unable to get the timer clock\n"); + return; + } davinci_timer_init(clk); } diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 2f9ae6431bf5..8062412be70f 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -784,6 +784,10 @@ void __init dm365_init_time(void) dm365_psc_init(NULL, psc); clk = clk_get(NULL, "timer0"); + if (WARN_ON(IS_ERR(clk))) { + pr_err("Unable to get the timer clock\n"); + return; + } davinci_timer_init(clk); } diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 1b9e9a6192ef..7a6b5a48cae5 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -679,6 +679,10 @@ void __init dm644x_init_time(void) dm644x_psc_init(NULL, psc); clk = clk_get(NULL, "timer0"); + if (WARN_ON(IS_ERR(clk))) { + pr_err("Unable to get the timer clock\n"); + return; + } davinci_timer_init(clk); } diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 62ca952fe161..97fe533726e9 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -663,6 +663,10 @@ void __init dm646x_init_time(unsigned long ref_clk_rate, dm646x_psc_init(NULL, psc); clk = clk_get(NULL, "timer0"); + if (WARN_ON(IS_ERR(clk))) { + pr_err("Unable to get the timer clock\n"); + return; + } davinci_timer_init(clk); } From patchwork Mon Jun 24 13:13:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013073 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C5A0613B4 for ; Mon, 24 Jun 2019 13:16:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B3A79287FB for ; Mon, 24 Jun 2019 13:16:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6D7F2880B; Mon, 24 Jun 2019 13:16:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C4C6287FB for ; Mon, 24 Jun 2019 13:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PykJusaKaBeyDJeDoUGVWtHHuxQHnFdsHvOthNrZKLI=; b=OLzeBQaD/YhOkV PquP7PlEZ2/rmBVtmQWhfHt9/4PQBJOuY3LCIcFE3+17zFqkKqz6euzKXZ9JPgicGAQMMKOcsHu2t G6moeLsyvnwT7mxiDrmq1BVr5Ki0SiRjxKdiGcCu5VKUYDpzUAZbPf+2KhyEgZJvFuMpauiGl50Kq ZruXachBYq3e/A4F/XbsLYvm+9QmQ7scZMTd9/INiovKNNPtaNFxSYevaQDgF+Gnc62oywAbh6zel 1MduByrre5MfIylgrSkgeBX2W2hTA7uz5dno7lKL0E3ONFwxX1bfs349vnoW/SySGvN3Tlf8yzGeB AsSllcOcYQdGh1DId0dA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOpF-0001ZK-EA; Mon, 24 Jun 2019 13:16:01 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnN-000823-QI for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:08 +0000 Received: by mail-wm1-x342.google.com with SMTP id c6so13375945wml.0 for ; Mon, 24 Jun 2019 06:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1TfWHxtQiNmrkXujZYAI0hTn+BhOSphr+TltX20vVaQ=; b=l8J08YKOJwmACjfUIJ6uTeyI84leHPXXrAsSJdkYuXh/C0wYpl1bSyZY5J24slwT26 txxLOJB5wXk8R18kMLgB+YMGCzMUekRAHFhwZG6KrXx476j0BDbMlxTNzrVMU9PjRtf+ 85d8a+7N+KD4mbGVVA91GaMKU/HaJuBOgbtTq4lZTRUynKqvlILjx/MpkHQKy71FBAJu ukiYVQ8lxIXkjfnHzo0myBt5MviE26zfaoSD22gy3ACl5P1u+zQQNz6QWu8FlWmHgQgR 8Lia1aJtVCdXCuAa7/Zp5pxkkgYnvFOHUJ/2y0xXIRVj9gvRH7R3H0OmUtpclSFxuC9T kT4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1TfWHxtQiNmrkXujZYAI0hTn+BhOSphr+TltX20vVaQ=; b=gvT372TKVwA2FlUClIXLW0qdofDGSQCzXGCy9+hmKQMcPqIyOy1Urgv+gvaEZ9ihVe mNGcksExHC7o5neFvNDXYGNJgD60dJmR1Cx0FxPk7ykb5VDW4fZfr9DDoqcD2+UcPHKo 0f2qF/v1DAVpcfvf2hV2PH3anH5/174/f8VzKx+NXYLXuH09CjM2Z+WTjOHiKoobrUXd JXfk/fUYNr3yaaat1Yt4COafe2OyRL9Z5uD7OHB9DHPrpUY0Hc0qaI1SG75W9jGFmlh2 eCgLa63KaABFQcW9ZpiWgmWxI+ZMb+2n5Pu2Xn397DQg9LGTa8OOJ4AeqnPMDMA49z19 5uww== X-Gm-Message-State: APjAAAWVDK+tBtuSvBNE5V4koD+lnrqf7EFQhlqrMkJd9vZhsrTSvh/h D5WoZoV/ugCixksoYKNCCVNDPw== X-Google-Smtp-Source: APXvYqyRnmxp6bUCbPDH2fq2z5NQMTVyYIuWTnDzzhr051yMPH4j4YLQm/OSpS6v4oJlyS2ycgd+vQ== X-Received: by 2002:a1c:b189:: with SMTP id a131mr16593611wmf.7.1561382044414; Mon, 24 Jun 2019 06:14:04 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:03 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 03/10] ARM: davinci: da850: switch to using the clocksource driver Date: Mon, 24 Jun 2019 15:13:44 +0200 Message-Id: <20190624131351.3732-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061405_850208_D6EEDB76 X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a proper clocksource driver for davinci. Switch the da850 platform to using it. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/da850.c | 46 ++++++++++------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c index dcf3536c46bc..73b7cc53f966 100644 --- a/arch/arm/mach-davinci/da850.c +++ b/arch/arm/mach-davinci/da850.c @@ -35,7 +35,8 @@ #include #include #include -#include + +#include #include "irqs.h" #include "mux.h" @@ -333,38 +334,16 @@ static struct davinci_id da850_ids[] = { }, }; -static struct davinci_timer_instance da850_timer_instance[4] = { - { - .base = DA8XX_TIMER64P0_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_0), - .top_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT34_0), - }, - { - .base = DA8XX_TIMER64P1_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_1), - .top_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT34_1), - }, - { - .base = DA850_TIMER64P2_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_DA850_TINT12_2), - .top_irq = DAVINCI_INTC_IRQ(IRQ_DA850_TINT34_2), - }, - { - .base = DA850_TIMER64P3_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_DA850_TINT12_3), - .top_irq = DAVINCI_INTC_IRQ(IRQ_DA850_TINT34_3), - }, -}; - /* - * T0_BOT: Timer 0, bottom : Used for clock_event - * T0_TOP: Timer 0, top : Used for clocksource - * T1_BOT, T1_TOP: Timer 1, bottom & top: Used for watchdog timer + * Bottom half of timer 0 is used for clock_event, top half for + * clocksource. */ -static struct davinci_timer_info da850_timer_info = { - .timers = da850_timer_instance, - .clockevent_id = T0_BOT, - .clocksource_id = T0_TOP, +static const struct davinci_timer_cfg da850_timer_cfg = { + .reg = DEFINE_RES_IO(DA8XX_TIMER64P0_BASE, SZ_4K), + .irq = { + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_0)), + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT34_0)), + }, }; #ifdef CONFIG_CPU_FREQ @@ -635,7 +614,6 @@ static const struct davinci_soc_info davinci_soc_info_da850 = { .pinmux_base = DA8XX_SYSCFG0_BASE + 0x120, .pinmux_pins = da850_pins, .pinmux_pins_num = ARRAY_SIZE(da850_pins), - .timer_info = &da850_timer_info, .emac_pdata = &da8xx_emac_pdata, .sram_dma = DA8XX_SHARED_RAM_BASE, .sram_len = SZ_128K, @@ -672,6 +650,7 @@ void __init da850_init_time(void) void __iomem *pll0; struct regmap *cfgchip; struct clk *clk; + int rv; clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA850_REF_FREQ); @@ -686,7 +665,8 @@ void __init da850_init_time(void) return; } - davinci_timer_init(clk); + rv = davinci_timer_register(clk, &da850_timer_cfg); + WARN(rv, "Unable to register the timer: %d\n", rv); } static struct resource da850_pll1_resources[] = { From patchwork Mon Jun 24 13:13:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013077 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5DFCA186E for ; Mon, 24 Jun 2019 13:16:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474AF27FB0 for ; Mon, 24 Jun 2019 13:16:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 377B3287FB; Mon, 24 Jun 2019 13:16:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C97C427FB0 for ; Mon, 24 Jun 2019 13:16:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7/YqG2t9SU+Xm3W0df9XXcFLyZH7ky81TPbk7phGTzo=; b=ur/UkuqVV196wx MjeCnk8YeOKIDXuKLiAHNkbLRPBUj2A/gHijQq1/XH6e+PGUMa2W0BwsK+VeF4AiTtO2tElQnoyk9 hg2ed8k+aOYChVOHC6lKd9yFmNp+LVNls5yXDOlJ0DMaIjT6d5a/tNgRTBJLIlx10cNGYxlGODuYF euBBBdJW+druFkdTbMKOx0R+yM5lSAC1sXGXFeO7ZeBGaEvnL0eoiw4oHpRzmohokTzU1H4Yow1qd zc+7YPARi2eHCxqcoPmZDkbitIwQcjwdmPSInm7VT3SsxMHtDE0pTly+E0pWN2q99V6eYsuwRIMNI F8NiRooWl7gHESzNQcOQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOq6-00022i-Ps; Mon, 24 Jun 2019 13:16:54 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnP-00082f-1o for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:08 +0000 Received: by mail-wm1-x341.google.com with SMTP id c6so13376001wml.0 for ; Mon, 24 Jun 2019 06:14:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7QzkaTCV3I7NgoLWSlqzvltTcK62DUmr4R57ORffNTM=; b=edO6aPEP58ioKdqIasfS9Zjvh73POdMrN4X8etJfFka0LxkGuLgGoDrv0M5pwm88uP /yX8icxiLs0Oc9gECnhNwwKVhmlPrhJ7PmEOeK0UFsEKakynLLLau+4psJ7T6IK86qHn nOqqSXD7encRu+XgoVp9KWbCJVb9oiD5zrTuXnDZ0EVSh3jK53n2X6481JVPLfD6Nbu+ +gn5K+BKREHFEf9sf6p4T1qjPV6JZuYs73AIl1/s+eHhTcU5VDs/eGxVcvQfBSNV+5/H yLfaZ5pcktJMHz5511G3nE1ssKyQDCcqD3wwO8qjaCg/gg0oKlUvAOf3aLytgJMZqKSE T1FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7QzkaTCV3I7NgoLWSlqzvltTcK62DUmr4R57ORffNTM=; b=OyUREsTgtlcnIRT+XwvgeW1Z6vH1PZqhxCsk1pRaWByRThzt9wJs9w4rulvdChGCex N/oeIFl/Mtp9geTh0M0cnoVtaF3Vp6T/XaCW5SkwX3hgZ07NW0jSVnRfdJ+X0wGAzADY EQM1K5CL/kfx/NvBJEfgQfs7auRp6LE/UNrlGwYt5LGJnWAjBff3RdhQJnpZiDFNW3mm 0Kd+K47c7a0W4wwVFR/E3AEMotOAQE5mmbko+tBPtGFrPsp+SSgIam33z+ohZGY9gQka klau2rPrDJc67WDTHCkue38lV03FmLEeZebnx24KcVCvkbVEsMC7Z65IzJfHjGfPiUi0 egcA== X-Gm-Message-State: APjAAAX1Q1RE8lwgxA4ecFPdA/ix3oEhnTEiFOtSlyfHQQyJs+K28kg1 81MUYFoavVGlxFtcsv1WzP5KMw== X-Google-Smtp-Source: APXvYqwVFqcCUQwQhci8y9g7envcvDcRv+Wn+pc6LI5R5mNzl8SLt8XJoW+JJe2vPDvfeIL0skR+Gw== X-Received: by 2002:a7b:c34b:: with SMTP id l11mr16313292wmj.69.1561382045600; Mon, 24 Jun 2019 06:14:05 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:04 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 04/10] ARM: davinci: da830: switch to using the clocksource driver Date: Mon, 24 Jun 2019 15:13:45 +0200 Message-Id: <20190624131351.3732-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061407_245756_EEB41ABC X-CRM114-Status: GOOD ( 15.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a proper clocksource driver for davinci. Switch the da830 platform to using it. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/da830.c | 41 ++++++++++++----------------------- 1 file changed, 14 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c index 220e99438ae0..018ab4b549f1 100644 --- a/arch/arm/mach-davinci/da830.c +++ b/arch/arm/mach-davinci/da830.c @@ -21,7 +21,8 @@ #include #include #include -#include + +#include #include "irqs.h" #include "mux.h" @@ -676,32 +677,17 @@ int __init da830_register_gpio(void) return da8xx_register_gpio(&da830_gpio_platform_data); } -static struct davinci_timer_instance da830_timer_instance[2] = { - { - .base = DA8XX_TIMER64P0_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_0), - .top_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT34_0), - .cmp_off = DA830_CMP12_0, - .cmp_irq = DAVINCI_INTC_IRQ(IRQ_DA830_T12CMPINT0_0), - }, - { - .base = DA8XX_TIMER64P1_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_1), - .top_irq = DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT34_1), - .cmp_off = DA830_CMP12_0, - .cmp_irq = DAVINCI_INTC_IRQ(IRQ_DA830_T12CMPINT0_1), - }, -}; - /* - * T0_BOT: Timer 0, bottom : Used for clock_event & clocksource - * T0_TOP: Timer 0, top : Used by DSP - * T1_BOT, T1_TOP: Timer 1, bottom & top: Used for watchdog timer + * Bottom half of timer0 is used both for clock even and clocksource. + * Top half is used by DSP. */ -static struct davinci_timer_info da830_timer_info = { - .timers = da830_timer_instance, - .clockevent_id = T0_BOT, - .clocksource_id = T0_BOT, +static const struct davinci_timer_cfg da830_timer_cfg = { + .reg = DEFINE_RES_IO(DA8XX_TIMER64P0_BASE, SZ_4K), + .irq = { + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_DA830_T12CMPINT0_0)), + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_DA8XX_TINT12_0)), + }, + .cmp_off = DA830_CMP12_0, }; static const struct davinci_soc_info davinci_soc_info_da830 = { @@ -713,7 +699,6 @@ static const struct davinci_soc_info davinci_soc_info_da830 = { .pinmux_base = DA8XX_SYSCFG0_BASE + 0x120, .pinmux_pins = da830_pins, .pinmux_pins_num = ARRAY_SIZE(da830_pins), - .timer_info = &da830_timer_info, .emac_pdata = &da8xx_emac_pdata, }; @@ -743,6 +728,7 @@ void __init da830_init_time(void) { void __iomem *pll; struct clk *clk; + int rv; clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DA830_REF_FREQ); @@ -756,7 +742,8 @@ void __init da830_init_time(void) return; } - davinci_timer_init(clk); + rv = davinci_timer_register(clk, &da830_timer_cfg); + WARN(rv, "Unable to register the timer: %d\n", rv); } static struct resource da830_psc0_resources[] = { From patchwork Mon Jun 24 13:13:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7D5F813B4 for ; Mon, 24 Jun 2019 13:17:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CA4D279E0 for ; Mon, 24 Jun 2019 13:17:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6085528600; Mon, 24 Jun 2019 13:17:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0324227FB0 for ; Mon, 24 Jun 2019 13:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=tvIE3J7UYFJqTnke2sMchKbXrTwtIpsAUkqlCawrkTc=; b=Rc4QzGX1S0jFYF 4WFb3R+Ca525/UQ6s2XsaBivvX3OE+pFq9Woy3vPLkh58gerKQMzliQgtS74arNJRe6cz2kjo8P08 F1xHT2Y+rz+PUorLmwmvpmeWsF2zvc2YfpSKflq+GK+mDjwtw16UTucMEl1CUrtFiAIcaSrTt1wQJ cF+I9uT99Qp39ERNgMXnncYxAU5JS0RlLJ+USr48JkBiL4b0oTmiMd5zb8hd3f3xbRlwIDPPZsGIn wIyLYeWaH3dLDlqYqkM42ieLibjw5hn43rrhSArsYNBqE0D1I3YYzuvbVFkL5RXvvdQCk/ztr8cT2 IswgXyDUQnKnTyd6sOGw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOqV-0002KT-7F; Mon, 24 Jun 2019 13:17:19 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnQ-00082u-H2 for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:10 +0000 Received: by mail-wr1-x441.google.com with SMTP id f15so3982942wrp.2 for ; Mon, 24 Jun 2019 06:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i1AJwx99L7FOyjXOzW3yVuzHOgblADWD2c7KtmC/N3c=; b=WOySg19uwixtLJcA34iXOVTAvsO3Qw7eg/4J7JqNLGkwewilaFe1+y+jlxscwDQ876 dvRwKZ5JZPTB1yoVLftIgMN4jeQxDtptUtHagZ/Et6tO1ycxiGn/CmruZsmIMiCoLJEY KTF0zwd9AuaAEFxQXQvEWMLHJVFKEhZ0GoW7lyU4ff+JznxNQdHHPTfTStIOZ0/13f+G op9eMVHrXho9xnud3GO6aHei8hY9xVc5CDtPT/Tt2fdm8jiY9TK15aHkdVK8yt/ZiYV8 qV/DurgpQw7hQLCbJDdVjfec/B0KNnKik9bfIZOOp9Xm7ErXTj3MDQleBuixVzAK5KI1 b/ag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i1AJwx99L7FOyjXOzW3yVuzHOgblADWD2c7KtmC/N3c=; b=aPX9cU0we+SrP/1FVjkT5/RbEJXQKngyOFWNRapq29RYy0PPLnULlbkEEltboVo2AI ft5ZLLTqO8FfUwb7DsNJM+RJykahVHwQJawejERCMlWJTLai+gg3K0k5KGj9MR+P6TRt gs88oV+rMxxGMXSbv7E7VW7EmuK9L+lsmiRDQvXkr4eymfSQsPaTt4EZz/sVpn6ws168 Z5b04cpRndjE7lcvhIEJfQARgPQCJ27P07i051IpbXoMJU6Kzz1Y5dR9llIN5j8z/Fh1 lNT0xmhe/D2ez8UBP42pwNgl9yOoMc77J+WrZt2TiiaozFpYBt8LzzrqIPhwtQgZmxu7 R3Ig== X-Gm-Message-State: APjAAAWFE5lFP2W9QQywAbYf+NzhHduB6WkOm059XzWA1XwYcNh9zUFy zBFvvCCmTMEpsjqQq6nmMjIQNw== X-Google-Smtp-Source: APXvYqwMrGE/b2UQOnAjqoPXTMcUtRBbxCyCrQMb4pPMV12KOWmxfAgxSMS2EEyzVVZXU67ssEcvPA== X-Received: by 2002:a05:6000:d1:: with SMTP id q17mr58315452wrx.40.1561382046572; Mon, 24 Jun 2019 06:14:06 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:05 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 05/10] ARM: davinci: move timer definitions to davinci.h Date: Mon, 24 Jun 2019 15:13:46 +0200 Message-Id: <20190624131351.3732-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061409_059510_DA44F984 X-CRM114-Status: GOOD ( 11.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Boards from the dm* family rely on register offset definitions from arch/arm/mach-davinci/include/mach/time.h. We'll be removing this file soon, so move the required defines to davinci.h where the rest of such constants live. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/davinci.h | 3 +++ arch/arm/mach-davinci/include/mach/time.h | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h index 56c1835c42e5..208d7a4d3597 100644 --- a/arch/arm/mach-davinci/davinci.h +++ b/arch/arm/mach-davinci/davinci.h @@ -60,6 +60,9 @@ void davinci_map_sysmod(void); #define DAVINCI_GPIO_BASE 0x01C67000 int davinci_gpio_register(struct resource *res, int size, void *pdata); +#define DAVINCI_TIMER0_BASE (IO_PHYS + 0x21400) +#define DAVINCI_WDOG_BASE (IO_PHYS + 0x21C00) + /* DM355 base addresses */ #define DM355_ASYNC_EMIF_CONTROL_BASE 0x01e10000 #define DM355_ASYNC_EMIF_DATA_CE0_BASE 0x02000000 diff --git a/arch/arm/mach-davinci/include/mach/time.h b/arch/arm/mach-davinci/include/mach/time.h index 1c971d8d8ba8..ba913736990f 100644 --- a/arch/arm/mach-davinci/include/mach/time.h +++ b/arch/arm/mach-davinci/include/mach/time.h @@ -11,9 +11,7 @@ #ifndef __ARCH_ARM_MACH_DAVINCI_TIME_H #define __ARCH_ARM_MACH_DAVINCI_TIME_H -#define DAVINCI_TIMER0_BASE (IO_PHYS + 0x21400) #define DAVINCI_TIMER1_BASE (IO_PHYS + 0x21800) -#define DAVINCI_WDOG_BASE (IO_PHYS + 0x21C00) enum { T0_BOT, From patchwork Mon Jun 24 13:13:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013087 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45BC513B4 for ; Mon, 24 Jun 2019 13:18:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32EAC279E0 for ; Mon, 24 Jun 2019 13:18:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 23F8128600; Mon, 24 Jun 2019 13:18:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC695279E0 for ; Mon, 24 Jun 2019 13:17:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vntGyV9J5e7ibcUwbF3mn4IGWcSrS6BfGHLGzYXFv6o=; b=WnQaGZunBnC2rP bTBnxPlG1+az4+hRz8c82pSAOT2PZT8ekIenPgtk+bjbE744rrUgRR4KvR+KVs7+78aVFWhiScLQH G7kWoeVRq9uLRBtkJ6L3CG6w3mYHeTmmGCSIuBN0RTpZZ4tHR/8wSmhOvAVim0v2JPrIAuanWoFYw 4kEVi3YdNu9BwEfKpyHAE+pBzmWE4pOEWfU5bw8kxyhZuOjeSykQ2AS1LINXqAtV5hh4wMdoD4dHv 99cXkqk13DNEsqo2AzsN7CABEOiibXp2p4B/1y3NUf/+au7+wvZ1nXLXWbcFuT2zob/WeSklWEjZb 0XKn3pw+cKz8jiu0nnLA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOr4-0002b1-N9; Mon, 24 Jun 2019 13:17:54 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnQ-00083S-QV for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:10 +0000 Received: by mail-wm1-x341.google.com with SMTP id g135so12741680wme.4 for ; Mon, 24 Jun 2019 06:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zOhvfud1UplL6dXW+3V5RKRSj+/QqrgOZPNk1aW9k94=; b=sRBYCDtG70BsqOE2cPQ6Yb/vH8Y1K3vBWGkcB24MC4iIGeY7i5yLh2FHRMLBAXOBqr 98GOJDOVmfzkuTio07OmLzeTtu0vX/3in+w0X1DKMy84oyCuzQqdAT6IQvZtyunkTmdz ATSj8Blww2SV7SlLPS70V5e3IB6X6gVf5AR/62cljr5RzLuMOtR5386b28q5mb87nqGl hE38amGYMXTld+ZIrRYf5aFg5QiJmCKrbQf8it1GUHIHiwCjDq+8pvBygIEbmTMjA8Z9 43CJWrxMfaxXSjUGDGNOO0ECeh2L5K3JQ6AAdLGM7OZEsY8wMSAm6fU3szvcXzwUhITb zleg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zOhvfud1UplL6dXW+3V5RKRSj+/QqrgOZPNk1aW9k94=; b=guU/HjqFNyb/0C8RKYTejuTCWzAAgV08WetGBnvbdrFlFKOCbK/zhBcjrt/bjX50sF SH5L3HzA2GR4Zufq7v5eYDPPm5svobsqb+EM7wH0aAgNmJYMCeLCCEcXunyziqzy4Eyc czLO8xdhF9GkCWia+62Kc4CSqhO/6wDtFST2GEtF2w+UqoSgrRGLfvaD5MTLre9cXcGU EebbUlKqcAA2KOH+QvA3EbenB3IL5pzokiAaASIrvEZDN8nfS9rGn8i5iqHnQu9b7BwO MeWHyZlaQ/kDp5DKSs5XqfEJgapi19UZwsoRwbMAbGQYfTemJYgIQlB1yhOaoO0zzqR/ FNVg== X-Gm-Message-State: APjAAAWoWzjg4VOWAigcRBNNO+xzK3yx+VCmkvcaNuDnYDGllgzD0aiP m4sz39iPxk+4XK25uJNLy+U8JA== X-Google-Smtp-Source: APXvYqwvo1iriPD0W/bfOCnyIWRUt6wyAk/QMkGV06b6J0/YPFZFlgm4xFkGNQUKUyarb4J5NZgvKg== X-Received: by 2002:a7b:c776:: with SMTP id x22mr15710150wmk.55.1561382047666; Mon, 24 Jun 2019 06:14:07 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:07 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 06/10] ARM: davinci: dm355: switch to using the clocksource driver Date: Mon, 24 Jun 2019 15:13:47 +0200 Message-Id: <20190624131351.3732-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061409_065590_0750B034 X-CRM114-Status: GOOD ( 14.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a proper clocksource driver for davinci. Switch the dm355 platform to using it. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/dm355.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c index a38a3648345b..5de72d2fa8f0 100644 --- a/arch/arm/mach-davinci/dm355.c +++ b/arch/arm/mach-davinci/dm355.c @@ -30,7 +30,8 @@ #include #include #include -#include + +#include #include "asp.h" #include "davinci.h" @@ -620,15 +621,15 @@ static struct davinci_id dm355_ids[] = { }; /* - * T0_BOT: Timer 0, bottom: clockevent source for hrtimers - * T0_TOP: Timer 0, top : clocksource for generic timekeeping - * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) - * T1_TOP: Timer 1, top : + * Bottom half of timer0 is used for clockevent, top half is used for + * clocksource. */ -static struct davinci_timer_info dm355_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id = T0_BOT, - .clocksource_id = T0_TOP, +static const struct davinci_timer_cfg dm355_timer_cfg = { + .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K), + .irq = { + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)), + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)), + }, }; static struct plat_serial8250_port dm355_serial0_platform_data[] = { @@ -706,7 +707,6 @@ static const struct davinci_soc_info davinci_soc_info_dm355 = { .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, .pinmux_pins = dm355_pins, .pinmux_pins_num = ARRAY_SIZE(dm355_pins), - .timer_info = &dm355_timer_info, .sram_dma = 0x00010000, .sram_len = SZ_32K, }; @@ -733,6 +733,7 @@ void __init dm355_init_time(void) { void __iomem *pll1, *psc; struct clk *clk; + int rv; clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM355_REF_FREQ); @@ -748,7 +749,8 @@ void __init dm355_init_time(void) return; } - davinci_timer_init(clk); + rv = davinci_timer_register(clk, &dm355_timer_cfg); + WARN(rv, "Unable to register the timer: %d\n", rv); } static struct resource dm355_pll2_resources[] = { From patchwork Mon Jun 24 13:13:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 77ABA13B4 for ; Mon, 24 Jun 2019 13:18:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 652E527FB0 for ; Mon, 24 Jun 2019 13:18:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59AB5287FB; Mon, 24 Jun 2019 13:18:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C1A8C27FB0 for ; Mon, 24 Jun 2019 13:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sP+suA0o3I5Q2A4v5nZ0MnkytQdyI/PjP8DPuyj8qu8=; b=LCM5rNRQdstDRH 40kR4Uiovn50HJ+s7lz2qfC22dyyz9DlYwGOMEnRTS8/VhEUN6LdWpC+y5tJ+N7sbxT9iLR77n1Qk B0clrSDcL6U90mI6W3AlHY9MtKQErAlBtcblz2FJdXXDwhO90TXTBYu/M34rbMuRanNdFf7gV8nD6 ZDrISM/FXx8vaCypurwz/iu8Nu7DjCAmMLyEK1XwljgT/YZOvfg0KkNhdSDa8vdvps1igRd5z3wGQ eKmEZjPrltRNCmSmqfm5P8xcgBb+7ZWyC9YYoZd+7FhYATqsEW80fpXI0Kd1NLfLfoz6g6+EKYmOM uR6Ap/eGvCdC0/pexeMQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOrK-0002pQ-N2; Mon, 24 Jun 2019 13:18:10 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnR-00084D-St for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:12 +0000 Received: by mail-wr1-x441.google.com with SMTP id v14so13874833wrr.4 for ; Mon, 24 Jun 2019 06:14:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=19fYL7Z8mI6tfJg545F0VQ6RS/+NjmhdJgfi1UhO5UU=; b=jol/3H/jyd+n5+UmVJcFYxn4G6XLnGFk58Io6xBdo8IH1KMpFbEeamgPfqCKmX/bSK C45pQaBMAxpqQNY+G7gicp0SlMFb0+CbflH6zpD48LuGN1pgNdjG6hvQhSot3SDomYfr s2ukWKMW14+JD0j0bqWwZDlbSSrU9wpUwBKdw+KxOAnfoq7araQy1xlKbdiztQvcdvwa TRBRmgeANjaMFEsPAIhosDfZp77aeyhrEjfEdaYyVF5FXXUft0NyQSs9hA/sBEftWE1L f4MUjkjo4HMgTzFyDoTWfEKOjUC5rdlKwOr+KW00cT0tA2Zi93dJuTSFxRTvUMpiJFE0 kxVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=19fYL7Z8mI6tfJg545F0VQ6RS/+NjmhdJgfi1UhO5UU=; b=bwqO/W1RGbTvWjwofCkFd2DQlDqHAP/e3fECI4rmigadhvdJ6a5mlyp5QJt9Mi+mmK UqfpjlEGvmo8dU8O0VNkMk/XMjvL43pUfjSqe2xKp+3VHLp4GOi3R4ik61l9OShweH59 E/Q4GUVTBpSSnCE5zF8JGrVguw+pG1BLtYILEoxVMzVwbOb6VSt+gcKVhVxjHXRcdTU/ bAPqWNkpJHduxVl8pPDrRKjPrveYreVUCNiSe1G0ZBBY9x5O0AE2X7WdtRUH7kBKYfKL Eeg83AhLCFJ0IbAqxmzc6Jh/Ch7Mo5nOcGYlg3vfJDGDbhgtseMsu+0aj7lwpOSUGNmc mqPQ== X-Gm-Message-State: APjAAAUTrRilSO7ZyOId9fD7HPECKDWdxiijY0+eCmzCGKWEekl0VC3c DavQkKxjlEnCvbhMT2bHU8wH/Q== X-Google-Smtp-Source: APXvYqywH596rG5HuH5Z1TME7LtvICvR2+wtjm0DznEwB3khuDIREmwbKdT3WYlktUIicc9QC/rmaQ== X-Received: by 2002:adf:e910:: with SMTP id f16mr17523944wrm.183.1561382048709; Mon, 24 Jun 2019 06:14:08 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:08 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 07/10] ARM: davinci: dm365: switch to using the clocksource driver Date: Mon, 24 Jun 2019 15:13:48 +0200 Message-Id: <20190624131351.3732-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061410_009508_501BBFA1 X-CRM114-Status: GOOD ( 14.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a proper clocksource driver for davinci. Switch the dm365 platform to using it. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/dm365.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c index 8062412be70f..2299ca445c0e 100644 --- a/arch/arm/mach-davinci/dm365.c +++ b/arch/arm/mach-davinci/dm365.c @@ -35,7 +35,8 @@ #include #include #include -#include + +#include #include "asp.h" #include "davinci.h" @@ -660,10 +661,16 @@ static struct davinci_id dm365_ids[] = { }, }; -static struct davinci_timer_info dm365_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id = T0_BOT, - .clocksource_id = T0_TOP, +/* + * Bottom half of timer0 is used for clockevent, top half is used for + * clocksource. + */ +static const struct davinci_timer_cfg dm365_timer_cfg = { + .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K), + .irq = { + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)), + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)), + }, }; #define DM365_UART1_BASE (IO_PHYS + 0x106000) @@ -723,7 +730,6 @@ static const struct davinci_soc_info davinci_soc_info_dm365 = { .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, .pinmux_pins = dm365_pins, .pinmux_pins_num = ARRAY_SIZE(dm365_pins), - .timer_info = &dm365_timer_info, .emac_pdata = &dm365_emac_pdata, .sram_dma = 0x00010000, .sram_len = SZ_32K, @@ -771,6 +777,7 @@ void __init dm365_init_time(void) { void __iomem *pll1, *pll2, *psc; struct clk *clk; + int rv; clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM365_REF_FREQ); @@ -789,7 +796,8 @@ void __init dm365_init_time(void) return; } - davinci_timer_init(clk); + rv = davinci_timer_register(clk, &dm365_timer_cfg); + WARN(rv, "Unable to register the timer: %d\n", rv); } void __init dm365_register_clocks(void) From patchwork Mon Jun 24 13:13:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7FE961580 for ; Mon, 24 Jun 2019 13:18:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E5D328600 for ; Mon, 24 Jun 2019 13:18:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62BB428802; Mon, 24 Jun 2019 13:18:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 08ABB28600 for ; Mon, 24 Jun 2019 13:18:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s+zLgAG3opmkg+lxhlklrv7jlTqQDISmoLStCHFbAik=; b=R/phPIt6+qOyt5 kajKGtp5+BQMIK8cQv29Z4I+A0dOeeGTd7g9xZycskJKE5AKWAW+JdVLWOD33rZcpt/7Yullfhzun X25PFUA1lvazogWIKymAsYc1MgnZxjha+xvbErVLVi977u7obSQ9MBNpKKhN4+VFz47IdMQP3KY7r VKmL30hiVopzb9EQFqmpszylEPw/lNtwR1oExtpXlP0Awdxb272hxqfCDTohrHqgLUYtFbquj/j3b UPaUaMxRwlL7Kq0B+l4kdvq5bP8li2gPLQ1F7Yyrlt68BFVBMBB/WXtDbasoV5hcaUFTInEoWJWZB dvdLPS6wm5xfjotaBCJw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOrf-000340-Ti; Mon, 24 Jun 2019 13:18:32 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnS-00084u-Sj for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:13 +0000 Received: by mail-wm1-x342.google.com with SMTP id u8so13343466wmm.1 for ; Mon, 24 Jun 2019 06:14:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=550rdQvPEpXRICt57j9lxMM5hxSHkZtM5UQc6a6drbE=; b=MApm63Q5KkYtQWv/PSQalezO2BBDnpIijPrWRFHKBj7SA+98UuiveTqEwQtX429kTE Nf5ie8av3/38lXA6GiaCdQoqNn1nhPThbBpKeSbS0gJ9oKhj0TfcF3c73PhbniIu3iiL wSqHRqM90R7kZrCD3hMnkEt7pJt/C4kz7lLcogQApq6BssveU4OWFnMOvCKXttEx2aId a6oB6n+4nGRsC214G3Ew24iYriZRk9MJ6wteIrMfHEwlzsmUS++7I6I6Z0clRTAvb4Q3 6MKkmgxi8rE+tRwcmRiGOzxjyTXuM/W/94DZWp30FHmjqs6ds0KGDEs7a8d3CUNILFt5 KF4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=550rdQvPEpXRICt57j9lxMM5hxSHkZtM5UQc6a6drbE=; b=RIm3nTa9sia1rORl/HhmSSlVug/I/SzTYAq4iwGVL+r3KuFVD3Q9XkJbcufA9AE36s H6WF/lyMyIkifMaDCVa4D66YFSlV3OU+7ZGIhrpycFuqgKy+gyuq9emlTyBCBwOELS/B yn+p8acnuKpScIGuvvlnzCvxo669t+tJBf+K0CpfnJ4KIZI5XB5pg9WPEwHQtPUJWcFc vy2X+JKSxOhpctOCXVFrbAKBxnJyxiW1OgHoXFmwA26mQJI3iAacNhU6U9rK9u5DSvNS h9Fv+sQWNLKjNCxB2t6f84JPILQFRLn519Vf3/Jwv50syK9V3NNai31bnQnUH2y6qOI8 TWZA== X-Gm-Message-State: APjAAAX3aFoNcZ6D3zF9xMcgw1xwU0URKI6Pva66n6mYD4ZIokluljuT Wbu5eqw4rdj4lDa7KS3us+SiHg== X-Google-Smtp-Source: APXvYqxMfoGiYVcKiwFRikncCa+qI0TnCVmdSIl2dnveLE/Y9e5L/NveSMlQa58p67RnT6Ou8Hsfsw== X-Received: by 2002:a7b:c94a:: with SMTP id i10mr15519108wml.97.1561382049688; Mon, 24 Jun 2019 06:14:09 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:09 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 08/10] ARM: davinci: dm644x: switch to using the clocksource driver Date: Mon, 24 Jun 2019 15:13:49 +0200 Message-Id: <20190624131351.3732-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061411_167465_493DB9C8 X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a proper clocksource driver for davinci. Switch the dm644x platform to using it. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/dm644x.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c index 7a6b5a48cae5..24988939ae46 100644 --- a/arch/arm/mach-davinci/dm644x.c +++ b/arch/arm/mach-davinci/dm644x.c @@ -27,7 +27,8 @@ #include #include #include -#include + +#include #include "asp.h" #include "davinci.h" @@ -561,15 +562,15 @@ static struct davinci_id dm644x_ids[] = { }; /* - * T0_BOT: Timer 0, bottom: clockevent source for hrtimers - * T0_TOP: Timer 0, top : clocksource for generic timekeeping - * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) - * T1_TOP: Timer 1, top : + * Bottom half of timer0 is used for clockevent, top half is used for + * clocksource. */ -static struct davinci_timer_info dm644x_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id = T0_BOT, - .clocksource_id = T0_TOP, +static const struct davinci_timer_cfg dm644x_timer_cfg = { + .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K), + .irq = { + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)), + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)), + }, }; static struct plat_serial8250_port dm644x_serial0_platform_data[] = { @@ -647,7 +648,6 @@ static const struct davinci_soc_info davinci_soc_info_dm644x = { .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, .pinmux_pins = dm644x_pins, .pinmux_pins_num = ARRAY_SIZE(dm644x_pins), - .timer_info = &dm644x_timer_info, .emac_pdata = &dm644x_emac_pdata, .sram_dma = 0x00008000, .sram_len = SZ_16K, @@ -669,6 +669,7 @@ void __init dm644x_init_time(void) { void __iomem *pll1, *psc; struct clk *clk; + int rv; clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, DM644X_REF_FREQ); @@ -684,7 +685,8 @@ void __init dm644x_init_time(void) return; } - davinci_timer_init(clk); + rv = davinci_timer_register(clk, &dm644x_timer_cfg); + WARN(rv, "Unable to register the timer: %d\n", rv); } static struct resource dm644x_pll2_resources[] = { From patchwork Mon Jun 24 13:13:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98FA81580 for ; Mon, 24 Jun 2019 13:18:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C03279E0 for ; Mon, 24 Jun 2019 13:18:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D1AB28600; Mon, 24 Jun 2019 13:18:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2188C279E0 for ; Mon, 24 Jun 2019 13:18:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xkp/t7Utiyg0Edvn6tt8dWqEHZNpI/1kj4KrLyG3ZW0=; b=DCFrIeVjFnWirr pwNRNRVvjZWU01XwhtiBq2RG9alJiPxzPxQLt0OHzWvReKE48eJEHg+0RisBKIZHetl8bYkL3Qel0 cYsOF1rQ8Z/LYpFToyDhYN8JWXPR092W16ofAiVgPWXlPGntqz0pfrl/90KM/+uapY0tmhtHzDyYP PTi5yi1zDmVvDJ3tGZgdrEuWiEh/2B1lPzs0sWu3YxzIJo+BQI3EBK/rmZEZg/MSaQT1wlELX4rum fmcUXxISKmUXHHn6iwgK+mzJnWkPoRa0gp0jf6s7Vaq6v4N8W3MkHjET3R7BvnhwxtmTcE2uluKKr i0VbONqb6TItkEgaMaVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOrx-0003J7-Ev; Mon, 24 Jun 2019 13:18:49 +0000 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnT-00085F-Qs for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:13 +0000 Received: by mail-wm1-x341.google.com with SMTP id w9so14246567wmd.1 for ; Mon, 24 Jun 2019 06:14:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4D3o5SEJKsvVBksV7qKTIddf2rG+0VEDDDbyrl2Tbrs=; b=tctRPNjWrC2Vt84gqwVrLJlyUXsOUtGoAseuFGx4UAAS4tI2v37ZBitD/0A73cllC0 HU1E+DYtpMe8p2E7KijS3JKjI7jMsjvzcB6EuRgaG0NrcNS2Yhzs/NXa5W7El3nJBwC/ xC0OJcieyCLFNNtB36ffVb9NZxu0wOd34S39IZL1hs6B+IFlR98/oVeBbphjxDNPGguT j/s87zbGUN9E3zHokCDjT6mTXMw7w0zoST6/kCfpj6K0CMri9sLs5gwRdtYzh2UmsOmS vJhKkM6HD9/hQjhHXiiIyEeeup3cbREjdbNv+k5AVjKlHbRe0NfSTbuVZqYUi2dZuQnP jZ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4D3o5SEJKsvVBksV7qKTIddf2rG+0VEDDDbyrl2Tbrs=; b=mziKx7QkzxXJauZgIrhRAreGDA0wMDZYxYeAEuCTyWvH1k7bXhqrZZSwH98OUBSslR 6VWdeb1rkzdlaLoQoSaOFQmblJAthLJS2yiiowh8saYH91w41FAb1JS766/xiHuibjQw dVLuAtpvfzcTh0filBAHB4l7e8GmWSsqh8I1gXWQIV9mt0FmxUacr2sEwmZ3SRXiey0x p+ANrwiyWK3KCG9tzFUsUOcg8/jkXS6N8LoBaU74B6cugG6V3djjIYoC2vVAkcgvhe/e 4Xv71f7uSvZKvabt8hiCm1sIZvbX5v1qTJ2mzLOWSIHmBgtNLhQVw+G052lSZRBQylqT supA== X-Gm-Message-State: APjAAAVMO2XeyMO8BlgN5lLEJs6QDiaSS3EpGVN6VTOBJQxja75gTrob 4MsKjG9Fk0wYmT2r/4oVVVawCQ== X-Google-Smtp-Source: APXvYqwbRHzkbzEasV7zXLRLlOukqtmx2riVNvJZJOvWanztVmt5mbXS4yH2Y7UyFN3oIUMg2jYf5Q== X-Received: by 2002:a1c:6a06:: with SMTP id f6mr15926991wmc.159.1561382050517; Mon, 24 Jun 2019 06:14:10 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:10 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 09/10] ARM: davinci: dm646x: switch to using the clocksource driver Date: Mon, 24 Jun 2019 15:13:50 +0200 Message-Id: <20190624131351.3732-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061412_165966_ECDFC6C0 X-CRM114-Status: GOOD ( 14.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski We now have a proper clocksource driver for davinci. Switch the dm646x platform to using it. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/dm646x.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c index 97fe533726e9..2b628c31aef4 100644 --- a/arch/arm/mach-davinci/dm646x.c +++ b/arch/arm/mach-davinci/dm646x.c @@ -28,7 +28,8 @@ #include #include #include -#include + +#include #include "asp.h" #include "davinci.h" @@ -501,15 +502,15 @@ static struct davinci_id dm646x_ids[] = { }; /* - * T0_BOT: Timer 0, bottom: clockevent source for hrtimers - * T0_TOP: Timer 0, top : clocksource for generic timekeeping - * T1_BOT: Timer 1, bottom: (used by DSP in TI DSPLink code) - * T1_TOP: Timer 1, top : + * Bottom half of timer0 is used for clockevent, top half is used for + * clocksource. */ -static struct davinci_timer_info dm646x_timer_info = { - .timers = davinci_timer_instance, - .clockevent_id = T0_BOT, - .clocksource_id = T0_TOP, +static const struct davinci_timer_cfg dm646x_timer_cfg = { + .reg = DEFINE_RES_IO(DAVINCI_TIMER0_BASE, SZ_4K), + .irq = { + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12)), + DEFINE_RES_IRQ(DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34)), + }, }; static struct plat_serial8250_port dm646x_serial0_platform_data[] = { @@ -587,7 +588,6 @@ static const struct davinci_soc_info davinci_soc_info_dm646x = { .pinmux_base = DAVINCI_SYSTEM_MODULE_BASE, .pinmux_pins = dm646x_pins, .pinmux_pins_num = ARRAY_SIZE(dm646x_pins), - .timer_info = &dm646x_timer_info, .emac_pdata = &dm646x_emac_pdata, .sram_dma = 0x10010000, .sram_len = SZ_32K, @@ -652,6 +652,7 @@ void __init dm646x_init_time(unsigned long ref_clk_rate, { void __iomem *pll1, *psc; struct clk *clk; + int rv; clk_register_fixed_rate(NULL, "ref_clk", NULL, 0, ref_clk_rate); clk_register_fixed_rate(NULL, "aux_clkin", NULL, 0, aux_clkin_rate); @@ -668,7 +669,8 @@ void __init dm646x_init_time(unsigned long ref_clk_rate, return; } - davinci_timer_init(clk); + rv = davinci_timer_register(clk, &dm646x_timer_cfg); + WARN(rv, "Unable to register the timer: %d\n", rv); } static struct resource dm646x_pll2_resources[] = { From patchwork Mon Jun 24 13:13:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11013095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 51B3813B4 for ; Mon, 24 Jun 2019 13:19:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E7F527FB0 for ; Mon, 24 Jun 2019 13:19:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32BFA28802; Mon, 24 Jun 2019 13:19:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 43D4B27FB0 for ; Mon, 24 Jun 2019 13:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=fowqPeSeoz4SEpXeox+yyPqyg5hEB2aWwiCzS+F3HVc=; b=shndwk58mSxmcb +SwsIpczdNgjySYO4vEYdrTf1S3iDPo6Tya4MFPc5Il073+XiAFp91MbYm332Mdy4Py/Zfi3CzATU IdOmJnasTWQqOQgMfomA1BQPsxjaCqa36kYY9++aBXW5VhZJnI1zbivZsCv7G5Go+Qy17w7h+Qu+K 4eAcPiYXCuSsZdc2bhE5IIGfPd6qaaWLH6nHwp72bDwlqUqCTQemF7MYogn8BqFxTBtKlJcjJH2NQ K/jqcph92Env5mDE5ZnGU7BDbw/5LJQbjikIclSQZRMlygRiA9kWVtAA+Fvn+/lB9EyM0Mk2SYXrj f9Tt+CyD/arkgXVUzqIA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hfOsK-0003Yu-Eu; Mon, 24 Jun 2019 13:19:12 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hfOnV-00085r-KY for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2019 13:14:21 +0000 Received: by mail-wr1-x442.google.com with SMTP id n4so13822344wrw.13 for ; Mon, 24 Jun 2019 06:14:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yBdG0H/gCIPYYVGR+KCWLaRLenPfJFEX87fC2jx+ebM=; b=103W7Ezz8Sq+vjdhV7/0AMmHmATQ8Axg+/Sjz2XF4O45/GLCJDNA94qGb8bDaYymyP 518Zlfce/3WhtK81xGqxRMU3GORSFzELrmvNeii1uxeqLL6iEEYt5Bkale0XLr28EPw+ XtNGb0vBv/DtdHahfFLDkYjzdNFvah82GVVR/1+C16FPfHfAdiWPSIH5HUdHFS2fv7KX oT/O8cftxqkYaNnZmUqq1y5+XrNg9PiGXAQzlK9Awb82RJhuOH4Beh+rngt7XULX80Nv U8M1Y68Uk+OkNvuGTO5sMoh7H6EWK0nbIjyQoJjA0+pnTB4iw95S6D0coaDe383Ixz0+ nr7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yBdG0H/gCIPYYVGR+KCWLaRLenPfJFEX87fC2jx+ebM=; b=Nt2IUtCb8/8uHGSgIdzB8cn5WYUyIrYEl6C66qhVuKBZXRhvRtg39WAe9jRHXgBfRU q0mdOG/vbgDzdfr/RGe2pjcTIfVP5pq5hCKiVs7bX2hETJhj4+YICss/T64uukTOXnzg jRfWrJ4iyWR16YqT2bF/fyUTCqZobOU/4C7VLMHJlriw4y6+2cPoa6RhIOyozxUECg9u oX78PDYEgWud6TWIVHU82Ox3Rs0dBLsBS91o4ZRvUNogG0lVP2F3LLGWW1DAf3wP4Eii d0CTQ+xCZSHxHdAYJEkt9jMzOxnpCTqaxAmS+tfZlz2E5URQbxblZdNAXijvvCGIInpQ swSw== X-Gm-Message-State: APjAAAVRSC1WjoOgd/dSxde72oBoWsfcctVa1VvMR1v47oD+MnHEBiJW wBArqkqqJ9yhotxscd2iVX0Xqg== X-Google-Smtp-Source: APXvYqxBnZi7cHHbvwgMl/dOyfWdsF7yYlN7c4coAtWJC9wtSZmLj0VYNpoISuq8wjy2ZpGntKvdyw== X-Received: by 2002:a5d:5286:: with SMTP id c6mr97995676wrv.118.1561382051388; Mon, 24 Jun 2019 06:14:11 -0700 (PDT) Received: from localhost.localdomain (amontpellier-652-1-281-69.w109-210.abo.wanadoo.fr. [109.210.96.69]) by smtp.gmail.com with ESMTPSA id y2sm9535526wrl.4.2019.06.24.06.14.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 06:14:10 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , David Lechner , Kevin Hilman Subject: [PATCH 10/10] ARM: davinci: remove legacy timer support Date: Mon, 24 Jun 2019 15:13:51 +0200 Message-Id: <20190624131351.3732-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190624131351.3732-1-brgl@bgdev.pl> References: <20190624131351.3732-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190624_061414_078183_6EF338C6 X-CRM114-Status: GOOD ( 20.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski All platforms have now been switched to the new clocksource driver. Remove the old code and various no longer needed bits and pieces. Signed-off-by: Bartosz Golaszewski Reviewed-by: David Lechner --- arch/arm/mach-davinci/Makefile | 3 +- arch/arm/mach-davinci/devices-da8xx.c | 1 - arch/arm/mach-davinci/devices.c | 19 - arch/arm/mach-davinci/include/mach/common.h | 17 - arch/arm/mach-davinci/include/mach/time.h | 33 -- arch/arm/mach-davinci/time.c | 400 -------------------- 6 files changed, 1 insertion(+), 472 deletions(-) delete mode 100644 arch/arm/mach-davinci/include/mach/time.h delete mode 100644 arch/arm/mach-davinci/time.c diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile index f76a8482784f..d9af8c0c0b87 100644 --- a/arch/arm/mach-davinci/Makefile +++ b/arch/arm/mach-davinci/Makefile @@ -5,8 +5,7 @@ # # Common objects -obj-y := time.o serial.o usb.o \ - common.o sram.o +obj-y := serial.o usb.o common.o sram.o obj-$(CONFIG_DAVINCI_MUX) += mux.o diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c index 2d69e704f7f6..feb206bdf6e1 100644 --- a/arch/arm/mach-davinci/devices-da8xx.c +++ b/arch/arm/mach-davinci/devices-da8xx.c @@ -21,7 +21,6 @@ #include #include #include -#include #include "asp.h" #include "cpuidle.h" diff --git a/arch/arm/mach-davinci/devices.c b/arch/arm/mach-davinci/devices.c index 3e447d468845..d912d62a0eca 100644 --- a/arch/arm/mach-davinci/devices.c +++ b/arch/arm/mach-davinci/devices.c @@ -17,7 +17,6 @@ #include #include #include -#include #include "davinci.h" #include "irqs.h" @@ -303,21 +302,3 @@ int davinci_gpio_register(struct resource *res, int size, void *pdata) davinci_gpio_device.dev.platform_data = pdata; return platform_device_register(&davinci_gpio_device); } - -/*-------------------------------------------------------------------------*/ - -/*-------------------------------------------------------------------------*/ - -struct davinci_timer_instance davinci_timer_instance[2] = { - { - .base = DAVINCI_TIMER0_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_TINT0_TINT12), - .top_irq = DAVINCI_INTC_IRQ(IRQ_TINT0_TINT34), - }, - { - .base = DAVINCI_TIMER1_BASE, - .bottom_irq = DAVINCI_INTC_IRQ(IRQ_TINT1_TINT12), - .top_irq = DAVINCI_INTC_IRQ(IRQ_TINT1_TINT34), - }, -}; - diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h index 9526e5da0d33..139b83de011d 100644 --- a/arch/arm/mach-davinci/include/mach/common.h +++ b/arch/arm/mach-davinci/include/mach/common.h @@ -22,22 +22,6 @@ #define DAVINCI_INTC_START NR_IRQS #define DAVINCI_INTC_IRQ(_irqnum) (DAVINCI_INTC_START + (_irqnum)) -void davinci_timer_init(struct clk *clk); - -struct davinci_timer_instance { - u32 base; - u32 bottom_irq; - u32 top_irq; - unsigned long cmp_off; - unsigned int cmp_irq; -}; - -struct davinci_timer_info { - struct davinci_timer_instance *timers; - unsigned int clockevent_id; - unsigned int clocksource_id; -}; - struct davinci_gpio_controller; /* @@ -58,7 +42,6 @@ struct davinci_soc_info { u32 pinmux_base; const struct mux_config *pinmux_pins; unsigned long pinmux_pins_num; - struct davinci_timer_info *timer_info; int gpio_type; u32 gpio_base; unsigned gpio_num; diff --git a/arch/arm/mach-davinci/include/mach/time.h b/arch/arm/mach-davinci/include/mach/time.h deleted file mode 100644 index ba913736990f..000000000000 --- a/arch/arm/mach-davinci/include/mach/time.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Local header file for DaVinci time code. - * - * Author: Kevin Hilman, MontaVista Software, Inc. - * - * 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ -#ifndef __ARCH_ARM_MACH_DAVINCI_TIME_H -#define __ARCH_ARM_MACH_DAVINCI_TIME_H - -#define DAVINCI_TIMER1_BASE (IO_PHYS + 0x21800) - -enum { - T0_BOT, - T0_TOP, - T1_BOT, - T1_TOP, - NUM_TIMERS -}; - -#define IS_TIMER1(id) (id & 0x2) -#define IS_TIMER0(id) (!IS_TIMER1(id)) -#define IS_TIMER_TOP(id) ((id & 0x1)) -#define IS_TIMER_BOT(id) (!IS_TIMER_TOP(id)) - -#define ID_TO_TIMER(id) (IS_TIMER1(id) != 0) - -extern struct davinci_timer_instance davinci_timer_instance[]; - -#endif /* __ARCH_ARM_MACH_DAVINCI_TIME_H */ diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c deleted file mode 100644 index 740410a3bb6a..000000000000 --- a/arch/arm/mach-davinci/time.c +++ /dev/null @@ -1,400 +0,0 @@ -/* - * DaVinci timer subsystem - * - * Author: Kevin Hilman, MontaVista Software, Inc. - * - * 2007 (c) MontaVista Software, Inc. This file is licensed under - * the terms of the GNU General Public License version 2. This program - * is licensed "as is" without any warranty of any kind, whether express - * or implied. - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -static struct clock_event_device clockevent_davinci; -static unsigned int davinci_clock_tick_rate; - -/* - * This driver configures the 2 64-bit count-up timers as 4 independent - * 32-bit count-up timers used as follows: - */ - -enum { - TID_CLOCKEVENT, - TID_CLOCKSOURCE, -}; - -/* Timer register offsets */ -#define PID12 0x0 -#define TIM12 0x10 -#define TIM34 0x14 -#define PRD12 0x18 -#define PRD34 0x1c -#define TCR 0x20 -#define TGCR 0x24 -#define WDTCR 0x28 - -/* Offsets of the 8 compare registers */ -#define CMP12_0 0x60 -#define CMP12_1 0x64 -#define CMP12_2 0x68 -#define CMP12_3 0x6c -#define CMP12_4 0x70 -#define CMP12_5 0x74 -#define CMP12_6 0x78 -#define CMP12_7 0x7c - -/* Timer register bitfields */ -#define TCR_ENAMODE_DISABLE 0x0 -#define TCR_ENAMODE_ONESHOT 0x1 -#define TCR_ENAMODE_PERIODIC 0x2 -#define TCR_ENAMODE_MASK 0x3 - -#define TGCR_TIMMODE_SHIFT 2 -#define TGCR_TIMMODE_64BIT_GP 0x0 -#define TGCR_TIMMODE_32BIT_UNCHAINED 0x1 -#define TGCR_TIMMODE_64BIT_WDOG 0x2 -#define TGCR_TIMMODE_32BIT_CHAINED 0x3 - -#define TGCR_TIM12RS_SHIFT 0 -#define TGCR_TIM34RS_SHIFT 1 -#define TGCR_RESET 0x0 -#define TGCR_UNRESET 0x1 -#define TGCR_RESET_MASK 0x3 - -struct timer_s { - char *name; - unsigned int id; - unsigned long period; - unsigned long opts; - unsigned long flags; - void __iomem *base; - unsigned long tim_off; - unsigned long prd_off; - unsigned long enamode_shift; - struct irqaction irqaction; -}; -static struct timer_s timers[]; - -/* values for 'opts' field of struct timer_s */ -#define TIMER_OPTS_DISABLED 0x01 -#define TIMER_OPTS_ONESHOT 0x02 -#define TIMER_OPTS_PERIODIC 0x04 -#define TIMER_OPTS_STATE_MASK 0x07 - -#define TIMER_OPTS_USE_COMPARE 0x80000000 -#define USING_COMPARE(t) ((t)->opts & TIMER_OPTS_USE_COMPARE) - -static char *id_to_name[] = { - [T0_BOT] = "timer0_0", - [T0_TOP] = "timer0_1", - [T1_BOT] = "timer1_0", - [T1_TOP] = "timer1_1", -}; - -static int timer32_config(struct timer_s *t) -{ - u32 tcr; - struct davinci_soc_info *soc_info = &davinci_soc_info; - - if (USING_COMPARE(t)) { - struct davinci_timer_instance *dtip = - soc_info->timer_info->timers; - int event_timer = ID_TO_TIMER(timers[TID_CLOCKEVENT].id); - - /* - * Next interrupt should be the current time reg value plus - * the new period (using 32-bit unsigned addition/wrapping - * to 0 on overflow). This assumes that the clocksource - * is setup to count to 2^32-1 before wrapping around to 0. - */ - __raw_writel(__raw_readl(t->base + t->tim_off) + t->period, - t->base + dtip[event_timer].cmp_off); - } else { - tcr = __raw_readl(t->base + TCR); - - /* disable timer */ - tcr &= ~(TCR_ENAMODE_MASK << t->enamode_shift); - __raw_writel(tcr, t->base + TCR); - - /* reset counter to zero, set new period */ - __raw_writel(0, t->base + t->tim_off); - __raw_writel(t->period, t->base + t->prd_off); - - /* Set enable mode */ - if (t->opts & TIMER_OPTS_ONESHOT) - tcr |= TCR_ENAMODE_ONESHOT << t->enamode_shift; - else if (t->opts & TIMER_OPTS_PERIODIC) - tcr |= TCR_ENAMODE_PERIODIC << t->enamode_shift; - - __raw_writel(tcr, t->base + TCR); - } - return 0; -} - -static inline u32 timer32_read(struct timer_s *t) -{ - return __raw_readl(t->base + t->tim_off); -} - -static irqreturn_t timer_interrupt(int irq, void *dev_id) -{ - struct clock_event_device *evt = &clockevent_davinci; - - evt->event_handler(evt); - return IRQ_HANDLED; -} - -/* called when 32-bit counter wraps */ -static irqreturn_t freerun_interrupt(int irq, void *dev_id) -{ - return IRQ_HANDLED; -} - -static struct timer_s timers[] = { - [TID_CLOCKEVENT] = { - .name = "clockevent", - .opts = TIMER_OPTS_DISABLED, - .irqaction = { - .flags = IRQF_TIMER, - .handler = timer_interrupt, - } - }, - [TID_CLOCKSOURCE] = { - .name = "free-run counter", - .period = ~0, - .opts = TIMER_OPTS_PERIODIC, - .irqaction = { - .flags = IRQF_TIMER, - .handler = freerun_interrupt, - } - }, -}; - -static void __init timer_init(void) -{ - struct davinci_soc_info *soc_info = &davinci_soc_info; - struct davinci_timer_instance *dtip = soc_info->timer_info->timers; - void __iomem *base[2]; - int i; - - /* Global init of each 64-bit timer as a whole */ - for(i=0; i<2; i++) { - u32 tgcr; - - base[i] = ioremap(dtip[i].base, SZ_4K); - if (WARN_ON(!base[i])) - continue; - - /* Disabled, Internal clock source */ - __raw_writel(0, base[i] + TCR); - - /* reset both timers, no pre-scaler for timer34 */ - tgcr = 0; - __raw_writel(tgcr, base[i] + TGCR); - - /* Set both timers to unchained 32-bit */ - tgcr = TGCR_TIMMODE_32BIT_UNCHAINED << TGCR_TIMMODE_SHIFT; - __raw_writel(tgcr, base[i] + TGCR); - - /* Unreset timers */ - tgcr |= (TGCR_UNRESET << TGCR_TIM12RS_SHIFT) | - (TGCR_UNRESET << TGCR_TIM34RS_SHIFT); - __raw_writel(tgcr, base[i] + TGCR); - - /* Init both counters to zero */ - __raw_writel(0, base[i] + TIM12); - __raw_writel(0, base[i] + TIM34); - } - - /* Init of each timer as a 32-bit timer */ - for (i=0; i< ARRAY_SIZE(timers); i++) { - struct timer_s *t = &timers[i]; - int timer = ID_TO_TIMER(t->id); - u32 irq; - - t->base = base[timer]; - if (!t->base) - continue; - - if (IS_TIMER_BOT(t->id)) { - t->enamode_shift = 6; - t->tim_off = TIM12; - t->prd_off = PRD12; - irq = dtip[timer].bottom_irq; - } else { - t->enamode_shift = 22; - t->tim_off = TIM34; - t->prd_off = PRD34; - irq = dtip[timer].top_irq; - } - - /* Register interrupt */ - t->irqaction.name = t->name; - t->irqaction.dev_id = (void *)t; - - if (t->irqaction.handler != NULL) { - irq = USING_COMPARE(t) ? dtip[i].cmp_irq : irq; - setup_irq(irq, &t->irqaction); - } - } -} - -/* - * clocksource - */ -static u64 read_cycles(struct clocksource *cs) -{ - struct timer_s *t = &timers[TID_CLOCKSOURCE]; - - return (cycles_t)timer32_read(t); -} - -static struct clocksource clocksource_davinci = { - .rating = 300, - .read = read_cycles, - .mask = CLOCKSOURCE_MASK(32), - .flags = CLOCK_SOURCE_IS_CONTINUOUS, -}; - -/* - * Overwrite weak default sched_clock with something more precise - */ -static u64 notrace davinci_read_sched_clock(void) -{ - return timer32_read(&timers[TID_CLOCKSOURCE]); -} - -/* - * clockevent - */ -static int davinci_set_next_event(unsigned long cycles, - struct clock_event_device *evt) -{ - struct timer_s *t = &timers[TID_CLOCKEVENT]; - - t->period = cycles; - timer32_config(t); - return 0; -} - -static int davinci_shutdown(struct clock_event_device *evt) -{ - struct timer_s *t = &timers[TID_CLOCKEVENT]; - - t->opts &= ~TIMER_OPTS_STATE_MASK; - t->opts |= TIMER_OPTS_DISABLED; - return 0; -} - -static int davinci_set_oneshot(struct clock_event_device *evt) -{ - struct timer_s *t = &timers[TID_CLOCKEVENT]; - - t->opts &= ~TIMER_OPTS_STATE_MASK; - t->opts |= TIMER_OPTS_ONESHOT; - return 0; -} - -static int davinci_set_periodic(struct clock_event_device *evt) -{ - struct timer_s *t = &timers[TID_CLOCKEVENT]; - - t->period = davinci_clock_tick_rate / (HZ); - t->opts &= ~TIMER_OPTS_STATE_MASK; - t->opts |= TIMER_OPTS_PERIODIC; - timer32_config(t); - return 0; -} - -static struct clock_event_device clockevent_davinci = { - .features = CLOCK_EVT_FEAT_PERIODIC | - CLOCK_EVT_FEAT_ONESHOT, - .set_next_event = davinci_set_next_event, - .set_state_shutdown = davinci_shutdown, - .set_state_periodic = davinci_set_periodic, - .set_state_oneshot = davinci_set_oneshot, -}; - -void __init davinci_timer_init(struct clk *timer_clk) -{ - struct davinci_soc_info *soc_info = &davinci_soc_info; - unsigned int clockevent_id; - unsigned int clocksource_id; - int i; - - clockevent_id = soc_info->timer_info->clockevent_id; - clocksource_id = soc_info->timer_info->clocksource_id; - - timers[TID_CLOCKEVENT].id = clockevent_id; - timers[TID_CLOCKSOURCE].id = clocksource_id; - - /* - * If using same timer for both clock events & clocksource, - * a compare register must be used to generate an event interrupt. - * This is equivalent to a oneshot timer only (not periodic). - */ - if (clockevent_id == clocksource_id) { - struct davinci_timer_instance *dtip = - soc_info->timer_info->timers; - int event_timer = ID_TO_TIMER(clockevent_id); - - /* Only bottom timers can use compare regs */ - if (IS_TIMER_TOP(clockevent_id)) - pr_warn("%s: Invalid use of system timers. Results unpredictable.\n", - __func__); - else if ((dtip[event_timer].cmp_off == 0) - || (dtip[event_timer].cmp_irq == 0)) - pr_warn("%s: Invalid timer instance setup. Results unpredictable.\n", - __func__); - else { - timers[TID_CLOCKEVENT].opts |= TIMER_OPTS_USE_COMPARE; - clockevent_davinci.features = CLOCK_EVT_FEAT_ONESHOT; - } - } - - BUG_ON(IS_ERR(timer_clk)); - clk_prepare_enable(timer_clk); - - /* init timer hw */ - timer_init(); - - davinci_clock_tick_rate = clk_get_rate(timer_clk); - - /* setup clocksource */ - clocksource_davinci.name = id_to_name[clocksource_id]; - if (clocksource_register_hz(&clocksource_davinci, - davinci_clock_tick_rate)) - pr_err("%s: can't register clocksource!\n", - clocksource_davinci.name); - - sched_clock_register(davinci_read_sched_clock, 32, - davinci_clock_tick_rate); - - /* setup clockevent */ - clockevent_davinci.name = id_to_name[timers[TID_CLOCKEVENT].id]; - - clockevent_davinci.cpumask = cpumask_of(0); - clockevents_config_and_register(&clockevent_davinci, - davinci_clock_tick_rate, 1, 0xfffffffe); - - for (i=0; i< ARRAY_SIZE(timers); i++) - timer32_config(&timers[i]); -}