phy: qcom-qmp-ufs: add symbol clocks support
v8 cover phy: qcom-qmp-ufs: add symbol clocks support
Register UFS symbol clocks in the Qualcomm QMP PHY driver. Some of the platforms (msm8996, sc7280, sm8350/sm8450) expect them to be defined (to be used as GCC clock parents).
Changes since v7:
- Rebased on top of phy/next
- Renamed the clock registration function (Johan)
- Dropped rogue qcom_qmp_ufs_ops (Johan)
- Fixed the comment following Johan's suggestion.
Changes since v6:
- Added bindings change (Johan, thanks for the reminder)
- Added corresponding dts changes for msm8996 and sm8350/sm8450.
Changes since v5:
- Rebased on top of phy/next
Changes since v4:
- Rebased, dropping merged clk patches
- Fixed whitespace errors
- Added linebreaks to fit into 100 chars limit
Changes since v3:
- Rewrote asm9260 clk driver to fix the TODO item by using parent index rather than calling of_clk_get_parent_name().
Changes since v2:
- Added error handling to phy_symbols_clk_register() (requested by Johan).
Changes since v1:
- Added a macro used by clk-asm9260, so that the clk-fixed-rate changes do not affect the driver
- Changed registered clock names to be unique (as e.g. SC8280XP will have two UFS PHYs).
Dmitry Baryshkov (2):
dt-bindings: phy: qcom,*-qmp-ufs-phy: add clock-cells property
phy: qcom-qmp-ufs: provide symbol clocks
Yoshihiro Shimoda (2):
dt-bindings: phy: renesas: Document Renesas Ethernet SERDES
phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8
.../phy/qcom,msm8996-qmp-ufs-phy.yaml | 3 + .../phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 3 + .../phy/renesas,r8a779f0-ether-serdes.yaml | 54 +++ drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 64 +++ drivers/phy/renesas/Kconfig | 8 + drivers/phy/renesas/Makefile | 1 + drivers/phy/renesas/r8a779f0-ether-serdes.c | 417 ++++++++++++++++++ 7 files changed, 550 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/renesas,r8a779f0-ether-serdes.yaml create mode 100644 drivers/phy/renesas/r8a779f0-ether-serdes.c
Signature · 7 lines
2.35.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v8 1/4 dt-bindings: phy: renesas: Document Renesas Ethernet SERDES
From: Yoshihiro Shimoda <[email protected]>
Document Renesas Etherent SERDES for R-Car S4-8 (r8a779f0).
--- .../phy/renesas,r8a779f0-ether-serdes.yaml | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/renesas,r8a779f0-ether-serdes.yaml
Documentation/devicetree/bindings/phy/renesas,r8a779f0-ether-serdes.yaml new file +54 -0
@@ -0,0 +1,54 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/renesas,r8a779f0-ether-serdes.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas Ethernet SERDES + +maintainers: + - Yoshihiro Shimoda <[email protected]> + +properties: + compatible: + const: renesas,r8a779f0-ether-serdes + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + resets: + maxItems: 1 + + power-domains: + maxItems: 1 + + '#phy-cells': + description: Port number of SERDES. + const: 1 + +required: + - compatible + - reg + - clocks + - resets + - power-domains + - '#phy-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/r8a779f0-cpg-mssr.h> + #include <dt-bindings/power/r8a779f0-sysc.h> + + phy@e6444000 { + compatible = "renesas,r8a779f0-ether-serdes"; + reg = <0xe6444000 0xc00>; + clocks = <&cpg CPG_MOD 1506>; + power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>; + resets = <&cpg 1506>; + #phy-cells = <1>; + };
Signature · 7 lines
2.35.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v8 2/4 phy: renesas: Add Renesas Ethernet SERDES driver for R-Car S4-8
In reply to Dmitry BaryshkovFrom: Yoshihiro Shimoda <[email protected]>
Add Renesas Ethernet SERDES driver for R-Car S4-8 (r8a779f0). The datasheet describes initialization procedure without any information about registers' name/bits. So, this is all black magic to initialize the hardware. Especially, all channels should be initialized at once.
--- drivers/phy/renesas/Kconfig | 8 + drivers/phy/renesas/Makefile | 1 + drivers/phy/renesas/r8a779f0-ether-serdes.c | 417 ++++++++++++++++++++ 3 files changed, 426 insertions(+) create mode 100644 drivers/phy/renesas/r8a779f0-ether-serdes.c
drivers/phy/renesas/Kconfig +8 -0
@@ -2,6 +2,14 @@ # # Phy drivers for Renesas platforms # +# NOTE: Please sorted config names alphabetically. +config PHY_R8A779F0_ETHERNET_SERDES + tristate "Renesas R-Car S4-8 Ethernet SERDES driver" + depends on ARCH_RENESAS || COMPILE_TEST + select GENERIC_PHY + help + Support for Ethernet SERDES found on Renesas R-Car S4-8 SoCs. + config PHY_RCAR_GEN2 tristate "Renesas R-Car generation 2 USB PHY driver" depends on ARCH_RENESAS
drivers/phy/renesas/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_PHY_R8A779F0_ETHERNET_SERDES) += r8a779f0-ether-serdes.o obj-$(CONFIG_PHY_RCAR_GEN2) += phy-rcar-gen2.o obj-$(CONFIG_PHY_RCAR_GEN3_PCIE) += phy-rcar-gen3-pcie.o obj-$(CONFIG_PHY_RCAR_GEN3_USB2) += phy-rcar-gen3-usb2.o
drivers/phy/renesas/r8a779f0-ether-serdes.c new file +417 -0
417 lines not on this page · raw message
Signature · 7 lines
2.35.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v8 3/4 dt-bindings: phy: qcom,*-qmp-ufs-phy: add clock-cells property
In reply to Dmitry BaryshkovAdd #clock-cells property to the QMP UFS PHYs to describe them as clock providers. The QMP PHY provides rx and tx symbol clocks for the GCC.
--- .../devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml | 3 +++ .../devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml | 3 +++ 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/phy/qcom,msm8996-qmp-ufs-phy.yaml +3 -0
@@ -75,6 +75,9 @@ patternProperties: minItems: 3 maxItems: 6 + "#clock-cells": + const: 1 + "#phy-cells": const: 0
Documentation/devicetree/bindings/phy/qcom,sc8280xp-qmp-ufs-phy.yaml +3 -0
@@ -43,6 +43,9 @@ properties: vdda-pll-supply: true + "#clock-cells": + const: 1 + "#phy-cells": const: 0
Signature · 7 lines
2.35.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
PATCH v8 4/4 phy: qcom-qmp-ufs: provide symbol clocks
In reply to Dmitry BaryshkovRegister three UFS symbol clocks (ufs_rx_symbol_0_clk_src, ufs_rx_symbol_1_clk_src ufs_tx_symbol_0_clk_src). Register OF clock provider to let other devices link these clocks through the DT.
--- drivers/phy/qualcomm/phy-qcom-qmp-ufs.c | 64 +++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
drivers/phy/qualcomm/phy-qcom-qmp-ufs.c +64 -0
@@ -1023,6 +1023,66 @@ static int qmp_ufs_clk_init(struct qmp_ufs *qmp)return devm_clk_bulk_get (dev, num, qmp->clks); } +static void phy_clk_release_provider (void *res) +{ +of_clk_del_provider (res); +} + +#define UFS_SYMBOL_CLOCKS 3 + +static int phy_symbols_clk_register (struct qmp_ufs *qmp,struct device_node *np) +{ +struct clk_hw_onecell_data *clk_data; +struct clk_hw *hw; +char name[64 ]; +int ret; + + clk_data =devm_kzalloc (qmp->dev, +struct_size (clk_data, hws,UFS_SYMBOL_CLOCKS ), +GFP_KERNEL ); +if (!clk_data) +return -ENOMEM ; + + clk_data->num =UFS_SYMBOL_CLOCKS ; + +snprintf (name,sizeof (name),"%s::rx_symbol_0" ,dev_name (qmp->dev)); + hw =devm_clk_hw_register_fixed_rate (qmp->dev, name,NULL ,0 ,0 ); +if (IS_ERR (hw)) +return PTR_ERR (hw); + + clk_data->hws[0 ] = hw; + +snprintf (name,sizeof (name),"%s::rx_symbol_1" ,dev_name (qmp->dev)); + hw =devm_clk_hw_register_fixed_rate (qmp->dev, name,NULL ,0 ,0 ); +if (IS_ERR (hw)) +return PTR_ERR (hw); + + clk_data->hws[1 ] = hw; + +snprintf (name,sizeof (name),"%s::tx_symbol_0" ,dev_name (qmp->dev)); + hw =devm_clk_hw_register_fixed_rate (qmp->dev, name,NULL ,0 ,0 ); +if (IS_ERR (hw)) +return PTR_ERR (hw); + + clk_data->hws[2 ] = hw; + + ret =of_clk_add_hw_provider (np, of_clk_hw_onecell_get, clk_data); +if (ret) +return ret; + +/* +* Roll a devm action because the clock provider is the child node, but +* the child node is not actually a device. +*/ +return devm_add_action_or_reset (qmp->dev, phy_clk_release_provider, np); +} + +static const struct phy_ops qcom_qmp_ufs_ops = { + .power_on = qmp_ufs_enable, + .power_off = qmp_ufs_disable, + .owner =THIS_MODULE , +}; +static int qmp_ufs_parse_dt_legacy (struct qmp_ufs *qmp,struct device_node *np) {struct platform_device *pdev =to_platform_device (qmp->dev);
@@ -1135,6 +1195,10 @@ static int qmp_ufs_probe(struct platform_device *pdev)if (ret) goto err_node_put; + ret =phy_symbols_clk_register (qmp, np); +if (ret) + goto err_node_put; + qmp->phy =devm_phy_create (dev, np, &qcom_qmp_ufs_phy_ops);if (IS_ERR (qmp->phy)) { ret =PTR_ERR (qmp->phy);
Signature · 7 lines
2.35.1 -- linux-phy mailing list [email protected] https://lists.infradead.org/mailman/listinfo/linux-phy
Quoted 9 lines · Dmitry Baryshkov
Register UFS symbol clocks in the Qualcomm QMP PHY driver. Some of the platforms (msm8996, sc7280, sm8350/sm8450) expect them to be defined (to be used as GCC clock parents).
Changes since v7:
- Rebased on top of phy/next
- Renamed the clock registration function (Johan)
- Dropped rogueqcom_qmp_ufs_ops(Johan)
- Fixed the comment following Johan's suggestion.
Ugh, this went total crazy with me sending the patches from the wrong commit. Please excuse me, I'll send v9 instead.
Signature · 2 lines
With best wishes Dmitry