From patchwork Mon Jul 22 13:17:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11052349 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 58CF9912 for ; Mon, 22 Jul 2019 13:19:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 455191FF29 for ; Mon, 22 Jul 2019 13:19:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 396B926E3A; Mon, 22 Jul 2019 13:19:49 +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 D168A1FF29 for ; Mon, 22 Jul 2019 13:19:48 +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=Ufar89+Giq7jXpX1OTgn4mck5apBkihsc+yiLUciAjI=; b=AMAw0MaL8WE0Ui e7hupigbHBpsi5QG0Td8f4Oq3uPzACgqg+6ThpGrgYIwtpoKvy1lK7DNKmQGZEF8SoV8PEe94AnyU Ajtz7MimV5VKTZuzESagKy8xZmGL5lNSiiB9TgixKreZc3wNFGpyaqt3MYYjZVVm44rpEgyx6zoIL Fx3GKcKUHMG1ugIwv2TZtza+DxH7Agfwbn0DtTEEVL1fmwJEwDvXLQFbtac1BoDJHhv8pVXKs3Fz5 /UWZZ1ICvaUkP4P+2lp6QKn6e3qIrS7+nj9GKk8dKAMAqwCtxVPaR8bZwEAfm7KFbtd2p2Hqt8yqb P2t+4gM/HwZGfkaLePGw==; 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 1hpYEB-0005w7-Ra; Mon, 22 Jul 2019 13:19:44 +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 1hpYCU-0004a4-O0 for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:00 +0000 Received: by mail-wr1-x441.google.com with SMTP id x4so39354354wrt.6 for ; Mon, 22 Jul 2019 06:17:53 -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=Y1ffjQ0IDz3Rx/A0gmq8SxV+cunonTZVAynZexDe78o=; b=x1issdWAgb0eS09Lxw7xPwhpwTU/39XeACBh9kB60ut2VxtDWkMyag4EgQnTlwUfcf yMqzIL8posvumO6ojHZU+KQZKHkPAw0TxUCc1gmsUz2RVLABK2P9nilaNmQFpxpXZe4R 558gUEn1aEzsxJgffzJ00EpOjdSOUZtdK4jdgB7FxC7chGee4Ja/xYIG8jJQfLPynNzN xInD69jezWLr0edoE1fOOGAGfi4KPZlfm9BWTJ+GRtXqjwwKBtLZI8NDotGACdm1JFnT 0Kb4dQWEo7m/0EG6jO5yAXsTFfNWyy6543RHwZpFOkLoye+XrXDF09gecVRHlC29kGJU nFMA== 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=Y1ffjQ0IDz3Rx/A0gmq8SxV+cunonTZVAynZexDe78o=; b=kLYckOJReGDc8QK7QM/sV8omjHN0xBID4zP7pGPFGHllaH8nh7A8P7ZNyJpjmUamjU m48/Eoxgj4pbCm+J8CHnuJDNj6rO0jfq3WfYI5rL2WAL34LYKBSBWLWcB5LjlRn7eeI4 8lt+pWkU7gaVqOECgOtxwEucdLo/vrS9A11dzz8QMt9eWF6Dgii9AYi9VkzZgegm7iLb WT4fg5n4KCuPiZps/IPbj03omODYuGZh3WP+0W4sXgC4jD+D/OrLN6B2II4RFN0UqEuR m5UzTTy+6bAssJW8Hximg0KUslEIhVU/aM67syxMCxE+2V0NY1NAWLMZYbN9rCHTxx4c 6wsg== X-Gm-Message-State: APjAAAVcff9HPQr/LIEECI43YO1cPZmUPmECHwkgSit/p/BvjTKCJlDx 129dIdWOxYLl3KBi08fYlkI= X-Google-Smtp-Source: APXvYqxAM4HVkzwLrfr/Q9QNR2M395lkxfoX//pzPMx9anNZm+rzLlLqHPhKZOS4R2VQWLj7Nv8Zsg== X-Received: by 2002:a5d:6144:: with SMTP id y4mr76325444wrt.84.1563801472845; Mon, 22 Jul 2019 06:17:52 -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 z6sm34156657wrw.2.2019.07.22.06.17.51 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:52 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 01/10] ARM: davinci: enable the clocksource driver for DT mode Date: Mon, 22 Jul 2019 15:17:39 +0200 Message-Id: <20190722131748.30319-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061758_873815_3F853829 X-CRM114-Status: GOOD ( 11.51 ) 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, David Lechner 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 33b00579beff..92ff58be1a43 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -583,6 +583,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 Jul 22 13:17:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11052339 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 E83A8912 for ; Mon, 22 Jul 2019 13:18:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D442C1FF29 for ; Mon, 22 Jul 2019 13:18:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C7FA721BED; Mon, 22 Jul 2019 13:18:25 +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 613441FF29 for ; Mon, 22 Jul 2019 13:18:25 +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=XFxBiXbbGmpFRm TiGnhDqpH8ukgN0ClZSsy7yNfodTUzX3KffSE4+7RnqbBMt0qgPp97koDDttV7Lm6oTH1ElQ4IFPa esUpuVmLM7xebKg41QrJV6mzKcJ/lIMs+UJu1csVCHMHEXRZ1vT32f1TEZbVbzNT1AZhCHxzHlM6S LSxV4kzFJY1k9ZDRBtdTO4un0OeNJtIfeekBwA6YfRMUQ+yBvsOliWnDr+YJg/ckdzuogbQOfKPAk 7LGee1EgTSByAU0jdU7pq+qtX6liUkBe6k33lIcG5PT46/3fepuWn1+NwKo2DEHlKa7Z478johpvx j794kSLIUfdNGseOp6kg==; 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 1hpYCo-0004yv-M9; Mon, 22 Jul 2019 13:18:18 +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 1hpYCS-0004dL-29 for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:17:58 +0000 Received: by mail-wr1-x442.google.com with SMTP id p17so39354416wrf.11 for ; Mon, 22 Jul 2019 06:17:54 -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=JupiVnuDy2n2aPCZgFJmLG37jMrOtH0zvxXZZQu8FgDcankNuQTwvQDYy0I5IzsJSA F8KruVAy701YL+AZHs5cwB0d/pqodtxmtqFzGF++S/CBkO48zLx4Xh2Oni/wMRatRfn9 jnm+eMPB+Jqtswlu7JHM+e/gIpjJULO0sTX+hGynCJsZDxeRY52bMDx5veq+Dt5nmjDE udir5IJWjd+ptyx7uXEBNNdp3CXvOASNAYE28jdL0A2UblFhIuyi/bRTLh9xXgOhrU/5 DQ9V2zBkS3YZhJrn7pmGDZOwBuU1hUGwr2fW5jQJA5ucCgRdjem/A/NVZyb1hJygiQEb Nu0Q== 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=nwJwBGKdAWfKAxQm8eTVFrVr0b2A6063p3pPsrwvACaOEscaGJN9pq5mNAmBN45Goj ePYMoOkyd4FdfUR4QvOHZERNNe/bdOdEAzLvnrqJDJnODp86zlV0fJzxYdjByL6n7r4P jcWPzaMAuBYMEyO1ZbtSSLViWGCpsAKdztdwRWrt5PhRebYGYcve8lf82OSx5vIols3F Qka2jW9/P7BX3nacZJwBdGOruhhSSUtWY5Vq7hCTPWksR+EBOB56bH6s5lwu9o33mQQg OR9MZaD9bLG9GChLHim9EiDKyswYx8EVJ4CPDp8pyhSsLMuDMvXSDDGrgo70GpPA5Nyk 4bnw== X-Gm-Message-State: APjAAAVPyx3XicQH5kV4m7mqfhTYmPhBO8zLZcNKKF0DPK0RVXQU57oR MYzCo96dgKA9FUF6Rscs8CM= X-Google-Smtp-Source: APXvYqzqJfinGvtWGLtZwmywOZm3G950NbAUa+GIqCAGlJY4Nyl0B4GPHLntvvYmvyc3AYD8ddwjBA== X-Received: by 2002:adf:f591:: with SMTP id f17mr60699781wro.119.1563801473928; Mon, 22 Jul 2019 06:17:53 -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 z6sm34156657wrw.2.2019.07.22.06.17.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:53 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 02/10] ARM: davinci: WARN_ON() if clk_get() fails Date: Mon, 22 Jul 2019 15:17:40 +0200 Message-Id: <20190722131748.30319-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061756_303388_5CA51C53 X-CRM114-Status: GOOD ( 10.57 ) 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, David Lechner 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 Jul 22 13:17:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 11052347 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 CC9426C5 for ; Mon, 22 Jul 2019 13:19:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B81F41FF29 for ; Mon, 22 Jul 2019 13:19:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC21E21BED; Mon, 22 Jul 2019 13:19: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 4C21B1FF29 for ; Mon, 22 Jul 2019 13:19: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=PykJusaKaBeyDJeDoUGVWtHHuxQHnFdsHvOthNrZKLI=; b=jIAthUyOooXx7f 7xlXHWONPcO2s5HARBMnpQigrM0MGPXNMVyV+PvxSpQWilZlKHi8rM8OmpNPCn42860Qci8S86OSs 50RwKOwZ59i9DFWmt76Yw4R/eJIluTzEoaC0q4v8eJYQpZp1pVX8rwNVjyJ2hXI8thKWNBFYEeOv1 ONcxsHlZT+PukTP3sjaXh8sb4bWWkrbXpuItJP2TGuYagwyYosj6paueiGMA9S6Y8kCWOX+juZF/n mcJ8qhPtpEa4nCMe26n2xn+fMZ2je2pgs/EabV2UlXUDhSRL5BYZhnRxfbqgCpGMN27dtZQAsHwMq zPAxlIGD5zXLcq8pLWNQ==; 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 1hpYDt-0005hJ-7m; Mon, 22 Jul 2019 13:19:25 +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 1hpYCS-0004gf-9b for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:00 +0000 Received: by mail-wr1-x442.google.com with SMTP id n9so14323188wrr.4 for ; Mon, 22 Jul 2019 06:17:56 -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=V4ffy7qaldHxXOW637TnRc8jd4OhS2z4gsD5AYpaXcCZESdUK0AfrgWtzRDSSqXGvj Of3DZBBCQNX6ZRRLgm/0gVh0JTl2W4itIFUcz9DQpYY13n7LX6WzGDrFdPBGic9LHvIX e7T4uYwZes+pCnyj7ZazNJuvCAY6Do29Hvqb10n2baCDFupmi87VZYQofXz4kV2mEDkX tppnTIMcm0ZMqz8Ial3dSWWckPYbDxaq5o2I7I4jWIy3Ant+GcZrWvH+fnr3QVoS8XNz 9YAZp0fz0auVdH7NeHlthaAAsREkkVNAkn/OttSXYFxhRpIe6iVMKJQxyDQs5c+cdfhn UyzQ== 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=gvh6idlcLJwnX22LsWmZejpGE3i8T+cquWAlw6oJYMSUqLcWMTOvo8TvHvJ/ONRR+d ciccGNlMf9d/A5mvqC9/7NR9e7o5RKY1COTfivF1cXxQA7NB8zNrkkhm6IJxve1uLkz9 t18uFmraVeI6lozn3853qg5XSjt1aHntoP6xMtFRgkHZNUgu9zGrJc21elNWeIbyMh/J nRHVGhyPu9bbrNcDGtBqxjnqVdpcnmmwWEBGQiv3Dd+DQe+qS7xgflvmQvTenFDhMv53 aJUXL1iOLKSalx60n1c5Y7lmQ8GxmaKYJ6TvmUToU0M2IMbvpvIe/rk/El0fYut5uLu9 1+tA== X-Gm-Message-State: APjAAAXddGIgLIeeLnhNFfXxsjQOerk7Zz0vn1I52k4d0otU18mvaKGh h4LnGlXiuUrqvuJ6hcbEiEE= X-Google-Smtp-Source: APXvYqzUWqhOPEknMtjGYiPGDW6HTsZ2oiF2bxO9d/89b9+L75EvdD+mPxU4ah2qHmVKGhwRbtcKEg== X-Received: by 2002:a5d:6a52:: with SMTP id t18mr37194421wrw.178.1563801475117; Mon, 22 Jul 2019 06:17:55 -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 z6sm34156657wrw.2.2019.07.22.06.17.54 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:54 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 03/10] ARM: davinci: da850: switch to using the clocksource driver Date: Mon, 22 Jul 2019 15:17:41 +0200 Message-Id: <20190722131748.30319-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061757_244499_CAF9D8BA X-CRM114-Status: GOOD ( 13.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, David Lechner 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 Jul 22 13:17: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: 11052353 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 B1FC36C5 for ; Mon, 22 Jul 2019 13:20:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D05B1FF62 for ; Mon, 22 Jul 2019 13:20:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9065820134; Mon, 22 Jul 2019 13:20:44 +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 20EF11FF62 for ; Mon, 22 Jul 2019 13:20:44 +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=pMi+/s8OZNOcLE RqFDVIrQZHymth6gwkL8F7EX6Fm9wLL5UD3UeiLVEmwtPTRW0pCiOts2xzUatlZkboGZserLKHEkD LR3mcAUpmQB7uZHrNCF1OEm8384J76RUdOGHtYWIbW7cYuyRIFVzeJFvRSl5nBgXmjjdvx/yrnxBT 53uodTwE7xP3mfDq5tTYy7Ky955cUhnIqShrGMIDA5ymmzNB7KAZNQD3rx3B96LVDwmfkOJ2UXd3g AZoGm5IUJj73SRoVId37ufjhrcFVTxRlZJaT+XYnotjLh27g/yvI+GZCAlr3UU5VtA/24z6qbOY8z NU+5wbFbFolYKP7GAJMQ==; 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 1hpYF3-0007al-Oz; Mon, 22 Jul 2019 13:20:37 +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 1hpYCV-0004jY-9c for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:01 +0000 Received: by mail-wm1-x342.google.com with SMTP id a15so35134907wmj.5 for ; Mon, 22 Jul 2019 06:17:57 -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=mkotl6aKmS6IdISEAzL4effKL/yQ4f6Bflxe7dR33J3CkOqOXN/0ikxRpbq4KKx9W3 /1mj4oIHUAzy52gQp4Zp+PzmgW0uZAS3wgBOZ2iL/HdgMOborcG8TouHXo166FX8K2OM yudmdMwNeMOfKrbPArt0B8WcxGvdTeEvBf/pqCjAviSWPCZiAMPFXOlX3QUF8hVeDpjL RzTgxAlNRTBum3vlSnwA7WzklbPJKUW5/o9yzmFBF1ZfmwK4suB0IU95C9bohcv5vzZx /KUPAaYzUzjWVaE6N5wDF5fzFlwCbnLW2o0ySguPGm3TnMu66TsKZrS5TdNwjS30RiBU 584g== 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=ESZQdDwMsgoS2CU466ewG7ay+4r9LhStQXXB7+luVOOWvmc02dVcj12oAdCos6zpuV Ybtpc6o/L6BwOkeHHzYHZwBbK5nXSgknDDvflmfCVDi9iqWJuHz0YHxiEWZMBC3YdAhK 5gJI8OaMia5zQ+50B0nBY2aKgBJr7iYdPY6ZXfVSruzkR/bWtNoM4N7i15fXroR4wPhD 9H4VaZT4eDWiTa9qUHnbLwZFi0EorGSQmOHLQ7ZGesqJ7mxu2Q0pU9aw2UXAREH5OMgO nMrNnC0uHQIhhde4otzRTZ2onAlBcue2Hm3KomBH+32nQg0Drp5clk1Ej1+k1UwkzsHI zXBw== X-Gm-Message-State: APjAAAV/2vsEjbCjd6EHQBVUHMW0P0j9ntOHrbk5R+o3KFCtSbuJXP8I qIE0f4LZMKJeaqViNVCp1Po= X-Google-Smtp-Source: APXvYqxw087DX8W4z4K8oPGRqejCwotCKfuU4fP4ThXxJdSTKyrurerZBfN0BApuTQqtr0i1pjtIRg== X-Received: by 2002:a7b:c247:: with SMTP id b7mr66573345wmj.13.1563801475995; Mon, 22 Jul 2019 06:17:55 -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 z6sm34156657wrw.2.2019.07.22.06.17.55 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:55 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 04/10] ARM: davinci: da830: switch to using the clocksource driver Date: Mon, 22 Jul 2019 15:17:42 +0200 Message-Id: <20190722131748.30319-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061759_632127_3689FF55 X-CRM114-Status: GOOD ( 14.09 ) 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, David Lechner 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 Jul 22 13:17: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: 11052345 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 C8D946C5 for ; Mon, 22 Jul 2019 13:19:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B132C1FF29 for ; Mon, 22 Jul 2019 13:19:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EE3921BED; Mon, 22 Jul 2019 13:19:10 +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 46E9E1FF29 for ; Mon, 22 Jul 2019 13:19:10 +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=ioKdj8aY3itp5p cddRScv4GbzAGcvQZutM54tpYP5FDcb3DkXYharSPKUT5KNRycJ0a+hC5IcChp2NkQLHEkgfIvD72 sRdxCtGwAnRPdbyGjFvpv2vezFczOgtqqAc4rhAbgtK9dEzFba9JMieb/6YXShm/NIG3qETNNeCOr T1rRiE2jlTQ4lMy8OdPTjCeebx7wckaS2CualrT9cpgnDhS/I+ge5yc78KRpt/TNxSMkVchzDkkRP zSZNeKmMZz6pg4j0Q+lhc4DmsYeXp6Leo1vIeZDDOiSUDElzLdjojoipJGNPOuqjgZzbH/unctSH0 khR3rkccBsglwpuG8vFQ==; 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 1hpYDY-0005TS-Ga; Mon, 22 Jul 2019 13:19:04 +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 1hpYCU-0004lY-5z for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:00 +0000 Received: by mail-wr1-x442.google.com with SMTP id n4so39456866wrs.3 for ; Mon, 22 Jul 2019 06:17:58 -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=pIoC9oM2SJ5bTQ+eRC7d6ReZipWlFuv8mhyOuLWGmoiM8hihjKDbcYzk6hANScrgJN rW05dvNGO4vHZr4dMUEDVyGjjjkB2g5tV8ivnNDEywzlkYWYyP/3Vlq6BTNwMjUcC6DY stoKLsBEJ9Kpf12vzhujsvcYIhPxHMZfEuKIPQBcLMVeL32Lml1EKxjHmsp6ic+ayM0X R6xwxui+6Mp9JKkkz1/pKDBpveHOE12dVpW70c1oXe+UbW+C4k8HFEDPISpAj+uiGS1i BpS1re/U9WlWq6XGrylr1Xep7OvA/lahP+EhtkjgH1pAZ3T4a+2opzxxmr/W+wrv/oCB QmXw== 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=V6EyRRlZAWXh0edFlx2OYAuJqkjCbbLpJVAX4L7djXbTBrJs9004Hwg5kESxMopLo+ oiLpKr1BeX1WS0M3+u16xWyRHdCCggJ6k6P2DMt3vp5sT9AlhvNu2Ehr9Q9mWqdLWXjs uCCU5BwLIuU5SGyUKGr5feM5diZS2nsSweN3d5aIpgbTjxPyuy78Z8XdxOLpbZn80gZn AO0V/dKTtiuPhcg4SJixmY0ykMy5/iafm4uim8bH58pR+tr909GKAq0Lszt8W/NFNPnd ltBPlQM5F31aV6M0V7DACQLT4QuGcTJlQYB9y33eVCV3XQg0Rv6rJwDpphRtmcFccce6 zZYA== X-Gm-Message-State: APjAAAUeaTURy5jFNZg4qHTqH3dVTgz/Ei83ZlaI0wvaDBhY/UCvyYM0 +HsD9Z7TLGcxC4+egOPI7A8= X-Google-Smtp-Source: APXvYqz3On9bPHv79/RsBc+0dwicwKP6apaQW2ZmacAnsdUnKzLS+lJLsX2BS/W4UpcSrcRApRCn9g== X-Received: by 2002:a5d:4e4d:: with SMTP id r13mr25919456wrt.295.1563801477023; Mon, 22 Jul 2019 06:17:57 -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 z6sm34156657wrw.2.2019.07.22.06.17.56 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:56 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 05/10] ARM: davinci: move timer definitions to davinci.h Date: Mon, 22 Jul 2019 15:17:43 +0200 Message-Id: <20190722131748.30319-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061758_482899_879E2307 X-CRM114-Status: GOOD ( 11.04 ) 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, David Lechner 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 Jul 22 13:17: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: 11052351 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 0D926912 for ; Mon, 22 Jul 2019 13:20:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EABDC1FF29 for ; Mon, 22 Jul 2019 13:20:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D989A26E3A; Mon, 22 Jul 2019 13:20:30 +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 776581FF29 for ; Mon, 22 Jul 2019 13:20:25 +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=Va61hRooMq2c9O OubLhBFRdoR1wrNkp+lqf1TcqSaMyvPMcnnn+NpUFK/QbWvsJwLBvwFm8Cn7fe02JSuXqNInF+Jez fabrSQ8/IvfORSFRdHmkv4Bt/1xI3teK5anzilk1rnFSJtNAclrNBeZsPL3SeNr62B12ikKnvKcoF mkdZe69b63PokpQOeUsQDcfQwnclF1n+kY++Z9f8VIT7rJtHcoK9/QjrgbvcobGr66KoKBiLQwFoy CrLxK41lNDajNTyH0WF4qIjmBjD+hJbWAwXxVJqOJ9SNlHDG981pUxLB6pDUdR1BCPZ6hP6oI6qfd KA/DUPMS7Sh5qRSHapyg==; 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 1hpYEg-0006Uh-9f; Mon, 22 Jul 2019 13:20:14 +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 1hpYCV-0004ma-Ef for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:01 +0000 Received: by mail-wr1-x443.google.com with SMTP id n9so39465938wru.0 for ; Mon, 22 Jul 2019 06:17:59 -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=PQw+pP1iXX72GVQ9kohjgqtP+wTw65TQAgRYVrUlgLjAVsRxK4c4+l/lntTh00Q9M3 8teC3SYE0xetvNP5nkU6e4YBh4V4GrB3q+Lq0BP4EqB2/wLVtArQllQ+r4GMx1RlKBBd puuo7oASjqffQkBoxzRoQkZtvjPdz2ZeysMOf+8UE5BM202tQ3SVxz7nl+GUjon+AEbI cUMLG2f1a00E9Hp4Szm87vNMnwxnJanc041SLIt4+l+9rU/XP4mOI5RDFmWLjEjorkPe pMLYh8h/tOOkwTzFMwBXpg9yuYlnTB00OPzHStXOCmQrEbb/lLFLR4Fx9+lPAKaV+zQX t9Nw== 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=najSJ69drdTME4Xxy9LqEx6V1LKnE4CYrSmNwOh5d96bSUxbFZ+969KLp3vBYkAvCh lgPJRjMDCW09aQX+ZPzbMeBxDjqSuMPKN0DXFyBTGa7LYo7NhdQVyi75JpMlcX3m+LB0 r13XaSWBHsQ7bc4+j7QLNS3RafDmFb4dbXeCvUq0asWVFjRCNmBMCd6bCi1AZQ94Ibcp ZGjwq9+yGJ14cjD5InukPMeJR926RFbgIZus+u1Yr6xbhP/ISF+SZD5wwP86WR0rGdZx eJuaBWZ8kfr4IKjtUf7ROEsn/2MiDthO4lE3QryF/jVr0CXh+Myo3tNu5bVscxBa/N7g DoQg== X-Gm-Message-State: APjAAAXS5WMbkEurikiIwPTAB4MmiTNrFd4Sas6QNdJ2w8Mq/5Jd5vxB Hx5CsXdOvo53Bx0ApX904aw= X-Google-Smtp-Source: APXvYqw5kSAQACR7OW4MuKFZ+QqrkrmM83HBxycXSdQYRQePn0m/CpYbJW8RlJw372HR07CxxdrZxQ== X-Received: by 2002:a5d:6709:: with SMTP id o9mr19402007wru.301.1563801477974; Mon, 22 Jul 2019 06:17:57 -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 z6sm34156657wrw.2.2019.07.22.06.17.57 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:57 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 06/10] ARM: davinci: dm355: switch to using the clocksource driver Date: Mon, 22 Jul 2019 15:17:44 +0200 Message-Id: <20190722131748.30319-7-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061759_630031_B17071E3 X-CRM114-Status: GOOD ( 13.81 ) 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, David Lechner 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 Jul 22 13:17: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: 11052357 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 512016C5 for ; Mon, 22 Jul 2019 13:21:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E48627FC0 for ; Mon, 22 Jul 2019 13:21:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 328D32837E; Mon, 22 Jul 2019 13:21:22 +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 D08C627FC0 for ; Mon, 22 Jul 2019 13:21:21 +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=K2aJeT8GiR0EWG 8mLDzk0/+2cJWS4s9d1hjOSgUw5PApzZdXQIK4iWbAv/05Q96J4Z9HEESe3V49tk8828rJGvfw3Vm UmWjPW5PecRx8FuoKLiQogp1OG3MlMIbZkWdLPD3lM43T5/JrtSVBavFx+CBcH+WRxZTBmTZFk3vS Hf4UGvgVcf2Ur6bk8hIEc/QP5AbwQUDPqGD7iZuIDNsQ7G8slaBlASshGAoJbEzj5B07WZAJxy8FU EkPHZbfXyj67V/FHUCiaVMtXDoHy0vgbeFXaGI4qXVr4RZrBDkF1JqgtXSvRgRVZJ2LTpqE/+flQB Itf0v7zdrquviUlfEqTA==; 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 1hpYFj-0007qB-R9; Mon, 22 Jul 2019 13:21:20 +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 1hpYCW-0004nX-1q for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:01 +0000 Received: by mail-wr1-x442.google.com with SMTP id r1so39383952wrl.7 for ; Mon, 22 Jul 2019 06:17:59 -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=DsDrdUquw3YNnBzyEWqWdI+Cnfy6Fuvtlxefcq7vLIqQu9bYaNFyXVPtdG0VhmtOt1 jPjkrCH4S9jJwJIUfomAlL35Jg+buseKoulSgicwy7YtYH0aLc5gMNd5buv6y7ufo5fP /jM319NAu7NqGRg5qnv+LPCISXZ2vCD8SP5JNc/Gszn3x2SI0qBV2aQ4LdoM6GpHnybs Iy8jYLrMqWUDEOQ5miMz5tfL1PBoX9GCwLOozl9sqv7rRhgBS0BueM0N+t4lR0YqqXlo mbkfrhlSdzEW47X2cvAz20UX0YtCRcafjiQmVcUbseybZ7AU02C+j/4igUBBI/Gbmens HP7g== 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=dsQOGnIRQJxd6/jGE55L2ZjRbo2ntItsOCR0U8zk+qut3aKfZ/qidkUlvywVtd95K7 4MPi0HdSBwE0eFDnW0Yku7wi04gpfZtwEcUG2ZCVZ92i6hio+waJZbmGmKYJkeRPOxzM xc1whVHemVBox6C/gpt3ji8pmjU0rbrDJXOyThkL4G1nUn4PI/57m02oxvRByO2CP6C8 w+Wbynp9r13WQgB/NqLdrWo+lCcgAUtl6KspOTJuGFfHObrH/7cO4/inM+hHlD6HGDNN EdiECeA5wHPd3j7OlkR8t9PvHDbAprweCbAXsXYvGSYCSbZ5ce3jpR9PcyOfzowi11Jc q4GQ== X-Gm-Message-State: APjAAAUKNrXJYrrggxvHgDZMzF9AG6+2z0MZMqjo/0LNrpdEFP2SqzqW IcCRVJ906HplmrXNu/uhN8VvR+SE X-Google-Smtp-Source: APXvYqx03dcJEB7dW7BRLPq2VnDhGkGWV+spKrTYqsXZx5pmb7YimlWrjM6/E+UJDvKDOeIoVr/LYA== X-Received: by 2002:adf:f348:: with SMTP id e8mr77592071wrp.76.1563801478939; Mon, 22 Jul 2019 06:17:58 -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 z6sm34156657wrw.2.2019.07.22.06.17.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:58 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 07/10] ARM: davinci: dm365: switch to using the clocksource driver Date: Mon, 22 Jul 2019 15:17:45 +0200 Message-Id: <20190722131748.30319-8-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061800_566242_562C8074 X-CRM114-Status: GOOD ( 13.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, David Lechner 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 Jul 22 13:17: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: 11052359 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 382721399 for ; Mon, 22 Jul 2019 13:21:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 236CB2821F for ; Mon, 22 Jul 2019 13:21:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D4628387; Mon, 22 Jul 2019 13:21:52 +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 A59E62821F for ; Mon, 22 Jul 2019 13:21:51 +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=Po87ZG1AFI/DDy Z5aRIbSfxA/tzQDEC7Zb9c4EGQcF017u6KZphUcENKYKaju1F1iEpPBAK97SOeP+7PnKvQRilS5/U NuEoDNAQpsMZVMX/yAMET0vwCY/4aYIaMvva45ELfH1N42XQWC4mGw4xSSCkNkz4cuAU2Ca9T+haf I75kR8sN28jNZ+xTcqWcDpASueeimxsyRw63FvNkmUsJeq+bFdi/m7rtmCdQa0s5bMf7YzmEv06TZ km3bISWax6kk08BEWmOtJ8zYfgyz+UOBeQrD3evzwZNw5TJIy21uPFP1E5x06dXmsbTtIrvlK2/4p Wum1LwsgsCyanUYPhAfw==; 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 1hpYGA-00084d-22; Mon, 22 Jul 2019 13:21:46 +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 1hpYCX-0004oa-1T for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:02 +0000 Received: by mail-wr1-x443.google.com with SMTP id c2so36193235wrm.8 for ; Mon, 22 Jul 2019 06:18:00 -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=GSo6+MOVPcgHTb7xbyvoyhWlDXlsu4/zI6ivXXcgl85lYOIGmZx2/jvT8mhZUACRiT h3ZZfHoiSds/60N6vj96oXVCSZ0TOeBDEU2W78+W2lJUrIdeAfjKaGWhYKxlHciGYV03 gG1in5QvaGNEypqRhOBeWWr6Wbqy1bmZmm/x7BsW6PM68SeKiX4mnhADT+mmFwdxroE4 YsLaJJIleuAv+2C+jrQsg/Ymg8xobbI/i//FGAHpYX5re5/+4QjO9vYzT0c7L4RBaigH RUks7rJF6oRgx68nqVpOmg2+EoBFQFfIPsWj4tqtbKLjCXG2mOKSjJy7VTIijAxazQDJ /uIg== 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=kbd5o4U/E3xmJLU+kCbg8ILJFfDpgQCuu/yqMw5yt1BxHuF5EG4ULJqEliqwZhfbGM xGo6YIduvBPqZnCnkGEuxJEpMtOvcjN2NoyUEss9XAP3CGoyJF3YvfE3/xT7NHkMK7LQ DaL1zJgZ5fAF3nhpBTm2Bo2OeTXN+Uol3+83Ay5pMJr9DLD3nL+vcAiVHjsdhyFitE1+ jZ98qKtdbPmG26JMrbcdbSdujW9hnmNTVNAkwGRgIIWE+HeN1n74GrS5bQqo1yxVfLle w0hylZiKPikYYUwkFbeonjtrmVtFaHoqtS1K75EUsqt/dvHEP2V/Lf73wnkySOW6B4xt NGgQ== X-Gm-Message-State: APjAAAW+1S1UWavCyDBgYtuzj1p2uqLvcd8kfjFGIUPM9y8xzu9mf9qF wQFMBkpk+UrOE9tsnAglFVdFou0g X-Google-Smtp-Source: APXvYqzXZRF64uLK/Lk8tIovJHppdfZWIS3sBB241bHdwb7Mo3MMlQp00WuciSsyOrKeoxESAqltuA== X-Received: by 2002:adf:cd04:: with SMTP id w4mr24072931wrm.230.1563801479923; Mon, 22 Jul 2019 06:17:59 -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 z6sm34156657wrw.2.2019.07.22.06.17.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:17:59 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 08/10] ARM: davinci: dm644x: switch to using the clocksource driver Date: Mon, 22 Jul 2019 15:17:46 +0200 Message-Id: <20190722131748.30319-9-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061801_236917_B3731F26 X-CRM114-Status: GOOD ( 13.72 ) 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, David Lechner 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 Jul 22 13:17: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: 11052361 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 0A4AD912 for ; Mon, 22 Jul 2019 13:22:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E73C827FC0 for ; Mon, 22 Jul 2019 13:22:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D885D2837E; Mon, 22 Jul 2019 13:22: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 672FA27FC0 for ; Mon, 22 Jul 2019 13:22:19 +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=JqfZfButB4RO7H OKYVFDYXm1xMpWpZPf/gCCFGaUNtvdXrda9eO5+ThiYLb4ughINWvGUyAi+ybTXx6912HK2By8lTI YIjmM40BfMUCRtOQavSp26SVnfyZopKlOwHBUehotIorwZUx6YdqBLu3mzXaHl1Z1hNohEA83Aalv NZT+vo7I5r/hTH5o3jWXP67Pu+IMSODCtAXAL+27zUGC8xq0ig0RLSNrySkgUFe8AAfmYfjEbPdtR ziH8/aBjphliFAq82p8aGiUwyPoLn99O5eipOhLNBTuERdxERzOzwEObAtxNLeAfx29fSCxZChfqj eObHw8MA/aalTASX0Tvg==; 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 1hpYGg-0008Ig-LD; Mon, 22 Jul 2019 13:22:18 +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 1hpYCY-0004q0-3S for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:03 +0000 Received: by mail-wr1-x441.google.com with SMTP id n9so39466091wru.0 for ; Mon, 22 Jul 2019 06:18:01 -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=yGPiN2mvApoi3Tmm1BR9ii6bxGVu2gVZidX5Rhf9EF6Ra8xLEiReChUQpbJa/YNy89 LlpaYNPoJWUZ860/PdyDvr9hA/0guKHAzs8puaHH9mSnCANpjoBP4ZwoCTMJrvjx6xd2 xXfnXRR+mQIiP2f8OR8NTtHZZ4/VSNbbQ99V3sbC2fuY3Pd/ZahnnYxxst8DgYXCiInB vAByCJP+BsDSCso/uvMmd125+kmYV2pMSd6fqssjfS2dVt0al/c7x+G9ek8BNZUUAAlt tqksMV6DFPHeR/NlXKkzQTasWOCnQSjdSEyzLrds0S8i079xu2YH9h6bn31UGg/EzRPR rl3g== 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=mVDkmnw/76ERTIfM7GflwfS+NI8yYaYVp9GOvQbknmiWwrmr4Eo3Ispz3aocKTnhEN X+aMI3xx2GeOWibS/YG4sM4BgLMlkep1XHfwaR9DMyZIOWC/5MzmbPV9AN2XskvR6MR1 u+sLsZFUXkOOUPyFTq83gln6a8Rkur9k7qe1/GL/vihZZx8b8hKm0jHcgMya5ArWD/oM +QFa+kKu0A6Q3Lp7D+hNA2iLd0fTGr9Obe9WFIen1X9I/qPk9RH5WCe94yFiSVBNa0kS Y+sLjElkKEmhcOyytwtSChMnOioDBrBsFt/o/v7+1zx83cmwQVXXnd6+xpTA5aElZ0ex 6bRQ== X-Gm-Message-State: APjAAAVw9rdvEunMmYJ8L/W1H+owHV455XdpYh/mZ51hibEURTNs7LQA 32aZVI8JMQNu4YLe9lW9r+GKeo1+ X-Google-Smtp-Source: APXvYqxPkVnjlezscaNqpaFxgwBmw/ubpqan5rXFlB+uwyl+qnq0OQHnkDnthoFroLpDcGFM8bUjXQ== X-Received: by 2002:adf:c594:: with SMTP id m20mr47191662wrg.126.1563801480886; Mon, 22 Jul 2019 06:18:00 -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 z6sm34156657wrw.2.2019.07.22.06.17.59 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:18:00 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 09/10] ARM: davinci: dm646x: switch to using the clocksource driver Date: Mon, 22 Jul 2019 15:17:47 +0200 Message-Id: <20190722131748.30319-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061802_359327_46838B01 X-CRM114-Status: GOOD ( 13.62 ) 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, David Lechner 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 Jul 22 13:17: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: 11052363 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 3186F6C5 for ; Mon, 22 Jul 2019 13:23:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C16F283A6 for ; Mon, 22 Jul 2019 13:23:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FC102847E; Mon, 22 Jul 2019 13:23:13 +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 27C08283A6 for ; Mon, 22 Jul 2019 13:23: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=fowqPeSeoz4SEpXeox+yyPqyg5hEB2aWwiCzS+F3HVc=; b=Bb8t/+Lzzz/yXR +sSNOS/OolGhupos6uPoYup/0FyvAH1dDRUD/CjxduPrAECiJBgyLeJO/tgNjYW8UVCx5QlRWoSYO uH/gB2lNzNJVQBIds11TdGm8bfJXX3WNh8r7nZbCk6XYiZsmvc+VsTvd5CZHKCChjRNVSzq24ySd+ 7QtRglJjhLC6OnhqD+LvwvRLtVl6mcdScT1znMzRvIwzB4Y4XI6d4Ml5is+l+Y3LsSa2heGKHeNt6 6pwLtgGoQm7VTD2q3ZMdyhVnp7cGKjAK+hnOf3MwDoDy8OQxuBQAPw70UEwpuGGnKuc2xkYeFkjG1 S7xbbKfYRPDrb883P0wQ==; 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 1hpYHL-0000FB-RR; Mon, 22 Jul 2019 13:22:59 +0000 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hpYCZ-0004r7-Ep for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2019 13:18:10 +0000 Received: by mail-wm1-x344.google.com with SMTP id g67so31197158wme.1 for ; Mon, 22 Jul 2019 06:18: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=yBdG0H/gCIPYYVGR+KCWLaRLenPfJFEX87fC2jx+ebM=; b=oovgEqHUfbY2BBAcczYQEA4yva9iGjYZVMnPuq9sRP0ZqxVxZqeRbL6gt013Pp7sRc DCsvCV59wISNlBQtfuNwDhkGZKlhgNDohm1Bk0PYcry0sZdqPBRhOGYY9g3/WB/aLtyi TWP5A4KLSfqviu/nJWNXDqHede+cEEASHX/4D6+j7I5Tsy0JPOopoIyvlv52GnyCCsRw lXt2Wyi/53+/fw9t0xjL7bjac0gM09+I9WeJ6Qxfxpycn3DLJpQCGBVHc7Rv24zm3ovI BZohsEGxT2dS/C7KrKEPYxL50Q1epANYOcSGAvjMQ+CmSynlGmCKYeD3lDsEWtN/xrKA P15g== 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=jR+TZdhm8m2CH3bfupF+u3fXU++xdLiep45sZE6BxaDTbJJ6iTNU0VhrvMasfyAlMO C2MpoYW86HXEPQ1Uq/g0AKwmLtLxqlV64n9JPvecXF16tcgURVk4uo9+ZEJ5RxYVjQSF 5Yx61s5TyxzxSbTGFhzedPKXH1vxXSo2k5dp1TJVhEcal7VILjM6ZFhWdJYClNQGDCCx uDgr/ks43OzCpI3FugsjRPL4LoeekXehepYlcJaLQFxJIiqFISW6xLsEME8PkXdTUCNQ vLIDXn/dvv/eoZsSsYJ2krwkIIIWR3TB891tIK4DMe9jxZKdX1y/J2UL0nnzwsnMQuUL MZZg== X-Gm-Message-State: APjAAAWwiLg6/WAM+Ospp31QNdUqNZx2g7MAqUs45htj+KvdVI2nXwDw 4qHnrqtyCdu9QQjr07W14wU= X-Google-Smtp-Source: APXvYqz47D4I1DFw2+1HMI+YWdNxQLuQS9eAM2wec3lMRimp9A8IAbKQlZwN3USgIRj/KWcW+w7fwg== X-Received: by 2002:a1c:acc8:: with SMTP id v191mr65741695wme.177.1563801481752; Mon, 22 Jul 2019 06:18:01 -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 z6sm34156657wrw.2.2019.07.22.06.18.00 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 06:18:01 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman Subject: [RESEND PATCH 10/10] ARM: davinci: remove legacy timer support Date: Mon, 22 Jul 2019 15:17:48 +0200 Message-Id: <20190722131748.30319-11-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722131748.30319-1-brgl@bgdev.pl> References: <20190722131748.30319-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190722_061803_784543_1B6F9E2C X-CRM114-Status: GOOD ( 19.31 ) 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, David Lechner 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]); -}