Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6019144ybc; Wed, 27 Nov 2019 13:30:56 -0800 (PST) X-Google-Smtp-Source: APXvYqw1vuadO/90cbrVVfoJlrRYX1f4vji1p6CY2q9PBE2zAbFU437PnHraffnktzkHzX3eWux5 X-Received: by 2002:a17:906:5a92:: with SMTP id l18mr50228190ejq.238.1574890256087; Wed, 27 Nov 2019 13:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574890256; cv=none; d=google.com; s=arc-20160816; b=KucwIVlxoXRHj20ZLOw9UKgA63UROEVI0vK0SzD252IvIpYhCS2fKNp2C4uftSRdVF 0KvUAexNiuKsig4GP1kFRWr1fNv8lZnDDtN5SxnDD9RwKDMqprHOidQaDRTMN72Ehf1p IWEBRypUNEHeou1T30yB6XGdY1jg4QIwxIiUqyR9lN/3KU+fdxRyYsJh1mNncWFHl+6P AUHBU6kEWtpjv5wySj9Nk0JRlkFGvCgQd335QZN3CxVr5bUssUWJYNbeO6XRTyB5jyvt VlJSO89BB090rrV/de8ktIcrEj8lRJ5/yEdVZPUaMpPBZVzcWkLGCcNRNF5YT//Io+cc 0rkw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=wXPc1JZ2bZ4H73i03ZvOCmAFnE1gKUcflgON/KvwsnI=; b=V/ZwmA/A5E5PpkstA2I71a+X0loLCuZjtVJ4IlPq48Kn47h88xO7bTsJJv1IYpuG34 P2DGiq9JA4mp3XsqonvXWUg7NJXIqoTczoBybl4YjPCTPpC4dQkS5mPVZuNyFsRPcL8E ctiaCQU9UU7nNb9EPlxIpT4SMHiqWlEg6ffhUM0lOhlLKlNMZTU9oQhy3rFUsP6w1haU 7qjVSzazfvpFi4vmpxwMdLIkoHHdlorGTAfwwFE0YiwEqAt9EuS4Q9OGnnimcFH3plbN CupEeHJ+YbXm4CUGSjnMuVeXgHcLzTcoNPSLfDAQjcGIo4BbBCX+qYuP3PtJgoAVrmTL ffLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DqkOcaOS; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si11758604edm.344.2019.11.27.13.30.32; Wed, 27 Nov 2019 13:30:56 -0800 (PST) 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 header.i=@kernel.org header.s=default header.b=DqkOcaOS; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732103AbfK0V2R (ORCPT + 99 others); Wed, 27 Nov 2019 16:28:17 -0500 Received: from mail.kernel.org ([198.145.29.99]:49914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731333AbfK0U6f (ORCPT ); Wed, 27 Nov 2019 15:58:35 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 344302084D; Wed, 27 Nov 2019 20:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888313; bh=nn55VR0mjRnVCirDI9UVbFxLsK48NZQCrZGr+lyqim4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqkOcaOSLqlXzihNlSBHSygu6FzyMpCALIrzCDRumwufxM4olMwIpxs2Cq/P8e9yN KWtk+2NAIMJWJlKolK+CvOqQs0EiumqpKh5LXh5zmwy0BV/kAEwL0XYrxl+Ty56dFs 4CR+2eM5FJIq1Til8BjoZ414Rdl7diD8rxarI/rU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Marek=20Beh=C3=BAn?= , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 085/306] net: dsa: mv88e6xxx: Fix 88E6141/6341 2500mbps SERDES speed Date: Wed, 27 Nov 2019 21:28:55 +0100 Message-Id: <20191127203121.142473613@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Marek BehĂșn [ Upstream commit 26422340da467538cd65eaa9c65538039ee99c8c ] This is a fix for the port_set_speed method for the Topaz family. Currently the same method is used as for the Peridot family, but this is wrong for the SERDES port. On Topaz, the SERDES port is port 5, not 9 and 10 as in Peridot. Moreover setting alt_bit on Topaz only makes sense for port 0 (for (differentiating 100mbps vs 200mbps). The SERDES port does not support more than 2500mbps, so alt_bit does not make any difference. Signed-off-by: Marek BehĂșn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/dsa/mv88e6xxx/chip.c | 4 ++-- drivers/net/dsa/mv88e6xxx/port.c | 25 +++++++++++++++++++++++-- drivers/net/dsa/mv88e6xxx/port.h | 1 + 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index d075f0f7a3de8..411ae9961bf4f 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3028,7 +3028,7 @@ static const struct mv88e6xxx_ops mv88e6141_ops = { .port_set_link = mv88e6xxx_port_set_link, .port_set_duplex = mv88e6xxx_port_set_duplex, .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, - .port_set_speed = mv88e6390_port_set_speed, + .port_set_speed = mv88e6341_port_set_speed, .port_tag_remap = mv88e6095_port_tag_remap, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_egress_floods = mv88e6352_port_set_egress_floods, @@ -3649,7 +3649,7 @@ static const struct mv88e6xxx_ops mv88e6341_ops = { .port_set_link = mv88e6xxx_port_set_link, .port_set_duplex = mv88e6xxx_port_set_duplex, .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, - .port_set_speed = mv88e6390_port_set_speed, + .port_set_speed = mv88e6341_port_set_speed, .port_tag_remap = mv88e6095_port_tag_remap, .port_set_frame_mode = mv88e6351_port_set_frame_mode, .port_set_egress_floods = mv88e6352_port_set_egress_floods, diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index fdeddbfa829da..2f16a310c110e 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -228,8 +228,11 @@ static int mv88e6xxx_port_set_speed(struct mv88e6xxx_chip *chip, int port, ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_1000; break; case 2500: - ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000 | - MV88E6390_PORT_MAC_CTL_ALTSPEED; + if (alt_bit) + ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000 | + MV88E6390_PORT_MAC_CTL_ALTSPEED; + else + ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000; break; case 10000: /* all bits set, fall through... */ @@ -291,6 +294,24 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) return mv88e6xxx_port_set_speed(chip, port, speed, false, false); } +/* Support 10, 100, 200, 1000, 2500 Mbps (e.g. 88E6341) */ +int mv88e6341_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) +{ + if (speed == SPEED_MAX) + speed = port < 5 ? 1000 : 2500; + + if (speed > 2500) + return -EOPNOTSUPP; + + if (speed == 200 && port != 0) + return -EOPNOTSUPP; + + if (speed == 2500 && port < 5) + return -EOPNOTSUPP; + + return mv88e6xxx_port_set_speed(chip, port, speed, !port, true); +} + /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */ int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed) { diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index 95b59f5eb3931..cbb64a7683e28 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h @@ -280,6 +280,7 @@ int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup); int mv88e6065_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); +int mv88e6341_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed); -- 2.20.1