From patchwork Mon Oct 26 10:56:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 55528 Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1129690lbq; Mon, 26 Oct 2015 03:58:31 -0700 (PDT) X-Received: by 10.66.248.170 with SMTP id yn10mr21338941pac.74.1445857111019; Mon, 26 Oct 2015 03:58:31 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ip2si50939179pbd.176.2015.10.26.03.58.30; Mon, 26 Oct 2015 03:58:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753566AbbJZK6T (ORCPT + 28 others); Mon, 26 Oct 2015 06:58:19 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:34659 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753447AbbJZK6R (ORCPT ); Mon, 26 Oct 2015 06:58:17 -0400 Received: by wikq8 with SMTP id q8so158674688wik.1 for ; Mon, 26 Oct 2015 03:58:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fLJKQK5GUj5z4xlJF3qskofaqM8bPUbTmcJTeAwZcuk=; b=xl/MtyL+9O4BYnNbZrsVAQPHdgTsFZQcNG6TTH6pfp1IGj3VZsNdoOWCITsQyrb1kv IYjw1iLxNI7Tv5xKBgD9PULmO382TCizmvtsDFT3dgAJvF9aqf5rhd061whHKCZYQi4+ Vzgs5T2mFPXqTfuuCVtFSiPKN/vGlh14VK2haemtLZJe3k2XDlhdcv8pl6pQBrDzkC+l VUHfnDRtC9Jl77/FULya/m2scZe0SLvGu0rd/2ORpBPjwEZf8yc0xOiHfYRg8FCxB6Me y5TbKUJJM567F/CuLJHvVDruSBZKb5oUZXBLk3xrwGrY8rOU/Kp0kVr7zjlWotSFXEyL OZRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=fLJKQK5GUj5z4xlJF3qskofaqM8bPUbTmcJTeAwZcuk=; b=LG7UhRZwaWmJ7MQt9sldZjF+Vr9Xx7qGbK8/JfYdCTdmGzU0aot1FjpYMyraNVjbEB 6wUb+cp4Q8OKZOEMMWb0I5q9d4/HsyGefvMbXprYNfRhhd9J6mHhIWXDrh0EScr3TrtN v/coK8QmKp5qPFUNSVYkpW6TdfzN38yKer/+iioSJI8DGfUPlGF+VZevE5TiA01T5UOY IJ9IqOGGT0Dl4Y5nKUHbM4ueWvGeRxFM+sWmKc66Rq5QmvWQVayWdv+KFHG7wSA/NuwN eWAiRljD52VTR9QrJHqcLNQUqkzc36DsUlYcY0rxDG6+Z8AYCGY879IGu1HMD1gNfWLn vB9A== X-Gm-Message-State: ALoCoQltVR3HFKgtslrvkyYTWOefbDvh9dH5q0pdVgpnDOWFGqoCwPhRSfm+qySOfVg0zV9LCG5g X-Received: by 10.180.72.48 with SMTP id a16mr20909176wiv.39.1445857095813; Mon, 26 Oct 2015 03:58:15 -0700 (PDT) Received: from localhost.localdomain (host81-129-172-135.range81-129.btcentralplus.com. [81.129.172.135]) by smtp.gmail.com with ESMTPSA id he3sm38390779wjc.48.2015.10.26.03.58.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Oct 2015 03:58:15 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: kernel@stlinux.com, maxime.coquelin@st.com, devicetree@vger.kernel.org, p.zabel@pengutronix.de, Lee Jones Subject: [PATCH 3/3] reset: sti: Provide ops .status() call-back Date: Mon, 26 Oct 2015 10:56:09 +0000 Message-Id: <1445856969-19424-3-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1445856969-19424-1-git-send-email-lee.jones@linaro.org> References: <1445856969-19424-1-git-send-email-lee.jones@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Lee Jones --- drivers/reset/sti/reset-syscfg.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/drivers/reset/sti/reset-syscfg.c b/drivers/reset/sti/reset-syscfg.c index a145cc0..4453412 100644 --- a/drivers/reset/sti/reset-syscfg.c +++ b/drivers/reset/sti/reset-syscfg.c @@ -110,10 +110,33 @@ static int syscfg_reset_dev(struct reset_controller_dev *rcdev, return syscfg_reset_deassert(rcdev, idx); } +static int syscfg_reset_status(struct reset_controller_dev *rcdev, + unsigned long idx) +{ + struct syscfg_reset_controller *rst = to_syscfg_reset_controller(rcdev); + const struct syscfg_reset_channel *ch; + u32 ret_val = 0; + int err; + + if (idx >= rcdev->nr_resets) + return -EINVAL; + + ch = &rst->channels[idx]; + if (ch->ack) + err = regmap_field_read(ch->ack, &ret_val); + else + err = regmap_field_read(ch->reset, &ret_val); + if (err) + return err; + + return rst->active_low ? !ret_val : !!ret_val; +} + static struct reset_control_ops syscfg_reset_ops = { .reset = syscfg_reset_dev, .assert = syscfg_reset_assert, .deassert = syscfg_reset_deassert, + .status = syscfg_reset_status, }; static int syscfg_reset_controller_register(struct device *dev,