From patchwork Wed May 24 04:53: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: 100405 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp105533qge; Tue, 23 May 2017 21:53:56 -0700 (PDT) X-Received: by 10.99.116.7 with SMTP id p7mr35767643pgc.162.1495601636808; Tue, 23 May 2017 21:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1495601636; cv=none; d=google.com; s=arc-20160816; b=z2TFA88Hlz/PJgTPivOoxvZSme0hIENfl8BiGLMAOEUSIn6AwjOkPUHHGmutm8VGAd cjIhJVAQRmnx2BF5q4BY8661HryZH4otEZzvgJaO833c2IDme1/52gukMomP0dMMkdNI /UhmTT2Re7/MqB9XE8yFLugA6W4lFTQxVkuOCc8URTw9wiPPeD71yXq0okHv2oY6Mjep mXM+HlxxGRNkrzmSwqJ2nS3jLOIvB1l6SeIj04wdO6JF/V13jB1s81vSarPuPRjZ676V kiMkszrujrca2bKlIFwVSuBc6j3I5uaPQyBIA3Hl2R2XVYLHn4LhSj/wlBvWXKbgIaCs iLxg== 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=9Qe4jWXYm/zZOLN/RzGw0QWYcgoQdwycFLjclxCzflQ=; b=EU3qRDHToQ7b8zF64aE9x9La92AIsq9XHmid0fdncED8zyPxGg+DDDNQundSb7JlpP n60tqxAXud8tK8DbYi48KL3jKRKoHPvCp4ViWcM+eMT9NZyn0NFcFK0BAd/pg/LUvFi2 SrJx4pUXBiedbpjaOhH4DIHi5xeKOXmKZQcepWtefx5H+HSvWQ0zaXR+ZXQfSONDHa7H gqovezCSYO+5vCzWhxvVeJAOfcXkwfAtTuVC6XZIeMsmKB/SXG3nkieVYrONnol/H4cA bqQ7w41p1NSsB0TFtE46PPbxijwYdtT/9OSp7l4H0HafdRi+C39l9YctrsHiIAF/n0Yx mMhg== 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 s193si17132205pgs.194.2017.05.23.21.53.56; Tue, 23 May 2017 21:53:56 -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 S966055AbdEXExn (ORCPT + 3 others); Wed, 24 May 2017 00:53:43 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:35948 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965906AbdEXExl (ORCPT ); Wed, 24 May 2017 00:53:41 -0400 Received: by mail-pg0-f67.google.com with SMTP id h64so15684582pge.3; Tue, 23 May 2017 21:53:41 -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=c7kkdU5lm6/Tr1Ca+mWWnHq1sgmdW9fByhHDYNMXUfc=; b=XVCAuvJDZfj7F06l6voP8QyGIo/eeDCNA0YW5CTDpdSZeey6O035NI6G3Iyv2m13XU Iyfb+xuU1uQ7azvViKCzxj5lcHi7Gk0443upFDJ2x/ofX1/up/WkGXRoy93/F9EqCaNl WZPg6L5C9JhISOqjrKoMKsS4CMQ6UvY4WRKS6/GfDjCJgbehUzy6o3rw6foSjZlpcss0 gsO4HhEOX4WdI/rOZbi+w7cCZr+4lK7fH3jvOHpwVRYd7gdefXfyPNuLRLSd1W3Qr2AS z2Gve5dsHXyY6fp8C5YpkoynhCnm//tcxV8rr9uYMeeTsVHPJh8aDPb6ym2komM4B5uo jdCA== 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=c7kkdU5lm6/Tr1Ca+mWWnHq1sgmdW9fByhHDYNMXUfc=; b=B40v9JyiIU8dD9pV+evwbDvQmxd5/VZIdjKQRiyzLJaAU3+4saxpXPQCheW7qZOks0 K1no3Dh/cJobUIyiFSW/lPJ4vA6mkG19QY9ENuakHwo/Kq55z6W2HveN4PiplxQqkZMO wkiGv7see9CcpuTp8jzcH+TyulwW0s/iLwrtf4Euv46BL2RO2t5L2HapPTIcmnFFYYGf xld0FbEZClM6fyhKABFX+SO1z7ivV0VS0BRHHr533ACRgWA+4t4lI7zTIKNv3H2nG1R4 MTCLpi3MEzm47PBPFxlzGT0ZeByA16RlFb8JYCwPU68plNale0kOHknZWWbmaprgchLo BuSg== X-Gm-Message-State: AODbwcD/3D6ftuevT8zihirieu89/LsaymBOHCN1FTNn4C2rev1N92fk Z8klJ1Oo9AuGCJ0u1nM= X-Received: by 10.99.96.3 with SMTP id u3mr35868900pgb.69.1495601621086; Tue, 23 May 2017 21:53:41 -0700 (PDT) Received: from aurora.jms.id.au ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id 64sm4294168pfi.111.2017.05.23.21.53.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 23 May 2017 21:53:40 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Wed, 24 May 2017 14:53:32 +1000 From: Joel Stanley To: Greg Kroah-Hartman , Rob Herring , Mark Rutland Cc: linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Philipp Zabel Subject: [PATCH] serial: 8250_of: Add reset support Date: Wed, 24 May 2017 14:53:19 +1000 Message-Id: <20170524045319.29926-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 --- Documentation/devicetree/bindings/serial/8250.txt | 1 + drivers/tty/serial/8250/8250_of.c | 16 ++++++++++++++++ 2 files changed, 17 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 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..f34dd23376f4 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,18 @@ static int of_platform_serial_setup(struct platform_device *ofdev, } } + info->rst = devm_reset_control_get_optional(&ofdev->dev, NULL); + if (IS_ERR(info->rst)) { + ret = PTR_ERR(info->rst); + if (ret == -EPROBE_DEFER) + goto out; + info->rst = NULL; + } else { + 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 +245,8 @@ static int of_platform_serial_remove(struct platform_device *ofdev) if (info->clk) clk_disable_unprepare(info->clk); + if (info->rst) + reset_control_assert(info->rst); kfree(info); return 0; }