[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d9616001-e64e-4fe6-ba53-4dc90555d226@linaro.org>
Date: Sat, 23 Mar 2024 01:22:32 +0100
From: Konrad Dybcio <konrad.dybcio@...aro.org>
To: Shashank Babu Chinta Venkata <quic_schintav@...cinc.com>,
agross@...nel.org, andersson@...nel.org, mani@...nel.org
Cc: quic_msarkar@...cinc.com, quic_kraravin@...cinc.com,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kw@...ux.com>,
Rob Herring <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
Jingoo Han <jingoohan1@...il.com>,
Gustavo Pimentel <gustavo.pimentel@...opsys.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
Serge Semin <fancer.lancer@...il.com>,
Conor Dooley <conor.dooley@...rochip.com>, linux-kernel@...r.kernel.org,
linux-pci@...r.kernel.org, linux-arm-msm@...r.kernel.org
Subject: Re: [PATCH v2 2/3] PCI: qcom: Add equalization settings for gen4
On 20.03.2024 08:14, Shashank Babu Chinta Venkata wrote:
> GEN3_RELATED_OFFSET is being used as shadow register for generation4 and
> generation5 data rates based on rate select mask settings on this register.
> Select relevant mask and equalization settings for generation4 operation.
>
> Signed-off-by: Shashank Babu Chinta Venkata <quic_schintav@...cinc.com>
> ---
[...]
> +
> +#define GEN3_EQ_FB_MODE_DIR_CHANGE_OFF 0x8ac
> +#define GEN3_EQ_FMDC_T_MIN_PHASE23_MASK GENMASK(4, 0)
> +#define GEN3_EQ_FMDC_N_EVALS_MASK GENMASK(9, 5)
> +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_MASK GENMASK(13, 10)
> +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_MASK GENMASK(17, 14)
> +#define GEN3_EQ_FMDC_N_EVALS_SHIFT 5
> +#define GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_SHIFT 10
> +#define GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_SHIFT 14
The beauty of bitops.h is you no longer need to define these shifts..
Just use FIELD_GET/FIELD_PREP with the field! Please also drop _MASK
from the leftover definitions.
> +void qcom_pcie_cmn_set_16gt_eq_settings(struct dw_pcie *pci)
> +{
> + u32 reg;
> +
> + /*
> + * GEN3_RELATED_OFF is repurposed to be used with GEN4(16GT/s) rate
> + * as well based on RATE_SHADOW_SEL_MASK settings on this register.
> + */
Given this comment and the commit message, should setting of this field
be factored out to a function that would accept a generation argument?
> + reg = dw_pcie_readl_dbi(pci, GEN3_RELATED_OFF);
> + reg &= ~GEN3_RELATED_OFF_GEN3_ZRXDC_NONCOMPL;
> + reg &= ~GEN3_RELATED_OFF_RATE_SHADOW_SEL_MASK;
> + reg |= (0x1 << GEN3_RELATED_OFF_RATE_SHADOW_SEL_SHIFT);
> + dw_pcie_writel_dbi(pci, GEN3_RELATED_OFF, reg);
> +
> + reg = dw_pcie_readl_dbi(pci, GEN3_EQ_FB_MODE_DIR_CHANGE_OFF);
> + reg &= ~GEN3_EQ_FMDC_T_MIN_PHASE23_MASK;
> + reg &= ~GEN3_EQ_FMDC_N_EVALS_MASK;
> + reg |= (GEN3_EQ_FMDC_N_EVALS_16GT_VAL <<
> + GEN3_EQ_FMDC_N_EVALS_SHIFT);
> + reg &= ~GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_MASK;
> + reg |= (GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_16GT_VAL <<
> + GEN3_EQ_FMDC_MAX_PRE_CUSROR_DELTA_SHIFT);
> + reg &= ~GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_MASK;
> + reg |= (GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_16GT_VAL <<
> + GEN3_EQ_FMDC_MAX_POST_CUSROR_DELTA_SHIFT);
> + dw_pcie_writel_dbi(pci, GEN3_EQ_FB_MODE_DIR_CHANGE_OFF, reg);
> +
> + reg = dw_pcie_readl_dbi(pci, GEN3_EQ_CONTROL_OFF);
> + reg &= ~GEN3_EQ_CONTROL_OFF_FB_MODE_MASK;
> + reg &= ~GEN3_EQ_CONTROL_OFF_PHASE23_EXIT_MODE;
> + reg &= ~GEN3_EQ_CONTROL_OFF_FOM_INC_INITIAL_EVAL;
> + reg &= ~GEN3_EQ_CONTROL_OFF_PSET_REQ_VEC_MASK;
> + dw_pcie_writel_dbi(pci, GEN3_EQ_CONTROL_OFF, reg);
> +}
Powered by blists - more mailing lists