From patchwork Tue Jan 9 15:24:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 10152535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A9AC7601A1 for ; Tue, 9 Jan 2018 15:25:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 888F426223 for ; Tue, 9 Jan 2018 15:25:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C8EC27F98; Tue, 9 Jan 2018 15:25:14 +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=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 5590326223 for ; Tue, 9 Jan 2018 15:25: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: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:In-Reply-To:References: List-Owner; bh=BwtNwC9D088XEPi9CeY9VCPFw1/7sH5KiFWpKHYLwZA=; b=Z0eiOFkJHS3mak /gkAxPTqte1ob5hiZVzAO/KpVe33pZW5YZNy7kG/ZUlH8WtVecZYdIxZrFChYozQgJ2vVrpSFJQVe KK/QXfDAeFt2EV+O+dmB83Q7/BO4xj1o4tfLhsbwsn5E0oJIESbmpI7Npd0ztdUDE2RyYm55TPz2D ctcXyik48HQejoE2ZjZAvaMtO6a9JtvoSXUYqJLzZa90R6WBSxElmO6tzt2mCcc6PqLYpAQAsY4C8 osqOO/fO2mSkdmeDOoVhuAlAzFjI5yWLTHWqE6gT7fNFvfh3rf8Qy/tMeNP0NsaGsAZ3n3TUS0iL7 KSFVZfJd5THEjVKF6zVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYvm3-0003ee-4f; Tue, 09 Jan 2018 15:25:11 +0000 Received: from mail-bl2nam02on0629.outbound.protection.outlook.com ([2a01:111:f400:fe46::629] helo=NAM02-BL2-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYvly-0002kD-Cp for linux-arm-kernel@lists.infradead.org; Tue, 09 Jan 2018 15:25:08 +0000 Received: from CY4PR03CA0099.namprd03.prod.outlook.com (10.171.242.168) by MWHPR03MB2702.namprd03.prod.outlook.com (10.168.207.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.386.5; Tue, 9 Jan 2018 15:24:53 +0000 Received: from BN1AFFO11FD012.protection.gbl (2a01:111:f400:7c10::174) by CY4PR03CA0099.outlook.office365.com (2603:10b6:910:4d::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.386.5 via Frontend Transport; Tue, 9 Jan 2018 15:24:53 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD012.mail.protection.outlook.com (10.58.52.72) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.345.12 via Frontend Transport; Tue, 9 Jan 2018 15:24:20 +0000 Received: from fabio-Latitude-E5450.am.freescale.net (fabio-Latitude-E5450.am.freescale.net [10.29.244.155]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id w09FOm32020922; Tue, 9 Jan 2018 08:24:48 -0700 From: Fabio Estevam To: Subject: [PATCH] ARM: imx: Remove epit support Date: Tue, 9 Jan 2018 13:24:43 -0200 Message-ID: <1515511483-24706-1-git-send-email-fabio.estevam@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131599850620353866; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(346002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(52314003)(189003)(199004)(48376002)(68736007)(8656006)(5660300001)(50226002)(575784001)(356003)(51416003)(54906003)(4326008)(305945005)(50466002)(47776003)(86362001)(36756003)(77096006)(2906002)(316002)(85426001)(2351001)(8676002)(81156014)(16586007)(81166006)(498600001)(59450400001)(106466001)(97736004)(104016004)(6666003)(8936002)(6916009)(105606002)(53936002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2702; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD012; 1:/nZNyGFcd9/iuFzRcfB6d9lk8gEewc6ag5sMDpaaksuqlU1JO/8OH/LsGadREaCDEZTi8oaniohKE4GfxjQYacjzzhVtSjft106PJSWeyrquvIx2JRhiYDr/qXJDOvK9 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e4870c19-8514-42eb-7d4a-08d557750f2f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307); SRVR:MWHPR03MB2702; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 3:gzq2A3vj5OoEJxxK9GMuCqGC0AgLEIKdAJlETx7dFM89o0S7Cwm8/BSa7784PORC15lOvuL8L3RNBMDV5+V407GLpv8kNyZPEHXJz/IHKUPCThaaXzwM3d2NeO3AHM1YgnK07OityJdAEPMJQU32RpnnWwqPZFAx0uAFShYBQZxjQKT+/Yx0qVbX/ivmNrMMq/5oRORy4ukjSiiJFjP80/NOIZOj+m7nfDUYq6oQGZT1gcAIe+/ARMyJwUrgRLVKbHCXGP6OWW9O6vi5ebzg9ClOR00/oB/AAnYrVRCfjMvl8Agd7PXt4upAoTJHVlSJJih6zYjYyrT49gA2Je4cqdjnstD39QaApKbgcLgEhb8=; 25:IFk7jKgV8C11tfK0vZ6m4bKGupLVGI4s4s3A1cE+8JDvClPqxVypjOaxRT4yiSvBWRAh5BsjXAGKGXmxZtWlhPTU1NMkVIbeEMIXPgID7/l/t46xDOnrtpqmQO8lMo2C9BmT5mMiqT6jlyPOGJP4kZgZ+2Bwbo6INNRouFQsDXCUhk8lXzbgY1eDnBnb6ufqZxwWt7apsD86Mg1wHQp7ADf7T/zdx6tAQ+KqwXGbM64R8jLYAoEcc4opwn3CxueVIzGLS6sjNNp3dQrcP69rx9nSZLXIMSkN9WVePEjT3CNJUm1XSJ5TXektljVube6i3zvszNwYNGO0XmWI66gbIw== X-MS-TrafficTypeDiagnostic: MWHPR03MB2702: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 31:XUVq02XYor5AeQTA7y7ZTLeKszwK1u+iuObQ8kuYWQhcYT9RKfJtk6ie7iXJzoyyej0cDyYF1Pa9aoIJfZ0esZXMlEO44bwv8mP+s+3NfP510lKaZT9zg4Ytv3llxw76FV3T6wFBVG/tqew/VEtMePRaRPI6S4iFFBAHyrly8vyue3emT5oCT4yT04xFzQ9aGM5Wd2C8lQCCMf5VaBwoNIdo6tAs6GmYpb6iUVzDlCo=; 4:2KgljNKZDlY4bVoDEY5+HqrE3i2pE4A4bCYt2cK/YnnNW+f/2K3dAYVlqfDzv0WnaNM8FzsDUcDwWNeL0dBahvQrPvtdKZNpOsmRAiZPcU0CwK598C4+7S4OD6M+UGim7wPzF5OyCMtTU069PDV5YKLV2Ut5bmtpFH0iVS7D6ytaPWJDP8uYpq9iJ3jhlrfjtItYDHWXonIMPtKOqK2xvwRckMlDWE+X3ZIFfvWNMju7XQpKPPJ0c7QvhI5ODUHZZYwELFsXEaiGmn3+ZBegk3d2jvtSKR20MVIvkvMe8rYOQWBnO7qhhH6OhE7YiJ9p X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231023)(944510075)(944921075)(946801075)(946901075)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123559100)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123565025)(20161123556025)(201708071742011); SRVR:MWHPR03MB2702; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2702; X-Forefront-PRVS: 0547116B72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2702; 23:yBloj2s8Vts0H8xx+mytTvEX5+4i3yrgKr9ySQGza?= =?us-ascii?Q?vbJNWANRpsydsCHkEs+yZ4nozlH7ULgAdpaQ2egwY6I46lOZvTXw1dA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Z6P57sADwNEoTfdGOK0BWHtJZDRZlCVnOIzH12M3yM15GCTGqLv8b/nHO/osVmSc9GASd9lXAbmWlDWKnhhaFkhgryJ9XppmKaJI SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2018 15:24:20.4753 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e4870c19-8514-42eb-7d4a-08d557750f2f X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2702 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180109_072506_563337_DD4ADC97 X-CRM114-Status: GOOD ( 20.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fabio Estevam , linux-arm-kernel@lists.infradead.org, kernel@pengutronix.de 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 Currently there is no user of EPIT, so remove such unused code. If someone wants to add EPIT support back, then the person needs to create a proper support into drivers/clocksource/ and add device tree support, proper bindings, etc. Signed-off-by: Fabio Estevam Acked-by: Sascha Hauer --- arch/arm/mach-imx/Kconfig | 13 --- arch/arm/mach-imx/Makefile | 1 - arch/arm/mach-imx/epit.c | 228 --------------------------------------------- 3 files changed, 242 deletions(-) delete mode 100644 arch/arm/mach-imx/epit.c diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 782699e..1831319 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -32,18 +32,6 @@ config MXC_DEBUG_BOARD data/address de-multiplexing and decode, signal level shift, interrupt control and various board functions. -config HAVE_EPIT - bool - -config MXC_USE_EPIT - bool "Use EPIT instead of GPT" - depends on HAVE_EPIT - help - Use EPIT as the system timer on systems that have it. Normally you - don't have a reason to do so as the EPIT has the same features and - uses the same clocks as the GPT. Anyway, on some systems the GPT - may be in use for other purposes. - config HAVE_IMX_ANATOP bool @@ -85,7 +73,6 @@ config SOC_IMX31 config SOC_IMX35 bool select ARCH_MXC_IOMUX_V3 - select HAVE_EPIT select MXC_AVIC select PINCTRL_IMX35 diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 8ff7105..04ba789 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -20,7 +20,6 @@ obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o obj-$(CONFIG_MXC_TZIC) += tzic.o obj-$(CONFIG_MXC_AVIC) += avic.o -obj-$(CONFIG_MXC_USE_EPIT) += epit.o obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o ifeq ($(CONFIG_CPU_IDLE),y) diff --git a/arch/arm/mach-imx/epit.c b/arch/arm/mach-imx/epit.c deleted file mode 100644 index fb9a73a..0000000 --- a/arch/arm/mach-imx/epit.c +++ /dev/null @@ -1,228 +0,0 @@ -/* - * linux/arch/arm/plat-mxc/epit.c - * - * Copyright (C) 2010 Sascha Hauer - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - -#define EPITCR 0x00 -#define EPITSR 0x04 -#define EPITLR 0x08 -#define EPITCMPR 0x0c -#define EPITCNR 0x10 - -#define EPITCR_EN (1 << 0) -#define EPITCR_ENMOD (1 << 1) -#define EPITCR_OCIEN (1 << 2) -#define EPITCR_RLD (1 << 3) -#define EPITCR_PRESC(x) (((x) & 0xfff) << 4) -#define EPITCR_SWR (1 << 16) -#define EPITCR_IOVW (1 << 17) -#define EPITCR_DBGEN (1 << 18) -#define EPITCR_WAITEN (1 << 19) -#define EPITCR_RES (1 << 20) -#define EPITCR_STOPEN (1 << 21) -#define EPITCR_OM_DISCON (0 << 22) -#define EPITCR_OM_TOGGLE (1 << 22) -#define EPITCR_OM_CLEAR (2 << 22) -#define EPITCR_OM_SET (3 << 22) -#define EPITCR_CLKSRC_OFF (0 << 24) -#define EPITCR_CLKSRC_PERIPHERAL (1 << 24) -#define EPITCR_CLKSRC_REF_HIGH (1 << 24) -#define EPITCR_CLKSRC_REF_LOW (3 << 24) - -#define EPITSR_OCIF (1 << 0) - -#include -#include -#include -#include -#include -#include - -#include "common.h" -#include "hardware.h" - -static struct clock_event_device clockevent_epit; - -static void __iomem *timer_base; - -static inline void epit_irq_disable(void) -{ - u32 val; - - val = imx_readl(timer_base + EPITCR); - val &= ~EPITCR_OCIEN; - imx_writel(val, timer_base + EPITCR); -} - -static inline void epit_irq_enable(void) -{ - u32 val; - - val = imx_readl(timer_base + EPITCR); - val |= EPITCR_OCIEN; - imx_writel(val, timer_base + EPITCR); -} - -static void epit_irq_acknowledge(void) -{ - imx_writel(EPITSR_OCIF, timer_base + EPITSR); -} - -static int __init epit_clocksource_init(struct clk *timer_clk) -{ - unsigned int c = clk_get_rate(timer_clk); - - return clocksource_mmio_init(timer_base + EPITCNR, "epit", c, 200, 32, - clocksource_mmio_readl_down); -} - -/* clock event */ - -static int epit_set_next_event(unsigned long evt, - struct clock_event_device *unused) -{ - unsigned long tcmp; - - tcmp = imx_readl(timer_base + EPITCNR); - - imx_writel(tcmp - evt, timer_base + EPITCMPR); - - return 0; -} - -/* Left event sources disabled, no more interrupts appear */ -static int epit_shutdown(struct clock_event_device *evt) -{ - unsigned long flags; - - /* - * The timer interrupt generation is disabled at least - * for enough time to call epit_set_next_event() - */ - local_irq_save(flags); - - /* Disable interrupt in GPT module */ - epit_irq_disable(); - - /* Clear pending interrupt */ - epit_irq_acknowledge(); - - local_irq_restore(flags); - - return 0; -} - -static int epit_set_oneshot(struct clock_event_device *evt) -{ - unsigned long flags; - - /* - * The timer interrupt generation is disabled at least - * for enough time to call epit_set_next_event() - */ - local_irq_save(flags); - - /* Disable interrupt in GPT module */ - epit_irq_disable(); - - /* Clear pending interrupt, only while switching mode */ - if (!clockevent_state_oneshot(evt)) - epit_irq_acknowledge(); - - /* - * Do not put overhead of interrupt enable/disable into - * epit_set_next_event(), the core has about 4 minutes - * to call epit_set_next_event() or shutdown clock after - * mode switching - */ - epit_irq_enable(); - local_irq_restore(flags); - - return 0; -} - -/* - * IRQ handler for the timer - */ -static irqreturn_t epit_timer_interrupt(int irq, void *dev_id) -{ - struct clock_event_device *evt = &clockevent_epit; - - epit_irq_acknowledge(); - - evt->event_handler(evt); - - return IRQ_HANDLED; -} - -static struct irqaction epit_timer_irq = { - .name = "i.MX EPIT Timer Tick", - .flags = IRQF_TIMER | IRQF_IRQPOLL, - .handler = epit_timer_interrupt, -}; - -static struct clock_event_device clockevent_epit = { - .name = "epit", - .features = CLOCK_EVT_FEAT_ONESHOT, - .set_state_shutdown = epit_shutdown, - .tick_resume = epit_shutdown, - .set_state_oneshot = epit_set_oneshot, - .set_next_event = epit_set_next_event, - .rating = 200, -}; - -static int __init epit_clockevent_init(struct clk *timer_clk) -{ - clockevent_epit.cpumask = cpumask_of(0); - clockevents_config_and_register(&clockevent_epit, - clk_get_rate(timer_clk), - 0x800, 0xfffffffe); - - return 0; -} - -void __init epit_timer_init(void __iomem *base, int irq) -{ - struct clk *timer_clk; - - timer_clk = clk_get_sys("imx-epit.0", NULL); - if (IS_ERR(timer_clk)) { - pr_err("i.MX epit: unable to get clk\n"); - return; - } - - clk_prepare_enable(timer_clk); - - timer_base = base; - - /* - * Initialise to a known state (all timers off, and timing reset) - */ - imx_writel(0x0, timer_base + EPITCR); - - imx_writel(0xffffffff, timer_base + EPITLR); - imx_writel(EPITCR_EN | EPITCR_CLKSRC_REF_HIGH | EPITCR_WAITEN, - timer_base + EPITCR); - - /* init and register the timer to the framework */ - epit_clocksource_init(timer_clk); - epit_clockevent_init(timer_clk); - - /* Make irqs happen */ - setup_irq(irq, &epit_timer_irq); -}