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]
Date:   Tue, 31 Mar 2020 10:44:52 +0200
From:   Neil Armstrong <narmstrong@...libre.com>
To:     Martin Blumenstingl <martin.blumenstingl@...glemail.com>
Cc:     kishon@...com, balbi@...nel.org, khilman@...libre.com,
        linux-amlogic@...ts.infradead.org, linux-usb@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 07/14] usb: dwc3: meson-g12a: refactor usb init

On 27/03/2020 00:26, Martin Blumenstingl wrote:
> Hi Neil,
> 
> On Thu, Mar 26, 2020 at 2:45 PM Neil Armstrong <narmstrong@...libre.com> wrote:
> [...]
>> -static int dwc3_meson_g12a_usb2_init(struct dwc3_meson_g12a *priv)
>> +static int dwc3_meson_g12a_usb2_init(struct dwc3_meson_g12a *priv,
>> +                                    enum phy_mode mode)
>>  {
>>         int i, ret;
>>
>> -       if (priv->otg_mode == USB_DR_MODE_PERIPHERAL)
>> -               priv->otg_phy_mode = PHY_MODE_USB_DEVICE;
>> -       else
>> -               priv->otg_phy_mode = PHY_MODE_USB_HOST;
>> -
>>         for (i = 0; i < priv->drvdata->num_phys; ++i) {
>>                 if (!priv->phys[i])
>>                         continue;
>> @@ -284,9 +286,10 @@ static void dwc3_meson_g12a_usb3_init(struct dwc3_meson_g12a *priv)
>>                         FIELD_PREP(USB_R1_P30_PCS_TX_SWING_FULL_MASK, 127));
>>  }
> There is something strange with dwc3_meson_g12a_usb2_init.
> enum phy_mode mode is added here but it's not used inside this function

You are right...

> 
> I also think that we should not pass enum phy_mode to
> dwc3_meson_g12a_usb_otg_apply_mode
> I'm aware that the original function used enum phy_mode inside but
> this doesn't seem right:
> we're not configuring a PHY there
> instead we're setting up the OTG switch so I think we should use enum
> usb_role instead

Indirectly yes, we setup how the phy_mode is set in the glue, and passing
usb_role will need an useless conversion in dwc3_meson_g12a_usb_init_glue
also calling dwc3_meson_g12a_usb_otg_apply_mode.

> 
> [...]
> not part of this patch but should be:
> there's a still a direct call to dwc3_meson_g12a_usb_init() in
> dwc3_meson_g12a_resume()
> I think that needs to be changed to priv->drvdata->usb_init(priv); as well
> 

Indeed, I'll fix that.

Again, thanks for reviewing !

Neil

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ