Received: by 2002:ab2:7988:0:b0:1f4:b336:87c4 with SMTP id g8csp107601lqj; Thu, 11 Apr 2024 11:08:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUCG8hSTo23H1GbjwPHQtRS2dAW9T3qnOaf0vuYYJ8Zw48gGXnwVoFCK0pWXkyuAhsjBi8eta9Wr/E5xyeEgvcTOv9loNH5dhGA4P9ZcA== X-Google-Smtp-Source: AGHT+IElw4CtoLIcXXT7evAqdWATvRBCJ1PjvgccVlD7YXy7FARilJZt01VWIHrtFHTymVWQ5cE4 X-Received: by 2002:a05:6870:7312:b0:22e:e0c5:c729 with SMTP id q18-20020a056870731200b0022ee0c5c729mr368235oal.3.1712858920926; Thu, 11 Apr 2024 11:08:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712858920; cv=pass; d=google.com; s=arc-20160816; b=Ej6XEI2BKAyU2Nc3gcCMHVfSeVvJTPIUb/ONGrne3x3N4M0RgsoxAh3Xv+9tEotL3y yqSbtmPE2kgpSkn3+uJUHO/hqhyA0kCTLKutrRllvG4w1rNHQeRLBhqgQzJhpxBF67XJ Tm0QCYNG4WDn1lcXFos8w7sJAO0Vm1P/T+iF5eCfo0vT4LifkjLhL9XJNX1Fk8GRNQf2 Rkm8ndcBY+2Web9eDjqhzP14EczVtODDQM8CTbaVRlPZhBIMyS0ljM0ycyipN7gKuudS Al4qFCkl5Buh3Dp2AdKEiE3pmXu1PwPPIlW4BMhR/ZYQPAYD9tTom2LdsDH960SKsYsn kgQA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=y2S8ps23JPLXgrPfGEzilsfp2O+tu49YWzC18wHWdrw=; fh=2hp/d+F3EkihomLY5h1YXRz2N8loIpR2L7KcrVtYhuk=; b=rkWMCulfhy5IYuYXkc/Y/f9UCJlL+NvA596v48sKSvRstBp6tvYg0ufXkbcn3FZrcx qR5e5E2M+gEP1Xj95/IJ8BB/was3a/sLZD9GbMkO5m12kl7cKlRnf8dUFC/E8TAlejzm SRtY0cVjDg9GmQQWpFGTXs+zUTNpuQ9tap+OJPJWC3AmF1okKpwnZXsiGsbFTB3MU/9e JPtpeKBBu7QCke+dlK6lDCi1GPmxhaEdnYBD5cp9moFVcDJ/M4ZUiu9N9lt8rBmzZcuy XZdQZWZJsB4EGgEOAjTR5vs/chDFBbFry+wnIuWUCbHb0T9PP8EwvKHOiQZhqdZY0PMF jQOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=ew59QKNq; arc=pass (i=1 spf=pass spfdomain=engicam.com dkim=pass dkdomain=aruba.it dmarc=pass fromdomain=engicam.com); spf=pass (google.com: domain of linux-kernel+bounces-141366-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=engicam.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f17-20020ac85d11000000b0043448da0dd7si2189632qtx.95.2024.04.11.11.08.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 11:08:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-141366-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@aruba.it header.s=a1 header.b=ew59QKNq; arc=pass (i=1 spf=pass spfdomain=engicam.com dkim=pass dkdomain=aruba.it dmarc=pass fromdomain=engicam.com); spf=pass (google.com: domain of linux-kernel+bounces-141366-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-141366-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=engicam.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id DB0BD1C241BB for ; Thu, 11 Apr 2024 18:08:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A212184115; Thu, 11 Apr 2024 17:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=aruba.it header.i=@aruba.it header.b="ew59QKNq" Received: from smtpdh18-1.aruba.it (smtpdh18-1.aruba.it [62.149.155.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AE8704F890 for ; Thu, 11 Apr 2024 17:01:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=62.149.155.132 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712854875; cv=none; b=fav5rciTK7gqPk5O1QMNIGUpk5IarzftRyGeazu3c7uxG68bPsq27vb2ytBBmxStZSNTsMR6pF0zLpQG6AA0hFiZb+TKnIxDwToBrlGacNc0ujLA46AsvGd1joCehVQYTNCXTjbUEGG2lvw/vNYMUt/DObEWQd4jgcVw4DpvZ7g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712854875; c=relaxed/simple; bh=KCcJfOmxJYJnvn9ISK24CrnwVdcYHY0uQ34DDVMZgBw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=gQSSK0YZBsVGZnBDJljnDWA079n/i/fxysEUczAFYZfwooI+kvTN3o6dxGjgISmLjSzOlClTIqm9JUJ4/M6aKowvA+3vsgPh9ewEYXDPfrlfUiI7JzyMkI+qn7NTKujSyMERspSif0z1Z7Gy5FFbOSmLhk/BlyJtmN+sU2lNppE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=engicam.com; spf=pass smtp.mailfrom=engicam.com; dkim=pass (2048-bit key) header.d=aruba.it header.i=@aruba.it header.b=ew59QKNq; arc=none smtp.client-ip=62.149.155.132 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=engicam.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=engicam.com Received: from engicam.com ([77.32.15.153]) by Aruba Outgoing Smtp with ESMTPSA id uxkPr7ow7wcFeuxkQrcyee; Thu, 11 Apr 2024 18:58:03 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aruba.it; s=a1; t=1712854683; bh=KCcJfOmxJYJnvn9ISK24CrnwVdcYHY0uQ34DDVMZgBw=; h=From:To:Subject:Date:MIME-Version; b=ew59QKNq/dbvf09XUQXPFM11uk+0XOHJ0L01PPrB145QB6nseDenN0R/m6y0i2fMt 1lKGtSMvmbFnnxoz4obSrXvTJZiuub0+lopDsrR6qJwItZgPt9exbDDLauMnDnnIrs oNaETgyzbnYUPYk6w+FOP05AmY67FgnOWMcCyCfq36BbblePZZUn8ZdCAx4UFepcOK Jdi13I0WyL5QbxS8hPjdiFCSk6MPajnKA3/U0WM8uPmDnpgIyUhJG6cZeZ+/uk1v50 RT13Ocd8mYGQuqau2RZ2JApU7HemZxpRhix9AHFGTIQaE/54wfCOKPCHgBSoZqQC2F DFqECU4xYBHNA== From: Fabio Aiuto To: Mark Brown , Liam Girdwood , Krzysztof Kozlowski , Rob Herring , Conor Dooley Cc: Robin Gong , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Matteo Lisi , Mirko Ardinghi Subject: [PATCH v3 2/2] regulator: pca9450: make warm reset on PMIC_RST_B assertion Date: Thu, 11 Apr 2024 18:58:01 +0200 Message-Id: <20240411165801.143160-3-fabio.aiuto@engicam.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240411165801.143160-1-fabio.aiuto@engicam.com> References: <20240411165801.143160-1-fabio.aiuto@engicam.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfOXgWXYZkPR/W7EqJpK6GrkzYKGI0D0u392Yt7Fs5V+n1UKQ0kZz1z5NNWtuu83KC+bc2AsD01BF4lsLIHtmmxD18xu/ggXjIkamosPq/eXf5voqd842 OlWURp/RrHmZFQye1IKTPPMimN94zyC9ZbS7VyLC64ml7sMCQzTznDA/IR/oD1ui0pD6TW4Ls5tmkjoq5HOxLS4Y9RWrVAQbrjaL5hgF0/LhonKWESleI9Ek qa6UIESedr5cYNDiPAX9t9+nJ0bLKjlZcFO32o9zFoRO4XzRUk9wFRpcbrT3jp5BJKFpXlU5TqXhHf2ifQeRBJCrInROUd1p1ITKfnCl6CUy1lnBdpwxOJNE Tk/aVNelEWNbMN+685KH6GQQhdu/634q6TGbi/jJQJU9qbox7muBZGyOMqlL54aa42KGRab/aY7zG4G2z6cZMhA1ZN7U1+svjtK2mjrWSU07t7MzwNgqzPQQ eRkqrL6S9PT1kyjK The default configuration of the PMIC behavior makes the PMIC power cycle most regulators on PMIC_RST_B assertion. This power cycling causes the memory contents of OCRAM to be lost. Some systems needs some memory that survives reset and reboot, therefore this patch is created. This patch extends commit 2364a64d0673 ("regulator: pca9450: Make warm reset on WDOG_B assertion") to the other reset input source PMIC_RST_B as per pmic specs. Cc: Matteo Lisi Cc: Mirko Ardinghi Signed-off-by: Fabio Aiuto --- drivers/regulator/pca9450-regulator.c | 11 ++++++++--- include/linux/regulator/pca9450.h | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index be488c5dff14..3a7f238de1a5 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -999,11 +999,16 @@ static int pca9450_i2c_probe(struct i2c_client *i2c) else reset_ctrl = WDOG_B_CFG_COLD_LDO12; - /* Set reset behavior on assertion of WDOG_B signal */ + if (of_property_read_bool(i2c->dev.of_node, "nxp,pmic-rst-b-warm-reset")) + reset_ctrl |= PMIC_RST_CFG_WARM; + else + reset_ctrl |= PMIC_RST_CFG_COLD_LDO12; + + /* Set reset behavior on assertion of WDOG_B/PMIC_RST_B signal */ ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL, - WDOG_B_CFG_MASK, reset_ctrl); + WDOG_B_CFG_MASK | PMIC_RST_CFG_MASK, reset_ctrl); if (ret) { - dev_err(&i2c->dev, "Failed to set WDOG_B reset behavior\n"); + dev_err(&i2c->dev, "Failed to set WDOG_B/PMIC_RST_B reset behavior\n"); return ret; } diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h index 243633c8dceb..d87f0b410b00 100644 --- a/include/linux/regulator/pca9450.h +++ b/include/linux/regulator/pca9450.h @@ -227,6 +227,12 @@ enum { #define WDOG_B_CFG_COLD_LDO12 0x80 #define WDOG_B_CFG_COLD 0xC0 +#define PMIC_RST_CFG_MASK 0x30 +#define PMIC_RST_CFG_NONE 0x00 +#define PMIC_RST_CFG_WARM 0x10 +#define PMIC_RST_CFG_COLD_LDO12 0x20 +#define PMIC_RST_CFG_COLD 0x30 + /* PCA9450_REG_CONFIG2 bits */ #define I2C_LT_MASK 0x03 #define I2C_LT_FORCE_DISABLE 0x00 -- 2.34.1