From patchwork Sat Dec 23 13:05:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 122685 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp3412525qgn; Sat, 23 Dec 2017 05:06:18 -0800 (PST) X-Google-Smtp-Source: ACJfBouldlZ66nd4e39ZunQvnM4YRuiZlcj6W3pMbTmVKb0FLltMLbM+p+LrGhIDp64whqgDX3bb X-Received: by 10.99.166.18 with SMTP id t18mr15657273pge.252.1514034378330; Sat, 23 Dec 2017 05:06:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1514034378; cv=none; d=google.com; s=arc-20160816; b=Wtgcgg4V7erazs80PzMoCAhJwPBPgQABQBmLTUfKJolKmZVTPiyb/lFC4vVRr14ekB NbcjjcDWMMb80/XDmESFGD/fB1jIRLmux6MOqglWACJrvxMiLOYa3a4gqaBHD4FAp/nA datsjTzzxPtQJpGThTBJd/88PVdBIQ9WM6t+XT3/m+QfSUo0kKxKSCPqqKZ01n0QaaqB kk+kTMBGdnEwAxvn83xWztveKrSLWNZQPL6mopR49/0YzlkK5TAuxQlTvhnDT0S5yMk/ Z3O1KXFPnvpBHVLY9FPSpd0YtD6G8yXu7FazPwuyqa/MylGIIspd5UOlBjauB9hmZapd +cnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XDzCFzIaLCLFsjhRkrXDKptEntH1izmHQ8y39Uzq7AU=; b=qrOQg7OdJ00cnHwxdUjvsv3EW5m4nvJUaZ4DPopft2W6BzJYoIC/BHaIdkom6Ky2fA deKnQkQ02rjWOp2alhGcI9tvEmoYzChwHrgLq5jZPzU/pZKx9Gta0iPE0bTjy8iEbCN2 K6tB+pkgdnhzLYTLrc8iXlsWwIhJOZ5KU1YILaDt1uZhANFnvHYmP+oVg1J0LRjmc6JI 9hKg7DT/AJuHsnVCiXocAhgDUPMgtKHcckGsNz9s2T4OxtEdh5iJgIAJslg4pHlWIbe7 VbpwWrHgBlr/Q1LLuJZSNkndwpH+fEEP0k2f6iBBfCLb7+TWczm6LAbTHNTR8MX9CjN8 Cl2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=J+hd1jz/; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si5135339pge.204.2017.12.23.05.06.18; Sat, 23 Dec 2017 05:06:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=J+hd1jz/; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752454AbdLWNGJ (ORCPT + 6 others); Sat, 23 Dec 2017 08:06:09 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35385 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756874AbdLWNGF (ORCPT ); Sat, 23 Dec 2017 08:06:05 -0500 Received: by mail-pg0-f65.google.com with SMTP id q20so15506026pgv.2; Sat, 23 Dec 2017 05:06:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Yuur16AJKnha+FL0dk+RxoJ6hQN0k2cVIZ0K1P1562I=; b=J+hd1jz/53lgdh49daXvt05atcMulPRjO6HzjTQVCZNEPoMEHRXG6rdoNHdfLaiVSy AdKhH27b0QXciyU9rmvSqaebiu1vu8HmC/qt5ugD0rPzmBFg8JM8V8tUiZQvVjUriFb+ F0QOBRUWdhYRgGOpa2146SpyUFEOQqRx7JNv82gVd2y3Fw6NPqVKWr/0jAUf6E65LQS6 cK9pNgHcOvCcZdMt3Uz7rQFVCoCOJsRi16BeNpR7imPmdh0ejywfOk4/U8B7gDM28MfC 3ECcA2onTQqvwdrZG1WSLsWnT4aoynqFKJheFlKBW3My8oOGSM9lwZElvo5DaJTnw3Bf kg4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Yuur16AJKnha+FL0dk+RxoJ6hQN0k2cVIZ0K1P1562I=; b=PspYBCGzilDT+E61NbQ/jDl3aOC4E+fgrLA7tzqxuunRWrpss01L+qN2e4JCCjQ+SO 7ul3wt51DRMV8t5knBCFaUq62UbGoAxB/GWoe9YEd1wzqgCJCJpoPJ5dCXwkaT3l8qyZ d9nNqsVIcmaKdH0QdMgCXQ/fw8qIx6P23M0ygCJQ/2EdVHh0ZiGWy5XYlFbERXTbTO2B 1WcDodz3jRW8enGAhzgsJTJU/YMXc9pzbP7wRc0h07HUEG5hmOum8Sk2BETA7fY+7Wdw jISN8jikapxqYo4AsT2oaUvGGXMbdI6/Pt2hH3lm0Jk8779e+A2uWMNHXPVdvenmHMLd XGSw== X-Gm-Message-State: AKGB3mJSjMscLMl91nkOtJwaV8EHT++LZlnrc+0IrOLDtMf53PCWnD8+ t/iQFW94o3gzws5Xc9u7Z8Y= X-Received: by 10.98.19.202 with SMTP id 71mr17416444pft.181.1514034364672; Sat, 23 Dec 2017 05:06:04 -0800 (PST) Received: from aurora.jms.id.au ([45.124.203.15]) by smtp.gmail.com with ESMTPSA id b25sm51915515pfd.182.2017.12.23.05.05.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 23 Dec 2017 05:06:03 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Sat, 23 Dec 2017 23:35:52 +1030 From: Joel Stanley To: Guenter Roeck , Rob Herring Cc: Philipp Zabel , Mykola Kostenok , Jaghathiswari Rankappagounder Natarajan , Patrick Venture , Andrew Jeffery , devicetree@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] hwmon: (aspeed-pwm-tacho) Deassert reset in probe Date: Sat, 23 Dec 2017 23:35:28 +1030 Message-Id: <20171223130528.5346-3-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171223130528.5346-1-joel@jms.id.au> References: <20171223130528.5346-1-joel@jms.id.au> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The ASPEED SoC must deassert a reset in order to use the PWM/tach peripheral. Signed-off-by: Joel Stanley --- drivers/hwmon/aspeed-pwm-tacho.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) -- 2.15.1 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/hwmon/aspeed-pwm-tacho.c b/drivers/hwmon/aspeed-pwm-tacho.c index 63a95e23ca81..693a3d53cab5 100644 --- a/drivers/hwmon/aspeed-pwm-tacho.c +++ b/drivers/hwmon/aspeed-pwm-tacho.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -181,6 +182,7 @@ struct aspeed_cooling_device { struct aspeed_pwm_tacho_data { struct regmap *regmap; + struct reset_control *rst; unsigned long clk_freq; bool pwm_present[8]; bool fan_tach_present[16]; @@ -905,6 +907,13 @@ static int aspeed_create_fan(struct device *dev, return 0; } +static void aspeed_pwm_tacho_remove(void *data) +{ + struct aspeed_pwm_tacho_data *priv = data; + + reset_control_assert(priv->rst); +} + static int aspeed_pwm_tacho_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -931,6 +940,19 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) &aspeed_pwm_tacho_regmap_config); if (IS_ERR(priv->regmap)) return PTR_ERR(priv->regmap); + + priv->rst = devm_reset_control_get_exclusive(dev, NULL); + if (IS_ERR(priv->rst)) { + dev_err(dev, + "missing or invalid reset controller device tree entry"); + return PTR_ERR(priv->rst); + } + reset_control_deassert(priv->rst); + + ret = devm_add_action_or_reset(dev, aspeed_pwm_tacho_remove, priv); + if (ret) + return ret; + regmap_write(priv->regmap, ASPEED_PTCR_TACH_SOURCE, 0); regmap_write(priv->regmap, ASPEED_PTCR_TACH_SOURCE_EXT, 0);