Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1645797rwb; Fri, 19 Aug 2022 07:10:32 -0700 (PDT) X-Google-Smtp-Source: AA6agR7aTz4Qe+4ZX8kDcG4b66U4tLi+V5Zt/4gU1mjOAGuWt0An3/Eo41uJRWFGP0Ns/NJU/N/C X-Received: by 2002:a17:907:6d9b:b0:731:1135:dc2d with SMTP id sb27-20020a1709076d9b00b007311135dc2dmr5137586ejc.76.1660918232006; Fri, 19 Aug 2022 07:10:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660918232; cv=none; d=google.com; s=arc-20160816; b=cmrYhSmAadB+/k/CCGdNkagZnbTnSnVHsj7JL9dR97Fy1TlPJ+H163u+SFdeFSXLhk +WmBa2fWtW5u6rC4goyVCX5xEejVDJGrHq97rBGqy99is0o7ziuTXehk9mMG6BRKxnih cNmFAfoh1dluLypDl8KI1O5uw4IXpChHXSi5mEyPClKdqtlCfk11leXZj+e8awHTFs4h aLpygHCuQwjsKViuk1HupDpQ3ojeAkJ1srU5BhLYydnaGhrGACqxUrE3erWNuN5OVYzb InNc+5Vqnh91in4xoMzUlVE7r0L8tNx7kuwIU6eekzNTvRVbN3bLApDTek1PrQl/GsPV +ULQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=n2YiM1VkOWanmoZq6F/KNDCGL6g5QejwONGhMN+1ATQ=; b=CVNg3kp8YoIDB2FmrEgopc+4QYcJQvNbK07opn+vD6uZYXoh6OJ1z7QKHE1O4O4kLd umAB02uuioyAHTMs2KxO9K6lJrkjPrAXsVkHcS/oiOJ7eo4CX3qxW0BEUFsOjX+iTGg3 tbCRJSe/qopSaOcK1t/xnIcQTCmRvU6Z6bjRPbNtC+MsqVyq6YUaDD79/b+z5WXdw+V4 cyNDIETnCX4xG6vf65pnzJq5yAo5vvujafB/wQU2pU9eZHUmcMDuEFyxzwn4q1OBs/jy laFCLlvzyMF+rfWaU/K5Vx+ujiwTpCiI6yruoKaYASfBiFkeKuzJQeDjn/+o+22T1JNH eyyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@axis.com header.s=axis-central1 header.b=FhwyQPft; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a19-20020a170906191300b007306e4fc2f2si2692944eje.374.2022.08.19.07.10.05; Fri, 19 Aug 2022 07:10:31 -0700 (PDT) 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 (test mode) header.i=@axis.com header.s=axis-central1 header.b=FhwyQPft; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=axis.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349145AbiHSN5g (ORCPT + 99 others); Fri, 19 Aug 2022 09:57:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348540AbiHSN5e (ORCPT ); Fri, 19 Aug 2022 09:57:34 -0400 Received: from smtp2.axis.com (smtp2.axis.com [195.60.68.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E10FFF7E; Fri, 19 Aug 2022 06:57:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1660917453; x=1692453453; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=n2YiM1VkOWanmoZq6F/KNDCGL6g5QejwONGhMN+1ATQ=; b=FhwyQPftgjFihBg+Vb16DwmOHrAb9hKPE/XcklRBbN7mLExhFEaR6ziP 113SsXwR9VUDJV/JqoUEktrd4AxYa+8+1iGw4/0wgz1GNzxYW3uCXOPI9 bXuQthSDhp25z0cA+JXEYtt14c6DZIq0PCV00cvBdw2f7rFuVwW+dcR63 u5IJf3j2Pf6IZUDpUbiG2we2YBOlAQRJqSbPxgCzSrBvLtvg8gWN+hbIe iDpS+/rWwnf+sijUIyiVGkau+54SVXGfi+Kra0mm6wR3iNT7jLSqZ0eyj aUwu5k0v10AQpQGJYSWCJT5qjyb3d4SzR93sG+xjZk0o3T9iz59sRXlHL Q==; From: Marcus Carlberg To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: , Marcus Carlberg , , Subject: [PATCH v2] net: dsa: mv88e6xxx: support RGMII cmode Date: Fri, 19 Aug 2022 15:56:29 +0200 Message-ID: <20220819135629.32590-1-marcus.carlberg@axis.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, 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 Since the probe defaults all interfaces to the highest speed possible (10GBASE-X in mv88e6393x) before the phy mode configuration from the devicetree is considered it is currently impossible to use port 0 in RGMII mode. This change will allow RGMII modes to be configurable for port 0 enabling port 0 to be configured as RGMII as well as serial depending on configuration. Signed-off-by: Marcus Carlberg --- Notes: v2: add phy mode input validation for SERDES only ports drivers/net/dsa/mv88e6xxx/port.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index 90c55f23b7c9..5c4195c635b0 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -517,6 +517,12 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, case PHY_INTERFACE_MODE_RMII: cmode = MV88E6XXX_PORT_STS_CMODE_RMII; break; + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + cmode = MV88E6XXX_PORT_STS_CMODE_RGMII; + break; case PHY_INTERFACE_MODE_1000BASEX: cmode = MV88E6XXX_PORT_STS_CMODE_1000BASEX; break; @@ -634,6 +640,19 @@ int mv88e6393x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, if (port != 0 && port != 9 && port != 10) return -EOPNOTSUPP; + if (port == 9 || port == 10) { + switch (mode) { + case PHY_INTERFACE_MODE_RMII: + case PHY_INTERFACE_MODE_RGMII: + case PHY_INTERFACE_MODE_RGMII_ID: + case PHY_INTERFACE_MODE_RGMII_RXID: + case PHY_INTERFACE_MODE_RGMII_TXID: + return -EINVAL; + default: + break; + } + } + /* mv88e6393x errata 4.5: EEE should be disabled on SERDES ports */ err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_MAC_CTL, ®); if (err) -- 2.20.1