Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1895503ybn; Thu, 26 Sep 2019 03:58:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqwOSrwxAe8cYWQXmd/rMajYOuBwciknRWH3Z3K3ziXFELmROAtHYhl1EaBCr4tJyPwTcpF2 X-Received: by 2002:a17:907:411d:: with SMTP id nw21mr2442469ejb.8.1569495502125; Thu, 26 Sep 2019 03:58:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569495502; cv=none; d=google.com; s=arc-20160816; b=XI2YRMmTYsWwX06HiIzYKGCI8i59GqQkG4JHev9lzKQLP3t+wmEXQW7ySPzzxDUxr8 C8l7rzOKRXH4KIZ/JPnbrCaqePB9WChPcsbuJrvymtkJKSIFa6/dqC4xdL8fCSWr5qE8 +4v7qY0vApTfJ16aM2kNq0pqFPDQZJiLhoIM+Cx/Ps8nqC7XfjLGzXreD4Dv7cqdE51i 5qeifeqKRTz7tZPFFJEqMVPUvYPaFNzBJXOs7w+lsJa+clG7K9OdTytbQsWPaSaoFuU1 aXqkuzlsJKEtbcbW/96gtBnAKiuX8//jyA+7ITl2GrXM4VqeopAee1Gee2Q341erQI1U DvSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=S+zR6hT69uMuvtLUzS5eVjfUv4JCt+CS0cXeaaqRO1w=; b=wLa4ihYgvwoHPbmkhMNgPqlVwkgNRdIfXdMvNr75/tTY2SDd2cOQ8f38BTgnJFLD3q vaRYGr76xh1UQNavZRza3rl/Lzo/to35OcN3x1v9KWNQbLUSp+UnW7E5PU+uuJnzmeq7 +DQ9nu8EJhlt6FYJGAG75zlJW0K6sI3zzObJD5i8BLpAuVKre2BLHxKOUrCbui0x16tR h16xjgGYZ0jKNDMc/z9OdQFuP6NqFbJZxhBS0wI0lsAdsdCg6RdBchID1Mg3YqLd1sKf V/xnxJaf2ai/ICa6ziViysF+Qpeh8HHvhvlFn5Qgnq6q5zgM4b3iL1I0s2RmOwOWSGaB PVUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=Fe0DtrL6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f21si1115334edb.379.2019.09.26.03.57.59; Thu, 26 Sep 2019 03:58:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ysoft.com header.s=20160406-ysoft-com header.b=Fe0DtrL6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ysoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730040AbfIZI7m (ORCPT + 99 others); Thu, 26 Sep 2019 04:59:42 -0400 Received: from uho.ysoft.cz ([81.19.3.130]:33270 "EHLO uho.ysoft.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728506AbfIZI7l (ORCPT ); Thu, 26 Sep 2019 04:59:41 -0400 Received: from iota-build.ysoft.local (unknown [10.1.5.151]) by uho.ysoft.cz (Postfix) with ESMTP id 83C1CA45FC; Thu, 26 Sep 2019 10:59:39 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ysoft.com; s=20160406-ysoft-com; t=1569488379; bh=S+zR6hT69uMuvtLUzS5eVjfUv4JCt+CS0cXeaaqRO1w=; h=From:To:Cc:Subject:Date:From; b=Fe0DtrL6V6h2VapmNghlv7JdhcyF4p+Gg0QjoPcZTzi/uqa0CN/OB1DNiftMbzxgL n1m26wj1eobVRfoRujC1C+YMR+84R61XhbQ0UNqTxcxW/WGxJY7F69oLtonDqzLq/0 VvykzCe1RLiIBQiQ7aCdSzvDRxIiguUw1IR4iFHY= From: =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= To: Andrew Lunn , "David S. Miller" , netdev@vger.kernel.org Cc: Vivien Didelot , linux-kernel@vger.kernel.org, Florian Fainelli , Heiner Kallweit , =?UTF-8?q?Michal=20Vok=C3=A1=C4=8D?= Subject: [PATCH net] net: dsa: qca8k: Use up to 7 ports for all operations Date: Thu, 26 Sep 2019 10:59:17 +0200 Message-Id: <1569488357-31415-1-git-send-email-michal.vokac@ysoft.com> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The QCA8K family supports up to 7 ports. So use the existing QCA8K_NUM_PORTS define to allocate the switch structure and limit all operations with the switch ports. This was not an issue until commit 0394a63acfe2 ("net: dsa: enable and disable all ports") disabled all unused ports. Since the unused ports 7-11 are outside of the correct register range on this switch some registers were rewritten with invalid content. Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family") Fixes: a0c02161ecfc ("net: dsa: variable number of ports") Fixes: 0394a63acfe2 ("net: dsa: enable and disable all ports") Signed-off-by: Michal Vokáč --- I am not sure which of the fixes tags should be used but this definetelly fixes something.. IMHO the 0394a63acfe2 ("net: dsa: enable and disable all ports") did not cause the issue but made it visible. drivers/net/dsa/qca8k.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c index 16f15c93a102..bbeeb8618c80 100644 --- a/drivers/net/dsa/qca8k.c +++ b/drivers/net/dsa/qca8k.c @@ -705,7 +705,7 @@ qca8k_setup(struct dsa_switch *ds) BIT(0) << QCA8K_GLOBAL_FW_CTRL1_UC_DP_S); /* Setup connection between CPU port & user ports */ - for (i = 0; i < DSA_MAX_PORTS; i++) { + for (i = 0; i < QCA8K_NUM_PORTS; i++) { /* CPU port gets connected to all user ports of the switch */ if (dsa_is_cpu_port(ds, i)) { qca8k_rmw(priv, QCA8K_PORT_LOOKUP_CTRL(QCA8K_CPU_PORT), @@ -1074,7 +1074,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev) if (id != QCA8K_ID_QCA8337) return -ENODEV; - priv->ds = dsa_switch_alloc(&mdiodev->dev, DSA_MAX_PORTS); + priv->ds = dsa_switch_alloc(&mdiodev->dev, QCA8K_NUM_PORTS); if (!priv->ds) return -ENOMEM; -- 2.1.4