Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5232782pxb; Sun, 13 Feb 2022 12:53:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJw5OCD2EMgWWILpRaL8DJBLmUo08G9QZCK5DBKcjBqPV7BRYPRNv7AyooTm1h1GxLgMvzdP X-Received: by 2002:a17:902:e889:: with SMTP id w9mr11139166plg.95.1644785592396; Sun, 13 Feb 2022 12:53:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644785592; cv=none; d=google.com; s=arc-20160816; b=Xgq9VJxq2/p4WpbgFL+INk9025Y26E7rFcQsmsTEARVDUjnPQQr/hmmbziXLruwoqX iJLHtwwRXc0EChzBNHgsOLZDU7pzYLLomCyg4FuM5vCCwLktSIsnSDC/duVMWRhGN90l 8RqVWGis8e7pTcugCJseAwNV7ox5PT9YIUTzKbG2ySshcZZ6ejNaKBd1W49SnF29zwTX SJc6qtMHyVccWBKr7CO65I04xKIDd+NcflzAdfyRGHT9LxD45Ke/LxhyGrdcib2oKqrj 8LpP8FyI8OXA0fSQKIGNp8wH0XtAzCC7avzWoltAgMYQEp2IyG3YR7+vNOY1/Jr4dRL3 SaBg== 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=5b6T59mtoBLg2aHTqbBo/r+mo6q1zaT8htW2r31opOo=; b=mjcJdUca0MK/ITCRFl33ODnHegq5wj+FsFrPTR6tPInd28Mc2LWvV5ovOJeljlR3Wz lhJ0lD+PT2wgwt6E9foo1g/pE0IH414l2Uo8gNzqJc9dDyvRuJyU06hZiWy3E+RHKZB+ ASEw2PT5KIGalL/zw5uplmq4GhT6R9XB5O5+KIA7cms/0tpRYrjri/qSNUcn+TnvqFoH 47JpLRCeKICutWU5PQbNhlNlmWFBgiLrvNBq+1E033FWDdzD8DsEP6uKAqC1T5pxmbAP vvlbpoY9dVHP4VAW/nIXMO10SQ6I4C/mdqVZDugXXoHz7EIYUgZGSDiAzIINM9E9WySc 77zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=jkcJuibz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r83si19718272pgr.26.2022.02.13.12.52.56; Sun, 13 Feb 2022 12:53:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@waldekranz-com.20210112.gappssmtp.com header.s=20210112 header.b=jkcJuibz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234745AbiBMSwM (ORCPT + 99 others); Sun, 13 Feb 2022 13:52:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234294AbiBMSwL (ORCPT ); Sun, 13 Feb 2022 13:52:11 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BEC457B3C for ; Sun, 13 Feb 2022 10:52:05 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id h6so23543379wrb.9 for ; Sun, 13 Feb 2022 10:52:05 -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=5b6T59mtoBLg2aHTqbBo/r+mo6q1zaT8htW2r31opOo=; b=jkcJuibzzNnKOpzhPiGpqn62fKaL16PjFsJa9ECq+C+9uKDFnGlijB7gW+8kO7w+HY JTcmBFp3EXWo8QZxjaYvYNZmWqtKY53glpL8tsHmTXry7U0lPDGb0TWpinKA5mPeGL14 kDUW1Ri44IFGs5CQt4gY1kJHP3LLzsCHOzrL4MFDt2iS0ahGKDxBtEqHdiKsXO6wREoz zgKTBZX068Vk/n8xLuTiT/ydSusfeWg8P2AgGIYZU0B2/wTqzDMOkjsHC4EWiT+Fnw3Y BU9gqnjg5KAlnM2NRS4uDHlhXeU27TTzmSObP9PDmVxnVVIQYWMX27BEh5GwhM+snTIy GYOQ== 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=5b6T59mtoBLg2aHTqbBo/r+mo6q1zaT8htW2r31opOo=; b=cNauonTJ1qmp+jXzuwBo5YNvvAZ2WiAOLTpwLzp62/S/EJuAvAoJfVR/lcBHO2R5Vj e8b5YuWYBPaS/fLlTr7unnoDn0ytkhA0kJ923r9Y2BBlmTyUdyWlk85GkAH6/887GnT3 EA7ZYm2PdUXa57pyRp4TbBG7FGnRLeGmL18Z3CNF0Y7miESGCtjFwHDDwSOfh0iWig4b LfdiZ++YSvI/M1hVHUg5gSHQ/+Q5YsV2rNzrM9A38W/3i02983g4hLOKPBh3cizpLBar Vm1CkfhvVLFHylz5Rwc6Bcku/+lUqL/IgKVq+yMbqEu4sAA5RcONJJ23Yag2SzidQbpr L15Q== X-Gm-Message-State: AOAM5321iWcMMoEVN0+iBy9uhksryeTi1NL79JGYpYWPuL8A67N1U2RA rhdLde3NccEmDYIWGwtfW6uziw== X-Received: by 2002:a05:6000:81:: with SMTP id m1mr8479062wrx.94.1644778324070; Sun, 13 Feb 2022 10:52:04 -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 j5sm25659049wrq.31.2022.02.13.10.52.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Feb 2022 10:52:03 -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 v2 net-next] net: dsa: mv88e6xxx: Fix validation of built-in PHYs on 6095/6097 Date: Sun, 13 Feb 2022 19:51:54 +0100 Message-Id: <20220213185154.3262207-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,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 85527fe4fcc8..34036c555977 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -580,6 +580,25 @@ 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)) { + __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 +3822,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 +3869,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