lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADhT+weuBWygDShZ5wgyozZ9zrm+EB+rhOZegXHjRLKLja2GXw@mail.gmail.com>
Date:	Wed, 6 Aug 2014 17:48:08 -0500
From:	Dinh Nguyen <dinh.linux@...il.com>
To:	Doug Anderson <dianders@...omium.org>
Cc:	Kever Yang <kever.yang@...k-chips.com>,
	Paul Zimmerman <paulz@...opsys.com>,
	Heiko Stuebner <heiko@...ech.de>,
	Addy Ke <addy.ke@...k-chips.com>,
	Eddie Cai <cf@...k-chips.com>, Jianqun Xu <xjq@...k-chips.com>,
	Olof Johansson <olof@...om.net>,
	Sonny Rao <sonnyrao@...omium.org>, wulf <wulf@...k-chips.com>,
	lyz <lyz@...k-chips.com>, Jingoo Han <jg1.han@...sung.com>,
	han jiang <hj@...k-chips.com>,
	Tao Huang <huangtao@...k-chips.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Dinh Nguyen <dinguyen@...era.com>
Subject: Re: [PATCH v4 2/2] usb: dwc2: add 'mode' which based on Kconfig
 select or dts setting

On Wed, Aug 6, 2014 at 5:24 PM, Doug Anderson <dianders@...omium.org> wrote:
> Kever,
>
> On Tue, Aug 5, 2014 at 6:01 PM, Kever Yang <kever.yang@...k-chips.com> wrote:
>> According to the "dr_mode", the otg controller can work as
>> device role and host role. Some boards always want to use host mode
>> and some other boards want to use gadget mode. We use the dts setting
>> to set dwc2's mode, rather than fixing it to whatever hardware says.
>>
>> Signed-off-by: Kever Yang <kever.yang@...k-chips.com>
>> Acked-by: Paul Zimmerman <paulz@...opsys.com>
>> ---
>>
>> Changes in v4:
>> - From Doug's suggestion:
>>  -- remove dr_mode init from Kconfig code
>>  -- change the commit meesage
>>
>> Changes in v3:
>> - fix the odd spacing in dwc2_hsotg struct
>> - From Jingoo's suggestion:
>>     change the commit message
>> - add dr_mode init from Kconfig
>>
>> Changes in v2:
>> - put spaces around '+' operator
>> - expand the comment for dr_mode
>> - handle dr_mode is USB_DR_MODE_OTG
>>
>>  drivers/usb/dwc2/core.c     | 18 ++++++++++++++++++
>>  drivers/usb/dwc2/core.h     |  5 +++++
>>  drivers/usb/dwc2/platform.c |  4 ++++
>>  3 files changed, 27 insertions(+)
>
> I think this patch still makes sense even though we don't have a
> combined driver yet.  Perhaps Paul or Dihn can confirm.
>

I think this looks fine to me. I will rebase my v3 on top of this patch.

Dinh

> We could potentially do something based on KConfig (like you did in
> patch set #3), but it wouldn't really make sense to do that until
> after Dihn's work lands.
>
>
>> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
>> index 27d2c9b..738bec2 100644
>> --- a/drivers/usb/dwc2/core.c
>> +++ b/drivers/usb/dwc2/core.c
>> @@ -118,6 +118,7 @@ static int dwc2_core_reset(struct dwc2_hsotg *hsotg)
>>  {
>>         u32 greset;
>>         int count = 0;
>> +       u32 gusbcfg;
>>
>>         dev_vdbg(hsotg->dev, "%s()\n", __func__);
>>
>> @@ -148,6 +149,23 @@ static int dwc2_core_reset(struct dwc2_hsotg *hsotg)
>>                 }
>>         } while (greset & GRSTCTL_CSFTRST);
>>
>> +       if (hsotg->dr_mode == USB_DR_MODE_HOST) {
>> +               gusbcfg = readl(hsotg->regs + GUSBCFG);
>> +               gusbcfg &= ~GUSBCFG_FORCEDEVMODE;
>> +               gusbcfg |= GUSBCFG_FORCEHOSTMODE;
>> +               writel(gusbcfg, hsotg->regs + GUSBCFG);
>> +       } else if (hsotg->dr_mode == USB_DR_MODE_PERIPHERAL) {
>> +               gusbcfg = readl(hsotg->regs + GUSBCFG);
>> +               gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
>> +               gusbcfg |= GUSBCFG_FORCEDEVMODE;
>> +               writel(gusbcfg, hsotg->regs + GUSBCFG);
>> +       } else if (hsotg->dr_mode == USB_DR_MODE_OTG) {
>> +               gusbcfg = readl(hsotg->regs + GUSBCFG);
>> +               gusbcfg &= ~GUSBCFG_FORCEHOSTMODE;
>> +               gusbcfg &= ~GUSBCFG_FORCEDEVMODE;
>> +               writel(gusbcfg, hsotg->regs + GUSBCFG);
>
> I think the third case here won't be too useful until the combined
> driver, but it shouldn't hurt, right?
>
>
> -Doug
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ