Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5945682pxb; Mon, 14 Feb 2022 11:21:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCWphH9KhC7m9YtlwbVzl7+lp6lZMTdEUgtr4NkieerZfPUwwVtP4N1ao/JptO0YcGzRq9 X-Received: by 2002:a17:902:d4c1:: with SMTP id o1mr449127plg.167.1644866481384; Mon, 14 Feb 2022 11:21:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644866481; cv=none; d=google.com; s=arc-20160816; b=JlOhv13xD/Pl9sbhp/U+y6yC2qmwpzZn5kfDu8M3yVCQuD84Nui4RzFl5I38qzkBgq fYXHsrHcKEYA+f1mfZ/yantx20WiQX+TvQqh6O2ElAqpmRatt1/Fxya3EWqgdhZ6Onc7 08BL1J7FQMDh+Q++pcuBKQMA8gJxmNrtF2uZHGp8JwFQqw2hIWsp6aRzJAoEh74Mv+20 XmFDktFWNpfM65MMKpnL875HUeyjlCOeXbYC/g9jl7qwxkY1Gh3DS0D27VCFb7RP1bPM 95HyzAZ/4bFs2BLNz4PwA07W8et0NaQYUIu5c2tSwJ2zCBbJfoFEElg8TQyHqg6FmDE3 +hdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=bT2Te+Kg9SQlga08Bc5dZ+XNGd8nQG47I/LjRlS+lTA=; b=B4WANRASIYWTY2WmPNiVnqRyPG39UhSYrWCUU4cKx+31qvxbv6Ky4ub0pOLsqJIw/w CvGiGKc3mwVgi77Au5VNCTuz+UgC3diHtsSO2qlT8nI6gSu5N73xqwSdW63wBPq0tpLS QSFCV+zykt+/sBR5xnRongJY+G5EHbyCQoBKooh4RYQsvHYFb2nhkuFGDN1D8pKezpCs qbrJmPNHZeniGZhXkZ0h48wXi5SvITQx5fxfd5NkddIivDY45tFBkU+kQaH9ak8pxvAH YLRy+Ca0H+MR7FxiDFWekLONCfEjNNQxhR1qmPCotZe5uxBF7z6x1fGGSMbchtmxZlK4 vYnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=izpzK2ap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id fr14si11932230pjb.18.2022.02.14.11.21.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 11:21:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=izpzK2ap; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 712C7BF512; Mon, 14 Feb 2022 11:12:31 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232706AbiBMAi3 (ORCPT + 99 others); Sat, 12 Feb 2022 19:38:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232696AbiBMAi2 (ORCPT ); Sat, 12 Feb 2022 19:38:28 -0500 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2827360054 for ; Sat, 12 Feb 2022 16:38:24 -0800 (PST) Received: by mail-wr1-x42f.google.com with SMTP id q7so21059919wrc.13 for ; Sat, 12 Feb 2022 16:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=waldekranz-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version:organization :content-transfer-encoding; bh=bT2Te+Kg9SQlga08Bc5dZ+XNGd8nQG47I/LjRlS+lTA=; b=izpzK2aptidswgj+IrD8bsq0MTZ2eEsoQQF6NZBWOjfHyo+7uJl0c17wn6Y3LgvVLJ P1upGmuHjQ5GC28vYiOQDDvNz1BLKZqI4nAQFMFijNr2jd6L1Zs7d2sBu8RqFy2EPPwE kTIPDtZjqDCypTGpf0xXxo1LRVxVhhGp6W3rFP8lOmOrXM+beXE2OYRTwFmtZJ/P+Esf xVRFB8C+lZ950y6MuLNSWKUSmz3HrBNIELZ9QP6e9KWCtPaV+AqsycFEZEkDqGbiJtjD 3gQLDIr3BE8LtfOHc8ycvM2xoe7hOqHKrbam6NEsM6sCt3h1nF4peM78dlXHGCPRimmO Q82g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :organization:content-transfer-encoding; bh=bT2Te+Kg9SQlga08Bc5dZ+XNGd8nQG47I/LjRlS+lTA=; b=M6eULHjfi0xuFFjzgMuN8uHjKIJwiyEjl2Odj/supF9Xw12+QsykOWxiZ8lmQuMrUj fcJ94pCTzsQoXS9/xZvn+pF21pLWFBsVGQHFxLI9Nxhsp+Uq5gjbKovYKYnVZhc/ywKK lrQXaBdHRuIYYffKtQhAlJUQ76yt+s6QX4TAUZTR5q71tD5oOa1bM2w1ADQL8Batc9B8 9vVYMX45ceNvZin51aGklBQPJ7ydU+czRwwAtMzDlaQPa+KQ4AMCviBMXRi3U2vIm5ew TpUItp19QkgT1ACVHCVfN5n+bgA7jCGO+0I9NKpJ0Z2tDDL2LEDYhZVQFfgaqtzO0Q0S yQoQ== X-Gm-Message-State: AOAM532hZDAtXOsl/nq6nkgSe8n63P2OpiBUvX5nWEX7r/4LzabcP/8r 633oeVYFIoMNeLXEXUqHXx643Q== X-Received: by 2002:adf:908f:: with SMTP id i15mr6531238wri.256.1644712701925; Sat, 12 Feb 2022 16:38:21 -0800 (PST) Received: from veiron.westermo.com (static-193-12-47-89.cust.tele2.se. [193.12.47.89]) by smtp.gmail.com with ESMTPSA id s7sm8676472wrw.71.2022.02.12.16.38.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 12 Feb 2022 16:38:21 -0800 (PST) From: Tobias Waldekranz To: davem@davemloft.net, kuba@kernel.org Cc: netdev@vger.kernel.org, Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , Russell King , =?UTF-8?q?Marek=20Beh=C3=BAn?= , "Russell King (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH net-next] net: dsa: mv88e6xxx: Fix validation of built-in PHYs on 6095/6097 Date: Sun, 13 Feb 2022 01:37:01 +0100 Message-Id: <20220213003702.2440875-1-tobias@waldekranz.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Organization: Westermo Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org These chips have 8 built-in FE PHYs and 3 SERDES interfaces that can run at 1G. With the blamed commit, the built-in PHYs could no longer be connected to, using an MII PHY interface mode. Create a separate .phylink_get_caps callback for these chips, which takes the FE/GE split into consideration. Fixes: 2ee84cfefb1e ("net: dsa: mv88e6xxx: convert to phylink_generic_validate()") Signed-off-by: Tobias Waldekranz --- drivers/net/dsa/mv88e6xxx/chip.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 85527fe4fcc8..622b3b4ed513 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -580,6 +580,27 @@ static const u8 mv88e6185_phy_interface_modes[] = { [MV88E6185_PORT_STS_CMODE_PHY] = PHY_INTERFACE_MODE_SGMII, }; +static void mv88e6095_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, + struct phylink_config *config) +{ + u8 cmode = chip->ports[port].cmode; + + config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100; + + if (mv88e6xxx_phy_is_internal(chip->ds, port)) { + if (cmode == MV88E6185_PORT_STS_CMODE_PHY) + __set_bit(PHY_INTERFACE_MODE_MII, + config->supported_interfaces); + } else { + if (cmode < ARRAY_SIZE(mv88e6185_phy_interface_modes) && + mv88e6185_phy_interface_modes[cmode]) + __set_bit(mv88e6185_phy_interface_modes[cmode], + config->supported_interfaces); + + config->mac_capabilities |= MAC_1000FD; + } +} + static void mv88e6185_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, struct phylink_config *config) { @@ -3803,7 +3824,7 @@ static const struct mv88e6xxx_ops mv88e6095_ops = { .reset = mv88e6185_g1_reset, .vtu_getnext = mv88e6185_g1_vtu_getnext, .vtu_loadpurge = mv88e6185_g1_vtu_loadpurge, - .phylink_get_caps = mv88e6185_phylink_get_caps, + .phylink_get_caps = mv88e6095_phylink_get_caps, .set_max_frame_size = mv88e6185_g1_set_max_frame_size, }; @@ -3850,7 +3871,7 @@ static const struct mv88e6xxx_ops mv88e6097_ops = { .rmu_disable = mv88e6085_g1_rmu_disable, .vtu_getnext = mv88e6352_g1_vtu_getnext, .vtu_loadpurge = mv88e6352_g1_vtu_loadpurge, - .phylink_get_caps = mv88e6185_phylink_get_caps, + .phylink_get_caps = mv88e6095_phylink_get_caps, .set_max_frame_size = mv88e6185_g1_set_max_frame_size, }; -- 2.25.1