From nobody Mon Feb 9 17:35:39 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 B92EA3101AE for ; Mon, 26 Jan 2026 23:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769470718; cv=none; b=Jr3UuhRtOMwO9iKQJBFmirRR0hcEtzyTvBmQx5aJfwF0EDOpMO3RoYxD4uAVnhOMQ4ETD7fDwr6OHLwCRYkgq3dTbB7bYVmfqtSKJazGPPsqoJGVdOdp33eCdmjqkHS4L1TprLzP0CtMfpUYKMV7KzOkpNu7UMbYUtVsHC3cGc0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769470718; c=relaxed/simple; bh=xMUCXc+T1mxqitUAHJsbyD7zN0MBtP33MxPyki89jC0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xq5a8sLfOcQegv8LQ4DH7GQscD7Q0s9lsdoYdymEHGlEU5u0uGxIu7L7P/dKfxf3bpsdRKzz2YpZ7EUGwseEpwV0NFvUoYe46AtPW+5tdyKl9/drYMAZgCXUd/P0IUbud0t8eQvwKYRVLWoHN5TVizKCOf+n0Xglevnr2PAn9OY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=LQM47yFy; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=jC6Htphu; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="LQM47yFy"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="jC6Htphu" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60QKg8vb2733003 for ; Mon, 26 Jan 2026 23:38:35 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=X71iaS2pCQJ 5JwChEZnH7egZFDTUof/Ft5BQu4Wr5X8=; b=LQM47yFyeyh8lDyXc7+YIA53FFW Y/WCEZJiHdNW8Unkb1fmCh5B9uXfUcqi/hm5kQrRf0mwACtfwGayJB+QxUaG0e+N GjpFbW3BAs2rlxSJAYjQy40++u4EDyQf/HaSQf/0vd1MB23UeGuWYmZjj6wlBt/3 dRwtNAO2L+w+JVF3LhXcTLwvTpvs/6kbHGaESrhnb1gOyC0UCP9P43v1qFuKR0pF E9vnlvt1JJe/y4o84gC6Vh6Bsp3gQ+IKODr1R/pDWL8nmB8VpM8E+QV1xct187ox w10soBVm5Mmmh5n5VgwoVsiT5y5HAtLU/5Hz/HoLZ2MOdJ1Z0JuFR68RGNQ== Received: from mail-dl1-f70.google.com (mail-dl1-f70.google.com [74.125.82.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bxdv08qp2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 26 Jan 2026 23:38:35 +0000 (GMT) Received: by mail-dl1-f70.google.com with SMTP id a92af1059eb24-123840bf029so37593545c88.1 for ; Mon, 26 Jan 2026 15:38:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769470714; x=1770075514; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=X71iaS2pCQJ5JwChEZnH7egZFDTUof/Ft5BQu4Wr5X8=; b=jC6HtphudHaGci2yxAPdgNRxZnuGACF4blVXNU+3xUEj/WnhbKU1VoP6qyHukVP2+i vYClwKtteSmrmtUdTOSFn0iciQ/uAkMsRs+Nq1QD9Uu90npWtbRp0Bum6UF5IvDPQEan /4D4h9UqUEvlbgRlxQSjR12YH0c6yCwa31bsVeqTdNbDMJQIT+vBQOWCNgCCh8m38DUC U1jLPu9M3fwChJOFw0V9pAQxe0peAqezZwfj18dloFgzZe2dxmHCC60lEtVbx8ZUn5yg RTwNGIGLNxPQTkl7CU0FIEcPs6V2Zt1CM7AUKFmyeDDtW2NJdJ2KAs5qouo4XK2nrgBQ 0LgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769470714; x=1770075514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=X71iaS2pCQJ5JwChEZnH7egZFDTUof/Ft5BQu4Wr5X8=; b=HjyKPZsinb/zbwBqSRjZvsadNljMwpinSftkUdNgEouV8CugjI/91hDeU3UKwoIf42 3RluoOPNrK8aYMcPpQylfGtekloMISQt/aEkmHLKDyxBiwR54PtKhqoP0YSGYNzkaCpQ N40XNJebniLpDkzCsyTR5vqEXb5pnyKuxPKBXf+YL71+iWKNgVCvMwif4iVjvux4ZDsL nEojvPf7HtumR6XRdTZUgusynFxnPuBFMpM8cO8U8wv3sBJ9w++tqf7Ik6u/O9oiKD5K LheOGh2e2lOnIuj3g5DmqWLQPDlXTWBk6q2tTtNcosg5XCq4NCgMTl0wtgFnKcOnE0fO VH/Q== X-Forwarded-Encrypted: i=1; AJvYcCVWmKDIhBuEfqfnIRkQd4XAr03TwJ0mQGMiF2J8JTXZUMoEe9vJTCFWgXYDI6seJjGBpIFygOe/l0P9hpo=@vger.kernel.org X-Gm-Message-State: AOJu0YxihdkJ2RtuHotJfk7VcS6ZhssKFpzLxg7fPx8ezHb0Sw8nA3rD RdFZtZPduFXle5pW+W5kZH94bcj1WeYFBRKy50MsvJBLiSbHAw4fYLp/YJmIPqKPsgW4oGJI86D xDP4GBgWiDSzhY20Q5xBfuLwgVSZBoa9XhhdgZfi0FzckolwGhMeDPOUw/XYTczuYNis= X-Gm-Gg: AZuq6aKN/t27N19YlcbqqRHv57e9NjMYQQ8CZ5D8ol5/0Ax05SjrPE5vygRTJHVLrMu X9FzRtdGRzryZUg5KIU1bEz5Lz8TRcqe6w6bIpxUqdGLNi5TMwMGjOaRiZ40w/ZIKbKf8cz9lcH b+bGU0qBo95bPuePBxCkcDv/7KuekR2+6vgG/KIw3YQrJsPWhdffDbPZ0jQAgUWoGaGBktYUZch q7KprO4U3BtPRn4Xv8oJ+UIYHvmSxZ5k32UJVLQgCKfj8L1SbvTU0d8TELvDxVka6QC+4p471x3 aD1TZkylKivc+dCE7TkRf+9EsXzU+gW1XpePAsak6RWg4d8GWIDNwYvcTNCY+vZpoNQDwwyxzqb zllFeFsOQHzhSnGilT5gLvCpOJMY0sksS9SEiy9vBqL8wf+xcR/owf1zvBL/Xllc= X-Received: by 2002:a05:7022:699e:b0:11b:9386:a3cc with SMTP id a92af1059eb24-1248ec9c731mr3816965c88.45.1769470714191; Mon, 26 Jan 2026 15:38:34 -0800 (PST) X-Received: by 2002:a05:7022:699e:b0:11b:9386:a3cc with SMTP id a92af1059eb24-1248ec9c731mr3816945c88.45.1769470713660; Mon, 26 Jan 2026 15:38:33 -0800 (PST) Received: from hu-eserrao-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1247d90ce0dsm19948967c88.4.2026.01.26.15.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jan 2026 15:38:33 -0800 (PST) From: Elson Serrao To: Greg Kroah-Hartman , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Souradeep Chowdhury Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/9] usb: misc: qcom_eud: add sysfs attribute for port selection Date: Mon, 26 Jan 2026 15:38:23 -0800 Message-Id: <20260126233830.2193816-3-elson.serrao@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260126233830.2193816-1-elson.serrao@oss.qualcomm.com> References: <20260126233830.2193816-1-elson.serrao@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-GUID: bT4fTnHPPU1T2_Qa4uv2dorpOT5ljYcz X-Authority-Analysis: v=2.4 cv=SvedKfO0 c=1 sm=1 tr=0 ts=6977fafb cx=c_pps a=SvEPeNj+VMjHSW//kvnxuw==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=un400R04Xmhap_XYEvQA:9 a=Kq8ClHjjuc5pcCNDwlU0:22 X-Proofpoint-ORIG-GUID: bT4fTnHPPU1T2_Qa4uv2dorpOT5ljYcz X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI2MDIwMiBTYWx0ZWRfX6aYXIpVPCFBd 9sDLiGujGluC6nV/wYa0koE3u958WPBPvM21oF9YHGI8EnmLMDiE4dlPSoNpYsPwI1k2dzG8YfA tK5bxfXd6U5H03LKrPiseJWEs4nVVLEQJBWtaJgVfn7OjbSV5DbOEYg1pXFyQqUZ1122iIKht3E bUGK1kjjKBBH+rm1nsxr83/3K8JZgUKB4WU61edGCXR8badduDvXzRc4i1vdUC9C+5Dv2S9IqQU bFDVcgAsk6C/RmShLM0NLHy3xRRSI/XSazc0pe51jEa5/75L9jGKFp84ZUwjuf4QvvktlwS+S0k rOBLp9SW44vcS66/3wOyLAWzUe6Tn6lHzS/jzMuY3AVOC2I7R48mDNw4eUgKfSF32vKCIMHYfj7 hyjX5XBVNNCWPYHpr5xD955PVWgtnWDlBOrWJZUBjfPzswOltnmG4WKKcdcAIO0jlNPjX3r3vnC UXjFQEMv5WhMZ4kc2dQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.20,FMLib:17.12.100.49 definitions=2026-01-26_04,2026-01-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 adultscore=0 clxscore=1015 suspectscore=0 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601260202 Content-Type: text/plain; charset="utf-8" EUD can be mapped to either the primary USB port or the secondary USB port depending on the value of the EUD_PORT_SEL register. Add a 'port' sysfs attribute to allow userspace to select which port EUD should operate on and update the ABI documentation. This is needed for systems with dual USB ports where EUD needs to be accessible on either port depending on the system configuration and use case. Signed-off-by: Elson Serrao Reviewed-by: Konrad Dybcio --- Documentation/ABI/testing/sysfs-driver-eud | 16 ++++++++ drivers/usb/misc/qcom_eud.c | 43 ++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/Documentation/ABI/testing/sysfs-driver-eud b/Documentation/ABI= /testing/sysfs-driver-eud index 2bab0db2d2f0..67223f73ee60 100644 --- a/Documentation/ABI/testing/sysfs-driver-eud +++ b/Documentation/ABI/testing/sysfs-driver-eud @@ -7,3 +7,19 @@ Description: EUD based on a 1 or a 0 value. By enabling EUD, the user is able to activate the mini-usb hub of EUD for debug and trace capabilities. + +What: /sys/bus/platform/drivers/qcom_eud/.../port +Date: January 2026 +Contact: Elson Serrao +Description: + Selects which USB port the Embedded USB Debugger (EUD) + is mapped to on platforms providing multiple High-Speed + USB ports. + + Valid values: + 0 - Primary USB port + 1 - Secondary USB port + + The attribute is writable only while EUD is disabled. + Reading the attribute returns the currently selected + USB port number. diff --git a/drivers/usb/misc/qcom_eud.c b/drivers/usb/misc/qcom_eud.c index 926419ca560f..1a136f8f1ae5 100644 --- a/drivers/usb/misc/qcom_eud.c +++ b/drivers/usb/misc/qcom_eud.c @@ -23,8 +23,11 @@ #define EUD_REG_VBUS_INT_CLR 0x0080 #define EUD_REG_CSR_EUD_EN 0x1014 #define EUD_REG_SW_ATTACH_DET 0x1018 +#define EUD_REG_PORT_SEL 0x1028 #define EUD_REG_EUD_EN2 0x0000 =20 +#define EUD_MAX_PORTS 2 + #define EUD_ENABLE BIT(0) #define EUD_INT_PET_EUD BIT(0) #define EUD_INT_VBUS BIT(2) @@ -40,6 +43,7 @@ struct eud_chip { int irq; bool enabled; bool usb_attached; + u8 port_idx; }; =20 static int enable_eud(struct eud_chip *priv) @@ -104,8 +108,47 @@ static ssize_t enable_store(struct device *dev, =20 static DEVICE_ATTR_RW(enable); =20 +static ssize_t port_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct eud_chip *chip =3D dev_get_drvdata(dev); + + return sysfs_emit(buf, "%u\n", chip->port_idx); +} + +static ssize_t port_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct eud_chip *chip =3D dev_get_drvdata(dev); + u8 port; + int ret; + + ret =3D kstrtou8(buf, 0, &port); + if (ret) + return ret; + + /* Only port 0 and port 1 are valid */ + if (port >=3D EUD_MAX_PORTS) + return -EINVAL; + + /* Port selection must be done before enabling EUD */ + if (chip->enabled) { + dev_err(chip->dev, "Cannot change port while EUD is enabled\n"); + return -EBUSY; + } + + writel(port, chip->base + EUD_REG_PORT_SEL); + chip->port_idx =3D port; + + return count; +} + +static DEVICE_ATTR_RW(port); + static struct attribute *eud_attrs[] =3D { &dev_attr_enable.attr, + &dev_attr_port.attr, NULL, }; ATTRIBUTE_GROUPS(eud); --=20 2.34.1