From nobody Sun Feb 8 10:30:06 2026 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (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 81FC233E37B for ; Wed, 12 Nov 2025 16:27:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762964839; cv=none; b=IG5dwDrs8cwQMoTwu86q7sgBQkKFMVFovxnKeY59zPC3lhMAPxGvuaEM2GxhC9KGaai5S3mplPuck7i/F/vtO0lH7UKsFrNaQGgPsbw+VthNOROZxlMY+6iJJFiEvKnPsGsoKuXhwYZRzbzS+lUgXlP/pBQXwB2gGs0hwJsGVcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762964839; c=relaxed/simple; bh=DjGwOCNkvyUE4A7k0D/F77jFR+qtAXMy5dKibtq/0dY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=riJFWyCzCLKaN2KWixFv98NON/gaI5DcM/h3PVeJFnloB11H6M45s/PJZdkt7cZk52IPWdxDHinqbF2fV34GejhrSM2rCcffRcVJpMj1iFZ/Lkwu7kXzkaHR3MPWxrvC6VCrGeiEKvW1VZFrGVY28jr2Z8N5u5UG4WYDvwYp7E0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=f5Z1kt9K; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="f5Z1kt9K" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-477632b0621so6998555e9.2 for ; Wed, 12 Nov 2025 08:27:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762964836; x=1763569636; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=dAKdburdmTrd3xFQbH7tEy2HoAp3nACgzFyFbbo8g0k=; b=f5Z1kt9KnT75YgK2WoCTzdf0PMr3ILdccWrrvdeBpopVBTF7IJnSK0JSCpzwZsZlrR hDequ/rF1Kg+kcY4qimtwbIytyjAFhaYBj+ecL/dlqgHWvZrbKpesLmyfaYrfULl7+5g DqGwxGadq7g02Ftf9whF5rY1tJlkOVQt7Js6762ivQJBg0crPR0laeOHl0TeJdk7jQX/ pMOFk4xbyKSxgYCL8FF4NVHRyaqEYUak0hmpkQjOluKZmW7mYegWFrbjZhwmEC1nQQYo cZCM1hPb4y28o6EcxnmCieAYS/XoMbpV+YJ8uWh77NGNUUTxZKIZG6VzT/5g35awrKeB Fmpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762964836; x=1763569636; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=dAKdburdmTrd3xFQbH7tEy2HoAp3nACgzFyFbbo8g0k=; b=kizNycO9tT85mMr/gw4gVZdhcC7uXfl6LDgLymgr+Ze1RR2sFPx0bQ5iKiP2soiGNc uR6unerKJeEIqIjOFpohlfbBgWjYhEuBQ0Hs0slbkffu24V4jr34GvbTQgF5qUXqSH09 odas7kdzvTmtG/prdvwDuQGoeYelVDlTFVoYT+p+SFssX5HGCeKm6zr9ncusQZunw6Sj vG3i7AcY7ElWUjaSKvrbIH5nAKVlpaLw+mBP2FWCYxY/f52fsypIKG3dZlmCzdQ0C00u Nl+eVFWWN83ILRbTW4cYcedOb/GsYrS+Rjsc66tCVSv2zMYf6g3tyaD4Ov/HasU4/npO IFbg== X-Forwarded-Encrypted: i=1; AJvYcCXKoKr2qZdopWl/u5OYBKzXnmb/ULMDNJQq0aXdeqx8YpSrNlXbuofpuXpxSkTC+AGzikzKEYNuiA555/A=@vger.kernel.org X-Gm-Message-State: AOJu0YxhX3Rp9tpTHahSneXTyxKJdLhAXjRTRweVViSmRstox3bR9mG9 vrsAR9evZME4eSSbCLM+1iuPte4uYU3CIcQo4GrphkZ0HnkACBHSl/RTTIpcQ/tTRwY= X-Gm-Gg: ASbGnctlzVIahIST4W1wLD9Mcx7+fLHjGXWwKvhJ/T9pldjeVLEme+xWX9H9g/hcfan MY5mXJCMUPUId9AtkPlnRoWVSWeJH8MW0gJiXZZqofvpDlfYsH9um1QC/ZB2wgiEzu4lNosgtJT NfnpeKoNXtx3qteMv8NRd9pqJDGYUd+12Y367iO1QdsPo9UlxY805IgrnFjGK+ORYwoOMp89ogY DFNnxI148F4LpYU3MhiKGzfelHWJQAH3M3Wde6hO3BRTwfDefuKvEhKftfN+epahtxUDGujc8Y8 m+uCse11tE04FS6Wi9Ai1zUgSuDMzSXnpd2R/twRZVl6JC0znNIkMT++pxYxTLaTFBTAxHCpQDp 7d/w/CtaY9Y8nvmY+HtnUEp3sqmQ3BPjNfESOQrg3gxDzNtuDSSzhYaMKutAE+1jzZNzhUBjrzN y0CTdl3cSs1Hlt37Dq/VwQVQflRHUPoWg= X-Google-Smtp-Source: AGHT+IFqo3/svwWqD0iD1WGGUDvvT++y/w5W7U0XhvmlLgCSNPX5h0N4MUoKFDwPP5zIqH55u/pB7w== X-Received: by 2002:a05:600c:1391:b0:477:5cc6:7e44 with SMTP id 5b1f17b1804b1-4778704d776mr29462015e9.11.1762964835730; Wed, 12 Nov 2025 08:27:15 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([145.224.66.100]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47787e36ca3sm48534815e9.5.2025.11.12.08.27.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 08:27:15 -0800 (PST) From: Peter Griffin Date: Wed, 12 Nov 2025 16:27:06 +0000 Subject: [PATCH v5 1/2] phy: add new phy_notify_state() api Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251112-phy-notify-pmstate-v5-1-39df622d8fcb@linaro.org> References: <20251112-phy-notify-pmstate-v5-0-39df622d8fcb@linaro.org> In-Reply-To: <20251112-phy-notify-pmstate-v5-0-39df622d8fcb@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Alim Akhtar , Krzysztof Kozlowski Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel-team@android.com, William Mcvicker , Manivannan Sadhasivam , neil.armstrong@linaro.org, Peter Griffin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=3708; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=DjGwOCNkvyUE4A7k0D/F77jFR+qtAXMy5dKibtq/0dY=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpFLVfIqxBioAhOzku1ZwQVC5Gs7ki7qKHySjkQ rgVwmlIR3GJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaRS1XwAKCRDO6LjWAjRy upF+D/9ff2Zl3hJeeYUtZ+jPkL6DLhM9xU1xU3Yp1gA/XZLtyDMog2pNBCXhej5Tdw+Q92o5GDR QMF5/gtbNkazmxrbh3LPUWnP6TjP8Om8E4upWlcRpqmPpYti7vOQlV/w3jwi0SQGEZpd8PHQcii PIRLrX3BSPZFxBn/5ahvGrnglnlH1+K5fzllWbM+ZGqI/+lLHBcckfhcwvvbavHWh/jG1Ah0660 m7tkJYaDpoKvEiIlmveZySppTu+yzR0XtFiR9PiisvGyzjFCfqgCjlubSRtOFQOe8gsDGz5tARP 0Q6AglGz+P3c+oAwKcYM50L7yvMHmNVZWg4Xmt1I/ISN8v/J4Ot/lPdjvLBdgoVNL4H8+DGxB/j QGfIlkkBfdsCW7rcFejNVKFgVwxPA+X+Sz7YazyTgiTmIzHH7J2SYGM3/U0F0yXY5LQRcoCM104 NQkdY4DlxdVhMWuVi0mbFOk0qHWBQ5gBHc/DtWXBdJj8ks2jk+CW8euND0drJK66DHKDn/NW6ny VP2QzrLnb5FXc+T48yA6VjRR0PrH3AHZ6ulxWiFJ4IU36WX/sRCz+xBvyI4oo4zzG3lzJNXxzPO O+S88sBnSEcHxXSM01yqY0X3iZ0DRs7Byz0jWYMm7o848Sr+ftCxj51CiCVvfz7PrRyVWo9uEa3 Tt60bKvKELq+hww== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA Add a new phy_notify_state() api that notifies and configures a phy for a given state transition. This is intended to be used by phy drivers which need to do some runtime configuration of parameters that can't be handled by phy_calibrate() or phy_power_{on|off}(). The first usage of this API is in the Samsung UFS phy that needs to issue some register writes when entering and exiting the hibernate link state. Signed-off-by: Peter Griffin Reviewed-by: Neil Armstrong --- Changes in v5 - Fix typo phy_notify_phystate to phy_notify_state (Russell) Changes in v4 - Add missing 'used' word (Vinod) --- drivers/phy/phy-core.c | 25 +++++++++++++++++++++++++ include/linux/phy/phy.h | 19 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 04a5a34e7a950ae94fae915673c25d476fc071c1..60be8af984bf06649ef00e695d0= ed4ced597cdb9 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -520,6 +520,31 @@ int phy_notify_disconnect(struct phy *phy, int port) } EXPORT_SYMBOL_GPL(phy_notify_disconnect); =20 +/** + * phy_notify_state() - phy state notification + * @phy: the PHY returned by phy_get() + * @state: the PHY state + * + * Notify the PHY of a state transition. Used to notify and + * configure the PHY accordingly. + * + * Returns: %0 if successful, a negative error code otherwise + */ +int phy_notify_state(struct phy *phy, union phy_notify state) +{ + int ret; + + if (!phy || !phy->ops->notify_phystate) + return 0; + + mutex_lock(&phy->mutex); + ret =3D phy->ops->notify_phystate(phy, state); + mutex_unlock(&phy->mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(phy_notify_state); + /** * phy_configure() - Changes the phy parameters * @phy: the phy returned by phy_get() diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 13add0c2c40721fe9ca3f0350d13c035cd25af45..2af0d01ebb39f27dfb34ccb5140= 771beef8288d5 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -53,6 +53,15 @@ enum phy_media { PHY_MEDIA_DAC, }; =20 +enum phy_ufs_state { + PHY_UFS_HIBERN8_ENTER, + PHY_UFS_HIBERN8_EXIT, +}; + +union phy_notify { + enum phy_ufs_state ufs_state; +}; + /** * union phy_configure_opts - Opaque generic phy configuration * @@ -83,6 +92,7 @@ union phy_configure_opts { * @set_speed: set the speed of the phy (optional) * @reset: resetting the phy * @calibrate: calibrate the phy + * @notify_phystate: notify and configure the phy for a particular state * @release: ops to be performed while the consumer relinquishes the PHY * @owner: the module owner containing the ops */ @@ -132,6 +142,7 @@ struct phy_ops { int (*connect)(struct phy *phy, int port); int (*disconnect)(struct phy *phy, int port); =20 + int (*notify_phystate)(struct phy *phy, union phy_notify state); void (*release)(struct phy *phy); struct module *owner; }; @@ -255,6 +266,7 @@ int phy_reset(struct phy *phy); int phy_calibrate(struct phy *phy); int phy_notify_connect(struct phy *phy, int port); int phy_notify_disconnect(struct phy *phy, int port); +int phy_notify_state(struct phy *phy, union phy_notify state); static inline int phy_get_bus_width(struct phy *phy) { return phy->attrs.bus_width; @@ -412,6 +424,13 @@ static inline int phy_notify_disconnect(struct phy *ph= y, int index) return -ENOSYS; } =20 +static inline int phy_notify_state(struct phy *phy, union phy_notify state) +{ + if (!phy) + return 0; + return -ENOSYS; +} + static inline int phy_configure(struct phy *phy, union phy_configure_opts *opts) { --=20 2.51.2.1041.gc1ab5b90ca-goog From nobody Sun Feb 8 10:30:06 2026 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (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 E4BE733F8BE for ; Wed, 12 Nov 2025 16:27:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762964841; cv=none; b=gefyxrpBKPLS8EFCBYY38YMALjpZMCWsZKdPEWhJqrSG+bzIBmHF9uQFGdR1/gKtgR1UtkYGiAKghqS5z7MlEBwDNzL3mySAQLa9P4QkdfneLgJSiVJywkf5/ZK1YdABX5TQBR8rdaflVGC1+p2M2wRyYY3X4+sCtnDMmTS88Vg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1762964841; c=relaxed/simple; bh=ZkTyvzs3kiErZLDD09beyCa4zgS6txIDoNMnbc53+tY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NlTV+22a8P1SPTMzEbXT8LHFYgFgDqL1F0LKb55j/CIhTAj44CDLteHjnyLLV6OUh5tU6yih9fS3SnLvaPLFhaVD+JDD/jfG93D2FTureIWZrjaKULFeG9/K8OSVqQyaUPBffnSwieRBQ3tWdgfsrDDOor0Tlx3eQZuhqz9hsVI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=WxNu9eZn; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="WxNu9eZn" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-477619f8ae5so8394775e9.3 for ; Wed, 12 Nov 2025 08:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1762964837; x=1763569637; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3zf+/GCTzFTCgE5kx1XIhvvkdps3fbhzPkXxT6Wkygo=; b=WxNu9eZnecV6hErSsqtqoqRX8HCB+SxOqCUIsmINGXl43pNYzlNK96iCWQ87rVwFGK faeI+JOzQRxZIBRXlNaAOrGKm5l6ASrzPmkdXLfmAaNWoXmAFRvnaKKxqBWp7KLPY7Z2 jZ8O84kYDyfO8aLbnxggVTddsXeAjYyGuhyqNsAJArnHqa/Xaa4yT4ilvthJqPHmdbIU hSGeEXf79HcpSc0zVqEwy2PUxzQBaOnYyYjSPoeE+7UPEkIcE1FD2W6KgyGzTZ2zUyY1 IuJ0MGYs35/tKc5QPD4q+R8sBvmE4HGn7na2FSiU2VOELSpxdMEQjI0ibN6FUYhrIWrD VVwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762964837; x=1763569637; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=3zf+/GCTzFTCgE5kx1XIhvvkdps3fbhzPkXxT6Wkygo=; b=ePUpqryPZfnqexBWhEfTgJaUiwQRj/T6g2t/MkO+hRfTjzn7pFTxy4+CDwQ54jQGqa CSgIhkX7bAIpUPGT8bvZtwVHmeVkkXqbDb5frcQFeNU2hoQG3Oovgs6KX4nvcUukCJ17 fp3vqmfyxofjW5rs4GJvjGTYeiFBZIWKeluvfYnXm3aCUyiaYyLZNqhSJjna3xnXMJoB 1KGifDSgx0zQwrqubJO1h3O7Iye0HQpCd6r8pOeZg6qwIt8wHBJTUUHtH0SoF1F1CQGY K7ZXqHY33/HSyYx6138jCyTaeKRzbUJFi6xLZw9sVX3EmKuzhgjsYlQMHYuUcEwIwclf rM3g== X-Forwarded-Encrypted: i=1; AJvYcCWaTSiI6ovJG1KuX6ctOuvxiRomM7GGc8rMlBuB6LSaNC40iMnd8lz4SnLtD4dz8cQyNRBDUZ2YIBVCjMI=@vger.kernel.org X-Gm-Message-State: AOJu0Yx+YwzDd9KMY1QOhEq7Hp8NLVchntUur6GiOKJVwBmJrvOdcpel C1ZEy8leWDpeCoO328cq15b1PMzxKquJyrv4NVPdV8UMCXBq6urb2FEC3Kftqu4iAJI= X-Gm-Gg: ASbGnctLUF2PVPNODiwX3XJns5Vqt0754u0n89b/B8TQniJAy3hJMDC7CUE+9K1um01 975Kp2qmx0Nynz/J9epljqsfMGyIbD/10EN4d346A27mNl95zhUlqcOwYc+3s6Hw10SmhyJjrVp ZgX2BYvSrfGXZ+miPofShIVw4aAEyj4haIu7bxpgjYXAZ+pwCVlf023YBCL/cqaN3BvhjVxp9Gf rUQGnvikIq8nxe5nPuB6fdbnesQhZvpW7ingj8GtofML+NxleuJoxVhNiofhY+2p8wvezl6Yjj+ +QRXaXF1WavsTHPhgdnCuXo8RYAUjSV15by4CBEuCFXqHA+wnkW74ns5tOex8uxIwmVsCK8hbXc g4IlwsNOA460LZnMA0JVlgMHM2pqAjN62vza+WSGZp4KRKlpWp/m0vrKpWK9h0btofGwJhtEGas ZBo+eG1wvBastXDCTFwDEkZdOlzbKxzSQ= X-Google-Smtp-Source: AGHT+IGbQBT6h9D+QiV3NZeclPrdWfHO3lE+CnYRzD/4ItKJuieqX8JUgxpLYyCA2DaWGs9ABKZfZA== X-Received: by 2002:a05:600c:8b22:b0:477:63dc:be00 with SMTP id 5b1f17b1804b1-47787086655mr33058775e9.25.1762964837199; Wed, 12 Nov 2025 08:27:17 -0800 (PST) Received: from gpeter-l.roam.corp.google.com ([145.224.66.100]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47787e36ca3sm48534815e9.5.2025.11.12.08.27.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Nov 2025 08:27:16 -0800 (PST) From: Peter Griffin Date: Wed, 12 Nov 2025 16:27:07 +0000 Subject: [PATCH v5 2/2] phy: samsung: gs101-ufs: Add .notify_phystate() & hibern8 enter/exit values Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251112-phy-notify-pmstate-v5-2-39df622d8fcb@linaro.org> References: <20251112-phy-notify-pmstate-v5-0-39df622d8fcb@linaro.org> In-Reply-To: <20251112-phy-notify-pmstate-v5-0-39df622d8fcb@linaro.org> To: Vinod Koul , Kishon Vijay Abraham I , =?utf-8?q?Andr=C3=A9_Draszik?= , Tudor Ambarus , Alim Akhtar , Krzysztof Kozlowski Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, kernel-team@android.com, William Mcvicker , Manivannan Sadhasivam , neil.armstrong@linaro.org, Peter Griffin X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=5855; i=peter.griffin@linaro.org; h=from:subject:message-id; bh=ZkTyvzs3kiErZLDD09beyCa4zgS6txIDoNMnbc53+tY=; b=owEBbQKS/ZANAwAKAc7ouNYCNHK6AcsmYgBpFLVfwlZ5jst5dZK7+RF0jA51MBaOdzMVv/kjL xcH1R87WhSJAjMEAAEKAB0WIQQO/I5vVXh1DVa1SfzO6LjWAjRyugUCaRS1XwAKCRDO6LjWAjRy utY0D/4sWragFjlosVxmET+0kZGsxeZNRi/7KobzDWh8KPTwpWOjtFZ0jEYq7e/lCmyWaKbqRK3 AopubMfgLd5aVJpavGeSQNki7Mclzw34Y013JC+5EK9+0fcQIZ+5XBY452ipzmXUqbILM51Psqw LxZwfTy5+KfWVNQtH1OjVmtBXZT4D4js5fAhw9svh7AHQefpQpOxxQd9Diq9ZVsNlivopmBxOwg tyq/Rk75SvyYCJVcwGNJIf8vkWRlzO0gL2UWAvElzvx1PckfqzsjscDntF1jvZC7zb//Cc7i/73 MD7lm0YIpj9NTYMsrp/S57zXDEGsSkwuUfrinROfsDEt1GKVy0x5grhYLJlrikObGlgUPzVad3a s9VoVJAn1MMZzOlbY/TaHbzipsdBmzRS4Be1mnoVlmhVviBvZOdHQEwx1/E7R+tKQdB50jvnsEp QjDukapygIb9xPt9rSGE2eoRMbQWvG2wOm8LZHaQnsXS+oiXlf4AbuXMUE+TbwSReceSsD9Dufd szvDKlxO+kwk0oIvXhv0KrI/ffWkhL5xM+ehg98Xrl7rc49VCxo/6PqvRmkpdOc+J1zAMWdCm7a XrtXSrJbq4lJvzxooZA1CqBIMVtvY2GXgmTD40tnZj2RGiqg8Tk3hLMgvb/9kbC4g/3x0oDWXHl ysVzOtkmaxPD3Ag== X-Developer-Key: i=peter.griffin@linaro.org; a=openpgp; fpr=0EFC8E6F5578750D56B549FCCEE8B8D6023472BA Implement the .notify_phystate() callback and provide the gs101 specific phy values that need to be programmed when entering and exiting the hibern8 state. Signed-off-by: Peter Griffin Reviewed-by: Neil Armstrong --- Changes in v4 - Resolve Intel 0-day warning --- drivers/phy/samsung/phy-gs101-ufs.c | 28 ++++++++++++++++++++++++ drivers/phy/samsung/phy-samsung-ufs.c | 40 +++++++++++++++++++++++++++++++= ++++ drivers/phy/samsung/phy-samsung-ufs.h | 7 ++++++ 3 files changed, 75 insertions(+) diff --git a/drivers/phy/samsung/phy-gs101-ufs.c b/drivers/phy/samsung/phy-= gs101-ufs.c index 17b798da5b5761f8e367599517d2d97bf0bb6b74..a15e1f453f7f3cecd6d3aa75217= 633ac4b6085d0 100644 --- a/drivers/phy/samsung/phy-gs101-ufs.c +++ b/drivers/phy/samsung/phy-gs101-ufs.c @@ -108,12 +108,39 @@ static const struct samsung_ufs_phy_cfg tensor_gs101_= post_pwr_hs_config[] =3D { END_UFS_PHY_CFG, }; =20 +static const struct samsung_ufs_phy_cfg tensor_gs101_post_h8_enter[] =3D { + PHY_TRSV_REG_CFG_GS101(0x262, 0x08, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_GS101(0x265, 0x0A, PWR_MODE_ANY), + PHY_COMN_REG_CFG(0x1, 0x8, PWR_MODE_ANY), + PHY_COMN_REG_CFG(0x0, 0x86, PWR_MODE_ANY), + PHY_COMN_REG_CFG(0x8, 0x60, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_GS101(0x222, 0x08, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_GS101(0x246, 0x01, PWR_MODE_HS_ANY), + END_UFS_PHY_CFG, +}; + +static const struct samsung_ufs_phy_cfg tensor_gs101_pre_h8_exit[] =3D { + PHY_COMN_REG_CFG(0x0, 0xC6, PWR_MODE_ANY), + PHY_COMN_REG_CFG(0x1, 0x0C, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_GS101(0x262, 0x00, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_GS101(0x265, 0x00, PWR_MODE_ANY), + PHY_COMN_REG_CFG(0x8, 0xE0, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_GS101(0x246, 0x03, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_GS101(0x222, 0x18, PWR_MODE_HS_ANY), + END_UFS_PHY_CFG, +}; + static const struct samsung_ufs_phy_cfg *tensor_gs101_ufs_phy_cfgs[CFG_TAG= _MAX] =3D { [CFG_PRE_INIT] =3D tensor_gs101_pre_init_cfg, [CFG_PRE_PWR_HS] =3D tensor_gs101_pre_pwr_hs_config, [CFG_POST_PWR_HS] =3D tensor_gs101_post_pwr_hs_config, }; =20 +static const struct samsung_ufs_phy_cfg *tensor_gs101_hibern8_cfgs[] =3D { + [CFG_POST_HIBERN8_ENTER] =3D tensor_gs101_post_h8_enter, + [CFG_PRE_HIBERN8_EXIT] =3D tensor_gs101_pre_h8_exit, +}; + static const char * const tensor_gs101_ufs_phy_clks[] =3D { "ref_clk", }; @@ -170,6 +197,7 @@ static int gs101_phy_wait_for_cdr_lock(struct phy *phy,= u8 lane) =20 const struct samsung_ufs_phy_drvdata tensor_gs101_ufs_phy =3D { .cfgs =3D tensor_gs101_ufs_phy_cfgs, + .cfgs_hibern8 =3D tensor_gs101_hibern8_cfgs, .isol =3D { .offset =3D TENSOR_GS101_PHY_CTRL, .mask =3D TENSOR_GS101_PHY_CTRL_MASK, diff --git a/drivers/phy/samsung/phy-samsung-ufs.c b/drivers/phy/samsung/ph= y-samsung-ufs.c index f3cbe6b17b235bb181b3fae628d75822f0c9183a..ee665f26c2361ff9c3933b10ac7= 13bbd9085b459 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.c +++ b/drivers/phy/samsung/phy-samsung-ufs.c @@ -217,6 +217,44 @@ static int samsung_ufs_phy_set_mode(struct phy *generi= c_phy, return 0; } =20 +static int samsung_ufs_phy_notify_state(struct phy *phy, + union phy_notify state) +{ + struct samsung_ufs_phy *ufs_phy =3D get_samsung_ufs_phy(phy); + const struct samsung_ufs_phy_cfg *cfg; + int i, err =3D -EINVAL; + + if (!ufs_phy->cfgs_hibern8) + return 0; + + if (state.ufs_state =3D=3D PHY_UFS_HIBERN8_ENTER) + cfg =3D ufs_phy->cfgs_hibern8[CFG_POST_HIBERN8_ENTER]; + else if (state.ufs_state =3D=3D PHY_UFS_HIBERN8_EXIT) + cfg =3D ufs_phy->cfgs_hibern8[CFG_PRE_HIBERN8_EXIT]; + else + goto err_out; + + for_each_phy_cfg(cfg) { + for_each_phy_lane(ufs_phy, i) { + samsung_ufs_phy_config(ufs_phy, cfg, i); + } + } + + if (state.ufs_state =3D=3D PHY_UFS_HIBERN8_EXIT) { + for_each_phy_lane(ufs_phy, i) { + if (ufs_phy->drvdata->wait_for_cdr) { + err =3D ufs_phy->drvdata->wait_for_cdr(phy, i); + if (err) + goto err_out; + } + } + } + + return 0; +err_out: + return err; +} + static int samsung_ufs_phy_exit(struct phy *phy) { struct samsung_ufs_phy *ss_phy =3D get_samsung_ufs_phy(phy); @@ -233,6 +271,7 @@ static const struct phy_ops samsung_ufs_phy_ops =3D { .power_off =3D samsung_ufs_phy_power_off, .calibrate =3D samsung_ufs_phy_calibrate, .set_mode =3D samsung_ufs_phy_set_mode, + .notify_phystate =3D samsung_ufs_phy_notify_state, .owner =3D THIS_MODULE, }; =20 @@ -287,6 +326,7 @@ static int samsung_ufs_phy_probe(struct platform_device= *pdev) phy->dev =3D dev; phy->drvdata =3D drvdata; phy->cfgs =3D drvdata->cfgs; + phy->cfgs_hibern8 =3D drvdata->cfgs_hibern8; memcpy(&phy->isol, &drvdata->isol, sizeof(phy->isol)); =20 if (!of_property_read_u32_index(dev->of_node, "samsung,pmu-syscon", 1, diff --git a/drivers/phy/samsung/phy-samsung-ufs.h b/drivers/phy/samsung/ph= y-samsung-ufs.h index a28f148081d168344b47f2798b00cb098f0a8574..f2c2e744e5bae87c9cfcaa17f4a= 09456f134966a 100644 --- a/drivers/phy/samsung/phy-samsung-ufs.h +++ b/drivers/phy/samsung/phy-samsung-ufs.h @@ -92,6 +92,11 @@ enum { CFG_TAG_MAX, }; =20 +enum { + CFG_POST_HIBERN8_ENTER, + CFG_PRE_HIBERN8_EXIT, +}; + struct samsung_ufs_phy_cfg { u32 off_0; u32 off_1; @@ -108,6 +113,7 @@ struct samsung_ufs_phy_pmu_isol { =20 struct samsung_ufs_phy_drvdata { const struct samsung_ufs_phy_cfg **cfgs; + const struct samsung_ufs_phy_cfg **cfgs_hibern8; struct samsung_ufs_phy_pmu_isol isol; const char * const *clk_list; int num_clks; @@ -124,6 +130,7 @@ struct samsung_ufs_phy { struct clk_bulk_data *clks; const struct samsung_ufs_phy_drvdata *drvdata; const struct samsung_ufs_phy_cfg * const *cfgs; + const struct samsung_ufs_phy_cfg * const *cfgs_hibern8; struct samsung_ufs_phy_pmu_isol isol; u8 lane_cnt; int ufs_phy_state; --=20 2.51.2.1041.gc1ab5b90ca-goog