From nobody Mon Feb 9 07:22:02 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 8750F31AF24 for ; Thu, 22 Jan 2026 15:11:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769094716; cv=none; b=RDWak5Q7pBvR2ymFMJ2Fa4r4yP7R7oLfy56849xZEiUOtrX5YWXOZGO9xy2I57DVp9NUBeRlFqHkNf6PibsCQnEgW0r7xIWNGbFaUHCRekjmPxNOgl01arR8daZqwUv/5gx2QN3kmptY7dilu6nDSsW1Ov3dH82neq/ftLP/Jlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769094716; c=relaxed/simple; bh=Dalp9JKi9nYaLgLeQTdmZa2HRLGvhzfShJ2gOCw/juM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ppmOvhlUf/OLT9jv87TJn6uXDMX84JZ11p7DQYTvnULI3wnyv1VYcyaWh1kAg+tFELX1fVP/A1F1WrFKAMQHPyMrHYG9tGTvORkoLBWl6Kwkp1quUn6c21KANnHgzHdtgaLJ46EDu23YtBsjYpoag/0XlvHXUvrXBV8RCro4eY4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=BUEluEla; arc=none smtp.client-ip=209.85.128.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BUEluEla" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-47ee301a06aso12716605e9.0 for ; Thu, 22 Jan 2026 07:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769094712; x=1769699512; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ajF+9IIPti7bTMujtf2+9NWft5TDbxjTIxiEYSTjvHI=; b=BUEluEla2hQMsL49vKAI7RHU/Vgr6/lLubR9ZVi8XsYjtkGCKfZvYjM2HmNiZpT39x xuLtnikRaYw4GfihodqB1mqIJVQBTyEgg8nRfLVBdv4QZOPGuBv145+ZhA1gTWiHYGz9 /0IOYPmW5GzMpA3sNDujhMATE81zAk429aF+hQd/YqjUgAP1ERkQDyMqePkbp3E6mykY huAaCxqC3mQy5POQWoP7CTC3tT8UWgGZ48XNogOXkApK2y8okgx8twpPvRvIWKDK7ycz UsQ3BT9Q/WnT6xUjSHLZfu9hSZUaePXEAM+3oxuUFafDrK9mUQx5deNv7l2aCcBdSEmq TRuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769094712; x=1769699512; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ajF+9IIPti7bTMujtf2+9NWft5TDbxjTIxiEYSTjvHI=; b=HRnePU6yRHf3vOvaSJqQj8+KAumaL2uBWat2lUPk0t0YVg/m4Z6Kjg3H54/CEjosNj DenOCtIG+ETWIpxJiPtHobfL/VqVt6S3WOMKjCwn0+jt0tiqie2/uuRdyZEzp6SeeUUF 4vQU7Kx+cBaoC1+boUlyQM65D04wce1baiAbQez+PwPakFbSYGVVuaw/BmM6DSxZIeyl I+XDTh3JRsoKnj/rhKIX0GlZ362EYvGEsTq0skeEg7S1eubjHxnzhtjSsj/18oxdg4A6 5ZbCHP9Z6eNnOpRiu62+VUM4u6GBQ10bytqKSzrefbLsvI2Q6OdJK2n/KGOZ2MgYhEOb 4Bqw== X-Forwarded-Encrypted: i=1; AJvYcCVPW9Kg52wDo5pYjV4TBPsMKDCxUoe94gcNQeuqZasyCmccAP/8udwwCh4lBhZYlCc6zcjBtBK7v0KpQ2M=@vger.kernel.org X-Gm-Message-State: AOJu0Yx8XBdry7TcnHIhh1YUwQLvGYlyYdiL91y7xxVvfocuWSL9n2wg GiRmegHR3Bf2R80xaB3D7OmikIohwQAnwneAWwUl8uY3crMwW+G42lWJ X-Gm-Gg: AZuq6aKQoSq7eCkT6VArZc6kVVkjVs94S0ZuWs3vQ237LSN4eMg34MvTaacvxSkg+n0 0nnRQ+bLi3WbTVWrttyeli4aCS8OzJpX5PwFWXx6TnYvx82slrePYUIUJQHUbWWD+MKk7IGWOiU fr18vb4fR/DL1+x3m+3rh1C7ElDqTH4kPjshbTbMZvQAYRBV35lHeWoiaNPwmT4TKqbB1MCMjY6 zHJsaiNyYiYoFy3tViT/+oeJ+p3afngRLkA9yICcIuGKmqE+LiaZUSOMQzhjymTmrBgXTSVO4xR LS+TqwubZkmnBhUSWovyHOtkjfh4nv1b4uHq19k/6U4nqfi8obtFKTH4qASysYEdBatGfZKntb8 Oy0S4xJaK9hmUAQYQTGf++7JCJqew0bDRm8aAZQccBOCM8u+3O2D/IDCuBTAj+7LG0j7ILYGgja B5 X-Received: by 2002:a05:600d:6450:10b0:477:58af:a91d with SMTP id 5b1f17b1804b1-480215e1ad9mr236546925e9.5.1769094711457; Thu, 22 Jan 2026 07:11:51 -0800 (PST) Received: from xeon ([188.163.112.49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804704b4e6sm74861705e9.7.2026.01.22.07.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Jan 2026 07:11:51 -0800 (PST) From: Svyatoslav Ryhel To: Greg Kroah-Hartman , Thierry Reding , Thierry Reding , Jonathan Hunter , Svyatoslav Ryhel , Dmitry Osipenko Cc: linux-usb@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/2] usb: phy: tegra: use phy type directly Date: Thu, 22 Jan 2026 17:11:24 +0200 Message-ID: <20260122151125.7367-2-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260122151125.7367-1-clamor95@gmail.com> References: <20260122151125.7367-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Refactor to directly use enum usb_phy_interface to determine the PHY mode. This change is in preparation for adding support for HSIC mode. Signed-off-by: Svyatoslav Ryhel Reviewed-by: Mikko Perttunen --- drivers/usb/phy/phy-tegra-usb.c | 51 +++++++++++++++++++------------ include/linux/usb/tegra_usb_phy.h | 2 +- 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/drivers/usb/phy/phy-tegra-usb.c b/drivers/usb/phy/phy-tegra-us= b.c index 1f527fcb42f6..afa5b5535f92 100644 --- a/drivers/usb/phy/phy-tegra-usb.c +++ b/drivers/usb/phy/phy-tegra-usb.c @@ -814,15 +814,24 @@ static int ulpi_phy_power_off(struct tegra_usb_phy *p= hy) =20 static int tegra_usb_phy_power_on(struct tegra_usb_phy *phy) { - int err; + int err =3D 0; =20 if (phy->powered_on) return 0; =20 - if (phy->is_ulpi_phy) - err =3D ulpi_phy_power_on(phy); - else + switch (phy->phy_type) { + case USBPHY_INTERFACE_MODE_UTMI: err =3D utmi_phy_power_on(phy); + break; + + case USBPHY_INTERFACE_MODE_ULPI: + err =3D ulpi_phy_power_on(phy); + break; + + default: + break; + } + if (err) return err; =20 @@ -836,15 +845,24 @@ static int tegra_usb_phy_power_on(struct tegra_usb_ph= y *phy) =20 static int tegra_usb_phy_power_off(struct tegra_usb_phy *phy) { - int err; + int err =3D 0; =20 if (!phy->powered_on) return 0; =20 - if (phy->is_ulpi_phy) - err =3D ulpi_phy_power_off(phy); - else + switch (phy->phy_type) { + case USBPHY_INTERFACE_MODE_UTMI: err =3D utmi_phy_power_off(phy); + break; + + case USBPHY_INTERFACE_MODE_ULPI: + err =3D ulpi_phy_power_off(phy); + break; + + default: + break; + } + if (err) return err; =20 @@ -863,7 +881,7 @@ static void tegra_usb_phy_shutdown(struct usb_phy *u_ph= y) usb_phy_set_wakeup(u_phy, false); tegra_usb_phy_power_off(phy); =20 - if (!phy->is_ulpi_phy) + if (phy->phy_type =3D=3D USBPHY_INTERFACE_MODE_UTMI) utmip_pad_close(phy); =20 regulator_disable(phy->vbus); @@ -1049,7 +1067,7 @@ static int tegra_usb_phy_init(struct usb_phy *u_phy) goto disable_clk; } =20 - if (!phy->is_ulpi_phy) { + if (phy->phy_type =3D=3D USBPHY_INTERFACE_MODE_UTMI) { err =3D utmip_pad_open(phy); if (err) goto disable_vbus; @@ -1066,7 +1084,7 @@ static int tegra_usb_phy_init(struct usb_phy *u_phy) return 0; =20 close_phy: - if (!phy->is_ulpi_phy) + if (phy->phy_type =3D=3D USBPHY_INTERFACE_MODE_UTMI) utmip_pad_close(phy); =20 disable_vbus: @@ -1104,8 +1122,6 @@ static int utmi_phy_probe(struct tegra_usb_phy *tegra= _phy, struct resource *res; int err; =20 - tegra_phy->is_ulpi_phy =3D false; - res =3D platform_get_resource(pdev, IORESOURCE_MEM, 1); if (!res) { dev_err(&pdev->dev, "Failed to get UTMI pad regs\n"); @@ -1280,7 +1296,6 @@ static int tegra_usb_phy_probe(struct platform_device= *pdev) { struct device_node *np =3D pdev->dev.of_node; struct tegra_usb_phy *tegra_phy; - enum usb_phy_interface phy_type; struct reset_control *reset; struct gpio_desc *gpiod; struct resource *res; @@ -1342,8 +1357,8 @@ static int tegra_usb_phy_probe(struct platform_device= *pdev) return err; } =20 - phy_type =3D of_usb_get_phy_mode(np); - switch (phy_type) { + tegra_phy->phy_type =3D of_usb_get_phy_mode(np); + switch (tegra_phy->phy_type) { case USBPHY_INTERFACE_MODE_UTMI: err =3D utmi_phy_probe(tegra_phy, pdev); if (err) @@ -1369,8 +1384,6 @@ static int tegra_usb_phy_probe(struct platform_device= *pdev) break; =20 case USBPHY_INTERFACE_MODE_ULPI: - tegra_phy->is_ulpi_phy =3D true; - tegra_phy->clk =3D devm_clk_get(&pdev->dev, "ulpi-link"); err =3D PTR_ERR_OR_ZERO(tegra_phy->clk); if (err) { @@ -1410,7 +1423,7 @@ static int tegra_usb_phy_probe(struct platform_device= *pdev) =20 default: dev_err(&pdev->dev, "phy_type %u is invalid or unsupported\n", - phy_type); + tegra_phy->phy_type); return -EINVAL; } =20 diff --git a/include/linux/usb/tegra_usb_phy.h b/include/linux/usb/tegra_us= b_phy.h index c314fad5e375..e394f4880b7e 100644 --- a/include/linux/usb/tegra_usb_phy.h +++ b/include/linux/usb/tegra_usb_phy.h @@ -73,7 +73,7 @@ struct tegra_usb_phy { struct usb_phy *ulpi; struct usb_phy u_phy; bool is_legacy_phy; - bool is_ulpi_phy; + enum usb_phy_interface phy_type; struct gpio_desc *reset_gpio; struct reset_control *pad_rst; bool wakeup_enabled; --=20 2.51.0