* [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode. @ 2013-02-05 13:45 Vivek Gautam 2013-02-25 8:17 ` Felipe Balbi 0 siblings, 1 reply; 9+ messages in thread From: Vivek Gautam @ 2013-02-05 13:45 UTC (permalink / raw) To: linux-usb; +Cc: linux-kernel, linux-omap, gregkh, balbi, kishon Now that machines may select the mode of working of DWC3, we can set the Port capability direction based on selected mode. Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> --- drivers/usb/dwc3/core.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 177f4c6..f4c47f7 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -479,7 +479,6 @@ static int dwc3_probe(struct platform_device *pdev) switch (mode) { case DWC3_MODE_DEVICE: - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); ret = dwc3_gadget_init(dwc); if (ret) { dev_err(dev, "failed to initialize gadget\n"); @@ -487,7 +486,6 @@ static int dwc3_probe(struct platform_device *pdev) } break; case DWC3_MODE_HOST: - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); ret = dwc3_host_init(dwc); if (ret) { dev_err(dev, "failed to initialize host\n"); @@ -495,7 +493,6 @@ static int dwc3_probe(struct platform_device *pdev) } break; case DWC3_MODE_DRD: - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); ret = dwc3_host_init(dwc); if (ret) { dev_err(dev, "failed to initialize host\n"); @@ -514,6 +511,14 @@ static int dwc3_probe(struct platform_device *pdev) } dwc->mode = mode; +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); +#else + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); +#endif + ret = dwc3_debugfs_init(dwc); if (ret) { dev_err(dev, "failed to initialize debugfs\n"); -- 1.7.6.5 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode. 2013-02-05 13:45 [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode Vivek Gautam @ 2013-02-25 8:17 ` Felipe Balbi 2013-02-25 8:51 ` Vivek Gautam 0 siblings, 1 reply; 9+ messages in thread From: Felipe Balbi @ 2013-02-25 8:17 UTC (permalink / raw) To: Vivek Gautam; +Cc: linux-usb, linux-kernel, linux-omap, gregkh, balbi, kishon [-- Attachment #1: Type: text/plain, Size: 4078 bytes --] Hi, On Tue, Feb 05, 2013 at 07:15:58PM +0530, Vivek Gautam wrote: > Now that machines may select the mode of working of DWC3, > we can set the Port capability direction based on selected mode. > > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> > --- > drivers/usb/dwc3/core.c | 11 ++++++++--- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 177f4c6..f4c47f7 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -479,7 +479,6 @@ static int dwc3_probe(struct platform_device *pdev) > > switch (mode) { > case DWC3_MODE_DEVICE: > - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); > ret = dwc3_gadget_init(dwc); > if (ret) { > dev_err(dev, "failed to initialize gadget\n"); > @@ -487,7 +486,6 @@ static int dwc3_probe(struct platform_device *pdev) > } > break; > case DWC3_MODE_HOST: > - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); > ret = dwc3_host_init(dwc); > if (ret) { > dev_err(dev, "failed to initialize host\n"); > @@ -495,7 +493,6 @@ static int dwc3_probe(struct platform_device *pdev) > } > break; > case DWC3_MODE_DRD: > - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); > ret = dwc3_host_init(dwc); > if (ret) { > dev_err(dev, "failed to initialize host\n"); > @@ -514,6 +511,14 @@ static int dwc3_probe(struct platform_device *pdev) > } > dwc->mode = mode; > > +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) > + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); > +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) > + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); > +#else > + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); > +#endif you can actually use: if (IS_ENABLED(CONFIG_USB_DWC3_HOST)) dwc3_set_mode(dwc... else if (IS_ENABLED( ... ... else ... instead of pre-processor conditionals. In fact, I have recently written a patch converting #if IS_ENABLED() to if (IS_ENABLED()) but I haven't posted yet: commit 42dbbbc272bc941ec2b0cac51342609e61e13a01 Author: Felipe Balbi <balbi@ti.com> Date: Fri Feb 22 16:24:49 2013 +0200 usb: dwc3: debugfs: improve debugfs file creation when commit 388e5c5 (usb: dwc3: remove dwc3 dependency on host AND gadget.) changed the way debugfs files are created, it failed to note that 'mode' is necessary in Dual Role mode only while 'testmode' and 'link_state' are valid in Dual Role and Peripheral-only builds. Fix this while also converting pre- processor conditional to C conditionals. Signed-off-by: Felipe Balbi <balbi@ti.com> diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index a1bac9a..8b23d045 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -667,28 +667,31 @@ int dwc3_debugfs_init(struct dwc3 *dwc) goto err1; } -#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) - file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, - dwc, &dwc3_mode_fops); - if (!file) { - ret = -ENOMEM; - goto err1; + if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { + file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, + dwc, &dwc3_mode_fops); + if (!file) { + ret = -ENOMEM; + goto err1; + } } - file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, - dwc, &dwc3_testmode_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } - - file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, - dwc, &dwc3_link_state_fops); - if (!file) { - ret = -ENOMEM; - goto err1; + if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) || + IS_ENABLED(CONFIG_USB_DWC3_GADGET)) { + file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, + dwc, &dwc3_testmode_fops); + if (!file) { + ret = -ENOMEM; + goto err1; + } + + file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, + dwc, &dwc3_link_state_fops); + if (!file) { + ret = -ENOMEM; + goto err1; + } } -#endif return 0; -- balbi [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode. 2013-02-25 8:17 ` Felipe Balbi @ 2013-02-25 8:51 ` Vivek Gautam 2013-02-25 9:19 ` Felipe Balbi 0 siblings, 1 reply; 9+ messages in thread From: Vivek Gautam @ 2013-02-25 8:51 UTC (permalink / raw) To: balbi; +Cc: Vivek Gautam, linux-usb, linux-kernel, linux-omap, gregkh, kishon Hi Balbi, On Mon, Feb 25, 2013 at 1:47 PM, Felipe Balbi <balbi@ti.com> wrote: > Hi, > > On Tue, Feb 05, 2013 at 07:15:58PM +0530, Vivek Gautam wrote: >> Now that machines may select the mode of working of DWC3, >> we can set the Port capability direction based on selected mode. >> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> >> --- >> drivers/usb/dwc3/core.c | 11 ++++++++--- >> 1 files changed, 8 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c >> index 177f4c6..f4c47f7 100644 >> --- a/drivers/usb/dwc3/core.c >> +++ b/drivers/usb/dwc3/core.c >> @@ -479,7 +479,6 @@ static int dwc3_probe(struct platform_device *pdev) >> >> switch (mode) { >> case DWC3_MODE_DEVICE: >> - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); >> ret = dwc3_gadget_init(dwc); >> if (ret) { >> dev_err(dev, "failed to initialize gadget\n"); >> @@ -487,7 +486,6 @@ static int dwc3_probe(struct platform_device *pdev) >> } >> break; >> case DWC3_MODE_HOST: >> - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); >> ret = dwc3_host_init(dwc); >> if (ret) { >> dev_err(dev, "failed to initialize host\n"); >> @@ -495,7 +493,6 @@ static int dwc3_probe(struct platform_device *pdev) >> } >> break; >> case DWC3_MODE_DRD: >> - dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); >> ret = dwc3_host_init(dwc); >> if (ret) { >> dev_err(dev, "failed to initialize host\n"); >> @@ -514,6 +511,14 @@ static int dwc3_probe(struct platform_device *pdev) >> } >> dwc->mode = mode; >> >> +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); >> +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); >> +#else >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); >> +#endif > > you can actually use: > > if (IS_ENABLED(CONFIG_USB_DWC3_HOST)) > dwc3_set_mode(dwc... > else if (IS_ENABLED( ... > ... > else > ... > I am actually hoping to change this to something like below (after of course changing the preprocessor conditionals) : commit 9a62ed948dcb6ac5d78aff41f5355c0a5ea86475 Author: Vivek Gautam <gautam.vivek@samsung.com> Date: Thu Jan 24 11:58:05 2013 +0530 usb: dwc3: Set GCTL.PrtCapDir based on selected mode. Now that machines may select the mode of working of DWC3, we can set the Port capability direction based on selected mode. Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 79f335f..9444fbe 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -478,7 +478,13 @@ static int dwc3_probe(struct platform_device *pdev) goto err1; } - mode = DWC3_MODE(dwc->hwparams.hwparams0); +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) + mode = DWC3_MODE_HOST; +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) + mode = DWC3_MODE_DEVICE; +#else + mode = DWC3_MODE_DRD; +#endif switch (mode) { case DWC3_MODE_DEVICE: Since the mode is now software dependent, we can skip initializing gadget/host in case of Host-only/Gadget-only modes respectively. Can't guess how much this is valid though :-( > instead of pre-processor conditionals. In fact, I have recently written > a patch converting #if IS_ENABLED() to if (IS_ENABLED()) but I haven't > posted yet: > Right, very valid change. Missed this in earlier change :-( > commit 42dbbbc272bc941ec2b0cac51342609e61e13a01 > Author: Felipe Balbi <balbi@ti.com> > Date: Fri Feb 22 16:24:49 2013 +0200 > > usb: dwc3: debugfs: improve debugfs file creation > > when commit 388e5c5 (usb: dwc3: remove dwc3 > dependency on host AND gadget.) changed the > way debugfs files are created, it failed to > note that 'mode' is necessary in Dual Role > mode only while 'testmode' and 'link_state' > are valid in Dual Role and Peripheral-only > builds. Fix this while also converting pre- > processor conditional to C conditionals. > > Signed-off-by: Felipe Balbi <balbi@ti.com> > > diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c > index a1bac9a..8b23d045 100644 > --- a/drivers/usb/dwc3/debugfs.c > +++ b/drivers/usb/dwc3/debugfs.c > @@ -667,28 +667,31 @@ int dwc3_debugfs_init(struct dwc3 *dwc) > goto err1; > } > > -#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) > - file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, > - dwc, &dwc3_mode_fops); > - if (!file) { > - ret = -ENOMEM; > - goto err1; > + if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { > + file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, > + dwc, &dwc3_mode_fops); > + if (!file) { > + ret = -ENOMEM; > + goto err1; > + } > } > > - file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, > - dwc, &dwc3_testmode_fops); > - if (!file) { > - ret = -ENOMEM; > - goto err1; > - } > - > - file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, > - dwc, &dwc3_link_state_fops); > - if (!file) { > - ret = -ENOMEM; > - goto err1; > + if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) || > + IS_ENABLED(CONFIG_USB_DWC3_GADGET)) { > + file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, > + dwc, &dwc3_testmode_fops); > + if (!file) { > + ret = -ENOMEM; > + goto err1; > + } > + > + file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, > + dwc, &dwc3_link_state_fops); > + if (!file) { > + ret = -ENOMEM; > + goto err1; > + } > } > -#endif > > return 0; > > > -- > balbi -- Thanks & Regards Vivek ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode. 2013-02-25 8:51 ` Vivek Gautam @ 2013-02-25 9:19 ` Felipe Balbi 2013-02-25 9:29 ` Vivek Gautam 0 siblings, 1 reply; 9+ messages in thread From: Felipe Balbi @ 2013-02-25 9:19 UTC (permalink / raw) To: Vivek Gautam Cc: balbi, Vivek Gautam, linux-usb, linux-kernel, linux-omap, gregkh, kishon [-- Attachment #1: Type: text/plain, Size: 1803 bytes --] Hi, On Mon, Feb 25, 2013 at 02:21:46PM +0530, Vivek Gautam wrote: > >> @@ -514,6 +511,14 @@ static int dwc3_probe(struct platform_device *pdev) > >> } > >> dwc->mode = mode; > >> > >> +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) > >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); > >> +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) > >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); > >> +#else > >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); > >> +#endif > > > > you can actually use: > > > > if (IS_ENABLED(CONFIG_USB_DWC3_HOST)) > > dwc3_set_mode(dwc... > > else if (IS_ENABLED( ... > > ... > > else > > ... > > > > I am actually hoping to change this to something like below (after > of course changing the preprocessor conditionals) : > > commit 9a62ed948dcb6ac5d78aff41f5355c0a5ea86475 > Author: Vivek Gautam <gautam.vivek@samsung.com> > Date: Thu Jan 24 11:58:05 2013 +0530 > > usb: dwc3: Set GCTL.PrtCapDir based on selected mode. > > Now that machines may select the mode of working of DWC3, > we can set the Port capability direction based on selected mode. > > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 79f335f..9444fbe 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -478,7 +478,13 @@ static int dwc3_probe(struct platform_device *pdev) > goto err1; > } > > - mode = DWC3_MODE(dwc->hwparams.hwparams0); > +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) > + mode = DWC3_MODE_HOST; > +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) > + mode = DWC3_MODE_DEVICE; > +#else > + mode = DWC3_MODE_DRD; looks alright. -- balbi [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode. 2013-02-25 9:19 ` Felipe Balbi @ 2013-02-25 9:29 ` Vivek Gautam [not found] ` <CAFp+6iGGAY=nMg03-bqHz=XuNP+1t9mQR=M53HGoqCXv=t+f0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Vivek Gautam @ 2013-02-25 9:29 UTC (permalink / raw) To: balbi; +Cc: Vivek Gautam, linux-usb, linux-kernel, linux-omap, gregkh, kishon On Mon, Feb 25, 2013 at 2:49 PM, Felipe Balbi <balbi@ti.com> wrote: > Hi, > > On Mon, Feb 25, 2013 at 02:21:46PM +0530, Vivek Gautam wrote: >> >> @@ -514,6 +511,14 @@ static int dwc3_probe(struct platform_device *pdev) >> >> } >> >> dwc->mode = mode; >> >> >> >> +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) >> >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST); >> >> +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) >> >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE); >> >> +#else >> >> + dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG); >> >> +#endif >> > >> > you can actually use: >> > >> > if (IS_ENABLED(CONFIG_USB_DWC3_HOST)) >> > dwc3_set_mode(dwc... >> > else if (IS_ENABLED( ... >> > ... >> > else >> > ... >> > >> >> I am actually hoping to change this to something like below (after >> of course changing the preprocessor conditionals) : >> >> commit 9a62ed948dcb6ac5d78aff41f5355c0a5ea86475 >> Author: Vivek Gautam <gautam.vivek@samsung.com> >> Date: Thu Jan 24 11:58:05 2013 +0530 >> >> usb: dwc3: Set GCTL.PrtCapDir based on selected mode. >> >> Now that machines may select the mode of working of DWC3, >> we can set the Port capability direction based on selected mode. >> >> Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> >> >> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c >> index 79f335f..9444fbe 100644 >> --- a/drivers/usb/dwc3/core.c >> +++ b/drivers/usb/dwc3/core.c >> @@ -478,7 +478,13 @@ static int dwc3_probe(struct platform_device *pdev) >> goto err1; >> } >> >> - mode = DWC3_MODE(dwc->hwparams.hwparams0); >> +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) >> + mode = DWC3_MODE_HOST; >> +#elif IS_ENABLED(CONFIG_USB_DWC3_GADGET) >> + mode = DWC3_MODE_DEVICE; >> +#else >> + mode = DWC3_MODE_DRD; > > looks alright. > Fine then, i'll post this. -- Thanks & Regards Vivek ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CAFp+6iGGAY=nMg03-bqHz=XuNP+1t9mQR=M53HGoqCXv=t+f0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode. [not found] ` <CAFp+6iGGAY=nMg03-bqHz=XuNP+1t9mQR=M53HGoqCXv=t+f0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-03-02 13:25 ` Vivek Gautam 2013-03-13 9:12 ` Vivek Gautam 0 siblings, 1 reply; 9+ messages in thread From: Vivek Gautam @ 2013-03-02 13:25 UTC (permalink / raw) To: linux-usb-u79uwXL29TY76Z2rM5mHXA Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r, balbi-l0cyMroinI0 Now that machines may select the mode of working of DWC3 (HOST only, GADGET only or DUAL_ROLE), lets set DWC3 mode based on that rather than fixing it to whatever DWC3 hardware says. This way we can skip initializing Gadget/Host in case we are using Host-only/Gadget-only mode respectively. Signed-off-by: Vivek Gautam <gautam.vivek-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> --- Changes from RFC patch "usb: dwc3: Set GCTL.PrtCapDir based on selected mode" - Setting the mode in dwc3 context structure based on selected mode in machine, rather than programming PrtCapDir drivers/usb/dwc3/core.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 79f335f..be0672f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -478,7 +478,12 @@ static int dwc3_probe(struct platform_device *pdev) goto err1; } - mode = DWC3_MODE(dwc->hwparams.hwparams0); + if (IS_ENABLED(CONFIG_USB_DWC3_HOST)) + mode = DWC3_MODE_HOST; + else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET)) + mode = DWC3_MODE_DEVICE; + else + mode = DWC3_MODE_DRD; switch (mode) { case DWC3_MODE_DEVICE: -- 1.7.6.5 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode. 2013-03-02 13:25 ` [PATCH] usb: dwc3: Set DWC3 context's mode " Vivek Gautam @ 2013-03-13 9:12 ` Vivek Gautam 2013-03-13 9:14 ` Felipe Balbi 0 siblings, 1 reply; 9+ messages in thread From: Vivek Gautam @ 2013-03-13 9:12 UTC (permalink / raw) To: Felipe Balbi Cc: linux-usb, linux-kernel, linux-omap, linux-samsung-soc, gregkh, Vivek Gautam Hi Balbi, On Sat, Mar 2, 2013 at 6:55 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote: > Now that machines may select the mode of working of DWC3 (HOST only, > GADGET only or DUAL_ROLE), lets set DWC3 mode based on that > rather than fixing it to whatever DWC3 hardware says. > This way we can skip initializing Gadget/Host in case > we are using Host-only/Gadget-only mode respectively. > Hope this patch if fine, and mainlinable ? > Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com> > --- > > Changes from RFC patch "usb: dwc3: Set GCTL.PrtCapDir based on selected mode" > - Setting the mode in dwc3 context structure based on > selected mode in machine, rather than programming PrtCapDir > > drivers/usb/dwc3/core.c | 7 ++++++- > 1 files changed, 6 insertions(+), 1 deletions(-) > > diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c > index 79f335f..be0672f 100644 > --- a/drivers/usb/dwc3/core.c > +++ b/drivers/usb/dwc3/core.c > @@ -478,7 +478,12 @@ static int dwc3_probe(struct platform_device *pdev) > goto err1; > } > > - mode = DWC3_MODE(dwc->hwparams.hwparams0); > + if (IS_ENABLED(CONFIG_USB_DWC3_HOST)) > + mode = DWC3_MODE_HOST; > + else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET)) > + mode = DWC3_MODE_DEVICE; > + else > + mode = DWC3_MODE_DRD; > > switch (mode) { > case DWC3_MODE_DEVICE: > -- > 1.7.6.5 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ -- Thanks & Regards Vivek ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode. 2013-03-13 9:12 ` Vivek Gautam @ 2013-03-13 9:14 ` Felipe Balbi 2013-03-13 9:15 ` Vivek Gautam 0 siblings, 1 reply; 9+ messages in thread From: Felipe Balbi @ 2013-03-13 9:14 UTC (permalink / raw) To: Vivek Gautam Cc: Felipe Balbi, linux-usb, linux-kernel, linux-omap, linux-samsung-soc, gregkh, Vivek Gautam [-- Attachment #1: Type: text/plain, Size: 613 bytes --] On Wed, Mar 13, 2013 at 02:42:22PM +0530, Vivek Gautam wrote: > Hi Balbi, > > > On Sat, Mar 2, 2013 at 6:55 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote: > > Now that machines may select the mode of working of DWC3 (HOST only, > > GADGET only or DUAL_ROLE), lets set DWC3 mode based on that > > rather than fixing it to whatever DWC3 hardware says. > > This way we can skip initializing Gadget/Host in case > > we are using Host-only/Gadget-only mode respectively. > > > > Hope this patch if fine, and mainlinable ? yes, it's in my testing branch, you will receive mail soon -- balbi [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode. 2013-03-13 9:14 ` Felipe Balbi @ 2013-03-13 9:15 ` Vivek Gautam 0 siblings, 0 replies; 9+ messages in thread From: Vivek Gautam @ 2013-03-13 9:15 UTC (permalink / raw) To: balbi Cc: linux-usb, linux-kernel, linux-omap, linux-samsung-soc, gregkh, Vivek Gautam On Wed, Mar 13, 2013 at 2:44 PM, Felipe Balbi <balbi@ti.com> wrote: > On Wed, Mar 13, 2013 at 02:42:22PM +0530, Vivek Gautam wrote: >> Hi Balbi, >> >> >> On Sat, Mar 2, 2013 at 6:55 PM, Vivek Gautam <gautam.vivek@samsung.com> wrote: >> > Now that machines may select the mode of working of DWC3 (HOST only, >> > GADGET only or DUAL_ROLE), lets set DWC3 mode based on that >> > rather than fixing it to whatever DWC3 hardware says. >> > This way we can skip initializing Gadget/Host in case >> > we are using Host-only/Gadget-only mode respectively. >> > >> >> Hope this patch if fine, and mainlinable ? > > yes, it's in my testing branch, you will receive mail soon > Sure, thanks. > -- > balbi -- Thanks & Regards Vivek ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-03-13 9:15 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-05 13:45 [PATCH RFC] usb: dwc3: Set GCTL.PrtCapDir based on selected mode Vivek Gautam
2013-02-25 8:17 ` Felipe Balbi
2013-02-25 8:51 ` Vivek Gautam
2013-02-25 9:19 ` Felipe Balbi
2013-02-25 9:29 ` Vivek Gautam
[not found] ` <CAFp+6iGGAY=nMg03-bqHz=XuNP+1t9mQR=M53HGoqCXv=t+f0Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-02 13:25 ` [PATCH] usb: dwc3: Set DWC3 context's mode " Vivek Gautam
2013-03-13 9:12 ` Vivek Gautam
2013-03-13 9:14 ` Felipe Balbi
2013-03-13 9:15 ` Vivek Gautam
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox