Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp22999lqh; Mon, 6 May 2024 10:02:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrBKgDWzp6uTBVD7yBomOAc1CeoPJdt1HISY1uqvyi0v01txdBw68iM1NL4s5gQzuuF6FNS5x5OO1eAF6Uj+Co7d91HpCjuizjq1YE8w== X-Google-Smtp-Source: AGHT+IE6sOqc3z1zfsqpKSqnzBehb9Uep4lVIwJBxWPE+IdmpraOtDWZu8AbeDWbv3OqcDXU2dL7 X-Received: by 2002:a05:6a20:12cb:b0:1aa:340e:237e with SMTP id v11-20020a056a2012cb00b001aa340e237emr13920793pzg.59.1715014957150; Mon, 06 May 2024 10:02:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715014957; cv=pass; d=google.com; s=arc-20160816; b=QlvRZkJIDCAXVbSAh2+lB5TfPEedI1ZSAMN+z9rgO5ttAteT1eWf2t+rh4GxErouLV 37kDLFWdjOouQjT8qbD+TjT6ppjstpUMajFp7hOyy4yiYOaTX8ZwAo1aTTU56FfajdlC arifGO3tE5dPn17C+ISgd7Q7n2VTNQszsgvSq6QNMHcLEFFRrM5HjZw/UtJsk32FvKm9 Ks9KqvNzjMB8zBtyjG2IgwazaB5cYL8nbonl0+CvWmUDL8R8vty966DQ8GF0IDTHx79K FnmhclDSW8Y6RlIrULFsuqHl2EQqKfINoIkTMVWy/C3XTugvLUwH8zKxcS8g9x6vIxsY aO2w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cymb81QFA90cgzVWyCG8xmXANdYL6hFgCIH16jTwgp4=; fh=q7tQHM/3mw530/NG0tnxgRi+88xJuLx0MjFmQlO4hbE=; b=SHq9Ex0uZK9dF5pBpzLPKlALGTNdyA4CfnkZAKbnpCwSi0nUdEMxn3O3qeRF4Y2OTc WdYzSg8axgNadGZEQolsjkp+LCYXY1HBnTZ4cNG7l1sQ055rTmIF0rJSR70MzWNxWoUy 2/QXORvmGkEaXDpG62ZSJZF4NNreI+FDIuInLwfHzHpz/+8hsOpfM5ivI4y58bilhBL9 nurN/D4/NcChy8ewpfI9E+oMIsDwDB6ETtj0o1OVj+xzsOlmXn0uVKMh3oGbGZvOV2un 8aHzcuC3lJVVxKQ1iMOiKr0QcYyFS5vW6DIT/GPOIqARGe30b2YzeVAQ/l9aMAHjpZvj bPEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SXnecchZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h36-20020a635324000000b0061c26673e52si7498048pgb.286.2024.05.06.10.02.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 10:02:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=SXnecchZ; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-170216-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170216-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BF56A282260 for ; Mon, 6 May 2024 17:02:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8270F158860; Mon, 6 May 2024 17:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="SXnecchZ" Received: from out-171.mta1.migadu.com (out-171.mta1.migadu.com [95.215.58.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19B87157E7A for ; Mon, 6 May 2024 17:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014884; cv=none; b=Vwgr7khMx+RX0b+qN0s7zTmKPEgDCKcfFsyb706qAp4etG7DGKVcj4fgkhA9brHk368dDowA+KI1f8VdKo3hrAaR5WRqBbWj2alO1BmTBM9LsEjPw8ZFYhmB/DWEoIM4UxLRsKlzWohynWJu7numCrjkhQ2+jU1xrhFhExZ5jCM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715014884; c=relaxed/simple; bh=d6Xfy4UCyWqdopD5dBNuP/bdXW74dEdd6XtFMyagUt8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ULHnHZ67lK3wurRGdFLPjNagCnvuME/gVNTz7qvBdeYgFETs090qSwAYYCqi84I86tuekhuBaWISCtGhpL6ba9u/gLJhysLmb/XzDDwPnb6r348xyFOVfSYzpgBesYxtrKeBPI4+zPTA+Ll1NqP/KkQrbJ9gpk19iZ6Sw88d2B8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=SXnecchZ; arc=none smtp.client-ip=95.215.58.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715014881; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cymb81QFA90cgzVWyCG8xmXANdYL6hFgCIH16jTwgp4=; b=SXnecchZOmlUkNSbT3EZ3jx8I+bsAi/ghp8tnGJNmS+mKzBpL5HXG/1PapWwZFLv6S+sLR 6acFddYtwbn6mI34/ZP51xk5qtiSAjMJ7RxCqhfeFb50rDfjgKe0dEah5xtEqzyE3x4RWO lN4Eh8FftU8x8Bnig++3q7DlvRSNjh8= From: Sean Anderson To: Laurent Pinchart , linux-phy@lists.infradead.org Cc: Vinod Koul , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Michal Simek , Kishon Vijay Abraham I , Sean Anderson Subject: [PATCH v2 4/4] phy: zynqmp: Add debugfs support Date: Mon, 6 May 2024 13:01:10 -0400 Message-Id: <20240506170110.2874724-5-sean.anderson@linux.dev> In-Reply-To: <20240506170110.2874724-1-sean.anderson@linux.dev> References: <20240506170110.2874724-1-sean.anderson@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 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 --- Changes in v2: - Use debugfs_create_devm_seqfile drivers/phy/xilinx/phy-zynqmp.c | 40 +++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqmp.c index b86fe2a249a8..2520c75a4a77 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -13,6 +13,7 @@ */ #include +#include #include #include #include @@ -123,6 +124,15 @@ #define ICM_PROTOCOL_DP 0x4 #define ICM_PROTOCOL_SGMII 0x5 +static const char *const xpsgtr_icm_str[] = { + [ICM_PROTOCOL_PD] = "powered down", + [ICM_PROTOCOL_PCIE] = "PCIe", + [ICM_PROTOCOL_SATA] = "SATA", + [ICM_PROTOCOL_USB] = "USB", + [ICM_PROTOCOL_DP] = "DisplayPort", + [ICM_PROTOCOL_SGMII] = "SGMII", +}; + /* Test Mode common reset control parameters */ #define TM_CMN_RST 0x10018 #define TM_CMN_RST_EN 0x1 @@ -788,6 +798,34 @@ static struct phy *xpsgtr_xlate(struct device *dev, return ERR_PTR(-EINVAL); } +/* + * DebugFS + */ + +static int xpsgtr_status_read(struct seq_file *seq, void *data) +{ + struct device *dev = seq->private; + struct xpsgtr_phy *gtr_phy = dev_get_drvdata(dev); + struct clk *clk; + u32 pll_status; + + mutex_lock(>r_phy->phy->mutex); + pll_status = xpsgtr_read_phy(gtr_phy, L0_PLL_STATUS_READ_1); + clk = gtr_phy->dev->clk[gtr_phy->refclk]; + + seq_printf(seq, "Lane: %u\n", gtr_phy->lane); + seq_printf(seq, "Protocol: %s\n", + xpsgtr_icm_str[gtr_phy->protocol]); + seq_printf(seq, "Instance: %u\n", gtr_phy->instance); + seq_printf(seq, "Reference clock: %u (%pC)\n", gtr_phy->refclk, clk); + seq_printf(seq, "Reference rate: %lu\n", clk_get_rate(clk)); + seq_printf(seq, "PLL locked: %s\n", + pll_status & PLL_STATUS_LOCKED ? "yes" : "no"); + + mutex_unlock(>r_phy->phy->mutex); + return 0; +} + /* * Power Management */ @@ -937,6 +975,8 @@ static int xpsgtr_probe(struct platform_device *pdev) gtr_phy->phy = phy; phy_set_drvdata(phy, gtr_phy); + debugfs_create_devm_seqfile(&phy->dev, "status", phy->debugfs, + xpsgtr_status_read); } /* Register the PHY provider. */ -- 2.35.1.1320.gc452695387.dirty