From patchwork Mon Oct 30 07:22:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 117450 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2250271qgn; Mon, 30 Oct 2017 00:22:41 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TZM+L7Vx8UNZXGpWJXu/Ck9OPeuM3GjvAwGymIEgJllPPI651/CViiUIgCnEIYXoig2zBo X-Received: by 10.98.10.21 with SMTP id s21mr7956416pfi.119.1509348161331; Mon, 30 Oct 2017 00:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509348161; cv=none; d=google.com; s=arc-20160816; b=AHqJY7lB6vUFkGHUYrAdk+wpro9geeGBdvHsggugOc97CCw9hYreAqiHJgEmml4W98 Plu4/tGQ/0EJ41lEN4JaPRwfh3P1A13YUtw5MS7hmDj1PEMYZNXaZ5enc2tUZAElyJlf 8paKYACsR4kFt7cNZNyCIsZY6Clb9rRhwb1hcYhgczfktqmOkRLrcxoo5P+zrGte9Tuc QMfGHgb37xAiJQmp9d5nisOA/Wko8IfxJZBc0eGzS5Nd6Edt6sQNQ1CU9oKypmz1utQa HMhD7my9U1uQyLkk3LoDopzGzfLAlBqMa8z6S4s2K1mi5bIKOV4A6JomvjidYFBi4cls ln+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=AkW2Td5BJ+xy7DlEYlz/lFXz7K90GfxLFstmjuwGeQI=; b=Sw2rUKi+Dx3XY3AUS1Yxih8vNYF35UC3f4kJKbT2rijAOj1eEa96S2vgsZQ4rRsrrK mdkYDxFUxIpDJJj55hsB1h+8Vi8sdg3PqCT+u92AiACaawMH/P38gAgVD+tLOoapZrxL vps5VpJTuMBo572X4LQIgMdHroAErfYE6ix2htU+K2ApC1Zhej4Z9rARZ2s/eXo8IVck KvJhnvt7y0iRds22s2i5eamc/8r9iV4njqd8u0DpIGrL7g2Fs/NdosZ5cgnojZDQmR6a wNkzTNvHWG7mzkTylDguYZF+1LE+WRGVsN75ZaosJUuUS6oma+a93wBEcdSRFBJ/McMa MASA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=G5URWAe3; 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 37si8774051plc.747.2017.10.30.00.22.40; Mon, 30 Oct 2017 00:22:41 -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=G5URWAe3; 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 S1751460AbdJ3HWj (ORCPT + 6 others); Mon, 30 Oct 2017 03:22:39 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:48961 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451AbdJ3HWi (ORCPT ); Mon, 30 Oct 2017 03:22:38 -0400 Received: by mail-pf0-f196.google.com with SMTP id b79so10306472pfk.5; Mon, 30 Oct 2017 00:22:38 -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; bh=Dpts089VMeXGSKHtnaLwV2bao8NhZwJfqKldsRHy4GQ=; b=G5URWAe3EwfVRCP5ICr6vM0Agx5czxRla6UJve1a0PN+AOa6/np5XFCUAkdZHUnS0N aUPlOA/ROIBRJufX56cgoIMQxZGV8dlac1sW9K7TSnVuG6CXDQ8zijMmYMNYjDtlNbCo +VJMIYoDBbpnExGreI5z3LAO349pRLt5EjUOnz3ZkxjhDQMQqS0kUkKXWiKh5fMp6jaX x1EPFExq2sVkqe5ftP1anz2/nfvvP6aMjXTWhtBTYcBDSZs3IrUSi63G8WZy375lw/aO TS5tFwUQoarqYXqjinyqI88kpQHp9sl1aBjztSZiSVgnFkDypaqphpm6W5FZD2MEM0P5 n3SQ== 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; bh=Dpts089VMeXGSKHtnaLwV2bao8NhZwJfqKldsRHy4GQ=; b=fb6ILVJ57ZuamQBIUvdHlbE9N2ZrtCcVld1HptCsbjxJOLOsBGZPqpwKYyh88mlGWU cqxbIgCEJ47PJIamtqL5pbFM3GPp57QG5VSSPJS5A31h6CSUBw8S5WjA77AYup8PW6ZE f02n1O7EGcjwhSfSrlspFSEhgJ9x6R22zqZdQFT3eR4MhyfHL4tf25gLz9GbwiiWEsaB smUPP9AK7aEgFfruLSuT00Nw8YeMZw3C+NBUN/1ETsaDrZBIfkxOHqGeR42VchHfbpdJ niC3n6PsaXseXFRa4uZzRYSC+YblimaeQbFpZ6DvMEbSAEem1DPNcAunj5WAYq0RR8fe hn7g== X-Gm-Message-State: AMCzsaX9Qs+VtqXxksTzbUoeRG9bRhZIJh1HwvCTHq02bFIp9HXoQKvA R6aErZhp1pO3mNOkap7zzH0= X-Received: by 10.101.67.137 with SMTP id m9mr6811252pgp.51.1509348157396; Mon, 30 Oct 2017 00:22:37 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id l79sm28846726pfb.33.2017.10.30.00.22.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Oct 2017 00:22:36 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 30 Oct 2017 17:52:28 +1030 From: Joel Stanley To: Jonathan Cameron , Rick Altherr , Rob Herring Cc: Philipp Zabel , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iio: adc: aspeed: Deassert reset in probe Date: Mon, 30 Oct 2017 17:52:18 +1030 Message-Id: <20171030072218.2094-1-joel@jms.id.au> X-Mailer: git-send-email 2.14.1 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 ADC peripheral. The device tree bindings are updated to document the resets phandle, and the example is updated to match what is expected for both the reset and clock phandle. Signed-off-by: Joel Stanley --- .../devicetree/bindings/iio/adc/aspeed_adc.txt | 4 +++- drivers/iio/adc/aspeed_adc.c | 21 ++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) -- 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/Documentation/devicetree/bindings/iio/adc/aspeed_adc.txt b/Documentation/devicetree/bindings/iio/adc/aspeed_adc.txt index 674e133b7cd7..034fc2ba100e 100644 --- a/Documentation/devicetree/bindings/iio/adc/aspeed_adc.txt +++ b/Documentation/devicetree/bindings/iio/adc/aspeed_adc.txt @@ -8,6 +8,7 @@ Required properties: - reg: memory window mapping address and length - clocks: Input clock used to derive the sample clock. Expected to be the SoC's APB clock. +- resets: Reset controller phandle - #io-channel-cells: Must be set to <1> to indicate channels are selected by index. @@ -15,6 +16,7 @@ Example: adc@1e6e9000 { compatible = "aspeed,ast2400-adc"; reg = <0x1e6e9000 0xb0>; - clocks = <&clk_apb>; + clocks = <&syscon ASPEED_CLK_APB>; + resets = <&syscon ASPEED_RESET_ADC>; #io-channel-cells = <1>; }; diff --git a/drivers/iio/adc/aspeed_adc.c b/drivers/iio/adc/aspeed_adc.c index 8a958d5f1905..0fc9712cdde4 100644 --- a/drivers/iio/adc/aspeed_adc.c +++ b/drivers/iio/adc/aspeed_adc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -53,11 +54,12 @@ struct aspeed_adc_model_data { }; struct aspeed_adc_data { - struct device *dev; - void __iomem *base; - spinlock_t clk_lock; - struct clk_hw *clk_prescaler; - struct clk_hw *clk_scaler; + struct device *dev; + void __iomem *base; + spinlock_t clk_lock; + struct clk_hw *clk_prescaler; + struct clk_hw *clk_scaler; + struct reset_control *rst; }; #define ASPEED_CHAN(_idx, _data_reg_addr) { \ @@ -217,6 +219,13 @@ static int aspeed_adc_probe(struct platform_device *pdev) goto scaler_error; } + data->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + if (IS_ERR(data->rst)) { + dev_err(&pdev->dev, "invalid reset controller in device tree"); + data->rst = NULL; + } else + reset_control_deassert(data->rst); + model_data = of_device_get_match_data(&pdev->dev); if (model_data->wait_init_sequence) { @@ -268,6 +277,7 @@ static int aspeed_adc_probe(struct platform_device *pdev) scaler_error: clk_hw_unregister_divider(data->clk_prescaler); + reset_control_assert(data->rst); return ret; } @@ -282,6 +292,7 @@ static int aspeed_adc_remove(struct platform_device *pdev) clk_disable_unprepare(data->clk_scaler->clk); clk_hw_unregister_divider(data->clk_scaler); clk_hw_unregister_divider(data->clk_prescaler); + reset_control_assert(data->rst); return 0; }