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: 10131595 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 DFCF96019C for ; Sat, 23 Dec 2017 13:06:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D5ABD298B3 for ; Sat, 23 Dec 2017 13:06:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA815298B4; Sat, 23 Dec 2017 13:06: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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 71ADD2957C for ; Sat, 23 Dec 2017 13:06:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756862AbdLWNGJ (ORCPT ); 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-Google-Smtp-Source: ACJfBoscvtt1ESGKusbZXamkFffKJT/Inzp1/ey5/AhuBdqPbF+Bgpk0GIF6YELaqX/aN0JOMIjRJA== 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: linux-hwmon-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(+) 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);