From nobody Sun Apr 5 13:04:34 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 322AD36C0BC for ; Mon, 9 Mar 2026 20:33:44 +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=1773088425; cv=none; b=es6V/Ewnj9b6OKlAVIOx1lYL5b3j9v5cg8x2+AQ/zfaMbLyn+GflE7n1ITthaikoZzI7EvNmd4SZhMrC7iA3W3I2n3EomddBKYl9dMkyrKqMc/8GVKtVNViZAxH3adMLChf2tHvwkQvYkKE7kkQBm0f86Thn4QzxFc5TzRU5iME= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773088425; c=relaxed/simple; bh=xMUCXc+T1mxqitUAHJsbyD7zN0MBtP33MxPyki89jC0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ocDBB+9gV0UsiN6TpfXOYf3V5ggFPzgkyok5Hewt624TWW7T6yY1UdcW69HAKtOvCD1NqJYaCC7kzpTCcDJ2mOGidGFZqcCz4DQnVM7dpUVhjluzmORFKa2fB6x5AAjYP/7L7owUUfIBE3CyBsJpaI/PYnZ0GZP8qH0PKTI+yXE= 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=gXD56n7V; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=Ylx/nzZr; 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="gXD56n7V"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Ylx/nzZr" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 629HBtgD2427754 for ; Mon, 9 Mar 2026 20:33:43 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=gXD56n7Vltq1K63b/yIvvsdXdTe wXrivOOGduoNWvIEzfy1D+wHWr88P2cUE2hQFEHWWOdh0POHnVLlm2tagvKSYyXx KysRy2+Z66iOyureCLTI0AVkQ9JFoKDw8v7Vsj+mOi6BaQ1BTOV/WvS7wXBqAl2c TGERFdPwkr9XKwev0Id50LrABQdGIP0dl9rup0NjHTBNgBf/reTF7+Kcyr/0QRHF hqqWMKJ02rQPQKkf46/PflBO4kpgMJhX2QHd4uFox9AyrySEjBA7mO2AKzVHjuKp WDejcFiKaJhUEIwILZAo/baju8Mcnk/6o7MV2uIBud+XEVQ9mJSkvaR1uIQ== Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4ct1ekrwjj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 09 Mar 2026 20:33:43 +0000 (GMT) Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-7d73bcdba71so23257222a34.3 for ; Mon, 09 Mar 2026 13:33:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1773088422; x=1773693222; 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=Ylx/nzZr5An7A4NqV5k7V/7DlEklPxHyvYtG0AD9+7dcERIQXgk97pUr3RlMRBV36M 4tNFH8zBCQ4cMO89Bch1/mKtVn6UbfF86gPt4KZepUIJPp/Z5qELeyCMxpN0M3hOnG59 71RQEUy/Sybwj6GO169k/Ln1llaYmR6XOPrXSDvVm7vwn+006J9A6lDoZusYcKfDLVTm 9rR2u527A5IvdRLvjWHgx7ifLTK86TfImh/oZEGmA7adgXZDiP1Bn8jdWU9KL9EDyaBs kLWwl4IepVA6907IW/e1VeJaqPxhvYTHWFqq3sgd6kVvNJxl9HC291yZiR9JZvLHJssJ d7hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773088422; x=1773693222; 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=KUMLWIAolvgwdQDrgi9140FF+f8cHtTJWD5GsmhQ8yBDC1MBlExjB2csBjRiv2G5QF mETTw2jG27BFP/c2j63qYzuTDL/3YE8sAg7AggzTy0eJpV/OinKQiRRsDk+xpWngJRep 2Q15pduSPY84Y4BPz/MwxOnDmGxpCQwUV02it05qO6B+4xkXvPbpSAcCTb3y7MLLrwKO q4n+JFV/VSo2+FAYRppAESXzdCqBPXJP/JTYcgHe45+dIEFPQCU/zdgeJ8EO4POSxhOX 3YPIBiZtYp/Y9hnc3C6iPCydcs67bNLbDeLVSJzTcMj7JhccEEM60QYIGvX4Nbjz9WCd FI5w== X-Forwarded-Encrypted: i=1; AJvYcCXm/m5Odoa+XLhHAw5UqPPeAxPeVtamC8r8x7iChRZFPvvAuN2jT5rtuEIu62GcNsWK2yu+BkM+fipaUkY=@vger.kernel.org X-Gm-Message-State: AOJu0YznLzGZ5Kat+UkT4vLluMam7Ll+UjrGiDHSXiGJqXO753DAbFsj 2vK7KWjKTIkcvCXQ7GHUGlvrIw011PJojCjBhhkIS96xeIu1rPTL8PKU25xFD6aRMmv5QvL/MLs IdGcfS6BR4TCogGTEghihG0wFxFHNHgL4oAtBJAT66iLgZzXCkJeH0FtNfmnQv6njMxw= X-Gm-Gg: ATEYQzyKnsGThDu+dBqvLkuGpoDpd1i59M6u+M42DO5S6z0s6cEl/2OuSsCLmPgfr9j ExDgGS5c5cvfJYQA2BX68+H6SONM9gomO++k5UnYiRKpm2/3aahom6komrNU8x0yVp14xcRC0sF OvgrAyM6hjITPj3AbIoXSQ1YGb/I1pIGXphYLbLAFyStMCYo2hZVOODXs9IPhFB51lANPCyo7Yb i6+e++9SnrYcTe9Z6lwqKTLSkrL9M1lLIyb/PmiWcMbOyR/4yi/7r2cQuLFq52SLB/XKJqwDPDX MEbR8M0x9lH2F5xbIhCy3FNFhdDxSbFxqKM0TebRXiylmkUahIczW45MvyxEuN7M2ybIDGlnUEN 4HuI/d8Cd8LtJ1dxraIv4ktbvFqdoE7EmoUgwCd2XCqFWojlkCt3yTQiT100PEyWSLCqeGs24gw A= X-Received: by 2002:a05:6830:3987:b0:7cf:d05f:3e57 with SMTP id 46e09a7af769-7d727028e32mr8409068a34.25.1773088421992; Mon, 09 Mar 2026 13:33:41 -0700 (PDT) X-Received: by 2002:a05:6830:3987:b0:7cf:d05f:3e57 with SMTP id 46e09a7af769-7d727028e32mr8409048a34.25.1773088421620; Mon, 09 Mar 2026 13:33:41 -0700 (PDT) Received: from hu-eserrao-lv.qualcomm.com (Global_NAT1.qualcomm.com. [129.46.96.20]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7d74885b5a4sm3036494a34.23.2026.03.09.13.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Mar 2026 13:33:41 -0700 (PDT) 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 RFC v3 02/10] usb: misc: qcom_eud: add sysfs attribute for port selection Date: Mon, 9 Mar 2026 13:33:29 -0700 Message-Id: <20260309203337.803986-3-elson.serrao@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260309203337.803986-1-elson.serrao@oss.qualcomm.com> References: <20260309203337.803986-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: mqqSXpB2bBUmF54e5mBh3H5HcG4I9ntY X-Proofpoint-ORIG-GUID: mqqSXpB2bBUmF54e5mBh3H5HcG4I9ntY X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMzA5MDE4MiBTYWx0ZWRfX8bVheNSsmdH8 APSwLin1suY7Nh3IxN6f1CULeE+G8k5voRlbngUa/P7pnN61Dmp+uE2+MBjFP9HPplg+FWI4PzK EN911VORGp64RYL0U5G7T+Dk+jZoZKudJLt2/S/D2V5VFXalpC5r1qlkKkFqXHvsRDy5t6RD/fG PE7So00HAcX7Bfr7Tc4KUaHEkKF5X64bQBfVGuX9eD+fXkQ3tFsLCGoWTiaFjsHxU6GgsPbTj7+ GMo+AmD0P1xAWM/3uVaAKOliUH7uzHWFNiW4FlEKiu5baUqD4bzlcaObb7W+k5tH9XTeOfXk9KG ECFzY1haxeg+G/gjLdbOjQNKA8AB2E7QdJSbF1s/8xlTAkibRwve5jyPRDIYhiB21N+iB/bRINE InVfDpN8oIBi5VVNHWiEpKeFvGzBFChPoIDdWbll+UAe1AMnY3cYE8VTcUgcPMvrjfEjh6FMzOW rLKtfXZxHJmCofmYQHg== X-Authority-Analysis: v=2.4 cv=eIEeTXp1 c=1 sm=1 tr=0 ts=69af2ea7 cx=c_pps a=7uPEO8VhqeOX8vTJ3z8K6Q==:117 a=ouPCqIW2jiPt+lZRy3xVPw==:17 a=Yq5XynenixoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=DJpcGTmdVt4CTyJn9g5Z:22 a=EUspDBNiAAAA:8 a=un400R04Xmhap_XYEvQA:9 a=EXS-LbY8YePsIyqnH6vw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-03-09_05,2026-03-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 bulkscore=0 lowpriorityscore=0 adultscore=0 suspectscore=0 spamscore=0 priorityscore=1501 malwarescore=0 clxscore=1015 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2602130000 definitions=main-2603090182 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 --- 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