[PATCH v4 1/6] phy: qcom-qmp-pcie: split register tables into common and extra parts

Johan Hovold johan at kernel.org
Mon Sep 26 06:24:55 PDT 2022


On Mon, Sep 26, 2022 at 02:35:07PM +0300, Dmitry Baryshkov wrote:
> On 26/09/2022 10:27, Johan Hovold wrote:
> > On Sat, Sep 24, 2022 at 07:02:57PM +0300, Dmitry Baryshkov wrote:
> >> SM8250 configuration tables are split into two parts: the common one and
> >> the PHY-specific tables. Make this split more formal. Rather than having
> >> a blind renamed copy of all QMP table fields, add separate struct
> >> qmp_phy_cfg_tables and add two instances of this structure to the struct
> >> qmp_phy_cfg. Later on this will be used to support different PHY modes
> >> (RC vs EP).
> >>
> >> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov at linaro.org>
> >> ---
> >>   drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 129 ++++++++++++++---------
> >>   1 file changed, 77 insertions(+), 52 deletions(-)
> >>
> >> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
> >> index 7aff3f9940a5..30806816c8b0 100644
> >> --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
> >> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
> >> @@ -1300,31 +1300,30 @@ static const struct qmp_phy_init_tbl sm8450_qmp_gen4x2_pcie_pcs_misc_tbl[] = {
> >>   	QMP_PHY_INIT_CFG(QPHY_V5_20_PCS_PCIE_G4_PRE_GAIN, 0x2e),
> >>   };
> >>   
> >> -/* struct qmp_phy_cfg - per-PHY initialization config */
> >> -struct qmp_phy_cfg {
> >> -	int lanes;
> >> -
> >> -	/* Init sequence for PHY blocks - serdes, tx, rx, pcs */
> >> +struct qmp_phy_cfg_tables {
> >>   	const struct qmp_phy_init_tbl *serdes_tbl;
> >>   	int serdes_tbl_num;
> > 
> > So I still think you should drop the now redundant "tbl" suffix and
> > infix.
> > 
> >> -	const struct qmp_phy_init_tbl *serdes_tbl_sec;
> >> -	int serdes_tbl_num_sec;
> >>   	const struct qmp_phy_init_tbl *tx_tbl;
> >>   	int tx_tbl_num;
> >> -	const struct qmp_phy_init_tbl *tx_tbl_sec;
> >> -	int tx_tbl_num_sec;
> >>   	const struct qmp_phy_init_tbl *rx_tbl;
> >>   	int rx_tbl_num;
> >> -	const struct qmp_phy_init_tbl *rx_tbl_sec;
> >> -	int rx_tbl_num_sec;
> >>   	const struct qmp_phy_init_tbl *pcs_tbl;
> >>   	int pcs_tbl_num;
> >> -	const struct qmp_phy_init_tbl *pcs_tbl_sec;
> >> -	int pcs_tbl_num_sec;
> >>   	const struct qmp_phy_init_tbl *pcs_misc_tbl;
> >>   	int pcs_misc_tbl_num;
> >> -	const struct qmp_phy_init_tbl *pcs_misc_tbl_sec;
> >> -	int pcs_misc_tbl_num_sec;
> >> +};
> >> +
> >> +/* struct qmp_phy_cfg - per-PHY initialization config */
> >> +struct qmp_phy_cfg {
> >> +	int lanes;
> >> +
> >> +	/* Main init sequence for PHY blocks - serdes, tx, rx, pcs */
> >> +	struct qmp_phy_cfg_tables common;
> > 
> > And this could be "tbls_common".
> 
> I'd go for common_tables, if you don't mind.

Sure, if you prefer.

	struct qmp_phy_cfg_tables	tables;
	struct qmp_phy_cfg_tables	tables_ep;
	struct qmp_phy_cfg_tables	tables_rc;

Could also be an alternative. Not sure the "common" prefix/suffix really
adds anything.

Johan



More information about the linux-phy mailing list