From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B89EC1FC7F5 for ; Mon, 27 Jan 2025 09:06:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737968792; cv=none; b=ucHZOVR4o+bOOvtLk2SV0ZHmU7e9QO/1DRaZ4JyEqPG2/dIxWaAbqvZWv9ZxHCOendRWMCKxid4otTcEI4oo97owhVYKDVkNMz+nNaDoQAhDidgM2+nKjAOscVsVPWNU/WL/Zp1cFJq0KeTZt9cLog2Rap/vOISzKPiP41S3f1U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737968792; c=relaxed/simple; bh=gO3d/4mrWXGze06FTi6Z9lXpH3hV9B3qsDLKjVLRQjQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=aAWqzV5YloAlJYJXuWrkYQ/8TZNpdcB+BlkMnjwrDBq0PiRIhTyJedB6f5PplvKUZ+yIHPFqRgtmrvE4nto9LK9IRD+8ZCX3kKo9upwDvIEssVJddbX1WkT//8qD6FzDRMDbdRLoz1eDWtZ7G/tXEIxSdUGI95EiIFPm5Gt+k0A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=MWsDLUNS; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="MWsDLUNS" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5d3f28881d6so6206886a12.1 for ; Mon, 27 Jan 2025 01:06:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1737968787; x=1738573587; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Ru5JcDXJ0V6EvEX8QHAyIUNaLhSujmRQCuu+cesIXi4=; b=MWsDLUNSCM7FFWg3dm7Qh6h//hk0sxd67bjvyUJoTmIzDbKOSt4vs692c4lO7XI2B9 bMZazHztRfBRHD7gBAP5qwhxn91kLh35Qaiff6aUetBCoyOSQtcH/VmqXZEdnWosOQS5 93QlyNAus1jgT7H0DXk+2K/C0fc9KnTXm35Raspw971doF7jupyEOKHu5O/qaPgcIFVJ CYnzFs9IOeGH9dJ8Pi+F9CDNDpFfnluV3n5QQb7sp8tOlCPILsdS9zC5NmX1voIfKUKT Lc4x0fMOVjYXqdazbUuwCeQ2Mi+69uf6lA/bu+ALAKM53mooEXAK7O7FnA1iTDefKsPl 1NfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737968787; x=1738573587; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ru5JcDXJ0V6EvEX8QHAyIUNaLhSujmRQCuu+cesIXi4=; b=nyUgXEUI1jeJRxx6vbwNMWHK24QLVa6NRFKzPg7SEQHJTjMS47wF+HO2whTNeA1BWk j1Ir0iM7luFNtTsK6/MNnl0r5s8IQA9TkcboNtZ0VVxxNMZVW4CqBrNrbACB2tEVIj4F lDOx+ugOcOEtELySi4LpWWzwxU62LJe+AHhzCD4SFqZXt4W6FFZWWFrAqciH4XeiX86Y XKwwq8SDNEUX1gj++sLxv/i059pJmOibSY+GkfBeqd/sP6rkUn3z+IrqedSeHc9jhs+6 1iI7u9Hb858ZxNTbRggw0nutDb5CYe1GvrrWHDdFRMHIq0nir7BKXYprWC0haUMu3Elo RNRw== X-Forwarded-Encrypted: i=1; AJvYcCXKjLgHyDE1u62fU5HXfutBy5umGPNjOQCLlaQYm0S/3b/6QWvcetx339YAgVFdLZ6iNofGK7tbQakryi4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy1zwfaJKApwN3TclYmpIBDKw/w8VogRCcT5LReHlG/I7yNaqJr /n2jJTtHFq7fUd3pd8qTJ6BC87TXFa2F0qM6y384c7VfMt6HnCu1KeJjUawl/hE= X-Gm-Gg: ASbGncuo1yGGmKntBs1pIEu4nt5AJpzla5xLIf7+cXEVGqxFBMAOfuTxFt3jJNWrLCB /v4CuKLvst4tSoFY3WbtZlqc1Dt0xBnRL4Y/hkmY518VrjdxJ5a2kkaeYP65zUj5L/kdhvXtNkh LlPf3H1SegqQXWiYXGNhfwYpzU1OIze+sKZH2gl5FNMGz3HluZ94RjGKbwSGFWI1Gs7ITvBsVem vtDbZBZWirQ3IzEsdWjUgRezlR95oyPw/Vsx927oGreaSkUipCq1ZGU6xxdrthc2HgZZ7Flf0d6 AglOoD6IhOQVVjpO X-Google-Smtp-Source: AGHT+IEoku4hVU1Bs9oRO3XcssM7g6jlT/m4SSLdEG1yw4hlXESz6xS72CFcZgRwwuOZUWCMBW5YQg== X-Received: by 2002:a05:6402:518a:b0:5d3:ba42:e9e3 with SMTP id 4fb4d7f45d1cf-5db7d2f5ec0mr98139827a12.13.1737968787049; Mon, 27 Jan 2025 01:06:27 -0800 (PST) Received: from linaro.org ([2a02:2454:ff21:ef30:f64e:7d70:e55f:6da8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5dc18638ed2sm5138630a12.36.2025.01.27.01.06.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 01:06:25 -0800 (PST) Date: Mon, 27 Jan 2025 10:06:24 +0100 From: Stephan Gerhold To: Luca Weiss Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, Bjorn Andersson , Mathieu Poirier , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stephan Gerhold , Konrad Dybcio , Matti =?iso-8859-1?Q?Lehtim=E4ki?= , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/9] remoteproc: qcom_q6v5_mss: Add modem support on MSM8226 Message-ID: References: <20250126-msm8226-modem-v2-0-e88d76d6daff@lucaweiss.eu> <20250126-msm8226-modem-v2-4-e88d76d6daff@lucaweiss.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250126-msm8226-modem-v2-4-e88d76d6daff@lucaweiss.eu> On Sun, Jan 26, 2025 at 09:57:23PM +0100, Luca Weiss wrote: > Add support for the external power block headswitch register needed by > MSM8226 and some other qcom platforms. > > Co-developed-by: Matti Lehtimäki > Signed-off-by: Matti Lehtimäki > Signed-off-by: Luca Weiss > --- > Changes in v2: > - Remove cx-supply from MSM8226 "fallback_proxy_supply" because it's > always used as power domain > --- > drivers/remoteproc/qcom_q6v5_mss.c | 117 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 117 insertions(+) > > diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c > index e2523b01febf393abfe50740a68b85a04011293c..ef85c9843a12acb0e4e9ee6167c34d4981d4dc8a 100644 > --- a/drivers/remoteproc/qcom_q6v5_mss.c > +++ b/drivers/remoteproc/qcom_q6v5_mss.c > @@ -134,6 +134,11 @@ > #define BOOT_FSM_TIMEOUT 10000 > #define BHS_CHECK_MAX_LOOPS 200 > > +/* External power block headswitch */ > +#define EXTERNAL_BHS_ON BIT(0) > +#define EXTERNAL_BHS_STATUS BIT(4) > +#define EXTERNAL_BHS_TIMEOUT_US 50 > + > struct reg_info { > struct regulator *reg; > int uV; > @@ -161,6 +166,7 @@ struct rproc_hexagon_res { > [...] > @@ -1871,6 +1897,36 @@ static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds, > dev_pm_domain_detach(pds[i], false); > } > > +static int q6v5_external_bhs_enable(struct q6v5 *qproc) > +{ > + u32 val; > + int ret = 0; > + > + /* > + * Enable external power block headswitch and wait for it to > + * stabilize > + */ > + regmap_update_bits(qproc->conn_map, qproc->ext_bhs, > + EXTERNAL_BHS_ON, 1); Nitpick: regmap_update_bits() doesn't take a bool (0/1) as last value, it's the actual value. The 1 as last argument is essentially a magic number here that happens to be equal to EXTERNAL_BHS_ON = BIT(0). This should be regmap_update_bits(..., EXTERNAL_BHS_ON, EXTERNAL_BHS_ON); or even better just regmap_set_bits(..., EXTERNAL_BHS_ON); > + > + ret = regmap_read_poll_timeout(qproc->conn_map, qproc->ext_bhs, > + val, val & EXTERNAL_BHS_STATUS, > + 1, EXTERNAL_BHS_TIMEOUT_US); > + > + if (ret) { > + dev_err(qproc->dev, "External BHS timed out\n"); > + ret = -ETIMEDOUT; > + } > + > + return ret; > +} > + > +static void q6v5_external_bhs_disable(struct q6v5 *qproc) > +{ > + regmap_update_bits(qproc->conn_map, qproc->ext_bhs, > + EXTERNAL_BHS_ON, 0); regmap_clear_bits(..., EXTERNAL_BHS_ON); > +} > + > static int q6v5_init_reset(struct q6v5 *qproc) > { > qproc->mss_restart = devm_reset_control_get_exclusive(qproc->dev, > @@ -2021,6 +2077,7 @@ static int q6v5_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, qproc); > > qproc->has_qaccept_regs = desc->has_qaccept_regs; > + qproc->has_ext_bhs_reg = desc->has_ext_bhs_reg; > qproc->has_ext_cntl_regs = desc->has_ext_cntl_regs; > qproc->has_vq6 = desc->has_vq6; > qproc->has_spare_reg = desc->has_spare_reg; > @@ -2079,6 +2136,14 @@ static int q6v5_probe(struct platform_device *pdev) > qproc->proxy_pd_count = ret; > } > > + if (qproc->has_ext_bhs_reg) { > + ret = q6v5_external_bhs_enable(qproc); > + if (ret < 0) { > + dev_err(&pdev->dev, "Failed to enable external BHS.\n"); Since the only possible error condition inside q6v5_external_bhs_enable() is the timeout condition that is already logged, you might as well drop this error message. Thanks, Stephan