From patchwork Fri May 26 01:55:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 100537 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp42924qge; Thu, 25 May 2017 18:55:42 -0700 (PDT) X-Received: by 10.98.34.203 with SMTP id p72mr49349857pfj.118.1495763741964; Thu, 25 May 2017 18:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495763741; cv=none; d=google.com; s=arc-20160816; b=XF8uaPnlnsE2kDPsr2OmfLt5qcJ5OAOiOeFlqm+WBBhMPaHukf+jHso13h+d9uqirn i53FppgdrtMYUl/CXfesdGvdDvoqJ9HJ/r/GP2hF1J4uc1inTjLsm8y3JV+nEatf36qm 5BDVXHiP+2tmlIC36lsVNSgLhHGw7wxGJ0KJ9MFl5vSgm2lDfV2CReO/33d+arxQ5GZw mDqemFUn0gdqiRnOCrrXcdsml+WmFvZ9xDBB9eF90ARHn6VhY7Cl0sJ7fb/hjseu8WK3 Vl23LF9YppCr1VO0o83Wj57zcSsVxvHsq9opmMQALIrzhGYXifn5Nb12r/ijEm1g21Nu v2uQ== 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=SlWNOniEqp5wZpVIIvRrP23ldX/dDtECT6BnyNQuPVk=; b=JSB74Cbw3pVALIa6FZKhNdoYaYhTvuarGNawCDy8FZ9YoGgY56nPbaKj4r7hZ8s657 frwJlPW1ypkioQG7wd6zJWSVJXyLQ4Hy/BCHbsuM4sn8CH5tw50iCcbwpNu5uev6D+M9 qX+wklH9Cdsv3x3xFF5vhT8yzL2dznidB9g6d3mRMKX8c2OVsgs1HpXxxdRYzP11xPuf JfJLj8FOopb9XkX9nH4JlzgMlZisER7vbhFQ2CxGxG09EoZFIWoaf++fNfgoMOREWLDK NFwG7R1DJ1i6FYEe1NFNId2MmqCCOl571qMCDCqHlZDjcGSutFxA9HnaqsXRN/ettZdR p/vA== 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 linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-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 f16si16368174plk.239.2017.05.25.18.55.41; Thu, 25 May 2017 18:55:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-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 linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946657AbdEZBzl (ORCPT + 3 others); Thu, 25 May 2017 21:55:41 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33329 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1946604AbdEZBzg (ORCPT ); Thu, 25 May 2017 21:55:36 -0400 Received: by mail-pf0-f193.google.com with SMTP id f27so42603308pfe.0; Thu, 25 May 2017 18:55:36 -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=q7YeGn42RPPXcdbcB10LFMKxzNxgydVx+6H9Zgyox1k=; b=A4mZJe8kVYqFe3fYYWioo+ZOhkwNlXAhSztK/BVJCG0Lnc0pnnvG7/MRtEx/cthMwK gDJKtThHVsacwrf7DDglokMEpyn0rxN+Vlpxl/7j/zVNGWRlGuIwVInekzU2s3B3Enzt okRP13ZSIfWcOjD5KZToTt0OvYoGaFsR8es6B8BCPYznPke+sYavWZsHg7kc8fiXRwMS Az7nraA5G3uMTINtaOQkkj7sgcsws6puJLzywbNGZR3CBQehdAYinN3PzAob1gAWcPlE YQ8yPWqc02u59llC6AtPA/jlgf5PmJRfn66tENjgUV2VFj/LsSGPDRKdl34g2MTAa+cu WdPQ== 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=q7YeGn42RPPXcdbcB10LFMKxzNxgydVx+6H9Zgyox1k=; b=aNutL39/ZsrsVgIhi0tpydzSR1z8JCy60GU/wUwtUjhxtbeOeKob5bclUPFtGwXnjJ fppw16J1FNHHwc2R4iIOPK1JzZwFAmqPU+5DKwrXCFlqZKAtnC0jUB2T2/46FmDTcV0Y /5T2N4xRxzkWkpn1LN2vldseiXpuQYAD/kaGGaxqL+mV/qAbk6HH+MNTciRjnZCaQYDt FusSbDOHkpaRouVKcZak63fmjeV59eRIQfJ8ixRajwpiLZodVhHUAA1+5Jh8HyRs11KE EesKGHKLCywPrgJ0qzKibkmnclzDRyL1wpNbTmgCHzuEH+EceNAtYOITa49+ZAHznP/L hCUg== X-Gm-Message-State: AODbwcCmnKIM6eETVtNqFGkSl4e1vshpdA1Em9kWhoGHTxFqmnQZj+hS ysmYl7mibx883A== X-Received: by 10.98.58.83 with SMTP id h80mr49225557pfa.27.1495763735563; Thu, 25 May 2017 18:55:35 -0700 (PDT) Received: from aurora.jms.id.au (bh02i525f01.au.ibm.com. [202.81.18.30]) by smtp.gmail.com with ESMTPSA id c67sm11833258pfe.37.2017.05.25.18.55.29 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 25 May 2017 18:55:34 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Fri, 26 May 2017 11:55:24 +1000 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 v2] serial: 8250_of: Add reset support Date: Fri, 26 May 2017 11:55:19 +1000 Message-Id: <20170526015519.11865-1-joel@jms.id.au> X-Mailer: git-send-email 2.11.0 Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org This adds the hooks for an optional reset controller in the 8250 device tree node. Signed-off-by: Joel Stanley --- 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 linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Philipp Zabel 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..e95cc9698c32 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 @@ -231,6 +240,7 @@ static int of_platform_serial_remove(struct platform_device *ofdev) if (info->clk) clk_disable_unprepare(info->clk); + reset_control_assert(info->rst); kfree(info); return 0; }