2013-03-02 13:27:32

by Vivek Gautam

[permalink] [raw]
Subject: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode.

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 <[email protected]>
---

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


2013-03-13 09:12:26

by Vivek Gautam

[permalink] [raw]
Subject: Re: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode.

Hi Balbi,


On Sat, Mar 2, 2013 at 6:55 PM, Vivek Gautam <[email protected]> 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 <[email protected]>
> ---
>
> 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 [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/



--
Thanks & Regards
Vivek

2013-03-13 09:15:03

by Felipe Balbi

[permalink] [raw]
Subject: Re: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode.

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 <[email protected]> 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


Attachments:
(No filename) (595.00 B)
signature.asc (836.00 B)
Digital signature
Download all attachments

2013-03-13 09:15:39

by Vivek Gautam

[permalink] [raw]
Subject: Re: [PATCH] usb: dwc3: Set DWC3 context's mode based on selected mode.

On Wed, Mar 13, 2013 at 2:44 PM, Felipe Balbi <[email protected]> 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 <[email protected]> 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