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: 767198 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wYq3L1xW3z9s8H for ; Fri, 26 May 2017 11:55:42 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="A4mZJe8k"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1946658AbdEZBzl (ORCPT ); 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: 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 --- 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(+) 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; }