From patchwork Wed Mar 18 09:02:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?UmFmYcWCIE1pxYJlY2tp?= X-Patchwork-Id: 451269 X-Patchwork-Delegate: jogo@openwrt.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from arrakis.dune.hu (arrakis.dune.hu [78.24.191.176]) (using TLSv1.1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8270E1400D5 for ; Wed, 18 Mar 2015 20:03:06 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=gmail.com header.i=@gmail.com header.b=yoWGO6dj; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 6FC142809E0; Wed, 18 Mar 2015 10:02:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on arrakis.dune.hu X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, T_DKIM_INVALID autolearn=no version=3.3.2 Received: from arrakis.dune.hu (localhost [127.0.0.1]) by arrakis.dune.hu (Postfix) with ESMTP id 32FED28045A for ; Wed, 18 Mar 2015 10:02:23 +0100 (CET) X-policyd-weight: using cached result; rate: -8.5 Received: from mail-wg0-f52.google.com (mail-wg0-f52.google.com [74.125.82.52]) by arrakis.dune.hu (Postfix) with ESMTPS for ; Wed, 18 Mar 2015 10:02:22 +0100 (CET) Received: by wgbcc7 with SMTP id cc7so29275801wgb.0 for ; Wed, 18 Mar 2015 02:02:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=y6uzeDCr0ogzbGMB6c5Zf+TSTxmXvy8DCTdn5Pt5AkA=; b=yoWGO6djd08J1WlQE1j3ULwpZ075DXYtdJpw6FRHqtZqMGpyusa4l7gRV5uBVYRZok zZn8t+ZV9OVabx0wUD4HrVoqs8dzQ3/TyZZDes6GIrVLAsgLXMgvkNAl+J0c5D6oZXju jfYHHIxQJaRdCGRxm16RtRNsVBtipee6Ek1OOCiG0iYKu6e+VqaIz9iefOB3Hu5tvoT2 c1sqnlknwTTvc1wMp3y8UgX9JTv3+STuPfX2pf/UaI5awFZcbCe64dznM7T2CSrCmr7e 7DsyYJfZDsSmgMS4Ev8EaMNeulVN77ULwacwZysLa6CHiTe0L8c7wClBifLcebPsuCBu wjKQ== X-Received: by 10.194.19.10 with SMTP id a10mr142902236wje.153.1426669370151; Wed, 18 Mar 2015 02:02:50 -0700 (PDT) Received: from linux-tdhb.lan ([89.174.37.6]) by mx.google.com with ESMTPSA id dz6sm2252773wib.0.2015.03.18.02.02.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Mar 2015 02:02:47 -0700 (PDT) From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= To: openwrt-devel@lists.openwrt.org Date: Wed, 18 Mar 2015 10:02:36 +0100 Message-Id: <1426669356-10799-1-git-send-email-zajec5@gmail.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Cc: Jonas Gorski Subject: [OpenWrt-Devel] [PATCH] b53: fix overriding port 8 state (if it is connected to CPU) X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openwrt-devel-bounces@lists.openwrt.org Sender: "openwrt-devel" Signed-off-by: Rafał Miłecki --- .../generic/files/drivers/net/phy/b53/b53_common.c | 23 +++++++++++++++++++++- .../generic/files/drivers/net/phy/b53/b53_regs.h | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c index e44d194..4597742 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c @@ -525,7 +525,7 @@ static int b53_switch_reset(struct b53_device *dev) return -EINVAL; } } - } else if ((is531x5(dev) || is5301x(dev)) && dev->sw_dev.cpu_port == B53_CPU_PORT) { + } else if (is531x5(dev) && dev->sw_dev.cpu_port == B53_CPU_PORT) { u8 mii_port_override; b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, @@ -533,6 +533,27 @@ static int b53_switch_reset(struct b53_device *dev) b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, mii_port_override | PORT_OVERRIDE_EN | PORT_OVERRIDE_LINK); + } else if (is5301x(dev)) { + /* + * CPU interface attached to port 8 requires specific handling. + * It uses different overriding register and extra ports 5 and 7 + * need to be configured as well. + */ + if (dev->sw_dev.cpu_port == 8) { + u8 mii_port_override; + + b53_read8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, + &mii_port_override); + mii_port_override |= PORT_OVERRIDE_LINK | + PORT_OVERRIDE_RX_FLOW | + PORT_OVERRIDE_TX_FLOW | + PORT_OVERRIDE_SPEED_2000M | + PORT_OVERRIDE_EN; + b53_write8(dev, B53_CTRL_PAGE, B53_PORT_OVERRIDE_CTRL, + mii_port_override); + } else { + pr_warn("overriding CPU port other than 8 is not supported yet\n"); + } } b53_enable_mib(dev); diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h index 6d71493..129946d 100644 --- a/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_regs.h @@ -86,6 +86,7 @@ #define PORT_OVERRIDE_RV_MII_25 BIT(4) /* BCM5325 only */ #define PORT_OVERRIDE_RX_FLOW BIT(4) #define PORT_OVERRIDE_TX_FLOW BIT(5) +#define PORT_OVERRIDE_SPEED_2000M BIT(6) /* BCM5301X only, requires setting 1000M */ #define PORT_OVERRIDE_EN BIT(7) /* Use the register contents */ /* Power-down mode control */