phy: core: add debugfs root
Subsystems (3)
Chunfeng Yun
maintainerPATCH v2 1/2 phy: core: add debugfs root
Add a debugfs root for phy class, then phy drivers can add debugfs files under this folder.
---
v2: no changes
--- drivers/phy/phy-core.c | 6 ++++++ include/linux/phy/phy.h | 2 ++ 2 files changed, 8 insertions(+)
drivers/phy/phy-core.c +6 -0
@@ -11,6 +11,7 @@#include <linux/export.h> #include <linux/module.h> #include <linux/err.h> +#include <linux/debugfs.h> #include <linux/device.h> #include <linux/slab.h> #include <linux/of.h>
@@ -1204,6 +1205,9 @@ void devm_of_phy_provider_unregister(struct device *dev, }EXPORT_SYMBOL_GPL (devm_of_phy_provider_unregister); +struct dentry *phy_debug_root; +EXPORT_SYMBOL_GPL (phy_debug_root); +/** * phy_release() - release the phy * @dev: the dev member within phy
@@ -1233,6 +1237,8 @@ static int __init phy_core_init(void) phy_class->dev_release = phy_release; + phy_debug_root =debugfs_create_dir ("phy" ,NULL ); +return 0 ; }device_initcall (phy_core_init);
include/linux/phy/phy.h +2 -0
@@ -205,6 +205,8 @@ struct phy_lookup {#define devm_of_phy_provider_register_full (dev, children, xlate) \ __devm_of_phy_provider_register(dev, children, THIS_MODULE, xlate) +extern struct dentry *phy_debug_root; +static inline void phy_set_drvdata (struct phy *phy,void *data) {dev_set_drvdata (&phy->dev, data);
Signature · 1 line
2.18.0
Chunfeng Yun
maintainerPATCH v2 2/2 phy: mediatek: tphy: add debugfs files
These debugfs files are mainly used to make eye diagram test easier, especially helpful to do HQA test for a new IC without efuse enabled.
---
v2: add CONFIG_PHY_MTK_TPHY_DEBUGFS suggested by AngeloGioacchino
--- drivers/phy/mediatek/Kconfig | 5 + drivers/phy/mediatek/phy-mtk-tphy.c | 403 +++++++++++++++++++++++++++- 2 files changed, 407 insertions(+), 1 deletion(-)
drivers/phy/mediatek/Kconfig +5 -0
@@ -27,6 +27,11 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second version, so you can easily distinguish them by banks layout. +config PHY_MTK_TPHY_DEBUGFS + bool "Add T-PHY Debugfs Files" + help + Say Y here to add debugfs files mainly for T-PHY HQA test. + config PHY_MTK_UFS tristate "MediaTek UFS M-PHY driver" depends on ARCH_MEDIATEK || COMPILE_TEST
drivers/phy/mediatek/phy-mtk-tphy.c +402 -1
457 lines not on this page · raw message
Signature · 1 line
2.18.0
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 2/2] phy: mediatek: tphy: add debugfs files
Il 29/09/22 10:09, Chunfeng Yun ha scritto:
Quoted 49 lines
These debugfs files are mainly used to make eye diagram test easier, especially helpful to do HQA test for a new IC without efuse enabled.
Signed-off-by Chunfeng Yun <[email protected]>---
v2: addCONFIG_PHY_MTK_TPHY_DEBUGFSsuggested by AngeloGioacchino--- drivers/phy/mediatek/Kconfig | 5 + drivers/phy/mediatek/phy-mtk-tphy.c | 403 +++++++++++++++++++++++++++- 2 files changed, 407 insertions(+), 1 deletion(-)drivers/phy/mediatek/Kconfig +5
-0@@ -27,6 +27,11 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second version, so you can easily distinguish them by banks layout. +config PHY_MTK_TPHY_DEBUGFS + bool "Add T-PHY Debugfs Files" + help + Say Y here to add debugfs files mainly for T-PHY HQA test. + config PHY_MTK_UFS tristate "MediaTek UFS M-PHY driver" depends on ARCH_MEDIATEK || COMPILE_TESTdrivers/phy/mediatek/phy-mtk-tphy.c +3
-0@@ -7,6 +7,7 @@#include <dt-bindings/phy/phy.h> #include <linux/clk.h> +#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/mfd/syscon.h> @@ -264,6 +265,8 @@#define TPHY_CLKS_CNT 2 +#define USER_BUF_LEN (count) min_t(size_t, 8, (count)) +enum mtk_phy_version {MTK_PHY_V1 =1 ,MTK_PHY_V2 ,
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_phy_instance { · line 316
Quoted 4 lines
drivers/phy/mediatek/phy-mtk-tphy.c +1
-0@@ -310,6 +313,7 @@ struct mtk_phy_instance {struct clk_bulk_data clks[TPHY_CLKS_CNT ];u32 index;u32 type; +struct dentry *dbgfs;
Unused when !IS_ENABLED(CONFIG_PHY_MTK_TPHY_DEBUGFS)
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_tphy { · line 339
Quoted 8 lines
drivers/phy/mediatek/phy-mtk-tphy.c +1
-0struct regmap *type_sw;u32 type_sw_reg;u32 type_sw_index;@@ -332,10 +336,389 @@ struct mtk_tphy {const struct mtk_phy_pdata *pdata;struct mtk_phy_instance **phys;int nphys; +struct dentry *dbgfs_root;
Same here
Quoted 6 lines
drivers/phy/mediatek/phy-mtk-tphy.c +2
-0int src_ref_clk;/* MHZ, reference clock for slew rate calibrate */ int src_coef;/* coefficient for slew rate calibrate */ }; +#if IS_ENABLED (CONFIG_PHY_MTK_TPHY_DEBUGFS ) +
..snip..
drivers/phy/mediatek/phy-mtk-tphy.c
Quoted 2 lines
drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+ +static void tphy_debufs_init (struct mtk_tphy *tphy,struct mtk_phy_instance *inst)
Please fix typo "debufs" -> "debugfs", here and everywhere else.
Apart from that, it looks good to me.
Regards,
Angelo
Chunfeng Yun
maintainerRe: [PATCH v2 2/2] phy: mediatek: tphy: add debugfs files
Quoted 49 lines · AngeloGioacchino Del Regno
Il 29/09/22 10:09, Chunfeng Yun ha scritto:
Quoted 48 lines
These debugfs files are mainly used to make eye diagram test easier,
especially helpful to do HQA test for a new IC without efuse enabled.Signed-off-by Chunfeng Yun <[email protected]>---
v2: addCONFIG_PHY_MTK_TPHY_DEBUGFSsuggested by AngeloGioacchino--- drivers/phy/mediatek/Kconfig | 5 + drivers/phy/mediatek/phy-mtk-tphy.c | 403 +++++++++++++++++++++++++++- 2 files changed, 407 insertions(+), 1 deletion(-)drivers/phy/mediatek/Kconfig +5
-0@@ -27,6 +27,11 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second version, so you can easily distinguish them by banks layout. +config PHY_MTK_TPHY_DEBUGFS + bool "Add T-PHY Debugfs Files" + help + Say Y here to add debugfs files mainly for T-PHY HQA test. + config PHY_MTK_UFS tristate "MediaTek UFS M-PHY driver" depends on ARCH_MEDIATEK || COMPILE_TESTdrivers/phy/mediatek/phy-mtk-tphy.c +1
-0@@ -7,6 +7,7 @@#include <dt-bindings/phy/phy.h> #include <linux/clk.h> +#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/mfd/syscon.h> @@ -264,6 +265,8 @@#define TPHY_CLKS_CNT 2
Quoted 12 lines
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_phy_instance { · line 316
Quoted 10 lines
drivers/phy/mediatek/phy-mtk-tphy.c +3
-0+#define USER_BUF_LEN (count) min_t(size_t, 8, (count)) +enum mtk_phy_version {MTK_PHY_V1 =1 ,MTK_PHY_V2 ,@@ -310,6 +313,7 @@ struct mtk_phy_instance {struct clk_bulk_data clks[TPHY_CLKS_CNT ];u32 index;u32 type; +struct dentry *dbgfs;Unused when !IS_ENABLED(CONFIG_PHY_MTK_TPHY_DEBUGFS)
Yes, it will be NULL.
Quoted 22 lines
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_tphy { · line 339
Quoted 9 lines
drivers/phy/mediatek/phy-mtk-tphy.c +1
-0struct regmap *type_sw;u32 type_sw_reg;u32 type_sw_index;@@ -332,10 +336,389 @@ struct mtk_tphy {const struct mtk_phy_pdata *pdata;struct mtk_phy_instance **phys;int nphys; +struct dentry *dbgfs_root;Same here
Quoted 7 lines
drivers/phy/mediatek/phy-mtk-tphy.c +0
-0int src_ref_clk;/* MHZ, reference clock for slew rate calibrate */
intsrc_coef; /* coefficient for slew rate calibrate */
};drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+#if IS_ENABLED (CONFIG_PHY_MTK_TPHY_DEBUGFS ) +..snip..
Quoted 5 lines
Quoted 3 lines
drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+ +static void tphy_debufs_init(struct mtk_tphy *tphy, struct
mtk_phy_instance*inst)Please fix typo "debufs" -> "debugfs",
Will fix it, thanks a lot
Quoted 6 lines
here and everywhere else.
Apart from that, it looks good to me.
Regards,
Angelo
AngeloGioacchino Del Regno
maintainerRe: [PATCH v2 2/2] phy: mediatek: tphy: add debugfs files
Il 06/10/22 16:42, Chunfeng Yun ha scritto:
Quoted 62 lines · AngeloGioacchino Del Regno
Quoted 49 lines
Il 29/09/22 10:09, Chunfeng Yun ha scritto:
Quoted 48 lines
These debugfs files are mainly used to make eye diagram test easier,
especially helpful to do HQA test for a new IC without efuse enabled.Signed-off-by Chunfeng Yun <[email protected]>---
v2: addCONFIG_PHY_MTK_TPHY_DEBUGFSsuggested by AngeloGioacchino--- drivers/phy/mediatek/Kconfig | 5 + drivers/phy/mediatek/phy-mtk-tphy.c | 403 +++++++++++++++++++++++++++- 2 files changed, 407 insertions(+), 1 deletion(-)drivers/phy/mediatek/Kconfig +5
-0@@ -27,6 +27,11 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second version, so you can easily distinguish them by banks layout. +config PHY_MTK_TPHY_DEBUGFS + bool "Add T-PHY Debugfs Files" + help + Say Y here to add debugfs files mainly for T-PHY HQA test. + config PHY_MTK_UFS tristate "MediaTek UFS M-PHY driver" depends on ARCH_MEDIATEK || COMPILE_TESTdrivers/phy/mediatek/phy-mtk-tphy.c +1
-0@@ -7,6 +7,7 @@#include <dt-bindings/phy/phy.h> #include <linux/clk.h> +#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/mfd/syscon.h> @@ -264,6 +265,8 @@#define TPHY_CLKS_CNT 2Quoted 12 lines
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_phy_instance { · line 316
Quoted 10 lines
drivers/phy/mediatek/phy-mtk-tphy.c +3
-0+#define USER_BUF_LEN (count) min_t(size_t, 8, (count)) +enum mtk_phy_version {MTK_PHY_V1 =1 ,MTK_PHY_V2 ,@@ -310,6 +313,7 @@ struct mtk_phy_instance {struct clk_bulk_data clks[TPHY_CLKS_CNT ];u32 index;u32 type; +struct dentry *dbgfs;Unused when !IS_ENABLED(CONFIG_PHY_MTK_TPHY_DEBUGFS)
Quoted 2 lines
Yes, it will be NULL.
I was meaning that you should ifdef that out...
Regards,
Angelo
Quoted 36 lines
Quoted 22 lines
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_tphy { · line 339
Quoted 9 lines
drivers/phy/mediatek/phy-mtk-tphy.c +1
-0struct regmap *type_sw;u32 type_sw_reg;u32 type_sw_index;@@ -332,10 +336,389 @@ struct mtk_tphy {const struct mtk_phy_pdata *pdata;struct mtk_phy_instance **phys;int nphys; +struct dentry *dbgfs_root;Same here
Quoted 7 lines
drivers/phy/mediatek/phy-mtk-tphy.c +0
-0int src_ref_clk;/* MHZ, reference clock for slew rate calibrate */
intsrc_coef; /* coefficient for slew rate calibrate */
};drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+#if IS_ENABLED (CONFIG_PHY_MTK_TPHY_DEBUGFS ) +..snip..
Quoted 5 lines
Quoted 3 lines
drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+ +static void tphy_debufs_init(struct mtk_tphy *tphy, struct
mtk_phy_instance*inst)Please fix typo "debufs" -> "debugfs",
Will fix it, thanks a lot
Quoted 6 lines
here and everywhere else.
Apart from that, it looks good to me.
Regards,
Angelo
Signature · 6 lines
AngeloGioacchino Del Regno Software Engineer Collabora Ltd. Platinum Building, St John's Innovation Park, Cambridge CB4 0DS, UK Registered in England & Wales, no. 5513718
Chunfeng Yun
maintainerRe: [PATCH v2 2/2] phy: mediatek: tphy: add debugfs files
Quoted 68 lines · AngeloGioacchino Del Regno
Il 06/10/22 16:42, Chunfeng Yun ha scritto:
Quoted 67 lines
Quoted 64 lines · AngeloGioacchino Del Regno
Il 29/09/22 10:09, Chunfeng Yun ha scritto:
Quoted 57 lines
These debugfs files are mainly used to make eye diagram test easier,
especially helpful to do HQA test for a new IC without efuse enabled.Signed-off-by Chunfeng Yun <[email protected]>---
v2: addCONFIG_PHY_MTK_TPHY_DEBUGFSsuggested by
AngeloGioacchino--- drivers/phy/mediatek/Kconfig | 5 + drivers/phy/mediatek/phy-mtk-tphy.c | 403 +++++++++++++++++++++++++++- 2 files changed, 407 insertions(+), 1 deletion(-)drivers/phy/mediatek/Kconfig +4
-0@@ -27,6 +27,11 @@ config PHY_MTK_TPHY multi-ports is first version, otherwise is second version, so you can easily distinguish them by banks layout. +config PHY_MTK_TPHY_DEBUGFS + bool "Add T-PHY Debugfs Files" + help + Say Y here to add debugfs files mainly for T-PHY HQAtest.
drivers/phy/mediatek/Kconfig +1
-0+ config PHY_MTK_UFS tristate "MediaTek UFS M-PHY driver" depends on ARCH_MEDIATEK || COMPILE_TESTdrivers/phy/mediatek/phy-mtk-tphy.c +3
-0@@ -7,6 +7,7 @@#include <dt-bindings/phy/phy.h> #include <linux/clk.h> +#include <linux/debugfs.h> #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/mfd/syscon.h> @@ -264,6 +265,8 @@#define TPHY_CLKS_CNT 2 +#define USER_BUF_LEN (count) min_t(size_t, 8, (count)) +enum mtk_phy_version {MTK_PHY_V1 =1 ,MTK_PHY_V2 ,drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_phy_instance { · line 316
Quoted 4 lines
drivers/phy/mediatek/phy-mtk-tphy.c +1
-0@@ -310,6 +313,7 @@ struct mtk_phy_instance {struct clk_bulk_data clks[TPHY_CLKS_CNT ];u32 index;u32 type; +struct dentry *dbgfs;Unused when !IS_ENABLED(CONFIG_PHY_MTK_TPHY_DEBUGFS)
Quoted 4 lines
Quoted 2 lines
Yes, it will be NULL.
I was meaning that you should ifdef that out...
That's no side-effect, but just wastes some bytes, leave it unchanged
Quoted 42 lines
Regards,
AngeloQuoted 36 lines
Quoted 22 lines
drivers/phy/mediatek/phy-mtk-tphy.c struct mtk_tphy { · line 339
Quoted 9 lines
drivers/phy/mediatek/phy-mtk-tphy.c +1
-0struct regmap *type_sw;u32 type_sw_reg;u32 type_sw_index;@@ -332,10 +336,389 @@ struct mtk_tphy {const struct mtk_phy_pdata *pdata;struct mtk_phy_instance **phys;int nphys; +struct dentry *dbgfs_root;Same here
Quoted 7 lines
drivers/phy/mediatek/phy-mtk-tphy.c +0
-0int src_ref_clk;/* MHZ, reference clock for slew rate calibrate */
intsrc_coef; /* coefficient for slew rate calibrate */
};drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+#if IS_ENABLED (CONFIG_PHY_MTK_TPHY_DEBUGFS ) +..snip..
Quoted 5 lines
Quoted 3 lines
drivers/phy/mediatek/phy-mtk-tphy.c +2
-0+ +static void tphy_debufs_init(struct mtk_tphy *tphy, struct
mtk_phy_instance*inst)Please fix typo "debufs" -> "debugfs",
Will fix it, thanks a lot
Quoted 6 lines
here and everywhere else.
Apart from that, it looks good to me.
Regards,
Angelo