Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4591989pxj; Wed, 12 May 2021 08:51:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEBGFGwkQwDNxEeTcI3cyz6T2rMfG9WdnwFUBpnaMc/P7IMyp2Y5kI1D8/cOyJonGbNJ8y X-Received: by 2002:a4a:e548:: with SMTP id s8mr28448194oot.63.1620834664672; Wed, 12 May 2021 08:51:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620834664; cv=none; d=google.com; s=arc-20160816; b=NosRWEMZ8XsMIyb3gEU7VOeD53PmGy/Vlnssf8FhCap5pjUjlsTXCnphxVYi/BBFYC enqaec8VgNypJYdD14aub6dkuu9yzw5XnnAiE9B3TF6imH4QzwghBOhFFckQvtj58v5o dJFprYtQjbZ37LmUV5hiskxVscBQ98x7VQ7465c9auIISdKfcb/2XCuP1Gla9Z/XMlNw fCL+1gfGGaKyJJGqqmLtyiTUfHB4CpzJ7f+QK4YNtuqvgtST3J/KmFDu6ySSQXBGq2hL DphzQ2SriMr9V3fwrPn84ka6IO6DpjOYN2ctPoodhh4aX21//wGId2OeIhq9aJLjbUNR 1JHA== 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=aJTxUjlYoxwo1J6TO4puK5HUd8KuR696e80g+yoHrRk=; b=bxvIrDEVimp9ViAytfBcBYl7v1/jBHVwAG6aSiZc/U3SvqEMYaVT2+kcurYEHo9rti yfXmHTeNM5pJ2jwNeCuFq06kIc/1R1MOv/OJUzcuF26NPrgg0WGZ3e0hFYLxSWk5Nr2d Z4PIU4DQszvNdNnsHOaozPhCHTtdjcf0/9NsI2cxe4IJgT+oClOXx4nDQEjX9mTy0NPS xjN41jgIqRS+A+9q3jgbD4Wb5aakJDDEGGLmvBZ5dnvgmZcDpDkxHBXgx3yri6vXZyuO d0T+UJPTfevh16h1kYraYs99GVXJJEC5i6eDf+YSPOvwSpa+7gcDLfui0PkGbPrx+bTW bhsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=o6kmMbL4; 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 u2si249463oif.6.2021.05.12.08.50.50; Wed, 12 May 2021 08:51:04 -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=o6kmMbL4; 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 S232871AbhELPvH (ORCPT + 99 others); Wed, 12 May 2021 11:51:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:40742 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234803AbhELPZo (ORCPT ); Wed, 12 May 2021 11:25:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 925AD6141C; Wed, 12 May 2021 15:10:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832237; bh=BJS27XRKhusUx8jqKkiJ8QKpqpYh14YxJNYeWwrTyy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o6kmMbL4wQQnMqxfoyyopw/EaeNVzGdIRxtUFTXB9I8WQMZyPB4SOmWFL8Z9jXhby uc2T/pmowUqXg0gc2lsQDi+dAeEazbwbhVBvIkG/+RIZ/5Ux+cq3wOuTpO5Feazhl9 9IdEwHBDdYxrVZSmJNy3kn4n7tdu9cHbB07Fpee4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Ravi Kumar Bokka , Srinivas Kandagatla , Sasha Levin Subject: [PATCH 5.10 198/530] drivers: nvmem: Fix voltage settings for QTI qfprom-efuse Date: Wed, 12 May 2021 16:45:08 +0200 Message-Id: <20210512144826.343287571@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Ravi Kumar Bokka [ Upstream commit 9ec4f4b0e9fd3ad4b9a38bddb75b516ea09f4628 ] QFPROM controller hardware requires 1.8V min for fuse blowing. So, this change sets the voltage to 1.8V, required to blow the fuse for qfprom-efuse controller. To disable fuse blowing, we set the voltage to 0V since this may be a shared rail and may be able to run at a lower rate when we're not blowing fuses. Fixes: 93b4e49f8c86 ("nvmem: qfprom: Add fuse blowing support") Reported-by: Douglas Anderson Suggested-by: Douglas Anderson Reviewed-by: Douglas Anderson Signed-off-by: Ravi Kumar Bokka Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20210330111241.19401-4-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/nvmem/qfprom.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/nvmem/qfprom.c b/drivers/nvmem/qfprom.c index 5e9e60e2e591..955b8b8c8238 100644 --- a/drivers/nvmem/qfprom.c +++ b/drivers/nvmem/qfprom.c @@ -104,6 +104,16 @@ static void qfprom_disable_fuse_blowing(const struct qfprom_priv *priv, { int ret; + /* + * This may be a shared rail and may be able to run at a lower rate + * when we're not blowing fuses. At the moment, the regulator framework + * applies voltage constraints even on disabled rails, so remove our + * constraints and allow the rail to be adjusted by other users. + */ + ret = regulator_set_voltage(priv->vcc, 0, INT_MAX); + if (ret) + dev_warn(priv->dev, "Failed to set 0 voltage (ignoring)\n"); + ret = regulator_disable(priv->vcc); if (ret) dev_warn(priv->dev, "Failed to disable regulator (ignoring)\n"); @@ -149,6 +159,17 @@ static int qfprom_enable_fuse_blowing(const struct qfprom_priv *priv, goto err_clk_prepared; } + /* + * Hardware requires 1.8V min for fuse blowing; this may be + * a rail shared do don't specify a max--regulator constraints + * will handle. + */ + ret = regulator_set_voltage(priv->vcc, 1800000, INT_MAX); + if (ret) { + dev_err(priv->dev, "Failed to set 1.8 voltage\n"); + goto err_clk_rate_set; + } + ret = regulator_enable(priv->vcc); if (ret) { dev_err(priv->dev, "Failed to enable regulator\n"); -- 2.30.2