Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

phy: zynqmp: Add debugfs support

Add support for printing some basic status information to debugfs. This
is helpful when debugging phy consumers to make sure they are configuring
the phy appropriately.

Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
Link: https://lore.kernel.org/r/20240628205540.3098010-6-sean.anderson@linux.dev
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Sean Anderson and committed by
Vinod Koul
04490b62 d79c6840

+40
+40
drivers/phy/xilinx/phy-zynqmp.c
··· 13 13 */ 14 14 15 15 #include <linux/clk.h> 16 + #include <linux/debugfs.h> 16 17 #include <linux/delay.h> 17 18 #include <linux/io.h> 18 19 #include <linux/kernel.h> ··· 123 122 #define ICM_PROTOCOL_USB 0x3 124 123 #define ICM_PROTOCOL_DP 0x4 125 124 #define ICM_PROTOCOL_SGMII 0x5 125 + 126 + static const char *const xpsgtr_icm_str[] = { 127 + [ICM_PROTOCOL_PD] = "none", 128 + [ICM_PROTOCOL_PCIE] = "PCIe", 129 + [ICM_PROTOCOL_SATA] = "SATA", 130 + [ICM_PROTOCOL_USB] = "USB", 131 + [ICM_PROTOCOL_DP] = "DisplayPort", 132 + [ICM_PROTOCOL_SGMII] = "SGMII", 133 + }; 126 134 127 135 /* Test Mode common reset control parameters */ 128 136 #define TM_CMN_RST 0x10018 ··· 798 788 } 799 789 800 790 /* 791 + * DebugFS 792 + */ 793 + 794 + static int xpsgtr_status_read(struct seq_file *seq, void *data) 795 + { 796 + struct device *dev = seq->private; 797 + struct xpsgtr_phy *gtr_phy = dev_get_drvdata(dev); 798 + struct clk *clk; 799 + u32 pll_status; 800 + 801 + mutex_lock(&gtr_phy->phy->mutex); 802 + pll_status = xpsgtr_read_phy(gtr_phy, L0_PLL_STATUS_READ_1); 803 + clk = gtr_phy->dev->clk[gtr_phy->refclk]; 804 + 805 + seq_printf(seq, "Lane: %u\n", gtr_phy->lane); 806 + seq_printf(seq, "Protocol: %s\n", 807 + xpsgtr_icm_str[gtr_phy->protocol]); 808 + seq_printf(seq, "Instance: %u\n", gtr_phy->instance); 809 + seq_printf(seq, "Reference clock: %u (%pC)\n", gtr_phy->refclk, clk); 810 + seq_printf(seq, "Reference rate: %lu\n", clk_get_rate(clk)); 811 + seq_printf(seq, "PLL locked: %s\n", 812 + pll_status & PLL_STATUS_LOCKED ? "yes" : "no"); 813 + 814 + mutex_unlock(&gtr_phy->phy->mutex); 815 + return 0; 816 + } 817 + 818 + /* 801 819 * Power Management 802 820 */ 803 821 ··· 974 936 975 937 gtr_phy->phy = phy; 976 938 phy_set_drvdata(phy, gtr_phy); 939 + debugfs_create_devm_seqfile(&phy->dev, "status", phy->debugfs, 940 + xpsgtr_status_read); 977 941 } 978 942 979 943 /* Register the PHY provider. */