Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2577917pxb; Tue, 21 Sep 2021 03:03:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEeiuIV9aJ6PY4AF0fTMRkqy1d0tnYq+iTjfq/oDnlguScGfsxTpMrzKJNDnyK57MVa2D4 X-Received: by 2002:a19:740e:: with SMTP id v14mr22318107lfe.483.1632218632587; Tue, 21 Sep 2021 03:03:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632218632; cv=none; d=google.com; s=arc-20160816; b=e+endlsmJHp79GAErqx+asSCW/+tPo68oJP15W4auFFXql8JSkDGDLrEoyp3CzSlkm lACtYmOrByu8z1O1lIeEUeHE+v3RbMraVI9uLumebwcSFw26d/tzMjM/9RIob1Tylo/c /6GZ2n6UEaeYJWPTvQzrfFZYTEn/Di82wr/DVso3/Z6XHLWu1WZl/UUzBCeUzHbyoqst ErCaGAuRdBsyHc36lu9agAewYLHgtgb4goK1lFAV57pNbvxrBPl/xfO+lPmV/zaIfHKa 1mzDBoH4DmbZs7yynQiCoBp4mCTckm+TYrWiY0iq7ZRPiQM+NGUrsNKJs5EXZitZvyCi rttw== 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; bh=99fefvRhnSuftFnRn+lbE6w8u3E/DB6rlodpyW/5t10=; b=MLZ+Ci0gykJjPkGhfEsuebMCIcFI9f7kOrWZ3mFFnH5FBxxGytamhw1B2pa3Bfj0hy gpv57ay113nLJY3oQStmdXErbckqHnI0qEyE93WnKUDm8ONx9+8j/ovf2cIwF90HqrU8 3fW69bYBSuZC2whq8olwArPCM1LoPd+3cUO3ZgXL0+9+DpnAmSJkOo6jN2UxX72yYzPg JX440Im51u0eVAHabgnu9nFupaIyxyZAY7wDlUQWFCoA/sTrG1kDmnitAs34NdDbO57H IRmgqWIE0Qxb5Cg+jPnpLcL7/PYNXPgUOgATBHKXSAoxBYBOPOwNDFfFAghElL9ZnkoH qjqw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h24si15029143ejt.376.2021.09.21.03.03.28; Tue, 21 Sep 2021 03:03:52 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231613AbhIUKDJ (ORCPT + 99 others); Tue, 21 Sep 2021 06:03:09 -0400 Received: from muru.com ([72.249.23.125]:35438 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231586AbhIUKDC (ORCPT ); Tue, 21 Sep 2021 06:03:02 -0400 Received: from hillo.muru.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTP id 5264F8207; Tue, 21 Sep 2021 10:02:00 +0000 (UTC) From: Tony Lindgren To: linux-omap@vger.kernel.org Cc: Dave Gerlach , Faiz Abbas , Greg Kroah-Hartman , Grygorii Strashko , Keerthy , Kevin Hilman , Nishanth Menon , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 4/9] bus: ti-sysc: Add quirk handling for reset on re-init Date: Tue, 21 Sep 2021 13:01:10 +0300 Message-Id: <20210921100115.59865-5-tony@atomide.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210921100115.59865-1-tony@atomide.com> References: <20210921100115.59865-1-tony@atomide.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At least am335x gpmc module needs a reset in addition to re-init on resume. Let's add a quirk handling for reset on re-init. Signed-off-by: Tony Lindgren --- drivers/bus/ti-sysc.c | 10 ++++++++++ include/linux/platform_data/ti-sysc.h | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c --- a/drivers/bus/ti-sysc.c +++ b/drivers/bus/ti-sysc.c @@ -157,6 +157,7 @@ struct sysc { static void sysc_parse_dts_quirks(struct sysc *ddata, struct device_node *np, bool is_child); +static int sysc_reset(struct sysc *ddata); static void sysc_write(struct sysc *ddata, int offset, u32 value) { @@ -1440,6 +1441,15 @@ static int sysc_reinit_module(struct sysc *ddata, bool leave_enabled) if (error) dev_warn(dev, "reinit resume failed: %i\n", error); + /* Some modules like am335x gpmc need reset and restore of sysconfig */ + if (ddata->cfg.quirks & SYSC_QUIRK_RESET_ON_CTX_LOST) { + error = sysc_reset(ddata); + if (error) + dev_warn(dev, "reinit reset failed: %i\n", error); + + sysc_write_sysconfig(ddata, ddata->sysconfig); + } + if (leave_enabled) return error; diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h --- a/include/linux/platform_data/ti-sysc.h +++ b/include/linux/platform_data/ti-sysc.h @@ -50,6 +50,7 @@ struct sysc_regbits { s8 emufree_shift; }; +#define SYSC_QUIRK_RESET_ON_CTX_LOST BIT(29) #define SYSC_QUIRK_REINIT_ON_CTX_LOST BIT(28) #define SYSC_QUIRK_REINIT_ON_RESUME BIT(27) #define SYSC_QUIRK_GPMC_DEBUG BIT(26) -- 2.33.0