From patchwork Thu Nov 2 03:53:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 117743 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1665841qgn; Wed, 1 Nov 2017 20:54:23 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SynRgPFqiFdzxDGhutysE/+iIJjJsn08iX8SOBHdLTar39zmnVjSKNj4pNCJpjrTXEXWRn X-Received: by 10.98.17.7 with SMTP id z7mr2220570pfi.206.1509594863284; Wed, 01 Nov 2017 20:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509594863; cv=none; d=google.com; s=arc-20160816; b=AKhoALPU5i3VjSooKrZ1cTgnWlnbrhXuXIDihD1GXbFEfcUas+nWZMBq861V03HLmG ZT4QXjdRa/6Ag3mo+qwkUvEuKhGSVBsDgmWn4TaDBhP6bOTG69Fvk6aiN3V2Mta3fzhy nUDOKAlsPV6eRRiw9wPibMRIW7nZ9/bWoWBcimptD/YJKwCMHnJu5aZg3+jc40jsioze l9vvSg0gBPV/MU3AhXjVOLi7T7rY5o8xjKz3Jza7MTPReviuEKquSKNo/hJVQ6bdjHnf mUGLeMIRCXrK5t3RwhVagslMOSLOKksVBWBoPIPvylkbq8/BHAlrY41q8hQYZoJOMGrx 5wJQ== 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=HrOIPwGw9nv7K6WluHEoHo08O8micMaCFoM/TmZF4IU=; b=w6Txa2UA0UsHiwzmkfOcwzyPlQ1WuI1kaizAkXzJC29YghQHaGgCzM4tjTK+cIIYl0 K0ruZl6oArr9r6XS/ydSg39i9ksAGQLPDOFn+eX0lKuf5srtBFdvYhni6IFyWQpEc4YP 8rYfecqvZikXvwPuxke3GCWAUT2QnV4iW0xH5f/Z5SWwVQ09wz2uNkKTodr2/unMQ2K5 PQ7HNjV+RAww4eGYXsUC7Qds08dQ5OUIOgtnP/27EZ3+Fca5cVGUA/7ifeaCg4RXSs6K 35JNecq+ickVwnaHTpR1pSDllDCz6BFEXiQHLOQ6XypTQHGT4fdusmynX/UuSwxhxQjD p9Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=SmpDG+tt; 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 k15si2372372pgr.633.2017.11.01.20.54.23; Wed, 01 Nov 2017 20:54:23 -0700 (PDT) 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=SmpDG+tt; 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 S934120AbdKBDyV (ORCPT + 6 others); Wed, 1 Nov 2017 23:54:21 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:56114 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934073AbdKBDyT (ORCPT ); Wed, 1 Nov 2017 23:54:19 -0400 Received: by mail-pf0-f194.google.com with SMTP id 17so3581794pfn.12; Wed, 01 Nov 2017 20:54:19 -0700 (PDT) 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=L5l94yF0yE1wu/5vOlDHvM2d56+uG2Acz5mZs4DlHPg=; b=SmpDG+tt6akqfMEcA87anm++M+RcRHNuNondDDWXzkzd1zctIeFmIlAzXF2/iZNqEK l0ggvtKFSijz4DHZbCp3eOlmWnWf1nPFhxI8q2aprcNFQGWFjwXRPCOPQ9I2HWj44P0M 2oW/2T3UdQND6FnAekAOb+FNJWeuvY2fI6KRtSBqdakMEqAcylvv7DnbFSE1+Cma2I4h HYUf+XjW9gbhrPeIm/iwR5FqHnoApTxty7XP2nnDHLyGDpFQ0I3t69LjPnSCxMj/lCgI rYi6l4XCJv5cSeFUJpOBhySqhH0CuMRQNe9csK5tbnQZvuNUzWJa1QIc+SEIpeHHR0KG uZBg== 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=L5l94yF0yE1wu/5vOlDHvM2d56+uG2Acz5mZs4DlHPg=; b=LeCSbDgTIXztU1iY78H5fa6XISdtm9F4DfsWaWz5j70H/0YUQD++P+hz+GjKqGYqWc n6HN+BAOfQLKkg0DRJBp7ny7JAXKUTFJEk5U8mCWmvb94hmh/zwSBmABQPHlSPMYGcKa K9YscRvSscw58/kj4MQwh7s24wCjc2kiZ9Q5AaX/IIq+vguOwmup81oe+7LLWW2xrkBn 60guY3vby7q5sObbd7xT7kbk9a23n/yRdJX2DcEX+dxJxunJJN2noM+VqePV+9VUZLfR Bik8adY+lYENb2l6ZA5ipnD3hKmbLUeGyNbho0qEPklrNGJq2QsAqAlFpdUfrmV/zLCZ 6lUA== X-Gm-Message-State: AMCzsaU8lj09AAPp6rMDNJsOWk+VXhQAzSM9kmghIBKJeCYK2ilY5Rm3 MlfCxWeksPp841AnCdykZOQ= X-Received: by 10.99.110.196 with SMTP id j187mr2066487pgc.393.1509594858625; Wed, 01 Nov 2017 20:54:18 -0700 (PDT) Received: from aurora.jms.id.au ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id q13sm2867963pgt.73.2017.11.01.20.54.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 01 Nov 2017 20:54:17 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Thu, 02 Nov 2017 14:54:10 +1100 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 v2 2/3] hwmon: (aspeed-pwm-tacho) Deassert reset in probe Date: Thu, 2 Nov 2017 14:53:48 +1100 Message-Id: <20171102035349.1902-3-joel@jms.id.au> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171102035349.1902-1-joel@jms.id.au> References: <20171102035349.1902-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 --- v2: - Correct horrible mistakes - Boot tested and hwmon sysfs files checked --- drivers/hwmon/aspeed-pwm-tacho.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.14.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..77bb7a4bbed4 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]; @@ -931,6 +933,15 @@ 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); + regmap_write(priv->regmap, ASPEED_PTCR_TACH_SOURCE, 0); regmap_write(priv->regmap, ASPEED_PTCR_TACH_SOURCE_EXT, 0); @@ -960,6 +971,15 @@ static int aspeed_pwm_tacho_probe(struct platform_device *pdev) return PTR_ERR_OR_ZERO(hwmon); } +static int aspeed_pwm_tacho_remove(struct platform_device *pdev) +{ + struct aspeed_pwm_tacho_data *priv = platform_get_drvdata(pdev); + + reset_control_assert(priv->rst); + + return 0; +} + static const struct of_device_id of_pwm_tacho_match_table[] = { { .compatible = "aspeed,ast2400-pwm-tacho", }, { .compatible = "aspeed,ast2500-pwm-tacho", }, @@ -969,6 +989,7 @@ MODULE_DEVICE_TABLE(of, of_pwm_tacho_match_table); static struct platform_driver aspeed_pwm_tacho_driver = { .probe = aspeed_pwm_tacho_probe, + .remove = aspeed_pwm_tacho_remove, .driver = { .name = "aspeed_pwm_tacho", .of_match_table = of_pwm_tacho_match_table,