Linux clock framework development
 help / color / mirror / Atom feed
From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
To: John Madieu <john.madieu.xa@bp.renesas.com>,
	claudiu.beznea.uj@bp.renesas.com, lpieralisi@kernel.org,
	kwilczynski@kernel.org, mani@kernel.org, geert+renesas@glider.be,
	krzk+dt@kernel.org
Cc: robh@kernel.org, bhelgaas@google.com, conor+dt@kernel.org,
	magnus.damm@gmail.com, biju.das.jz@bp.renesas.com,
	linux-pci@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	john.madieu@gmail.com
Subject: Re: [PATCH 06/16] PCI: rzg3s-host: Make SYSC register offsets SoC-specific
Date: Mon, 19 Jan 2026 20:14:02 +0200	[thread overview]
Message-ID: <34bd51e6-c93d-40fd-bf5a-8f476c4e1776@tuxon.dev> (raw)
In-Reply-To: <20260114153337.46765-7-john.madieu.xa@bp.renesas.com>

Hi, John,

On 1/14/26 17:33, John Madieu wrote:
> In preparation for adding RZ/G3E support, move the RST_RSM_B register
> offset and mask into a SoC-specific data structure. Compared with RZ/G3S,
> the RZ/G3E SYSC controls different functionalities for the PCIe controller.
> 
> Make SYSC operations conditional on the presence of register offset
> information, allowing the driver to handle SoCs that don't use the
> RST_RSM_B signal.
> 
> Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
> ---
>   drivers/pci/controller/pcie-rzg3s-host.c | 93 +++++++++++++++++-------
>   1 file changed, 67 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/pci/controller/pcie-rzg3s-host.c b/drivers/pci/controller/pcie-rzg3s-host.c
> index 205b60421be1..44728771afa3 100644
> --- a/drivers/pci/controller/pcie-rzg3s-host.c
> +++ b/drivers/pci/controller/pcie-rzg3s-host.c
> @@ -159,10 +159,6 @@
>   
>   #define RZG3S_PCI_CFG_PCIEC			0x60
>   
> -/* System controller registers */
> -#define RZG3S_SYS_PCIE_RST_RSM_B		0xd74
> -#define RZG3S_SYS_PCIE_RST_RSM_B_MASK		BIT(0)
> -
>   /* Maximum number of windows */
>   #define RZG3S_MAX_WINDOWS			8
>   
> @@ -174,6 +170,34 @@
>   /* Timeouts experimentally determined */
>   #define RZG3S_REQ_ISSUE_TIMEOUT_US		2500
>   
> +/**
> + * struct rzg3s_sysc_function - System Controller register function descriptor
> + * @offset: Register offset from the System Controller base address
> + * @mask: Bit mask for the function within the register
> + */
> +struct rzg3s_sysc_function {
> +	u32 offset;
> +	u32 mask;
> +};
> +
> +/**
> + * struct rzg3s_sysc_info - RZ/G3S System Controller function info
> + * @rst_rsm_b: Reset RSM_B function descriptor
> + */
> +struct rzg3s_sysc_info {
> +	struct rzg3s_sysc_function rst_rsm_b;
> +};
> +
> +/**
> + * struct rzg3s_sysc - RZ/G3S System Controller descriptor
> + * @regmap: System controller regmap
> + * @info: System controller info
> + */
> +struct rzg3s_sysc {
> +	struct regmap *regmap;
> +	const struct rzg3s_sysc_info *info;
> +};
> +
>   /**
>    * struct rzg3s_pcie_msi - RZ/G3S PCIe MSI data structure
>    * @domain: IRQ domain
> @@ -203,6 +227,7 @@ struct rzg3s_pcie_host;
>    *                power-on
>    * @cfg_resets: array with the resets that need to be de-asserted after
>    *              configuration
> + * @sysc_info: SYSC functionalities
>    * @num_power_resets: number of power resets
>    * @num_cfg_resets: number of configuration resets
>    */
> @@ -210,6 +235,7 @@ struct rzg3s_pcie_soc_data {
>   	int (*init_phy)(struct rzg3s_pcie_host *host);
>   	const char * const *power_resets;
>   	const char * const *cfg_resets;
> +	struct rzg3s_sysc_info sysc_info;
>   	u8 num_power_resets;
>   	u8 num_cfg_resets;
>   };
> @@ -233,7 +259,7 @@ struct rzg3s_pcie_port {
>    * @dev: struct device
>    * @power_resets: reset control signals that should be set after power up
>    * @cfg_resets: reset control signals that should be set after configuration
> - * @sysc: SYSC regmap
> + * @sysc: SYSC descriptor
>    * @intx_domain: INTx IRQ domain
>    * @data: SoC specific data
>    * @msi: MSI data structure
> @@ -248,7 +274,7 @@ struct rzg3s_pcie_host {
>   	struct device *dev;
>   	struct reset_control_bulk_data *power_resets;
>   	struct reset_control_bulk_data *cfg_resets;
> -	struct regmap *sysc;
> +	struct rzg3s_sysc *sysc;
>   	struct irq_domain *intx_domain;
>   	const struct rzg3s_pcie_soc_data *data;
>   	struct rzg3s_pcie_msi msi;
> @@ -1516,6 +1542,7 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
>   	struct device_node *sysc_np __free(device_node) =
>   		of_parse_phandle(np, "renesas,sysc", 0);
>   	struct rzg3s_pcie_host *host;
> +	struct rzg3s_sysc *sysc;
>   	int ret;
>   
>   	bridge = devm_pci_alloc_host_bridge(dev, sizeof(*host));
> @@ -1527,6 +1554,13 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
>   	host->data = device_get_match_data(dev);
>   	platform_set_drvdata(pdev, host);
>   
> +	host->sysc = devm_kzalloc(dev, sizeof(*host->sysc), GFP_KERNEL);
> +	if (!host->sysc)
> +		return -ENOMEM;
> +
> +	sysc = host->sysc;
> +	sysc->info = &host->data->sysc_info;
> +
>   	host->axi = devm_platform_ioremap_resource(pdev, 0);
>   	if (IS_ERR(host->axi))
>   		return PTR_ERR(host->axi);
> @@ -1540,15 +1574,16 @@ static int rzg3s_pcie_probe(struct platform_device *pdev)
>   	if (ret)
>   		return ret;
>   
> -	host->sysc = syscon_node_to_regmap(sysc_np);
> -	if (IS_ERR(host->sysc)) {
> -		ret = PTR_ERR(host->sysc);
> +	sysc->regmap = syscon_node_to_regmap(sysc_np);
> +	if (IS_ERR(sysc->regmap)) {
> +		ret = PTR_ERR(sysc->regmap);
>   		goto port_refclk_put;
>   	}
>   
> -	ret = regmap_update_bits(host->sysc, RZG3S_SYS_PCIE_RST_RSM_B,
> -				 RZG3S_SYS_PCIE_RST_RSM_B_MASK,
> -				 FIELD_PREP(RZG3S_SYS_PCIE_RST_RSM_B_MASK, 1));
> +	ret = regmap_update_bits(sysc->regmap,
> +				 sysc->info->rst_rsm_b.offset,

This can stay on the previous line to spare one extra line of code.

The rest LGTM.

Thank you,
Claudiu

  reply	other threads:[~2026-01-19 18:14 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-14 15:33 [PATCH 00/16] PCI: renesas: Add RZ/G3E PCIe controller support John Madieu
2026-01-14 15:33 ` [PATCH 01/16] PCI: rzg3s-host: Fix reset handling in probe error path John Madieu
2026-01-15 13:13   ` claudiu beznea
2026-01-16 21:00     ` John Madieu
2026-01-19 14:03   ` Claudiu Beznea
2026-01-20 20:11     ` John Madieu
2026-01-19 14:04   ` Claudiu Beznea
2026-01-20 20:05     ` John Madieu
2026-01-21  8:10       ` Biju Das
2026-01-14 15:33 ` [PATCH 02/16] PCI: rzg3s-host: Fix inbound window size tracking John Madieu
2026-01-19 14:06   ` Claudiu Beznea
2026-01-14 15:33 ` [PATCH 03/16] clk: renesas: rzv2h-cpg: Add support for init_off clocks John Madieu
2026-01-20 10:49   ` Geert Uytterhoeven
2026-01-20 19:08     ` John Madieu
2026-01-22 16:21       ` John Madieu
2026-01-22 16:29         ` Geert Uytterhoeven
2026-01-23 11:29           ` John Madieu
2026-01-23 11:39             ` Lad, Prabhakar
2026-01-23 12:32               ` John Madieu
2026-01-14 15:33 ` [PATCH 04/16] clk: renesas: r9a09g047: Add PCIe clocks and reset John Madieu
2026-01-20 11:03   ` Geert Uytterhoeven
2026-01-20 14:04     ` John Madieu
2026-01-14 15:33 ` [PATCH 05/16] dt-bindings: PCI: renesas,r9a08g045s33-pcie: Document RZ/G3E SoC John Madieu
2026-01-15 13:48   ` Krzysztof Kozlowski
2026-01-16 20:55     ` John Madieu
2026-01-15 13:55   ` claudiu beznea
2026-01-14 15:33 ` [PATCH 06/16] PCI: rzg3s-host: Make SYSC register offsets SoC-specific John Madieu
2026-01-19 18:14   ` Claudiu Beznea [this message]
2026-01-20 19:58     ` John Madieu
2026-01-14 15:33 ` [PATCH 07/16] PCI: rzg3s-host: Make configuration reset lines optional John Madieu
2026-01-14 22:38   ` Bjorn Helgaas
2026-01-15  9:44     ` John Madieu
2026-01-19 18:14   ` Claudiu Beznea
2026-01-14 15:33 ` [PATCH 08/16] PCI: rzg3s-host: Make inbound window setup SoC-specific John Madieu
2026-01-19 18:15   ` Claudiu Beznea
2026-01-20 19:52     ` John Madieu
2026-01-14 15:33 ` [PATCH 09/16] PCI: rzg3s-host: Add SoC-specific configuration and initialization callbacks John Madieu
2026-01-14 22:40   ` Bjorn Helgaas
2026-01-15  9:43     ` John Madieu
2026-01-19 18:21   ` Claudiu Beznea
2026-01-14 15:33 ` [PATCH 10/16] PCI: rzg3s-host: Explicitly set class code for RZ/G3E compatibility John Madieu
2026-01-15 13:49   ` kernel test robot
2026-01-14 15:33 ` [PATCH 11/16] PCI: rzg3s-host: Add PCIe Gen3 (8.0 GT/s) link speed support John Madieu
2026-01-19 18:21   ` Claudiu Beznea
2026-01-14 15:33 ` [PATCH 12/16] PCI: rzg3s-host: Add support for RZ/G3E PCIe controller John Madieu
2026-01-19 18:25   ` Claudiu Beznea
2026-01-14 15:33 ` [PATCH 13/16] arm64: dts: renesas: r9a09g047: Add PCIe node John Madieu
2026-01-14 15:33 ` [PATCH 14/16] arm64: dts: renesas: r9a09g047e57-smarc-som: Add PCIe reference clock John Madieu
2026-01-14 15:33 ` [PATCH 15/16] arm64: dts: renesas: r9a09g047e57-smarc: Add PCIe pincontrol John Madieu
2026-01-14 15:33 ` [PATCH 16/16] arm64: dts: renesas: r9a09g047e57-smarc: Enable PCIe John Madieu
2026-01-14 16:19   ` Biju Das
2026-01-14 16:34     ` John Madieu
2026-01-14 16:50       ` Biju Das
2026-01-21 10:25         ` Geert Uytterhoeven
2026-01-21 10:27           ` John Madieu
2026-01-14 17:47 ` [PATCH 00/16] PCI: renesas: Add RZ/G3E PCIe controller support Biju Das
2026-01-15  9:45   ` John Madieu

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=34bd51e6-c93d-40fd-bf5a-8f476c4e1776@tuxon.dev \
    --to=claudiu.beznea@tuxon.dev \
    --cc=bhelgaas@google.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=claudiu.beznea.uj@bp.renesas.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=john.madieu.xa@bp.renesas.com \
    --cc=john.madieu@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    /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