From patchwork Fri May 19 14:12:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1274011vqo; Fri, 19 May 2023 07:21:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5ibnCCbIomIg5oUBRzJSj37ZDpgluM6VHzlgcweV+r4uyR3nh9WS9VEXrasfOiJLA8ljns X-Received: by 2002:a17:902:f682:b0:1a6:db0a:8005 with SMTP id l2-20020a170902f68200b001a6db0a8005mr2837211plg.68.1684506093098; Fri, 19 May 2023 07:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684506093; cv=none; d=google.com; s=arc-20160816; b=DYQB8R60a8Po84H8sH7AbIg7SpdV0Wi+q+0dDzlh+mvAZWTAbi1TVbW0VbBso5PjvL QA2hhZjcCLMh94gEthc1WDsK6uQgRuxEyVO5BCTV62OdHUd8ZCIOR3FJqraDHhWzaERM 48zdqqvfG2N9JKKmnu1GvM2mRjD3hfnsm1ikTfHbrrRBYYPK+903xcC+58pKmc5frVtx jozhnEFxinjBXlSWT0hP+vSaB1WblCnJj0Ry2Q85Sb2xhQRLHyJXe2xp625QU/pCoIyb K0inxVDV+wSk4fU81rMMn7FIVGzkqA01OtKOswbVWDLpC61199rBfZwv22/mKXns8WjZ iBjA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UYUBPw5xIqdXV/lw528bb3qa+8mkxwgbfXhn4XMJacc=; b=dTW3iJY1Fj6w1dQntjf4yjZqrInBhApNIBN8cNTiGPzRJuTpF0csBMPEzqyysDfz2d KXcp2ZW80iVzNmin4tP6Wk9aKtO2/7AbgGytkmxQBi34L9hnOdfsbQ1fefLNlR/gXW4N A+T8cNeftupjAGWyVTAOKgdT30bEtS5Zxar5+tV9GV1ZDolf3Kc0GtF4R2ztbpEaKkNN BwVfKrH4krmabMxTx57jsggtsWHRjP3hQrElZqeEGb3CbWy+eBRIGyL8zV9W4zkWmq48 EkrgUx2sFvD1kiqLkfIDW5DNGjcD4cu7JMtGK2mL4gOIAjDnTkX9l3Pj+JzjmPj6oMdu +B0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b="jVV/Ch6d"; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id je1-20020a170903264100b001ac82e8491dsi862211plb.345.2023.05.19.07.21.18; Fri, 19 May 2023 07:21:33 -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 header.i=@bootlin.com header.s=gm1 header.b="jVV/Ch6d"; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230116AbjESONK (ORCPT + 99 others); Fri, 19 May 2023 10:13:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbjESONF (ORCPT ); Fri, 19 May 2023 10:13:05 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 518FCA3; Fri, 19 May 2023 07:13:03 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 4BFAAE000B; Fri, 19 May 2023 14:12:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UYUBPw5xIqdXV/lw528bb3qa+8mkxwgbfXhn4XMJacc=; b=jVV/Ch6dFB1gdLZHJ9ZV45WMSRxkP0wwXNOS7CVpM8sAGCvJew8RxuuqU02XNp6cepw+kb UZbJ3pX4Ug7hES3sUZthqN0w9hYuOezsprVZ3EYqROhpK0ExfwcamE5BXfT3tbheVj3nOz W7NqznpP9SWqvZ90bq+n3PHl5ab/CiERhOly6fLbWA7CSRBmFvX+e1gXzrHQE0PejAUhYA l3ocwJf7GvJRXipdALFcnqYwGzyUko6ajX0qcjo38TepUbHKp+sarNrJgXfSxsNogjjRdF hjI7SiV8eooA74ufyQGK2pCCw3WvogJeEBNrNygUuA+QjewRxYvOELfEfVDmww== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= , Conor Dooley Subject: [PATCH net-next v2 1/7] dt-bindings: net: dsa: marvell: add MV88E6361 switch to compatibility list Date: Fri, 19 May 2023 16:12:57 +0200 Message-Id: <20230519141303.245235-2-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332661347034191?= X-GMAIL-MSGID: =?utf-8?q?1766332661347034191?= From: Alexis Lothoré Marvell MV88E6361 is an 8-port switch derived from the 88E6393X/88E9193X/88E6191X switches family. Since its functional behavior is very close to switches from this family, it can benefit from existing drivers for this family, so add it to the list of compatible switches Reviewed-by: Andrew Lunn Acked-by: Conor Dooley Signed-off-by: Alexis Lothoré Reviewed-by: Florian Fainelli --- Documentation/devicetree/bindings/net/dsa/marvell.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/dsa/marvell.txt b/Documentation/devicetree/bindings/net/dsa/marvell.txt index 2363b412410c..33726134f5c9 100644 --- a/Documentation/devicetree/bindings/net/dsa/marvell.txt +++ b/Documentation/devicetree/bindings/net/dsa/marvell.txt @@ -20,7 +20,7 @@ which is at a different MDIO base address in different switch families. 6171, 6172, 6175, 6176, 6185, 6240, 6320, 6321, 6341, 6350, 6351, 6352 - "marvell,mv88e6190" : Switch has base address 0x00. Use with models: - 6190, 6190X, 6191, 6290, 6390, 6390X + 6163, 6190, 6190X, 6191, 6290, 6390, 6390X - "marvell,mv88e6250" : Switch has base address 0x08 or 0x18. Use with model: 6220, 6250 From patchwork Fri May 19 14:12:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96447 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269464vqo; Fri, 19 May 2023 07:15:19 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ73KKPgfRfcM/gmc9A5ihZW/08otPsE1CVM5xa3utF2W+TyPS9d6twpbEWI5edFMd1i6sg4 X-Received: by 2002:a05:6a00:21cf:b0:644:18ec:4510 with SMTP id t15-20020a056a0021cf00b0064418ec4510mr3598738pfj.9.1684505719704; Fri, 19 May 2023 07:15:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505719; cv=none; d=google.com; s=arc-20160816; b=QX1pVBfiNXwsAHESXqoBU2O96TbSRvmmPB1VlotPZbJIPFU8lWBjNzp59Euys6QiIV WlUm/wXvB/ZQPIYdR/c0xVhzA2IBpKAIBNizGU0zwMulVxCJdrYXnQhRdqCQERXvaAxW vCJdmEYLH/z4ziQoUCw07XYYeFrv5+2yQWpSQp2/jFeZBatReuPpdU0Qn2/XnMXucRe3 6kBlHNfqVXbnBKNei4PQjOMWBc4f+HGg7p42wLpqQ8DFurTpxiHJtc377A/DuHdKP+bF cDP9eeIouJlaNWNWleuQkE62qJe+ZAt26K1a6O8qkWFpDNKQtAloeVQ9o0/WQMzBw0Jg Wa7g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RbnRwa+V9iC7DR2jK0YOcpyWlvO4fLpqpNlnKGwZALk=; b=QV2x/cOtxzZUPMfNsa82tQbNRKUdpjuLXGwq28EExbAUM2YcwLXnnSTP2Oci93cjMn sz6tm6fdcwITFlzVRhhXE3sJwLLmyEOyfYsU/U1JCqTGuPdz/8TZhvNi7JD+HD96MsFK f3BXLXxBASPuyOENL76i5af6awvJXlQ2eh7Rza1EHRclPKvpVAk1a3z46reqfH37qxQm gSGj0UAPxXqmaHmr79vm93e6z0Ibyg2/eOK382L2fP0wkAI8NMC5DQom5TO9VMF+Yi+0 D3T+4rAxUybgfKT/rRDk6AdnpNsU4SBcPPsYefMzibKr+GL2Dh+Awbt6N5dsiV4l+RVm fZiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZGm68zV8; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s12-20020a63b40c000000b00518a1800624si3823799pgf.307.2023.05.19.07.15.03; Fri, 19 May 2023 07:15:19 -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 header.i=@bootlin.com header.s=gm1 header.b=ZGm68zV8; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232080AbjESONN (ORCPT + 99 others); Fri, 19 May 2023 10:13:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232065AbjESONG (ORCPT ); Fri, 19 May 2023 10:13:06 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D746A192; Fri, 19 May 2023 07:13:04 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id E1648E0018; Fri, 19 May 2023 14:13:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505583; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RbnRwa+V9iC7DR2jK0YOcpyWlvO4fLpqpNlnKGwZALk=; b=ZGm68zV8E4hlpG7EeqdCgsf8/g8ZH4dx0knLP4oAQIkggF7GFrJkjcFBr+aiY3Vjb9jF2X 2IttnsEYN0CSB5SNVBVGQdxer0lyJoaWC95EKRXo+FIszaAZRM1nJ0/36I66fsRAiQSsIv RJQNAvwDu3FjCuvdIIimmLSCDvbuGwDSojoTDINtOh833TKxBgqHWjC922WlumBan9Q0um PiphIjaroRsBw90R90UB2kCxz+ceyqC7kNnXnxKQJ+1+wJ28jFddJ0IxJH/dv1HZpbFoSg fux5FEqS/w85dYNLR8cwDoPcQr2WpYOvk1SrnjLEDjr0zuMR/Vlt2alVa4AywQ== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 2/7] net: dsa: mv88e6xxx: pass directly chip structure to mv88e6xxx_phy_is_internal Date: Fri, 19 May 2023 16:12:58 +0200 Message-Id: <20230519141303.245235-3-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332269554792072?= X-GMAIL-MSGID: =?utf-8?q?1766332269554792072?= From: Alexis Lothoré Since this function is a simple helper, we do not need to pass a full dsa_switch structure, we can directly pass the mv88e6xxx_chip structure. Doing so will allow to share this function with any other function not manipulating dsa_switch structure but needing info about number of internal phys Signed-off-by: Alexis Lothoré Reviewed-by: Russell King (Oracle) Reviewed-by: Florian Fainelli --- drivers/net/dsa/mv88e6xxx/chip.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 64a2f2f83735..93bcfa5c80e1 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -463,10 +463,8 @@ static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, return err; } -static int mv88e6xxx_phy_is_internal(struct dsa_switch *ds, int port) +static int mv88e6xxx_phy_is_internal(struct mv88e6xxx_chip *chip, int port) { - struct mv88e6xxx_chip *chip = ds->priv; - return port < chip->info->num_internal_phys; } @@ -584,7 +582,7 @@ static void mv88e6095_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, config->mac_capabilities = MAC_SYM_PAUSE | MAC_10 | MAC_100; - if (mv88e6xxx_phy_is_internal(chip->ds, port)) { + if (mv88e6xxx_phy_is_internal(chip, port)) { __set_bit(PHY_INTERFACE_MODE_MII, config->supported_interfaces); } else { if (cmode < ARRAY_SIZE(mv88e6185_phy_interface_modes) && @@ -832,7 +830,7 @@ static void mv88e6xxx_get_caps(struct dsa_switch *ds, int port, chip->info->ops->phylink_get_caps(chip, port, config); mv88e6xxx_reg_unlock(chip); - if (mv88e6xxx_phy_is_internal(ds, port)) { + if (mv88e6xxx_phy_is_internal(chip, port)) { __set_bit(PHY_INTERFACE_MODE_INTERNAL, config->supported_interfaces); /* Internal ports with no phy-mode need GMII for PHYLIB */ @@ -853,7 +851,7 @@ static void mv88e6xxx_mac_config(struct dsa_switch *ds, int port, mv88e6xxx_reg_lock(chip); - if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(ds, port)) { + if (mode != MLO_AN_PHY || !mv88e6xxx_phy_is_internal(chip, port)) { /* In inband mode, the link may come up at any time while the * link is not forced down. Force the link down while we * reconfigure the interface mode. From patchwork Fri May 19 14:12:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96448 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269652vqo; Fri, 19 May 2023 07:15:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6wOk8rRgdxBimAI7gBr2TS3CnIP75cv3XnZLeMePWNQbPlmSsEFASbjYGkcb1QO88Br/89 X-Received: by 2002:a05:6a20:72a0:b0:100:a201:83dc with SMTP id o32-20020a056a2072a000b00100a20183dcmr2446361pzk.35.1684505733596; Fri, 19 May 2023 07:15:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505733; cv=none; d=google.com; s=arc-20160816; b=QFWytWBTa73Tt56xABK66ZJSG0ugMVIiDZl84g2QvJJMokLJF/hj749DTRe5XjABZK eijU0jJCIRwUL2uVImAsu5txo2s00zro2BOxxwPsQ1VuwSLV/TT1iZGX4VQ7Rs98C4aB gqjmMHtE4if64IohC8zE/suCKsEVJkEYv/V1WkSHwBdPxzPgxmmsYGHMxzinF/WqS95S y944NhAewXBU71waZjQTTQMzgYTYN9/2ZmyRY+YBpBa3EJg1otxeOXZyeiLiCX7dowAr 8bDOXC/scl4WtmfdV0TH9U9pRfQ7Dvk/syxXtwSpkDlhTEvocg94MPSJdEiYPnQ9FjBY 6E/A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/PdR+46jyf8bKiK0AiqIRHB98lWg+txwfuVwXSZEZOI=; b=qIR44XUSkIXEC7hdWJ9fdapvLHu2UX4wMiAyBWYphZI5iJrYGWYtDHnaK8+Oii/lRy +7SzRPidbIXLejVv0kW2f44mefNMXoTQvtyZ/12uzSZWPWUio1FG1ZB8ltuBjEtTPVo/ AWD0svIki5FbUklL2ZxgA/pxyZ95dWQyCK39NM69burc+8oikMbuycNxD68+ujsLQZg4 jPm0G8QTtIEXuiL2xNl7uWVSWxXGINoYJ5IBXNfpbA2x5bJ3Bfd/qA+VQG5Qd884u6Hx 1Po/eK0Zf6Xw9WpUWSlOGH0FkEuvSoDnEX4CCZFw2SgC4soMhDZgCQ5n7EYzWS0Kx+NP qvRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=OrZjSUTt; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h190-20020a6383c7000000b00535f192827bsi57642pge.542.2023.05.19.07.15.18; Fri, 19 May 2023 07:15:33 -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 header.i=@bootlin.com header.s=gm1 header.b=OrZjSUTt; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232094AbjESONQ (ORCPT + 99 others); Fri, 19 May 2023 10:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232066AbjESONH (ORCPT ); Fri, 19 May 2023 10:13:07 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 675DF1A8; Fri, 19 May 2023 07:13:06 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id A885FE0010; Fri, 19 May 2023 14:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/PdR+46jyf8bKiK0AiqIRHB98lWg+txwfuVwXSZEZOI=; b=OrZjSUTtbd3MYNoQhzPqmL+Bt6G6R77yrFw7tD2/YyxBo+hNhCGJzyHYsfdMHw+3iwgPcz n8QTKAER1dQOZIY2BF2fxptOIOoZFj1ASvgGO8UAVuRZMxBReYxt1NUAYYHI2Funj7vlB5 9zVHXA+GF2knPytanEyeqc4hZgAviLHaDlPPMflvtS/k8n9pU87RdHh/mlTUwZrDPN+Vfw PXBNAZSE0d08wEfI/6p21zTlycAGyFJBcKyUKkseEHpKvVzTZw7WEyJp6swgkOLuPE1OrM GMykI+EFwl7JGGy2nLvTO28rgFwizsQw6cXKfTrvNy83YEw1eos74CVondSWtA== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 3/7] net: dsa: mv88e6xxx: use mv88e6xxx_phy_is_internal in mv88e6xxx_port_ppu_updates Date: Fri, 19 May 2023 16:12:59 +0200 Message-Id: <20230519141303.245235-4-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332284119277558?= X-GMAIL-MSGID: =?utf-8?q?1766332284119277558?= From: Alexis Lothoré Make sure to use existing helper to get internal PHYs count instead of redoing it manually Signed-off-by: Alexis Lothoré Reviewed-by: Russell King (Oracle) Reviewed-by: Florian Fainelli --- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 93bcfa5c80e1..c812e52bb5b7 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -477,7 +477,7 @@ static int mv88e6xxx_port_ppu_updates(struct mv88e6xxx_chip *chip, int port) * report whether the port is internal. */ if (chip->info->family == MV88E6XXX_FAMILY_6250) - return port < chip->info->num_internal_phys; + return mv88e6xxx_phy_is_internal(chip, port); err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, ®); if (err) { From patchwork Fri May 19 14:13:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96449 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269722vqo; Fri, 19 May 2023 07:15:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4ZOhAZ4LFAISgaGzrCN9MxIBoYNYOCioLGWBnzreFvw429tHY8S4vR77w55hShoF6Ro5vm X-Received: by 2002:a05:6a20:4c9:b0:109:c161:a67d with SMTP id 9-20020a056a2004c900b00109c161a67dmr1907214pzd.18.1684505737842; Fri, 19 May 2023 07:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505737; cv=none; d=google.com; s=arc-20160816; b=Dfxh+JDNI3fSGNdTBuoAQj/0+DESOhCdSQHo1d2lkBD3e6SOUvkZul7NR46sBhVxxu A5YwLRjmaFosOQhV5aMCi/BDBf3AV3zUVe9FR90Lbp/o6yW8MUGDAuF2mVPVUodimBIc 0b6+jQSvcK1m+5AW7cwMntRFkaa7uGbxMZaqxgA0skmGRI0cR3t1YzZYyCITFGe0yBmQ NuJn0631TpO4pHTqO+QVg/zCPMfw8HTKI9w0ilyit01bMHaV+56J1w7pdFL+GZk88ZSb dXtgyWbT4J/+idf0I7dBDS8MP80Sqqugi8KaJ6G165rMv56YRm+XusBtiddG+Ha1tHp2 t3AA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tZKqks+YZF6QNGHbXF5J2Rk0M/jecF/f0cv7RwbH0nk=; b=DJiooCzz/99yQaWvNrwjXk6x9KqpYoUwzPrdxEnZeAYVgbDxUXTSi1dic5uC31mS0s 24lXCE8k9CUA0USv+8H7UrKBqRWAIerl49G3Rf22cRNSbIzCW3T6F+Ifn+urs1yX3XM6 Gu886nbtrKCGAStp2NUUorUM/ZKYwA1cBL8S/+6fwN1cAOn8ggMgiKkl1ZcDGF9bSBCj uQAKsp2yflUHkV+SvTGQqtyh6LLQbaYYXyQwqDj8m8fudTpjsj2LdK7O3r2ULKkSzsMY 22SFh9mNLwWvEAhgRtoXQo3paCRLqp0JEksj4SvESckzUhSluMMZToLrFPED3ZyQNxkU 0YhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KcLAgXCE; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s17-20020a639251000000b005192652814bsi3825502pgn.541.2023.05.19.07.15.21; Fri, 19 May 2023 07:15:37 -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 header.i=@bootlin.com header.s=gm1 header.b=KcLAgXCE; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231971AbjESONT (ORCPT + 99 others); Fri, 19 May 2023 10:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232077AbjESONJ (ORCPT ); Fri, 19 May 2023 10:13:09 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30CDF1A7; Fri, 19 May 2023 07:13:08 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 5BDD1E0007; Fri, 19 May 2023 14:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tZKqks+YZF6QNGHbXF5J2Rk0M/jecF/f0cv7RwbH0nk=; b=KcLAgXCEqnrSbALl4WaNA01NoxKRvdg7eg3cLdL9xJhfKYDwaPdr+vIE0BasMrAuXVRm1x YsAwlNo4W+1E53Iw3ZC1zaFxX/tMFjIelljXf44P8ic4VL2nIIwkfLJOhqTHhw1kq/mUnV 0uxtkx+X5iK0GWUxPFlbHNIKzZjdTbyIucSz31a9GYna7oELXDp86fuF5Es9/J2arFRkLn sb1z97jeaL3KXRGqYkHijYpmifckGGrJtTftbIK+Myhg3xKhuee4CjpCqFPgn1QHyjktpH rwomtqPsYmt/H7CoC6Sbo+/4xTkN1/RRY7p5wT1GwJWQEno/UJRDdf2EzuquDg== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 4/7] net: dsa: mv88e6xxx: add field to specify internal phys layout Date: Fri, 19 May 2023 16:13:00 +0200 Message-Id: <20230519141303.245235-5-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332288650557597?= X-GMAIL-MSGID: =?utf-8?q?1766332288650557597?= From: Alexis Lothoré mv88e6xxx currently assumes that switch equipped with internal phys have those phys mapped contiguously starting from port 0 (see mv88e6xxx_phy_is_internal). However, some switches have internal PHYs but NOT starting from port 0. For example 88e6393X, 88E6193X and 88E6191X have integrated PHYs available on ports 1 to 8 To properly support this offset, add a new field to allow specifying an internal PHYs layout. If field is not set, default layout is assumed (start at port 0) Signed-off-by: Alexis Lothoré --- drivers/net/dsa/mv88e6xxx/chip.c | 4 +++- drivers/net/dsa/mv88e6xxx/chip.h | 5 +++++ drivers/net/dsa/mv88e6xxx/global2.c | 6 +++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index c812e52bb5b7..2716d17c5c49 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -465,7 +465,9 @@ static int mv88e6xxx_port_setup_mac(struct mv88e6xxx_chip *chip, int port, static int mv88e6xxx_phy_is_internal(struct mv88e6xxx_chip *chip, int port) { - return port < chip->info->num_internal_phys; + return port >= chip->info->internal_phys_offset && + port < chip->info->num_internal_phys + + chip->info->internal_phys_offset; } static int mv88e6xxx_port_ppu_updates(struct mv88e6xxx_chip *chip, int port) diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index da6e1339f809..eca51946c100 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -167,6 +167,11 @@ struct mv88e6xxx_info { /* Supports PTP */ bool ptp_support; + + /* Internal PHY start index. 0 means that internal PHYs range starts at + * port 0, 1 means internal PHYs range starts at port 1, etc + */ + unsigned int internal_phys_offset; }; struct mv88e6xxx_atu_entry { diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c index 615896893076..d460f7290012 100644 --- a/drivers/net/dsa/mv88e6xxx/global2.c +++ b/drivers/net/dsa/mv88e6xxx/global2.c @@ -1198,13 +1198,17 @@ int mv88e6xxx_g2_irq_mdio_setup(struct mv88e6xxx_chip *chip, { int phy, irq; - for (phy = 0; phy < chip->info->num_internal_phys; phy++) { + for (phy = chip->info->internal_phys_offset; + phy < + chip->info->num_internal_phys + chip->info->internal_phys_offset; + phy++) { irq = irq_find_mapping(chip->g2_irq.domain, phy); if (irq < 0) return irq; bus->irq[chip->info->phy_base_addr + phy] = irq; } + return 0; } From patchwork Fri May 19 14:13:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96450 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269738vqo; Fri, 19 May 2023 07:15:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5jlL6usW3y3XFAjvFSaFMZl1tjeVf+b8vZlpcpHd8aq5scbwg/wUHnu5efjYoVkv3xLTmX X-Received: by 2002:a05:6a00:1505:b0:63b:4313:f8c4 with SMTP id q5-20020a056a00150500b0063b4313f8c4mr3836540pfu.9.1684505739222; Fri, 19 May 2023 07:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505739; cv=none; d=google.com; s=arc-20160816; b=UnXl9GGngEYD91BsEwJfZmuXA6ZT/0ZIsv9dHgJAAG7RaicRmWlg84NlnjenUJEitM ZzncTsWUptT2izIGmnDsXSXwxdXA2rjlTyoN/NSJzozByNeRhprIDfkGvXaDHbPKJ6BK 45Fv9l3z6IeZHl5pXrQ+rC/EcCD1REZE0jr5IZGn1kNcpmoZxrYXF0c7NPDJpCtuo7TI 95nqIq5ME+WQ6e+ob+ggoSZSRmWimxeKUvKdXDtypuCVXPZNhivlOJ/OY7ZYBeX/gH/a 4J5Amkr38DNRmvubfsPiHLmB+0Hco0Po01THsPHZPfX1eFwtuFnom+RIV/YY1qgsBAl6 Dc6A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qBHDgODuRA2mc9mP3Izczog1YAv4uS8QCvhF8LhFK3o=; b=JMghBo+fDDEnqfOqOE/13fgpbdNgysqmKiDOJ/EPq7gUX2kMVd9MycBfIQVhPwVgm0 tLFFYCtYOVh44LBVYp83p8QuK8wSWRU9gSrAZ8CzHOyzXv2Ub8igrvdVCBEMm0erVPyz l1RHK1wNZa1Nz/n8WJW4e4s2y2FM6ugWKELpt55EQ/49Xgu6Ofq2ZJBcbeUvyUm3AH6b BTlwIMmRsO9bEkMxUAEZ/7ECD5a9f0oZoELivmFwDiEJJ6QXgd9HyG74HS7CSunj27cB U+2fx5SZrpPIEczphOPuZIjbZVaE+OdddMeHtjZGKybX9GWpyeaGpcjplJyU3QQhpJMP 00eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=PuhoWhkM; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bs65-20020a632844000000b005139e0d2b5csi3637860pgb.487.2023.05.19.07.15.23; Fri, 19 May 2023 07:15:39 -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 header.i=@bootlin.com header.s=gm1 header.b=PuhoWhkM; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232103AbjESONV (ORCPT + 99 others); Fri, 19 May 2023 10:13:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbjESONL (ORCPT ); Fri, 19 May 2023 10:13:11 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2515A3; Fri, 19 May 2023 07:13:09 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 180BAE0013; Fri, 19 May 2023 14:13:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505588; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qBHDgODuRA2mc9mP3Izczog1YAv4uS8QCvhF8LhFK3o=; b=PuhoWhkMH48bvsVwi1zL2F0myAEP4debKZGYE7XZo2ivzqQiqO+NVbchhhG+B56c+jhZxQ CYozApTYmRY4xYRreC6TOBjq2qWcZ8QBc+UiAep855xYUNr/5xkoLu0o5Xth7DG1cO6Ocz dWXZe8XyJf5m77Ul0MsJmGYpCKYIMT5slScba+xrnSfuukVGGyNucWW9syUeOSRyBxqH7V mOQt59iMcpaJD6r9jLEATGb/vp5cKyd+n3sv0kLHkbXSO4kPGk/DkqOMlTfdymdN04XLIu bIu/1omlVsKT7sptgtKfzxd45x1twEvi0ZNTl6PUgyykwlV/WK6tqHwdkv1srg== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 5/7] net: dsa: mv88e6xxx: fix 88E6393X family internal phys layout Date: Fri, 19 May 2023 16:13:01 +0200 Message-Id: <20230519141303.245235-6-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332289961891666?= X-GMAIL-MSGID: =?utf-8?q?1766332289961891666?= From: Alexis Lothoré 88E6393X/88E6193X/88E6191X swicthes have in fact 8 internal PHYs, but those are not present starting at port 0: supported ports go from 1 to 8 Signed-off-by: Alexis Lothoré Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli --- drivers/net/dsa/mv88e6xxx/chip.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 2716d17c5c49..f15ca17bf9e2 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -6024,7 +6024,8 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .name = "Marvell 88E6191X", .num_databases = 4096, .num_ports = 11, /* 10 + Z80 */ - .num_internal_phys = 9, + .num_internal_phys = 8, + .internal_phys_offset = 1, .max_vid = 8191, .max_sid = 63, .port_base_addr = 0x0, @@ -6047,7 +6048,8 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .name = "Marvell 88E6193X", .num_databases = 4096, .num_ports = 11, /* 10 + Z80 */ - .num_internal_phys = 9, + .num_internal_phys = 8, + .internal_phys_offset = 1, .max_vid = 8191, .max_sid = 63, .port_base_addr = 0x0, @@ -6366,7 +6368,8 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .name = "Marvell 88E6393X", .num_databases = 4096, .num_ports = 11, /* 10 + Z80 */ - .num_internal_phys = 9, + .num_internal_phys = 8, + .internal_phys_offset = 1, .max_vid = 8191, .max_sid = 63, .port_base_addr = 0x0, From patchwork Fri May 19 14:13:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96451 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1269758vqo; Fri, 19 May 2023 07:15:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6yEOGQJCXEKcIJdIVGaYDsPmz0cCClao4ohUb2NCp6RqIa9PEzIJTTDRwsuukNfgamAWSY X-Received: by 2002:a17:90b:46c2:b0:247:2152:6391 with SMTP id jx2-20020a17090b46c200b0024721526391mr2415881pjb.17.1684505740583; Fri, 19 May 2023 07:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505740; cv=none; d=google.com; s=arc-20160816; b=weRt10G16bBFgMbJnnkLbWjdlLF+5Xzt4JNgp3bImdC1/y42gizSk1lwZc1x/dc8Je lF+XW6yFDijuHgRhdobdvRjMdkWDKHQWo2crvyIcUWhMplh1ds4utPY2nuzqzqD2u35z bSTRvJLOId08fiAoOwXnDZBlwB9gsKX3aY2rdwY7tmOjmJ5KAMxfKxmFWfqIkV69eG9T SAhbZ29ZobPXbYZ8aZRdCMe/jBjzF957hIYNtP8068ZLcLkkXhw/fTpP565BXxHzAnqP Wkyyn2XTmu64ltMaQbNrIgEszIJK0Ar624QyiZEVr4LE2pZP565aXQH+bBkwv0dGYJ81 WlfQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GD3HpwdAPAJ9CBxKjHowieAW3F05Ue1lxFDSEk1GFi4=; b=j4cs8WbB+7zRAw0Lhs9YerKJ7azlxTbDl/maRTjJs8XnFdPVkJX8IOg/eO7UuwSdIJ YjiLfdpxFM+WnlQ0nQ6Lfsu73yT7pTDV8Xsuh8WGZCINRQ94ci+GzPKLJp4Vp986WdI/ rOVCRvFqEh8JGVBXaQxHr4LeaapEtBpopnwaNxHXAXHajQlO+cTm1iKMotLXeptMv01M cVGlMwzbVIhLYQvFufA8LI7T3CaVR2Xs292RNb8glszSmu+Vkv5YMj6/BC5EcWwTF67n guqmpcI12wVj5W27jH7LsMHUWC3QlsIjf5MmmxDJUrZD+zPxPOACIjxD4XwjlMbylFJ5 A46w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=BiJmN6iK; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cl24-20020a17090af69800b00233f3034302si1713952pjb.46.2023.05.19.07.15.23; Fri, 19 May 2023 07:15:40 -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 header.i=@bootlin.com header.s=gm1 header.b=BiJmN6iK; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbjESONY (ORCPT + 99 others); Fri, 19 May 2023 10:13:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232062AbjESONN (ORCPT ); Fri, 19 May 2023 10:13:13 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A7A1B5; Fri, 19 May 2023 07:13:11 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id B54E3E0009; Fri, 19 May 2023 14:13:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505590; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GD3HpwdAPAJ9CBxKjHowieAW3F05Ue1lxFDSEk1GFi4=; b=BiJmN6iK7DXgwcIX3bFx5T/ySFmsH7KClO1G2ukKGPIfP391jZOPBqwPPGtGNQ00WgjveB Btv82zQff5ZZxtYR+XV+iU3dqozpREEXcP9V4c96LoPMzSTPUp+sSqF2oPj1PZpg4qv5wu xLov/P/qAIudxny+4gpYmwEGqqKL2/Bs/j+z7u2jHAmIeL26EKdIy0jHlEFILIIKJsS0gR Jfb9+GLRoeNMdE79utfpbGLOsd0HJnqZhsqK5NeSLs7dTengGDJ8IYQ/KiiCP+qsApCbHO dM08w6NeSpdsx9souR5MzaO9su8BBo4+1jxNKnP5QjafEWr6bezWbvC6w56dPw== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 6/7] net: dsa: mv88e6xxx: pass mv88e6xxx_chip structure to port_max_speed_mode Date: Fri, 19 May 2023 16:13:02 +0200 Message-Id: <20230519141303.245235-7-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332291222528034?= X-GMAIL-MSGID: =?utf-8?q?1766332291222528034?= From: Alexis Lothoré Some switches families have minor differences on supported link speed for ports. Instead of redefining a new port_max_speed_mode for each different configuration, allow to pass mv88e6xxx_chip structure to allow differentiating those chips by known chip id Signed-off-by: Alexis Lothoré Reviewed-by: Florian Fainelli --- drivers/net/dsa/mv88e6xxx/chip.c | 2 +- drivers/net/dsa/mv88e6xxx/chip.h | 3 ++- drivers/net/dsa/mv88e6xxx/port.c | 12 ++++++++---- drivers/net/dsa/mv88e6xxx/port.h | 12 ++++++++---- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index f15ca17bf9e2..0e6267193ac1 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3311,7 +3311,7 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) caps = pl_config.mac_capabilities; if (chip->info->ops->port_max_speed_mode) - mode = chip->info->ops->port_max_speed_mode(port); + mode = chip->info->ops->port_max_speed_mode(chip, port); else mode = PHY_INTERFACE_MODE_NA; diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index eca51946c100..dd7c8880e987 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -518,7 +518,8 @@ struct mv88e6xxx_ops { int speed, int duplex); /* What interface mode should be used for maximum speed? */ - phy_interface_t (*port_max_speed_mode)(int port); + phy_interface_t (*port_max_speed_mode)(struct mv88e6xxx_chip *chip, + int port); int (*port_tag_remap)(struct mv88e6xxx_chip *chip, int port); diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index f79cf716c541..66f1b40b4e96 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -342,7 +342,8 @@ int mv88e6341_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } -phy_interface_t mv88e6341_port_max_speed_mode(int port) +phy_interface_t mv88e6341_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port) { if (port == 5) return PHY_INTERFACE_MODE_2500BASEX; @@ -381,7 +382,8 @@ int mv88e6390_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } -phy_interface_t mv88e6390_port_max_speed_mode(int port) +phy_interface_t mv88e6390_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port) { if (port == 9 || port == 10) return PHY_INTERFACE_MODE_2500BASEX; @@ -403,7 +405,8 @@ int mv88e6390x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, duplex); } -phy_interface_t mv88e6390x_port_max_speed_mode(int port) +phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port) { if (port == 9 || port == 10) return PHY_INTERFACE_MODE_XAUI; @@ -500,7 +503,8 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, return 0; } -phy_interface_t mv88e6393x_port_max_speed_mode(int port) +phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port) { if (port == 0 || port == 9 || port == 10) return PHY_INTERFACE_MODE_10GBASER; diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index aec9d4fd20e3..3c9fc17abdd2 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h @@ -359,10 +359,14 @@ int mv88e6390x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex); -phy_interface_t mv88e6341_port_max_speed_mode(int port); -phy_interface_t mv88e6390_port_max_speed_mode(int port); -phy_interface_t mv88e6390x_port_max_speed_mode(int port); -phy_interface_t mv88e6393x_port_max_speed_mode(int port); +phy_interface_t mv88e6341_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port); +phy_interface_t mv88e6390_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port); +phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port); +phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip, + int port); int mv88e6xxx_port_set_state(struct mv88e6xxx_chip *chip, int port, u8 state); From patchwork Fri May 19 14:13:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 96452 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1271001vqo; Fri, 19 May 2023 07:17:12 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4sJUCyogqsWD4p/Ana0yE8cocTJWoiV+qnQGkbXyg+XV91sIp/2SqPEG6WdXhF5kMa74cZ X-Received: by 2002:a05:6a21:6da7:b0:ff:c184:7c6b with SMTP id wl39-20020a056a216da700b000ffc1847c6bmr2428360pzb.10.1684505832092; Fri, 19 May 2023 07:17:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684505832; cv=none; d=google.com; s=arc-20160816; b=SxSxKgAeoQtdhxNZAt2Erz5/gNM5+ab43UPEQaTU9HqlKUJy1k4jx+zsN+HFSQyDJG ctoZFOhVmITgJa3y1rJA3wLrCIZdWzJJ+S584U5/lxpiitPZ8nX0Fkwlqf5GunnI4Mw9 7aCz1PKom6WVaDEfVxfKwibr05Wyb0cuI3LOTz/zABWogenastF/12ahZPeqMOciWI1c USIacbnLSgLgW2cGnbPUz2fpsEKs9uGAqugoLyy5CbziYTUdlV51AbAqZjlkdkI0tp6D G8kIscCYihlFcVDQQ+4Jy0ESFtRefhqZ6ig0qHe88sl4cALtwhBsX2gQzAMJpG6ZJ7Qc eBpQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+pTZBh4+ZRBlZb4kygGnhcmsOQohHM/7lyy4o5VBhtc=; b=mybDw8fEaY6rlefjG46WfDVnoK8yV34AlX3mG+e6KMFGEm55J2p3LUVLXUxYkKJxYd Lk0MgBpJErhmyXJAkif4DdU1+21qp2NXzVt6/+qCR0ZwW3yfF/Q9spMGOrsIjecyoAXN WBnIDIn4IdX2d1H+Mf2slSdW+u+N7C81JDOY6FC14IQ8ptQD4kbVMOh5udtcJBMQLmpp Gp3aiL/63Dcvv8NCSq5zlb/X6I80IXKD++keFlaMgqmsnpw9D8c9pdySicnshLVwf+1A WN1OUMZJwhcsF8vE2I/9Rf0QPjX3ALGbQ1uZ6Xl41uLwIFivRDMJ4973SHX/avVq+0fl /PcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=VMGIdgCi; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z6-20020aa79906000000b0063b669ec9a0si4124961pff.103.2023.05.19.07.16.57; Fri, 19 May 2023 07:17:12 -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 header.i=@bootlin.com header.s=gm1 header.b=VMGIdgCi; 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=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbjESONb (ORCPT + 99 others); Fri, 19 May 2023 10:13:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232088AbjESONP (ORCPT ); Fri, 19 May 2023 10:13:15 -0400 Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [217.70.183.196]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6039312C; Fri, 19 May 2023 07:13:13 -0700 (PDT) Received: (Authenticated sender: alexis.lothore@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 7C022E0004; Fri, 19 May 2023 14:13:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1684505592; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+pTZBh4+ZRBlZb4kygGnhcmsOQohHM/7lyy4o5VBhtc=; b=VMGIdgCi44uU+239PmKYr3hORa6blm2Sw0Jfh58S3ybM2XtaCYH2LcWaKdiocMO9iv0PrG c47UrQC4zi1D7b22yRPaveCOwSGl7d8GI6OP39pzKa+PHE5t4K+O81oQsDXD7Tj4rIYOko Q8R7mYKMjPFISfWn77kUDVO2CkV/zmTCmcaJN9ZU8AdblWuScJ4UhQv31rgI34J64nfIrd gm7/IPYQCNXHjRteibT71pJIYxtFHuY21pTWTxS8wnyL2phD67vJRH8vI4xPoIDVejWINk tO4ovUl6uVkeDAHJ014SetNThJWq1MJT+YMUakikoGJoc/8rZfxB/dgYweZGRg== From: alexis.lothore@bootlin.com To: Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Russell King Cc: netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, thomas.petazzoni@bootlin.com, paul.arola@telus.com, scott.roberts@telus.com, =?utf-8?q?Marek_Beh=C3=BAn?= , =?utf-8?q?Alexis_Lothor?= =?utf-8?q?=C3=A9?= Subject: [PATCH net-next v2 7/7] net: dsa: mv88e6xxx: enable support for 88E6361 switch Date: Fri, 19 May 2023 16:13:03 +0200 Message-Id: <20230519141303.245235-8-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230519141303.245235-1-alexis.lothore@bootlin.com> References: <20230519141303.245235-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766332387547329991?= X-GMAIL-MSGID: =?utf-8?q?1766332387547329991?= From: Alexis Lothoré Marvell 88E6361 is an 8-port switch derived from the 88E6393X/88E9193X/88E6191X switches family. It can benefit from the existing mv88e6xxx driver by simply adding the proper switch description in the driver. Main differences with other switches from this family are: - 8 ports exposed (instead of 11): ports 1, 2 and 8 not available - No 5GBase-x nor SFI/USXGMII support --- Changes since v1: - define internal phys offset - enforce 88e6361 features in mv88e6393x_phylink_get_caps - enforce 88e6361 features in mv88e6393x_port_set_speed_duplex - enforce 88e6361 features in mv88e6393x_port_max_speed_mode Signed-off-by: Alexis Lothoré --- drivers/net/dsa/mv88e6xxx/chip.c | 42 ++++++++++++++++++++++++++++---- drivers/net/dsa/mv88e6xxx/chip.h | 3 ++- drivers/net/dsa/mv88e6xxx/port.c | 11 ++++++++- drivers/net/dsa/mv88e6xxx/port.h | 1 + 4 files changed, 50 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 0e6267193ac1..7c77b4b634f9 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -790,6 +790,8 @@ static void mv88e6393x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, unsigned long *supported = config->supported_interfaces; bool is_6191x = chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6191X; + bool is_6361 = + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361; mv88e6xxx_translate_cmode(chip->ports[port].cmode, supported); @@ -804,13 +806,17 @@ static void mv88e6393x_phylink_get_caps(struct mv88e6xxx_chip *chip, int port, /* 6191X supports >1G modes only on port 10 */ if (!is_6191x || port == 10) { __set_bit(PHY_INTERFACE_MODE_2500BASEX, supported); - __set_bit(PHY_INTERFACE_MODE_5GBASER, supported); - __set_bit(PHY_INTERFACE_MODE_10GBASER, supported); + config->mac_capabilities |= MAC_2500FD; + + /* 6361 only supports up to 2500BaseX */ + if (!is_6361) { + __set_bit(PHY_INTERFACE_MODE_5GBASER, supported); + __set_bit(PHY_INTERFACE_MODE_10GBASER, supported); + config->mac_capabilities |= MAC_5000FD | + MAC_10000FD; + } /* FIXME: USXGMII is not supported yet */ /* __set_bit(PHY_INTERFACE_MODE_USXGMII, supported); */ - - config->mac_capabilities |= MAC_2500FD | MAC_5000FD | - MAC_10000FD; } } @@ -6311,6 +6317,32 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .ptp_support = true, .ops = &mv88e6352_ops, }, + [MV88E6361] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6361, + .family = MV88E6XXX_FAMILY_6393, + .name = "Marvell 88E6361", + .num_databases = 4096, + .num_macs = 16384, + .num_ports = 11, + /* Ports 1, 2 and 8 are not routed */ + .invalid_port_mask = BIT(1) | BIT(2) | BIT(8), + .num_internal_phys = 5, + .internal_phys_offset = 3, + .max_vid = 4095, + .max_sid = 63, + .port_base_addr = 0x0, + .phy_base_addr = 0x0, + .global1_addr = 0x1b, + .global2_addr = 0x1c, + .age_time_coeff = 3750, + .g1_irqs = 10, + .g2_irqs = 14, + .atu_move_port_mask = 0x1f, + .pvt = true, + .multi_chip = true, + .ptp_support = true, + .ops = &mv88e6393x_ops, + }, [MV88E6390] = { .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6390, .family = MV88E6XXX_FAMILY_6390, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index dd7c8880e987..79c06ba42c54 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -82,6 +82,7 @@ enum mv88e6xxx_model { MV88E6350, MV88E6351, MV88E6352, + MV88E6361, MV88E6390, MV88E6390X, MV88E6393X, @@ -100,7 +101,7 @@ enum mv88e6xxx_family { MV88E6XXX_FAMILY_6351, /* 6171 6175 6350 6351 */ MV88E6XXX_FAMILY_6352, /* 6172 6176 6240 6352 */ MV88E6XXX_FAMILY_6390, /* 6190 6190X 6191 6290 6390 6390X */ - MV88E6XXX_FAMILY_6393, /* 6191X 6193X 6393X */ + MV88E6XXX_FAMILY_6393, /* 6191X 6193X 6361 6393X */ }; /** diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index 66f1b40b4e96..e72ea3c8092f 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -421,9 +421,14 @@ phy_interface_t mv88e6390x_port_max_speed_mode(struct mv88e6xxx_chip *chip, int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { + bool is_6361 = + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361; u16 reg, ctrl; int err; + if (is_6361 && speed > 2500) + return -EOPNOTSUPP; + if (speed == 200 && port != 0) return -EOPNOTSUPP; @@ -506,8 +511,12 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, phy_interface_t mv88e6393x_port_max_speed_mode(struct mv88e6xxx_chip *chip, int port) { + bool is_6361 = + chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6361; + if (port == 0 || port == 9 || port == 10) - return PHY_INTERFACE_MODE_10GBASER; + return is_6361 ? PHY_INTERFACE_MODE_2500BASEX : + PHY_INTERFACE_MODE_10GBASER; return PHY_INTERFACE_MODE_NA; } diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index 3c9fc17abdd2..56dfa9d3d4e0 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h @@ -138,6 +138,7 @@ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6141 0x3400 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6341 0x3410 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6352 0x3520 +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6361 0x2610 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6350 0x3710 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6351 0x3750 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6390 0x3900