From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from layka.disroot.org (layka.disroot.org [178.21.23.139]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1D06382378; Mon, 20 Apr 2026 19:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=178.21.23.139 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776712822; cv=none; b=oJGYzCz7/9wVAEr3o70dGyHVB5p0iDreDXR3xsBuM7p3pyEpTvtKDmF22F/+CngfpJNZaxTyfmaiKmrKFALlUd6NmqLKwMTdI/9OLxlgmlNOMjeNE7DHrOlv43szFv75By7LUeJdvJ0WqxS3pI/RQjzXy7OgJ5BHWPKbVKerNCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776712822; c=relaxed/simple; bh=I4bAzl1GDu2wOCTjoJs7Sz/xGm5YwQN59J/ybBhb/EQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Y0T0pOjVVA1WEZ/+E+HtqjIbzVJ+kcZ59dOttkq5ICedRLceoSLrruKp9sgwvJNrTTC3cxjYYTmcrQuFfxzfStnwPfiZpRCzV4LMkELbFaAT0YK7xH7F0oQz5j7DvDGzYAmss9Np4gXKjQ0tnE5TwkN6c4INV4D6vFuAOOvs31w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org; spf=pass smtp.mailfrom=disroot.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b=VQxKa7Wr; arc=none smtp.client-ip=178.21.23.139 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=disroot.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=disroot.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=disroot.org header.i=@disroot.org header.b="VQxKa7Wr" Received: from mail01.disroot.lan (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 162AE27011; Mon, 20 Apr 2026 21:20:18 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Received: from layka.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id VetugQQBQRKD; Mon, 20 Apr 2026 21:20:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1776712817; bh=I4bAzl1GDu2wOCTjoJs7Sz/xGm5YwQN59J/ybBhb/EQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=VQxKa7WrEBkGgFrKO/Y78/ce4S7uJivyZVkvZSGNCt5aSScP2rouohgZ+bwRvvr9N 2kvNEUe8OHKyS9Co2k9U4HOD5X9g+CjRKWmMIIuQ+yaGP5A3UiopKkmn1VdreuzBHT Ntb9eJaDLZgKaCcYZAvFvgq7QhMSpYBevuP3SXhBLhq4Kty5Hm7rIA79iZykJZx47t 83vaoClW+Sm3T5Z++ehaZxv55Mjg+PjxKIqhR2rz2UPQ+yTUmgKhdP0Iv/0vTzZXjY TrO7nMihHWmRwqKiqsJ2GXHGTn4JM18lfLSR1yctJ4V3HEo+5VlsihLfKi92uCoAFv 7Z194FC/CLHhw== From: Rustam Adilov To: Vinod Koul , Neil Armstrong , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stanley Chang , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Rustam Adilov , Michael Zavertkin Subject: [PATCH v5 4/6] phy: realtek: usb2: introduce reset controller struct Date: Tue, 21 Apr 2026 00:19:39 +0500 Message-ID: <20260420191941.81834-5-adilov@disroot.org> In-Reply-To: <20260420191941.81834-1-adilov@disroot.org> References: <20260420191941.81834-1-adilov@disroot.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In RTL9607C, there is so called "IP Enable Controller" which resemble reset controller with reset lines and is used for various things like USB, PCIE, GMAC and such. Introduce the reset_control struct to this driver to handle deasserting usb2 phy reset line. Make use of the function devm_reset_control_array_get_optional_exclusive() function to get the reset controller and since existing RTD SoCs don't specify the resets we can have a cleaner code. Since the vendor usb driver developed by Realtek doesn't assert the reset line (or in their case clear the register bit), we can reasonably assume reset_control_assert is not needed here. Co-developed-by: Michael Zavertkin Signed-off-by: Michael Zavertkin Signed-off-by: Rustam Adilov --- drivers/phy/realtek/phy-rtk-usb2.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/phy/realtek/phy-rtk-usb2.c b/drivers/phy/realtek/phy-rtk-usb2.c index 19297a42a841..aaa07a69224a 100644 --- a/drivers/phy/realtek/phy-rtk-usb2.c +++ b/drivers/phy/realtek/phy-rtk-usb2.c @@ -17,6 +17,7 @@ #include #include #include +#include #include /* GUSB2PHYACCn register */ @@ -130,6 +131,7 @@ struct rtk_phy { struct phy_cfg *phy_cfg; int num_phy; struct phy_parameter *phy_parameter; + struct reset_control *phy_rst; struct dentry *debug_dir; }; @@ -676,6 +678,15 @@ static int rtk_phy_init(struct phy *phy) if (!rtk_phy) return -EINVAL; + if (rtk_phy->phy_rst) { + ret = reset_control_deassert(rtk_phy->phy_rst); + + if (ret) + return ret; + + usleep_range(5000, 6000); + } + for (i = 0; i < rtk_phy->num_phy; i++) ret = do_rtk_phy_init(rtk_phy, i); @@ -1059,6 +1070,11 @@ static int rtk_usb2phy_probe(struct platform_device *pdev) rtk_phy->num_phy = phy_cfg->num_phy; + rtk_phy->phy_rst = devm_reset_control_array_get_optional_exclusive(dev); + if (IS_ERR(rtk_phy->phy_rst)) + return dev_err_probe(dev, PTR_ERR(rtk_phy->phy_rst), + "usb2 phy resets are not working\n"); + ret = parse_phy_data(rtk_phy); if (ret) goto err; -- 2.53.0