Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp853155pxk; Wed, 23 Sep 2020 19:07:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdFCKx77e0tyxuUt0hC7Adkg+S6nAI3Mj6QBvgpgo9eaBmvtcuWDF/giJj3etDNl87Vcvx X-Received: by 2002:a17:906:cf9b:: with SMTP id um27mr2487879ejb.66.1600913255093; Wed, 23 Sep 2020 19:07:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600913255; cv=none; d=google.com; s=arc-20160816; b=XByhP7WKY2O8xOJ8pqJ0ne0sas79uov2FzU06CHl2MGm2NkoOdLF7YGxMM6ruz/JSV ynn4KsNVfVbMr5r2fWOx6W5DJfeebfAPsKOEhcE8eCpv/nmkxvbfH0d8azwaPsK5bxlo eCYcbUTUPkrzqR37p6fR7tZzdbgm44SrXcG2rjF6RDy9PEL5BSpWXuS+DEkEoZJ/K4FO xVyg/8s+BnYKLEOgpej42ZQHj1Zbmtf+bRVaCiGuLwQxpP5nl3hF03rOlLFlm346Y6WF MgE+kdDdNMd48PAoTCCsxL2iNPsy5Gxupi4nVtrWrKGhtnvPSpRNBy+c6JU4S7q2bEIx S/sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from; bh=ECjpgJ3hAJjr7laeACqc7sljKJwJzJ75H0Pi4mbjGHM=; b=e1b/EaGrQasA751NA2HLxKWmsw5Tsvw2nlK0991vOe71EgmD1FWV281xrOOKY3KuQS EPml0tZUL3cWayFLMbf/9AY/lOffsW9iXuqK79bR81BlUHvkTrTT3/uBTMQ5lwzBCqTm mSTt0AAZvQsmyiSdATcUfhFt2OpJs3YIRzOEWQZbFfeeTk+DZccGNKhGCUn2s24KqQxu GFcZh5cemvaHD+6IcaVngswIZGHl0lUDVfwa4k9IUUGJYwrIHKgFxadEZzWpmyies9Tc eV0QRwzcU4g5i8hKAh/Bdf/ILmyR2WnfW2ry7tq0Pg0pDDCQE37EkzI4Sdc0YD0jcHF+ /LOQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o24si1220822edi.225.2020.09.23.19.07.11; Wed, 23 Sep 2020 19:07:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbgIXCGK (ORCPT + 99 others); Wed, 23 Sep 2020 22:06:10 -0400 Received: from inva020.nxp.com ([92.121.34.13]:36340 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725208AbgIXCGK (ORCPT ); Wed, 23 Sep 2020 22:06:10 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B85551A0489; Thu, 24 Sep 2020 04:06:08 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id E42D11A0CD5; Thu, 24 Sep 2020 04:06:03 +0200 (CEST) Received: from localhost.localdomain (mega.ap.freescale.net [10.192.208.232]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id B8A4D4029A; Thu, 24 Sep 2020 04:05:57 +0200 (CEST) From: Xiaoliang Yang To: xiaoliang.yang_1@nxp.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, allan.nielsen@microchip.com, joergen.andreasen@microchip.com, UNGLinuxDriver@microchip.com, alexandru.marginean@nxp.com, po.liu@nxp.com, claudiu.manoil@nxp.com, vladimir.oltean@nxp.com, leoyang.li@nxp.com Subject: [net] net: dsa: felix: convert TAS link speed based on phylink speed Date: Thu, 24 Sep 2020 09:57:46 +0800 Message-Id: <20200924015746.7994-1-xiaoliang.yang_1@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org state->speed holds a value of 10, 100, 1000 or 2500, but QSYS_TAG_CONFIG_LINK_SPEED expects a value of 0, 1, 2, 3. So convert the speed to a proper value. Fixes: de143c0e274b ("net: dsa: felix: Configure Time-Aware Scheduler via taprio offload") Signed-off-by: Xiaoliang Yang Reviewed-by: Vladimir Oltean --- drivers/net/dsa/ocelot/felix_vsc9959.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 6855c94256f8..36db631a55e6 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1284,8 +1284,28 @@ void vsc9959_mdio_bus_free(struct ocelot *ocelot) static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, u32 speed) { + u8 tas_speed; + + switch (speed) { + case SPEED_10: + tas_speed = OCELOT_SPEED_10; + break; + case SPEED_100: + tas_speed = OCELOT_SPEED_100; + break; + case SPEED_1000: + tas_speed = OCELOT_SPEED_1000; + break; + case SPEED_2500: + tas_speed = OCELOT_SPEED_2500; + break; + default: + tas_speed = OCELOT_SPEED_1000; + break; + } + ocelot_rmw_rix(ocelot, - QSYS_TAG_CONFIG_LINK_SPEED(speed), + QSYS_TAG_CONFIG_LINK_SPEED(tas_speed), QSYS_TAG_CONFIG_LINK_SPEED_M, QSYS_TAG_CONFIG, port); } -- 2.17.1