From patchwork Thu Jun 14 10:45:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ley Foon Tan X-Patchwork-Id: 929216 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415p481R4dz9s01 for ; Thu, 14 Jun 2018 12:49:28 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D626EC21DA2; Thu, 14 Jun 2018 02:47:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 71BA6C21DED; Thu, 14 Jun 2018 02:46:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 464B4C21DA2; Thu, 14 Jun 2018 02:45:51 +0000 (UTC) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lists.denx.de (Postfix) with ESMTPS id F247EC21E0B for ; Thu, 14 Jun 2018 02:45:47 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jun 2018 19:45:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,221,1526367600"; d="scan'208";a="57180608" Received: from lftan-mobl.gar.corp.intel.com (HELO ubuntu) ([10.226.248.78]) by FMSMGA003.fm.intel.com with SMTP; 13 Jun 2018 19:45:42 -0700 Received: by ubuntu (sSMTP sendmail emulation); Thu, 14 Jun 2018 18:45:41 +0800 From: Ley Foon Tan To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:45:22 +0800 Message-Id: <1528973123-21858-5-git-send-email-ley.foon.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1528973123-21858-1-git-send-email-ley.foon.tan@intel.com> References: <1528973123-21858-1-git-send-email-ley.foon.tan@intel.com> Cc: Marek Vasut , Tom Rini , Joe Hershberger , Chin Liang See Subject: [U-Boot] [PATCH v6 4/5] serial: ns16550: Add reset ctrl to driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add code to reset all reset signals as in serial DT node. A reset property is an optional feature, so do not fail if a reset property is not present. If a reset property is discovered, then use it to deassert, thus bringing the IP out of reset. Signed-off-by: Ley Foon Tan Reviewed-by: Marek Vasut Reviewed-by: Simon Glass --- v2: - Added Marek's Reviewed-by. v5: - Added Simon's Reviewed-by. --- drivers/serial/ns16550.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 53550bf..9c80090 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -177,6 +178,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) #if defined(CONFIG_ARCH_OMAP2PLUS) serial_out(0x7, &com_port->mdr1); /* mode select reset TL16C750*/ #endif + serial_out(UART_MCRVAL, &com_port->mcr); serial_out(ns16550_getfcr(com_port), &com_port->fcr); if (baud_divisor != -1) @@ -370,6 +372,12 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate) int ns16550_serial_probe(struct udevice *dev) { struct NS16550 *const com_port = dev_get_priv(dev); + struct reset_ctl_bulk reset_bulk; + int ret; + + ret = reset_get_bulk(dev, &reset_bulk); + if (!ret) + reset_deassert_bulk(&reset_bulk); com_port->plat = dev_get_platdata(dev); NS16550_init(com_port, -1);