linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
Cc: linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org,
	devicetree@vger.kernel.org, pure.logic@nexus-software.ie,
	bjorn.andersson@linaro.org, greg@kroah.com,
	linux-kernel@vger.kernel.org, quic_tsoni@quicinc.com,
	quic_psodagud@quicinc.com, quic_satyap@quicinc.com,
	quic_pheragu@quicinc.com, quic_rjendra@quicinc.com,
	quic_sibis@quicinc.com, quic_saipraka@quicinc.com
Subject: Re: [PATCH V2 4/8] usb: dwc3: drd: Register the eud connector child node for dwc3
Date: Mon, 13 Dec 2021 14:03:56 -0600	[thread overview]
Message-ID: <YbenLLPUYVX50CJc@robh.at.kernel.org> (raw)
In-Reply-To: <bcb48839a520b8bfc9b09e7a26ba8a8459ab602d.1638430506.git.quic_schowdhu@quicinc.com>

On Thu, Dec 02, 2021 at 03:21:23PM +0530, Souradeep Chowdhury wrote:
> Register the child node for dwc3 which is the "eud_usb_connector".
> The eud driver will be able to switch the usb role from device to
> host and vice versa using the role switch property of dwc3 node.
> 
> Signed-off-by: Souradeep Chowdhury <quic_schowdhu@quicinc.com>
> ---
>  drivers/usb/dwc3/drd.c | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/drd.c b/drivers/usb/dwc3/drd.c
> index d7f7683..b4ea55c 100644
> --- a/drivers/usb/dwc3/drd.c
> +++ b/drivers/usb/dwc3/drd.c
> @@ -8,6 +8,7 @@
>   */
>  
>  #include <linux/extcon.h>
> +#include <linux/of_platform.h>
>  #include <linux/of_graph.h>
>  #include <linux/platform_device.h>
>  #include <linux/property.h>
> @@ -164,6 +165,27 @@ static int dwc3_otg_get_irq(struct dwc3 *dwc)
>  	return irq;
>  }
>  
> +static int dwc3_register_eud(struct dwc3 *dwc)
> +{
> +	struct device		*dev = dwc->dev;
> +	struct device_node	*np = dev->of_node;
> +	int                     ret;
> +
> +	of_get_child_by_name(np, "eud_usb_connector");

Connector nodes are named 'connector' or possibly 'usb-connector'. If 
you are creating an ABI with the node name, it should be documented. 
However, it's preferred to use 'compatible' for identifying nodes rather 
than a node name.

> +	if (!np) {
> +		dev_dbg(dev, "no usb_connector child node specified\n");
> +		return 0;
> +	}
> +
> +	ret = of_platform_populate(np, NULL, NULL, dev);

But why is any of this needed. The connector doesn't have a driver (I 
expect eventually we will) and the EUD device is not a child.

> +	if (ret) {
> +		dev_err(dev, "failed to register usb_connector - %d\n", ret);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
>  void dwc3_otg_init(struct dwc3 *dwc)
>  {
>  	u32 reg;
> @@ -580,6 +602,10 @@ int dwc3_drd_init(struct dwc3 *dwc)
>  		ret = dwc3_setup_role_switch(dwc);
>  		if (ret < 0)
>  			return ret;
> +
> +		ret = dwc3_register_eud(dwc);
> +		if (ret < 0)
> +			return ret;
>  	} else if (dwc->edev) {
>  		dwc->edev_nb.notifier_call = dwc3_drd_notifier;
>  		ret = extcon_register_notifier(dwc->edev, EXTCON_USB_HOST,
> -- 
> 2.7.4
> 
> 

  reply	other threads:[~2021-12-13 20:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-02  9:51 [PATCH V2 0/8] Add Embedded USB Debugger (EUD) driver Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 1/8] dt-bindings: Add the yaml bindings for EUD Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 2/8] dt-bindings: connector: Add property for EUD type-C connector Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 3/8] bindings: usb: dwc3: Update dwc3 properties for EUD connector Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 4/8] usb: dwc3: drd: Register the eud connector child node for dwc3 Souradeep Chowdhury
2021-12-13 20:03   ` Rob Herring [this message]
2021-12-15 12:06     ` Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 5/8] soc: qcom: eud: Add driver support for Embedded USB Debugger(EUD) Souradeep Chowdhury
2021-12-03 11:04   ` Greg KH
2021-12-06  4:54     ` Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 6/8] arm64: dts: qcom: sc7280: Add EUD dt node and dwc3 connector Souradeep Chowdhury
2021-12-13 19:59   ` Rob Herring
2021-12-15 12:36     ` Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 7/8] arm64: dts: qcom: sc7280: Set the default dr_mode for usb2 Souradeep Chowdhury
2021-12-02  9:51 ` [PATCH V2 8/8] MAINTAINERS: Add maintainer entry for EUD Souradeep Chowdhury

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=YbenLLPUYVX50CJc@robh.at.kernel.org \
    --to=robh@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=greg@kroah.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=pure.logic@nexus-software.ie \
    --cc=quic_pheragu@quicinc.com \
    --cc=quic_psodagud@quicinc.com \
    --cc=quic_rjendra@quicinc.com \
    --cc=quic_saipraka@quicinc.com \
    --cc=quic_satyap@quicinc.com \
    --cc=quic_schowdhu@quicinc.com \
    --cc=quic_sibis@quicinc.com \
    --cc=quic_tsoni@quicinc.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;
as well as URLs for NNTP newsgroup(s).