From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8AFC6429822 for ; Fri, 15 May 2026 09:02:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778835736; cv=none; b=uDTJVY5+4+2HMlAPp6plR2eQVt+Z0Apg/v6MpCW/P7bLuA7MYxXyo53urVGdMRZjjhYCNi+pFx2JPGamImMSk4u6uauS5winZtUikM0LChpabebDCfkRX61MTfWrTAN+UcxkV3xZs6CyFLzUySXM6i5SCWcQN+w4pVzKyX4TP54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778835736; c=relaxed/simple; bh=QIk7JPCunkbKluanxQkxUv0yYQaC75cEo7KnXQQKbys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jaYEKaZATRiWhA3AA6vtbPF1HUin1YfD5r+DQxE1GrlHzL4/SuEbRGYhMfyoUBnXAlHAXxBcGkiLhQoiUAZc4QeHg2l3WiHN1J55msfE9Sgzi2NaVFYPCAD0sQVfbfkq9wNzHb2ao4cJWOrAhTqCO1CRk4wItVZXqzL68kMcdWM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=lPyRB48M; arc=none smtp.client-ip=209.85.216.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lPyRB48M" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-3665a90bcd3so7142355a91.1 for ; Fri, 15 May 2026 02:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1778835735; x=1779440535; 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=+04SKeVBhvRIfsHaTWxnqsLENnjwWESaqrABBm+vFKc=; b=lPyRB48MdySvrLxUPjSIJtXH9XTUO69dL/fHGI1Yh2IyKrtIa/VkpLd6MErLFlH6zz IckhG3nXnBSVeDkOEWWz6/7f/KU3o2A5sXsH8RSEh89U2rnM8EiP2liyKZgtZNDjgSY7 p3Eo4tPUhYr1t8YBuvnxG5NJirHq/IG0XQgaw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778835735; x=1779440535; 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=+04SKeVBhvRIfsHaTWxnqsLENnjwWESaqrABBm+vFKc=; b=FfZm8pPuH8Z10MvdT7sfSXvvTnqcoc3sQoA1qFRNcsHLvE8cxU94+tZpY9m4IHox7I 5bDgD7JuqbVNXoy98UTjyI6r/SodE2psmSCnWdwhsLV65kb9FmasRhyFr3RLdwDfpuDN gpva5SoyriCtnadGXnECrvRbXXPan1BCRSr2gZ4mQKGsX3utkrdYPyw68UG5Kq3IdkUO ItpbOPKNW+XAtxNGR2FhBBuBD/a55EHLUPdAljkRS1JlNz634zy67YilC6/BOz43mr5H wlDyutXIYTLL9vSIicxQMdkNpMh/HboLn9A4L9p4GPBLrNir3TbeIT+nguzHdrLmcOUQ BcJQ== X-Forwarded-Encrypted: i=1; AFNElJ8T2qEWu6yt+1GFjiNATzVCdxyV7ruhdg60NhWz2wIcYb4qYI84N/+PEAzJ2fDNU3d/rhQXptUfTuBSsPo=@vger.kernel.org X-Gm-Message-State: AOJu0YyrbJbs7Ah8MKJJ+r/1lZ4kO2UAPZVf09vnRei5K2A4KyR6KPJn TovyXLv+76QHsUwHAXhtgBGiCjgFhinf35pCSuhpJUUIGPRTHyNxYkqB07CQTYRYMBU6SKjKYCr ArCk= X-Gm-Gg: Acq92OHRzQT4sutdKREBEt1cCUncDW+7O6XbPZ3xK889nWkk4UIxUcVZrNVj3KBT54U hLJ4p/kPY7bkGaYLE5TgEBIb/C27d79MiV3nD+TPMljWFSikoa/7KnD7TGqaGkEZhdXxFs7PmHV hqQyMuLxXpjlLCgsaEeHY59+hpavZK6jA+IV99ojrjo7NzDIggTEkeTdYLOz9l8GDOY3gMwVgBE +mGME85KRPp+I0ub6NtjXCshgd3iEwKJvxm6ICVpRH1emAnXSuDYDFg4WjwPlv/Bh/W5k4FPm8F kTsgUXNyDahuDxVSD9m2QCTStIkhHs/4cG7EFTHODBzZnEZmueM5hsFs5SL9slaorLLbJCmPSba EsvKW3UYprcAjsMGlvDI0WZXbRYlpFzskl9h+jRPtstnmrYtqbO1ESGekqVF9pE15YadkVFsUCr y6oSOd49KMHqXtoIFnOf0ciXpXAwqDiBEtEG3lr6o9P90CBIgPp5PuzGul1XHbqVHoe8zmIZGE5 ADteJ9O X-Received: by 2002:a17:90b:50d0:b0:367:bb47:9fc2 with SMTP id 98e67ed59e1d1-369518bae79mr3243819a91.2.1778835734722; Fri, 15 May 2026 02:02:14 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2a00:79e0:201d:8:b3d8:e32e:c2fc:c31e]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-36951584654sm2076537a91.7.2026.05.15.02.02.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 02:02:14 -0700 (PDT) From: Chen-Yu Tsai To: Bartosz Golaszewski , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Manivannan Sadhasivam Subject: [PATCH RFC 02/12] power: sequencing: pcie-m2: implement port index matching Date: Fri, 15 May 2026 17:01:38 +0800 Message-ID: <20260515090149.3169406-3-wenst@chromium.org> X-Mailer: git-send-email 2.54.0.563.g4f69b47b94-goog In-Reply-To: <20260515090149.3169406-1-wenst@chromium.org> References: <20260515090149.3169406-1-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit For USB connections, the upstream USB (hub) device could be connected to multiple M.2 E-key slots (or other power sequencer providers) via different downstream USB ports. The provider needs a way to tell the different connections apart so that the correct provider is matched. In the previous change an index parameter was added for the consumer API and the provider matching function. Implement port matching using the index parameter. We simply check if the remote endpoint's port number matches the index. Signed-off-by: Chen-Yu Tsai --- drivers/power/sequencing/pwrseq-pcie-m2.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/power/sequencing/pwrseq-pcie-m2.c b/drivers/power/sequencing/pwrseq-pcie-m2.c index 16a332f9da7d..c9aed2c02e81 100644 --- a/drivers/power/sequencing/pwrseq-pcie-m2.c +++ b/drivers/power/sequencing/pwrseq-pcie-m2.c @@ -165,12 +165,28 @@ static int pwrseq_pcie_m2_match(struct pwrseq_device *pwrseq, /* * Traverse the 'remote-endpoint' nodes and check if the remote node's - * parent matches the OF node of 'dev'. + * parent matches the OF node of 'dev' and the port number matches + * 'index'. */ for_each_endpoint_of_node(ctx->of_node, endpoint) { + struct device_node *remote_ep __free(device_node) = + of_graph_get_remote_endpoint(endpoint); struct device_node *remote __free(device_node) = - of_graph_get_remote_port_parent(endpoint); - if (remote && (remote == dev_of_node(dev))) + of_graph_get_port_parent(remote_ep); + struct of_endpoint ep; + + if (!remote) + continue; + if (remote != dev_of_node(dev)) + continue; + /* For existing users of pwrseq_get(): index = -1 */ + if (index < 0) + return PWRSEQ_MATCH_OK; + + /* Check if the remote endpoint's port matches 'index'. */ + if (of_graph_parse_endpoint(remote_ep, &ep) < 0) + continue; + if (ep.port == index) return PWRSEQ_MATCH_OK; } -- 2.54.0.563.g4f69b47b94-goog