From patchwork Tue Apr 2 06:30:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 10881107 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 9BF3F17E0 for ; Tue, 2 Apr 2019 06:32:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CC2528770 for ; Tue, 2 Apr 2019 06:32:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6DF9F28843; Tue, 2 Apr 2019 06:32:55 +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_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable 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 EC31428770 for ; Tue, 2 Apr 2019 06:32:54 +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=YW1F3cprKZa4NHXyuANCfIvkQn4jgdKZRzQcrzV773c=; b=SDK/iiJbMaYhcY mt3YXtd7SyfLW6znrQrTnSx9FMB3KcQC8cdvqEaCUwDPRL88LMpAs7GXVSKcUGxmgp11RcRDg4xtV QcA5FnmvP4P5Y3uWdJy8cCqTMxJfdbYbdZDJvPAl0PTT6lbfX3tPFFXcknJwr4gSh8wpO7BLIOMeM Ux14FaB1EU73yKL1W2U/gVbQc6AkBiSQxqCB7qvwbT5DEkCMiVv8hET0yt2ECdLQ1rTam2NStO/VZ AZjdaUBwYPfDF5YeMUhLxJRB0xNyWw2onwLyLFweIhdvmS9ndedM9fFAosRX/wmzs32lD8tcbrsHv JOAu5lWGXveW43HPUinw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBCyV-0001zQ-5i; Tue, 02 Apr 2019 06:32:47 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hBCxw-0001Hd-J6 for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2019 06:32:43 +0000 Received: by mail-pl1-x643.google.com with SMTP id b65so5727956plb.6 for ; Mon, 01 Apr 2019 23:32:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BaIWJSTRjzWyLekqc6jwZik98Kx45p7haF3OxKPIA1o=; b=iY/rqAecGiREiE7KwkpM7WFZ9E2O5uDNptFluiCUlEkxi8HtGYA0RBDVBzWIktfM4/ 6mctHdCPeZENnSqZwNhzc4iVY8m0avdaYMCjtRtDPuzl4mIroXOspMhKxMsVxAdSZgPG XMRCUZL+0GIx9kEFF6NmI5pvOJAWrlPY0zK5LhygqyXJjJ9cnMa2dLLm/P3sW51W++H+ /0rSULTv4EFhKDI8BSsDOG6bh49x8HRZSu66yb00MViAAEsECAJGgTOCa+uzYiLF+R49 oyxD++ThX9qZ61Cdf12XjeT8RPhvNdrNhCAJB5RPiL/9GW6TjQokb4AzHs1P3Sx6n4gu lCHw== 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=BaIWJSTRjzWyLekqc6jwZik98Kx45p7haF3OxKPIA1o=; b=MACT9hciWqm0KcPfm4Iw5Svi+WPXF9fchusjuigbYl90s2KIuw/3e/ADxNWuf3Hdu5 xBmfGEVeFQUZZTh6WP3Vs0l2e7QeLcmle0p2BWdjHhplrQ1QznJ0pv/5Qx9eRl//JyA7 6yaeTV9j9UEUOTNAtXSwJhLZZZOgsfoiRZTCpxvjDOwtlsNFxidRL16JlgGgrafPr14i zCcLDJw/LhMVlohKdVic2LWzM0Ouw3nEgLrOKrwgLvCSAMUU5oEK8bIO4OnDYylNbM4J k4yoM5MHfgfP+5KwbIKHa+FITatp/gnTNoTdmRqquzPZ/y1leLq0PTzckPx3lqtziyzJ XBUw== X-Gm-Message-State: APjAAAUbUm6D7d86KOOMaFdDAncsW2lEKaBqlU9NIIO8GUgGKIMypEDX lmvK9P1fEY+6coPyN0JD6mg= X-Google-Smtp-Source: APXvYqwVfrRByKFeOKBL9R1qbr5mt0aUWyMrsX8kZdL32AtyzhDeQxXCXY3D859wQjyCHhnQQSuqPQ== X-Received: by 2002:a17:902:2ba7:: with SMTP id l36mr69299080plb.237.1554186732097; Mon, 01 Apr 2019 23:32:12 -0700 (PDT) Received: from localhost.localdomain ([2001:268:c0a5:4ce0:c70:4af9:86e2:2]) by smtp.gmail.com with ESMTPSA id a17sm19327289pfj.123.2019.04.01.23.32.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 23:32:11 -0700 (PDT) From: William Breathitt Gray To: gregkh@linuxfoundation.org Subject: [PATCH v10 12/18] include/fsl: add common FlexTimer #defines in a separate header. Date: Tue, 2 Apr 2019 15:30:47 +0900 Message-Id: <4107a3897b6dc081bbf598d4faedaf3bc306a1d2.1554184734.git.vilhelm.gray@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190401_233213_636971_9514124D X-CRM114-Status: GOOD ( 12.64 ) 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: mark.rutland@arm.com, benjamin.gaignard@st.com, linux-pwm@vger.kernel.org, linux-iio@vger.kernel.org, patrick.havelange@essensium.com, thierry.reding@gmail.com, pmeerw@pmeerw.net, lars@metafoo.de, daniel.lezcano@linaro.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, david@lechnology.com, William Breathitt Gray , robh+dt@kernel.org, tglx@linutronix.de, fabrice.gasnier@st.com, esben@haabendal.dk, shawnguo@kernel.org, linux-kernel@vger.kernel.org, leoyang.li@nxp.com, knaack.h@gmx.de, akpm@linux-foundation.org, linuxppc-dev@lists.ozlabs.org, jic23@kernel.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Patrick Havelange Several files are/will be using the same #defines to use the Flextimer module. Regroup them in a common file. Reviewed-by: Esben Haabendal Signed-off-by: Patrick Havelange Signed-off-by: William Breathitt Gray --- include/linux/fsl/ftm.h | 88 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 include/linux/fsl/ftm.h diff --git a/include/linux/fsl/ftm.h b/include/linux/fsl/ftm.h new file mode 100644 index 000000000000..d59011acf66c --- /dev/null +++ b/include/linux/fsl/ftm.h @@ -0,0 +1,88 @@ +// SPDX-License-Identifier: GPL-2.0 +#ifndef __FSL_FTM_H__ +#define __FSL_FTM_H__ + +#define FTM_SC 0x0 /* Status And Control */ +#define FTM_CNT 0x4 /* Counter */ +#define FTM_MOD 0x8 /* Modulo */ + +#define FTM_CNTIN 0x4C /* Counter Initial Value */ +#define FTM_STATUS 0x50 /* Capture And Compare Status */ +#define FTM_MODE 0x54 /* Features Mode Selection */ +#define FTM_SYNC 0x58 /* Synchronization */ +#define FTM_OUTINIT 0x5C /* Initial State For Channels Output */ +#define FTM_OUTMASK 0x60 /* Output Mask */ +#define FTM_COMBINE 0x64 /* Function For Linked Channels */ +#define FTM_DEADTIME 0x68 /* Deadtime Insertion Control */ +#define FTM_EXTTRIG 0x6C /* FTM External Trigger */ +#define FTM_POL 0x70 /* Channels Polarity */ +#define FTM_FMS 0x74 /* Fault Mode Status */ +#define FTM_FILTER 0x78 /* Input Capture Filter Control */ +#define FTM_FLTCTRL 0x7C /* Fault Control */ +#define FTM_QDCTRL 0x80 /* Quadrature Decoder Control And Status */ +#define FTM_CONF 0x84 /* Configuration */ +#define FTM_FLTPOL 0x88 /* FTM Fault Input Polarity */ +#define FTM_SYNCONF 0x8C /* Synchronization Configuration */ +#define FTM_INVCTRL 0x90 /* FTM Inverting Control */ +#define FTM_SWOCTRL 0x94 /* FTM Software Output Control */ +#define FTM_PWMLOAD 0x98 /* FTM PWM Load */ + +#define FTM_SC_CLK_MASK_SHIFT 3 +#define FTM_SC_CLK_MASK (3 << FTM_SC_CLK_MASK_SHIFT) +#define FTM_SC_TOF 0x80 +#define FTM_SC_TOIE 0x40 +#define FTM_SC_CPWMS 0x20 +#define FTM_SC_CLKS 0x18 +#define FTM_SC_PS_1 0x0 +#define FTM_SC_PS_2 0x1 +#define FTM_SC_PS_4 0x2 +#define FTM_SC_PS_8 0x3 +#define FTM_SC_PS_16 0x4 +#define FTM_SC_PS_32 0x5 +#define FTM_SC_PS_64 0x6 +#define FTM_SC_PS_128 0x7 +#define FTM_SC_PS_MASK 0x7 + +#define FTM_MODE_FAULTIE 0x80 +#define FTM_MODE_FAULTM 0x60 +#define FTM_MODE_CAPTEST 0x10 +#define FTM_MODE_PWMSYNC 0x8 +#define FTM_MODE_WPDIS 0x4 +#define FTM_MODE_INIT 0x2 +#define FTM_MODE_FTMEN 0x1 + +/* NXP Errata: The PHAFLTREN and PHBFLTREN bits are tide to zero internally + * and these bits cannot be set. Flextimer cannot use Filter in + * Quadrature Decoder Mode. + * https://community.nxp.com/thread/467648#comment-1010319 + */ +#define FTM_QDCTRL_PHAFLTREN 0x80 +#define FTM_QDCTRL_PHBFLTREN 0x40 +#define FTM_QDCTRL_PHAPOL 0x20 +#define FTM_QDCTRL_PHBPOL 0x10 +#define FTM_QDCTRL_QUADMODE 0x8 +#define FTM_QDCTRL_QUADDIR 0x4 +#define FTM_QDCTRL_TOFDIR 0x2 +#define FTM_QDCTRL_QUADEN 0x1 + +#define FTM_FMS_FAULTF 0x80 +#define FTM_FMS_WPEN 0x40 +#define FTM_FMS_FAULTIN 0x10 +#define FTM_FMS_FAULTF3 0x8 +#define FTM_FMS_FAULTF2 0x4 +#define FTM_FMS_FAULTF1 0x2 +#define FTM_FMS_FAULTF0 0x1 + +#define FTM_CSC_BASE 0xC +#define FTM_CSC_MSB 0x20 +#define FTM_CSC_MSA 0x10 +#define FTM_CSC_ELSB 0x8 +#define FTM_CSC_ELSA 0x4 +#define FTM_CSC(_channel) (FTM_CSC_BASE + ((_channel) * 8)) + +#define FTM_CV_BASE 0x10 +#define FTM_CV(_channel) (FTM_CV_BASE + ((_channel) * 8)) + +#define FTM_PS_MAX 7 + +#endif