Subject: linux-next: manual merge of the phy-next tree with the phy tree

From: Stephen Rothwell <[email-masked]>
Date: Thu, 15 May 2025 17:09:12 +1000

Hi all,

Today's linux-next merge of the phy-next tree got a conflict in:

  drivers/phy/renesas/phy-rcar-gen3-usb2.c

between commits:

  54c4c58713aa ("phy: renesas: rcar-gen3-usb2: Fix role detection on unbind/bind")
  55a387ebb921 ("phy: renesas: rcar-gen3-usb2: Lock around hardware registers and driver data")

from the phy tree and commit:

  3767474d7497 ("phy: renesas: phy-rcar-gen3-usb2: Add USB2.0 PHY support for RZ/V2H(P)")

from the phy-next tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc drivers/phy/renesas/phy-rcar-gen3-usb2.c
index 9fdf17e0848a,867f43132b7a..000000000000
--- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c
+++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c
@@@ -467,16 -472,24 +477,24 @@@ static int rcar_gen3_phy_usb2_init(stru
  	val = readl(usb2_base + USB2_INT_ENABLE);
  	val |= USB2_INT_ENABLE_UCOM_INTEN | rphy->int_enable_bits;
  	writel(val, usb2_base + USB2_INT_ENABLE);
 -	writel(USB2_SPD_RSM_TIMSET_INIT, usb2_base + USB2_SPD_RSM_TIMSET);
 -	writel(USB2_OC_TIMSET_INIT, usb2_base + USB2_OC_TIMSET);
  
 -	/* Initialize otg part */
 -	if (channel->is_otg_channel) {
 -		if (rcar_gen3_needs_init_otg(channel))
 -			rcar_gen3_init_otg(channel);
 -		rphy->otg_initialized = true;
 +	if (!rcar_gen3_is_any_rphy_initialized(channel)) {
 +		writel(USB2_SPD_RSM_TIMSET_INIT, usb2_base + USB2_SPD_RSM_TIMSET);
 +		writel(USB2_OC_TIMSET_INIT, usb2_base + USB2_OC_TIMSET);
  	}
  
 +	/* Initialize otg part (only if we initialize a PHY with IRQs). */
 +	if (rphy->int_enable_bits)
 +		rcar_gen3_init_otg(channel);
 +
+ 	if (channel->utmi_ctrl) {
+ 		val = readl(usb2_base + USB2_REGEN_CG_CTRL) | USB2_REGEN_CG_CTRL_UPHY_WEN;
+ 		writel(val, usb2_base + USB2_REGEN_CG_CTRL);
+ 
+ 		writel(USB2_UTMI_CTRL_INIT, usb2_base + USB2_UTMI_CTRL);
+ 		writel(val & ~USB2_REGEN_CG_CTRL_UPHY_WEN, usb2_base + USB2_REGEN_CG_CTRL);
+ 	}
+ 
  	rphy->initialized = true;
  
  	return 0;
@@@ -764,7 -791,9 +792,9 @@@ static int rcar_gen3_phy_usb2_probe(str
  	if (phy_data->no_adp_ctrl)
  		channel->obint_enable_bits = USB2_OBINT_IDCHG_EN;
  
+ 	channel->utmi_ctrl = phy_data->utmi_ctrl;
+ 
 -	mutex_init(&channel->lock);
 +	spin_lock_init(&channel->lock);
  	for (i = 0; i < NUM_OF_PHYS; i++) {
  		channel->rphys[i].phy = devm_phy_create(dev, NULL,
  							phy_data->phy_usb2_ops);