Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1268885pxu; Mon, 23 Nov 2020 16:34:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxsPhFvC8J4MOsnARnt6iNDLf0IItS99laFEhF71DHaKSqMbNCcsXKnBmv5nAPWvD3Tt991 X-Received: by 2002:a17:906:f89a:: with SMTP id lg26mr2011388ejb.294.1606178040639; Mon, 23 Nov 2020 16:34:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606178040; cv=none; d=google.com; s=arc-20160816; b=R/DzrLlmAmtnixvogq4P2V/O5eFpnjgPwNk7cKvJW1HpT0qAxpFfpboPJSkJeOlIZd iTGuDzzFa+zU5glC5kocwI9ULOtJgXBN18vkDZuupi1q8nCHitLiK3jFGwpTdHTI0nwC QzJx0+3B0BscA2XWw7lMgD/v5zxah4M9d0t6gzzScmkA7gUJtE0ngkZT3+h1UTW0E6Z6 YsS/5ut+OoGxr9ebeCkUssttH9mwM+4vjfdDRyXXG6wUBzWnr8fV0z3s8X1nwytCTPir ygnxZgQSQ+pPwchLlNwJCs215uQI5YwN+vCbxjmeZWsd+Q7VA84e7no3HiRIRVCn2jku aS8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GNGhCGFijTlDWmEsKvydCMqBIWrPg4lKIna6GEFbM2E=; b=rG/GR2M5O9B5iJD8NiLu0FqHjAmRtr3X0VXeddM53wsr8QTVnUG+hOMVb1pQNVB/SK aamYBgyYCp98SvSwG1LD1huWvqva3stcBfqb8+rtjHb59eT4NJN+pLgt3m1oOfvPUfWa N9DRVlk2Ko3sWYr7Gz7bWfljsh0nRrnxRL/OJ8lqgxO4CUqC03LA27N76dVXpIVSRaOs MMYgDjzku8+fEVJFpwVtQWBActeXyavRqeHxeiM9dNg6B7qJkOEK4ZF5EPRYZKeGyLk7 kPYx8ZQHcX4eoDZ5sQfVLRli6ajIDsgH/ghRkt74NgcwOZXMDeO064VA15o1aT+s5si8 Lecg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=HCjPJZwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w5si8157780edi.111.2020.11.23.16.33.37; Mon, 23 Nov 2020 16:34:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@st.com header.s=STMicroelectronics header.b=HCjPJZwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=st.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390139AbgKWRCD (ORCPT + 99 others); Mon, 23 Nov 2020 12:02:03 -0500 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:50300 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387620AbgKWRBw (ORCPT ); Mon, 23 Nov 2020 12:01:52 -0500 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 0ANGwP0X011882; Mon, 23 Nov 2020 18:01:43 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=GNGhCGFijTlDWmEsKvydCMqBIWrPg4lKIna6GEFbM2E=; b=HCjPJZwygltD+bbckZUgarq1qGrXaNsAe7cEydP/4hFmRqlCy6JxeqUEOZq6pundSNAa JiVyESZzIkOjyah8+EIDsrsYWlph+br1CGTepBDOsVLl/CmIBFaAaOG8qdFBmsw+eI+W O4yDmOrmBSCIiPCmpL+yyZMujz8FVtPWYrpI7iIWUT+BCXgX/N4SwzQpepF5UgkZYBIJ nGUkjqp+UFLbh+H1krRqNz7PmZ0s3bjLjG6SGobenjVrnui2aHeCOd0Q8FpeaaNUzeEx yYd0FVO0g6OkkjoxnUGDObL1phey0+0aryC2IRGf8/wGZ21PvaMvaVzWTudqKw174h3/ fw== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 34y0fgkmm9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Nov 2020 18:01:43 +0100 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 7CC6B10002A; Mon, 23 Nov 2020 18:01:42 +0100 (CET) Received: from Webmail-eu.st.com (sfhdag3node2.st.com [10.75.127.8]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 708C12BA2D0; Mon, 23 Nov 2020 18:01:42 +0100 (CET) Received: from localhost (10.75.127.46) by SFHDAG3NODE2.st.com (10.75.127.8) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 23 Nov 2020 18:01:42 +0100 From: Amelie Delaunay To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Alexandre Torgue , Maxime Coquelin CC: , , , , Amelie Delaunay Subject: [PATCH 5/6] phy: stm32: ensure phy are no more active when removing the driver Date: Mon, 23 Nov 2020 18:01:31 +0100 Message-ID: <20201123170132.17859-6-amelie.delaunay@st.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201123170132.17859-1-amelie.delaunay@st.com> References: <20201123170132.17859-1-amelie.delaunay@st.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.75.127.46] X-ClientProxiedBy: SFHDAG1NODE1.st.com (10.75.127.1) To SFHDAG3NODE2.st.com (10.75.127.8) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.312,18.0.737 definitions=2020-11-23_14:2020-11-23,2020-11-23 signatures=0 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org To ensure a good balancing of regulators, and allow PLL disabling when the driver is removed, call stm32_usbphyc_phy_exit on each ports to set phys inactive and disable PLL. Signed-off-by: Amelie Delaunay --- drivers/phy/st/phy-stm32-usbphyc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index 33367a325612..8b11d95b2c20 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -470,6 +470,12 @@ static int stm32_usbphyc_probe(struct platform_device *pdev) static int stm32_usbphyc_remove(struct platform_device *pdev) { struct stm32_usbphyc *usbphyc = dev_get_drvdata(&pdev->dev); + int port; + + /* Ensure PHYs are not active, to allow PLL disabling */ + for (port = 0; port < usbphyc->nphys; port++) + if (usbphyc->phys[port]->active) + stm32_usbphyc_phy_exit(usbphyc->phys[port]->phy); clk_disable_unprepare(usbphyc->clk); -- 2.17.1