[PATCH v2 2/2] phy: mediatek: tphy: add debugfs files

Chunfeng Yun chunfeng.yun at mediatek.com
Thu Oct 6 07:42:15 PDT 2022


On Thu, 2022-09-29 at 11:02 +0200, AngeloGioacchino Del Regno wrote:
> Il 29/09/22 10:09, Chunfeng Yun ha scritto:
> > 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 <chunfeng.yun at mediatek.com>
> > ---
> > 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(-)
> > 
> > diff --git a/drivers/phy/mediatek/Kconfig
> > b/drivers/phy/mediatek/Kconfig
> > index 3125ecb5d119..e9fdfe9f519f 100644
> > --- a/drivers/phy/mediatek/Kconfig
> > +++ b/drivers/phy/mediatek/Kconfig
> > @@ -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
> > diff --git a/drivers/phy/mediatek/phy-mtk-tphy.c
> > b/drivers/phy/mediatek/phy-mtk-tphy.c
> > index e906a82791bd..d9509e1314a4 100644
> > --- a/drivers/phy/mediatek/phy-mtk-tphy.c
> > +++ b/drivers/phy/mediatek/phy-mtk-tphy.c
> > @@ -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,
> > @@ -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.

> 
> >   	struct 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
> 
> >   	int 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..
> 
> > +
> > +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

> here and everywhere else.
> 
> Apart from that, it looks good to me.
> 
> Regards,
> Angelo




More information about the Linux-mediatek mailing list