mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Zhang <18255117159@163.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: jingoohan1@gmail.com, bhelgaas@google.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, mani@kernel.org, robh@kernel.org,
	a-garg7@ti.com, linux-pci@vger.kernel.org,
	linux-kernel@vger.kernel.org, Feizhou Yu <yufeizhou201@163.com>
Subject: Re: [PATCH] pci: dwc: Rename PCIE_PORT_LINK_CONTROL to PORT_LINK_CTRL_OFF
Date: Sat, 5 Sep 2026 00:32:30 +0800	[thread overview]
Message-ID: <7eb29846-7561-4ead-9a05-0c5966de5fd6@163.com> (raw)
In-Reply-To: <20260904161250.GA2318713@bhelgaas>



On 9/5/26 00:12, Bjorn Helgaas wrote:
> On Fri, Sep 04, 2026 at 02:18:23PM +0800, Hans Zhang wrote:
>> The register at offset 0x710 is documented in the Synopsys DesignWare
>> PCIe Controller Reference Manual as "PORT_LINK_CTRL_OFF" (Port Link
>> Control Register). The current macro name PCIE_PORT_LINK_CONTROL does
>> not match the documentation, making it difficult to cross-reference
>> with the spec when debugging or maintaining the code.
> 
> I'm a little skeptical about this change.  I agree it's good to match
> the spec, and the leading "PCIE_" seems superfluous.  But I think it's
> pointless to add "_OFF" to every register offset.  "PORT_LINK_CTRL"
> seems like enough, and it's pretty close to the spec's name.
> 
> Adding "_OFF" also invites confusion: does it mean "offset" or "off"
> (the opposite of "on")?

Hi Bjorn,

I checked the official documentation of Synopsys. It seems that the 
suffix "_OFF" is added to each register, and it appears to mean "offset".

> 
> It's also nice if names of fields within a register include the
> register name, e.g., PCI_EXP_LNKCTL, PCI_EXP_LNKCTL_ASPMC, etc.
> For long register names like PCIE_PORT_MULTI_LANE_CTRL, with a
> PORT_MLTI_UPCFG_SUPPORT field, you have squint pretty hard to see the
> connection between the register and the field, but a name like
> "PCIE_PORT_MULTI_LANE_CTRL_UPCFG_SUPPORT" would be just ridiculous.

I agree with what you said. The official documentation of Synopsys 
currently defines it this way. If the naming is simplified, it would 
make it harder to search for where the registers are located. This is 
one of the purposes of this modification.



I will send a document to you and Mani. Or there might be a better way 
that I would be very happy to accept. I will also make the necessary 
modifications according to your preferences.

Best regards,
Hans

> 
>> Rename the macro to PORT_LINK_CTRL_OFF to align with the Synopsys
>> documentation, and update all usage sites accordingly. No functional
>> change is intended.
>>
>> This improves code maintainability and eases future reference to the
>> controller manual.
>>
>> Co-developed-by: Feizhou Yu <yufeizhou201@163.com>
>> Signed-off-by: Feizhou Yu <yufeizhou201@163.com>
>> Signed-off-by: Hans Zhang <18255117159@163.com>
>> ---
>>   drivers/pci/controller/dwc/pcie-designware.c | 8 ++++----
>>   drivers/pci/controller/dwc/pcie-designware.h | 2 +-
>>   2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c
>> index 593388f29bdd..9a0d8f0be792 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware.c
>> +++ b/drivers/pci/controller/dwc/pcie-designware.c
>> @@ -894,7 +894,7 @@ static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)
>>   		return;
>>   
>>   	/* Set the number of lanes */
>> -	plc = dw_pcie_readl_dbi(pci, PCIE_PORT_LINK_CONTROL);
>> +	plc = dw_pcie_readl_dbi(pci, PORT_LINK_CTRL_OFF);
>>   	plc &= ~PORT_LINK_FAST_LINK_MODE;
>>   	plc &= ~PORT_LINK_MODE_MASK;
>>   
>> @@ -922,7 +922,7 @@ static void dw_pcie_link_set_max_link_width(struct dw_pcie *pci, u32 num_lanes)
>>   		dev_err(pci->dev, "num-lanes %u: invalid value\n", num_lanes);
>>   		return;
>>   	}
>> -	dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, plc);
>> +	dw_pcie_writel_dbi(pci, PORT_LINK_CTRL_OFF, plc);
>>   	dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, lwsc);
>>   
>>   	cap = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
>> @@ -1295,10 +1295,10 @@ void dw_pcie_setup(struct dw_pcie *pci)
>>   		dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val);
>>   	}
>>   
>> -	val = dw_pcie_readl_dbi(pci, PCIE_PORT_LINK_CONTROL);
>> +	val = dw_pcie_readl_dbi(pci, PORT_LINK_CTRL_OFF);
>>   	val &= ~PORT_LINK_FAST_LINK_MODE;
>>   	val |= PORT_LINK_DLL_LINK_EN;
>> -	dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, val);
>> +	dw_pcie_writel_dbi(pci, PORT_LINK_CTRL_OFF, val);
>>   
>>   	dw_pcie_link_set_max_link_width(pci, pci->num_lanes);
>>   }
>> diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h
>> index 0735ae940924..77420230433b 100644
>> --- a/drivers/pci/controller/dwc/pcie-designware.h
>> +++ b/drivers/pci/controller/dwc/pcie-designware.h
>> @@ -87,7 +87,7 @@
>>   #define PORT_AFR_L1_ENTRANCE_LAT_SHIFT	27
>>   #define PORT_AFR_L1_ENTRANCE_LAT_MASK	GENMASK(29, 27)
>>   
>> -#define PCIE_PORT_LINK_CONTROL		0x710
>> +#define PORT_LINK_CTRL_OFF		0x710
>>   #define PORT_LINK_DLL_LINK_EN		BIT(5)
>>   #define PORT_LINK_FAST_LINK_MODE	BIT(7)
>>   #define PORT_LINK_MODE_MASK		GENMASK(21, 16)
>> -- 
>> 2.43.0
>>


  reply	other threads:[~2026-09-04 16:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-04  6:18 Hans Zhang
2026-09-04 16:12 ` Bjorn Helgaas
2026-09-04 16:32   ` Hans Zhang [this message]
2026-09-04 17:13     ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7eb29846-7561-4ead-9a05-0c5966de5fd6@163.com \
    --to=18255117159@163.com \
    --cc=a-garg7@ti.com \
    --cc=bhelgaas@google.com \
    --cc=helgaas@kernel.org \
    --cc=jingoohan1@gmail.com \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=yufeizhou201@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®