From patchwork Thu Oct 29 05:41:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavana Sharma X-Patchwork-Id: 11865643 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB916C55178 for ; Thu, 29 Oct 2020 08:15:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CC5D21D47 for ; Thu, 29 Oct 2020 08:15:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=digi.com header.i=@digi.com header.b="ruLCFPTz" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgJ2IPB (ORCPT ); Thu, 29 Oct 2020 04:15:01 -0400 Received: from outbound-ip24b.ess.barracuda.com ([209.222.82.221]:60610 "EHLO outbound-ip24b.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727124AbgJ2IO6 (ORCPT ); Thu, 29 Oct 2020 04:14:58 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2042.outbound.protection.outlook.com [104.47.73.42]) by mx2.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Oct 2020 08:14:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lDx97F7hZrSi/dzUyqkO+OkIeeBdr1XBk6feEjqyTIS8KxXDNbmMwhkEYREmnnkYrEI1tjY4kCoJSqae0W+9vX0Iv5AQLzJvTQSKQ3WFiy9Hp/cPEGF6zIpzus8NGbZKbK/Ul8LTrcTe7MRVkDPn1Cde+/lza3Ypa8MXJhn8ru2s1x4f6QRsCHLMenqrs5WoeZJLHDs68M3nHogoDn0I8jbKPTo+pW3Was/qRX4LT3iSN5zSD/EvsO+HZQknNDd72V6BR0O4X8vxZNPVknBiSMeEgXrAzs+PsaCblYKwxWJy15s3MXvNk+omg1KHRlg1DErC0Hqa/LkC0h4HSsh6YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vVeJPFnY66ukP2RQoBED8DfZLVWxBlrS8N01PAgmsec=; b=EoGtBTEQ9lEt6ERZZHmDFAopqeRVJwYINODvaPSGO5JQ5PaBNLG6/HhM2WcaPf2/ZUS+y5/HFZE86Cvt4L5AMgt5KQatmv0gNyRjlPk0LPmF/o0NLLGE50nFaKTw4DBxKEuzhALwSmiemZq1neMDH7WXwk9MyDKZdn+f7ACWXLzdZkP8Pcb3x8uErJ+J07b+qYcpQseRV6qW9kqhyrDdujRfyJqDbPefFEsNhiJIYZ2eFq5dIVl4B9eEKagfxAm2I2OncbetY/oVIiZMtsLJEdeRrUo4gUHh/IVsQlI6n6xNS6VJsQ1L0A5FHjuCbYlCiC4JGnYVL3+l9g4aAxkkVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=digi.com; dmarc=pass action=none header.from=digi.com; dkim=pass header.d=digi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vVeJPFnY66ukP2RQoBED8DfZLVWxBlrS8N01PAgmsec=; b=ruLCFPTzJ3CxH9XBCl2APEwKyAxfq1n4vG+etG9jtTHtAqtUaDODBZJKelihNrm755WLuKC0mGuVeqnLpUS3ouK1w/hrN9K7dNRIUWL3ZJRKXB6kCNr8PNKSab1+4EYaoqecsaHRwp78SHuXrokjr2JcrBYNAdQz1TivMVUz5/s= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=digi.com; Received: from MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) by MN2PR10MB4189.namprd10.prod.outlook.com (2603:10b6:208:1de::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 05:41:53 +0000 Received: from MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32]) by MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32%8]) with mapi id 15.20.3477.028; Thu, 29 Oct 2020 05:41:53 +0000 From: Pavana Sharma To: andrew@lunn.ch Cc: davem@davemloft.net, f.fainelli@gmail.com, gregkh@linuxfoundation.org, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pavana.sharma@digi.com, vivien.didelot@gmail.com, marek.behun@nic.cz, ashkan.boldaji@digi.com Subject: [PATCH v6 1/4] dt-bindings: net: Add 5GBASER phy interface mode Date: Thu, 29 Oct 2020 15:41:21 +1000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [58.84.104.89] X-ClientProxiedBy: SYXPR01CA0102.ausprd01.prod.outlook.com (2603:10c6:0:2d::11) To MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (58.84.104.89) by SYXPR01CA0102.ausprd01.prod.outlook.com (2603:10c6:0:2d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Thu, 29 Oct 2020 05:41:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 3dd2d05f-2b62-4588-e41b-08d87bcd56be X-MS-TrafficTypeDiagnostic: MN2PR10MB4189: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:296; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vPmOb1JOZgGndLlnBwWIhIMQz0MwJp/gjDMbvUE6p7tA2p5jVupIdP/+d5lDKg53LpPLkVogmF2wyk3thFeS1noXFXY3kfbrX7wO4yuRFZoekYwIFs99AyDyM+GOd1OT0UhfN5LzuPAY6VJmWQbqnFU3KcW0DifsJ4EdqSEAGN6cw991nxxBeE6AcOFHEY5GBOsvJWerB7LMc0xM4U8cDxiR5BlU0m4+ROmwmLE38wm33hY3akwFlSa765/Fu/luKBdgnvw+cSSXFsHvrpBlkClE5jiwl4ZcgqhQuS3cU4emnGj1atB/582G+088prcQPF/8FjmC4eTvXgOOKIjNMoW1lxhRevaPpLVdYaoIdGN9hCF9UG2h7r+lhKEYzmxn X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB4174.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(136003)(376002)(366004)(396003)(2616005)(956004)(69590400008)(8936002)(66476007)(6666004)(16526019)(66946007)(316002)(186003)(2906002)(4744005)(44832011)(8676002)(6916009)(107886003)(6486002)(36756003)(26005)(66556008)(5660300002)(86362001)(6506007)(4326008)(6512007)(52116002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: SGk8SFFz/aLjEni3LwXGhbmIapnGteG5XLO+xp5KNuPDHnZHLeeVB26mFtgHAzRvukUsRLL1ulBsybaFa460mk6JuPWPyK6OCZhON1L6EMCUOq3H3EEoCC6kjzC+EQGBcX0KQm8OsF6RL6gYi4b3vLP7mhF/Yl0zSxosj+Po+K/gbTwfT0tsTEningAUNqRsS51qsHyH9yf+T1LZ5e6YwlMwTENuAeBVp1kQQS5oGS8MSxzlbQ2U4luZG+tG9VgrFD36geUyU8TT70mCn9Me3M10TelgdPZvBGanOsHg/iL5dp+09fpdfHRRqjmTweN+nXhT9ipEFqnsrahWe5a1bB3gURyp0lfUOW/Vg8vLQr+ZEzDh8N0GfQY1fy1uIx9ywRGJdd7RkUug5Ubs4CxPe8+DD8rtqtU47GfrkoX9wixUh7hNDq5qpuZurXHTc4M7EDGZqzrBbxSuEheqx6qr+mgAK/CzNt1pMvNk4mfXFQfMQ7hsipy51PpYBkweyRqsHLann0QDiZlqRUYOLSbCvLfimvIEVpP250RESkyR677o7LdvUd78mHfkONUHgd1pds+FBYM/yLEheVsaiG8ISkpz/6xgyi4kJ2zusmi0UtW8VlOZ8zp0Byvb1CHTr+k4SJNnog7IyE8K4+10q3iTzQ== X-OriginatorOrg: digi.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3dd2d05f-2b62-4588-e41b-08d87bcd56be X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4174.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 05:41:53.0571 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: abb4cdb7-1b7e-483e-a143-7ebfd1184b9e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: N3EbwhgmaV7eNEDiOMtDWPH46L6n1km4IqKCoNBwaniVv2k5LgsZo1pS6jLYGWNDuNnw6xaRA8Bj/Og4ie2ERg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4189 X-BESS-ID: 1603959296-893003-5193-246828-1 X-BESS-VER: 2019.1_20201026.1928 X-BESS-Apparent-Source-IP: 104.47.73.42 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.227845 [from cloudscan16-168.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound 0.00 MSGID_FROM_MTA_HEADER META: Message-Id was added by a relay X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS112744 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND, MSGID_FROM_MTA_HEADER X-BESS-BRTS-Status: 1 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add 5GBASE-R phy interface mode supported by mv88e6393 family. Signed-off-by: Pavana Sharma --- Documentation/devicetree/bindings/net/ethernet-controller.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/net/ethernet-controller.yaml b/Documentation/devicetree/bindings/net/ethernet-controller.yaml index fa2baca8c726..068c16fd27dc 100644 --- a/Documentation/devicetree/bindings/net/ethernet-controller.yaml +++ b/Documentation/devicetree/bindings/net/ethernet-controller.yaml @@ -92,6 +92,8 @@ properties: - rxaui - xaui + # 5GBASE-R + - 5gbase-r # 10GBASE-KR, XFI, SFI - 10gbase-kr - usxgmii From patchwork Thu Oct 29 05:42:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavana Sharma X-Patchwork-Id: 11865647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F637C2D0A3 for ; Thu, 29 Oct 2020 08:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ACE8920720 for ; Thu, 29 Oct 2020 08:17:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=digi.com header.i=@digi.com header.b="pTMJt47c" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729279AbgJ2IQ7 (ORCPT ); Thu, 29 Oct 2020 04:16:59 -0400 Received: from outbound-ip23b.ess.barracuda.com ([209.222.82.220]:52550 "EHLO outbound-ip23b.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbgJ2IQu (ORCPT ); Thu, 29 Oct 2020 04:16:50 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by mx1.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Oct 2020 08:16:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mLff82fX8jth4FLeN8l8ISATwDn5XYdWCJ2c5/hUS89IjYb0lECkoxhFKejJZJhf1kNIbtwEXj/k4Y8rQYQU7ADErg6OoULl1PVl5ypOk9nKbVR5xDCBJEqSHjWNXlv9Twfiw2/XiUblsuLcm6Uf/mmhPl8UsOGWIwO7+oazVxeLGnAAMlZDMru+Q+FR3eCN7/CcLZn6+CPSgs8VPLCBYbHA/YOn9/3CfnJYzW/Nyy+UCkKss9oFMLBovwj+V2mbf0yBdvEhoFdBrXytm2Au8SPgaU6HpPTsMt4/VUEr69DUpyUntbr5xA11Jli5KR/WfcGpPpR6otyEaJuCQy0XIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SS6JeNiz4Ffc2kkGBfBJMzLlhOhujnvTLRvEzo/13x0=; b=QVCQPBLEaiQ/phI4mHXVd3Ot1CWQtd/bG1Y+RL0g57wNoZoUoi6w7I5NQ4JwoxWCkj8/dMke9hwatZjfA+Y1KEha+iP3rA9NjtE2nmxFGvkrjenp2VvZ0/jbwRpymf/Rm4jRgxU6n58891XScHQUMBLv/5DP9cxavpv93AbJp2U+Rh/EFJQ1iZ3evgqXa86XK6sVKw2QXDvlb1l6N2yQ0a3Ke43iT/UwtdmVig24mSba7JKXCF5Wjo7mOwmPBJPjU0rPWFbDXnJ4D9KwB/2FBL79lsj/JHpM0qTdY050eSzROhJ3n+jr/PQQq/5P0MqYrAFRoWjVNxx2sqEVMK1xzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=digi.com; dmarc=pass action=none header.from=digi.com; dkim=pass header.d=digi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SS6JeNiz4Ffc2kkGBfBJMzLlhOhujnvTLRvEzo/13x0=; b=pTMJt47cEAWZ29O5oh5hZVUfRw7dnAohL+XWqyKSKYt9PaasCMiJkuStzIOcb+crQmv+3hqyjkQgTlymCqVhhKW+A6RpYMs08tstbeydLFZEjf0g1Qri5FAF8xVv5S3g692lBjdFv8RfKLxD5Y6OTkItBb4CROTfLdnE9trL8pY= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=digi.com; Received: from MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) by MN2PR10MB4189.namprd10.prod.outlook.com (2603:10b6:208:1de::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 05:42:21 +0000 Received: from MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32]) by MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32%8]) with mapi id 15.20.3477.028; Thu, 29 Oct 2020 05:42:21 +0000 From: Pavana Sharma To: andrew@lunn.ch Cc: davem@davemloft.net, f.fainelli@gmail.com, gregkh@linuxfoundation.org, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pavana.sharma@digi.com, vivien.didelot@gmail.com, marek.behun@nic.cz, ashkan.boldaji@digi.com Subject: [PATCH v6 2/4] net: phy: Add 5GBASER interface mode Date: Thu, 29 Oct 2020 15:42:00 +1000 Message-Id: <9b93cc79d7cc07ee77808150ca76c9d243c8ca60.1603944740.git.pavana.sharma@digi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [58.84.104.89] X-ClientProxiedBy: SYCP282CA0018.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:80::30) To MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (58.84.104.89) by SYCP282CA0018.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:80::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.19 via Frontend Transport; Thu, 29 Oct 2020 05:42:17 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e5e7eef4-51a1-491c-1634-08d87bcd67b4 X-MS-TrafficTypeDiagnostic: MN2PR10MB4189: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:296; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Bliv8L/ECH7f8GeK385w1g0YzCJVBEUwsDIHQIsYQ00RRljFaE4AKgZ+ysqAskyUaw4dhhNk2/jc1AL1/CI3dY02Z+ciZTB+npa2Zk2QngFVibEp8vDsp4cbBRQjFVgGGtRmICUGGfg0hg7Zk+2lsEzt8YEghhuJv02d/NNolqyxlIRwptc19ey7U/G1MvLOM/+G9FNP86eixHj2jXuO+omGBqYmJYRA/lo6sAn7tyvm9S7yv2OBwSgdGyz2OjwmSWSgOrVgcUZCEk4C+xeC1tcttFxox+S92VEQnXseYUsQgZ7dWBHCo0P5Z2BYD++2Y9DqyZBauyuh7e/K/5lFJcUrwvNY5Va0gkJo2ZlXhTlkHdnrSBiYxnxobA0j82D8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB4174.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(136003)(376002)(366004)(396003)(2616005)(956004)(69590400008)(8936002)(66476007)(6666004)(16526019)(66946007)(316002)(186003)(2906002)(4744005)(44832011)(8676002)(6916009)(107886003)(6486002)(36756003)(26005)(66556008)(5660300002)(86362001)(6506007)(4326008)(6512007)(52116002)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: EvhDeRWlnvbbPIjpiTy+LR/Cqdz+RJgMXlwCRgt5SbuowgOGDFdgV3UG/EI/X3VbfQgOR7HhZPlLnJA10KqnSl1t5MiSHrViIFxXE+hW/geKsyInzYwFTpsQtSjSXbX/GT3VbJb06fRl064Esjs4IcfYdI63QH43efII5VCMs/pLiaTfgzyqshvKRHmjsQ/4vR90AxfvSGMN8D4SilfTGcPBxbnEwltnP6RksXq1MLpbxTKx2F1FlKbkZ/SFA1VHaV0TwLmDa3ftXhk8oTDHTQi73nmuv9UhBA9/B+lDfPzFLPsEb0LMw9Kkz1sW4TTVHaQwNhaJpIk22c1xwYceBhOmCoKDen07rGC5jFrYZxezqnBDuH2pvygmdos0FVmWzreVKA38oudGp55FCAX4boYeyE+R5hksksQQV5sCDrUCmtDPHvPGRIPC47ebPEs83UIHLiztecexl52IP99POqeBn+YCOGlwAWLY90u2BfA0bvbu6GyHkaei3QxIAtpMkhAeVpc0q7H27eOw0UdE+EMrJQFTJcEgju5LP5oOPX+eNJVtnk6dGHBmIwd5hYoupHk2sT3Qd35+RMzMDc3al7ci1nxcJLZMxHNYYNAOEsYnc0MFiR4b0PqdWlDrXKvlJ8oPj6/eKpoHdsdEc1H6CQ== X-OriginatorOrg: digi.com X-MS-Exchange-CrossTenant-Network-Message-Id: e5e7eef4-51a1-491c-1634-08d87bcd67b4 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4174.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 05:42:21.4976 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: abb4cdb7-1b7e-483e-a143-7ebfd1184b9e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 9UFTo2z7NJfGaCkgkMyo817nESQtdFKEKh05eIOwrOkK8pKBvqsNgRLP+OO9QPAXl2iKF9bQRofJjGNODOEEOg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4189 X-BESS-ID: 1603959389-893001-31478-248065-3 X-BESS-VER: 2019.3_20201026.1928 X-BESS-Apparent-Source-IP: 104.47.58.104 X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.227845 [from cloudscan16-168.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 MSGID_FROM_MTA_HEADER META: Message-Id was added by a relay 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS112744 scores of KILL_LEVEL=7.0 tests=MSGID_FROM_MTA_HEADER, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add new mode supported by MV88E6393 family. Signed-off-by: Pavana Sharma --- include/linux/phy.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index 3a09d2bf69ea..9de7c57cfd38 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -107,6 +107,7 @@ typedef enum { PHY_INTERFACE_MODE_2500BASEX, PHY_INTERFACE_MODE_RXAUI, PHY_INTERFACE_MODE_XAUI, + PHY_INTERFACE_MODE_5GBASER, /* 10GBASE-R, XFI, SFI - single lane 10G Serdes */ PHY_INTERFACE_MODE_10GBASER, PHY_INTERFACE_MODE_USXGMII, @@ -187,6 +188,8 @@ static inline const char *phy_modes(phy_interface_t interface) return "rxaui"; case PHY_INTERFACE_MODE_XAUI: return "xaui"; + case PHY_INTERFACE_MODE_5GBASER: + return "5gbase-r"; case PHY_INTERFACE_MODE_10GBASER: return "10gbase-r"; case PHY_INTERFACE_MODE_USXGMII: From patchwork Thu Oct 29 05:42:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavana Sharma X-Patchwork-Id: 11865649 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F186AC2D0A3 for ; Thu, 29 Oct 2020 08:16:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80F4720720 for ; Thu, 29 Oct 2020 08:16:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=digi.com header.i=@digi.com header.b="onbtfUxj" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728941AbgJ2IQk (ORCPT ); Thu, 29 Oct 2020 04:16:40 -0400 Received: from outbound-ip23b.ess.barracuda.com ([209.222.82.220]:51930 "EHLO outbound-ip23b.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728289AbgJ2IQf (ORCPT ); Thu, 29 Oct 2020 04:16:35 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by mx1.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Oct 2020 08:16:29 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EbHMotFnHvASAF5MxZnj1E5k73NXk9STFAcp0WUcC6l5LnxNIq3kfWX7m6eO75FFPbdFRB0q9eyuJ+O+xcg6E7d9jk8y28RM4H/aNHP34RDiPQm7HXCCfApVDZSMH8bn3UdBL1xsGZNfPYCiUfcwN31iyxOU8xVaWG3ViASPtXoySuvkE7emjwfcbXkAIPyG79IPFODYkenOaWdQJc5lzgXTiFqn1SZPV0jLMx0xZKNVD6KdfIRZCNEdsS3GVj2ottdAaQ51D6FzEp9EwcdvzIOSL7XiyhuqKCoali3RLoOs2jnoOzjTYqJmuY38Pek9R4angol4Z+ZIABIoTiPGCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hacm9oF54IU6HBZxEKMtnbf2Uw2qq2pU7zFU8gHVN08=; b=ewRmgCv8AD9/LMU9EFspZnUEQaNinalsxJIJLHigj7LUV1w1UX01gY1uyJjkUEidj4jatuTw0UKcayLFVlNQYCM04bm9wd5dwFmVLSg01L9cbQKXRw9Oi3tBz9xh8iVvWrqSjL+HUjxXsyYvrott8328pVh2vAsjWr1Wl0aDN9H/qo8IlLpItrrnuTZOWMxsKJR90MolEQoZ4tXlfJkkBCoDGlSdeR5pz5kg+2lCCd01hrlhooKtcY100NZORq+nnAcgiHy8uJfP2Zc179dyWl1JOWpLWpklIF4WJakBY33/uYQ/2v5+57wEhC9uhZQlZ2xkggTsNLKwZywRVMmINg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=digi.com; dmarc=pass action=none header.from=digi.com; dkim=pass header.d=digi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=hacm9oF54IU6HBZxEKMtnbf2Uw2qq2pU7zFU8gHVN08=; b=onbtfUxj+uJyoeYoJSoVSslf3wYjKUQOU/3/SWH4qqQ1fCIace8ZYTwouxXScV47lAlikES/7aJtaOnk+QBBLNMH74jSjfCZLZUC2OrUxpskdpxgbN5mBmZcAhHI17m4VyPs6DSoEuQD6Q5X5xuVmpnf+MJOUo22lHb5o0JgQ98= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=digi.com; Received: from MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) by MN2PR10MB4189.namprd10.prod.outlook.com (2603:10b6:208:1de::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 05:42:52 +0000 Received: from MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32]) by MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32%8]) with mapi id 15.20.3477.028; Thu, 29 Oct 2020 05:42:52 +0000 From: Pavana Sharma To: andrew@lunn.ch Cc: davem@davemloft.net, f.fainelli@gmail.com, gregkh@linuxfoundation.org, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pavana.sharma@digi.com, vivien.didelot@gmail.com, marek.behun@nic.cz, ashkan.boldaji@digi.com Subject: [PATCH v6 3/4] net: dsa: mv88e6xxx: Add support for mv88e6393x family of Marvell Date: Thu, 29 Oct 2020 15:42:29 +1000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [58.84.104.89] X-ClientProxiedBy: SYCP282CA0019.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:80::31) To MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (58.84.104.89) by SYCP282CA0019.AUSP282.PROD.OUTLOOK.COM (2603:10c6:10:80::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Thu, 29 Oct 2020 05:42:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bd894788-3e24-4447-86b6-08d87bcd79c5 X-MS-TrafficTypeDiagnostic: MN2PR10MB4189: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3173; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1C1hrLIYQ92CW2oJ0cu29UNKf6UaSA/ykQV6BrmBXy7V2Y98vFF2EGhufQVrO4X6UqHwCLUo2S58zv1FSjeGzm2vFzAXhIEtWKGsYPp4JValjydMZYn5KTVeu5AjjKIPypMOa7Hy+2PeJeqT2vzcDeLYh2v2fX1YQWTkPdQ5sZTP6WYEh3d8xfrHeSXLctwLYiiTdk8dTafHP84juwdBJZyXLfQ+xnWbQDUdIuJcYENVKRGkpDHrYjmawe+fPUhl8IQIRzQj3wYjlFmibpX/CPO0DmxWwQY2xKiohb34us1GC/5Pgr1P9x8y5NRWylmiIoGktCMwMfjP1YKpmxbsTRjKXaT5t6wnvq73ZwIMMb/8gLkjO878+vmr/54whdIt X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB4174.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(136003)(376002)(366004)(396003)(2616005)(956004)(69590400008)(8936002)(66476007)(6666004)(16526019)(66946007)(316002)(186003)(2906002)(44832011)(30864003)(8676002)(6916009)(107886003)(6486002)(36756003)(26005)(66556008)(5660300002)(86362001)(6506007)(4326008)(6512007)(52116002)(83380400001)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: EU/+1ftC3/LxYOH5Kdgre4Kz4sf6yv9AkwmdpMO0sZcIP57/Aixlj/a5Pmz/5I+DCk+90D8/98sHnaWWkEv/RfZ26eIizjw3XfBLvrEjq+qe6JEKzQ05d53f4a1t0XI0mkZQwDFKQB/ORUHwSa22WYJZCCkiQtENulzspvcy9C+WyCj17pTaaGXqRI6Po55wscpfUS508lr2/tfn/CSYVfxEfYG+jdFoDdZP8UoRxvfk9LtZ1ypbGEodr4XDatrHo5kbtM9r2Zcuq37lKJ2Uv1Pcfy8YmFghyPYBu+4XSJyG4c6oRJ7DtkZQs5tConWT14WLtgsip+XePNHO9ZFNm9R7+66L8SOoU7c2wIJA196VLWkbzhrQDePjc+3J+VxofNfIkSOno5W8KZ+D1ug6Ve9VS/baH+Vcij+TXoaofMZTHYX6NG2kFJmd6zSx/6HStlN6Ab6+Vq9lGv87foaVc28oVe+yPRKJ0e+IeggEpa/kL3G7kLtJ7EwJ7gekv7V3RW843ASNC5fpZIijSTs4O4CEybcXEWtVIZHO5AbbItOtXUM2yixqGLOpfpWjqx7USG70VLmR44VgVlOpZuy0Raa3RPYRuQIehAKYkwAid220JSKyuge2Oy85ZORuPpiMcW29BbAlijSpbWVBG/PgOw== X-OriginatorOrg: digi.com X-MS-Exchange-CrossTenant-Network-Message-Id: bd894788-3e24-4447-86b6-08d87bcd79c5 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4174.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 05:42:52.1365 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: abb4cdb7-1b7e-483e-a143-7ebfd1184b9e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xKbkkTi0AJk2lZv38ZG4sGZZQ/0PqN7I8a4eIVkJFQKqLw+4xnG3ljGCa7UAlluymae7m8HpZ03TbVsYOvKPkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4189 X-BESS-ID: 1603959389-893001-31478-248065-1 X-BESS-VER: 2019.3_20201026.1928 X-BESS-Apparent-Source-IP: 104.47.58.104 X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.227845 [from cloudscan10-221.us-east-2a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 MSGID_FROM_MTA_HEADER META: Message-Id was added by a relay 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS112744 scores of KILL_LEVEL=7.0 tests=MSGID_FROM_MTA_HEADER, BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The Marvell 88E6393X device is a single-chip integration of a 11-port Ethernet switch with eight integrated Gigabit Ethernet (GbE) transceivers and three 10-Gigabit interfaces. This patch adds functionalities specific to mv88e6393x family (88E6393X, 88E6193X and 88E6191X) Co-developed-by: Ashkan Boldaji Signed-off-by: Ashkan Boldaji Signed-off-by: Pavana Sharma --- Changes in v2: - Fix a warning (Reported-by: kernel test robot ) Changes in v3: - Fix 'unused function' warning Changes in v4, v5, v6: - Incorporated feedback from maintainers. --- drivers/net/dsa/mv88e6xxx/chip.c | 91 +++++++++++ drivers/net/dsa/mv88e6xxx/chip.h | 4 + drivers/net/dsa/mv88e6xxx/global1.h | 2 + drivers/net/dsa/mv88e6xxx/global2.h | 8 + drivers/net/dsa/mv88e6xxx/port.c | 234 ++++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/port.h | 43 ++++- drivers/net/dsa/mv88e6xxx/serdes.c | 225 ++++++++++++++++++++++++++ drivers/net/dsa/mv88e6xxx/serdes.h | 39 +++++ 8 files changed, 644 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index f0dbc05e30a4..de96fd08e77a 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -634,6 +634,24 @@ static void mv88e6390x_phylink_validate(struct mv88e6xxx_chip *chip, int port, mv88e6390_phylink_validate(chip, port, mask, state); } +static void mv88e6393x_phylink_validate(struct mv88e6xxx_chip *chip, int port, + unsigned long *mask, + struct phylink_link_state *state) +{ + if (port == 0 || port == 9 || port == 10) { + phylink_set(mask, 10000baseT_Full); + phylink_set(mask, 10000baseKR_Full); + phylink_set(mask, 5000baseT_Full); + phylink_set(mask, 2500baseX_Full); + phylink_set(mask, 2500baseT_Full); + } + + phylink_set(mask, 1000baseT_Full); + phylink_set(mask, 1000baseX_Full); + + mv88e6065_phylink_validate(chip, port, mask, state); +} + static void mv88e6xxx_validate(struct dsa_switch *ds, int port, unsigned long *supported, struct phylink_link_state *state) @@ -4141,6 +4159,56 @@ static const struct mv88e6xxx_ops mv88e6191_ops = { .phylink_validate = mv88e6390_phylink_validate, }; +static const struct mv88e6xxx_ops mv88e6193x_ops = { + /* MV88E6XXX_FAMILY_6393 */ + .setup_errata = mv88e6393x_setup_errata, + .irl_init_all = mv88e6390_g2_irl_init_all, + .get_eeprom = mv88e6xxx_g2_get_eeprom8, + .set_eeprom = mv88e6xxx_g2_set_eeprom8, + .set_switch_mac = mv88e6xxx_g2_set_switch_mac, + .phy_read = mv88e6xxx_g2_smi_phy_read, + .phy_write = mv88e6xxx_g2_smi_phy_write, + .port_set_link = mv88e6xxx_port_set_link, + .port_set_speed_duplex = mv88e6393x_port_set_speed_duplex, + .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, + .port_tag_remap = mv88e6390_port_tag_remap, + .port_set_frame_mode = mv88e6351_port_set_frame_mode, + .port_set_egress_floods = mv88e6352_port_set_egress_floods, + .port_set_ether_type = mv88e6393x_port_set_ether_type, + .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, + .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, + .port_pause_limit = mv88e6390_port_pause_limit, + .port_set_cmode = mv88e6393x_port_set_cmode, + .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, + .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, + .port_get_cmode = mv88e6352_port_get_cmode, + .stats_snapshot = mv88e6390_g1_stats_snapshot, + .stats_set_histogram = mv88e6390_g1_stats_set_histogram, + .stats_get_sset_count = mv88e6320_stats_get_sset_count, + .stats_get_strings = mv88e6320_stats_get_strings, + .stats_get_stats = mv88e6390_stats_get_stats, + .set_cpu_port = mv88e6393x_port_set_cpu_dest, + .set_egress_port = mv88e6393x_set_egress_port, + .watchdog_ops = &mv88e6390_watchdog_ops, + .mgmt_rsvd2cpu = mv88e6393x_port_mgmt_rsvd2cpu, + .pot_clear = mv88e6xxx_g2_pot_clear, + .reset = mv88e6352_g1_reset, + .rmu_disable = mv88e6390_g1_rmu_disable, + .vtu_getnext = mv88e6390_g1_vtu_getnext, + .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, + .serdes_power = mv88e6393x_serdes_power, + .serdes_get_lane = mv88e6393x_serdes_get_lane, + /* Check status register pause & lpa register */ + .serdes_pcs_get_state = mv88e6390_serdes_pcs_get_state, + .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, + .serdes_irq_enable = mv88e6393x_serdes_irq_enable, + .serdes_irq_status = mv88e6393x_serdes_irq_status, + .gpio_ops = &mv88e6352_gpio_ops, + .avb_ops = &mv88e6390_avb_ops, + .ptp_ops = &mv88e6352_ptp_ops, + .phylink_validate = mv88e6393x_phylink_validate, +}; + static const struct mv88e6xxx_ops mv88e6240_ops = { /* MV88E6XXX_FAMILY_6352 */ .ieee_pri_map = mv88e6085_g1_ieee_pri_map, @@ -5073,6 +5141,29 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { .ops = &mv88e6191_ops, }, + [MV88E6193X] = { + .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6193X, + .family = MV88E6XXX_FAMILY_6393, + .name = "Marvell 88E6193X", + .num_databases = 4096, + .num_ports = 11, /* 10 + Z80 */ + .num_internal_phys = 9, + .max_vid = 8191, + .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, + .tag_protocol = DSA_TAG_PROTO_DSA, + .ptp_support = true, + .ops = &mv88e6193x_ops, + }, + [MV88E6220] = { .prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6220, .family = MV88E6XXX_FAMILY_6250, diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index 823ae89e5fca..b7864a24a840 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -63,6 +63,8 @@ enum mv88e6xxx_model { MV88E6190, MV88E6190X, MV88E6191, + MV88E6191X, + MV88E6193X, MV88E6220, MV88E6240, MV88E6250, @@ -75,6 +77,7 @@ enum mv88e6xxx_model { MV88E6352, MV88E6390, MV88E6390X, + MV88E6393X, }; enum mv88e6xxx_family { @@ -90,6 +93,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 */ }; struct mv88e6xxx_ops; diff --git a/drivers/net/dsa/mv88e6xxx/global1.h b/drivers/net/dsa/mv88e6xxx/global1.h index 1e3546f8b072..bd17eed15aad 100644 --- a/drivers/net/dsa/mv88e6xxx/global1.h +++ b/drivers/net/dsa/mv88e6xxx/global1.h @@ -22,6 +22,7 @@ #define MV88E6185_G1_STS_PPU_STATE_DISABLED 0x8000 #define MV88E6185_G1_STS_PPU_STATE_POLLING 0xc000 #define MV88E6XXX_G1_STS_INIT_READY 0x0800 +#define MV88E6193X_G1_STS_IRQ_DEVICE_2 9 #define MV88E6XXX_G1_STS_IRQ_AVB 8 #define MV88E6XXX_G1_STS_IRQ_DEVICE 7 #define MV88E6XXX_G1_STS_IRQ_STATS 6 @@ -59,6 +60,7 @@ #define MV88E6185_G1_CTL1_SCHED_PRIO 0x0800 #define MV88E6185_G1_CTL1_MAX_FRAME_1632 0x0400 #define MV88E6185_G1_CTL1_RELOAD_EEPROM 0x0200 +#define MV88E6193X_G1_CTL1_DEVICE2_EN 0x0200 #define MV88E6XXX_G1_CTL1_DEVICE_EN 0x0080 #define MV88E6XXX_G1_CTL1_STATS_DONE_EN 0x0040 #define MV88E6XXX_G1_CTL1_VTU_PROBLEM_EN 0x0020 diff --git a/drivers/net/dsa/mv88e6xxx/global2.h b/drivers/net/dsa/mv88e6xxx/global2.h index 1f42ee656816..04696cb68971 100644 --- a/drivers/net/dsa/mv88e6xxx/global2.h +++ b/drivers/net/dsa/mv88e6xxx/global2.h @@ -38,9 +38,15 @@ /* Offset 0x02: MGMT Enable Register 2x */ #define MV88E6XXX_G2_MGMT_EN_2X 0x02 +/* Offset 0x02: MAC LINK change IRQ Register for MV88E6393X */ +#define MV88E6393X_G2_MACLINK_INT_SRC 0x02 + /* Offset 0x03: MGMT Enable Register 0x */ #define MV88E6XXX_G2_MGMT_EN_0X 0x03 +/* Offset 0x03: MAC LINK change IRQ Mask Register for MV88E6393X */ +#define MV88E6393X_G2_MACLINK_INT_MASK 0x03 + /* Offset 0x04: Flow Control Delay Register */ #define MV88E6XXX_G2_FLOW_CTL 0x04 @@ -52,6 +58,8 @@ #define MV88E6XXX_G2_SWITCH_MGMT_FORCE_FLOW_CTL_PRI 0x0080 #define MV88E6XXX_G2_SWITCH_MGMT_RSVD2CPU 0x0008 +#define MV88E6393X_G2_EGRESS_MONITOR_DEST 0x05 + /* Offset 0x06: Device Mapping Table Register */ #define MV88E6XXX_G2_DEVICE_MAPPING 0x06 #define MV88E6XXX_G2_DEVICE_MAPPING_UPDATE 0x8000 diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index 8128dc607cf4..8e36a69d8cad 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -14,6 +14,7 @@ #include #include "chip.h" +#include "global2.h" #include "port.h" #include "serdes.h" @@ -25,6 +26,14 @@ int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, return mv88e6xxx_read(chip, addr, reg, val); } +int mv88e6xxx_port_wait_bit(struct mv88e6xxx_chip *chip, int port, int reg, + int bit, int val) +{ + int addr = chip->info->port_base_addr + port; + + return mv88e6xxx_wait_bit(chip, addr, reg, bit, val); +} + int mv88e6xxx_port_write(struct mv88e6xxx_chip *chip, int port, int reg, u16 val) { @@ -390,6 +399,87 @@ phy_interface_t mv88e6390x_port_max_speed_mode(int port) return PHY_INTERFACE_MODE_NA; } +/* Support 10, 100, 200, 1000, 2500, 5000, 10000 Mbps (e.g. 88E6393X) */ +int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, + int speed, int duplex) +{ + u16 reg, ctrl; + int err; + + if (speed == SPEED_MAX) + speed = (port > 0 && port < 9) ? 1000 : 10000; + + if (speed == 200 && port != 0) + return -EOPNOTSUPP; + + if (speed >= 2500 && port > 0 && port < 9) + return -EOPNOTSUPP; + + switch (speed) { + case 10: + ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_10; + break; + case 100: + ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_100; + break; + case 200: + ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_100 | + MV88E6390_PORT_MAC_CTL_ALTSPEED; + break; + case 1000: + ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_1000; + break; + case 2500: + ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_1000 | + MV88E6390_PORT_MAC_CTL_ALTSPEED; + break; + case 5000: + ctrl = MV88E6390_PORT_MAC_CTL_SPEED_10000 | + MV88E6390_PORT_MAC_CTL_ALTSPEED; + break; + case 10000: + case SPEED_UNFORCED: + ctrl = MV88E6XXX_PORT_MAC_CTL_SPEED_UNFORCED; + break; + default: + return -EOPNOTSUPP; + } + + switch (duplex) { + case DUPLEX_HALF: + ctrl |= MV88E6XXX_PORT_MAC_CTL_FORCE_DUPLEX; + break; + case DUPLEX_FULL: + ctrl |= MV88E6XXX_PORT_MAC_CTL_FORCE_DUPLEX | + MV88E6XXX_PORT_MAC_CTL_DUPLEX_FULL; + break; + case DUPLEX_UNFORCED: + /* normal duplex detection */ + break; + default: + return -EOPNOTSUPP; + } + + err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_MAC_CTL, ®); + if (err) + return err; + + reg &= ~(MV88E6XXX_PORT_MAC_CTL_SPEED_MASK | + MV88E6390_PORT_MAC_CTL_ALTSPEED | + MV88E6390_PORT_MAC_CTL_FORCE_SPEED); + + if (speed != SPEED_UNFORCED) + reg |= MV88E6390_PORT_MAC_CTL_FORCE_SPEED; + + reg |= ctrl; + + err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_MAC_CTL, reg); + if (err) + return err; + + return 0; +} + static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, phy_interface_t mode, bool force) { @@ -421,6 +511,16 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, case PHY_INTERFACE_MODE_RXAUI: cmode = MV88E6XXX_PORT_STS_CMODE_RXAUI; break; + case PHY_INTERFACE_MODE_5GBASER: + cmode = MV88E6XXX_PORT_STS_CMODE_5GBASER; + break; + case PHY_INTERFACE_MODE_10GBASER: + case PHY_INTERFACE_MODE_10GKR: + cmode = MV88E6XXX_PORT_STS_CMODE_10GBASER; + break; + case PHY_INTERFACE_MODE_USXGMII: + cmode = MV88E6XXX_PORT_STS_CMODE_USXGMII; + break; default: cmode = 0; } @@ -505,6 +605,15 @@ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, return mv88e6xxx_port_set_cmode(chip, port, mode, false); } +int mv88e6393x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, + phy_interface_t mode) +{ + if (port != 0 && port != 9 && port != 10) + return -EOPNOTSUPP; + + return mv88e6xxx_port_set_cmode(chip, port, mode, false); +} + static int mv88e6341_port_set_cmode_writable(struct mv88e6xxx_chip *chip, int port) { @@ -1128,6 +1237,131 @@ int mv88e6xxx_port_disable_pri_override(struct mv88e6xxx_chip *chip, int port) return mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_PRI_OVERRIDE, 0); } +/* Offset 0x0E: Policy & MGMT Control Register for FAMILY 6191X 6193X 6393X*/ + +static int mv88e6393x_port_policy_write(struct mv88e6xxx_chip *chip, u16 pointer, + u8 data) +{ + + int err = 0; + int port; + u16 reg; + + /* Setup per Port policy register */ + for (port = 0; port < mv88e6xxx_num_ports(chip); port++) { + if (dsa_is_unused_port(chip->ds, port)) + continue; + + /* Prevent the use of an invalid port. */ + if (mv88e6xxx_is_invalid_port(chip, port)) { + dev_err(chip->dev, "port %d is invalid\n", port); + err = -EINVAL; + } + reg = MV88E6393X_PORT_POLICY_MGMT_CTL_UPDATE | pointer | data; + err = mv88e6xxx_port_write(chip, port, MV88E6393X_PORT_POLICY_MGMT_CTL, reg); + } + return err; +} + +int mv88e6393x_set_egress_port(struct mv88e6xxx_chip *chip, + enum mv88e6xxx_egress_direction direction, + int port) +{ + u16 ptr; + int err; + + switch (direction) { + case MV88E6XXX_EGRESS_DIR_INGRESS: + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_INGRESS_DEST; + err = mv88e6393x_port_policy_write(chip, ptr, port); + if (err) + return err; + break; + case MV88E6XXX_EGRESS_DIR_EGRESS: + ptr = MV88E6393X_G2_EGRESS_MONITOR_DEST; + err = mv88e6xxx_g2_write(chip, ptr, port); + if (err) + return err; + break; + } + return 0; +} + +int mv88e6393x_port_set_cpu_dest(struct mv88e6xxx_chip *chip, int port) +{ + u16 ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_CPU_DEST; + u8 data = MV88E6393X_PORT_POLICY_MGMT_CTL_CPU_DEST_MGMTPRI | port; + + return mv88e6393x_port_policy_write(chip, ptr, data); +} + +int mv88e6393x_port_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip) +{ + u16 ptr; + int err; + + /* Consider the frames with reserved multicast destination + * addresses matching 01:80:c2:00:00:00 and + * 01:80:c2:00:00:02 as MGMT. + */ + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000000XLO; + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); + if (err) + return err; + + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000000XHI; + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); + if (err) + return err; + + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000002XLO; + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); + if (err) + return err; + + ptr = MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000002XHI; + err = mv88e6393x_port_policy_write(chip, ptr, 0xff); + if (err) + return err; + + return 0; +} + +/* Offset 0x10 & 0x11: EPC */ + +static int mv88e6393x_epc_wait_ready(struct mv88e6xxx_chip *chip, int port) +{ + int bit = __bf_shf(MV88E6393X_PORT_EPC_CMD_BUSY); + + return mv88e6xxx_port_wait_bit(chip, port, MV88E6393X_PORT_EPC_CMD, bit, 0); +} + +/* Port Ether type for 6393X family */ + +int mv88e6393x_port_set_ether_type(struct mv88e6xxx_chip *chip, int port, + u16 etype) +{ + u16 val; + int err; + + err = mv88e6393x_epc_wait_ready(chip, port); + if (err) + return err; + + err = mv88e6xxx_port_write(chip, port, MV88E6393X_PORT_EPC_DATA, etype); + if (err) + return err; + + val = MV88E6393X_PORT_EPC_CMD_BUSY | + MV88E6393X_PORT_EPC_CMD_WRITE | + MV88E6393X_PORT_EPC_INDEX_PORT_ETYPE; + err = mv88e6xxx_port_write(chip, port, MV88E6393X_PORT_EPC_CMD, val); + if (err) + return err; + + return 0; +} + /* Offset 0x0f: Port Ether type */ int mv88e6351_port_set_ether_type(struct mv88e6xxx_chip *chip, int port, diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h index 44d76ac973f6..fbe16168ac09 100644 --- a/drivers/net/dsa/mv88e6xxx/port.h +++ b/drivers/net/dsa/mv88e6xxx/port.h @@ -49,6 +49,9 @@ #define MV88E6XXX_PORT_STS_CMODE_2500BASEX 0x000b #define MV88E6XXX_PORT_STS_CMODE_XAUI 0x000c #define MV88E6XXX_PORT_STS_CMODE_RXAUI 0x000d +#define MV88E6XXX_PORT_STS_CMODE_5GBASER 0x000c +#define MV88E6XXX_PORT_STS_CMODE_10GBASER 0x000d +#define MV88E6XXX_PORT_STS_CMODE_USXGMII 0x000e #define MV88E6185_PORT_STS_CDUPLEX 0x0008 #define MV88E6185_PORT_STS_CMODE_MASK 0x0007 #define MV88E6185_PORT_STS_CMODE_GMII_FD 0x0000 @@ -117,6 +120,8 @@ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6176 0x1760 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6190 0x1900 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6191 0x1910 +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6191X 0x1920 +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6193X 0x1930 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6185 0x1a70 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6220 0x2200 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6240 0x2400 @@ -129,6 +134,7 @@ #define MV88E6XXX_PORT_SWITCH_ID_PROD_6350 0x3710 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6351 0x3750 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6390 0x3900 +#define MV88E6XXX_PORT_SWITCH_ID_PROD_6393X 0x3930 #define MV88E6XXX_PORT_SWITCH_ID_REV_MASK 0x000f /* Offset 0x04: Port Control Register */ @@ -236,6 +242,19 @@ #define MV88E6XXX_PORT_POLICY_CTL_TRAP 0x0002 #define MV88E6XXX_PORT_POLICY_CTL_DISCARD 0x0003 +/* Offset 0x0E: Policy & MGMT Control Register (FAMILY_6393X)*/ +#define MV88E6393X_PORT_POLICY_MGMT_CTL 0x0e +#define MV88E6393X_PORT_POLICY_MGMT_CTL_UPDATE 0x8000 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_MASK 0x3f00 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000000XLO 0x2000 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000000XHI 0x2100 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000002XLO 0x2400 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_01C280000002XHI 0x2500 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_INGRESS_DEST 0x3000 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_PTR_CPU_DEST 0x3800 +#define MV88E6393X_PORT_POLICY_MGMT_CTL_DATA_MASK 0x00ff +#define MV88E6393X_PORT_POLICY_MGMT_CTL_CPU_DEST_MGMTPRI 0x00e0 + /* Offset 0x0F: Port Special Ether Type */ #define MV88E6XXX_PORT_ETH_TYPE 0x0f #define MV88E6XXX_PORT_ETH_TYPE_DEFAULT 0x9100 @@ -243,6 +262,15 @@ /* Offset 0x10: InDiscards Low Counter */ #define MV88E6XXX_PORT_IN_DISCARD_LO 0x10 +/* Offset 0x10: Extended Port Control Command */ +#define MV88E6393X_PORT_EPC_CMD 0x10 +#define MV88E6393X_PORT_EPC_CMD_BUSY 0x8000 +#define MV88E6393X_PORT_EPC_CMD_WRITE 0x0300 +#define MV88E6393X_PORT_EPC_INDEX_PORT_ETYPE 0x02 + +/* Offset 0x11: Extended Port Control Data */ +#define MV88E6393X_PORT_EPC_DATA 0x11 + /* Offset 0x11: InDiscards High Counter */ #define MV88E6XXX_PORT_IN_DISCARD_HI 0x11 @@ -288,7 +316,8 @@ int mv88e6xxx_port_read(struct mv88e6xxx_chip *chip, int port, int reg, u16 *val); int mv88e6xxx_port_write(struct mv88e6xxx_chip *chip, int port, int reg, u16 val); - +int mv88e6xxx_port_wait_bit(struct mv88e6xxx_chip *chip, int port, int reg, + int bit, int val); int mv88e6185_port_set_pause(struct mv88e6xxx_chip *chip, int port, int pause); int mv88e6352_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port, @@ -312,7 +341,8 @@ int mv88e6390_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex); int mv88e6390x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, int speed, int duplex); - +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); @@ -346,6 +376,13 @@ int mv88e6352_port_set_policy(struct mv88e6xxx_chip *chip, int port, enum mv88e6xxx_policy_action action); int mv88e6351_port_set_ether_type(struct mv88e6xxx_chip *chip, int port, u16 etype); +int mv88e6393x_set_egress_port(struct mv88e6xxx_chip *chip, + enum mv88e6xxx_egress_direction direction, + int port); +int mv88e6393x_port_set_cpu_dest(struct mv88e6xxx_chip *chip, int port); +int mv88e6393x_port_mgmt_rsvd2cpu(struct mv88e6xxx_chip *chip); +int mv88e6393x_port_set_ether_type(struct mv88e6xxx_chip *chip, int port, + u16 etype); int mv88e6xxx_port_set_message_port(struct mv88e6xxx_chip *chip, int port, bool message_port); int mv88e6165_port_set_jumbo_size(struct mv88e6xxx_chip *chip, int port, @@ -362,6 +399,8 @@ int mv88e6390_port_set_cmode(struct mv88e6xxx_chip *chip, int port, phy_interface_t mode); int mv88e6390x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, phy_interface_t mode); +int mv88e6393x_port_set_cmode(struct mv88e6xxx_chip *chip, int port, + phy_interface_t mode); int mv88e6185_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode); int mv88e6352_port_get_cmode(struct mv88e6xxx_chip *chip, int port, u8 *cmode); int mv88e6xxx_port_set_map_da(struct mv88e6xxx_chip *chip, int port); diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index 9c07b4f3d345..9148dd0f4555 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c @@ -526,6 +526,26 @@ u8 mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) return lane; } +/* Only Ports 0, 9 and 10 have SERDES lanes. Return the SERDES lane address + * a port is using else Returns -ENODEV. + */ +u8 mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) +{ + u8 cmode = chip->ports[port].cmode; + u8 lane = 0; + + if (port == 0 || port == 9 || port == 10) { + if (cmode == MV88E6XXX_PORT_STS_CMODE_1000BASEX || + cmode == MV88E6XXX_PORT_STS_CMODE_SGMII || + cmode == MV88E6XXX_PORT_STS_CMODE_2500BASEX || + cmode == MV88E6XXX_PORT_STS_CMODE_5GBASER || + cmode == MV88E6XXX_PORT_STS_CMODE_10GBASER || + cmode == MV88E6XXX_PORT_STS_CMODE_USXGMII) + lane = port; + } + return lane; +} + /* Set power up/down for 10GBASE-R and 10GBASE-X4/X2 */ static int mv88e6390_serdes_power_10g(struct mv88e6xxx_chip *chip, u8 lane, bool up) @@ -916,6 +936,51 @@ static int mv88e6390_serdes_irq_status_sgmii(struct mv88e6xxx_chip *chip, return err; } +int mv88e6393x_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, + u8 lane, bool enable) +{ + u8 cmode = chip->ports[port].cmode; + int err = 0; + + switch (cmode) { + case MV88E6XXX_PORT_STS_CMODE_SGMII: + case MV88E6XXX_PORT_STS_CMODE_1000BASEX: + case MV88E6XXX_PORT_STS_CMODE_2500BASEX: + case MV88E6XXX_PORT_STS_CMODE_5GBASER: + case MV88E6XXX_PORT_STS_CMODE_10GBASER: + err = mv88e6390_serdes_irq_enable_sgmii(chip, lane, enable); + } + + return err; +} + +irqreturn_t mv88e6393x_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, + u8 lane) +{ + u8 cmode = chip->ports[port].cmode; + irqreturn_t ret = IRQ_NONE; + u16 status; + int err; + + switch (cmode) { + case MV88E6XXX_PORT_STS_CMODE_SGMII: + case MV88E6XXX_PORT_STS_CMODE_1000BASEX: + case MV88E6XXX_PORT_STS_CMODE_2500BASEX: + case MV88E6XXX_PORT_STS_CMODE_5GBASER: + case MV88E6XXX_PORT_STS_CMODE_10GBASER: + err = mv88e6390_serdes_irq_status_sgmii(chip, lane, &status); + if (err) + return ret; + if (status & (MV88E6390_SGMII_INT_LINK_DOWN | + MV88E6390_SGMII_INT_LINK_UP)) { + ret = IRQ_HANDLED; + mv88e6390_serdes_irq_link_sgmii(chip, port, lane); + } + } + + return ret; +} + irqreturn_t mv88e6390_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, u8 lane) { @@ -999,3 +1064,163 @@ void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p) p[i] = reg; } } + +int mv88e6393x_setup_errata(struct mv88e6xxx_chip *chip) +{ + u16 config0, config9, config10; + u16 pcs0, pcs9, pcs10; + int err = 0; + + /* mv88e6393x family errata 3.8 : + * When a SERDES port is operating in 1000BASE-X or SGMII mode link may not + * come up after hardware reset or software reset of SERDES core. + * Workaround is to write SERDES register 4.F074.14 =1 for only those modes + * and 0 in all other modes. + */ + err = mv88e6390_serdes_read(chip, MV88E6393X_PORT0_LANE, MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, &config0); + err = mv88e6390_serdes_read(chip, MV88E6393X_PORT9_LANE, MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, &config9); + err = mv88e6390_serdes_read(chip, MV88E6393X_PORT10_LANE, MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, &config10); + + err = mv88e6390_serdes_read(chip, MV88E6393X_PORT0_LANE, MDIO_MMD_PHYXS, + MV88E6393X_SERDES_POC, &pcs0); + pcs0 &= MV88E6393X_SERDES_POC_PCS_MODE_MASK; + err = mv88e6390_serdes_read(chip, MV88E6393X_PORT9_LANE, MDIO_MMD_PHYXS, + MV88E6393X_SERDES_POC, &pcs9); + pcs9 &= MV88E6393X_SERDES_POC_PCS_MODE_MASK; + err = mv88e6390_serdes_read(chip, MV88E6393X_PORT10_LANE, MDIO_MMD_PHYXS, + MV88E6393X_SERDES_POC, &pcs10); + pcs10 &= MV88E6393X_SERDES_POC_PCS_MODE_MASK; + + if (pcs0 == MV88E6393X_PCS_SELECT_1000BASEX || + pcs0 == MV88E6393X_PCS_SELECT_SGMII_PHY || + pcs0 == MV88E6393X_PCS_SELECT_SGMII_MAC) { + config0 |= MV88E6393X_ERRATA_1000BASEX_SGMII_BIT; + err = mv88e6390_serdes_write(chip, MV88E6393X_PORT0_LANE, + MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, + config0); + } else { + config0 &= ~MV88E6393X_ERRATA_1000BASEX_SGMII_BIT; + err = mv88e6390_serdes_write(chip, MV88E6393X_PORT0_LANE, + MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, + config0); + } + + if (pcs9 == MV88E6393X_PCS_SELECT_1000BASEX || + pcs9 == MV88E6393X_PCS_SELECT_SGMII_PHY || + pcs9 == MV88E6393X_PCS_SELECT_SGMII_MAC) { + config9 |= MV88E6393X_ERRATA_1000BASEX_SGMII_BIT; + err = mv88e6390_serdes_write(chip, MV88E6393X_PORT9_LANE, + MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, + config9); + } else { + config9 &= ~MV88E6393X_ERRATA_1000BASEX_SGMII_BIT; + err = mv88e6390_serdes_write(chip, MV88E6393X_PORT9_LANE, + MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, + config9); + } + + if (pcs10 == MV88E6393X_PCS_SELECT_1000BASEX || + pcs10 == MV88E6393X_PCS_SELECT_SGMII_PHY || + pcs10 == MV88E6393X_PCS_SELECT_SGMII_MAC) { + config10 |= MV88E6393X_ERRATA_1000BASEX_SGMII_BIT; + err = mv88e6390_serdes_write(chip, MV88E6393X_PORT10_LANE, + MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, + config10); + } else { + config10 &= ~MV88E6393X_ERRATA_1000BASEX_SGMII_BIT; + err = mv88e6390_serdes_write(chip, MV88E6393X_PORT10_LANE, + MDIO_MMD_PHYXS, + MV88E6393X_ERRATA_1000BASEX_SGMII, + config10); + } + return err; +} + +static int mv88e6393x_serdes_port_config(struct mv88e6xxx_chip *chip, u8 lane, + bool on) +{ + u8 cmode = chip->ports[lane].cmode; + u16 config, pcs; + + switch (cmode) { + case MV88E6XXX_PORT_STS_CMODE_1000BASEX: + pcs = MV88E6393X_PCS_SELECT_1000BASEX; + break; + case MV88E6XXX_PORT_STS_CMODE_2500BASEX: + pcs = MV88E6393X_PCS_SELECT_2500BASEX; + break; + case MV88E6XXX_PORT_STS_CMODE_10GBASER: + pcs = MV88E6393X_PCS_SELECT_10GBASER; + break; + default: + pcs = MV88E6393X_PCS_SELECT_1000BASEX; + break; + } + + if (on) { + /* mv88e6393x family errata 3.6 : + * When changing c_mode on Port 0 from [x]MII mode to any + * SERDES mode SERDES will not be operational. + * Workaround: Set Port0 SERDES register 4.F002.5=0 + */ + mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS, + MV88E6393X_SERDES_POC, &config); + config &= ~(MV88E6393X_SERDES_POC_PCS_MODE_MASK | + MV88E6393X_SERDES_POC_PDOWN); + config |= pcs; + mv88e6390_serdes_write(chip, lane, MDIO_MMD_PHYXS, + MV88E6393X_SERDES_POC, config); + config |= MV88E6393X_SERDES_POC_RESET; + mv88e6390_serdes_write(chip, lane, MDIO_MMD_PHYXS, + MV88E6393X_SERDES_POC, config); + + /* mv88e6393x family errata 3.7 : + * When changing cmode on SERDES port from any other mode to + * 1000BASE-X mode the link may not come up due to invalid + * 1000BASE-X advertisement. + * Workaround: Correct advertisement and reset PHY core. + */ + config = MV88E6390_SGMII_ANAR_1000BASEX_FD; + mv88e6390_serdes_write(chip, lane, MDIO_MMD_PHYXS, + MV88E6390_SGMII_ANAR, config); + + /* soft reset the PCS/PMA */ + mv88e6390_serdes_read(chip, lane, MDIO_MMD_PHYXS, + MV88E6390_SGMII_CONTROL, &config); + config |= MV88E6390_SGMII_CONTROL_RESET; + mv88e6390_serdes_write(chip, lane, MDIO_MMD_PHYXS, + MV88E6390_SGMII_CONTROL, config); + } + + return 0; +} + +int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, + bool on) +{ + lane = mv88e6393x_serdes_get_lane(chip, port); + + if (port == 0 || port == 9 || port == 10) { + u8 cmode = chip->ports[port].cmode; + + mv88e6393x_serdes_port_config(chip, lane, on); + + switch (cmode) { + case MV88E6XXX_PORT_STS_CMODE_1000BASEX: + case MV88E6XXX_PORT_STS_CMODE_2500BASEX: + return mv88e6390_serdes_power_sgmii(chip, lane, on); + case MV88E6XXX_PORT_STS_CMODE_10GBASER: + return mv88e6390_serdes_power_10g(chip, lane, on); + } + } + + return 0; +} diff --git a/drivers/net/dsa/mv88e6xxx/serdes.h b/drivers/net/dsa/mv88e6xxx/serdes.h index 14315f26228a..c3eaaaac8619 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.h +++ b/drivers/net/dsa/mv88e6xxx/serdes.h @@ -68,15 +68,47 @@ #define MV88E6390_SGMII_PHY_STATUS_LINK BIT(10) #define MV88E6390_SGMII_PHY_STATUS_TX_PAUSE BIT(3) #define MV88E6390_SGMII_PHY_STATUS_RX_PAUSE BIT(2) +#define MV88E6390_SGMII_STATUS_AN_ABLE BIT(3) +#define MV88E6390_SGMII_ANAR 0x2004 +#define MV88E6390_SGMII_ANAR_1000BASEX_FD BIT(5) +#define MV88E6390_SGMII_CONTROL 0x2000 +#define MV88E6390_SGMII_CONTROL_RESET BIT(15) +#define MV88E6390_SGMII_CONTROL_LOOPBACK BIT(14) +#define MV88E6390_SGMII_CONTROL_PDOWN BIT(11) +#define MV88E6390_SGMII_STATUS 0x2001 /* Packet generator pad packet checker */ #define MV88E6390_PG_CONTROL 0xf010 #define MV88E6390_PG_CONTROL_ENABLE_PC BIT(0) +#define MV88E6393X_PORT0_LANE 0x00 +#define MV88E6393X_PORT9_LANE 0x09 +#define MV88E6393X_PORT10_LANE 0x0a + +/* Port Operational Configuration */ +#define MV88E6393X_PCS_SELECT_1000BASEX 0x0000 +#define MV88E6393X_PCS_SELECT_2500BASEX 0x0001 +#define MV88E6393X_PCS_SELECT_SGMII_PHY 0x0002 +#define MV88E6393X_PCS_SELECT_SGMII_MAC 0x0003 +#define MV88E6393X_PCS_SELECT_5GBASER 0x0004 +#define MV88E6393X_PCS_SELECT_10GBASER 0x0005 +#define MV88E6393X_PCS_SELECT_USXGMII_PHY 0x0006 +#define MV88E6393X_PCS_SELECT_USXGMII_MAC 0x0007 + +#define MV88E6393X_SERDES_POC 0xf002 +#define MV88E6393X_SERDES_POC_PCS_MODE_MASK 0x0007 +#define MV88E6393X_SERDES_POC_RESET BIT(15) +#define MV88E6393X_SERDES_POC_PDOWN BIT(5) +#define MV88E6393X_SERDES_POC_ANEG BIT(3) + +#define MV88E6393X_ERRATA_1000BASEX_SGMII 0xF074 +#define MV88E6393X_ERRATA_1000BASEX_SGMII_BIT BIT(14) + u8 mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); u8 mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); u8 mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); u8 mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +u8 mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); int mv88e6352_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, u8 lane, unsigned int mode, phy_interface_t interface, @@ -105,14 +137,21 @@ int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, bool on); int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, bool on); +int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, + bool on); +int mv88e6393x_setup_errata(struct mv88e6xxx_chip *chip); int mv88e6352_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, bool enable); int mv88e6390_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, bool enable); +int mv88e6393x_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, + u8 lane, bool enable); irqreturn_t mv88e6352_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, u8 lane); irqreturn_t mv88e6390_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, u8 lane); +irqreturn_t mv88e6393x_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, + u8 lane); int mv88e6352_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port); int mv88e6352_serdes_get_strings(struct mv88e6xxx_chip *chip, int port, uint8_t *data); From patchwork Thu Oct 29 05:43:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavana Sharma X-Patchwork-Id: 11865645 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FCACC2D0A3 for ; Thu, 29 Oct 2020 08:16:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id F153920720 for ; Thu, 29 Oct 2020 08:16:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=digi.com header.i=@digi.com header.b="d5Nbgtq3" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728626AbgJ2IQO (ORCPT ); Thu, 29 Oct 2020 04:16:14 -0400 Received: from outbound-ip24b.ess.barracuda.com ([209.222.82.221]:46006 "EHLO outbound-ip24b.ess.barracuda.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726949AbgJ2IQI (ORCPT ); Thu, 29 Oct 2020 04:16:08 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam08lp2044.outbound.protection.outlook.com [104.47.73.44]) by mx4.us-east-2b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 29 Oct 2020 08:16:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TYfNT20cxRIVQQM7ODJyrJoqxxQ/NrPSCVgcsDvWVAUKJ5rf2sEdLLmGaLLxS969b/V7cMXDPYMUyyhCIFJV8XXy10OnjO6V4e/g0JndcJbgSVHW7Xq1OuAWW+t2OXO7bTykA3cMGBzEaMgBzLhkvFKZAGe+ttdksxS4dJVRpmm+Kk8B1F9krRwOSxsqIl2wsqFik66qydHIuDSQpSNyTyXqf+SsqNs8YRw1S4BQV13wkfZ/FvhvPnOXIaVBOGcL6vYBa3rEaPlXRi7EFrxjfkgVlw7fwQuG3jTUCzqAVZWtmx2aLSL8EjWX5dMBHX3OgtZxVFESwC4g0uwPktviRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G5WlOjsxbpnwhM3q+wLtht0xW/G8WLu9WhzBC/etqdw=; b=Xtklyp5qR/k8XueW/8UCXQW0zwQbPnzUnbqYqw4BaB9LKrbISH78Qnvccc6WX/d6VIitR0ysw4BZSggqhYGWY5RYqzuUsiu/Ab9B1Pvm40tBlUDjtFdBGSljTDS7fDUrwJzJJjk61Ou0TFVBTD72jurg42jJGygWPPHd9i9GT8zNgEfos6TF8U//0/ZVNj8DfVlrTshKePV2WGl0xcZd/FR0ov4qA3tBFMXUsWby9LUxS9iYQldk9n4PBzYMVsSOYgU0zXyON5Za9T4mt0TcjRyeRVTHZj8zzqwfP2+eQG1ZmLOaqfkixpEni7X+xa3IfgM3l2uuelsphu4KFtxIHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=digi.com; dmarc=pass action=none header.from=digi.com; dkim=pass header.d=digi.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digi.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G5WlOjsxbpnwhM3q+wLtht0xW/G8WLu9WhzBC/etqdw=; b=d5Nbgtq3hXZx3UMOzxczTPShxY5m74cq/Hs/N2vL+ElY4waywDICz0r/EzwBeBwHBJVcZPJaPrTM2JkcSkhVKUN0xD3g7Fh2u4moPYI21pwr63jgXFOE3CwSc3ZMnhyKx2tl5wdd8SC6GSHxGQtHDc9g+y9y8WOiGCRAZNMp3aw= Authentication-Results: lunn.ch; dkim=none (message not signed) header.d=none;lunn.ch; dmarc=none action=none header.from=digi.com; Received: from MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) by MN2PR10MB4189.namprd10.prod.outlook.com (2603:10b6:208:1de::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18; Thu, 29 Oct 2020 05:43:22 +0000 Received: from MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32]) by MN2PR10MB4174.namprd10.prod.outlook.com ([fe80::b505:75ae:58c9:eb32%8]) with mapi id 15.20.3477.028; Thu, 29 Oct 2020 05:43:22 +0000 From: Pavana Sharma To: andrew@lunn.ch Cc: davem@davemloft.net, f.fainelli@gmail.com, gregkh@linuxfoundation.org, kuba@kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, pavana.sharma@digi.com, vivien.didelot@gmail.com, marek.behun@nic.cz, ashkan.boldaji@digi.com Subject: [PATCH v6 4/4] net: dsa: mv88e6xxx: Change serdes lane parameter from u8 to int Date: Thu, 29 Oct 2020 15:43:01 +1000 Message-Id: <668b21d1e9f9d91ae3c560eb49986f0625dfb616.1603944740.git.pavana.sharma@digi.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-Originating-IP: [58.84.104.89] X-ClientProxiedBy: SY2PR01CA0043.ausprd01.prod.outlook.com (2603:10c6:1:15::31) To MN2PR10MB4174.namprd10.prod.outlook.com (2603:10b6:208:1dd::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (58.84.104.89) by SY2PR01CA0043.ausprd01.prod.outlook.com (2603:10c6:1:15::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3499.18 via Frontend Transport; Thu, 29 Oct 2020 05:43:18 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b52670e3-fe55-4205-7fac-08d87bcd8bf5 X-MS-TrafficTypeDiagnostic: MN2PR10MB4189: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r+/yeFgVGiwsxDdahDIXpEd89Hb2t3m0fxdl6wMxQPrJKeQrGYK8g9qngNrqqKKl3lSRT1sHEthfDU9/150I0E5yWCt7t8HwRZ/J4v+j+HVsxbEMxHYq3D/WcBt2LoR5/qih8EUpTMFppoVA4fS3QgmEsQax/+ZQ1H3Nixub2VTKfRPR1jOBBzC0Fij0+se9uDpetN/Uz95Q3u66fiJcoV2ynwS5KhE2cm4pO/nVDtLl3Xd8P0UK+JGS0Pv5kGYETMRVgX3uA5S8GTHTc2N0Zkm0SU4l10zFF3B3QccGUjbPTp3erEjHHag8ktjPn1CTa5KPVG36KTOMBKinMierrfKdkXq8y1Fm1zKg5RF9niEOWzXpCY58KVUa17m6EbAC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR10MB4174.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(39850400004)(136003)(376002)(366004)(396003)(2616005)(956004)(69590400008)(8936002)(66476007)(6666004)(16526019)(66946007)(316002)(186003)(2906002)(44832011)(30864003)(8676002)(6916009)(107886003)(6486002)(36756003)(26005)(66556008)(5660300002)(86362001)(6506007)(4326008)(6512007)(52116002)(83380400001)(478600001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData: 3oCYyLNaW143VAihtgXSmgqQMDqcswQFtUmOkX9edvrp4NIIwe08YuMWq/A/2JWJRuIYKLTHbJcDBkJhkfG9iB/vWVFkUejNCatYmuLIqsA+Fqb9RSAg2z8htC+FT+suX8NGzP8h+SpjMc3DIU1EJakcsvwySWfLo4q0k7qf1EghvYPQ1t0Gp6TvLkcqHnIKC2O/KL10RCJ122MAudSyFmFZ84QNsnIIzrTVa8NzunglaIWr04QHOdW6pkNvYZYusBY3qR8CCRfb3l9aigZ/l4o1p6P18deH7Bw6PH6gm9K0taXYyBMlVsb+NQf/uBcx0alOGM6rMAYkXVp5jG+HykCaK8AffdruCe64XIZdIqRkOtRIVkSZZM6VMJpADgmQqUeCr4O/s3HPWpIQI79tZDO7OeHnSAo3esNDt5JflCfElxmCiCDPuFSAZvivjnVVrdMt0qmiSc2eScyRIX45sFQ0nf47+9InxzD+NYDVAdg7MeoDgmjeI4Dx2WgDjYskx/Nyu0R1eM+TG9H0TfsIrL6TA9vyNl5/v93fFk1cEMT0GCmPhwEbxxcVapc6qR6SQ8i+S+WkhmZDmkA2KQsUOxVDiROQLsotRNsGHP3bSmv9apAyJ5FZXxgloC2sbmBRgSjsS1hpzxPI26+6hx00mA== X-OriginatorOrg: digi.com X-MS-Exchange-CrossTenant-Network-Message-Id: b52670e3-fe55-4205-7fac-08d87bcd8bf5 X-MS-Exchange-CrossTenant-AuthSource: MN2PR10MB4174.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2020 05:43:22.5204 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: abb4cdb7-1b7e-483e-a143-7ebfd1184b9e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: F87xBj09NWCjeJwkA37g3vYz8M2rJ014AEAx00O6tmWwSKfkvIXyZZdmIUV47/oNCiIWIo/EqGSDfJOUH7vF9A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR10MB4189 X-BESS-ID: 1603959362-893007-17954-248255-1 X-BESS-VER: 2019.1_20201026.1928 X-BESS-Apparent-Source-IP: 104.47.73.44 X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.227845 [from cloudscan20-221.us-east-2b.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 MSGID_FROM_MTA_HEADER META: Message-Id was added by a relay 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS112744 scores of KILL_LEVEL=7.0 tests=MSGID_FROM_MTA_HEADER, BSF_RULE7568M, BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Returning 0 is no more an error case with MV88E6393 family which has serdes lane numbers 0, 9 or 10. So with this change .serdes_get_lane will return lane number or error (-ENODEV). Signed-off-by: Pavana Sharma --- drivers/net/dsa/mv88e6xxx/chip.c | 28 +++++----- drivers/net/dsa/mv88e6xxx/chip.h | 16 +++--- drivers/net/dsa/mv88e6xxx/port.c | 6 +-- drivers/net/dsa/mv88e6xxx/serdes.c | 86 +++++++++++++++--------------- drivers/net/dsa/mv88e6xxx/serdes.h | 58 ++++++++++---------- 5 files changed, 96 insertions(+), 98 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index de96fd08e77a..6e76c1c37700 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -484,12 +484,12 @@ static int mv88e6xxx_serdes_pcs_get_state(struct dsa_switch *ds, int port, struct phylink_link_state *state) { struct mv88e6xxx_chip *chip = ds->priv; - u8 lane; + int lane; int err; mv88e6xxx_reg_lock(chip); lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane && chip->info->ops->serdes_pcs_get_state) + if ((lane != -ENODEV) && chip->info->ops->serdes_pcs_get_state) err = chip->info->ops->serdes_pcs_get_state(chip, port, lane, state); else @@ -505,11 +505,11 @@ static int mv88e6xxx_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, const unsigned long *advertise) { const struct mv88e6xxx_ops *ops = chip->info->ops; - u8 lane; + int lane; if (ops->serdes_pcs_config) { lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane) + if (lane != -ENODEV) return ops->serdes_pcs_config(chip, port, lane, mode, interface, advertise); } @@ -522,14 +522,14 @@ static void mv88e6xxx_serdes_pcs_an_restart(struct dsa_switch *ds, int port) struct mv88e6xxx_chip *chip = ds->priv; const struct mv88e6xxx_ops *ops; int err = 0; - u8 lane; + int lane; ops = chip->info->ops; if (ops->serdes_pcs_an_restart) { mv88e6xxx_reg_lock(chip); lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane) + if (lane != -ENODEV) err = ops->serdes_pcs_an_restart(chip, port, lane); mv88e6xxx_reg_unlock(chip); @@ -543,11 +543,11 @@ static int mv88e6xxx_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, int speed, int duplex) { const struct mv88e6xxx_ops *ops = chip->info->ops; - u8 lane; + int lane; if (!phylink_autoneg_inband(mode) && ops->serdes_pcs_link_up) { lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane) + if (lane != -ENODEV) return ops->serdes_pcs_link_up(chip, port, lane, speed, duplex); } @@ -2442,11 +2442,11 @@ static irqreturn_t mv88e6xxx_serdes_irq_thread_fn(int irq, void *dev_id) struct mv88e6xxx_chip *chip = mvp->chip; irqreturn_t ret = IRQ_NONE; int port = mvp->port; - u8 lane; + int lane; mv88e6xxx_reg_lock(chip); lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane) + if (lane != -ENODEV) ret = mv88e6xxx_serdes_irq_status(chip, port, lane); mv88e6xxx_reg_unlock(chip); @@ -2454,7 +2454,7 @@ static irqreturn_t mv88e6xxx_serdes_irq_thread_fn(int irq, void *dev_id) } static int mv88e6xxx_serdes_irq_request(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { struct mv88e6xxx_port *dev_id = &chip->ports[port]; unsigned int irq; @@ -2483,7 +2483,7 @@ static int mv88e6xxx_serdes_irq_request(struct mv88e6xxx_chip *chip, int port, } static int mv88e6xxx_serdes_irq_free(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { struct mv88e6xxx_port *dev_id = &chip->ports[port]; unsigned int irq = dev_id->serdes_irq; @@ -2508,11 +2508,11 @@ static int mv88e6xxx_serdes_irq_free(struct mv88e6xxx_chip *chip, int port, static int mv88e6xxx_serdes_power(struct mv88e6xxx_chip *chip, int port, bool on) { - u8 lane; + int lane; int err; lane = mv88e6xxx_serdes_get_lane(chip, port); - if (!lane) + if (lane == -ENODEV) return 0; if (on) { diff --git a/drivers/net/dsa/mv88e6xxx/chip.h b/drivers/net/dsa/mv88e6xxx/chip.h index b7864a24a840..03c0466ab4ae 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.h +++ b/drivers/net/dsa/mv88e6xxx/chip.h @@ -494,30 +494,30 @@ struct mv88e6xxx_ops { int (*mgmt_rsvd2cpu)(struct mv88e6xxx_chip *chip); /* Power on/off a SERDES interface */ - int (*serdes_power)(struct mv88e6xxx_chip *chip, int port, u8 lane, + int (*serdes_power)(struct mv88e6xxx_chip *chip, int port, int lane, bool up); /* SERDES lane mapping */ - u8 (*serdes_get_lane)(struct mv88e6xxx_chip *chip, int port); + int (*serdes_get_lane)(struct mv88e6xxx_chip *chip, int port); int (*serdes_pcs_get_state)(struct mv88e6xxx_chip *chip, int port, - u8 lane, struct phylink_link_state *state); + int lane, struct phylink_link_state *state); int (*serdes_pcs_config)(struct mv88e6xxx_chip *chip, int port, - u8 lane, unsigned int mode, + int lane, unsigned int mode, phy_interface_t interface, const unsigned long *advertise); int (*serdes_pcs_an_restart)(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); int (*serdes_pcs_link_up)(struct mv88e6xxx_chip *chip, int port, - u8 lane, int speed, int duplex); + int lane, int speed, int duplex); /* SERDES interrupt handling */ unsigned int (*serdes_irq_mapping)(struct mv88e6xxx_chip *chip, int port); - int (*serdes_irq_enable)(struct mv88e6xxx_chip *chip, int port, u8 lane, + int (*serdes_irq_enable)(struct mv88e6xxx_chip *chip, int port, int lane, bool enable); irqreturn_t (*serdes_irq_status)(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); /* Statistics from the SERDES interface */ int (*serdes_get_sset_count)(struct mv88e6xxx_chip *chip, int port); diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c index 8e36a69d8cad..814c44a586b7 100644 --- a/drivers/net/dsa/mv88e6xxx/port.c +++ b/drivers/net/dsa/mv88e6xxx/port.c @@ -483,7 +483,7 @@ int mv88e6393x_port_set_speed_duplex(struct mv88e6xxx_chip *chip, int port, static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, phy_interface_t mode, bool force) { - u8 lane; + int lane; u16 cmode; u16 reg; int err; @@ -530,7 +530,7 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, return 0; lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane) { + if (lane != -ENODEV) { if (chip->ports[port].serdes_irq) { err = mv88e6xxx_serdes_irq_disable(chip, port, lane); if (err) @@ -559,7 +559,7 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port, chip->ports[port].cmode = cmode; lane = mv88e6xxx_serdes_get_lane(chip, port); - if (!lane) + if (lane == -ENODEV) return -ENODEV; err = mv88e6xxx_serdes_power_up(chip, port, lane); diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index 9148dd0f4555..3fbd6af7548e 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c @@ -95,7 +95,7 @@ static int mv88e6xxx_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, return 0; } -int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, bool up) { u16 val, new_val; @@ -117,7 +117,7 @@ int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, } int mv88e6352_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, - u8 lane, unsigned int mode, + int lane, unsigned int mode, phy_interface_t interface, const unsigned long *advertise) { @@ -166,7 +166,7 @@ int mv88e6352_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, } int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, - u8 lane, struct phylink_link_state *state) + int lane, struct phylink_link_state *state) { u16 lpa, status; int err; @@ -187,7 +187,7 @@ int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, } int mv88e6352_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { u16 bmcr; int err; @@ -200,7 +200,7 @@ int mv88e6352_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, } int mv88e6352_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, - u8 lane, int speed, int duplex) + int lane, int speed, int duplex) { u16 val, bmcr; int err; @@ -230,10 +230,10 @@ int mv88e6352_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, return mv88e6352_serdes_write(chip, MII_BMCR, bmcr); } -u8 mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) +int mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) { u8 cmode = chip->ports[port].cmode; - u8 lane = 0; + int lane = -ENODEV; if ((cmode == MV88E6XXX_PORT_STS_CMODE_100BASEX) || (cmode == MV88E6XXX_PORT_STS_CMODE_1000BASEX) || @@ -245,7 +245,7 @@ u8 mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) static bool mv88e6352_port_has_serdes(struct mv88e6xxx_chip *chip, int port) { - if (mv88e6xxx_serdes_get_lane(chip, port)) + if (mv88e6xxx_serdes_get_lane(chip, port) != -ENODEV) return true; return false; @@ -354,7 +354,7 @@ static void mv88e6352_serdes_irq_link(struct mv88e6xxx_chip *chip, int port) } irqreturn_t mv88e6352_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { irqreturn_t ret = IRQ_NONE; u16 status; @@ -372,7 +372,7 @@ irqreturn_t mv88e6352_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, return ret; } -int mv88e6352_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6352_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, int lane, bool enable) { u16 val = 0; @@ -411,10 +411,10 @@ void mv88e6352_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p) } } -u8 mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) +int mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) { u8 cmode = chip->ports[port].cmode; - u8 lane = 0; + int lane = -ENODEV; switch (port) { case 5: @@ -428,10 +428,10 @@ u8 mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) return lane; } -u8 mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) +int mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) { u8 cmode = chip->ports[port].cmode; - u8 lane = 0; + int lane = -ENODEV; switch (port) { case 9: @@ -451,12 +451,12 @@ u8 mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) return lane; } -u8 mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) +int mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) { u8 cmode_port = chip->ports[port].cmode; u8 cmode_port10 = chip->ports[10].cmode; u8 cmode_port9 = chip->ports[9].cmode; - u8 lane = 0; + int lane = -ENODEV; switch (port) { case 2: @@ -529,10 +529,10 @@ u8 mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) /* Only Ports 0, 9 and 10 have SERDES lanes. Return the SERDES lane address * a port is using else Returns -ENODEV. */ -u8 mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) +int mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) { u8 cmode = chip->ports[port].cmode; - u8 lane = 0; + int lane = -ENODEV; if (port == 0 || port == 9 || port == 10) { if (cmode == MV88E6XXX_PORT_STS_CMODE_1000BASEX || @@ -547,7 +547,7 @@ u8 mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) } /* Set power up/down for 10GBASE-R and 10GBASE-X4/X2 */ -static int mv88e6390_serdes_power_10g(struct mv88e6xxx_chip *chip, u8 lane, +static int mv88e6390_serdes_power_10g(struct mv88e6xxx_chip *chip, int lane, bool up) { u16 val, new_val; @@ -574,7 +574,7 @@ static int mv88e6390_serdes_power_10g(struct mv88e6xxx_chip *chip, u8 lane, } /* Set power up/down for SGMII and 1000Base-X */ -static int mv88e6390_serdes_power_sgmii(struct mv88e6xxx_chip *chip, u8 lane, +static int mv88e6390_serdes_power_sgmii(struct mv88e6xxx_chip *chip, int lane, bool up) { u16 val, new_val; @@ -610,7 +610,7 @@ static struct mv88e6390_serdes_hw_stat mv88e6390_serdes_hw_stats[] = { int mv88e6390_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port) { - if (mv88e6390_serdes_get_lane(chip, port) == 0) + if (mv88e6390_serdes_get_lane(chip, port) == -ENODEV) return 0; return ARRAY_SIZE(mv88e6390_serdes_hw_stats); @@ -622,7 +622,7 @@ int mv88e6390_serdes_get_strings(struct mv88e6xxx_chip *chip, struct mv88e6390_serdes_hw_stat *stat; int i; - if (mv88e6390_serdes_get_lane(chip, port) == 0) + if (mv88e6390_serdes_get_lane(chip, port) == -ENODEV) return 0; for (i = 0; i < ARRAY_SIZE(mv88e6390_serdes_hw_stats); i++) { @@ -659,7 +659,7 @@ int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, int i; lane = mv88e6390_serdes_get_lane(chip, port); - if (lane == 0) + if (lane == -ENODEV) return 0; for (i = 0; i < ARRAY_SIZE(mv88e6390_serdes_hw_stats); i++) { @@ -670,7 +670,7 @@ int mv88e6390_serdes_get_stats(struct mv88e6xxx_chip *chip, int port, return ARRAY_SIZE(mv88e6390_serdes_hw_stats); } -static int mv88e6390_serdes_enable_checker(struct mv88e6xxx_chip *chip, u8 lane) +static int mv88e6390_serdes_enable_checker(struct mv88e6xxx_chip *chip, int lane) { u16 reg; int err; @@ -685,7 +685,7 @@ static int mv88e6390_serdes_enable_checker(struct mv88e6xxx_chip *chip, u8 lane) MV88E6390_PG_CONTROL, reg); } -int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, bool up) { u8 cmode = chip->ports[port].cmode; @@ -710,7 +710,7 @@ int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, } int mv88e6390_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, - u8 lane, unsigned int mode, + int lane, unsigned int mode, phy_interface_t interface, const unsigned long *advertise) { @@ -769,7 +769,7 @@ int mv88e6390_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, } static int mv88e6390_serdes_pcs_get_state_sgmii(struct mv88e6xxx_chip *chip, - int port, u8 lane, struct phylink_link_state *state) + int port, int lane, struct phylink_link_state *state) { u16 lpa, status; int err; @@ -792,7 +792,7 @@ static int mv88e6390_serdes_pcs_get_state_sgmii(struct mv88e6xxx_chip *chip, } static int mv88e6390_serdes_pcs_get_state_10g(struct mv88e6xxx_chip *chip, - int port, u8 lane, struct phylink_link_state *state) + int port, int lane, struct phylink_link_state *state) { u16 status; int err; @@ -812,7 +812,7 @@ static int mv88e6390_serdes_pcs_get_state_10g(struct mv88e6xxx_chip *chip, } int mv88e6390_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, - u8 lane, struct phylink_link_state *state) + int lane, struct phylink_link_state *state) { switch (state->interface) { case PHY_INTERFACE_MODE_SGMII: @@ -831,7 +831,7 @@ int mv88e6390_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, } int mv88e6390_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { u16 bmcr; int err; @@ -847,7 +847,7 @@ int mv88e6390_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, } int mv88e6390_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, - u8 lane, int speed, int duplex) + int lane, int speed, int duplex) { u16 val, bmcr; int err; @@ -881,7 +881,7 @@ int mv88e6390_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, } static void mv88e6390_serdes_irq_link_sgmii(struct mv88e6xxx_chip *chip, - int port, u8 lane) + int port, int lane) { u16 bmsr; int err; @@ -898,7 +898,7 @@ static void mv88e6390_serdes_irq_link_sgmii(struct mv88e6xxx_chip *chip, } static int mv88e6390_serdes_irq_enable_sgmii(struct mv88e6xxx_chip *chip, - u8 lane, bool enable) + int lane, bool enable) { u16 val = 0; @@ -910,7 +910,7 @@ static int mv88e6390_serdes_irq_enable_sgmii(struct mv88e6xxx_chip *chip, MV88E6390_SGMII_INT_ENABLE, val); } -int mv88e6390_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6390_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, int lane, bool enable) { u8 cmode = chip->ports[port].cmode; @@ -926,7 +926,7 @@ int mv88e6390_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, } static int mv88e6390_serdes_irq_status_sgmii(struct mv88e6xxx_chip *chip, - u8 lane, u16 *status) + int lane, u16 *status) { int err; @@ -937,7 +937,7 @@ static int mv88e6390_serdes_irq_status_sgmii(struct mv88e6xxx_chip *chip, } int mv88e6393x_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, - u8 lane, bool enable) + int lane, bool enable) { u8 cmode = chip->ports[port].cmode; int err = 0; @@ -955,7 +955,7 @@ int mv88e6393x_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, } irqreturn_t mv88e6393x_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { u8 cmode = chip->ports[port].cmode; irqreturn_t ret = IRQ_NONE; @@ -982,7 +982,7 @@ irqreturn_t mv88e6393x_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, } irqreturn_t mv88e6390_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, - u8 lane) + int lane) { u8 cmode = chip->ports[port].cmode; irqreturn_t ret = IRQ_NONE; @@ -1041,7 +1041,7 @@ static const u16 mv88e6390_serdes_regs[] = { int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port) { - if (mv88e6xxx_serdes_get_lane(chip, port) == 0) + if (mv88e6xxx_serdes_get_lane(chip, port) == -ENODEV) return 0; return ARRAY_SIZE(mv88e6390_serdes_regs) * sizeof(u16); @@ -1055,7 +1055,7 @@ void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p) int i; lane = mv88e6xxx_serdes_get_lane(chip, port); - if (lane == 0) + if (lane == -ENODEV) return; for (i = 0 ; i < ARRAY_SIZE(mv88e6390_serdes_regs); i++) { @@ -1144,7 +1144,7 @@ int mv88e6393x_setup_errata(struct mv88e6xxx_chip *chip) return err; } -static int mv88e6393x_serdes_port_config(struct mv88e6xxx_chip *chip, u8 lane, +static int mv88e6393x_serdes_port_config(struct mv88e6xxx_chip *chip, int lane, bool on) { u8 cmode = chip->ports[lane].cmode; @@ -1203,11 +1203,9 @@ static int mv88e6393x_serdes_port_config(struct mv88e6xxx_chip *chip, u8 lane, return 0; } -int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, bool on) { - lane = mv88e6393x_serdes_get_lane(chip, port); - if (port == 0 || port == 9 || port == 10) { u8 cmode = chip->ports[port].cmode; diff --git a/drivers/net/dsa/mv88e6xxx/serdes.h b/drivers/net/dsa/mv88e6xxx/serdes.h index c3eaaaac8619..150b2381b779 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.h +++ b/drivers/net/dsa/mv88e6xxx/serdes.h @@ -104,54 +104,54 @@ #define MV88E6393X_ERRATA_1000BASEX_SGMII 0xF074 #define MV88E6393X_ERRATA_1000BASEX_SGMII_BIT BIT(14) -u8 mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); -u8 mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); -u8 mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); -u8 mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); -u8 mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +int mv88e6341_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +int mv88e6352_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +int mv88e6390_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +int mv88e6390x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); +int mv88e6393x_serdes_get_lane(struct mv88e6xxx_chip *chip, int port); int mv88e6352_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, - u8 lane, unsigned int mode, + int lane, unsigned int mode, phy_interface_t interface, const unsigned long *advertise); int mv88e6390_serdes_pcs_config(struct mv88e6xxx_chip *chip, int port, - u8 lane, unsigned int mode, + int lane, unsigned int mode, phy_interface_t interface, const unsigned long *advertise); int mv88e6352_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, - u8 lane, struct phylink_link_state *state); + int lane, struct phylink_link_state *state); int mv88e6390_serdes_pcs_get_state(struct mv88e6xxx_chip *chip, int port, - u8 lane, struct phylink_link_state *state); + int lane, struct phylink_link_state *state); int mv88e6352_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); int mv88e6390_serdes_pcs_an_restart(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); int mv88e6352_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, - u8 lane, int speed, int duplex); + int lane, int speed, int duplex); int mv88e6390_serdes_pcs_link_up(struct mv88e6xxx_chip *chip, int port, - u8 lane, int speed, int duplex); + int lane, int speed, int duplex); unsigned int mv88e6352_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port); unsigned int mv88e6390_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port); -int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6352_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, bool on); -int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6390_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, bool on); -int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6393x_serdes_power(struct mv88e6xxx_chip *chip, int port, int lane, bool on); int mv88e6393x_setup_errata(struct mv88e6xxx_chip *chip); -int mv88e6352_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6352_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, int lane, bool enable); -int mv88e6390_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, u8 lane, +int mv88e6390_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, int lane, bool enable); int mv88e6393x_serdes_irq_enable(struct mv88e6xxx_chip *chip, int port, - u8 lane, bool enable); + int lane, bool enable); irqreturn_t mv88e6352_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); irqreturn_t mv88e6390_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); irqreturn_t mv88e6393x_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, - u8 lane); + int lane); int mv88e6352_serdes_get_sset_count(struct mv88e6xxx_chip *chip, int port); int mv88e6352_serdes_get_strings(struct mv88e6xxx_chip *chip, int port, uint8_t *data); @@ -169,17 +169,17 @@ int mv88e6390_serdes_get_regs_len(struct mv88e6xxx_chip *chip, int port); void mv88e6390_serdes_get_regs(struct mv88e6xxx_chip *chip, int port, void *_p); /* Return the (first) SERDES lane address a port is using, 0 otherwise. */ -static inline u8 mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip, +static inline int mv88e6xxx_serdes_get_lane(struct mv88e6xxx_chip *chip, int port) { if (!chip->info->ops->serdes_get_lane) - return 0; + return -EOPNOTSUPP; return chip->info->ops->serdes_get_lane(chip, port); } static inline int mv88e6xxx_serdes_power_up(struct mv88e6xxx_chip *chip, - int port, u8 lane) + int port, int lane) { if (!chip->info->ops->serdes_power) return -EOPNOTSUPP; @@ -188,7 +188,7 @@ static inline int mv88e6xxx_serdes_power_up(struct mv88e6xxx_chip *chip, } static inline int mv88e6xxx_serdes_power_down(struct mv88e6xxx_chip *chip, - int port, u8 lane) + int port, int lane) { if (!chip->info->ops->serdes_power) return -EOPNOTSUPP; @@ -206,7 +206,7 @@ mv88e6xxx_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port) } static inline int mv88e6xxx_serdes_irq_enable(struct mv88e6xxx_chip *chip, - int port, u8 lane) + int port, int lane) { if (!chip->info->ops->serdes_irq_enable) return -EOPNOTSUPP; @@ -215,7 +215,7 @@ static inline int mv88e6xxx_serdes_irq_enable(struct mv88e6xxx_chip *chip, } static inline int mv88e6xxx_serdes_irq_disable(struct mv88e6xxx_chip *chip, - int port, u8 lane) + int port, int lane) { if (!chip->info->ops->serdes_irq_enable) return -EOPNOTSUPP; @@ -224,7 +224,7 @@ static inline int mv88e6xxx_serdes_irq_disable(struct mv88e6xxx_chip *chip, } static inline irqreturn_t -mv88e6xxx_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, u8 lane) +mv88e6xxx_serdes_irq_status(struct mv88e6xxx_chip *chip, int port, int lane) { if (!chip->info->ops->serdes_irq_status) return IRQ_NONE;