Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1348805pxf; Fri, 19 Mar 2021 05:25:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVRYeXyoORR2v4XxNmemgzIBjvJIo1sbN1CpFZQMhHrbm649s6R8B5rcmpEMhqQqmCNzOn X-Received: by 2002:a17:907:d10:: with SMTP id gn16mr3994765ejc.304.1616156705964; Fri, 19 Mar 2021 05:25:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616156705; cv=none; d=google.com; s=arc-20160816; b=iEs/NXfgIcnAu1l3Hj6LXf0+pOWC7b1Jdco2wnMmBVMXfvgJ97nb2r2FbnZxSgnySo c1RI5u+Npb4TljaG4ApMA3goAPq/0F56SaTxSirGQnrqFEdcojlQc6MNVDy2mGy0qiBh SVUPJD1xJY3liBgv+aRBSXlR/bMsq+e2qg9lIjp8htCx6UP3dtITislmPhcrNLBbDKsy CJioJAXu4ATcckYm2kGTb9wJ+2pQdOCL/ZaPHVojFcDYKKBXEpfJC5b4S0KM3PZxUd3m K91kSw7mj6uYmK99KcO7BsEZDz06/13DvAJhibw02S8RlvuceaXxTZIbH5PE+lwKn8V+ srVQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XDMp0FBvxz4sg/pADiW3gb+M1O3YVahsWaA8ycXpRdQ=; b=re/JIRKIAGdwvyCebX6eNl8p5qux+VVVFRmD4W9k1G76UvF9H33BMS/VSYIE+5y2/E PdKQ2WjaSaZnPjvgLrKtpJjjt8KG2hDgl3zMXOLZH7PliIFq3p8HS8lL365lxdRwl9Gw f3Taq+O1lqdUlxhypnc43keVvGy2qe1cBLEP370afxYhnJ9cadp9Bcj8Sz3Lw+35L/rG VcsNyQpsUd3btPHOnhCFXI9SN7FrL7yere3Agz+agEU4M7kDPFC3xpbtAutDHnWcdhoO xQS12ttXXgVgUno823MweUxQMcGUBpKetXrPZEFYMmi3BeONBnaLNGamdpZ9Iry35utS oaew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g1ZXCJiz; 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=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn42si4593643ejc.583.2021.03.19.05.24.43; Fri, 19 Mar 2021 05:25:05 -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=@linuxfoundation.org header.s=korg header.b=g1ZXCJiz; 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=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229964AbhCSMWZ (ORCPT + 99 others); Fri, 19 Mar 2021 08:22:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:60580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231401AbhCSMVo (ORCPT ); Fri, 19 Mar 2021 08:21:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D008B64F72; Fri, 19 Mar 2021 12:21:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1616156504; bh=VXkTG6rOTkWlJ9hdLPjJeSzlcFrA8+DVDxsQY5T/Fys=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g1ZXCJizfgcyw9E5L/HB2BnK78vq/76bF+KbCG42jPO/h73wUzFXdPcrKIYnmVArR zVotDY85VACRHJQjSMQApT/AoxnBf9OS45icoKL1KzBz/rI6R5a19aFP90+vxBUDHn JkGdpQ1fP1BYLM4m/LrGflB72NxxypY10NCXByZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frieder Schrempf , Mark Brown , Sasha Levin Subject: [PATCH 5.11 15/31] regulator: pca9450: Enable system reset on WDOG_B assertion Date: Fri, 19 Mar 2021 13:19:09 +0100 Message-Id: <20210319121747.691843661@linuxfoundation.org> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210319121747.203523570@linuxfoundation.org> References: <20210319121747.203523570@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frieder Schrempf [ Upstream commit f7684f5a048febd2a7bc98ee81d6dce52f7268b8 ] By default the PCA9450 doesn't handle the assertion of the WDOG_B signal, but this is required to guarantee that things like software resets triggered by the watchdog work reliably. As we don't want to rely on the bootloader to enable this, we tell the PMIC to issue a cold reset in case the WDOG_B signal is asserted (WDOG_B_CFG = 10), just as the NXP U-Boot code does. Signed-off-by: Frieder Schrempf Link: https://lore.kernel.org/r/20210211105534.38972-3-frieder.schrempf@kontron.de Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/regulator/pca9450-regulator.c | 8 ++++++++ include/linux/regulator/pca9450.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/drivers/regulator/pca9450-regulator.c b/drivers/regulator/pca9450-regulator.c index 1bba8fdcb7b7..833d398c6aa2 100644 --- a/drivers/regulator/pca9450-regulator.c +++ b/drivers/regulator/pca9450-regulator.c @@ -797,6 +797,14 @@ static int pca9450_i2c_probe(struct i2c_client *i2c, return ret; } + /* Set reset behavior on assertion of WDOG_B signal */ + ret = regmap_update_bits(pca9450->regmap, PCA9450_REG_RESET_CTRL, + WDOG_B_CFG_MASK, WDOG_B_CFG_COLD_LDO12); + if (ret) { + dev_err(&i2c->dev, "Failed to set WDOG_B reset behavior\n"); + return ret; + } + /* * The driver uses the LDO5CTRL_H register to control the LDO5 regulator. * This is only valid if the SD_VSEL input of the PMIC is high. Let's diff --git a/include/linux/regulator/pca9450.h b/include/linux/regulator/pca9450.h index 1bbd3014f906..ccdb5320a240 100644 --- a/include/linux/regulator/pca9450.h +++ b/include/linux/regulator/pca9450.h @@ -216,4 +216,11 @@ enum { #define IRQ_THERM_105 0x02 #define IRQ_THERM_125 0x01 +/* PCA9450_REG_RESET_CTRL bits */ +#define WDOG_B_CFG_MASK 0xC0 +#define WDOG_B_CFG_NONE 0x00 +#define WDOG_B_CFG_WARM 0x40 +#define WDOG_B_CFG_COLD_LDO12 0x80 +#define WDOG_B_CFG_COLD 0xC0 + #endif /* __LINUX_REG_PCA9450_H__ */ -- 2.30.1