From patchwork Fri Nov 19 22:43:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629663 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16E04C433EF for ; Fri, 19 Nov 2021 22:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234618AbhKSWqg (ORCPT ); Fri, 19 Nov 2021 17:46:36 -0500 Received: from mail-co1nam11on2117.outbound.protection.outlook.com ([40.107.220.117]:22881 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234108AbhKSWqb (ORCPT ); Fri, 19 Nov 2021 17:46:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VE/9Avc/9XKxne1f4hXcE7chcGJkq11JVsm8/pL+82KA8IPKTvamx+LHocGmt7lVY1futEEfbzH34lQiyPYX9jlBOYAoe/vkUEI1iawfn/rrieoAsyM3maG+a8KjyhZYPn9Ta4Gkgm2yaT9SKchiqbxcnSbepvw96bitPYeIXYKTwHnpXYinkAzQjF1gWiogXEooIHRoW6gZJz9AIJpb3PeOjAgVTrxRSZcHHpq9w/gIlUfYHUDrIoMAAWF6fCTszUQzWr+zFj78N3uAWX55y+FNPRTK9zBlkEV41Ok9qtGkQXsHVGXhQUJNptMuvj2jcxGUiJEM9Ng8bjEbwJ4A7A== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=g/3n1kVpGWtmRt10JmKA8tKhdumj6BrhX0aWQ31CSUg=; b=kGI96Je/EjOQHBl4bgQGO6Hu7D9j49kXKpX/8n+EthuLikqON7yiUCFd+lZ5lOvxkcYkZRm3gp8j9dEN66w0PkkSIrV27Y9TCiEJNkRMyYrYqBiGFlMxUEjfYADPHPAvGB9radkLugENqqyYrCC7ysDRidD2ytxpGnFY80lWxEJn6zIyr2ztFp2VdOcMPHHhInJNa5vdVaBiTHOX6WJTmQEhweSmhC4RIFTazejQF2G/3IyAjAR5CyBY6COgpK5fG8vg7HZhutVNKQHy8iDNezF4F2J6l2p/PXQ1K8mnK9hGiR0gnwqZvaMrklqgyHHi5ZmaiWAVPjH/yUxfixG5Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=g/3n1kVpGWtmRt10JmKA8tKhdumj6BrhX0aWQ31CSUg=; b=U6JiFmZBPfvnBj4rPXTsQkbHkboXC4nb7QrcbO+v19UjmMNNbITxGvTTqNWWj7Ub4i5Ja6gzM+F5oDW56hprJ+qjEGiCDmlbvFNU7BHk6i4V8MZMDzYeSGK3VuKP9N2QwNWJmDvFsKefoCEXLY8BJAmatWHhWvyemtCj4vWUV8o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MW4PR10MB5701.namprd10.prod.outlook.com (2603:10b6:303:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Fri, 19 Nov 2021 22:43:25 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:25 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 1/6] net: dsa: ocelot: remove unnecessary pci_bar variables Date: Fri, 19 Nov 2021 14:43:08 -0800 Message-Id: <20211119224313.2803941-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:24 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7b2076d-168a-4367-115a-08d9abadff20 X-MS-TrafficTypeDiagnostic: MW4PR10MB5701: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5236; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WnLWY1VhuANTq5s8GdRdUr0RW6EMVxV6BCpIHYYjiodPTQ942yOTjc3cuahhO5NQxhAUWe9YrHcT8OvX8wL5+rQQBlaAwER1QueKMOynsX6jozBKLZu3p5tHMw0JTK7Wf2VjMsB99a1kw6DK/vrPgnzca7cMtLIXOGipJp4NzGYXiD6c+FaLAII9ifSjjv4QdAU8oOZ6Nq3gdPeC8rG2+oKt/Y6iWHicwtof5udW0glnqTw865J8z4+Dg6JsxXFWAzWZZMK3kFYqilIDXpdGfnrhUpfonWBX5INOB4HB3NBr3/zsY1YjAaAC2xuOwunmQN1X4o8jc1tQbOJKsJeKw+lx1g/tZ9wkLGwULeZzUsB+0c+hG1O2SRcOHfZbhizatV+4/eB7kXkwZbMx1qhz5bgjhQf4cvqyd7L10srMrLwi261Fxk1ZzqPcHR4zA3RxtJAkww4qMD1h59jBUeXigXinA/e32J0RW836ZFc/zYDBro0GIUZbpYje2kADZrXAqWyLIwnDcKyX0GT4poI4XIKDudBxeD5OLRiITaGsjE6o6Rkvtkz00X8DEpH5zMw3pHl0lS0qbU/OE6YxocM2/R1vg6Z65DnrR6m5bEgIKwsHOFn1V1/lnxRepyxP6bOZhfSaSxPWQMINVPLKJtfkXOi2LOb4/Ub7KYes7A7W2rhzToO7loamXPHKc59tX3LYimzGJSpMiIjNO4N7xGNY4A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39840400004)(366004)(396003)(136003)(346002)(376002)(316002)(36756003)(44832011)(8936002)(8676002)(6486002)(4326008)(6506007)(508600001)(956004)(2616005)(1076003)(7416002)(6512007)(26005)(86362001)(66476007)(66946007)(66556008)(83380400001)(2906002)(38100700002)(52116002)(38350700002)(186003)(54906003)(5660300002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uN+LIyuF2EtnQC6wW1lNaWkkqaT55mao1ovWWhRQ5jScOe15WJF1AxChZnWOyBiB6Gmr0LM82GgC15e3yG/57lu/YQ+kk7n3czYVfYj3uTi3X2jbZYtfdECxijubBQ3Or7tg0kpRqFlFIcn1FFobMBlcV78l1QynG6SDzN8qAlQlgC1l0ld2U+xn86H3jFWCsEFnDfvevdZA2aRxrm3wkZ1w4ulrYBysGzMN+fNpSDlmBE6YoJiRtv5KNTnXdnmsJmkSIGqEXN02MLdTpbrHM/s4sFAkxNObNNKwYr3KWdHYhjz03i3UbZdvBmUqfGmhwqHyBtagGuUfXe42sIWhEIzJgzoGYiAaUNSQi+X4+BMAnFa5HmC9Y0WIoouCEHy54Ii0uR4RN/zW9fuL/9hl8RRfKUg/Ni01L0NZUy316t/+aHr4HoMF7PdudtFzfGpbZW9GERMS3D/UYsRPxnNBGbAKtjgPPrGBZAbnSp1r97n9vZ5gu6R786RTCFYgQn5Udm6tE+cZ57V4wgM+xwAOEkrbLyDHTDKel6/hp7+FafMYs0AQh02EZA6ZQV0cl+NgMaHUILJcpT6t1LbB69v7lpUug+FZuZEXMpyCSRYzlWGPR+W6iPTltrnVITTgiM9q99fPFflM687FOEzt3rNlCsLRMlHRkRMqrgGKAI+llCerL5m0JRXiFdpWtSHCzzn0L41VVwLGXOMT3kIS/hizcNLQfOm+5tCBc2t004V8evafM8HD1ivFryYCBOOrlJEl0ctoFKwT9KcSwY5HWWJ15+5G2jCaCK6LHH+rz3M+gRceuAIuTtCv+kAAYQvd55+Kvypwv1mDEmZKSan5HWHyYeeabbbXaBx7sXLPw+XbI81REfxn2lGNejhRfTNgH+RAlDhCH6hMyOq5IeghCGgwEuxcS8azwKM6Ph6CkHSYOwp4+KTLtXCreF0Lp2LtGoqhHClgscuc1HJQAzPaekjkPuR/rICQM5JGxPoHoWlvHX67yntf3VjXBYLT647fgA/5eLKePpKcH/1attdYcy8M97MZwrhnfFyGNOJKdiMGC5zMajv+l5G7r0jYDxH1NZyboZ4efyCRQ9H4sHz1j2oaXxc//saHc5W25hqmlYUfmH6LLwE5U1pgO49J0y0E/Nn93mT6lGpW9TPj5mxxP8+JHOZjuI5jMqTCq+4ZHq5/GNWzPhF5FtXPMCfE8KR/cUTNakqiVlklpTIFN+0GFos7No/I+CSUz5LK3rI9uSKAaRjhOIZJnhRBSQNtmhorGZv3iPHfpY4eDW+8klYeoAkFhb+tC7tVUp9XR3PtAcpFbYET9MQUQqn5Dm/e2DMQuldY2xU3I41CGOQ/NpCYzD4G9HMpf1lxOLKKAMzoNQecGCNL24TPLxwRTKzzB8Okut6sk8lAnBNXj/DQI58v34NSK9B0y2WGq9/zauPK9Qk2jT1r+4HrSfea0n2jSXdc5k0BsKU8ir9aoyviamXRVhbXrgfNjJ5NLv0pr9P+a9HHy5rrbfvai4fQKKhngVTxOE6TC5Z55DxS0mWx6H2ddJcEksCu0Ih6EzkVgvzFWp8NJtlZoiezcUxSGwDE1p96EoQO2KjdTD7Et6HGXLuQcc/0qCNBJtAMd6UPHOlzcAVKwttvatH+M4DxQ0qTPZc5Klrgcw4CC2u7ma4CGX50j/lG0khGlzxQaUSlAtXiQCM4Ecs= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7b2076d-168a-4367-115a-08d9abadff20 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:24.9768 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YCwNJUX8xVn5CHTnpA/B7II+Yw+nKGQYce1K3qw/J/KqKiOox2nSRy2kqHR2m2KRs/E6ykUbDodn54CYRqGwWxsYrFDCfrW3T369Wr4ybo4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5701 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The pci_bar variables for the switch and imdio don't make sense for the generic felix driver. Moving them to felix_vsc9959 to limit scope and simplify the felix_info struct. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- drivers/net/dsa/ocelot/felix.h | 2 -- drivers/net/dsa/ocelot/felix_vsc9959.c | 10 ++++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index dfe08dddd262..183dbf832db9 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -25,8 +25,6 @@ struct felix_info { u16 vcap_pol_max; u16 vcap_pol_base2; u16 vcap_pol_max2; - int switch_pci_bar; - int imdio_pci_bar; const struct ptp_clock_info *ptp_caps; /* Some Ocelot switches are integrated into the SoC without the diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 42ac1952b39a..9a144fd8c2e3 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -21,6 +21,8 @@ #define VSC9959_TAS_GCL_ENTRY_MAX 63 #define VSC9959_VCAP_POLICER_BASE 63 #define VSC9959_VCAP_POLICER_MAX 383 +#define VSC9959_SWITCH_PCI_BAR 4 +#define VSC9959_IMDIO_PCI_BAR 0 static const u32 vsc9959_ana_regmap[] = { REG(ANA_ADVLEARN, 0x0089a0), @@ -2155,8 +2157,6 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = 6, .num_tx_queues = OCELOT_NUM_TC, - .switch_pci_bar = 4, - .imdio_pci_bar = 0, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc, @@ -2215,10 +2215,8 @@ static int felix_pci_probe(struct pci_dev *pdev, ocelot->dev = &pdev->dev; ocelot->num_flooding_pgids = OCELOT_NUM_TC; felix->info = &felix_info_vsc9959; - felix->switch_base = pci_resource_start(pdev, - felix->info->switch_pci_bar); - felix->imdio_base = pci_resource_start(pdev, - felix->info->imdio_pci_bar); + felix->switch_base = pci_resource_start(pdev, VSC9959_SWITCH_PCI_BAR); + felix->imdio_base = pci_resource_start(pdev, VSC9959_IMDIO_PCI_BAR); pci_set_master(pdev); From patchwork Fri Nov 19 22:43:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629657 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8898FC433F5 for ; Fri, 19 Nov 2021 22:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233938AbhKSWqa (ORCPT ); Fri, 19 Nov 2021 17:46:30 -0500 Received: from mail-co1nam11on2117.outbound.protection.outlook.com ([40.107.220.117]:22881 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231231AbhKSWqa (ORCPT ); Fri, 19 Nov 2021 17:46:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y57LrukPSUZXN682GRucCoWI2i0476pyH8FU6W3tjFJR6mwcP/qPBX/S/141bz1dGZtW+3hyN6tPre36s+chIlaXtSMyLxRISy2PsAoWyKwl0iQp5/Zmr3/kdPy/i7km7vsVs4SY2xn03BuNkJEatG9otxkSs6IsRER8dcPJNOcQyg8UAZp0/VuR/hnkiI7rwcP73Cut9GzvNmnpPudKnRIHjQ5H8tB1T2kepGVqXAdbEPV56E9sLuraca9avKG6gE5OeFPTn/GEzhGUWuzT6FReq683wMe8wk/56FKJzq0k+hVYLOUoxYk7Do+CgwN7KeFsgo1CpSTW+c4+v07GAQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m3Zz4d2L95f4U+ta1PckduowNTdDByYB6IOALWxD360=; b=EPpV/XUlgVyk4vfN1WeYdyBjQS4jyE5RqY+hYXkH551AMmkaFbv/g+HDAVEmlScS9COhHEFgwfcOooD/+HIQZwhkDO0pTHgwt8/MZwu4yF6n5m9JLWv7pSvzcmQv674wQFK06EuPoL9OsUuGYcr+Z24zpPqPe6c0QeT7CjvxQ/ICcrhclh9WD9rR9qHiSndYvi453JGwsjlcIjz7D/aXDBWCQrrCgSYUiR/fPf4V3yu3fxLVBYJRiWYsY4Xvfqaq3A27YgjvjCg6N/ZfuKJqff7B7ukCp4Tk/nBBGTSUX1QxMLvGQyQYANAwkAGf7tURbEixao9Xe3j1rjp2lLou7w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m3Zz4d2L95f4U+ta1PckduowNTdDByYB6IOALWxD360=; b=iMpHC9bS0PrngnDzraR8smbdRTAlNXUr+ZfMrEE6jfHPKb6/WtbZaviWKeU2WGRuHMvGtzqKvEvuIJWkh6D0+2mukUxNpNojt1WYODT/2danhYlrymIpun0IBvoFnCml1Rb3xHX0QRVm+nig2Wkw+++W9jLO9XRUhLR4CRNZnBw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MW4PR10MB5701.namprd10.prod.outlook.com (2603:10b6:303:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Fri, 19 Nov 2021 22:43:25 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:25 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 2/6] net: dsa: ocelot: felix: Remove requirement for PCS in felix devices Date: Fri, 19 Nov 2021 14:43:09 -0800 Message-Id: <20211119224313.2803941-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 02a61b92-4999-4837-3a90-08d9abadff7f X-MS-TrafficTypeDiagnostic: MW4PR10MB5701: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8HNRLawthGhc32LRUZarXA9UQuZneji8uUYSC/xK80TB1x4oGbzptuUp6GBw/gZOfGdwcoVqSvj5T/dWa4pGjbakRfi2ceWKfWemA3J+Jt7NPUuiJmL6sOxQCNAZLvY9B1o2EouVXz5b/TikR9MzGUa8CnPIVosaTynxA1pLXyxV5XDyCo6z7vkBuaOfOFHj8paccwENPboWobAKGqq41Wvr5Emt4zX+6AA0Iw9WU+ZZCbtgo9tRBrxmiHMvje+2DEqYC6Uq241ZDiJDb2jOL8Rpzig+X9d1YBbgzGQDxJSKeiZHrRT8qOmoB8w6B5S0m2bWrR5NKOhcK/lnaLaadqF6DUKT8Ig/EFONB3fzU8a0LSVr9+uIwyUKvlvEpyLfovECU+5hCdGvVvsWWpdOP2w/5MkjDR2t7bBKkDYgYBl8C3dYgG6FomL02pxbivUesWGa57mFE8wmjZbt3tVmhxF0xN5WnsQFrJZxAGNDGUYav56w7Mbieizjx7sm98P+salvMy8Y/nEjvDPNozyEn3I5JL28cavoNvOC135CzjAhy51V4OGsqFOp8sqKUzIoWmbrmCy67kXvvKumB0RmvNroThBd7d+X0+fSA4xevOway/CG/kb6umJKsWScZQ93Bdr4SJV7GKavot5TDuziUjnk4UflsXM8aNdrwnBwt5bZelhGEvA7dN8xgJ/N64ak/Pjaz6NExeIiZWarfoJ5KA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39840400004)(366004)(396003)(136003)(346002)(376002)(316002)(36756003)(44832011)(8936002)(8676002)(6486002)(4326008)(6506007)(508600001)(4744005)(956004)(2616005)(1076003)(7416002)(6512007)(26005)(86362001)(66476007)(66946007)(66556008)(83380400001)(2906002)(38100700002)(52116002)(38350700002)(186003)(54906003)(5660300002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xNwn8ti+dqTu8zKwSm9ZmUZhR6DD+8XW9L69tlJ6f41MlKj6osfiyYdV9Urh+whBivUh0lAbpwwl0P3LgFIAlRvCJZpYOX8Xt8MC7QEzBZFaoSqUf24ilpjDmVjkT8zC7zeMUkWYoNs18LXsCQJoemJG3C8yhpPuYS9VrhXxoJN6EofKqKFmNzekzqABa2tOsv65jX8iQNT3/54g4PTFjuBZRAOrRwYQ9eEwttILMdo8pBeDY/vm9NrywSUlQME1oKZ5b19ePPuVeX6FxLriIRCy2O7ukAoDb8oQSbZ0pSCmQKUyij1C1oR6WmKy0taZECXUyb+V1BbMonsQfpHtfslqmy3k1VOaS36dBXrOBS8jymYK/70sgkevwpQk3XQCTvwXbM1ANoPqfs1wEOYNHn85y0EHF3G7jHAWolm32StHd4/RVNAx6PjiVXKfC5GBoZdWvqwpkn0AWWMiDmofB2UF4K05KLBPdStwy+XXwkPjME2h5YlqbOka2rxjhKMxF0YUuDF0qD6b2TShg7XQvv25yGFSqOBtpZxM5uVdtk3QtXk86dy5/tkzW0XnD5PWXm2rGvvGJoBFSdqxGHr3yDc3veGMXCqmzXi3vKw1sdlBDMr+oAAytdWTJ7uGasVsb0U+gZunt0x5QeJAUA4udX69i3m06b9Li4YG4YSJCrf0UGiuU8wtyM5CiJLEKOrjXjZ9dSC8s8AUsk8dggKgmZE07o530HBmOf3Ty0pJ7t+2vrZqC8boMpRHgzhFshyckASvA2mUnmq5zY/GReU0JjbOPRyeJ6DBBKvSFz8Dj0COtdUMlH4MFAoHFLKpUgY5ZY5Uh/q9qxo/dTVjcj6Yb6U8zMm1LZlqiQ5lTlNTN+Y4b301vYNPxIGStG9h+t9BV55XmDc0Pab/vhQVPd7/mUFsgwo/mOVxzBCg2KFwHd8JAFqDA6r6XbvOsnUGuUtbX8ik0z0rEYAOQC1Ho/SS+1eH97PbahpdgqAMMunfcMvTEoXtfAgtMhIFNm/NLu+cTsa9Fe+fZ9Xa6dRPK9RaM05s44aV244wR0U4lHMWaKvoHwkxJBVUNA+0LwsJGJESAseJuC7S3GAMWg7K/MnnfNk1XFBcNxW31K9iik16tnKrsuaolS1YrpKBUruuRyT65WxGTih3tE/HBPMpEsMlFD7hwBo6G8mkO5ee4vJwrHNQBc1R+Ky1J78fQsVQDO427zkbimcMXPX6ggenA5zaT9j48uKg8R1dmrNfHXBKCpMYZ0bJVub72Tn4MDIUvniqYjGflgZ3/vt9ojWdQJ+ZUETMCCk+yYsOl+1MI/rBSZQKKWZJiPgqzHMdH2XE2H47YZj5WDsuJZbEagzK3PEzxWG0RJeDxOcUeVA33rTVE4ve+YL5iVJS86wh+kmypwQs3SZYacWV8yJkzOHCXKmb2YLPKFMEsycn/0sApMMHcu3aKvGjhvJ8Fyjx7MZuwW+YsV6PRPQWJxq4e6EfKoTb6ntY0mKwjcMXsbtpz6G7oWXl4W+I0GxcENJXAuQWgWR/QSkpu4SYfO+4lrm4U0fm9MVXH6VdLZpvlp7yETm4FL+Ef182N5//r5MYhSUx5TTrLtqmDLG4zqHBsy6s7UTBnYG9amFyvsEjpE+DGWC/6XKJPeQOrONZrpvRobDr6xLH1qIlgfL8z07hW5h/T6WFlOhqyl5ozFRXxhYEaEKBjTE= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02a61b92-4999-4837-3a90-08d9abadff7f X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:25.5345 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: QKWFqjTPmscBtSMSYJionEtP3WbUiyTGt1aTn3jpiL668PQP1W/c+L1hasmFDLRJbqDgYUW1KncGB3UFgl67qbgotpskB+t5hTxZlXHmJjE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5701 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Existing felix devices all have an initialized pcs array. Future devices might not, so running a NULL check on the array before dereferencing it will allow those future drivers to not crash at this point Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index e487143709da..7b42d219545c 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -820,7 +820,7 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, struct felix *felix = ocelot_to_felix(ocelot); struct dsa_port *dp = dsa_to_port(ds, port); - if (felix->pcs[port]) + if (felix->pcs && felix->pcs[port]) phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); } From patchwork Fri Nov 19 22:43:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629661 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37DDAC433FE for ; Fri, 19 Nov 2021 22:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234549AbhKSWqd (ORCPT ); Fri, 19 Nov 2021 17:46:33 -0500 Received: from mail-co1nam11on2117.outbound.protection.outlook.com ([40.107.220.117]:22881 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233433AbhKSWqa (ORCPT ); Fri, 19 Nov 2021 17:46:30 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kUq16YaC/jew/APdFFpd32APawILDapzb1vSQxygCtlfA/EKxupS6Pmm2ljK/d0qBO2GNH2VWvmZFi5nAHYx+oGtVRvFP2lQOEmfvm3FEIgolcx6SVCr0Uv0HxU1KJH5m4S4poovRFih6JGjrSgrTrDnK0UgrPx0svBdpx2vdtLAHlr3qig8+UX/SUwx0pxMWZh3nmxa117aIPhnpMItuk5H+0JUz5Mpr9KEUAkwuWLNJds6r3znpRl8D8MVrYNZugLP/pDjveqmY9I0PVkD9H3TUDA3+D8MC6EcdDpDBnJMBgNcngtgi0trkjqR1EBwo2VlDqIRW0iaRFs0eR26PQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fs+P/dCgvnLUdxBK+Q8CHOeMNGIvtl6dbtjReLlqRP4=; b=DLFvKyKGBsGACKRjWVCDwp58uRzmjh7sxZk0gWGoi5zc9egbYniOtY2S96fcqb2r02YKUG/YPxBSxKf/84RlDXlvkG9lQOV04/dOlqPDAccOIpCRsGBtJdkhe6Gwesd1vUt98kl6gh7FfB7RRq0jD1mvHnC5Zb3sM0wDKbsR2DDnfI/urouup9E97j0S7b/iONmeGHCcCO7uKHT2pwab1MejinvJm3LK5Rz2EFSRbwHFNdcsTYaYY/43r6U6cnO4uPQno0Hlxbl8TzEnATADnZ4eem6qNjjWCLol+U+icg0OSv1KhG6AIMVs4hEJyitXYFHBF7+d9ulDyzPlNbjU8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fs+P/dCgvnLUdxBK+Q8CHOeMNGIvtl6dbtjReLlqRP4=; b=rLBY9LkTte3rEl9ELnLrSZ+9Kdpz/56VkQrjcB/5htPaN8Gjv8lOAkGQ8gQqZvQGDtQrI/IIQEu3iha+8SXePHAVmWnGsfyfm3kzHvZu7BenfWqnKJN3Sd9rG1DKwL84vyQgPtt3XBoms4K8yTDZhJ1Ynxh1ttLLLe9d7JYoy24= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MW4PR10MB5701.namprd10.prod.outlook.com (2603:10b6:303:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Fri, 19 Nov 2021 22:43:26 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:26 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 3/6] net: dsa: ocelot: felix: add interface for custom regmaps Date: Fri, 19 Nov 2021 14:43:10 -0800 Message-Id: <20211119224313.2803941-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7cacffc6-f77c-4faa-270b-08d9abadffdf X-MS-TrafficTypeDiagnostic: MW4PR10MB5701: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2150; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4B91kVM8QKNafucQDcUmmxDDIagGg6XBMxZYtUqIg3fmtmPeuAHmfU/xTvRPtIkYLoCIMCEkVaTtxneiTigGolAVlmeji1J8g/Vw0sdpuptu3dEn8n6awrVUDyENqMJFjjmoXqx6mMl/jrKyi4ETAzMXSeYfHKXCM+2SLDAv1hKkuOx6t7uDBLsGn0TxHvI9UXxAXDJVrN3wMZnU85aS0FjqtB+9tGuIsA0/wZ59a40oM4rX9PVYiDiHu9MXFp5IYRfW+9l//VkbGm1c23s8qZIyjqBr0uf0uyfRtKUZebXVUIKH2xcFTjdE1vf6dKSLTChPu4a5Sj0Sf8nC31nsSW0fUDEI6aHn6AgdofYLOKYFsVzH7vP2hf2DfK8FU3TouBbo0FSzBjvBnoWq5g91ZarxGcnQvN/7QrxJk5/z6/CO2sHSHz9Z44khkMsm6/83jjjL4luCeObC/zwC0raU7D32ATDFzDuUAyiM2zfusVHdVh8IR+YzCSyjznfjkTue+5g4IsCSObqeA1AB6ksYqwR83IsTYmXsItbrnQKaAwedCbQ9oJrwtnXlQEOo6j9ZqK5oj7wkqNcBgE6gnqbNJcT+14h5lINqAbqKjg3wDBjvEkSqgp66Bp2C3xxCuSEelxUg/nb2xZL3RQgawD1AXFpVsozeBE4joLGgMhKEtF0FKonFQZljDW0npHyEVMulWd7fiQpExXRKq3rJw9rwWw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39840400004)(366004)(396003)(136003)(346002)(376002)(316002)(36756003)(44832011)(8936002)(8676002)(6486002)(4326008)(6506007)(508600001)(956004)(2616005)(1076003)(7416002)(6512007)(26005)(86362001)(66476007)(66946007)(66556008)(83380400001)(2906002)(38100700002)(52116002)(38350700002)(186003)(54906003)(5660300002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0YBGue5XDs71uDPPEJ96MXroDrPKehTbfUbJnhbdL+Y8IJS6WM3jl2a9Bh48aCQMmCZ7/fuwR3jEMVSNK7GBoSjkcfoUpo6SL6gHE56AKLSA+cstF7Pj0+JIbV9ZFui8RcY/nnb8yNwn3zn/xlUeE5nrUMh4iKz5FUDC4jCHbkb9UhyXlwgilOESE9yRzLrNlufdoQrJBSvu4y8D0oELVawaG746jPAHbH+r4jKvs6LUjTLWnp6eM32nlEz79IJkW7LaD+kPD9J/kyjKcBMvrcMMN2E8PZd4Kjiv3/3yChl3FpS3Bi3LLMeLndRvjVItYuMxnX8nrMqj5ck9rdyuCDJzfKNGlgAGkxTUUu+fdF23lEmxKImLUQDtgLt88Nvk7N/UF6TxT8pcK/JV+BVCw38P/cVvlvioc28X47X++2ExvsHxUlmvjdn/ID81V1wIR6uCoA82Ck0mGxzhi6XgzZ/GLdgN5s4ValfScSi0sqtMyQjKy8IrLc/2oI7Zov5kai/BMD1RJ61tWglxAGzBzi2kBDKCiHE25qcx2aeTEVf3bRDvhUTt7fFF3qmWqRI6vJjhJ8HSUB/R5aobmbRl0w9gRiz69fGCINxSIR2CavrnzxCz3UZZfQh/Rb12MbCm8BWDHoIVKqujfW0ZwGkOY9KGFihVc2wu4+lJUm1dkYenCwYgC9lt7oMGLGagK9GKY2UlZufuM3lfORQG0mVKY/JJruu0H8J0cmTovY04cb9AfmCqIu1dNpaYMgYDAj0CkIRccyWJUh5m4OsohAjAwFdwZVNCylKU7k343Xs+93HUCmQUtu+wsBng6HgDcKzynXoKQYkHR/I42fe0L9Hf8IQyDoRF7b+ILS9jYYvmOrn0HyDynbyGrjYaWfqBU8BCnLN3HM8lGlCi4slDSUML6/HYEtDuWQR6FbM5wMPbnB0cid4rN/ieKvWOQTlUq41tH6iSLGExGH6Fe5k4oC96i2qFnGt1NbgCQZLnGanV+rdjV8oq4GZyopE+D7ImqOHnp8xwLatR0SS2vY1zzZceJl8AlyW4MhEt3siEyNgYTgagYrlW5buYhW1yB1p1BOBI/TGX3vzR0B8/u8DFUWl56eqj/9fOq3eMENG2iLgjUnH4MBnRnDHKo8rMyaeH+X3RKnWHJdoZrcdJMIvkapup1sueUALpD+RdrgRc6g9DTKUXO3CWtt2DWgSYJZfoNJ2TaWFWsbvllXAQ7LRBOkUYKs/js6c+EphB+ehoeaj+X60evD29O8ezupXsPZv6jVA0yXJgskjmV7dHOUI9Jq1kosBvW7rljKtMnQs01JaZ10b3OA2VFh24xyseFv7HmlKDqwqRTPRd5750Qgh0OBTMAKIC7Ijg/tk4mhpO+PvpNSphSxsNOymV97Ahr+i1KJtMkr88PoexiuPbKSHmWarqTauRk3G5lmCZ7EwIRjozBTyqQrSnzalq2nybdQKJhlhzI/r4Bsf/gnFx3rONT23oD4fUHeZCvY5gppH1RnVDXPwjANGVi0OCvh8C5nlBAX0uKbeWlLk5NVIl3PMw1v2fqUb7Z6ETAljZs7kmPBdLQIZ/ZwevUwWJxt/gD3VKiMnGuqIk7ASGHbuzO7YSMw+618q5NWpO0wQcX3QWc7cy+2uSxO2Gx8V3n68/q6H4/hAfyi/blJwx+AqG6tyYqZCNyt8MOWN7cK8CMoA7lSgAOtA= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7cacffc6-f77c-4faa-270b-08d9abadffdf X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:26.2311 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: VzRd59Ga7luGAoGn/RlvKxvRg5NhuSF0Lm/O9gTSbG8Cq0GEsrZQzVl6M+Pmdqxy4z/499WjuaKszqfB8KiKGqBngSXigRjdUu75aHmpOwg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5701 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add an interface so that non-mmio regmaps can be used Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 4 ++-- drivers/net/dsa/ocelot/felix.h | 2 ++ drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 7b42d219545c..2a90a703162d 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1020,7 +1020,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target = ocelot_regmap_init(ocelot, &res); + target = felix->info->init_regmap(ocelot, &res); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map device memory space\n"); @@ -1057,7 +1057,7 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) res.start += felix->switch_base; res.end += felix->switch_base; - target = ocelot_regmap_init(ocelot, &res); + target = felix->info->init_regmap(ocelot, &res); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map memory space for port %d\n", diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 183dbf832db9..515bddc012c0 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -50,6 +50,8 @@ struct felix_info { enum tc_setup_type type, void *type_data); void (*port_sched_speed_set)(struct ocelot *ocelot, int port, u32 speed); + struct regmap *(*init_regmap)(struct ocelot *ocelot, + struct resource *res); }; extern const struct dsa_switch_ops felix_switch_ops; diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 9a144fd8c2e3..4ddec3325f61 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2165,6 +2165,7 @@ static const struct felix_info felix_info_vsc9959 = { .prevalidate_phy_mode = vsc9959_prevalidate_phy_mode, .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, + .init_regmap = ocelot_regmap_init, }; static irqreturn_t felix_irq_handler(int irq, void *data) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 899b98193b4a..ce30464371e2 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1187,6 +1187,7 @@ static const struct felix_info seville_info_vsc9953 = { .mdio_bus_free = vsc9953_mdio_bus_free, .phylink_validate = vsc9953_phylink_validate, .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode, + .init_regmap = ocelot_regmap_init, }; static int seville_probe(struct platform_device *pdev) From patchwork Fri Nov 19 22:43:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629665 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27298C433FE for ; Fri, 19 Nov 2021 22:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234713AbhKSWqh (ORCPT ); Fri, 19 Nov 2021 17:46:37 -0500 Received: from mail-co1nam11on2117.outbound.protection.outlook.com ([40.107.220.117]:22881 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234248AbhKSWqb (ORCPT ); Fri, 19 Nov 2021 17:46:31 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZBArHpRMYPxq3lUTMMTwGxNDsC9gJ/6C5WzKtj1ctBjztVe/I03ZP2fkEhj6ldkc+EncwnnNODV42U6XZf1NyKGHLoPT4bzc5ufWfDNs3c2OveXpvqlsRiuQ2qpLmSXpiOxZqu/qWRD8xQlF5sMZMrcMoog4+cwnQl8A+gsFDeHMs+OydRkna0PeD8oJ7PFQGMbKoHj/AqQ0DbnXShmcuAhKRYwRGeyTOxL5ljAlhonfulsawIigqL3r01+bKNzOPCnkJqs53AiPDfWoWqm2TgVwna+owDbCN8r+N9VOfT/l089bxsoujno1Zb2ls7+SUpHtoSm2EfYVtyXAtK3fWw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LJAhBvMQsfsrmilvvepIMGy7l2AnN9UgT4ZJJs6/nE4=; b=Qfv7wn7TGDvYl27CzDdTOV2O0Z4JReVeqntSn+bL/4BbD/9WZmH1HuNU+nUBJLhy5iwqV2/iriv1XFb7zFcy0p3+N+ErdTicsoXxzLFKEZ41E/uSvHb+7hZeMFLequKD7ND6obUm4H/etcO+D6Lo8eON+/kl5B3jpBDzHrlUgV4LrubYwY12soFPDFoGzbfisxKC6cidBzMKRLRMx9O+iqL80gC42/YGHqx98EWzWkg6AwigionMtO3D5wPe8nlmmmqegyPxKD5YVRvBvrA5P91WaK/gKsJ4uiSFf4z7FU/putNuTlaibW3Z8MThBNuuclpnNeU/Z1/69opkgVHL0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LJAhBvMQsfsrmilvvepIMGy7l2AnN9UgT4ZJJs6/nE4=; b=TMn2y0UVHLdDSf82zZhfcLskt9lat0Rd223zD24DAeKTpdGrxYTb7HLNcCQlZZisb6c6murBrd1XYyyR7i+gIGcKyBT0Vo0vxvrTGj2EHmSpVlyrMG239ODbpTMYrXg/HFvJ1o8/gl5FGB/VzDGR4wfmXwa4uofa+iTYlJ8XMvs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MW4PR10MB5701.namprd10.prod.outlook.com (2603:10b6:303:18b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4690.27; Fri, 19 Nov 2021 22:43:26 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:26 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 4/6] net: dsa: ocelot: felix: add per-device-per-port quirks Date: Fri, 19 Nov 2021 14:43:11 -0800 Message-Id: <20211119224313.2803941-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 91987185-6fbd-4eed-7bc5-08d9abae003c X-MS-TrafficTypeDiagnostic: MW4PR10MB5701: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Ev59NCn6Q+ycPo5wv0cc7XNFsWEwIlWRQcexkxbHAn2hxJXchxUgJDubzZjUZK71NGSPwacsQeOHlQbcvY3rIJX2W6xNjHh9DIe9khGaPjuHrsx9TT+BbeqSoeAZxzEES1yQffncxkMf/RMQhr57Z9M0h3WQQo+X84YOWDRYvt/OO7Bin5i2k3ZDrgFKEatZMt+yH5LqSS1hrbalg7NE38c54nPlVg9C6wE9FWmTXCHgU3oPfN2TL+w33eFXKlUvxTtqsYAwfF3PBiC7sBXvz9T795I3wy3EsIE0CQhV0MBVcIU4nAuuGu6LBWqqzP7H/NGLwljU7/vjZBEr0NCfn1kYZETqGJ063SqOATtL6zS5ymw6mLiuBO03bm8BnJGA4GBocEoqmvdqyf5dyKG1nToqtpVuHzR/cKuMNRb9JLzsGKCn9coUN3WF3NVvEtohC2x5NLvPfPy9RDdhQjx8j1gJf+hXg0E7lFBJ7qOdyK0FuhL2wFjKsiwLNxHzS5KVSOSl0yCFXR2JmPDecL73/DAnJWSOsNFLLDJ67Kz6vtA8XZ7p9OCWPVLxvEcVVkl1CWqPFgR0l9sn2EX1DnCGHAoXsoM4P7qTb2iJTQvGpteS0Pmux3L0+d9S1AIXr2DQFw51a7xv8UlvtYq5r6a6rQ7TmuVAbvNS9bMZXfMG26JBCxNzPBPrjhxNXqPBfLhhNliKCYFsC2++6A71TAljqQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(39840400004)(366004)(396003)(136003)(346002)(376002)(316002)(36756003)(44832011)(8936002)(8676002)(6486002)(4326008)(6506007)(508600001)(956004)(2616005)(1076003)(7416002)(6512007)(26005)(86362001)(66476007)(66946007)(66556008)(83380400001)(2906002)(38100700002)(52116002)(38350700002)(186003)(54906003)(5660300002)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: N6foJoal1TOuJKMOWGbeV+wD9qSF+Jhvdt5ya4IFcvIDnorMnNAn2c1ZGackHukkext48SLjHdt22tCQhLHzO/jStOsyIphO191wOPk3ARp7kyhWs0DlseTnmXrmZoc0aKQoP2UWud/UnPP9hh7HTIxBt5OFRu/J7+0f6XT1R9/fC/qBHQyAXhFWcomHV9oxwBGL7j7uQPNVztVtZc4+UTeIJP9nHwV1yVTKcR/SUjbGSKMoCWD2zA5pZTGyWf0naL/BKBVgV/ljJsY6OQ8j5FfrcNZYEO/rk9zcyKaFMqE/m7zQ7HJYSYEaVTiiPoCfPTdyVwgZ+CJfhKhrRoHxAyFPIKCJrGz5a4GnhY6ij/6myGNaLp6XYlY7+BW71cq0jz0o3l1sEb3Xd0Byf/ev2d7eFA13CYyiXDzA2UslC9ekARaiWMAEz5l/eFMvEjlUXfgR3p6DJrCu2y5u49sx5xQnPMd5dhoU5BMfvqLZuBrJhSPGeHVzLFp7apEBxb7sxuWEwN0ZeGJQOiDPny2SuTYatcFwUEIA9cXHbs2rgGUPRKFmkIUEzfGn5I0dZXYS2gsX0LrMMnu4jncuPir2NuVQNi6z3wNCOxc0/sA+bf6wJnuGJx8XPbUKKOOffJIiC3kgbNuBKunejyVojVKfuTQ4WCouT35cgiDLy8r30ScUPJGWUyiWRcaJFW5hdqBKtqxR45nvZsDkIXLxkRBF5Mtl+s1TGfp+p9qAJCjFiM6cqTxRS5T/cUsXWWSu9NcOS45D5tJCoqOaoO/GFF7979Lb7btnfM3tDbw4GYheuUNiqnleD47oVLeskxIMNQxSAEmFTzXttL+dJdQNaV+D5dmdRDjVShJMGSbhu9KGesFDvFqQYpX38L1RRoXS2i+UDlw2oDCHG5Huy6my8wU+W18Ko3rWm3qJVw0lBpRlxYDdTKda0pENDPOXazkjvFtFJjMuuktF0yx+0RQ/VxYdsezDszILRUE/zNg1qcYpo49NjUzST652H9pReIEUHI9KK1P0uzztWd9wGTg1Mvjs3qsZhDufPsK0+fih370YUgXJUWZ02sTQz+YHpQKCZhEPPYzAZBcRzQI+7QRCOt2PYjzEv+mq1R+xqKuuTeGsndf1JiYjWEpilmREaunJISml4KhC5ueoMAQ27ZPlrgwK5BAeXMVyqT6ESQG7xXujFTwgHrTFRczAb1GbCZggA5zVU7/kwHsA/kKPEsveym36NssfMOahW+WA8mck4xAcs0OsuUIuBOkS9zxUyyVII5tnVC+7GG3e1hQ4T8sYP3h3Iqe8xbgPuAK4rA2Llug+D0B9wo15GxQQRk2Y5c0JZIaFKuVh2JRE3YceL0ZZTcam1dcQltJSdg5OOJOxyx6d+/U4vnu2+ohEfywOd/N4UT/Ncyf3bj9YuNHzM8u6ZGQBjaek3kxtX1DP2FOFyf0HSCOVLPCKJ7J/OGHDDQl62aPu38Lm9e4I4QM3lJCdgAaCkIBOu3hSw5kMB1otIL5Le9qsbHVZgaQJckGA26wYYIj6YwWMlEP51HN2i16vXdqN+bLVLR5JkLDQ4hmrk0vxVNTc8mxw3qM1gj3xsTAXBEEjDkba1ssHPTOAhsE1NknXGWg4llCFqVi/bPB9qag0E28KZ7kTsGjrn/cNqpnf0qElb+aZJpiTcV9Cf9G+D5Za0yOPTtj6sWXmbK4qZi7ZJA0= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 91987185-6fbd-4eed-7bc5-08d9abae003c X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:26.7748 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DMJyLTzjOEW960Ysobv7tirU+AMHYR4NUjX0TOOUyotXkxGYpQnH+wwC24Tk3KvI4KN2lmmK5bFbBxe+YwGm1ZvhH3/tF2n3xO2dx+KcA60= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB5701 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Initial Felix-driver products (VSC9959 and VSC9953) both had quirks where the PCS was in charge of rate adaptation. In the case of the VSC7512 there is a differnce in that some ports (ports 0-3) don't have a PCS and others might have different quirks based on how they are configured. This adds a generic method by which any port can have any quirks that are handled by each device's driver. Signed-off-by: Colin Foster --- drivers/net/dsa/ocelot/felix.c | 20 +++++++++++++++++--- drivers/net/dsa/ocelot/felix.h | 4 ++++ drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 2a90a703162d..5be2baa83bd8 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -824,14 +824,25 @@ static void felix_phylink_mac_config(struct dsa_switch *ds, int port, phylink_set_pcs(dp->pl, &felix->pcs[port]->pcs); } +unsigned long felix_quirks_have_rate_adaptation(struct ocelot *ocelot, + int port) +{ + return FELIX_MAC_QUIRKS; +} +EXPORT_SYMBOL(felix_quirks_have_rate_adaptation); + static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, unsigned int link_an_mode, phy_interface_t interface) { struct ocelot *ocelot = ds->priv; + unsigned long quirks; + struct felix *felix; + felix = ocelot_to_felix(ocelot); + quirks = felix->info->get_quirks_for_port(ocelot, port); ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, - FELIX_MAC_QUIRKS); + quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, @@ -842,11 +853,14 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, bool tx_pause, bool rx_pause) { struct ocelot *ocelot = ds->priv; - struct felix *felix = ocelot_to_felix(ocelot); + unsigned long quirks; + struct felix *felix; + felix = ocelot_to_felix(ocelot); + quirks = felix->info->get_quirks_for_port(ocelot, port); ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, - FELIX_MAC_QUIRKS); + quirks); if (felix->info->port_sched_speed_set) felix->info->port_sched_speed_set(ocelot, port, speed); diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 515bddc012c0..251463f7e882 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -52,6 +52,7 @@ struct felix_info { u32 speed); struct regmap *(*init_regmap)(struct ocelot *ocelot, struct resource *res); + unsigned long (*get_quirks_for_port)(struct ocelot *ocelot, int port); }; extern const struct dsa_switch_ops felix_switch_ops; @@ -72,4 +73,7 @@ struct felix { struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port); int felix_netdev_to_port(struct net_device *dev); +unsigned long felix_quirks_have_rate_adaptation(struct ocelot *ocelot, + int port); + #endif diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 4ddec3325f61..7fc5cf28b7d9 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2166,6 +2166,7 @@ static const struct felix_info felix_info_vsc9959 = { .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, .init_regmap = ocelot_regmap_init, + .get_quirks_for_port = felix_quirks_have_rate_adaptation, }; static irqreturn_t felix_irq_handler(int irq, void *data) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index ce30464371e2..c996fc45dc5e 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1188,6 +1188,7 @@ static const struct felix_info seville_info_vsc9953 = { .phylink_validate = vsc9953_phylink_validate, .prevalidate_phy_mode = vsc9953_prevalidate_phy_mode, .init_regmap = ocelot_regmap_init, + .get_quirks_for_port = felix_quirks_have_rate_adaptation, }; static int seville_probe(struct platform_device *pdev) From patchwork Fri Nov 19 22:43:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629669 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6707DC4321E for ; Fri, 19 Nov 2021 22:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234848AbhKSWqj (ORCPT ); Fri, 19 Nov 2021 17:46:39 -0500 Received: from mail-co1nam11on2131.outbound.protection.outlook.com ([40.107.220.131]:57696 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234551AbhKSWqd (ORCPT ); Fri, 19 Nov 2021 17:46:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CPhTxXUbFre1IGD05VZSm60In97MP07sxLAguL02EpCtpgSvJ+x6WI+mR1Gv9r2IzBV7hWNt+2luV2PGPfwHLWZlYpruLj7krtSDuCO6EaMbHWZGmKI7fQoKfC7H5KNr+ivZ4A7SeYKKgnd4A3+aSomlq03KOVlNTT05XBPbxKyMhCuA9/5QHu/+NHCEuDu9h1i7SZOCRA59oDKg6QK/4UfqPFcbMfEVnOJez9oeNmf8jHjErA3hFAxs2XCtKJb/SBsffw5QmWPEbCInNFiOu0XTpY/TuKsp9afbUUqBYFE58iFObtXD1kKAMTgMwhR+P1aK4fVr0fucTiTecPpTXA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BFXBFtNYJkfd5krT7rEOwSFDsBXzXg+IZWfqffcQcs8=; b=kGqrQ7M4H/OqIDp3XaQmTWfNhOeqFurt0IAUGkffX8s04t2zg196fwInm/g274IHvrxMoJFfandh+YK0aYOP9lKVHjXNj8MGvYcfLa6LULvBLvuJ5TALkUzp7yk8Qm2GCU2MQwzxpYrnehORRof5FHmsNVCTBeFcriYdD/Z36wWeEdEUpqPSoy+c8VdfsbY7txW1GoDhhqOJdxUClwGvyTCV5fmac2ikEmexbSv7xMo8mner595+laL3zvmW4L5AHq/zRPEEGt1JD4p5ZNbS3ZP3sNb/LYRIwP6mNs5nNqV1f5IApcFFsyi9J39ye0qhbp4cmU4Zdnoc8QUztggJuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BFXBFtNYJkfd5krT7rEOwSFDsBXzXg+IZWfqffcQcs8=; b=iHk4UiCwjgjWsGHcWyVrhRatUucCXPSMWrN+o4JQVf2/ZW0649ww+Pl/CrwsLuqQmbggXtrkiOEaNQiDIhPRddPGGslP9ZwOAJM4PM7kUtsh7tGTFwDPlJGl/ZuRc6amNiwuuxRSz3ybKPuOLDD5zJljNdl/OQfx1LN7k6iCZsQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MWHPR1001MB2238.namprd10.prod.outlook.com (2603:10b6:301:2d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Fri, 19 Nov 2021 22:43:28 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:27 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 5/6] net: mscc: ocelot: split register definitions to a separate file Date: Fri, 19 Nov 2021 14:43:12 -0800 Message-Id: <20211119224313.2803941-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:26 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5e479c43-a59c-4ee7-278d-08d9abae0096 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2238: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:556; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: naTAceWO+nJELsitsB6kxTJ+n4xUBFwsD6JGm8U7wovLEm4uLFqQ8hAhoM84AZqVoOIzC6jNwyJrtZXjs2d7Xyj3BTkBbjmXAzWB+g+lxWjpUPBU+IigE8Gpgd44NVbhS/sRlD/r+oBHQ342kdyT0vxJ2u3shv9fo2OFFCbtEUJdQoeSmMLYcxUXw2Al60iCx2RX0+c4KXcVg76jrN6LDkl7yMSSzxfRaMB07PHyfuMvlE7S8e86QEn3OrEz75LYRY3OZ8nzNJNcRPzeZmJtXmcir0CiGKd7CUK8Yk2Q1gu9kH/LnreLeHF47Oy3I0pHD1quwBUWcRE6N6uopnd/Dl87ykmwvZB+nTvPfRxeI3qgK1P6HjT7w5LET0mydufGyQPWyEiwhjLpOI4upStEmcBR0oPwTPy+hHsZDbahUA/X+eEdaUVQ2/7/3YIx8hiW8/CayZO33EjFlN+Z6Ww4A+QRn30E861VZ6WS1OvbK/BFEyuKmEkVPtNq5je7lRV0gGgGTiOB0DlZSTAUYplVsR9lHn0SJLuXZS/yrKonx//aTsyXATrAdoBUxsiroxcZajguogeCXulvL0YU+R1PtF7MM38sZ1YDeDEuQMGXpGn5EaIeEGXUz6142aLwPacr5CbHTsz6oSuprx5e5qlBfzcVihy66ukWFDPmIefVF1P0mTdy9S9URFikv/lwYiEACTDYk4svn+LTqTySIA5RMw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(366004)(136003)(346002)(39840400004)(1076003)(86362001)(6506007)(26005)(36756003)(5660300002)(6512007)(316002)(186003)(8936002)(30864003)(52116002)(6486002)(44832011)(2906002)(54906003)(7416002)(66946007)(66556008)(66476007)(4326008)(8676002)(508600001)(956004)(6666004)(2616005)(38350700002)(38100700002)(83380400001)(579004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KYpSjVlMd4VsBBX6wMuBhIT6pr/SLLjrZccH8ZesKHjC8xmymd7BEFAxz4wC0j4cTDz5WwW1Ufbi8w71ukbF9RNcuoFKVRA/R5tX2ix+RxXsn+OaFLtGh1XFiDSEDqIQc0hEQEHWqJplm9tvTwIDGte61rU4F40aG5nAAC70RszbZzMztSf6fUpbCkvs9/XOGNZC7yh18cgTMTR8m0fADilTovy/2lS3dx71EBSAYb2/GswtFZr9leXHn1zsX2KXmuKAEf9HA46IAoNd1IdvgxgdSGIx/n43yrf56GjuybhPzxVa39GPcw4inflAQ/E6bbDf3OmG0BD5A6UzYnIqFFivZ9117Yhk9tcM+6+/344TN+i8zeWZACievAcxDUXS1g6KFq56RuTlGxqpeYf2zaJUpX6nfkDzyTtKFM4GYx2d/po3iOrisicuOw6pWjqgdxK/TneXzcCh3QYD+E0rjh+PZlM5M2XD3dEviTHyVvf8rQF03I1H+zWcHiR2BGhiEzqk48S/91Gw7kCmLh+CbNw9raGjKozX0UyI64ZqyXnDZpYdSRY5Hpm9aIBwASUea6c75Q5a8MgP2pBzF1NAR5CG00RP4La3qRV/ddjQK13H4S7Su2jjqr1ko9dFCe5dDMneA0d/WhF6zvgD0DKPCyUBDMnpJIXb5/LpfY5PXpNEVYnpuUSW1GA6cfK8dAAZEaJ+tYlrmuXRydNFI2pK4/at7ZGsxO9SdcpRBGwgpo0T5nHoPoU8xNeJTbmpkrK9QPlmRqryvoAdRPtRq1aXR9NH6h0qKZG40qcePtK5gmm/MYm0wOk21nWVMOEIqT/r8EqOdMAChSkrCP1AWYMsyUYkoY+NGwStaiYD6jxqFsPSaWnneXqucQn+aeOexMu/rw+Km1rSq0YBooP28SMRcTD6Ib+A6q8PzmBSS5TIyaoDn5ryL1UhWnLJr+gaGakugKLHW8P+jfSdGHxxf6EZFX8FpLfp0Dw8tmM03cwQ9EgswjIVd9gP+eSztl1uG8gmoo42L9japmKsllARFYhyZzEXtX2kpKazXkF6Z2djHiIACoJ9rhI+97VzQl7Q+FVhEhW2K6CLnBS/DjU4tZwUB3xhsqji4485BbtN9utaDXLThIl203deTIpE50KErWvZmZBVKvtnP5gmmk/LKsYCCs4PucLzbHcUMDZFb2yBNZ+ujh7a3cAaIOOdDet0GDoxIcBXCiwybrPUZ1eKeaPRhbQ3dxcflei7MVMQoJO0+QWZ8oedzNliwuw9mzJ1gZgWfjTMN0RcsT6HSb95mQwWfZNduH4WaRhU4aeK9UY10iQeO+KnOEacBzYp4FomNXB5TSb3ejT9/Uh8xsYhhW+nq9sCaSI2cnuAIlxLVqw1TlAa5zneAOIwqg9NMBpHRWyHxmy8x7L2z9Nx61Nuyb3eAIrd3uvpVu7A/ZC6vd+xVIXQXbLQks/kJcrbodCjVZKhR/I6BgCFOK2hwtnsl00dkDP8CuVdvUFs8X0yAoR8R2aSdM7VAMM2Uzg3+n5Qxzfx1BBUaLlGNuq6M53J3Bjz5QCG82XoR2r0ojwVLMX0fwCnugEs5k7CHAJkIwulgC2UKZbub2nxSQrPLpKpAgvA0nUfOv7NTO2DI5juYDfn/w2A+tjSfnmV7qHqE8u63XEBaRhz9ErU0Q4HECfHYuy8zNcZjrRUb371T1UYKUvy42M= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5e479c43-a59c-4ee7-278d-08d9abae0096 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:27.4004 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: jRbDPO6YM5MSgisC2hRTrF+loEBWXM9am3haopkUShgd2SRQAdBkc8P0ncw+kXLLkXtueFhOmjCSW4PpnFJLU9xWMPTUvXcto4bHUpH/tPo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2238 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Move these to a separate file will allow them to be shared to other drivers. Signed-off-by: Colin Foster Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/net/ethernet/mscc/Makefile | 3 +- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 520 +------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 522 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 27 ++ 4 files changed, 562 insertions(+), 510 deletions(-) create mode 100644 drivers/net/ethernet/mscc/vsc7514_regs.c create mode 100644 include/soc/mscc/vsc7514_regs.h diff --git a/drivers/net/ethernet/mscc/Makefile b/drivers/net/ethernet/mscc/Makefile index 722c27694b21..dfa939376d6c 100644 --- a/drivers/net/ethernet/mscc/Makefile +++ b/drivers/net/ethernet/mscc/Makefile @@ -7,7 +7,8 @@ mscc_ocelot_switch_lib-y := \ ocelot_vcap.o \ ocelot_flower.o \ ocelot_ptp.o \ - ocelot_devlink.o + ocelot_devlink.o \ + vsc7514_regs.o mscc_ocelot_switch_lib-$(CONFIG_BRIDGE_MRP) += ocelot_mrp.o obj-$(CONFIG_MSCC_OCELOT_SWITCH) += mscc_ocelot.o mscc_ocelot-y := \ diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index cd3eb101f159..2db59060f5ab 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -18,316 +18,23 @@ #include #include +#include #include "ocelot.h" #define VSC7514_VCAP_POLICER_BASE 128 #define VSC7514_VCAP_POLICER_MAX 191 -static const u32 ocelot_ana_regmap[] = { - REG(ANA_ADVLEARN, 0x009000), - REG(ANA_VLANMASK, 0x009004), - REG(ANA_PORT_B_DOMAIN, 0x009008), - REG(ANA_ANAGEFIL, 0x00900c), - REG(ANA_ANEVENTS, 0x009010), - REG(ANA_STORMLIMIT_BURST, 0x009014), - REG(ANA_STORMLIMIT_CFG, 0x009018), - REG(ANA_ISOLATED_PORTS, 0x009028), - REG(ANA_COMMUNITY_PORTS, 0x00902c), - REG(ANA_AUTOAGE, 0x009030), - REG(ANA_MACTOPTIONS, 0x009034), - REG(ANA_LEARNDISC, 0x009038), - REG(ANA_AGENCTRL, 0x00903c), - REG(ANA_MIRRORPORTS, 0x009040), - REG(ANA_EMIRRORPORTS, 0x009044), - REG(ANA_FLOODING, 0x009048), - REG(ANA_FLOODING_IPMC, 0x00904c), - REG(ANA_SFLOW_CFG, 0x009050), - REG(ANA_PORT_MODE, 0x009080), - REG(ANA_PGID_PGID, 0x008c00), - REG(ANA_TABLES_ANMOVED, 0x008b30), - REG(ANA_TABLES_MACHDATA, 0x008b34), - REG(ANA_TABLES_MACLDATA, 0x008b38), - REG(ANA_TABLES_MACACCESS, 0x008b3c), - REG(ANA_TABLES_MACTINDX, 0x008b40), - REG(ANA_TABLES_VLANACCESS, 0x008b44), - REG(ANA_TABLES_VLANTIDX, 0x008b48), - REG(ANA_TABLES_ISDXACCESS, 0x008b4c), - REG(ANA_TABLES_ISDXTIDX, 0x008b50), - REG(ANA_TABLES_ENTRYLIM, 0x008b00), - REG(ANA_TABLES_PTP_ID_HIGH, 0x008b54), - REG(ANA_TABLES_PTP_ID_LOW, 0x008b58), - REG(ANA_MSTI_STATE, 0x008e00), - REG(ANA_PORT_VLAN_CFG, 0x007000), - REG(ANA_PORT_DROP_CFG, 0x007004), - REG(ANA_PORT_QOS_CFG, 0x007008), - REG(ANA_PORT_VCAP_CFG, 0x00700c), - REG(ANA_PORT_VCAP_S1_KEY_CFG, 0x007010), - REG(ANA_PORT_VCAP_S2_CFG, 0x00701c), - REG(ANA_PORT_PCP_DEI_MAP, 0x007020), - REG(ANA_PORT_CPU_FWD_CFG, 0x007060), - REG(ANA_PORT_CPU_FWD_BPDU_CFG, 0x007064), - REG(ANA_PORT_CPU_FWD_GARP_CFG, 0x007068), - REG(ANA_PORT_CPU_FWD_CCM_CFG, 0x00706c), - REG(ANA_PORT_PORT_CFG, 0x007070), - REG(ANA_PORT_POL_CFG, 0x007074), - REG(ANA_PORT_PTP_CFG, 0x007078), - REG(ANA_PORT_PTP_DLY1_CFG, 0x00707c), - REG(ANA_OAM_UPM_LM_CNT, 0x007c00), - REG(ANA_PORT_PTP_DLY2_CFG, 0x007080), - REG(ANA_PFC_PFC_CFG, 0x008800), - REG(ANA_PFC_PFC_TIMER, 0x008804), - REG(ANA_IPT_OAM_MEP_CFG, 0x008000), - REG(ANA_IPT_IPT, 0x008004), - REG(ANA_PPT_PPT, 0x008ac0), - REG(ANA_FID_MAP_FID_MAP, 0x000000), - REG(ANA_AGGR_CFG, 0x0090b4), - REG(ANA_CPUQ_CFG, 0x0090b8), - REG(ANA_CPUQ_CFG2, 0x0090bc), - REG(ANA_CPUQ_8021_CFG, 0x0090c0), - REG(ANA_DSCP_CFG, 0x009100), - REG(ANA_DSCP_REWR_CFG, 0x009200), - REG(ANA_VCAP_RNG_TYPE_CFG, 0x009240), - REG(ANA_VCAP_RNG_VAL_CFG, 0x009260), - REG(ANA_VRAP_CFG, 0x009280), - REG(ANA_VRAP_HDR_DATA, 0x009284), - REG(ANA_VRAP_HDR_MASK, 0x009288), - REG(ANA_DISCARD_CFG, 0x00928c), - REG(ANA_FID_CFG, 0x009290), - REG(ANA_POL_PIR_CFG, 0x004000), - REG(ANA_POL_CIR_CFG, 0x004004), - REG(ANA_POL_MODE_CFG, 0x004008), - REG(ANA_POL_PIR_STATE, 0x00400c), - REG(ANA_POL_CIR_STATE, 0x004010), - REG(ANA_POL_STATE, 0x004014), - REG(ANA_POL_FLOWC, 0x008b80), - REG(ANA_POL_HYST, 0x008bec), - REG(ANA_POL_MISC_CFG, 0x008bf0), -}; - -static const u32 ocelot_qs_regmap[] = { - REG(QS_XTR_GRP_CFG, 0x000000), - REG(QS_XTR_RD, 0x000008), - REG(QS_XTR_FRM_PRUNING, 0x000010), - REG(QS_XTR_FLUSH, 0x000018), - REG(QS_XTR_DATA_PRESENT, 0x00001c), - REG(QS_XTR_CFG, 0x000020), - REG(QS_INJ_GRP_CFG, 0x000024), - REG(QS_INJ_WR, 0x00002c), - REG(QS_INJ_CTRL, 0x000034), - REG(QS_INJ_STATUS, 0x00003c), - REG(QS_INJ_ERR, 0x000040), - REG(QS_INH_DBG, 0x000048), -}; - -static const u32 ocelot_qsys_regmap[] = { - REG(QSYS_PORT_MODE, 0x011200), - REG(QSYS_SWITCH_PORT_MODE, 0x011234), - REG(QSYS_STAT_CNT_CFG, 0x011264), - REG(QSYS_EEE_CFG, 0x011268), - REG(QSYS_EEE_THRES, 0x011294), - REG(QSYS_IGR_NO_SHARING, 0x011298), - REG(QSYS_EGR_NO_SHARING, 0x01129c), - REG(QSYS_SW_STATUS, 0x0112a0), - REG(QSYS_EXT_CPU_CFG, 0x0112d0), - REG(QSYS_PAD_CFG, 0x0112d4), - REG(QSYS_CPU_GROUP_MAP, 0x0112d8), - REG(QSYS_QMAP, 0x0112dc), - REG(QSYS_ISDX_SGRP, 0x011400), - REG(QSYS_TIMED_FRAME_ENTRY, 0x014000), - REG(QSYS_TFRM_MISC, 0x011310), - REG(QSYS_TFRM_PORT_DLY, 0x011314), - REG(QSYS_TFRM_TIMER_CFG_1, 0x011318), - REG(QSYS_TFRM_TIMER_CFG_2, 0x01131c), - REG(QSYS_TFRM_TIMER_CFG_3, 0x011320), - REG(QSYS_TFRM_TIMER_CFG_4, 0x011324), - REG(QSYS_TFRM_TIMER_CFG_5, 0x011328), - REG(QSYS_TFRM_TIMER_CFG_6, 0x01132c), - REG(QSYS_TFRM_TIMER_CFG_7, 0x011330), - REG(QSYS_TFRM_TIMER_CFG_8, 0x011334), - REG(QSYS_RED_PROFILE, 0x011338), - REG(QSYS_RES_QOS_MODE, 0x011378), - REG(QSYS_RES_CFG, 0x012000), - REG(QSYS_RES_STAT, 0x012004), - REG(QSYS_EGR_DROP_MODE, 0x01137c), - REG(QSYS_EQ_CTRL, 0x011380), - REG(QSYS_EVENTS_CORE, 0x011384), - REG(QSYS_CIR_CFG, 0x000000), - REG(QSYS_EIR_CFG, 0x000004), - REG(QSYS_SE_CFG, 0x000008), - REG(QSYS_SE_DWRR_CFG, 0x00000c), - REG(QSYS_SE_CONNECT, 0x00003c), - REG(QSYS_SE_DLB_SENSE, 0x000040), - REG(QSYS_CIR_STATE, 0x000044), - REG(QSYS_EIR_STATE, 0x000048), - REG(QSYS_SE_STATE, 0x00004c), - REG(QSYS_HSCH_MISC_CFG, 0x011388), -}; - -static const u32 ocelot_rew_regmap[] = { - REG(REW_PORT_VLAN_CFG, 0x000000), - REG(REW_TAG_CFG, 0x000004), - REG(REW_PORT_CFG, 0x000008), - REG(REW_DSCP_CFG, 0x00000c), - REG(REW_PCP_DEI_QOS_MAP_CFG, 0x000010), - REG(REW_PTP_CFG, 0x000050), - REG(REW_PTP_DLY1_CFG, 0x000054), - REG(REW_DSCP_REMAP_DP1_CFG, 0x000690), - REG(REW_DSCP_REMAP_CFG, 0x000790), - REG(REW_STAT_CFG, 0x000890), - REG(REW_PPT, 0x000680), -}; - -static const u32 ocelot_sys_regmap[] = { - REG(SYS_COUNT_RX_OCTETS, 0x000000), - REG(SYS_COUNT_RX_UNICAST, 0x000004), - REG(SYS_COUNT_RX_MULTICAST, 0x000008), - REG(SYS_COUNT_RX_BROADCAST, 0x00000c), - REG(SYS_COUNT_RX_SHORTS, 0x000010), - REG(SYS_COUNT_RX_FRAGMENTS, 0x000014), - REG(SYS_COUNT_RX_JABBERS, 0x000018), - REG(SYS_COUNT_RX_CRC_ALIGN_ERRS, 0x00001c), - REG(SYS_COUNT_RX_SYM_ERRS, 0x000020), - REG(SYS_COUNT_RX_64, 0x000024), - REG(SYS_COUNT_RX_65_127, 0x000028), - REG(SYS_COUNT_RX_128_255, 0x00002c), - REG(SYS_COUNT_RX_256_1023, 0x000030), - REG(SYS_COUNT_RX_1024_1526, 0x000034), - REG(SYS_COUNT_RX_1527_MAX, 0x000038), - REG(SYS_COUNT_RX_PAUSE, 0x00003c), - REG(SYS_COUNT_RX_CONTROL, 0x000040), - REG(SYS_COUNT_RX_LONGS, 0x000044), - REG(SYS_COUNT_RX_CLASSIFIED_DROPS, 0x000048), - REG(SYS_COUNT_TX_OCTETS, 0x000100), - REG(SYS_COUNT_TX_UNICAST, 0x000104), - REG(SYS_COUNT_TX_MULTICAST, 0x000108), - REG(SYS_COUNT_TX_BROADCAST, 0x00010c), - REG(SYS_COUNT_TX_COLLISION, 0x000110), - REG(SYS_COUNT_TX_DROPS, 0x000114), - REG(SYS_COUNT_TX_PAUSE, 0x000118), - REG(SYS_COUNT_TX_64, 0x00011c), - REG(SYS_COUNT_TX_65_127, 0x000120), - REG(SYS_COUNT_TX_128_511, 0x000124), - REG(SYS_COUNT_TX_512_1023, 0x000128), - REG(SYS_COUNT_TX_1024_1526, 0x00012c), - REG(SYS_COUNT_TX_1527_MAX, 0x000130), - REG(SYS_COUNT_TX_AGING, 0x000170), - REG(SYS_RESET_CFG, 0x000508), - REG(SYS_CMID, 0x00050c), - REG(SYS_VLAN_ETYPE_CFG, 0x000510), - REG(SYS_PORT_MODE, 0x000514), - REG(SYS_FRONT_PORT_MODE, 0x000548), - REG(SYS_FRM_AGING, 0x000574), - REG(SYS_STAT_CFG, 0x000578), - REG(SYS_SW_STATUS, 0x00057c), - REG(SYS_MISC_CFG, 0x0005ac), - REG(SYS_REW_MAC_HIGH_CFG, 0x0005b0), - REG(SYS_REW_MAC_LOW_CFG, 0x0005dc), - REG(SYS_CM_ADDR, 0x000500), - REG(SYS_CM_DATA, 0x000504), - REG(SYS_PAUSE_CFG, 0x000608), - REG(SYS_PAUSE_TOT_CFG, 0x000638), - REG(SYS_ATOP, 0x00063c), - REG(SYS_ATOP_TOT_CFG, 0x00066c), - REG(SYS_MAC_FC_CFG, 0x000670), - REG(SYS_MMGT, 0x00069c), - REG(SYS_MMGT_FAST, 0x0006a0), - REG(SYS_EVENTS_DIF, 0x0006a4), - REG(SYS_EVENTS_CORE, 0x0006b4), - REG(SYS_CNT, 0x000000), - REG(SYS_PTP_STATUS, 0x0006b8), - REG(SYS_PTP_TXSTAMP, 0x0006bc), - REG(SYS_PTP_NXT, 0x0006c0), - REG(SYS_PTP_CFG, 0x0006c4), -}; - -static const u32 ocelot_vcap_regmap[] = { - /* VCAP_CORE_CFG */ - REG(VCAP_CORE_UPDATE_CTRL, 0x000000), - REG(VCAP_CORE_MV_CFG, 0x000004), - /* VCAP_CORE_CACHE */ - REG(VCAP_CACHE_ENTRY_DAT, 0x000008), - REG(VCAP_CACHE_MASK_DAT, 0x000108), - REG(VCAP_CACHE_ACTION_DAT, 0x000208), - REG(VCAP_CACHE_CNT_DAT, 0x000308), - REG(VCAP_CACHE_TG_DAT, 0x000388), - /* VCAP_CONST */ - REG(VCAP_CONST_VCAP_VER, 0x000398), - REG(VCAP_CONST_ENTRY_WIDTH, 0x00039c), - REG(VCAP_CONST_ENTRY_CNT, 0x0003a0), - REG(VCAP_CONST_ENTRY_SWCNT, 0x0003a4), - REG(VCAP_CONST_ENTRY_TG_WIDTH, 0x0003a8), - REG(VCAP_CONST_ACTION_DEF_CNT, 0x0003ac), - REG(VCAP_CONST_ACTION_WIDTH, 0x0003b0), - REG(VCAP_CONST_CNT_WIDTH, 0x0003b4), - REG(VCAP_CONST_CORE_CNT, 0x0003b8), - REG(VCAP_CONST_IF_CNT, 0x0003bc), -}; - -static const u32 ocelot_ptp_regmap[] = { - REG(PTP_PIN_CFG, 0x000000), - REG(PTP_PIN_TOD_SEC_MSB, 0x000004), - REG(PTP_PIN_TOD_SEC_LSB, 0x000008), - REG(PTP_PIN_TOD_NSEC, 0x00000c), - REG(PTP_PIN_WF_HIGH_PERIOD, 0x000014), - REG(PTP_PIN_WF_LOW_PERIOD, 0x000018), - REG(PTP_CFG_MISC, 0x0000a0), - REG(PTP_CLK_CFG_ADJ_CFG, 0x0000a4), - REG(PTP_CLK_CFG_ADJ_FREQ, 0x0000a8), -}; - -static const u32 ocelot_dev_gmii_regmap[] = { - REG(DEV_CLOCK_CFG, 0x0), - REG(DEV_PORT_MISC, 0x4), - REG(DEV_EVENTS, 0x8), - REG(DEV_EEE_CFG, 0xc), - REG(DEV_RX_PATH_DELAY, 0x10), - REG(DEV_TX_PATH_DELAY, 0x14), - REG(DEV_PTP_PREDICT_CFG, 0x18), - REG(DEV_MAC_ENA_CFG, 0x1c), - REG(DEV_MAC_MODE_CFG, 0x20), - REG(DEV_MAC_MAXLEN_CFG, 0x24), - REG(DEV_MAC_TAGS_CFG, 0x28), - REG(DEV_MAC_ADV_CHK_CFG, 0x2c), - REG(DEV_MAC_IFG_CFG, 0x30), - REG(DEV_MAC_HDX_CFG, 0x34), - REG(DEV_MAC_DBG_CFG, 0x38), - REG(DEV_MAC_FC_MAC_LOW_CFG, 0x3c), - REG(DEV_MAC_FC_MAC_HIGH_CFG, 0x40), - REG(DEV_MAC_STICKY, 0x44), - REG(PCS1G_CFG, 0x48), - REG(PCS1G_MODE_CFG, 0x4c), - REG(PCS1G_SD_CFG, 0x50), - REG(PCS1G_ANEG_CFG, 0x54), - REG(PCS1G_ANEG_NP_CFG, 0x58), - REG(PCS1G_LB_CFG, 0x5c), - REG(PCS1G_DBG_CFG, 0x60), - REG(PCS1G_CDET_CFG, 0x64), - REG(PCS1G_ANEG_STATUS, 0x68), - REG(PCS1G_ANEG_NP_STATUS, 0x6c), - REG(PCS1G_LINK_STATUS, 0x70), - REG(PCS1G_LINK_DOWN_CNT, 0x74), - REG(PCS1G_STICKY, 0x78), - REG(PCS1G_DEBUG_STATUS, 0x7c), - REG(PCS1G_LPI_CFG, 0x80), - REG(PCS1G_LPI_WAKE_ERROR_CNT, 0x84), - REG(PCS1G_LPI_STATUS, 0x88), - REG(PCS1G_TSTPAT_MODE_CFG, 0x8c), - REG(PCS1G_TSTPAT_STATUS, 0x90), - REG(DEV_PCS_FX100_CFG, 0x94), - REG(DEV_PCS_FX100_STATUS, 0x98), -}; - static const u32 *ocelot_regmap[TARGET_MAX] = { - [ANA] = ocelot_ana_regmap, - [QS] = ocelot_qs_regmap, - [QSYS] = ocelot_qsys_regmap, - [REW] = ocelot_rew_regmap, - [SYS] = ocelot_sys_regmap, - [S0] = ocelot_vcap_regmap, - [S1] = ocelot_vcap_regmap, - [S2] = ocelot_vcap_regmap, - [PTP] = ocelot_ptp_regmap, - [DEV_GMII] = ocelot_dev_gmii_regmap, + [ANA] = vsc7514_ana_regmap, + [QS] = vsc7514_qs_regmap, + [QSYS] = vsc7514_qsys_regmap, + [REW] = vsc7514_rew_regmap, + [SYS] = vsc7514_sys_regmap, + [S0] = vsc7514_vcap_regmap, + [S1] = vsc7514_vcap_regmap, + [S2] = vsc7514_vcap_regmap, + [PTP] = vsc7514_ptp_regmap, + [DEV_GMII] = vsc7514_dev_gmii_regmap, }; static const struct reg_field ocelot_regfields[REGFIELD_MAX] = { @@ -636,211 +343,6 @@ static const struct ocelot_ops ocelot_ops = { .netdev_to_port = ocelot_netdev_to_port, }; -static const struct vcap_field vsc7514_vcap_es0_keys[] = { - [VCAP_ES0_EGR_PORT] = { 0, 4}, - [VCAP_ES0_IGR_PORT] = { 4, 4}, - [VCAP_ES0_RSV] = { 8, 2}, - [VCAP_ES0_L2_MC] = { 10, 1}, - [VCAP_ES0_L2_BC] = { 11, 1}, - [VCAP_ES0_VID] = { 12, 12}, - [VCAP_ES0_DP] = { 24, 1}, - [VCAP_ES0_PCP] = { 25, 3}, -}; - -static const struct vcap_field vsc7514_vcap_es0_actions[] = { - [VCAP_ES0_ACT_PUSH_OUTER_TAG] = { 0, 2}, - [VCAP_ES0_ACT_PUSH_INNER_TAG] = { 2, 1}, - [VCAP_ES0_ACT_TAG_A_TPID_SEL] = { 3, 2}, - [VCAP_ES0_ACT_TAG_A_VID_SEL] = { 5, 1}, - [VCAP_ES0_ACT_TAG_A_PCP_SEL] = { 6, 2}, - [VCAP_ES0_ACT_TAG_A_DEI_SEL] = { 8, 2}, - [VCAP_ES0_ACT_TAG_B_TPID_SEL] = { 10, 2}, - [VCAP_ES0_ACT_TAG_B_VID_SEL] = { 12, 1}, - [VCAP_ES0_ACT_TAG_B_PCP_SEL] = { 13, 2}, - [VCAP_ES0_ACT_TAG_B_DEI_SEL] = { 15, 2}, - [VCAP_ES0_ACT_VID_A_VAL] = { 17, 12}, - [VCAP_ES0_ACT_PCP_A_VAL] = { 29, 3}, - [VCAP_ES0_ACT_DEI_A_VAL] = { 32, 1}, - [VCAP_ES0_ACT_VID_B_VAL] = { 33, 12}, - [VCAP_ES0_ACT_PCP_B_VAL] = { 45, 3}, - [VCAP_ES0_ACT_DEI_B_VAL] = { 48, 1}, - [VCAP_ES0_ACT_RSV] = { 49, 24}, - [VCAP_ES0_ACT_HIT_STICKY] = { 73, 1}, -}; - -static const struct vcap_field vsc7514_vcap_is1_keys[] = { - [VCAP_IS1_HK_TYPE] = { 0, 1}, - [VCAP_IS1_HK_LOOKUP] = { 1, 2}, - [VCAP_IS1_HK_IGR_PORT_MASK] = { 3, 12}, - [VCAP_IS1_HK_RSV] = { 15, 9}, - [VCAP_IS1_HK_OAM_Y1731] = { 24, 1}, - [VCAP_IS1_HK_L2_MC] = { 25, 1}, - [VCAP_IS1_HK_L2_BC] = { 26, 1}, - [VCAP_IS1_HK_IP_MC] = { 27, 1}, - [VCAP_IS1_HK_VLAN_TAGGED] = { 28, 1}, - [VCAP_IS1_HK_VLAN_DBL_TAGGED] = { 29, 1}, - [VCAP_IS1_HK_TPID] = { 30, 1}, - [VCAP_IS1_HK_VID] = { 31, 12}, - [VCAP_IS1_HK_DEI] = { 43, 1}, - [VCAP_IS1_HK_PCP] = { 44, 3}, - /* Specific Fields for IS1 Half Key S1_NORMAL */ - [VCAP_IS1_HK_L2_SMAC] = { 47, 48}, - [VCAP_IS1_HK_ETYPE_LEN] = { 95, 1}, - [VCAP_IS1_HK_ETYPE] = { 96, 16}, - [VCAP_IS1_HK_IP_SNAP] = {112, 1}, - [VCAP_IS1_HK_IP4] = {113, 1}, - /* Layer-3 Information */ - [VCAP_IS1_HK_L3_FRAGMENT] = {114, 1}, - [VCAP_IS1_HK_L3_FRAG_OFS_GT0] = {115, 1}, - [VCAP_IS1_HK_L3_OPTIONS] = {116, 1}, - [VCAP_IS1_HK_L3_DSCP] = {117, 6}, - [VCAP_IS1_HK_L3_IP4_SIP] = {123, 32}, - /* Layer-4 Information */ - [VCAP_IS1_HK_TCP_UDP] = {155, 1}, - [VCAP_IS1_HK_TCP] = {156, 1}, - [VCAP_IS1_HK_L4_SPORT] = {157, 16}, - [VCAP_IS1_HK_L4_RNG] = {173, 8}, - /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */ - [VCAP_IS1_HK_IP4_INNER_TPID] = { 47, 1}, - [VCAP_IS1_HK_IP4_INNER_VID] = { 48, 12}, - [VCAP_IS1_HK_IP4_INNER_DEI] = { 60, 1}, - [VCAP_IS1_HK_IP4_INNER_PCP] = { 61, 3}, - [VCAP_IS1_HK_IP4_IP4] = { 64, 1}, - [VCAP_IS1_HK_IP4_L3_FRAGMENT] = { 65, 1}, - [VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0] = { 66, 1}, - [VCAP_IS1_HK_IP4_L3_OPTIONS] = { 67, 1}, - [VCAP_IS1_HK_IP4_L3_DSCP] = { 68, 6}, - [VCAP_IS1_HK_IP4_L3_IP4_DIP] = { 74, 32}, - [VCAP_IS1_HK_IP4_L3_IP4_SIP] = {106, 32}, - [VCAP_IS1_HK_IP4_L3_PROTO] = {138, 8}, - [VCAP_IS1_HK_IP4_TCP_UDP] = {146, 1}, - [VCAP_IS1_HK_IP4_TCP] = {147, 1}, - [VCAP_IS1_HK_IP4_L4_RNG] = {148, 8}, - [VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE] = {156, 32}, -}; - -static const struct vcap_field vsc7514_vcap_is1_actions[] = { - [VCAP_IS1_ACT_DSCP_ENA] = { 0, 1}, - [VCAP_IS1_ACT_DSCP_VAL] = { 1, 6}, - [VCAP_IS1_ACT_QOS_ENA] = { 7, 1}, - [VCAP_IS1_ACT_QOS_VAL] = { 8, 3}, - [VCAP_IS1_ACT_DP_ENA] = { 11, 1}, - [VCAP_IS1_ACT_DP_VAL] = { 12, 1}, - [VCAP_IS1_ACT_PAG_OVERRIDE_MASK] = { 13, 8}, - [VCAP_IS1_ACT_PAG_VAL] = { 21, 8}, - [VCAP_IS1_ACT_RSV] = { 29, 9}, - /* The fields below are incorrectly shifted by 2 in the manual */ - [VCAP_IS1_ACT_VID_REPLACE_ENA] = { 38, 1}, - [VCAP_IS1_ACT_VID_ADD_VAL] = { 39, 12}, - [VCAP_IS1_ACT_FID_SEL] = { 51, 2}, - [VCAP_IS1_ACT_FID_VAL] = { 53, 13}, - [VCAP_IS1_ACT_PCP_DEI_ENA] = { 66, 1}, - [VCAP_IS1_ACT_PCP_VAL] = { 67, 3}, - [VCAP_IS1_ACT_DEI_VAL] = { 70, 1}, - [VCAP_IS1_ACT_VLAN_POP_CNT_ENA] = { 71, 1}, - [VCAP_IS1_ACT_VLAN_POP_CNT] = { 72, 2}, - [VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA] = { 74, 4}, - [VCAP_IS1_ACT_HIT_STICKY] = { 78, 1}, -}; - -static const struct vcap_field vsc7514_vcap_is2_keys[] = { - /* Common: 46 bits */ - [VCAP_IS2_TYPE] = { 0, 4}, - [VCAP_IS2_HK_FIRST] = { 4, 1}, - [VCAP_IS2_HK_PAG] = { 5, 8}, - [VCAP_IS2_HK_IGR_PORT_MASK] = { 13, 12}, - [VCAP_IS2_HK_RSV2] = { 25, 1}, - [VCAP_IS2_HK_HOST_MATCH] = { 26, 1}, - [VCAP_IS2_HK_L2_MC] = { 27, 1}, - [VCAP_IS2_HK_L2_BC] = { 28, 1}, - [VCAP_IS2_HK_VLAN_TAGGED] = { 29, 1}, - [VCAP_IS2_HK_VID] = { 30, 12}, - [VCAP_IS2_HK_DEI] = { 42, 1}, - [VCAP_IS2_HK_PCP] = { 43, 3}, - /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */ - [VCAP_IS2_HK_L2_DMAC] = { 46, 48}, - [VCAP_IS2_HK_L2_SMAC] = { 94, 48}, - /* MAC_ETYPE (TYPE=000) */ - [VCAP_IS2_HK_MAC_ETYPE_ETYPE] = {142, 16}, - [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0] = {158, 16}, - [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1] = {174, 8}, - [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2] = {182, 3}, - /* MAC_LLC (TYPE=001) */ - [VCAP_IS2_HK_MAC_LLC_L2_LLC] = {142, 40}, - /* MAC_SNAP (TYPE=010) */ - [VCAP_IS2_HK_MAC_SNAP_L2_SNAP] = {142, 40}, - /* MAC_ARP (TYPE=011) */ - [VCAP_IS2_HK_MAC_ARP_SMAC] = { 46, 48}, - [VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK] = { 94, 1}, - [VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK] = { 95, 1}, - [VCAP_IS2_HK_MAC_ARP_LEN_OK] = { 96, 1}, - [VCAP_IS2_HK_MAC_ARP_TARGET_MATCH] = { 97, 1}, - [VCAP_IS2_HK_MAC_ARP_SENDER_MATCH] = { 98, 1}, - [VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN] = { 99, 1}, - [VCAP_IS2_HK_MAC_ARP_OPCODE] = {100, 2}, - [VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP] = {102, 32}, - [VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP] = {134, 32}, - [VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP] = {166, 1}, - /* IP4_TCP_UDP / IP4_OTHER common */ - [VCAP_IS2_HK_IP4] = { 46, 1}, - [VCAP_IS2_HK_L3_FRAGMENT] = { 47, 1}, - [VCAP_IS2_HK_L3_FRAG_OFS_GT0] = { 48, 1}, - [VCAP_IS2_HK_L3_OPTIONS] = { 49, 1}, - [VCAP_IS2_HK_IP4_L3_TTL_GT0] = { 50, 1}, - [VCAP_IS2_HK_L3_TOS] = { 51, 8}, - [VCAP_IS2_HK_L3_IP4_DIP] = { 59, 32}, - [VCAP_IS2_HK_L3_IP4_SIP] = { 91, 32}, - [VCAP_IS2_HK_DIP_EQ_SIP] = {123, 1}, - /* IP4_TCP_UDP (TYPE=100) */ - [VCAP_IS2_HK_TCP] = {124, 1}, - [VCAP_IS2_HK_L4_DPORT] = {125, 16}, - [VCAP_IS2_HK_L4_SPORT] = {141, 16}, - [VCAP_IS2_HK_L4_RNG] = {157, 8}, - [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = {165, 1}, - [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = {166, 1}, - [VCAP_IS2_HK_L4_FIN] = {167, 1}, - [VCAP_IS2_HK_L4_SYN] = {168, 1}, - [VCAP_IS2_HK_L4_RST] = {169, 1}, - [VCAP_IS2_HK_L4_PSH] = {170, 1}, - [VCAP_IS2_HK_L4_ACK] = {171, 1}, - [VCAP_IS2_HK_L4_URG] = {172, 1}, - [VCAP_IS2_HK_L4_1588_DOM] = {173, 8}, - [VCAP_IS2_HK_L4_1588_VER] = {181, 4}, - /* IP4_OTHER (TYPE=101) */ - [VCAP_IS2_HK_IP4_L3_PROTO] = {124, 8}, - [VCAP_IS2_HK_L3_PAYLOAD] = {132, 56}, - /* IP6_STD (TYPE=110) */ - [VCAP_IS2_HK_IP6_L3_TTL_GT0] = { 46, 1}, - [VCAP_IS2_HK_L3_IP6_SIP] = { 47, 128}, - [VCAP_IS2_HK_IP6_L3_PROTO] = {175, 8}, - /* OAM (TYPE=111) */ - [VCAP_IS2_HK_OAM_MEL_FLAGS] = {142, 7}, - [VCAP_IS2_HK_OAM_VER] = {149, 5}, - [VCAP_IS2_HK_OAM_OPCODE] = {154, 8}, - [VCAP_IS2_HK_OAM_FLAGS] = {162, 8}, - [VCAP_IS2_HK_OAM_MEPID] = {170, 16}, - [VCAP_IS2_HK_OAM_CCM_CNTS_EQ0] = {186, 1}, - [VCAP_IS2_HK_OAM_IS_Y1731] = {187, 1}, -}; - -static const struct vcap_field vsc7514_vcap_is2_actions[] = { - [VCAP_IS2_ACT_HIT_ME_ONCE] = { 0, 1}, - [VCAP_IS2_ACT_CPU_COPY_ENA] = { 1, 1}, - [VCAP_IS2_ACT_CPU_QU_NUM] = { 2, 3}, - [VCAP_IS2_ACT_MASK_MODE] = { 5, 2}, - [VCAP_IS2_ACT_MIRROR_ENA] = { 7, 1}, - [VCAP_IS2_ACT_LRN_DIS] = { 8, 1}, - [VCAP_IS2_ACT_POLICE_ENA] = { 9, 1}, - [VCAP_IS2_ACT_POLICE_IDX] = { 10, 9}, - [VCAP_IS2_ACT_POLICE_VCAP_ONLY] = { 19, 1}, - [VCAP_IS2_ACT_PORT_MASK] = { 20, 11}, - [VCAP_IS2_ACT_REW_OP] = { 31, 9}, - [VCAP_IS2_ACT_SMAC_REPLACE_ENA] = { 40, 1}, - [VCAP_IS2_ACT_RSV] = { 41, 2}, - [VCAP_IS2_ACT_ACL_ID] = { 43, 6}, - [VCAP_IS2_ACT_HIT_CNT] = { 49, 32}, -}; - static struct vcap_props vsc7514_vcap_props[] = { [VCAP_ES0] = { .action_type_width = 0, diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c new file mode 100644 index 000000000000..b041756d1b78 --- /dev/null +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -0,0 +1,522 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Microsemi Ocelot Switch driver + * + * Copyright (c) 2017 Microsemi Corporation + * Copyright (c) 2021 Innovative Advantage + */ +#include +#include "ocelot.h" + +const u32 vsc7514_ana_regmap[] = { + REG(ANA_ADVLEARN, 0x009000), + REG(ANA_VLANMASK, 0x009004), + REG(ANA_PORT_B_DOMAIN, 0x009008), + REG(ANA_ANAGEFIL, 0x00900c), + REG(ANA_ANEVENTS, 0x009010), + REG(ANA_STORMLIMIT_BURST, 0x009014), + REG(ANA_STORMLIMIT_CFG, 0x009018), + REG(ANA_ISOLATED_PORTS, 0x009028), + REG(ANA_COMMUNITY_PORTS, 0x00902c), + REG(ANA_AUTOAGE, 0x009030), + REG(ANA_MACTOPTIONS, 0x009034), + REG(ANA_LEARNDISC, 0x009038), + REG(ANA_AGENCTRL, 0x00903c), + REG(ANA_MIRRORPORTS, 0x009040), + REG(ANA_EMIRRORPORTS, 0x009044), + REG(ANA_FLOODING, 0x009048), + REG(ANA_FLOODING_IPMC, 0x00904c), + REG(ANA_SFLOW_CFG, 0x009050), + REG(ANA_PORT_MODE, 0x009080), + REG(ANA_PGID_PGID, 0x008c00), + REG(ANA_TABLES_ANMOVED, 0x008b30), + REG(ANA_TABLES_MACHDATA, 0x008b34), + REG(ANA_TABLES_MACLDATA, 0x008b38), + REG(ANA_TABLES_MACACCESS, 0x008b3c), + REG(ANA_TABLES_MACTINDX, 0x008b40), + REG(ANA_TABLES_VLANACCESS, 0x008b44), + REG(ANA_TABLES_VLANTIDX, 0x008b48), + REG(ANA_TABLES_ISDXACCESS, 0x008b4c), + REG(ANA_TABLES_ISDXTIDX, 0x008b50), + REG(ANA_TABLES_ENTRYLIM, 0x008b00), + REG(ANA_TABLES_PTP_ID_HIGH, 0x008b54), + REG(ANA_TABLES_PTP_ID_LOW, 0x008b58), + REG(ANA_MSTI_STATE, 0x008e00), + REG(ANA_PORT_VLAN_CFG, 0x007000), + REG(ANA_PORT_DROP_CFG, 0x007004), + REG(ANA_PORT_QOS_CFG, 0x007008), + REG(ANA_PORT_VCAP_CFG, 0x00700c), + REG(ANA_PORT_VCAP_S1_KEY_CFG, 0x007010), + REG(ANA_PORT_VCAP_S2_CFG, 0x00701c), + REG(ANA_PORT_PCP_DEI_MAP, 0x007020), + REG(ANA_PORT_CPU_FWD_CFG, 0x007060), + REG(ANA_PORT_CPU_FWD_BPDU_CFG, 0x007064), + REG(ANA_PORT_CPU_FWD_GARP_CFG, 0x007068), + REG(ANA_PORT_CPU_FWD_CCM_CFG, 0x00706c), + REG(ANA_PORT_PORT_CFG, 0x007070), + REG(ANA_PORT_POL_CFG, 0x007074), + REG(ANA_PORT_PTP_CFG, 0x007078), + REG(ANA_PORT_PTP_DLY1_CFG, 0x00707c), + REG(ANA_OAM_UPM_LM_CNT, 0x007c00), + REG(ANA_PORT_PTP_DLY2_CFG, 0x007080), + REG(ANA_PFC_PFC_CFG, 0x008800), + REG(ANA_PFC_PFC_TIMER, 0x008804), + REG(ANA_IPT_OAM_MEP_CFG, 0x008000), + REG(ANA_IPT_IPT, 0x008004), + REG(ANA_PPT_PPT, 0x008ac0), + REG(ANA_FID_MAP_FID_MAP, 0x000000), + REG(ANA_AGGR_CFG, 0x0090b4), + REG(ANA_CPUQ_CFG, 0x0090b8), + REG(ANA_CPUQ_CFG2, 0x0090bc), + REG(ANA_CPUQ_8021_CFG, 0x0090c0), + REG(ANA_DSCP_CFG, 0x009100), + REG(ANA_DSCP_REWR_CFG, 0x009200), + REG(ANA_VCAP_RNG_TYPE_CFG, 0x009240), + REG(ANA_VCAP_RNG_VAL_CFG, 0x009260), + REG(ANA_VRAP_CFG, 0x009280), + REG(ANA_VRAP_HDR_DATA, 0x009284), + REG(ANA_VRAP_HDR_MASK, 0x009288), + REG(ANA_DISCARD_CFG, 0x00928c), + REG(ANA_FID_CFG, 0x009290), + REG(ANA_POL_PIR_CFG, 0x004000), + REG(ANA_POL_CIR_CFG, 0x004004), + REG(ANA_POL_MODE_CFG, 0x004008), + REG(ANA_POL_PIR_STATE, 0x00400c), + REG(ANA_POL_CIR_STATE, 0x004010), + REG(ANA_POL_STATE, 0x004014), + REG(ANA_POL_FLOWC, 0x008b80), + REG(ANA_POL_HYST, 0x008bec), + REG(ANA_POL_MISC_CFG, 0x008bf0), +}; +EXPORT_SYMBOL(vsc7514_ana_regmap); + +const u32 vsc7514_qs_regmap[] = { + REG(QS_XTR_GRP_CFG, 0x000000), + REG(QS_XTR_RD, 0x000008), + REG(QS_XTR_FRM_PRUNING, 0x000010), + REG(QS_XTR_FLUSH, 0x000018), + REG(QS_XTR_DATA_PRESENT, 0x00001c), + REG(QS_XTR_CFG, 0x000020), + REG(QS_INJ_GRP_CFG, 0x000024), + REG(QS_INJ_WR, 0x00002c), + REG(QS_INJ_CTRL, 0x000034), + REG(QS_INJ_STATUS, 0x00003c), + REG(QS_INJ_ERR, 0x000040), + REG(QS_INH_DBG, 0x000048), +}; +EXPORT_SYMBOL(vsc7514_qs_regmap); + +const u32 vsc7514_qsys_regmap[] = { + REG(QSYS_PORT_MODE, 0x011200), + REG(QSYS_SWITCH_PORT_MODE, 0x011234), + REG(QSYS_STAT_CNT_CFG, 0x011264), + REG(QSYS_EEE_CFG, 0x011268), + REG(QSYS_EEE_THRES, 0x011294), + REG(QSYS_IGR_NO_SHARING, 0x011298), + REG(QSYS_EGR_NO_SHARING, 0x01129c), + REG(QSYS_SW_STATUS, 0x0112a0), + REG(QSYS_EXT_CPU_CFG, 0x0112d0), + REG(QSYS_PAD_CFG, 0x0112d4), + REG(QSYS_CPU_GROUP_MAP, 0x0112d8), + REG(QSYS_QMAP, 0x0112dc), + REG(QSYS_ISDX_SGRP, 0x011400), + REG(QSYS_TIMED_FRAME_ENTRY, 0x014000), + REG(QSYS_TFRM_MISC, 0x011310), + REG(QSYS_TFRM_PORT_DLY, 0x011314), + REG(QSYS_TFRM_TIMER_CFG_1, 0x011318), + REG(QSYS_TFRM_TIMER_CFG_2, 0x01131c), + REG(QSYS_TFRM_TIMER_CFG_3, 0x011320), + REG(QSYS_TFRM_TIMER_CFG_4, 0x011324), + REG(QSYS_TFRM_TIMER_CFG_5, 0x011328), + REG(QSYS_TFRM_TIMER_CFG_6, 0x01132c), + REG(QSYS_TFRM_TIMER_CFG_7, 0x011330), + REG(QSYS_TFRM_TIMER_CFG_8, 0x011334), + REG(QSYS_RED_PROFILE, 0x011338), + REG(QSYS_RES_QOS_MODE, 0x011378), + REG(QSYS_RES_CFG, 0x012000), + REG(QSYS_RES_STAT, 0x012004), + REG(QSYS_EGR_DROP_MODE, 0x01137c), + REG(QSYS_EQ_CTRL, 0x011380), + REG(QSYS_EVENTS_CORE, 0x011384), + REG(QSYS_CIR_CFG, 0x000000), + REG(QSYS_EIR_CFG, 0x000004), + REG(QSYS_SE_CFG, 0x000008), + REG(QSYS_SE_DWRR_CFG, 0x00000c), + REG(QSYS_SE_CONNECT, 0x00003c), + REG(QSYS_SE_DLB_SENSE, 0x000040), + REG(QSYS_CIR_STATE, 0x000044), + REG(QSYS_EIR_STATE, 0x000048), + REG(QSYS_SE_STATE, 0x00004c), + REG(QSYS_HSCH_MISC_CFG, 0x011388), +}; +EXPORT_SYMBOL(vsc7514_qsys_regmap); + +const u32 vsc7514_rew_regmap[] = { + REG(REW_PORT_VLAN_CFG, 0x000000), + REG(REW_TAG_CFG, 0x000004), + REG(REW_PORT_CFG, 0x000008), + REG(REW_DSCP_CFG, 0x00000c), + REG(REW_PCP_DEI_QOS_MAP_CFG, 0x000010), + REG(REW_PTP_CFG, 0x000050), + REG(REW_PTP_DLY1_CFG, 0x000054), + REG(REW_DSCP_REMAP_DP1_CFG, 0x000690), + REG(REW_DSCP_REMAP_CFG, 0x000790), + REG(REW_STAT_CFG, 0x000890), + REG(REW_PPT, 0x000680), +}; +EXPORT_SYMBOL(vsc7514_rew_regmap); + +const u32 vsc7514_sys_regmap[] = { + REG(SYS_COUNT_RX_OCTETS, 0x000000), + REG(SYS_COUNT_RX_UNICAST, 0x000004), + REG(SYS_COUNT_RX_MULTICAST, 0x000008), + REG(SYS_COUNT_RX_BROADCAST, 0x00000c), + REG(SYS_COUNT_RX_SHORTS, 0x000010), + REG(SYS_COUNT_RX_FRAGMENTS, 0x000014), + REG(SYS_COUNT_RX_JABBERS, 0x000018), + REG(SYS_COUNT_RX_CRC_ALIGN_ERRS, 0x00001c), + REG(SYS_COUNT_RX_SYM_ERRS, 0x000020), + REG(SYS_COUNT_RX_64, 0x000024), + REG(SYS_COUNT_RX_65_127, 0x000028), + REG(SYS_COUNT_RX_128_255, 0x00002c), + REG(SYS_COUNT_RX_256_1023, 0x000030), + REG(SYS_COUNT_RX_1024_1526, 0x000034), + REG(SYS_COUNT_RX_1527_MAX, 0x000038), + REG(SYS_COUNT_RX_PAUSE, 0x00003c), + REG(SYS_COUNT_RX_CONTROL, 0x000040), + REG(SYS_COUNT_RX_LONGS, 0x000044), + REG(SYS_COUNT_RX_CLASSIFIED_DROPS, 0x000048), + REG(SYS_COUNT_TX_OCTETS, 0x000100), + REG(SYS_COUNT_TX_UNICAST, 0x000104), + REG(SYS_COUNT_TX_MULTICAST, 0x000108), + REG(SYS_COUNT_TX_BROADCAST, 0x00010c), + REG(SYS_COUNT_TX_COLLISION, 0x000110), + REG(SYS_COUNT_TX_DROPS, 0x000114), + REG(SYS_COUNT_TX_PAUSE, 0x000118), + REG(SYS_COUNT_TX_64, 0x00011c), + REG(SYS_COUNT_TX_65_127, 0x000120), + REG(SYS_COUNT_TX_128_511, 0x000124), + REG(SYS_COUNT_TX_512_1023, 0x000128), + REG(SYS_COUNT_TX_1024_1526, 0x00012c), + REG(SYS_COUNT_TX_1527_MAX, 0x000130), + REG(SYS_COUNT_TX_AGING, 0x000170), + REG(SYS_RESET_CFG, 0x000508), + REG(SYS_CMID, 0x00050c), + REG(SYS_VLAN_ETYPE_CFG, 0x000510), + REG(SYS_PORT_MODE, 0x000514), + REG(SYS_FRONT_PORT_MODE, 0x000548), + REG(SYS_FRM_AGING, 0x000574), + REG(SYS_STAT_CFG, 0x000578), + REG(SYS_SW_STATUS, 0x00057c), + REG(SYS_MISC_CFG, 0x0005ac), + REG(SYS_REW_MAC_HIGH_CFG, 0x0005b0), + REG(SYS_REW_MAC_LOW_CFG, 0x0005dc), + REG(SYS_CM_ADDR, 0x000500), + REG(SYS_CM_DATA, 0x000504), + REG(SYS_PAUSE_CFG, 0x000608), + REG(SYS_PAUSE_TOT_CFG, 0x000638), + REG(SYS_ATOP, 0x00063c), + REG(SYS_ATOP_TOT_CFG, 0x00066c), + REG(SYS_MAC_FC_CFG, 0x000670), + REG(SYS_MMGT, 0x00069c), + REG(SYS_MMGT_FAST, 0x0006a0), + REG(SYS_EVENTS_DIF, 0x0006a4), + REG(SYS_EVENTS_CORE, 0x0006b4), + REG(SYS_CNT, 0x000000), + REG(SYS_PTP_STATUS, 0x0006b8), + REG(SYS_PTP_TXSTAMP, 0x0006bc), + REG(SYS_PTP_NXT, 0x0006c0), + REG(SYS_PTP_CFG, 0x0006c4), +}; +EXPORT_SYMBOL(vsc7514_sys_regmap); + +const u32 vsc7514_vcap_regmap[] = { + /* VCAP_CORE_CFG */ + REG(VCAP_CORE_UPDATE_CTRL, 0x000000), + REG(VCAP_CORE_MV_CFG, 0x000004), + /* VCAP_CORE_CACHE */ + REG(VCAP_CACHE_ENTRY_DAT, 0x000008), + REG(VCAP_CACHE_MASK_DAT, 0x000108), + REG(VCAP_CACHE_ACTION_DAT, 0x000208), + REG(VCAP_CACHE_CNT_DAT, 0x000308), + REG(VCAP_CACHE_TG_DAT, 0x000388), + /* VCAP_CONST */ + REG(VCAP_CONST_VCAP_VER, 0x000398), + REG(VCAP_CONST_ENTRY_WIDTH, 0x00039c), + REG(VCAP_CONST_ENTRY_CNT, 0x0003a0), + REG(VCAP_CONST_ENTRY_SWCNT, 0x0003a4), + REG(VCAP_CONST_ENTRY_TG_WIDTH, 0x0003a8), + REG(VCAP_CONST_ACTION_DEF_CNT, 0x0003ac), + REG(VCAP_CONST_ACTION_WIDTH, 0x0003b0), + REG(VCAP_CONST_CNT_WIDTH, 0x0003b4), + REG(VCAP_CONST_CORE_CNT, 0x0003b8), + REG(VCAP_CONST_IF_CNT, 0x0003bc), +}; +EXPORT_SYMBOL(vsc7514_vcap_regmap); + +const u32 vsc7514_ptp_regmap[] = { + REG(PTP_PIN_CFG, 0x000000), + REG(PTP_PIN_TOD_SEC_MSB, 0x000004), + REG(PTP_PIN_TOD_SEC_LSB, 0x000008), + REG(PTP_PIN_TOD_NSEC, 0x00000c), + REG(PTP_PIN_WF_HIGH_PERIOD, 0x000014), + REG(PTP_PIN_WF_LOW_PERIOD, 0x000018), + REG(PTP_CFG_MISC, 0x0000a0), + REG(PTP_CLK_CFG_ADJ_CFG, 0x0000a4), + REG(PTP_CLK_CFG_ADJ_FREQ, 0x0000a8), +}; +EXPORT_SYMBOL(vsc7514_ptp_regmap); + +const u32 vsc7514_dev_gmii_regmap[] = { + REG(DEV_CLOCK_CFG, 0x0), + REG(DEV_PORT_MISC, 0x4), + REG(DEV_EVENTS, 0x8), + REG(DEV_EEE_CFG, 0xc), + REG(DEV_RX_PATH_DELAY, 0x10), + REG(DEV_TX_PATH_DELAY, 0x14), + REG(DEV_PTP_PREDICT_CFG, 0x18), + REG(DEV_MAC_ENA_CFG, 0x1c), + REG(DEV_MAC_MODE_CFG, 0x20), + REG(DEV_MAC_MAXLEN_CFG, 0x24), + REG(DEV_MAC_TAGS_CFG, 0x28), + REG(DEV_MAC_ADV_CHK_CFG, 0x2c), + REG(DEV_MAC_IFG_CFG, 0x30), + REG(DEV_MAC_HDX_CFG, 0x34), + REG(DEV_MAC_DBG_CFG, 0x38), + REG(DEV_MAC_FC_MAC_LOW_CFG, 0x3c), + REG(DEV_MAC_FC_MAC_HIGH_CFG, 0x40), + REG(DEV_MAC_STICKY, 0x44), + REG(PCS1G_CFG, 0x48), + REG(PCS1G_MODE_CFG, 0x4c), + REG(PCS1G_SD_CFG, 0x50), + REG(PCS1G_ANEG_CFG, 0x54), + REG(PCS1G_ANEG_NP_CFG, 0x58), + REG(PCS1G_LB_CFG, 0x5c), + REG(PCS1G_DBG_CFG, 0x60), + REG(PCS1G_CDET_CFG, 0x64), + REG(PCS1G_ANEG_STATUS, 0x68), + REG(PCS1G_ANEG_NP_STATUS, 0x6c), + REG(PCS1G_LINK_STATUS, 0x70), + REG(PCS1G_LINK_DOWN_CNT, 0x74), + REG(PCS1G_STICKY, 0x78), + REG(PCS1G_DEBUG_STATUS, 0x7c), + REG(PCS1G_LPI_CFG, 0x80), + REG(PCS1G_LPI_WAKE_ERROR_CNT, 0x84), + REG(PCS1G_LPI_STATUS, 0x88), + REG(PCS1G_TSTPAT_MODE_CFG, 0x8c), + REG(PCS1G_TSTPAT_STATUS, 0x90), + REG(DEV_PCS_FX100_CFG, 0x94), + REG(DEV_PCS_FX100_STATUS, 0x98), +}; +EXPORT_SYMBOL(vsc7514_dev_gmii_regmap); + +const struct vcap_field vsc7514_vcap_es0_keys[] = { + [VCAP_ES0_EGR_PORT] = { 0, 4 }, + [VCAP_ES0_IGR_PORT] = { 4, 4 }, + [VCAP_ES0_RSV] = { 8, 2 }, + [VCAP_ES0_L2_MC] = { 10, 1 }, + [VCAP_ES0_L2_BC] = { 11, 1 }, + [VCAP_ES0_VID] = { 12, 12 }, + [VCAP_ES0_DP] = { 24, 1 }, + [VCAP_ES0_PCP] = { 25, 3 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_es0_keys); + +const struct vcap_field vsc7514_vcap_es0_actions[] = { + [VCAP_ES0_ACT_PUSH_OUTER_TAG] = { 0, 2 }, + [VCAP_ES0_ACT_PUSH_INNER_TAG] = { 2, 1 }, + [VCAP_ES0_ACT_TAG_A_TPID_SEL] = { 3, 2 }, + [VCAP_ES0_ACT_TAG_A_VID_SEL] = { 5, 1 }, + [VCAP_ES0_ACT_TAG_A_PCP_SEL] = { 6, 2 }, + [VCAP_ES0_ACT_TAG_A_DEI_SEL] = { 8, 2 }, + [VCAP_ES0_ACT_TAG_B_TPID_SEL] = { 10, 2 }, + [VCAP_ES0_ACT_TAG_B_VID_SEL] = { 12, 1 }, + [VCAP_ES0_ACT_TAG_B_PCP_SEL] = { 13, 2 }, + [VCAP_ES0_ACT_TAG_B_DEI_SEL] = { 15, 2 }, + [VCAP_ES0_ACT_VID_A_VAL] = { 17, 12 }, + [VCAP_ES0_ACT_PCP_A_VAL] = { 29, 3 }, + [VCAP_ES0_ACT_DEI_A_VAL] = { 32, 1 }, + [VCAP_ES0_ACT_VID_B_VAL] = { 33, 12 }, + [VCAP_ES0_ACT_PCP_B_VAL] = { 45, 3 }, + [VCAP_ES0_ACT_DEI_B_VAL] = { 48, 1 }, + [VCAP_ES0_ACT_RSV] = { 49, 24 }, + [VCAP_ES0_ACT_HIT_STICKY] = { 73, 1 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_es0_actions); + +const struct vcap_field vsc7514_vcap_is1_keys[] = { + [VCAP_IS1_HK_TYPE] = { 0, 1 }, + [VCAP_IS1_HK_LOOKUP] = { 1, 2 }, + [VCAP_IS1_HK_IGR_PORT_MASK] = { 3, 12 }, + [VCAP_IS1_HK_RSV] = { 15, 9 }, + [VCAP_IS1_HK_OAM_Y1731] = { 24, 1 }, + [VCAP_IS1_HK_L2_MC] = { 25, 1 }, + [VCAP_IS1_HK_L2_BC] = { 26, 1 }, + [VCAP_IS1_HK_IP_MC] = { 27, 1 }, + [VCAP_IS1_HK_VLAN_TAGGED] = { 28, 1 }, + [VCAP_IS1_HK_VLAN_DBL_TAGGED] = { 29, 1 }, + [VCAP_IS1_HK_TPID] = { 30, 1 }, + [VCAP_IS1_HK_VID] = { 31, 12 }, + [VCAP_IS1_HK_DEI] = { 43, 1 }, + [VCAP_IS1_HK_PCP] = { 44, 3 }, + /* Specific Fields for IS1 Half Key S1_NORMAL */ + [VCAP_IS1_HK_L2_SMAC] = { 47, 48 }, + [VCAP_IS1_HK_ETYPE_LEN] = { 95, 1 }, + [VCAP_IS1_HK_ETYPE] = { 96, 16 }, + [VCAP_IS1_HK_IP_SNAP] = { 112, 1 }, + [VCAP_IS1_HK_IP4] = { 113, 1 }, + /* Layer-3 Information */ + [VCAP_IS1_HK_L3_FRAGMENT] = { 114, 1 }, + [VCAP_IS1_HK_L3_FRAG_OFS_GT0] = { 115, 1 }, + [VCAP_IS1_HK_L3_OPTIONS] = { 116, 1 }, + [VCAP_IS1_HK_L3_DSCP] = { 117, 6 }, + [VCAP_IS1_HK_L3_IP4_SIP] = { 123, 32 }, + /* Layer-4 Information */ + [VCAP_IS1_HK_TCP_UDP] = { 155, 1 }, + [VCAP_IS1_HK_TCP] = { 156, 1 }, + [VCAP_IS1_HK_L4_SPORT] = { 157, 16 }, + [VCAP_IS1_HK_L4_RNG] = { 173, 8 }, + /* Specific Fields for IS1 Half Key S1_5TUPLE_IP4 */ + [VCAP_IS1_HK_IP4_INNER_TPID] = { 47, 1 }, + [VCAP_IS1_HK_IP4_INNER_VID] = { 48, 12 }, + [VCAP_IS1_HK_IP4_INNER_DEI] = { 60, 1 }, + [VCAP_IS1_HK_IP4_INNER_PCP] = { 61, 3 }, + [VCAP_IS1_HK_IP4_IP4] = { 64, 1 }, + [VCAP_IS1_HK_IP4_L3_FRAGMENT] = { 65, 1 }, + [VCAP_IS1_HK_IP4_L3_FRAG_OFS_GT0] = { 66, 1 }, + [VCAP_IS1_HK_IP4_L3_OPTIONS] = { 67, 1 }, + [VCAP_IS1_HK_IP4_L3_DSCP] = { 68, 6 }, + [VCAP_IS1_HK_IP4_L3_IP4_DIP] = { 74, 32 }, + [VCAP_IS1_HK_IP4_L3_IP4_SIP] = { 106, 32 }, + [VCAP_IS1_HK_IP4_L3_PROTO] = { 138, 8 }, + [VCAP_IS1_HK_IP4_TCP_UDP] = { 146, 1 }, + [VCAP_IS1_HK_IP4_TCP] = { 147, 1 }, + [VCAP_IS1_HK_IP4_L4_RNG] = { 148, 8 }, + [VCAP_IS1_HK_IP4_IP_PAYLOAD_S1_5TUPLE] = { 156, 32 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is1_keys); + +const struct vcap_field vsc7514_vcap_is1_actions[] = { + [VCAP_IS1_ACT_DSCP_ENA] = { 0, 1 }, + [VCAP_IS1_ACT_DSCP_VAL] = { 1, 6 }, + [VCAP_IS1_ACT_QOS_ENA] = { 7, 1 }, + [VCAP_IS1_ACT_QOS_VAL] = { 8, 3 }, + [VCAP_IS1_ACT_DP_ENA] = { 11, 1 }, + [VCAP_IS1_ACT_DP_VAL] = { 12, 1 }, + [VCAP_IS1_ACT_PAG_OVERRIDE_MASK] = { 13, 8 }, + [VCAP_IS1_ACT_PAG_VAL] = { 21, 8 }, + [VCAP_IS1_ACT_RSV] = { 29, 9 }, + /* The fields below are incorrectly shifted by 2 in the manual */ + [VCAP_IS1_ACT_VID_REPLACE_ENA] = { 38, 1 }, + [VCAP_IS1_ACT_VID_ADD_VAL] = { 39, 12 }, + [VCAP_IS1_ACT_FID_SEL] = { 51, 2 }, + [VCAP_IS1_ACT_FID_VAL] = { 53, 13 }, + [VCAP_IS1_ACT_PCP_DEI_ENA] = { 66, 1 }, + [VCAP_IS1_ACT_PCP_VAL] = { 67, 3 }, + [VCAP_IS1_ACT_DEI_VAL] = { 70, 1 }, + [VCAP_IS1_ACT_VLAN_POP_CNT_ENA] = { 71, 1 }, + [VCAP_IS1_ACT_VLAN_POP_CNT] = { 72, 2 }, + [VCAP_IS1_ACT_CUSTOM_ACE_TYPE_ENA] = { 74, 4 }, + [VCAP_IS1_ACT_HIT_STICKY] = { 78, 1 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is1_actions); + +const struct vcap_field vsc7514_vcap_is2_keys[] = { + /* Common: 46 bits */ + [VCAP_IS2_TYPE] = { 0, 4 }, + [VCAP_IS2_HK_FIRST] = { 4, 1 }, + [VCAP_IS2_HK_PAG] = { 5, 8 }, + [VCAP_IS2_HK_IGR_PORT_MASK] = { 13, 12 }, + [VCAP_IS2_HK_RSV2] = { 25, 1 }, + [VCAP_IS2_HK_HOST_MATCH] = { 26, 1 }, + [VCAP_IS2_HK_L2_MC] = { 27, 1 }, + [VCAP_IS2_HK_L2_BC] = { 28, 1 }, + [VCAP_IS2_HK_VLAN_TAGGED] = { 29, 1 }, + [VCAP_IS2_HK_VID] = { 30, 12 }, + [VCAP_IS2_HK_DEI] = { 42, 1 }, + [VCAP_IS2_HK_PCP] = { 43, 3 }, + /* MAC_ETYPE / MAC_LLC / MAC_SNAP / OAM common */ + [VCAP_IS2_HK_L2_DMAC] = { 46, 48 }, + [VCAP_IS2_HK_L2_SMAC] = { 94, 48 }, + /* MAC_ETYPE (TYPE=000) */ + [VCAP_IS2_HK_MAC_ETYPE_ETYPE] = { 142, 16 }, + [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD0] = { 158, 16 }, + [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD1] = { 174, 8 }, + [VCAP_IS2_HK_MAC_ETYPE_L2_PAYLOAD2] = { 182, 3 }, + /* MAC_LLC (TYPE=001) */ + [VCAP_IS2_HK_MAC_LLC_L2_LLC] = { 142, 40 }, + /* MAC_SNAP (TYPE=010) */ + [VCAP_IS2_HK_MAC_SNAP_L2_SNAP] = { 142, 40 }, + /* MAC_ARP (TYPE=011) */ + [VCAP_IS2_HK_MAC_ARP_SMAC] = { 46, 48 }, + [VCAP_IS2_HK_MAC_ARP_ADDR_SPACE_OK] = { 94, 1 }, + [VCAP_IS2_HK_MAC_ARP_PROTO_SPACE_OK] = { 95, 1 }, + [VCAP_IS2_HK_MAC_ARP_LEN_OK] = { 96, 1 }, + [VCAP_IS2_HK_MAC_ARP_TARGET_MATCH] = { 97, 1 }, + [VCAP_IS2_HK_MAC_ARP_SENDER_MATCH] = { 98, 1 }, + [VCAP_IS2_HK_MAC_ARP_OPCODE_UNKNOWN] = { 99, 1 }, + [VCAP_IS2_HK_MAC_ARP_OPCODE] = { 100, 2 }, + [VCAP_IS2_HK_MAC_ARP_L3_IP4_DIP] = { 102, 32 }, + [VCAP_IS2_HK_MAC_ARP_L3_IP4_SIP] = { 134, 32 }, + [VCAP_IS2_HK_MAC_ARP_DIP_EQ_SIP] = { 166, 1 }, + /* IP4_TCP_UDP / IP4_OTHER common */ + [VCAP_IS2_HK_IP4] = { 46, 1 }, + [VCAP_IS2_HK_L3_FRAGMENT] = { 47, 1 }, + [VCAP_IS2_HK_L3_FRAG_OFS_GT0] = { 48, 1 }, + [VCAP_IS2_HK_L3_OPTIONS] = { 49, 1 }, + [VCAP_IS2_HK_IP4_L3_TTL_GT0] = { 50, 1 }, + [VCAP_IS2_HK_L3_TOS] = { 51, 8 }, + [VCAP_IS2_HK_L3_IP4_DIP] = { 59, 32 }, + [VCAP_IS2_HK_L3_IP4_SIP] = { 91, 32 }, + [VCAP_IS2_HK_DIP_EQ_SIP] = { 123, 1 }, + /* IP4_TCP_UDP (TYPE=100) */ + [VCAP_IS2_HK_TCP] = { 124, 1 }, + [VCAP_IS2_HK_L4_DPORT] = { 125, 16 }, + [VCAP_IS2_HK_L4_SPORT] = { 141, 16 }, + [VCAP_IS2_HK_L4_RNG] = { 157, 8 }, + [VCAP_IS2_HK_L4_SPORT_EQ_DPORT] = { 165, 1 }, + [VCAP_IS2_HK_L4_SEQUENCE_EQ0] = { 166, 1 }, + [VCAP_IS2_HK_L4_FIN] = { 167, 1 }, + [VCAP_IS2_HK_L4_SYN] = { 168, 1 }, + [VCAP_IS2_HK_L4_RST] = { 169, 1 }, + [VCAP_IS2_HK_L4_PSH] = { 170, 1 }, + [VCAP_IS2_HK_L4_ACK] = { 171, 1 }, + [VCAP_IS2_HK_L4_URG] = { 172, 1 }, + [VCAP_IS2_HK_L4_1588_DOM] = { 173, 8 }, + [VCAP_IS2_HK_L4_1588_VER] = { 181, 4 }, + /* IP4_OTHER (TYPE=101) */ + [VCAP_IS2_HK_IP4_L3_PROTO] = { 124, 8 }, + [VCAP_IS2_HK_L3_PAYLOAD] = { 132, 56 }, + /* IP6_STD (TYPE=110) */ + [VCAP_IS2_HK_IP6_L3_TTL_GT0] = { 46, 1 }, + [VCAP_IS2_HK_L3_IP6_SIP] = { 47, 128 }, + [VCAP_IS2_HK_IP6_L3_PROTO] = { 175, 8 }, + /* OAM (TYPE=111) */ + [VCAP_IS2_HK_OAM_MEL_FLAGS] = { 142, 7 }, + [VCAP_IS2_HK_OAM_VER] = { 149, 5 }, + [VCAP_IS2_HK_OAM_OPCODE] = { 154, 8 }, + [VCAP_IS2_HK_OAM_FLAGS] = { 162, 8 }, + [VCAP_IS2_HK_OAM_MEPID] = { 170, 16 }, + [VCAP_IS2_HK_OAM_CCM_CNTS_EQ0] = { 186, 1 }, + [VCAP_IS2_HK_OAM_IS_Y1731] = { 187, 1 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is2_keys); + +const struct vcap_field vsc7514_vcap_is2_actions[] = { + [VCAP_IS2_ACT_HIT_ME_ONCE] = { 0, 1 }, + [VCAP_IS2_ACT_CPU_COPY_ENA] = { 1, 1 }, + [VCAP_IS2_ACT_CPU_QU_NUM] = { 2, 3 }, + [VCAP_IS2_ACT_MASK_MODE] = { 5, 2 }, + [VCAP_IS2_ACT_MIRROR_ENA] = { 7, 1 }, + [VCAP_IS2_ACT_LRN_DIS] = { 8, 1 }, + [VCAP_IS2_ACT_POLICE_ENA] = { 9, 1 }, + [VCAP_IS2_ACT_POLICE_IDX] = { 10, 9 }, + [VCAP_IS2_ACT_POLICE_VCAP_ONLY] = { 19, 1 }, + [VCAP_IS2_ACT_PORT_MASK] = { 20, 11 }, + [VCAP_IS2_ACT_REW_OP] = { 31, 9 }, + [VCAP_IS2_ACT_SMAC_REPLACE_ENA] = { 40, 1 }, + [VCAP_IS2_ACT_RSV] = { 41, 2 }, + [VCAP_IS2_ACT_ACL_ID] = { 43, 6 }, + [VCAP_IS2_ACT_HIT_CNT] = { 49, 32 }, +}; +EXPORT_SYMBOL(vsc7514_vcap_is2_actions); diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h new file mode 100644 index 000000000000..c39f64079a0f --- /dev/null +++ b/include/soc/mscc/vsc7514_regs.h @@ -0,0 +1,27 @@ +/* SPDX-License-Identifier: (GPL-2.0 OR MIT) */ +/* + * Microsemi Ocelot Switch driver + * + * Copyright (c) 2021 Innovative Advantage Inc. + */ + +#ifndef VSC7514_REGS_H +#define VSC7514_REGS_H + +extern const u32 ocelot_ana_regmap[]; +extern const u32 ocelot_qs_regmap[]; +extern const u32 ocelot_qsys_regmap[]; +extern const u32 ocelot_rew_regmap[]; +extern const u32 ocelot_sys_regmap[]; +extern const u32 ocelot_vcap_regmap[]; +extern const u32 ocelot_ptp_regmap[]; +extern const u32 ocelot_dev_gmii_regmap[]; + +extern const struct vcap_field vsc7514_vcap_es0_keys[]; +extern const struct vcap_field vsc7514_vcap_es0_actions[]; +extern const struct vcap_field vsc7514_vcap_is1_keys[]; +extern const struct vcap_field vsc7514_vcap_is1_actions[]; +extern const struct vcap_field vsc7514_vcap_is2_keys[]; +extern const struct vcap_field vsc7514_vcap_is2_actions[]; + +#endif From patchwork Fri Nov 19 22:43:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12629667 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 566F0C43217 for ; Fri, 19 Nov 2021 22:43:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234916AbhKSWqk (ORCPT ); Fri, 19 Nov 2021 17:46:40 -0500 Received: from mail-co1nam11on2131.outbound.protection.outlook.com ([40.107.220.131]:57696 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234547AbhKSWqd (ORCPT ); Fri, 19 Nov 2021 17:46:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jxT/lFA77pzy9OOEorNombNyBHNYfQ/y9IaYrbnYypEUN3Ydztm8V8eCGBNPKpgptzlmjC6E09sRodaDOt1goRBK8RZK2RZHRqle6Ie2hiHe08y6gPPtlXkpV5rBv9MZi+K1X6n8bwMfYmrgK9sM75VHZjirPGedshgHb04AmwFd4yNR/O6HW0bOmfZ3CzdVhlM6WiF4wdXVgXOkv++ob2/ohkpJZ2Pam/SHm2B5/F04sLWsiQXEbbkKIneneHSPgUHAt/7mUJaYoUfcjL4+PVKxOJ8fsqvT910pdaFJqNl5HhmQotQxdt6B7Nc4t3uGwccdXaxmFHH+WkfArHTYUA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wc3Pftj2m5JDF34IXf8wyGPjfzg+HPCVHIxuG4mCnXE=; b=l4AL1Yallc1en3LtPfTAk4TKrG05MoiiLwS0VpwkcXCaILJRRhxFOFERU23lY7l4dQwl4oulMZq2eG36L3zmEarIfjb2DyO3RbsEKhuaqRa1dfUOmL4egtonxxV/jdzlI5WZx14+S67XlxVwPD1sL/OatrsyeaCVFxODmbzSXMdmkzJV1NdGZHjm6EQx4gD3V8l1bIvSml+oq2muDf2avOFhY6RiRlkIP2SVnzgRmSVUmOt7/U8qaYvOtFRjiphv+ujk4kDD+tKU+7/lQVfjmMNDogOowGZvXoNX/dq3kNKBp1ZHv8aUU/LxLU73oehy/VU399UUx8B7RpBxm9szMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=in-advantage.com; dmarc=pass action=none header.from=in-advantage.com; dkim=pass header.d=in-advantage.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inadvantage.onmicrosoft.com; s=selector2-inadvantage-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wc3Pftj2m5JDF34IXf8wyGPjfzg+HPCVHIxuG4mCnXE=; b=xvvpd4LcvPGjoHsqLC6tWuwRnup9wWnvoaOYYtiDFsNJM3AEqhPuCHy/XxI2uMTfOH198aCZFiLwNtMU4OSLSR0pZBeu5oOU8c6EiJf1OJO3sZralhGD6LkFPXbSSFgu6A0MmAw2qrUBqO0drH1ilegNHi2yyC0Vwj4teKFeLwo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by MWHPR1001MB2238.namprd10.prod.outlook.com (2603:10b6:301:2d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19; Fri, 19 Nov 2021 22:43:28 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::6430:b20:8805:cd9f%5]) with mapi id 15.20.4713.019; Fri, 19 Nov 2021 22:43:28 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , Vivien Didelot , Florian Fainelli , "David S. Miller" , Jakub Kicinski , Russell King Subject: [PATCH v1 net-next 6/6] net: mscc: ocelot: expose ocelot wm functions Date: Fri, 19 Nov 2021 14:43:13 -0800 Message-Id: <20211119224313.2803941-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211119224313.2803941-1-colin.foster@in-advantage.com> References: <20211119224313.2803941-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 Received: from localhost.localdomain (67.185.175.147) by MWHPR19CA0061.namprd19.prod.outlook.com (2603:10b6:300:94::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4713.19 via Frontend Transport; Fri, 19 Nov 2021 22:43:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a6063545-73d4-4563-b026-08d9abae00f6 X-MS-TrafficTypeDiagnostic: MWHPR1001MB2238: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: f0e5F4hMDDD0j+ocMkBgmOOU6izUsf7SGwNAcmDW/nkqSiLtrtwpo79yUM9ce2Jd8rSs8JhZhWfQs3BTD9BjvRbKp8yHJ82AIRf23+akaM5dLUpkQwscqNKakk70QdDk6ZAZ3cuDZOaMzQ0Bgtx+6OqMztYZgVVEgA/+I67o6sQ8+ltiIIpG9fSLoIpZ4BL1icp4kz3ZMyonrIGBAtREgk8wieuMaxZWV2VDbbeJ07TwwlJhbk+voZ884qZ8Cqeq1i0JL5MTq5a8OaGnfk/zK+38EC2WorlhDUueSUhnPqjSy4lQAThetPQR1AUQ+SrUDkn189eiqLxB8f9S6lJw7mrrhhogyVsR7YLpibQIovXBqf4NBLpTEZUGkRG844CYwvwpyptJCo4jqU3Eo3W4a3ha2iRw8CKjU4MfXfOPOcB1Sapg1JgOQy9HT3mlqS0N9QGYNbIRM076lti8ygSeYKnJuY8gptCBZcwtBV8EIdudRZ+8WaSoUQ0mEg8lVgUqV2xO1vPvuRtFfdtafEiGFINnVRJtMeRhgefgxK7tL/2v5rslAvOcHIW3h88mx8ke+0Jd/fD9GWxOnJlJjDyVTI/uDfGl5eCqHwxMUUJ/arS3YRW3IKCmtJtxN4Bwf41kr42zV90CUHuTnV1rT6aXTIrpAWMkQc4mq9cJTc/2pXYYLBbxrSXC6AoVI6ALAZ3m3JLhr/cyevT+IbZZjS1SAA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(396003)(376002)(366004)(136003)(346002)(39840400004)(1076003)(86362001)(6506007)(26005)(36756003)(5660300002)(6512007)(316002)(186003)(8936002)(52116002)(6486002)(44832011)(2906002)(54906003)(7416002)(66946007)(66556008)(66476007)(4326008)(8676002)(508600001)(956004)(6666004)(2616005)(38350700002)(38100700002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5gSbWUoTfdBrYr/IBJYTotrNPAWJWvQ499MOjJ5mD5jWk22IRvnnOI5XPw4GpZOgpKIsR/RKwRPfFT/puSDIHcB4VMnXeAvv2xOaKe814J7fYe3187dwPztUvYqvGhi/N2Y6RtGnJ3hPSp4UWdauLUxqrhfH8a2htjfHu0V+3g2Hx5uHaQGm+sCG+EHIui21CFsIwv7JdXu5FW2U9+Ge2l4LDbqqO15MLmH2sUnuQyJMsRFQ1gwxpfV0OS5aQlkQ9DFZcvY5K4zswbESGHTj9iJFFjrDaltGkqrLyx0XVpr/IHdf3ifWe+96VZ2gzokfEO4hJ5UW7d/SqdTjBGs70mA19y9U6nGK0fFEt/xdvJWNyi+IVfXAhkvJn1Xo2ksMErQIZ1wK7sM+cGuqkWg+8Dsq21qnnGkuDiZZtERxRDBXhyMmRG9SRpz9gyBRkGvvXCckLsVyFfYftZN7b1zmD957qOzlTszFk2r/cNdyXLhL+0MVgwO6eNeffbNFFVYucewEJqZV5RhAyBqTzWtti1RrtzN9HBCi7P5gwcloMCCVU6Q5XfeGJ2TkSpEkcYI16OI9zoliDNzo6ArTnBmJxmmnw54qAH62lBAiCljqrnaGlJTGCDX2cqRxnpwN6JMa1vAPx5uucyu5JKTD3q9Z3fc4gItK4Rg9Wpp5QW4Rrnadh8+TS5jWSNNGtlbOQcQFsbD38Fj2G0tRQ/8RoV5k17aKzpylak1jBNfO9fRNG9aq7V3WzxMtTW4gDT8yXGh633cEtg8W0G4WsukSsMvLTlw9+32M+ygHaqU3jzXQWlB8E1WAl2yTfnwjHrHhWcDmflT0iUtLXG7N+O5TZu7bv0UBuh9TxNicuaFxkS3MMpFwvqXG8TAINC0QivtFB5ePGC2usa/8C5Qf/teA060fHHe/WjuVPINomWbv0zah5gqRttQI865LKagJ2itWXJf+ze+szzfL3COhFAwOpSQ55au01zlTYV3jyA/cLhhP7s/fWh5jdpDdw2obvP46AkbxX06V3ZGkIsRq7MQMeQSqBo6p+ZU60gnpBZgBnbHxDCvBnhzhf7ZGWPkQLqoIbxe564LOFJcw72/1fQU/Pb2DPelYmTXirqq0atC5O4B4173EwTt3PQ4NXzsjmi7xv1tcCbBz0spo3RWPnGPPYy9G482djLsvPOQzj8mFyo5IKdXNAIoNaqRlqWbyoAuWB7kQIJvj3GBjyzevG3dGY+KWwfaIfJ9hXGknKfec7qmDnJuk3tTwAA5sOf6i1N0RrkLvubSz/24MH5B4LwvuKCWJE9ak+e+beel22pRO33Mux+5z8HEU0BgBSZbQP+5/zxUSLknTl9CzMx5Pcwt4cyogRWBK+TVBgoMtF9Re2VfEHB5/w0raeRqreU5zQLhTSdSXy3bIOTwR4y44XOGZdIhgVLO1F3m6roncCAYSyVqiBsGLWchq3+OWHC85OOEIE9eJMWSk/dw9PQsobeLsIoYSf1iC871u2i9yoRUEzjv0x9NLSq0jP6zG/RWNnYHoD7e0AVsTSW/2vO2xuPg+R3oGfbLFhJeybDVSfm1hLYOROvV8zwxtocFBB1jP7RTRzsYEGUHGb3SDZLEAiEsBoI075OcP6PFc2P2pOzp2dOo2hq57Yuk5a5ZSgHvKQTEXQclwFk/dHUcHu2ACI5XHaZAVvIr/OW5mifCQTbaLmPL4vyE= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: a6063545-73d4-4563-b026-08d9abae00f6 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Nov 2021 22:43:28.4738 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 48e842ca-fbd8-4633-a79d-0c955a7d3aae X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sNO/xo3Ov1DwNVydF+CB9uYbp/y63spWiSAPeGXGT+ldwGpNaIkRK1OrRoVgtnuOD/0ouYTJXm/dKoFTprzk0wkA2zCJXfHJT26PTDrGSIE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1001MB2238 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Expose ocelot_wm functions so they can be shared with other drivers. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_devlink.c | 31 ++++++++++++++++++++++ drivers/net/ethernet/mscc/ocelot_vsc7514.c | 28 ------------------- include/soc/mscc/ocelot.h | 5 ++++ 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_devlink.c b/drivers/net/ethernet/mscc/ocelot_devlink.c index b8737efd2a85..d9ea75a14f2f 100644 --- a/drivers/net/ethernet/mscc/ocelot_devlink.c +++ b/drivers/net/ethernet/mscc/ocelot_devlink.c @@ -487,6 +487,37 @@ static void ocelot_watermark_init(struct ocelot *ocelot) ocelot_setup_sharing_watermarks(ocelot); } +/* Watermark encode + * Bit 8: Unit; 0:1, 1:16 + * Bit 7-0: Value to be multiplied with unit + */ +u16 ocelot_wm_enc(u16 value) +{ + WARN_ON(value >= 16 * BIT(8)); + + if (value >= BIT(8)) + return BIT(8) | (value / 16); + + return value; +} +EXPORT_SYMBOL(ocelot_wm_enc); + +u16 ocelot_wm_dec(u16 wm) +{ + if (wm & BIT(8)) + return (wm & GENMASK(7, 0)) * 16; + + return wm; +} +EXPORT_SYMBOL(ocelot_wm_dec); + +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse) +{ + *inuse = (val & GENMASK(23, 12)) >> 12; + *maxuse = val & GENMASK(11, 0); +} +EXPORT_SYMBOL(ocelot_wm_stat); + /* Pool size and type are fixed up at runtime. Keeping this structure to * look up the cell size multipliers. */ diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 2db59060f5ab..6f2d1d58a1ed 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -306,34 +306,6 @@ static int ocelot_reset(struct ocelot *ocelot) return 0; } -/* Watermark encode - * Bit 8: Unit; 0:1, 1:16 - * Bit 7-0: Value to be multiplied with unit - */ -static u16 ocelot_wm_enc(u16 value) -{ - WARN_ON(value >= 16 * BIT(8)); - - if (value >= BIT(8)) - return BIT(8) | (value / 16); - - return value; -} - -static u16 ocelot_wm_dec(u16 wm) -{ - if (wm & BIT(8)) - return (wm & GENMASK(7, 0)) * 16; - - return wm; -} - -static void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse) -{ - *inuse = (val & GENMASK(23, 12)) >> 12; - *maxuse = val & GENMASK(11, 0); -} - static const struct ocelot_ops ocelot_ops = { .reset = ocelot_reset, .wm_enc = ocelot_wm_enc, diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 89d17629efe5..e7eb1486b63f 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -801,6 +801,11 @@ void ocelot_deinit(struct ocelot *ocelot); void ocelot_init_port(struct ocelot *ocelot, int port); void ocelot_deinit_port(struct ocelot *ocelot, int port); +/* Watermark interface */ +u16 ocelot_wm_enc(u16 value); +u16 ocelot_wm_dec(u16 wm); +void ocelot_wm_stat(u32 val, u32 *inuse, u32 *maxuse); + /* DSA callbacks */ void ocelot_get_strings(struct ocelot *ocelot, int port, u32 sset, u8 *data); void ocelot_get_ethtool_stats(struct ocelot *ocelot, int port, u64 *data);