Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: Ruchika Kharwar <ruchika@ti.com>,
	linux-usb@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-omap@vger.kernel.org, Felipe Balbi <balbi@ti.com>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Rob Landley <rob@landley.net>
Subject: Re: [PATCH] usb: dwc3: Addition of "dr_mode" dt property.
Date: Fri, 31 May 2013 07:33:41 +0300	[thread overview]
Message-ID: <20130531043341.GA8279@arwen.pp.htv.fi> (raw)
In-Reply-To: <51A7AE26.90909@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

Hi,

On Thu, May 30, 2013 at 02:53:10PM -0500, Dan Murphy wrote:
> > @@ -520,9 +520,23 @@ static int dwc3_probe(struct platform_device *pdev)
> >  		mode = DWC3_MODE_HOST;
> >  	else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
> >  		mode = DWC3_MODE_DEVICE;
> > -	else
> > -		mode = DWC3_MODE_DRD;
> > -
> > +	else {
> > +		if (of_property_read_string(node, "dr_mode", &dr_mode)) {
> This will not execute if the either CONFIG options are set and then
> the DT property is not even honored
> Did you test this with multiple CONFIG options?
> There seems to be a conflict between CONFIGs and runtime operation.

this is alright. We still want to honor the users who chose to compile
the driver for gadget-only. In that case, there is no choice to be made.

Now, if you build the driver in its entirety (meaning, DRD), you can
still choose in runtime if you want the driver to behave as host-only or
gadget-only.

Picture a situation where you have a single SoC with multiple instances
of this IP and you want to make sure that e.g. ports 1-3 are host-only,
port 4 is peripheral-only and port 5 is DRD.

> > +			dev_warn(dev, "Missing dr_mode so assuming DWC3_MODE_DRD\n");
> If dr_mode is an optional parameter why would the dev_warn say it is missing?
> Do we even want to warn here?

Yes. Definitely yes. That would mean a less than optimal DTS file.
Still, for the sake of sensible defaults, we can still choose to work on
DRD mode, assuming full capabilities in case user didn't write proper
DTS, still user should be notified about it.

> > +			mode = DWC3_MODE_DRD;
> > +		} else {
> > +			if (strcmp(dr_mode, "host") == 0)
> > +				mode = DWC3_MODE_HOST;
> What if CONFIG_USB_DWC3_HOST is not enabled?

No issues, this will only execute if DRD is enabled, which means both
Host and Device are built in the final binary.

> > +			else if (strcmp(dr_mode, "gadget") == 0)
> > +				mode = DWC3_MODE_DEVICE;
> What if CONFIG_USB_DWC3_GADGET is not enabled?

see above.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2013-05-31  4:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-30 17:56 [PATCH] usb: dwc3: Addition of "dr_mode" dt property Ruchika Kharwar
2013-05-30 19:53 ` Dan Murphy
2013-05-31  4:33   ` Felipe Balbi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-05-30 20:14 Ruchika Kharwar
2013-05-30 20:19 ` Sergei Shtylyov
     [not found] ` <51A7B725.1090103@ti.com>
2013-05-30 20:35   ` Dan Murphy
2013-05-30 22:47     ` Ruchika Kharwar
2013-05-31  8:10 ` Michael Grzeschik
2013-05-30 20:31 Ruchika Kharwar
2013-06-03 12:09 ` Michael Grzeschik

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=20130531043341.GA8279@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=dmurphy@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kishon@ti.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=rob@landley.net \
    --cc=ruchika@ti.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