From patchwork Fri Jul 20 13:45:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 10537539 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 B4F77602CA for ; Fri, 20 Jul 2018 13:46:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD97E297BD for ; Fri, 20 Jul 2018 13:46:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9FE7C297C0; Fri, 20 Jul 2018 13:46: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=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49BBF297BD for ; Fri, 20 Jul 2018 13:46:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732097AbeGTOd7 (ORCPT ); Fri, 20 Jul 2018 10:33:59 -0400 Received: from imap1.codethink.co.uk ([176.9.8.82]:36156 "EHLO imap1.codethink.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731674AbeGTOd7 (ORCPT ); Fri, 20 Jul 2018 10:33:59 -0400 Received: from [148.252.241.226] (helo=rainbowdash) by imap1.codethink.co.uk with esmtpsa (Exim 4.84_2 #1 (Debian)) id 1fgViw-0000P0-8J; Fri, 20 Jul 2018 14:45:34 +0100 Received: from ben by rainbowdash with local (Exim 4.91) (envelope-from ) id 1fgViv-0003Ry-T4; Fri, 20 Jul 2018 14:45:33 +0100 From: Ben Dooks To: linux-clk@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Cc: pdeschrijver@nvidia.com, pgaikwad@nvidia.com, jonathanh@nvidia.co, thierry.reding@gmail.com, linux-kernel@lists.codethink.co.uk, Ben Dooks Subject: [PATCH 1/8] clk: tegra: implement reset status callback Date: Fri, 20 Jul 2018 14:45:25 +0100 Message-Id: <20180720134532.13148-2-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180720134532.13148-1-ben.dooks@codethink.co.uk> References: <20180720134532.13148-1-ben.dooks@codethink.co.uk> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a the status callback for the reset controller part of the clock code in the tegra to allow drivers to query the status of a reset line. Signed-off-by: Ben Dooks --- drivers/clk/tegra/clk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/clk/tegra/clk.c b/drivers/clk/tegra/clk.c index ffaf17f71860..a2cb3d0d38bf 100644 --- a/drivers/clk/tegra/clk.c +++ b/drivers/clk/tegra/clk.c @@ -146,6 +146,19 @@ static const struct tegra_clk_periph_regs periph_regs[] = { static void __iomem *clk_base; +static int tegra_clk_rst_status(struct reset_controller_dev *rcdev, + unsigned long id) +{ + void __iomem *reg; + + if (id < periph_banks * 32) { + reg = clk_base + periph_regs[id / 32].rst_reg; + return readl_relaxed(reg) & BIT(id % 32) ? 1 : 0; + } + + return -EINVAL; +} + static int tegra_clk_rst_assert(struct reset_controller_dev *rcdev, unsigned long id) { @@ -288,6 +301,7 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl, } static const struct reset_control_ops rst_ops = { + .status = tegra_clk_rst_status, .assert = tegra_clk_rst_assert, .deassert = tegra_clk_rst_deassert, .reset = tegra_clk_rst_reset,