From patchwork Tue Aug 21 13:57:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 960346 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=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41vsh66N9vz9s7c for ; Tue, 21 Aug 2018 23:57:58 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id DD2D8C21C3F; Tue, 21 Aug 2018 13:57:55 +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 A8982C21C6A; Tue, 21 Aug 2018 13:57:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 88D18C21C6A; Tue, 21 Aug 2018 13:57:50 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.10]) by lists.denx.de (Postfix) with ESMTPS id F214CC21C3F for ; Tue, 21 Aug 2018 13:57:49 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 41vsgx08ZVz1qvTP; Tue, 21 Aug 2018 15:57:49 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 41vsgw72GKz1r1Jx; Tue, 21 Aug 2018 15:57:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id J3gnezgnTUG1; Tue, 21 Aug 2018 15:57:47 +0200 (CEST) X-Auth-Info: nqH4RRn7sVM7gV6tsU6wupOFD4YA+SNUhYl2y47QqR4= Received: from localhost.localdomain (cst-prg-29-56.cust.vodafone.cz [46.135.29.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 21 Aug 2018 15:57:47 +0200 (CEST) From: Marek Vasut To: u-boot@lists.denx.de Date: Tue, 21 Aug 2018 15:57:43 +0200 Message-Id: <20180821135743.31421-1-marex@denx.de> X-Mailer: git-send-email 2.17.1 Cc: Marek Vasut Subject: [U-Boot] [PATCH] mtd: nand: denali_dt: Add reset support 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 optional reset support into the Denali NAND driver. In case there is a valid reset entry in the DT, the reset gets deasserted before the NAND controller gets used. Signed-off-by: Marek Vasut Cc: Masahiro Yamada --- drivers/mtd/nand/denali_dt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/mtd/nand/denali_dt.c b/drivers/mtd/nand/denali_dt.c index 65a7797f0f..6fcd7d3843 100644 --- a/drivers/mtd/nand/denali_dt.c +++ b/drivers/mtd/nand/denali_dt.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "denali.h" @@ -64,6 +65,7 @@ static int denali_dt_probe(struct udevice *dev) const struct denali_dt_data *data; struct clk clk; struct resource res; + struct reset_ctl reset_ctl; int ret; data = (void *)dev_get_driver_data(dev); @@ -97,6 +99,13 @@ static int denali_dt_probe(struct udevice *dev) denali->clk_x_rate = clk_get_rate(&clk); + ret = reset_get_by_index(dev, 0, &reset_ctl); + if (!ret) { + reset_assert(&reset_ctl); + udelay(2); + reset_deassert(&reset_ctl); + } + return denali_init(denali); }