From patchwork Mon May 29 09:57:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 100652 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp258777qge; Mon, 29 May 2017 02:58:20 -0700 (PDT) X-Received: by 10.98.156.29 with SMTP id f29mr16381682pfe.82.1496051900427; Mon, 29 May 2017 02:58:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496051900; cv=none; d=google.com; s=arc-20160816; b=dNHj7rnQqSz1iS+ABHldbyhUjeXBggo7A07xXsRJDQQvpnjgo/MuvNEIOOE1hnNlU0 3Pv/VLpexu3TMRRbWDgPXXke26YvVYOh7Oul7jkKvbnF67Upjc5wn/swpTNVjEyhyVuh ywQbrqUTVaG00dbPnXdi6x2yXhNwNQAFlUXB/3uY3tx2h/P6enl7Nj2Pmyi2CMO5j9m1 LrIlmUu1IIhcLfCs496TXgeSWZC60ay5Vd7rnYjfg9HzbpDluo54rrmLrYfaWr52Uvtn bm4TX/d2t3phUDY6CmSkBbAn6+fekGlq+J+Cpm9TvGLt+jN6YTlJ6JMTtC/VTmBzaQb7 RlRA== 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=EKNypZX1uuVoU4ygcFZn0odC8HC6myqo2dsm8BLgYX0=; b=vpkcg0YrBB4+wTdDEOx1FJafCCbxTxJvAJvC/82zDA0ncL+fRfnti3sqURUFH9s5/A 8xu788G0ekfoyh+YS1pV1lSp4ZcP2d9QJPE0AZqYfOOvTGlLK8I9a2ZkrzDh/JKyWvmX JcNVGEv4zkrSMfOZzgjwtJ7KvWnztOQ0/HhNoz2Ehz3S+Zr0H3ywr9FmhU+WnW/ng53T rjSU82xnOYwbMxCD3esg2HXMBkGePIt770qxygTID+kNIXzx0Zbt/ZiL5PqBXPvUnzPW 5G8OjxN/AibPzEhwo/NTLTWv5HxmeyQ7DahLmgyYu5mqoUW1URnz5dcBI4BezboJuNsP 2EdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; 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 e191si9898991pfc.299.2017.05.29.02.58.20; Mon, 29 May 2017 02:58:20 -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; 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 S1751038AbdE2J6O (ORCPT + 7 others); Mon, 29 May 2017 05:58:14 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:35374 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751029AbdE2J6M (ORCPT ); Mon, 29 May 2017 05:58:12 -0400 Received: by mail-pf0-f194.google.com with SMTP id u26so11731142pfd.2; Mon, 29 May 2017 02:58:06 -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=B+5d8j7LJd44hCfL5Y51dmeuh2UHVgpm/MZlsuI7r7Y=; b=BlxbZ7Hoc5P4QUxpcuUeT9WpLzovk8qu2qpi30M++eUaqOvUxEkmeq474J92u/AYFe oyV3GKtV15sp5qHDyFi4F4FHnkHxP5jFpqSUJEszzXOZ5Sh89GW+/uozny5JTSVt1VcQ +lhXxD+h93MJPtJ7Rn4jQN+iCe42MwemLFpwcs9OKS36ELvosICGrXcNq7aLVRjRZDWM vw67l+L1Je09GDg/AavkjrG616joLlx632TYsiAr6+t2jubU3Oye95owbvKH1Z9XNOZ1 4a8QY3FlshKp9kxz0KSjLJkHHpf1F1TCOstSK43GA9uCv4dUFpwJYbQcdAGIz22zc8jd nRVQ== 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=B+5d8j7LJd44hCfL5Y51dmeuh2UHVgpm/MZlsuI7r7Y=; b=PvHSOtBWmeglI0Q/HTQGTJko4VyhsPLYmK9M7gZrjZhj5+Zs3BKT9pzL8cVGKC176H i1Zj0HmazMH6kmDIuapgM1bvBKkis/oT/+/ZqqKMmpMJsdG2sQoDIM/xU/VR+o0jXwav qFwRh4V+IsCn7gRiiZ+SIK+QrJ+GwKLXCKy3gbrKZN80NOGipK99HiRzbTvliY4JTO7L L0O1GZ1RR/JYftjkuBJnUNyKPkg/yQzVRYrWqgc3ngLM4oVcKDDvCOx++WA3RFFc2oSC 1X7w46qtIWk60hpRPNYsDahltnecYcECJRFIpN2/wZatrG7AU+C1rpJsQd8PsxyW8vTj z65g== X-Gm-Message-State: AODbwcDLyn08gIvWaRTRJuRKPDhEEymkjCYOf/x1Gtn9cPfRcNk4wHik dj2Yx4npXumF0YxKBr4= X-Received: by 10.98.150.211 with SMTP id s80mr16690694pfk.201.1496051886226; Mon, 29 May 2017 02:58:06 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.14]) by smtp.gmail.com with ESMTPSA id 15sm15093308pfk.115.2017.05.29.02.58.01 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 29 May 2017 02:58:05 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Mon, 29 May 2017 19:27:57 +0930 From: Joel Stanley To: Greg Kroah-Hartman , Rob Herring , Mark Rutland , Philipp Zabel Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] serial: 8250_of: Add reset support Date: Mon, 29 May 2017 19:27:52 +0930 Message-Id: <20170529095753.1210-1-joel@jms.id.au> X-Mailer: git-send-email 2.11.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds the hooks for an optional reset controller in the 8250 device tree node. Signed-off-by: Joel Stanley Reviewed-by: Philipp Zabel --- v3: - deassert reset after disabling clock in _remove to to match _setup order v2: Address Philipp's comments. Thanks for the review! - use _shared variant - remove unnecessary error handling Documentation/devicetree/bindings/serial/8250.txt | 1 + drivers/tty/serial/8250/8250_of.c | 10 ++++++++++ 2 files changed, 11 insertions(+) -- 2.11.0 -- 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/serial/8250.txt b/Documentation/devicetree/bindings/serial/8250.txt index 10276a46ecef..63e32393f82b 100644 --- a/Documentation/devicetree/bindings/serial/8250.txt +++ b/Documentation/devicetree/bindings/serial/8250.txt @@ -45,6 +45,7 @@ Optional properties: property. - tx-threshold: Specify the TX FIFO low water indication for parts with programmable TX FIFO thresholds. +- resets : phandle + reset specifier pairs Note: * fsl,ns16550: diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/8250_of.c index 1cbadafc6889..0cf95fddccfc 100644 --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -19,11 +19,13 @@ #include #include #include +#include #include "8250.h" struct of_serial_info { struct clk *clk; + struct reset_control *rst; int type; int line; }; @@ -132,6 +134,13 @@ static int of_platform_serial_setup(struct platform_device *ofdev, } } + info->rst = devm_reset_control_get_optional_shared(&ofdev->dev, NULL); + if (IS_ERR(info->rst)) + goto out; + ret = reset_control_deassert(info->rst); + if (ret) + goto out; + port->type = type; port->uartclk = clk; port->flags = UPF_SHARE_IRQ | UPF_BOOT_AUTOCONF | UPF_IOREMAP @@ -229,6 +238,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev) serial8250_unregister_port(info->line); + reset_control_assert(info->rst); if (info->clk) clk_disable_unprepare(info->clk); kfree(info);