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 56E4D1C84A6 for ; Thu, 20 Nov 2025 21:39:01 +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=1763674743; cv=none; b=hV/LbexpB2D15cop8xok4z0cAIpNRvldmIU/FKrnKmwIhEF01pxKwSxIetnx1CYGpGEbf07Nch8bLu6WOIzPUi6JG6me0gAi8pFxmkRB63igBRzMH8uprxqGRIVPivcDrm+X8HPaBKHbNfqsWQpyx8NOR1bA6xJ6Z+Jor8/xtUQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763674743; c=relaxed/simple; bh=jlXatnOOS0O+6oIGmGevkUtTMaMhk33D/tJLA8PWWcA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=gr2E0/kOuj/xdgmu9tLTWh4PMmqvQuUBKbPFg2NKnL0rUQIa/Zgjtrv2rClo+cdZQ6kco0B+y2cIsuz4LY6pt56fYaj2GExDAz0c7CZS8jaeahuojhy1NAvliM2yLR93yULdkuiUaPwMgyko/GZ1rhFMfA/2mpRDb/FpS2oFm2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=JSAxvQum; arc=none smtp.client-ip=209.85.216.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JSAxvQum" Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-34101107cc8so1123457a91.0 for ; Thu, 20 Nov 2025 13:39:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763674741; x=1764279541; darn=vger.kernel.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=x7O/40bLxFz/ubc4QGbFz1RJXJpAvzSB31xunK5lGsY=; b=JSAxvQumM4eitYdCcfj17m3CuNI1tcYmJBEJNFgqXMtYAOQwpjNGthwlI/ud3j0bTk lJ2BbPWY85VFcilJVEXufDf7R0zzAtO7xyVZTde8m/ss1RGd9D9xUuwQ4eT6onhLQlHu ZRfN2WasdDsi4/5YqtxEe0hgEWMMrIXS3uFy3sRIe6RXlJyQzjRJ/YlYK4iRssxVtv6H cGeSZaPCQVqBaYgOEPrk/hfKnCb48qInHka9DZex317cGmLkP1vfvoxn7eZp3vO4BQoY 8PrOPGdEwzwFIwlM6viYbBDDFlPj+pHdyNxK1kfiiD5PEU05/SDZ5z7VwMZICoQHSB0O zRjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763674741; x=1764279541; h=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=x7O/40bLxFz/ubc4QGbFz1RJXJpAvzSB31xunK5lGsY=; b=w3RCw0kSLYfevSc48doPc7zQrOGlKmRuiBKoe+3Bc46ZueeZN6Z+cQNFu2a6ksBemG mGQPz3qySxIqfE3GP0v8P384dDvsoAffniUvkI/H3BeKwpFAc0DlPhZWGT8xixiyuE3C 8k3nExTBJJljX1i92J9LTkqbfpVwuAK95c4lJz8PcjqoOfNHxRO0s6uR6ie5jsajCryI gHQuJvcshdvtE/0WhFUbOSWyOjWsRfQszrWvi7Hc+EarRuDWZ08Ui7QxN95rfcoQ2lEQ 9UtuvLgGEZQeOuv/5EG+6SjOiOsVeTXy3D+T1Cum+QtdXfuudN7Yg2QjEJgomSXQv4vZ ul/g== X-Gm-Message-State: AOJu0YxYKNUi9Su8QVc/4rLbiBikEJ12v7epMYKyeBpIJA5oRxRpxSs/ FIO7X0fYyWiBmK+4/GP0oXM8bM4PyZd+J0DRNpRzxtMzjgSlLx4Zbayg X-Gm-Gg: ASbGncuzenBqJgApnITEaikExmlZ99Ti7haZmVwomM61LG23SKpLovXDGrfge3rHi30 Bw0gx+8BXOSOoL+7R/hZdJboqIWcGcW560MoCATt674fuuArYB5eqJxTmYU17TnvCgEyXJoAg5q 2DMWtF0+F8MKgBBgvxRk4KYBIwSgvnAi55SWWfXoVfBbhkSf7DaQigNMRha+oGeKfcnlqNUBVui 2yq2McZ7Ek/hh5ZUyZUcNPGXeqXFRxI3IQaXv4F5MWLhMwUPtZYKRcBUv3p6JK33xJn+FuV+QJc 0GXJHaKUKKw8Q4Ik3ey9kZJ+jTn58xBgZON+q9Fi49H1++8P9dE2/JjNjPf16IDO89e7OdUS4he 4KFjRtSbZFhSiH4k57uhnxsFbT3ZPkp/aCU0WVvLlLTWOvhWElwulmXSzjsNkt/DUwNA/3h0mw4 kq36oNtg== X-Google-Smtp-Source: AGHT+IFk2zNyEwkfMF+EqHHJ2lA9JWu8koRD6/b0KgaWv3WfMDkuD91zEkWIPZNe5l/6fSMM5LpsOQ== X-Received: by 2002:a17:90b:4c89:b0:340:cb18:922 with SMTP id 98e67ed59e1d1-34727bedd4emr4929684a91.14.1763674741359; Thu, 20 Nov 2025 13:39:01 -0800 (PST) Received: from SC-GAME.lan ([104.28.206.182]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-34727d6f48bsm3325479a91.17.2025.11.20.13.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 13:39:00 -0800 (PST) From: Chen Minqiang To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , "Chester A. Unal" , Daniel Golle , DENG Qingfang , Sean Wang , Andrew Lunn Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, netdev@vger.kernel.org, Chen Minqiang Subject: [PATCH v2 2/2] net: dsa: mt7530: fix active-low reset sequence Date: Fri, 21 Nov 2025 05:38:05 +0800 Message-Id: <20251120213805.4135-2-ptpt52@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20251120213805.4135-1-ptpt52@gmail.com> References: <20251120213805.4135-1-ptpt52@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: With GPIO_ACTIVE_LOW configured in DTS, gpiod_set_value(1) asserts reset (drives the line low), and gpiod_set_value(0) deasserts reset (drives high). Update the reset sequence so that the driver: - asserts reset by driving the GPIO low first - waits for the required reset interval - deasserts reset by driving it high This ensures MT7531 receives a correct low-to-high reset pulse. Compatibility notes: The previous implementation contained a polarity mismatch: the DTS described the reset line as active-high, while the driver asserted reset by driving the GPIO low. The two mistakes matched each other, so the reset sequence accidentally worked. This patch fixes both sides: the DTS is corrected to use GPIO_ACTIVE_LOW, and the driver now asserts reset by driving the line low (value = 1 for active-low) and then deasserts it by driving it high (value = 0). Because the old behaviour relied on a matched pair of bugs, this change is not compatible with mixed combinations of old DTS and new kernel, or new DTS and old kernel. Both sides must be updated together. Upstream DTS and upstream kernels will remain fully compatible after this patch. Out-of-tree DT blobs must update their reset-gpios flags to match the correct hardware polarity, or the switch may remain stuck in reset or fail to reset properly. There is no practical way to maintain compatibility with the previous incorrect behaviour without adding non-detectable heuristics, so fixing the binding and the driver together is the correct approach. Signed-off-by: Chen Minqiang --- drivers/net/dsa/mt7530.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 548b85befbf4..24c9adff191d 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2405,9 +2405,9 @@ mt7530_setup(struct dsa_switch *ds) usleep_range(5000, 5100); reset_control_deassert(priv->rstc); } else { - gpiod_set_value_cansleep(priv->reset, 0); - usleep_range(5000, 5100); gpiod_set_value_cansleep(priv->reset, 1); + usleep_range(5000, 5100); + gpiod_set_value_cansleep(priv->reset, 0); } /* Waiting for MT7530 got to stable */ @@ -2643,9 +2643,9 @@ mt7531_setup(struct dsa_switch *ds) usleep_range(5000, 5100); reset_control_deassert(priv->rstc); } else { - gpiod_set_value_cansleep(priv->reset, 0); - usleep_range(5000, 5100); gpiod_set_value_cansleep(priv->reset, 1); + usleep_range(5000, 5100); + gpiod_set_value_cansleep(priv->reset, 0); } /* Waiting for MT7530 got to stable */ -- 2.17.1