Subject: linux-next: manual merge of the usb-gadget tree with the usb tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 16 Mar 2020 14:23:09 +1100

Hi all,

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

  drivers/usb/dwc3/dwc3-meson-g12a.c

between commit:

  bce3052f0c16 ("usb: roles: Provide the switch drivers handle to the switch in the API")

from the usb tree and commit:

  1e355f21d3fb ("usb: dwc3: Add Amlogic A1 DWC3 glue")

from the usb-gadget 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/usb/dwc3/dwc3-meson-g12a.c
index 3309ce90ca14,902553f39889..000000000000
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@@ -381,6 -408,53 +409,54 @@@ static struct device *dwc3_meson_g12_fi
  	return &pdev->dev;
  }
  
+ static int dwc3_meson_g12a_otg_init(struct platform_device *pdev,
+ 				    struct dwc3_meson_g12a *priv)
+ {
+ 	enum phy_mode otg_id;
+ 	int ret, irq;
+ 	struct device *dev = &pdev->dev;
+ 
+ 	if (!priv->drvdata->otg_switch_supported)
+ 		return 0;
+ 
+ 	if (priv->otg_mode == USB_DR_MODE_OTG) {
+ 		/* Ack irq before registering */
+ 		regmap_update_bits(priv->regmap, USB_R5,
+ 				   USB_R5_ID_DIG_IRQ, 0);
+ 
+ 		irq = platform_get_irq(pdev, 0);
+ 		ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
+ 						dwc3_meson_g12a_irq_thread,
+ 						IRQF_ONESHOT, pdev->name, priv);
+ 		if (ret)
+ 			return ret;
+ 	}
+ 
+ 	/* Setup OTG mode corresponding to the ID pin */
+ 	if (priv->otg_mode == USB_DR_MODE_OTG) {
+ 		otg_id = dwc3_meson_g12a_get_id(priv);
+ 		if (otg_id != priv->otg_phy_mode) {
+ 			if (dwc3_meson_g12a_otg_mode_set(priv, otg_id))
+ 				dev_warn(dev, "Failed to switch OTG mode\n");
+ 		}
+ 	}
+ 
+ 	/* Setup role switcher */
+ 	priv->switch_desc.usb2_port = dwc3_meson_g12_find_child(dev,
+ 								"snps,dwc3");
+ 	priv->switch_desc.udc = dwc3_meson_g12_find_child(dev, "snps,dwc2");
+ 	priv->switch_desc.allow_userspace_control = true;
+ 	priv->switch_desc.set = dwc3_meson_g12a_role_set;
+ 	priv->switch_desc.get = dwc3_meson_g12a_role_get;
++	priv->switch_desc.driver_data = priv;
+ 
+ 	priv->role_switch = usb_role_switch_register(dev, &priv->switch_desc);
+ 	if (IS_ERR(priv->role_switch))
+ 		dev_warn(dev, "Unable to register Role Switch\n");
+ 
+ 	return 0;
+ }
+ 
  static int dwc3_meson_g12a_probe(struct platform_device *pdev)
  {
  	struct dwc3_meson_g12a	*priv;