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] [day] [month] [year] [list]
Message-ID: <28c4f3e6-1863-6a72-8edb-ad0639d126f9@samsung.com>
Date:   Fri, 20 Sep 2019 17:43:37 +0900
From:   Chanwoo Choi <cw00.choi@...sung.com>
To:     Yauhen Kharuzhy <jekhor@...il.com>, linux-kernel@...r.kernel.org,
        MyungJoo Ham <myungjoo.ham@...sung.com>
Cc:     Hans de Goede <hdegoede@...hat.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v2] extcon-intel-cht-wc: Don't reset USB data connection
 at probe

Hi,

On 19. 9. 17. 오전 6:15, Yauhen Kharuzhy wrote:
> Intel Cherry Trail Whiskey Cove extcon driver connect USB data lines to
> PMIC at driver probing for further charger detection. This causes reset of
> USB data sessions and removing all devices from bus. If system was
> booted from Live CD or USB dongle, this makes system unusable.
> 
> Check if USB ID pin is floating and re-route data lines in this case
> only, don't touch otherwise.
> 
> Signed-off-by: Yauhen Kharuzhy <jekhor@...il.com>
> ---
>  drivers/extcon/extcon-intel-cht-wc.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
> index 9d32150e68db..da1886a92f75 100644
> --- a/drivers/extcon/extcon-intel-cht-wc.c
> +++ b/drivers/extcon/extcon-intel-cht-wc.c
> @@ -338,6 +338,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
>  	struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
>  	struct cht_wc_extcon_data *ext;
>  	unsigned long mask = ~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_USBID_MASK);
> +	int pwrsrc_sts, id;
>  	int irq, ret;
>  
>  	irq = platform_get_irq(pdev, 0);
> @@ -387,8 +388,19 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
>  		goto disable_sw_control;
>  	}
>  
> -	/* Route D+ and D- to PMIC for initial charger detection */
> -	cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);
> +	ret = regmap_read(ext->regmap, CHT_WC_PWRSRC_STS, &pwrsrc_sts);
> +	if (ret) {
> +		dev_err(ext->dev, "Error reading pwrsrc status: %d\n", ret);
> +		goto disable_sw_control;
> +	}
> +
> +	id = cht_wc_extcon_get_id(ext, pwrsrc_sts);
> +
> +	/* If no USB host or device connected, route D+ and D- to PMIC for
> +	 * initial charger detection
> +	 */
> +	if (id != INTEL_USB_ID_GND)
> +		cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);
>  
>  	/* Get initial state */
>  	cht_wc_extcon_pwrsrc_event(ext);
> 

I edit this patch as following by myself and then applied it.

diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
index 9d32150e68db..771f6f4cf92e 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -338,6 +338,7 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
        struct intel_soc_pmic *pmic = dev_get_drvdata(pdev->dev.parent);
        struct cht_wc_extcon_data *ext;
        unsigned long mask = ~(CHT_WC_PWRSRC_VBUS | CHT_WC_PWRSRC_USBID_MASK);
+       int pwrsrc_sts, id;
        int irq, ret;

        irq = platform_get_irq(pdev, 0);
@@ -387,8 +388,19 @@ static int cht_wc_extcon_probe(struct platform_device *pdev)
                goto disable_sw_control;
        }

-       /* Route D+ and D- to PMIC for initial charger detection */
-       cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);
+       ret = regmap_read(ext->regmap, CHT_WC_PWRSRC_STS, &pwrsrc_sts);
+       if (ret) {
+               dev_err(ext->dev, "Error reading pwrsrc status: %d\n", ret);
+               goto disable_sw_control;
+       }
+
+       /*
+        * If no USB host or device connected, route D+ and D- to PMIC for
+        * initial charger detection
+        */
+       id = cht_wc_extcon_get_id(ext, pwrsrc_sts);
+       if (id != INTEL_USB_ID_GND)
+               cht_wc_extcon_set_phymux(ext, MUX_SEL_PMIC);



-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ