From nobody Mon Feb 9 23:00:53 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 449A1314D24 for ; Fri, 16 Jan 2026 23:21:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768605673; cv=none; b=p193yS/Bqe57iazxeKZlI7XvWD2lYUD5A+y01pSSu3hr+blI6ZA6s6nE2KoOsBom1JG/44yaCD7BSOg5J7nIC6d8U1ZwamCEyQsKu9Lc5gB36NhKuEhj+K/SlczMYAXyWFOP4XQjPKHIgyFW+xDcNmpJZbLd5hvgNXrpnlWByhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768605673; c=relaxed/simple; bh=xMUCXc+T1mxqitUAHJsbyD7zN0MBtP33MxPyki89jC0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kkZOj8kw0vJmpYTzClT+qgU2kaby857kAL4wZ4E8uyrezph+kLhX/zzpyMM5pf8HCdrHliOImHDr1zVjVne3HuJACeR0alUlgSH/QgYK5wXDsxgDkLx0bzLeOjRIxZBTwO5RByTv8aUGfnGyuRzpF/umymQ4SBSHYQTJB2lN9Fc= 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=LrmK+vs3; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=BExXGGcL; arc=none smtp.client-ip=205.220.168.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="LrmK+vs3"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="BExXGGcL" Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60GND02h2527076 for ; Fri, 16 Jan 2026 23:21:10 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=LrmK+vs3pl9QnXnAIzwE/KX3U5R AA/wRxhoSRzPD6wqNN+jObeSXQZGlyYn/OgYT5zwMkpoSAemPX9kYS6MVQMxJkDt CbxR78LmbWNqDwnAwTrQhMPx8DVnh5LSIy3wzNkFj2C5WmhBuTxNth76Bf+stJhB JU9RtacdiB4gxwXJKvKRepiGCMDW8uZJ8vYjaBLaH9CHPC060mv9RYdQy2k+vL5H cfgOpj5sCVdevmaZjP6hUPHeVXgL/u3an4+4VgmTEpO2B5rcbvmK6AnevQ4IpKJn wzB7FXRiRKgTpIan0iAdARsXcSg8qxBTDUW6doMRQ/M2Z1TRhSgBpUp4YSA== Received: from mail-dl1-f69.google.com (mail-dl1-f69.google.com [74.125.82.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4bqvevgbds-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 16 Jan 2026 23:21:10 +0000 (GMT) Received: by mail-dl1-f69.google.com with SMTP id a92af1059eb24-11b9786fb51so15704099c88.1 for ; Fri, 16 Jan 2026 15:21:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1768605670; x=1769210470; 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=BExXGGcLoU4IGJvz+n8upaghoqqbtLKh3CajiIGHVSvWpe+64X79LUYZqu1I1mqYJd DSgZRBvnNxiMvFEhv+/DVZfxrm68jxJo6kyntkXdpOJR5Cs1fYFZoA3KQkA7C83NRpys RSKaoSrjZqLy1dnnIeK4n5p2org0k9YeUwxy/5LV28MUBC8LVMk4vIg3F1WCd/8W4Lv4 44tOhf13oR53KLK7vE+avWFXcQXMQT4xTvAuwdp3rWaTh+BbxpdDVfMXEir7z7F8JXtC 8GODSjaz18u0/0JFq1+q8Ivk/3ZPhJFVbisu3SNDubY92FOCj/Sc3T7woOlqYczsUjOz sEGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768605670; x=1769210470; 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=O5c4YHlhuA0TNhRd9SlZjrZwmR8A80gRofcmBCHH8/qsIpiJOmk310dhFuov5qWUGw XC5B950zn03J8KF6zyDXqyWvpxaIBIt4svNEhtHy+PQRjuhD/ybYd5glGTjjvCX+8qff 2VGhPvMwgxrVB9mRJk1H7C1XNxtnTX6oAlQeKPylwlIIUIWtQxXnZcrkn8zZr+5kymTK Taj7WOHMt+zJioaHiK0ksCcuPzLGdFfBIW1HpEstM9eGxDS7S3HgkNOWEpbcXv/GVxLc CfKv91JTX6EYa8RLs9F5GjJkrNvs4O6gmcLu4+HyLAV4WZ//cpWTUz7hRwVKXk1RTKmF eIbQ== X-Forwarded-Encrypted: i=1; AJvYcCVNXTwtoY0nmhRSVmx0fiRtv0T9wxXpSpIKrpcIjFub1B3ZcXViFDQ68bDrzXuOoYy9fTpWHBiuoTiC3E0=@vger.kernel.org X-Gm-Message-State: AOJu0YwNHfAXrJHA7arbauM3P4ZraqMgsvIWUM+2OGSLblbPxQfZto0a Xjco6mm2zLLggPnkLDc0jFvrjMlZwWYK1ZzmT3hoh822uc1L9heP3hTGBb9Fzyfnc4X6+mwgGYk lRdJl+7CMzFJiDn7ECUq/+4XPHXzvtFQf3lGQwdV28hnhPyADSUzhIFJwAaaX6ZUE9hNW9J7v3o I= X-Gm-Gg: AY/fxX6mSkSJL3PrtoYOsCQPOXH67H86nJFzwKtBR1xvE+eACpkdOGcf1t1ttqcQga3 9rFBpR9NZEkHkCfnO6VQXvULnqU6SxytQxq/q0qBJGVGuQN1BRV4hCuSQNTQKgS2SLkHaB5eBT9 jBElHzTBaptMYK+L52zr5hwkOmuP19maF3gTzZFRp7FKQXxC7NTLTC99PaSc2zS3a1NZOZfYV0u HMCLfG5jGlYjCb5JS/ZwmhA1mDAjUzwWidXS93POfEMEs2iVqNlyjgdF4K/dR/7HzwdMcKg7tCc 8rUwn9uuaVGePEo65NPUWefLfmnnMWCFQcunm7JQz2cM5FBp9vdBL04SPwGOcmnuP8xcPnLrDVs gmqj0pqoWomAXOQE9bSsvhhOhRC1vNtYz4DNBOhmsXBEqpRsH8CNG5R2Fv4bFuIU= X-Received: by 2002:a05:7022:4189:b0:11b:9386:8262 with SMTP id a92af1059eb24-1244a7a547emr3764395c88.47.1768605669579; Fri, 16 Jan 2026 15:21:09 -0800 (PST) X-Received: by 2002:a05:7022:4189:b0:11b:9386:8262 with SMTP id a92af1059eb24-1244a7a547emr3764373c88.47.1768605669044; Fri, 16 Jan 2026 15:21:09 -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-1244af10e21sm4611267c88.16.2026.01.16.15.21.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jan 2026 15:21:08 -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 2/9] usb: misc: qcom_eud: add sysfs attribute for port selection Date: Fri, 16 Jan 2026 15:20:59 -0800 Message-Id: <20260116232106.2234978-3-elson.serrao@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260116232106.2234978-1-elson.serrao@oss.qualcomm.com> References: <20260116232106.2234978-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-Spam-Details-Enc: AW1haW4tMjYwMTE2MDE3NSBTYWx0ZWRfX4ft3BTvoGYIW /Ei3locPE534glfS5pRPZ0P6zxdYPKPRBqf7N0vWQTmVczI9KAOAJg/WFQY7QhodrG1I0PXQKtx bsx7mS5NByia1QgOu/aQXa3oDCwpPPZ44xAIdaFg4esVPk9agcn2VZURtiYoRbEIJ8VWk9fajAf BVudNeiHR7qgtsXJcNKx58H8jw75FWd0GN0zt3bq3KhB5SyXnqmXwzqX7N2igUAd7ex7cLqzYyo QbCqZoYvp/ttCJfg07a8xwJjf5NdOrnUWPW4pZ6uizopcVKkkhkRSWWJO7vi3i20Z+W5R7jKld9 ikE+s92ysFeeCRu/dq9Blzui3BYgeraItWdO17WZtQG2Rud/WUzT5p73R/eY9TGKoI35dggexk2 M2e0EuSKZ/u4eW1tQeer0uQe6W7RCIaHjzGsdikR+u0dMB/i1naDxsdqhePWRfS1YcuLoSX3I4r jUItKTF2R2YUrbgOU4w== X-Proofpoint-GUID: 4t1rH6BlrrwuG7Z6bN8r-zm9PJLfHjpA X-Authority-Analysis: v=2.4 cv=faugCkQF c=1 sm=1 tr=0 ts=696ac7e6 cx=c_pps a=kVLUcbK0zfr7ocalXnG1qA==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=un400R04Xmhap_XYEvQA:9 a=vr4QvYf-bLy2KjpDp97w:22 X-Proofpoint-ORIG-GUID: 4t1rH6BlrrwuG7Z6bN8r-zm9PJLfHjpA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.100.49 definitions=2026-01-16_08,2026-01-15_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 adultscore=0 suspectscore=0 spamscore=0 bulkscore=0 priorityscore=1501 malwarescore=0 clxscore=1011 phishscore=0 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601160175 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