* [RFC 0/5] Add mt7988 XS-PHY
@ 2025-04-13 8:58 Frank Wunderlich
2025-04-13 8:58 ` [RFC 1/5] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
` (4 more replies)
0 siblings, 5 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-13 8:58 UTC (permalink / raw)
To: Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
From: Frank Wunderlich <frank-w@public-files.de>
Mediatek XS-Phy is a high speed phy used for pcie and usb on mt7988 platform.
It requires a topmisc power controller to switch between USB and PCI mode.
This topmisc system controller is also used by ethernet-node which is not
upstreamed yet.
---
regading syscon-fallback...i know that it should be avoided ;)
based on these commits:
ba5095ebbc7a ("mfd: syscon: Allow syscon nodes without a "syscon" compatible")
5728c92ae112 ("mfd: syscon: Restore device_node_to_regmap() for non-syscon nodes")
I tried to get it working without syscon by changing
instance->type_sw = syscon_node_to_regmap(args.np);
to
device_node_to_regmap()
then xsphy was probed sucessfully, but all pcie (not only the one with xsphy)
stopped working.
for ethernet its driver uses syscon_regmap_lookup_by_phandle which needs to
be patched in syscon driver to also use device_node_to_regmap instead of
syscon_node_to_regmap (with create=true). But have not tried this.
regarding the pcie issue when dropping the syscon compatible i would leave
this compatible, but send this patchset as RFC. Maybe anyone can solve this.
Daniel Golle (1):
phy: mediatek: xsphy: support type switch by pericfg
Frank Wunderlich (4):
dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible
dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
dt-bindings: power: Add binding for MediaTek MT7988 topmisc power
controller
arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2
.../bindings/phy/mediatek,xsphy.yaml | 17 ++++
.../power/mediatek,power-controller.yaml | 35 +++++---
arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 39 +++++++++
drivers/phy/mediatek/phy-mtk-xsphy.c | 85 ++++++++++++++++++-
4 files changed, 164 insertions(+), 12 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 16+ messages in thread
* [RFC 1/5] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible
2025-04-13 8:58 [RFC 0/5] Add mt7988 XS-PHY Frank Wunderlich
@ 2025-04-13 8:58 ` Frank Wunderlich
2025-04-13 8:58 ` [RFC 2/5] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
` (3 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-13 8:58 UTC (permalink / raw)
To: Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
From: Frank Wunderlich <frank-w@public-files.de>
Add compatible for xs-phy on mt7988.
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
index a9e3139fd421..3b5253659e6f 100644
--- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
+++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
@@ -49,6 +49,7 @@ properties:
- enum:
- mediatek,mt3611-xsphy
- mediatek,mt3612-xsphy
+ - mediatek,mt7988-xsphy
- const: mediatek,xsphy
reg:
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RFC 2/5] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg
2025-04-13 8:58 [RFC 0/5] Add mt7988 XS-PHY Frank Wunderlich
2025-04-13 8:58 ` [RFC 1/5] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
@ 2025-04-13 8:58 ` Frank Wunderlich
2025-04-13 8:58 ` [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller Frank Wunderlich
` (2 subsequent siblings)
4 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-13 8:58 UTC (permalink / raw)
To: Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
From: Frank Wunderlich <frank-w@public-files.de>
Add support for type switch by pericfg register between USB3, PCIe, ...
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
.../devicetree/bindings/phy/mediatek,xsphy.yaml | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
index 3b5253659e6f..5033d77c1239 100644
--- a/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
+++ b/Documentation/devicetree/bindings/phy/mediatek,xsphy.yaml
@@ -151,6 +151,22 @@ patternProperties:
minimum: 1
maximum: 31
+ mediatek,syscon-type:
+ $ref: /schemas/types.yaml#/definitions/phandle-array
+ maxItems: 1
+ description:
+ A phandle to syscon used to access the register of type switch,
+ the field should always be 3 cells long.
+ items:
+ items:
+ - description:
+ The first cell represents a phandle to syscon
+ - description:
+ The second cell represents the register offset
+ - description:
+ The third cell represents the index of config segment
+ enum: [0, 1, 2, 3]
+
required:
- reg
- clocks
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-13 8:58 [RFC 0/5] Add mt7988 XS-PHY Frank Wunderlich
2025-04-13 8:58 ` [RFC 1/5] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
2025-04-13 8:58 ` [RFC 2/5] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
@ 2025-04-13 8:58 ` Frank Wunderlich
2025-04-13 10:42 ` Rob Herring (Arm)
2025-04-14 10:25 ` AngeloGioacchino Del Regno
2025-04-13 8:58 ` [RFC 4/5] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
2025-04-13 8:58 ` [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
4 siblings, 2 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-13 8:58 UTC (permalink / raw)
To: Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
From: Frank Wunderlich <frank-w@public-files.de>
Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
Add binding for it.
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
.../power/mediatek,power-controller.yaml | 35 +++++++++++++------
1 file changed, 24 insertions(+), 11 deletions(-)
diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
index 591a080ca3ff..60d2fc7963e5 100644
--- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
+++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
@@ -22,17 +22,27 @@ properties:
pattern: '^power-controller(@[0-9a-f]+)?$'
compatible:
- enum:
- - mediatek,mt6735-power-controller
- - mediatek,mt6795-power-controller
- - mediatek,mt8167-power-controller
- - mediatek,mt8173-power-controller
- - mediatek,mt8183-power-controller
- - mediatek,mt8186-power-controller
- - mediatek,mt8188-power-controller
- - mediatek,mt8192-power-controller
- - mediatek,mt8195-power-controller
- - mediatek,mt8365-power-controller
+ oneOf:
+ - items:
+ - enum:
+ - mediatek,mt6735-power-controller
+ - mediatek,mt6795-power-controller
+ - mediatek,mt8167-power-controller
+ - mediatek,mt8173-power-controller
+ - mediatek,mt8183-power-controller
+ - mediatek,mt8186-power-controller
+ - mediatek,mt8188-power-controller
+ - mediatek,mt8192-power-controller
+ - mediatek,mt8195-power-controller
+ - mediatek,mt8365-power-controller
+ - items:
+ - enum:
+ - mediatek,mt7988-topmisc
+ - const: syscon
+ - const: mediatek,mt7988-power-controller
+
+ reg:
+ maxItems: 1
'#power-domain-cells':
const: 1
@@ -43,6 +53,9 @@ properties:
'#size-cells':
const: 0
+ '#clock-cells':
+ const: 1
+
patternProperties:
"^power-domain@[0-9a-f]+$":
$ref: "#/$defs/power-domain-node"
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RFC 4/5] phy: mediatek: xsphy: support type switch by pericfg
2025-04-13 8:58 [RFC 0/5] Add mt7988 XS-PHY Frank Wunderlich
` (2 preceding siblings ...)
2025-04-13 8:58 ` [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller Frank Wunderlich
@ 2025-04-13 8:58 ` Frank Wunderlich
2025-04-14 10:25 ` AngeloGioacchino Del Regno
2025-04-13 8:58 ` [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
4 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-13 8:58 UTC (permalink / raw)
To: Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
From: Daniel Golle <daniel@makrotopia.org>
Patch from Sam Shih <sam.shih@mediatek.com> found in MediaTek SDK
released under GPL.
Get syscon and use it to set the PHY type.
Extend support to PCIe and SGMII mode in addition to USB2 and USB3.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
drivers/phy/mediatek/phy-mtk-xsphy.c | 85 +++++++++++++++++++++++++++-
1 file changed, 84 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c
index 7c248f5cfca5..c0ddb9273cc3 100644
--- a/drivers/phy/mediatek/phy-mtk-xsphy.c
+++ b/drivers/phy/mediatek/phy-mtk-xsphy.c
@@ -11,10 +11,12 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/iopoll.h>
+#include <linux/mfd/syscon.h>
#include <linux/module.h>
#include <linux/of_address.h>
#include <linux/phy/phy.h>
#include <linux/platform_device.h>
+#include <linux/regmap.h>
#include "phy-mtk-io.h"
@@ -81,12 +83,22 @@
#define XSP_SR_COEF_DIVISOR 1000
#define XSP_FM_DET_CYCLE_CNT 1024
+/* PHY switch between pcie/usb3/sgmii */
+#define USB_PHY_SWITCH_CTRL 0x0
+#define RG_PHY_SW_TYPE GENMASK(3, 0)
+#define RG_PHY_SW_PCIE 0x0
+#define RG_PHY_SW_USB3 0x1
+#define RG_PHY_SW_SGMII 0x2
+
struct xsphy_instance {
struct phy *phy;
void __iomem *port_base;
struct clk *ref_clk; /* reference clock of anolog phy */
u32 index;
u32 type;
+ struct regmap *type_sw;
+ u32 type_sw_reg;
+ u32 type_sw_index;
/* only for HQA test */
int efuse_intr;
int efuse_tx_imp;
@@ -259,6 +271,10 @@ static void phy_parse_property(struct mtk_xsphy *xsphy,
inst->efuse_intr, inst->efuse_tx_imp,
inst->efuse_rx_imp);
break;
+ case PHY_TYPE_PCIE:
+ case PHY_TYPE_SGMII:
+ /* nothing to do */
+ break;
default:
dev_err(xsphy->dev, "incompatible phy type\n");
return;
@@ -305,6 +321,62 @@ static void u3_phy_props_set(struct mtk_xsphy *xsphy,
RG_XTP_LN0_RX_IMPSEL, inst->efuse_rx_imp);
}
+/* type switch for usb3/pcie/sgmii */
+static int phy_type_syscon_get(struct xsphy_instance *instance,
+ struct device_node *dn)
+{
+ struct of_phandle_args args;
+ int ret;
+
+ /* type switch function is optional */
+ if (!of_property_present(dn, "mediatek,syscon-type"))
+ return 0;
+
+ ret = of_parse_phandle_with_fixed_args(dn, "mediatek,syscon-type",
+ 2, 0, &args);
+ if (ret)
+ return ret;
+
+ instance->type_sw_reg = args.args[0];
+ instance->type_sw_index = args.args[1] & 0x3; /* <=3 */
+ instance->type_sw = syscon_node_to_regmap(args.np);
+ of_node_put(args.np);
+ dev_info(&instance->phy->dev, "type_sw - reg %#x, index %d\n",
+ instance->type_sw_reg, instance->type_sw_index);
+
+ return PTR_ERR_OR_ZERO(instance->type_sw);
+}
+
+static int phy_type_set(struct xsphy_instance *instance)
+{
+ int type;
+ u32 offset;
+
+ if (!instance->type_sw)
+ return 0;
+
+ switch (instance->type) {
+ case PHY_TYPE_USB3:
+ type = RG_PHY_SW_USB3;
+ break;
+ case PHY_TYPE_PCIE:
+ type = RG_PHY_SW_PCIE;
+ break;
+ case PHY_TYPE_SGMII:
+ type = RG_PHY_SW_SGMII;
+ break;
+ case PHY_TYPE_USB2:
+ default:
+ return 0;
+ }
+
+ offset = instance->type_sw_index * BITS_PER_BYTE;
+ regmap_update_bits(instance->type_sw, instance->type_sw_reg,
+ RG_PHY_SW_TYPE << offset, type << offset);
+
+ return 0;
+}
+
static int mtk_phy_init(struct phy *phy)
{
struct xsphy_instance *inst = phy_get_drvdata(phy);
@@ -325,6 +397,10 @@ static int mtk_phy_init(struct phy *phy)
case PHY_TYPE_USB3:
u3_phy_props_set(xsphy, inst);
break;
+ case PHY_TYPE_PCIE:
+ case PHY_TYPE_SGMII:
+ /* nothing to do, only used to set type */
+ break;
default:
dev_err(xsphy->dev, "incompatible phy type\n");
clk_disable_unprepare(inst->ref_clk);
@@ -403,12 +479,15 @@ static struct phy *mtk_phy_xlate(struct device *dev,
inst->type = args->args[0];
if (!(inst->type == PHY_TYPE_USB2 ||
- inst->type == PHY_TYPE_USB3)) {
+ inst->type == PHY_TYPE_USB3 ||
+ inst->type == PHY_TYPE_PCIE ||
+ inst->type == PHY_TYPE_SGMII)) {
dev_err(dev, "unsupported phy type: %d\n", inst->type);
return ERR_PTR(-EINVAL);
}
phy_parse_property(xsphy, inst);
+ phy_type_set(inst);
return inst->phy;
}
@@ -510,6 +589,10 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
dev_err(dev, "failed to get ref_clk(id-%d)\n", port);
return PTR_ERR(inst->ref_clk);
}
+
+ retval = phy_type_syscon_get(inst, child_np);
+ if (retval)
+ return retval;
}
provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2
2025-04-13 8:58 [RFC 0/5] Add mt7988 XS-PHY Frank Wunderlich
` (3 preceding siblings ...)
2025-04-13 8:58 ` [RFC 4/5] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
@ 2025-04-13 8:58 ` Frank Wunderlich
2025-04-14 10:27 ` AngeloGioacchino Del Regno
4 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-13 8:58 UTC (permalink / raw)
To: Chunfeng Yun, Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
AngeloGioacchino Del Regno
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
From: Frank Wunderlich <frank-w@public-files.de>
First usb and third pcie controller on mt7988 need a xs-phy to work
properly.
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 39 +++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
index 88b56a24efca..10525d977007 100644
--- a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
@@ -334,6 +334,8 @@ usb@11190000 {
<&infracfg CLK_INFRA_133M_USB_HCK>,
<&infracfg CLK_INFRA_USB_XHCI>;
clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck";
+ phys = <&xphyu2port0 PHY_TYPE_USB2>,
+ <&xphyu3port0 PHY_TYPE_USB3>;
status = "disabled";
};
@@ -398,6 +400,9 @@ pcie2: pcie@11280000 {
pinctrl-0 = <&pcie2_pins>;
status = "disabled";
+ phys = <&xphyu3port0 PHY_TYPE_PCIE>;
+ phy-names = "pcie-phy";
+
#interrupt-cells = <1>;
interrupt-map-mask = <0 0 0 0x7>;
interrupt-map = <0 0 0 1 &pcie_intc2 0>,
@@ -548,6 +553,40 @@ tphyu3port0: usb-phy@11c50700 {
};
};
+ topmisc: power-controller@11d10000 {
+ compatible = "mediatek,mt7988-topmisc", "syscon",
+ "mediatek,mt7988-power-controller";
+ reg = <0 0x11d10000 0 0x10000>;
+ #clock-cells = <1>;
+ #power-domain-cells = <1>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ };
+
+ xs-phy@11e10000 {
+ compatible = "mediatek,mt7988-xsphy",
+ "mediatek,xsphy";
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+ status = "disabled";
+
+ xphyu2port0: usb-phy@11e10000 {
+ reg = <0 0x11e10000 0 0x400>;
+ clocks = <&infracfg CLK_INFRA_USB_UTMI>;
+ clock-names = "ref";
+ #phy-cells = <1>;
+ };
+
+ xphyu3port0: usb-phy@11e13000 {
+ reg = <0 0x11e13400 0 0x500>;
+ clocks = <&infracfg CLK_INFRA_USB_PIPE>;
+ clock-names = "ref";
+ #phy-cells = <1>;
+ mediatek,syscon-type = <&topmisc 0x218 0>;
+ };
+ };
+
clock-controller@11f40000 {
compatible = "mediatek,mt7988-xfi-pll";
reg = <0 0x11f40000 0 0x1000>;
--
2.43.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-13 8:58 ` [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller Frank Wunderlich
@ 2025-04-13 10:42 ` Rob Herring (Arm)
2025-04-14 10:25 ` AngeloGioacchino Del Regno
1 sibling, 0 replies; 16+ messages in thread
From: Rob Herring (Arm) @ 2025-04-13 10:42 UTC (permalink / raw)
To: Frank Wunderlich
Cc: Vinod Koul, Conor Dooley, Daniel Golle, Matthias Brugger,
linux-phy, Chunfeng Yun, devicetree, linux-mediatek,
AngeloGioacchino Del Regno, MandyJH Liu, Krzysztof Kozlowski,
linux-kernel, linux-arm-kernel, Kishon Vijay Abraham I,
Frank Wunderlich, Sam Shih
On Sun, 13 Apr 2025 10:58:03 +0200, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
>
> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
> Add binding for it.
>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> .../power/mediatek,power-controller.yaml | 35 +++++++++++++------
> 1 file changed, 24 insertions(+), 11 deletions(-)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
./Documentation/devicetree/bindings/power/mediatek,power-controller.yaml:27:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/power/mediatek,power-controller.yaml:28:11: [warning] wrong indentation: expected 12 but found 10 (indentation)
./Documentation/devicetree/bindings/power/mediatek,power-controller.yaml:39:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/power/mediatek,power-controller.yaml:40:11: [warning] wrong indentation: expected 12 but found 10 (indentation)
dtschema/dtc warnings/errors:
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250413085806.8544-4-linux@fw-web.de
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-13 8:58 ` [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller Frank Wunderlich
2025-04-13 10:42 ` Rob Herring (Arm)
@ 2025-04-14 10:25 ` AngeloGioacchino Del Regno
2025-04-15 9:52 ` Frank Wunderlich
1 sibling, 1 reply; 16+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-14 10:25 UTC (permalink / raw)
To: Frank Wunderlich, Chunfeng Yun, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
Il 13/04/25 10:58, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
>
> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
> Add binding for it.
That's the wrong binding... check mfd/syscon.yaml :-)
P.S.: Is there any reset controller in topmisc? Any clock?
If yes, syscon.yaml is also wrong, and you need a driver for that.
Remember: If it turns out *later* that this has clk/resets and the
bindings are already set for just a syscon, it's gonna be way harder!
Cheers,
Angelo
>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> .../power/mediatek,power-controller.yaml | 35 +++++++++++++------
> 1 file changed, 24 insertions(+), 11 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> index 591a080ca3ff..60d2fc7963e5 100644
> --- a/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> +++ b/Documentation/devicetree/bindings/power/mediatek,power-controller.yaml
> @@ -22,17 +22,27 @@ properties:
> pattern: '^power-controller(@[0-9a-f]+)?$'
>
> compatible:
> - enum:
> - - mediatek,mt6735-power-controller
> - - mediatek,mt6795-power-controller
> - - mediatek,mt8167-power-controller
> - - mediatek,mt8173-power-controller
> - - mediatek,mt8183-power-controller
> - - mediatek,mt8186-power-controller
> - - mediatek,mt8188-power-controller
> - - mediatek,mt8192-power-controller
> - - mediatek,mt8195-power-controller
> - - mediatek,mt8365-power-controller
> + oneOf:
> + - items:
> + - enum:
> + - mediatek,mt6735-power-controller
> + - mediatek,mt6795-power-controller
> + - mediatek,mt8167-power-controller
> + - mediatek,mt8173-power-controller
> + - mediatek,mt8183-power-controller
> + - mediatek,mt8186-power-controller
> + - mediatek,mt8188-power-controller
> + - mediatek,mt8192-power-controller
> + - mediatek,mt8195-power-controller
> + - mediatek,mt8365-power-controller
> + - items:
> + - enum:
> + - mediatek,mt7988-topmisc
> + - const: syscon
> + - const: mediatek,mt7988-power-controller
> +
> + reg:
> + maxItems: 1
>
> '#power-domain-cells':
> const: 1
> @@ -43,6 +53,9 @@ properties:
> '#size-cells':
> const: 0
>
> + '#clock-cells':
> + const: 1
> +
> patternProperties:
> "^power-domain@[0-9a-f]+$":
> $ref: "#/$defs/power-domain-node"
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 4/5] phy: mediatek: xsphy: support type switch by pericfg
2025-04-13 8:58 ` [RFC 4/5] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
@ 2025-04-14 10:25 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 16+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-14 10:25 UTC (permalink / raw)
To: Frank Wunderlich, Chunfeng Yun, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
Il 13/04/25 10:58, Frank Wunderlich ha scritto:
> From: Daniel Golle <daniel@makrotopia.org>
>
> Patch from Sam Shih <sam.shih@mediatek.com> found in MediaTek SDK
> released under GPL.
>
> Get syscon and use it to set the PHY type.
> Extend support to PCIe and SGMII mode in addition to USB2 and USB3.
>
That's really exactly the same code that is in phy-mtk-tphy.c ... and actually
there's a whole lot of code that is duplicated between TPHY and XSPHY...
It's even possible to just add the XSPHY to the TPHY driver and call it a day
if we really want to, but I'll leave that decision to the maintainer.
Another way would be to add a phy-mtk-tphy-common.c and migrate all of the common
code that can be shared from both XSPHY and TPHY in there....
Besides, if you check the register layout - even that is something like 90% the
same (actually, looks like even more than that, but for the sake of being
conservative...) so this really points me at believing that, despite the naming
change, those IPs are just incremental versions, or XSPHY is simply a reduced
functionality TPHY.
Either way, those are sharing really too much code to just keep duplicating :-)
P.S.: Those comments are only for the code, not for the binding.
Cheers,
Angelo
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
> drivers/phy/mediatek/phy-mtk-xsphy.c | 85 +++++++++++++++++++++++++++-
> 1 file changed, 84 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-xsphy.c b/drivers/phy/mediatek/phy-mtk-xsphy.c
> index 7c248f5cfca5..c0ddb9273cc3 100644
> --- a/drivers/phy/mediatek/phy-mtk-xsphy.c
> +++ b/drivers/phy/mediatek/phy-mtk-xsphy.c
> @@ -11,10 +11,12 @@
> #include <linux/clk.h>
> #include <linux/delay.h>
> #include <linux/iopoll.h>
> +#include <linux/mfd/syscon.h>
> #include <linux/module.h>
> #include <linux/of_address.h>
> #include <linux/phy/phy.h>
> #include <linux/platform_device.h>
> +#include <linux/regmap.h>
>
> #include "phy-mtk-io.h"
>
> @@ -81,12 +83,22 @@
> #define XSP_SR_COEF_DIVISOR 1000
> #define XSP_FM_DET_CYCLE_CNT 1024
>
> +/* PHY switch between pcie/usb3/sgmii */
> +#define USB_PHY_SWITCH_CTRL 0x0
> +#define RG_PHY_SW_TYPE GENMASK(3, 0)
> +#define RG_PHY_SW_PCIE 0x0
> +#define RG_PHY_SW_USB3 0x1
> +#define RG_PHY_SW_SGMII 0x2
> +
> struct xsphy_instance {
> struct phy *phy;
> void __iomem *port_base;
> struct clk *ref_clk; /* reference clock of anolog phy */
> u32 index;
> u32 type;
> + struct regmap *type_sw;
> + u32 type_sw_reg;
> + u32 type_sw_index;
> /* only for HQA test */
> int efuse_intr;
> int efuse_tx_imp;
> @@ -259,6 +271,10 @@ static void phy_parse_property(struct mtk_xsphy *xsphy,
> inst->efuse_intr, inst->efuse_tx_imp,
> inst->efuse_rx_imp);
> break;
> + case PHY_TYPE_PCIE:
> + case PHY_TYPE_SGMII:
> + /* nothing to do */
> + break;
> default:
> dev_err(xsphy->dev, "incompatible phy type\n");
> return;
> @@ -305,6 +321,62 @@ static void u3_phy_props_set(struct mtk_xsphy *xsphy,
> RG_XTP_LN0_RX_IMPSEL, inst->efuse_rx_imp);
> }
>
> +/* type switch for usb3/pcie/sgmii */
> +static int phy_type_syscon_get(struct xsphy_instance *instance,
> + struct device_node *dn)
> +{
> + struct of_phandle_args args;
> + int ret;
> +
> + /* type switch function is optional */
> + if (!of_property_present(dn, "mediatek,syscon-type"))
> + return 0;
> +
> + ret = of_parse_phandle_with_fixed_args(dn, "mediatek,syscon-type",
> + 2, 0, &args);
> + if (ret)
> + return ret;
> +
> + instance->type_sw_reg = args.args[0];
> + instance->type_sw_index = args.args[1] & 0x3; /* <=3 */
> + instance->type_sw = syscon_node_to_regmap(args.np);
> + of_node_put(args.np);
> + dev_info(&instance->phy->dev, "type_sw - reg %#x, index %d\n",
> + instance->type_sw_reg, instance->type_sw_index);
> +
> + return PTR_ERR_OR_ZERO(instance->type_sw);
> +}
> +
> +static int phy_type_set(struct xsphy_instance *instance)
> +{
> + int type;
> + u32 offset;
> +
> + if (!instance->type_sw)
> + return 0;
> +
> + switch (instance->type) {
> + case PHY_TYPE_USB3:
> + type = RG_PHY_SW_USB3;
> + break;
> + case PHY_TYPE_PCIE:
> + type = RG_PHY_SW_PCIE;
> + break;
> + case PHY_TYPE_SGMII:
> + type = RG_PHY_SW_SGMII;
> + break;
> + case PHY_TYPE_USB2:
> + default:
> + return 0;
> + }
> +
> + offset = instance->type_sw_index * BITS_PER_BYTE;
> + regmap_update_bits(instance->type_sw, instance->type_sw_reg,
> + RG_PHY_SW_TYPE << offset, type << offset);
> +
> + return 0;
> +}
> +
> static int mtk_phy_init(struct phy *phy)
> {
> struct xsphy_instance *inst = phy_get_drvdata(phy);
> @@ -325,6 +397,10 @@ static int mtk_phy_init(struct phy *phy)
> case PHY_TYPE_USB3:
> u3_phy_props_set(xsphy, inst);
> break;
> + case PHY_TYPE_PCIE:
> + case PHY_TYPE_SGMII:
> + /* nothing to do, only used to set type */
> + break;
> default:
> dev_err(xsphy->dev, "incompatible phy type\n");
> clk_disable_unprepare(inst->ref_clk);
> @@ -403,12 +479,15 @@ static struct phy *mtk_phy_xlate(struct device *dev,
>
> inst->type = args->args[0];
> if (!(inst->type == PHY_TYPE_USB2 ||
> - inst->type == PHY_TYPE_USB3)) {
> + inst->type == PHY_TYPE_USB3 ||
> + inst->type == PHY_TYPE_PCIE ||
> + inst->type == PHY_TYPE_SGMII)) {
> dev_err(dev, "unsupported phy type: %d\n", inst->type);
> return ERR_PTR(-EINVAL);
> }
>
> phy_parse_property(xsphy, inst);
> + phy_type_set(inst);
>
> return inst->phy;
> }
> @@ -510,6 +589,10 @@ static int mtk_xsphy_probe(struct platform_device *pdev)
> dev_err(dev, "failed to get ref_clk(id-%d)\n", port);
> return PTR_ERR(inst->ref_clk);
> }
> +
> + retval = phy_type_syscon_get(inst, child_np);
> + if (retval)
> + return retval;
> }
>
> provider = devm_of_phy_provider_register(dev, mtk_phy_xlate);
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2
2025-04-13 8:58 ` [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
@ 2025-04-14 10:27 ` AngeloGioacchino Del Regno
2025-04-14 10:57 ` Frank Wunderlich
0 siblings, 1 reply; 16+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-14 10:27 UTC (permalink / raw)
To: Frank Wunderlich, Chunfeng Yun, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger
Cc: Frank Wunderlich, Daniel Golle, Sam Shih, MandyJH Liu,
linux-arm-kernel, linux-mediatek, linux-phy, devicetree,
linux-kernel
Il 13/04/25 10:58, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
>
> First usb and third pcie controller on mt7988 need a xs-phy to work
> properly.
>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> arch/arm64/boot/dts/mediatek/mt7988a.dtsi | 39 +++++++++++++++++++++++
> 1 file changed, 39 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
> index 88b56a24efca..10525d977007 100644
> --- a/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
> +++ b/arch/arm64/boot/dts/mediatek/mt7988a.dtsi
> @@ -334,6 +334,8 @@ usb@11190000 {
> <&infracfg CLK_INFRA_133M_USB_HCK>,
> <&infracfg CLK_INFRA_USB_XHCI>;
> clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck";
> + phys = <&xphyu2port0 PHY_TYPE_USB2>,
> + <&xphyu3port0 PHY_TYPE_USB3>;
> status = "disabled";
> };
>
> @@ -398,6 +400,9 @@ pcie2: pcie@11280000 {
> pinctrl-0 = <&pcie2_pins>;
> status = "disabled";
>
> + phys = <&xphyu3port0 PHY_TYPE_PCIE>;
> + phy-names = "pcie-phy";
> +
> #interrupt-cells = <1>;
> interrupt-map-mask = <0 0 0 0x7>;
> interrupt-map = <0 0 0 1 &pcie_intc2 0>,
> @@ -548,6 +553,40 @@ tphyu3port0: usb-phy@11c50700 {
> };
> };
>
> + topmisc: power-controller@11d10000 {
> + compatible = "mediatek,mt7988-topmisc", "syscon",
> + "mediatek,mt7988-power-controller";
> + reg = <0 0x11d10000 0 0x10000>;
> + #clock-cells = <1>;
> + #power-domain-cells = <1>;
> + #address-cells = <1>;
> + #size-cells = <0>;
> + };
> +
> + xs-phy@11e10000 {
That shall be just "phy@addr"
> + compatible = "mediatek,mt7988-xsphy",
> + "mediatek,xsphy";
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> + status = "disabled";
> +
> + xphyu2port0: usb-phy@11e10000 {
Perhaps just u2port0/u3port0 like done on the other MediaTek SoC DTs is better
for consistency :-)
Cheers!
> + reg = <0 0x11e10000 0 0x400>;
> + clocks = <&infracfg CLK_INFRA_USB_UTMI>;
> + clock-names = "ref";
> + #phy-cells = <1>;
> + };
> +
> + xphyu3port0: usb-phy@11e13000 {
> + reg = <0 0x11e13400 0 0x500>;
> + clocks = <&infracfg CLK_INFRA_USB_PIPE>;
> + clock-names = "ref";
> + #phy-cells = <1>;
> + mediatek,syscon-type = <&topmisc 0x218 0>;
> + };
> + };
> +
> clock-controller@11f40000 {
> compatible = "mediatek,mt7988-xfi-pll";
> reg = <0 0x11f40000 0 0x1000>;
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2
2025-04-14 10:27 ` AngeloGioacchino Del Regno
@ 2025-04-14 10:57 ` Frank Wunderlich
0 siblings, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-14 10:57 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, Frank Wunderlich, Chunfeng Yun,
Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger
Cc: Daniel Golle, Sam Shih, MandyJH Liu, linux-arm-kernel,
linux-mediatek, linux-phy, devicetree, linux-kernel
Am 14. April 2025 12:27:30 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>Il 13/04/25 10:58, Frank Wunderlich ha scritto:
>> From: Frank Wunderlich <frank-w@public-files.de>
>> + xs-phy@11e10000 {
>
>That shall be just "phy@addr"
Ok
>> + compatible = "mediatek,mt7988-xsphy",
>> + "mediatek,xsphy";
>> + #address-cells = <2>;
>> + #size-cells = <2>;
>> + ranges;
>> + status = "disabled";
>> +
>> + xphyu2port0: usb-phy@11e10000 {
>
>Perhaps just u2port0/u3port0 like done on the other MediaTek SoC DTs is better
>for consistency :-)
Mt7988 also have a tphy where we have it named tphyu3port. Leaving this imho would increase confusion.
>Cheers!
>
regards Frank
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-14 10:25 ` AngeloGioacchino Del Regno
@ 2025-04-15 9:52 ` Frank Wunderlich
2025-04-15 9:59 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-15 9:52 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, Frank Wunderlich, Chunfeng Yun,
Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger
Cc: Daniel Golle, Sam Shih, MandyJH Liu, linux-arm-kernel,
linux-mediatek, linux-phy, devicetree, linux-kernel
Hi Angelo,
Am 14. April 2025 12:25:23 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>Il 13/04/25 10:58, Frank Wunderlich ha scritto:
>> From: Frank Wunderlich <frank-w@public-files.de>
>>
>> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
>> Add binding for it.
>
>That's the wrong binding... check mfd/syscon.yaml :-)
>
>P.S.: Is there any reset controller in topmisc? Any clock?
> If yes, syscon.yaml is also wrong, and you need a driver for that.
> Remember: If it turns out *later* that this has clk/resets and the
> bindings are already set for just a syscon, it's gonna be way harder!
>
>Cheers,
>Angelo
Ok based on the power-domain-cells property i guessed powercontroller is the right place.
But based on your suggestion i tried moving compatible to syscon binding and made dtbs_check here.
I can confirm dropping the unexpected properties reported by syscon binding (power-domain-cells,clock-cells,adress-cells and size-cells) are not needed for function (xsphy and ethernet).
For verifying that there are really no clocks/resets in topmisc (have not found it in public available register documents) i asked mtk (waiting for answer).
Also got it working without the syscon compatible by changing ethernet driver too (after this change xsphy was also working).
Eth:
https://github.com/frank-w/BPI-Router-Linux/commit/d866e648717800b6f6395ad36c38f9effcf0498d
Xsphy:
<https://github.com/frank-w/BPI-Router-Linux/commit/0121a94df99700487704ca056b210b13db07e90c>
regards Frank
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-15 9:52 ` Frank Wunderlich
@ 2025-04-15 9:59 ` AngeloGioacchino Del Regno
2025-04-15 11:33 ` Frank Wunderlich
2025-04-15 14:03 ` Frank Wunderlich
0 siblings, 2 replies; 16+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-15 9:59 UTC (permalink / raw)
To: frank-w, Frank Wunderlich, Chunfeng Yun, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger
Cc: Daniel Golle, Sam Shih, MandyJH Liu, linux-arm-kernel,
linux-mediatek, linux-phy, devicetree, linux-kernel
Il 15/04/25 11:52, Frank Wunderlich ha scritto:
> Hi Angelo,
>
> Am 14. April 2025 12:25:23 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>> Il 13/04/25 10:58, Frank Wunderlich ha scritto:
>>> From: Frank Wunderlich <frank-w@public-files.de>
>>>
>>> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
>>> Add binding for it.
>>
>> That's the wrong binding... check mfd/syscon.yaml :-)
>>
>> P.S.: Is there any reset controller in topmisc? Any clock?
>> If yes, syscon.yaml is also wrong, and you need a driver for that.
>> Remember: If it turns out *later* that this has clk/resets and the
>> bindings are already set for just a syscon, it's gonna be way harder!
>>
>> Cheers,
>> Angelo
>
> Ok based on the power-domain-cells property i guessed powercontroller is the right place.
power-domain-cells, but without any power domain assignment, so that was wrong :)))
>
> But based on your suggestion i tried moving compatible to syscon binding and made dtbs_check here.
>
> I can confirm dropping the unexpected properties reported by syscon binding (power-domain-cells,clock-cells,adress-cells and size-cells) are not needed for function (xsphy and ethernet).
>
> For verifying that there are really no clocks/resets in topmisc (have not found it in public available register documents) i asked mtk (waiting for answer).
>
> Also got it working without the syscon compatible by changing ethernet driver too (after this change xsphy was also working).
Perfect, a bit of a cleanup and you're done, then!
Cheers!
>
> Eth:
> https://github.com/frank-w/BPI-Router-Linux/commit/d866e648717800b6f6395ad36c38f9effcf0498d
> Xsphy:
> <https://github.com/frank-w/BPI-Router-Linux/commit/0121a94df99700487704ca056b210b13db07e90c>
>
> regards Frank
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-15 9:59 ` AngeloGioacchino Del Regno
@ 2025-04-15 11:33 ` Frank Wunderlich
2025-04-15 14:03 ` Frank Wunderlich
1 sibling, 0 replies; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-15 11:33 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, frank-w, Chunfeng Yun, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger
Cc: Daniel Golle, Sam Shih, MandyJH Liu, linux-arm-kernel,
linux-mediatek, linux-phy, devicetree, linux-kernel
Am 15. April 2025 11:59:06 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>Il 15/04/25 11:52, Frank Wunderlich ha scritto:
>> Hi Angelo,
>>
>> Am 14. April 2025 12:25:23 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>>> Il 13/04/25 10:58, Frank Wunderlich ha scritto:
>>>> From: Frank Wunderlich <frank-w@public-files.de>
>>>>
>>>> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
>>>> Add binding for it.
>>>
>>> That's the wrong binding... check mfd/syscon.yaml :-)
>>>
>>> P.S.: Is there any reset controller in topmisc? Any clock?
>>> If yes, syscon.yaml is also wrong, and you need a driver for that.
>>> Remember: If it turns out *later* that this has clk/resets and the
>>> bindings are already set for just a syscon, it's gonna be way harder!
>>>
>>> Cheers,
>>> Angelo
>>
>> Ok based on the power-domain-cells property i guessed powercontroller is the right place.
>
>power-domain-cells, but without any power domain assignment, so that was wrong :)))
>
>>
>> But based on your suggestion i tried moving compatible to syscon binding and made dtbs_check here.
>>
>> I can confirm dropping the unexpected properties reported by syscon binding (power-domain-cells,clock-cells,adress-cells and size-cells) are not needed for function (xsphy and ethernet).
>>
>> For verifying that there are really no clocks/resets in topmisc (have not found it in public available register documents) i asked mtk (waiting for answer).
>>
>> Also got it working without the syscon compatible by changing ethernet driver too (after this change xsphy was also working).
>
>Perfect, a bit of a cleanup and you're done, then!
If i do not have to change/merge driver code...and i hope getting response from mtk soon.
>Cheers!
>
>>
>> Eth:
>> https://github.com/frank-w/BPI-Router-Linux/commit/d866e648717800b6f6395ad36c38f9effcf0498d
>> Xsphy:
>> <https://github.com/frank-w/BPI-Router-Linux/commit/0121a94df99700487704ca056b210b13db07e90c>
>>
>> regards Frank
>
>
>
regards Frank
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-15 9:59 ` AngeloGioacchino Del Regno
2025-04-15 11:33 ` Frank Wunderlich
@ 2025-04-15 14:03 ` Frank Wunderlich
2025-04-15 14:12 ` AngeloGioacchino Del Regno
1 sibling, 1 reply; 16+ messages in thread
From: Frank Wunderlich @ 2025-04-15 14:03 UTC (permalink / raw)
To: AngeloGioacchino Del Regno, Frank Wunderlich, Chunfeng Yun,
Vinod Koul, Kishon Vijay Abraham I, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Matthias Brugger
Cc: Daniel Golle, Sam Shih, MandyJH Liu, linux-arm-kernel,
linux-mediatek, linux-phy, devicetree, linux-kernel
Am 15. April 2025 11:59:06 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>Il 15/04/25 11:52, Frank Wunderlich ha scritto:
>> Hi Angelo,
>>
>> Am 14. April 2025 12:25:23 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>>> Il 13/04/25 10:58, Frank Wunderlich ha scritto:
>>>> From: Frank Wunderlich <frank-w@public-files.de>
>>>>
>>>> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
>>>> Add binding for it.
>>>
>>> That's the wrong binding... check mfd/syscon.yaml :-)
>>>
>>> P.S.: Is there any reset controller in topmisc? Any clock?
>>> If yes, syscon.yaml is also wrong, and you need a driver for that.
>>> Remember: If it turns out *later* that this has clk/resets and the
>>> bindings are already set for just a syscon, it's gonna be way harder!
>>>
>>> Cheers,
>>> Angelo
>>
>> Ok based on the power-domain-cells property i guessed powercontroller is the right place.
>
>power-domain-cells, but without any power domain assignment, so that was wrong :)))
>
>>
>> But based on your suggestion i tried moving compatible to syscon binding and made dtbs_check here.
>>
>> I can confirm dropping the unexpected properties reported by syscon binding (power-domain-cells,clock-cells,adress-cells and size-cells) are not needed for function (xsphy and ethernet).
>>
>> For verifying that there are really no clocks/resets in topmisc (have not found it in public available register documents) i asked mtk (waiting for answer).
>>
>> Also got it working without the syscon compatible by changing ethernet driver too (after this change xsphy was also working).
>
>Perfect, a bit of a cleanup and you're done, then!
>
>Cheers!
>
>>
>> Eth:
>> https://github.com/frank-w/BPI-Router-Linux/commit/d866e648717800b6f6395ad36c38f9effcf0498d
>> Xsphy:
>> <https://github.com/frank-w/BPI-Router-Linux/commit/0121a94df99700487704ca056b210b13db07e90c>
>>
>> regards Frank
>
>
>
Got response from MTK and basicly topmisc contains a powercontroller (for cpu and internal 2g5) but currently not needed because ATF already switch this on. The second part is the pcs/phy muxing and 3rd some unneeded switches (where i have no detailed information). But no clocks or resets as these are handled in the connected platform driver (xsphy/ethernet).
So my original binding imho made more sense.
The syscon binding seems to need syscon fallback and shows error about unexpected "compatible" property. The binding itself does not contain any properties but references syscon-common where iiuc compatible property must have at least 2 items and requires the "syscon" fallback.
Mtk suggests splitting topmisc into the 2 blocks by only using the mux part as syscon with splitting the reg. If powerdomain really is needed then a second topmisc node could be added and bound to a new driver.
But this would need a bit more of testing.
regards Frank
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller
2025-04-15 14:03 ` Frank Wunderlich
@ 2025-04-15 14:12 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 16+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-04-15 14:12 UTC (permalink / raw)
To: frank-w, Frank Wunderlich, Chunfeng Yun, Vinod Koul,
Kishon Vijay Abraham I, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Matthias Brugger
Cc: Daniel Golle, Sam Shih, MandyJH Liu, linux-arm-kernel,
linux-mediatek, linux-phy, devicetree, linux-kernel
Il 15/04/25 16:03, Frank Wunderlich ha scritto:
> Am 15. April 2025 11:59:06 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>> Il 15/04/25 11:52, Frank Wunderlich ha scritto:
>>> Hi Angelo,
>>>
>>> Am 14. April 2025 12:25:23 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>>>> Il 13/04/25 10:58, Frank Wunderlich ha scritto:
>>>>> From: Frank Wunderlich <frank-w@public-files.de>
>>>>>
>>>>> Topmisc is a systemcontroller used for xs-phy and ethernet on mt7988.
>>>>> Add binding for it.
>>>>
>>>> That's the wrong binding... check mfd/syscon.yaml :-)
>>>>
>>>> P.S.: Is there any reset controller in topmisc? Any clock?
>>>> If yes, syscon.yaml is also wrong, and you need a driver for that.
>>>> Remember: If it turns out *later* that this has clk/resets and the
>>>> bindings are already set for just a syscon, it's gonna be way harder!
>>>>
>>>> Cheers,
>>>> Angelo
>>>
>>> Ok based on the power-domain-cells property i guessed powercontroller is the right place.
>>
>> power-domain-cells, but without any power domain assignment, so that was wrong :)))
>>
>>>
>>> But based on your suggestion i tried moving compatible to syscon binding and made dtbs_check here.
>>>
>>> I can confirm dropping the unexpected properties reported by syscon binding (power-domain-cells,clock-cells,adress-cells and size-cells) are not needed for function (xsphy and ethernet).
>>>
>>> For verifying that there are really no clocks/resets in topmisc (have not found it in public available register documents) i asked mtk (waiting for answer).
>>>
>>> Also got it working without the syscon compatible by changing ethernet driver too (after this change xsphy was also working).
>>
>> Perfect, a bit of a cleanup and you're done, then!
>>
>> Cheers!
>>
>>>
>>> Eth:
>>> https://github.com/frank-w/BPI-Router-Linux/commit/d866e648717800b6f6395ad36c38f9effcf0498d
>>> Xsphy:
>>> <https://github.com/frank-w/BPI-Router-Linux/commit/0121a94df99700487704ca056b210b13db07e90c>
>>>
>>> regards Frank
>>
>>
>>
>
> Got response from MTK and basicly topmisc contains a powercontroller (for cpu and internal 2g5) but currently not needed because ATF already switch this on. The second part is the pcs/phy muxing and 3rd some unneeded switches (where i have no detailed information). But no clocks or resets as these are handled in the connected platform driver (xsphy/ethernet).
>
> So my original binding imho made more sense.
>
> The syscon binding seems to need syscon fallback and shows error about unexpected "compatible" property. The binding itself does not contain any properties but references syscon-common where iiuc compatible property must have at least 2 items and requires the "syscon" fallback.
>
> Mtk suggests splitting topmisc into the 2 blocks by only using the mux part as syscon with splitting the reg. If powerdomain really is needed then a second topmisc node could be added and bound to a new driver.
>
I agree with MediaTek's suggestion. Split it, that just makes more sense.
Besides, if the first part (the power controller in topmisc) is managed by ATF it's
a good idea to avoid touching anything in there from the kernel :-)
> But this would need a bit more of testing.
> regards Frank
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2025-04-15 14:12 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-13 8:58 [RFC 0/5] Add mt7988 XS-PHY Frank Wunderlich
2025-04-13 8:58 ` [RFC 1/5] dt-bindings: phy: mtk-xs-phy: Add mt7988 compatible Frank Wunderlich
2025-04-13 8:58 ` [RFC 2/5] dt-bindings: phy: mtk-xs-phy: support type switch by pericfg Frank Wunderlich
2025-04-13 8:58 ` [RFC 3/5] dt-bindings: power: Add binding for MediaTek MT7988 topmisc power controller Frank Wunderlich
2025-04-13 10:42 ` Rob Herring (Arm)
2025-04-14 10:25 ` AngeloGioacchino Del Regno
2025-04-15 9:52 ` Frank Wunderlich
2025-04-15 9:59 ` AngeloGioacchino Del Regno
2025-04-15 11:33 ` Frank Wunderlich
2025-04-15 14:03 ` Frank Wunderlich
2025-04-15 14:12 ` AngeloGioacchino Del Regno
2025-04-13 8:58 ` [RFC 4/5] phy: mediatek: xsphy: support type switch by pericfg Frank Wunderlich
2025-04-14 10:25 ` AngeloGioacchino Del Regno
2025-04-13 8:58 ` [RFC 5/5] arm64: dts: mediatek: mt7988: Add xsphy for ssusb0/pcie2 Frank Wunderlich
2025-04-14 10:27 ` AngeloGioacchino Del Regno
2025-04-14 10:57 ` Frank Wunderlich
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).