Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3444391pxb; Sun, 26 Sep 2021 15:44:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHWZC+ryAXqpyT4Vc0qxDMM3T0TsdFC88ZjK+6TXFrlmuNQkfDHEAvJGKxsfHuWA+UpGRI X-Received: by 2002:a63:3685:: with SMTP id d127mr14054767pga.37.1632696288991; Sun, 26 Sep 2021 15:44:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632696288; cv=none; d=google.com; s=arc-20160816; b=vqqDBD0Mm2aQPzIDIjkv+On9arI9biE9onmvWVZCBhmEBiSSdflu9baeYirdKy8515 46VjTg4bZgdysr6mUSktTRBEAOD4d/NA4tcKuJ5CP6TH7+zSGqizqGuBZlkMKYZj1SFE vRqykcdxWJwxGNSvjv4uSbyrP5AfjaSxxBNoIFOuaQSlML86Vg5LJq0OsLHRRUWBNVXl yIqtr6paNJB37OAWthT3Cb0Vn1OY819M3BT706ONXMlvIRHAWayv1oN/PkVsViTz0DkX RlgRpLyQE1lee91pZtO+jmPFYLgjV5rnhjiKhBlDbSdmQi2AVQjsL8g2ANHK2OAZaLQO pj8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jkm6XIjMcFvBv/Q8SMVuuUrOs216TrQ7UEhmgPQFIpc=; b=iUE0qZcXPLGgLLa57G79iK7YUUPDM97ZtPl2y3Gab8k5Lr1Le2xfouGZX379glz0VK Kirpqu6KEkCeviU6zJXj8iou4QNbPn/efE7IfqO0KhCj89DSEXiwP+p57vSNrpEDO+DB H7pzcx+wC5t/CCFxcNfYPznjqfp65F1fcLN+AY8HAqRYoLXdMtZ55LFhztrFevY4sA9+ AVENJP91jRFwG77QsyoVS2Jp3uCaFMgWA2CY8qNYUxElc2fK7ShjfQzua/GzYadjSnjt 1k3LvbyDpnScihMNgY2bUHeUshE7gvrpeprpEGncykDx6wd/irZZPLswpc4R+qXM7EOj 0rZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SHxTucNW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 18si23069566pge.376.2021.09.26.15.44.36; Sun, 26 Sep 2021 15:44:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=SHxTucNW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232526AbhIZWpL (ORCPT + 99 others); Sun, 26 Sep 2021 18:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbhIZWoe (ORCPT ); Sun, 26 Sep 2021 18:44:34 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 227ACC06176F; Sun, 26 Sep 2021 15:42:57 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id z24so69313364lfu.13; Sun, 26 Sep 2021 15:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jkm6XIjMcFvBv/Q8SMVuuUrOs216TrQ7UEhmgPQFIpc=; b=SHxTucNWPFKt5awnTcKFilyfHzzToTizn2CZHO8A4OcDAp+cCP1/j398MjE0YVP4fY 9wO/xO+NEvv0chnef0cD2lgXgWQn9i3mkrgxJDUth+tIpF9nS4Nfc/D/BTUQbgLaIraw XGoBfLM50xiPb27dfyaBS1BBj9cjFJioyHKffcHH84ZdcGd23mSQ4gs95XV4czk4BzGc kcHkq7YGdF687ddXj8fi33DtZnUsKylTBAz9t2E07grnPE3HqxhYpsUlKLYh+BBUcEIZ 61bgxwTy30bMwB7VsmMfVMAcFHXphs+CoR5oE88oUzf2/Q1NYHdf2UVlbCvyhPeY50zL qNLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jkm6XIjMcFvBv/Q8SMVuuUrOs216TrQ7UEhmgPQFIpc=; b=LX+kTdBfvaA2LjTmPR8bkOelVmuwCEHQQZcS6Mkt4a4G+OHTl5AhXnw5Wh9hYdAwGl GbkDNEJVd5RUU4ZGduhnY/j9XyABMWeNsnK0xYL5HeVbucocEUE4mHB/CaaQHhJUPLOg 2bHMUbE+lJkMv2VEAz2PKXTkplTUScIHKBIRf2AOM1/PiewcLXGUxkZ5KAvqbr6lnOJI l/I0daE3Cs8RB7JLZKWLVk6vKJR7ou+CIVzvsIjNu8S1jSxUJWtLPheaDo7n3sgyysoI K+w7Wqp5lRpsqhlFMBaR+CwFGIa0mk62O3qZQoizD5wAS5BGvn3jdOUhCFbcDtRw2pSX kGqw== X-Gm-Message-State: AOAM530vwMs+spDIAn7XaSCmQxGKoKUDTafsYykiA/M9434MLc4QN+HS TheGNxN972Dz2xyEJvTtNYo= X-Received: by 2002:ac2:555d:: with SMTP id l29mr20600704lfk.638.1632696175552; Sun, 26 Sep 2021 15:42:55 -0700 (PDT) Received: from localhost.localdomain (46-138-80-108.dynamic.spd-mgts.ru. [46.138.80.108]) by smtp.gmail.com with ESMTPSA id m10sm1408899lfr.272.2021.09.26.15.42.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 15:42:55 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Ulf Hansson , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Lee Jones , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Nishanth Menon , Adrian Hunter , Michael Turquette Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-staging@lists.linux.dev, linux-pwm@vger.kernel.org, linux-mmc@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, Mark Brown , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Mauro Carvalho Chehab , David Heidelberg Subject: [PATCH v13 25/35] soc/tegra: fuse: Reset hardware Date: Mon, 27 Sep 2021 01:40:48 +0300 Message-Id: <20210926224058.1252-26-digetx@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210926224058.1252-1-digetx@gmail.com> References: <20210926224058.1252-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The FUSE controller is enabled at a boot time. Reset it in order to put hardware and clock into clean and disabled state. Signed-off-by: Dmitry Osipenko --- drivers/soc/tegra/fuse/fuse-tegra.c | 25 +++++++++++++++++++++++++ drivers/soc/tegra/fuse/fuse.h | 1 + 2 files changed, 26 insertions(+) diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c index f2151815db58..cc032729a143 100644 --- a/drivers/soc/tegra/fuse/fuse-tegra.c +++ b/drivers/soc/tegra/fuse/fuse-tegra.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -243,6 +244,30 @@ static int tegra_fuse_probe(struct platform_device *pdev) goto restore; } + fuse->rst = devm_reset_control_get_optional(&pdev->dev, "fuse"); + if (IS_ERR(fuse->rst)) { + err = PTR_ERR(fuse->rst); + dev_err(&pdev->dev, "failed to get FUSE reset: %pe\n", + fuse->rst); + goto restore; + } + + /* + * FUSE clock is enabled at a boot time, hence this resume/suspend + * disables the clock besides the h/w resetting. + */ + err = pm_runtime_resume_and_get(&pdev->dev); + if (err) + goto restore; + + err = reset_control_reset(fuse->rst); + pm_runtime_put(&pdev->dev); + + if (err < 0) { + dev_err(&pdev->dev, "failed to reset FUSE: %d\n", err); + goto restore; + } + /* release the early I/O memory mapping */ iounmap(base); diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h index de58feba0435..1b719d85bd04 100644 --- a/drivers/soc/tegra/fuse/fuse.h +++ b/drivers/soc/tegra/fuse/fuse.h @@ -43,6 +43,7 @@ struct tegra_fuse { void __iomem *base; phys_addr_t phys; struct clk *clk; + struct reset_control *rst; u32 (*read_early)(struct tegra_fuse *fuse, unsigned int offset); u32 (*read)(struct tegra_fuse *fuse, unsigned int offset); -- 2.32.0