From patchwork Fri Jan 27 19:35:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119229 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 E948EC61DA4 for ; Fri, 27 Jan 2023 19:36:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229489AbjA0TgS (ORCPT ); Fri, 27 Jan 2023 14:36:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjA0TgR (ORCPT ); Fri, 27 Jan 2023 14:36:17 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E283A783EF; Fri, 27 Jan 2023 11:36:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=luNlUY2tEc1dQCye2YuO2OcxTG5sOL3KubFMruHN+GAuknxL//HnHWpZa4/6pL3QjGfp21Sa3JFp7KlhuwNLXd84OdRTANZ6c0xRFGxjKKTxpssN8vOer/iB+aO1bgLFs4kN13M5u2jRShhNbmWop3A2duR28nFlX0r6pttTVRILrjGmHOVBM3S48xkiCwf9p5ivleN0ULIwzizjqwpe4BYVvI2fHSWhch7JnIuDfOdLo9zXMTVzxo7L50oKvC2HKt023n2TtUvkdmhXCkUqq3AfC8pVm/0kwAyXACMsX1vjXNQeJElVbq9wKeRSVsal8iG6PyIay/0XXApcHtczvg== 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=p4hbz4kp7kOrFhm91zD/Uo8d0jqjUUhJppxV1VMXjy0=; b=YI4B0FwgORDSTjSZ8750GT6xhLqDjeBZ0ihvfsGJMACjCr/cXJ7eokzfo4Mptdt9PoQWEHsWMb8MdewS2UGVuOTGkHPi+U1mEzfH5SpCS59vGo0MVhFZwTZoMLQP1A3X9QFwbQ09RnGakDRbhdL4mCZYlDWc27VooWPPd3h4VXmnoP0h2xXTYfONVkNk6vME6BuSxuyLZNg7z+sr1ascQaTH6JmkVM1LuNxKlsyPwzy/nTgppzDiDy9lGxOi8vn138/w0VP7zuVcPKNW4wRLA6pwLtRVkKdFckDMbbAFJzwCbaO7DQRqCkoUz/Pl9xelOuc+fgS5GqQsnMxv+WFlcw== 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=p4hbz4kp7kOrFhm91zD/Uo8d0jqjUUhJppxV1VMXjy0=; b=XXZgFg9NkwDi8OcMaf0qIzOGS1Nhy/VKKu+UAgV8uE7ommlgV6jdYfzfK+f9CxYJOmxaOVqXbNU93OE+Md39NihXwRSF7WgYAZZRpmeF8vG8aaeUf9GZqWuSQ5d2UMzHQ/7cWki0ZNxRPyFEYRIAxKv2mKEZgfVo7a7S6dH+3J8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:13 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:13 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 01/13] net: mscc: ocelot: expose ocelot wm functions Date: Fri, 27 Jan 2023 11:35:47 -0800 Message-Id: <20230127193559.1001051-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 9b025a91-e30a-433b-a009-08db009dbf74 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ItGWCxZZxFw7Lc6I0DCC/pm/RBaXCsxFKdZPGLvDNUOps3xGyaSepb1l6aZqaz/T6QlTi3Uis8+mPVlLaRBYYDsX76fR8ydnwD9LkuesmJxrn2tePWrDGez/ZEBwHpuVJz9TEf/fmZnduLedZzeRhISzwMrSN0By2lByFrsE975vUkUgNNtX2Ed1GXC6vICxsoY1MVnldsgHWb03AXeFcRfa6tJYr7DnNLEeZG283UPfOrweoyl77IAjlQ56qWIkYsgMANJ477fqH7ClxXZckvs+Oi+d5bNBXGJojNL694Uxo1dwLYRrEqgZnZRKpE8AS5UAlHD3N+DvKOqf5k0AEZDk2kDGnwAfVcnzN18Y89WH/XWt3jRZk7PL1Ik04O+WnfZ4ebrf0Xb1KzUh3b3JrWO74BnWaVZnEjdtIZBWhssJItHaahekuk9sOizJlv543Tb+v+NLU6o7Mo/jJLN3RVG5sRLCJaAqx1YMyo5TDc8+3M1UjoLYLc0j1Fg/pjbWLbWo8kOjjlljkjVa0DcUQ86OvEQmMZvYDMV2TvMzNAzJzBid1avQODHolQQMj8ATkd/QRFs9dyItBlxbqSnkAs3bfZJx5rhNb4K+EpnjYCJ4T4pH4wEiuQmu85CFHArSHVVBo5RncSSxKxqFwsHwRR/3+aWySywfEhe07XtRpkdZ4VyEbGkWfg4krMomgcGMPxh8PLMJ7qrstsCaHx/m9A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39830400003)(136003)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: WtB1Hy9w75+JeLPElhMPHhYR7MuY88IU3FmJQDWBGh9t00uqD3Q4svmIe9mUIPYxVKAULpewAJlBa/bP/r2IGgp6q2x2lYFbR6en2C2vrj+7B/CFFAs1U7BUg3pgKaNPbmJQeMTI6s+U5nt7F8ciU6vYXO41Vs/uo2O6AroohGLCCEkWEWqi1a1r21fiHKGlvH8y2WaiFn5dSkWrKwMI2jymQXhiTc68+OO3xinfccIZ/Ypnb5tTX2NKrF8nLTZnLYKuCZsPfmFzKUnrysnBacwVted8PnogSJktxCwVtk89BPnYX0IXxQsfQ/9DZ5ZwfyQnWpXmiW8rC8cH8FbAo43JgB3fZNrYy7w+Fqvs3CAQMLccxuBjswcDw0d7A7iBuwz8hlvs3JpBCahVjC4INB/2q9Jy29cxbDQB41VSVpkxCWazeBfkLC4Eb34ceE3Ce4HxCK+CC2YhFx48eBQoln0KrvpcsPdUOgjwO5/Ferb8YrAnJeBc8vvcx2ep7oR1oPtgdmKDfwVXc8tyOOrfTfTExrSovKmpjAc0QZCNTDThtl5sY7gPdapPR3y3keH/OnjDfByuQOiF1319ufHEFRXm6XPrXoxh9nCVHpdcjFTRprSaBzsVP+VDvXn/sXqVv3gm4tb0MVPTrMXBU6Bic8tiTn7SZ15jncDWRC9F6sUHvkIkWb7+WUJ1zj9YEwC9VcSnDsj9erW0sCZTltms+DqhJ0lNqHgsubEdnN23vAl090cmuALSdCi/Z6pgt2WYvADCsD2feFgb3nNyJkA+zG0UpFHh0LCUcH5bvBpW/sgoD59xfqDukAkbrOIVSvVVtqJOoSwwbmZQ373jaNspVSjCQhEUebNmlWMP/zdYGGcOEqNNZjw9lYF8XO5ELbv/ZgQS9QSARKfyfIhgACj4EXjN8XIl0pVtFtTJZFubbrJARalVYaDjYZNBo31wWgR4r54iNc182LUsnOSoTrlK8OuCJa5o2C/jQ8JB46nZ1XUI1OJjL/6o41vtFpQoTJwAGBq2/+gs1qzfi36MqulntovR6MziupzxUSEfgvUdwCCrTDKT7YvT/vVOjDWKu094V1zGP2KEaSbQZMMIjPKuji6U7kTWVgKX3Ro1jZEvctKqEa05bJEnYstgAqIazL6eBFI5vJB37jXxSfWnndrwDDzhOJdt3ZtVpqrjwKTXzlXCBrudZsfkKomxFyrcxn9KhrQquNrSI/O86T/kfijp7AocivR0mjdizcFoIfoonPjHMiOeTIaQ0MjOhM7D84CEBSbQv0H9DzNM6NMeNV9CeJq+ozJsAT955UlFlLBZ4b3BdrGotmYjTU3EcQkRHZ/+zQTREnrDsZG41S3jKd1V3iIpuveYT3dGupVnKeCwBCknY/hY/BFsgc4Zn3naEJzmHSdxF7jh8Chs1DbyGAxV5V4ySCE7mKzbBpLfIyjFCMj3KhWzWjyPkZ8pfa6Wz8HhhYqrraW+iWADrGvUIDPOXDhvKBskCtdDgUFGrLJ7CyIcmLxK1ZuokMOcaK6s1h7Jlg/qppUHLhYgmtelFUKq5hmn1b0F56GbCP7L0vCnqDuvZPamXTTs1CBYQKe8lCl8PmJrBEbou0ywez+4in/UrlPH1ES4KouazwpAqnh/2Fc= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9b025a91-e30a-433b-a009-08db009dbf74 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:12.7513 (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: 1h1UH5Nrl4w61PftJQYjVZUnOpNO3QeIeRPFQNi8a0Ku6XyROw70OF1BxRHJpMFFosSNEhnnoDMI81h04X4tIyQDsCN1U/vMw0fnZn3/0u8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 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 Reviewed-by: Florian Fainelli --- v1 - v5: * No changes since previous RFC --- 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 b097fd4a4061..a3a36de063e5 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -229,34 +229,6 @@ static int ocelot_reset(struct ocelot *ocelot) return regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); } -/* 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 afb11680a793..0edb16b6087f 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -978,6 +978,11 @@ void ocelot_port_assign_dsa_8021q_cpu(struct ocelot *ocelot, int port, int cpu); void ocelot_port_unassign_dsa_8021q_cpu(struct ocelot *ocelot, int port); u32 ocelot_port_assigned_dsa_8021q_cpu_mask(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); From patchwork Fri Jan 27 19:35:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119230 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 4506EC636BD for ; Fri, 27 Jan 2023 19:36:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbjA0TgT (ORCPT ); Fri, 27 Jan 2023 14:36:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjA0TgS (ORCPT ); Fri, 27 Jan 2023 14:36:18 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D26E783DD; Fri, 27 Jan 2023 11:36:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWjwLvWZk+Ly4TdPJEiTDZzN35ySuOk86FX4t9FNf8UclslsO+GAMOL4hyEq2O4aFRNUsk25EK1/lm45UKyeX9pEgZ5h4cV6Dn01RMruTM8XwUPRBYAFl6GtDxiJVQ+pAOFpL3N4iByuwd6d0d9Z0Rwmfkqr/3Je99SDSqKrPV4DqtoPIYTa1l4i7OYXzEnj2y5A6BjALwMbhuFC8QjxNPKNcwSHpglBtt89SqjUBylg252Ruo6D20w2zc/h0dosRvNKZhJsnUYORpSnR8iftHMTnrcSVEkEmQV5Kps2HRPP71cwXavZTuHxBDDE7SR2NF2vhmRHB2/GED+yLAd6ng== 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=cU6nIUIuEjZxvl9R5odCbzJR9GewRQG2fqpLIJ2BYmY=; b=J8o7ytzMG5M7ku5JDbwSmF0M2khkoBUehnLkP8nVPXNSUds6RmTFGe5VXVqVVsjcIM8xx9s+m53m9kyqIeq2CN972shA3KTRyFtsP6JvP7ekBE7FEJs8BQsmOlSeo6xJKtKvXCKlFMX5AU9QC+e1C8mFTvaSLwohR5fUwfz4XBOrBZDDIu5NnMWWI1EAF2wie/0RMfr+Kb1/GelRsQL745zeSjiW8I2OqLXDw3KMusK0mZ3kv531x/8MHBDOD5SwOV580IUjoQ2uI0572l1ow9z4eEVgS4orWjm1ECD1/mwYVP+cS6StiNtd9AtLcU07gDoe/L5iQAqbg6MxUF/8Lg== 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=cU6nIUIuEjZxvl9R5odCbzJR9GewRQG2fqpLIJ2BYmY=; b=CSTde6q5QnbiBVXSIM3gw+3e2swAX+7NtcsJMFY2Di1H/tLDIkFmSAGqoPsYvpFUjahrjX+7K4l0ERioPx4bGF2Tk+XOqNEN5M+7O0Jsau8U4wpZxDBOSbC+omEcRDloNHCN9DA86sAAVKQKRewUPHfAvSI31PCP5pQv7MoYnBI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:14 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:14 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 02/13] net: mscc: ocelot: expose regfield definition to be used by other drivers Date: Fri, 27 Jan 2023 11:35:48 -0800 Message-Id: <20230127193559.1001051-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: c6efaa92-6aad-4ef8-40e2-08db009dc07d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c3SAg12hzejdtBaOTClSvSzrBeNtotKChj6PoIGieme6/Mo4KR9oRCya88V/xwgDRPXnqQDVFOocmOIJ/64IkWN5L4xUOLj/PPRf6VAHJneXeKMMN7g+vkH3r6kDPO8MbfPHg9KPc469aG+6QNm+2LT5QVFPTGOsNyjBXESdvQARCGFYAo9yf4chQt45jabA4oWGCJPpF8IADa9GKlSzropTGBl8LYhmH0R8Kr4wLuQon1k0WCkJmQ8MetQORepaDAWJ7pt2rq9JHMe0c3k62OWtJOtlLQvhhWI5mXk1eJgXW3kIcU15eJwQ3UrYu/IMBp1cLgkqZcZi2vPUESC2VRsPktrMJQuQAwhrZv2hUHLk/1kI9yr7j8S0Kvvdmq0+4ZfhUiYb0rqhPByKi45YM++cUOmozH6MLhFeWVhlPXl2FxH5tNXnq/Q4ubl/iJQcqGa7DnSNlcxEMSU8Pmv3JJeb4z3ZyAb2AvAgW6zRvqZVv9fB0qLds6kgLFFZbCEp9iVwgpNSJvAh+11IN252AH+T7FPcvddDEeLtVVXmW9aDj+RJkdYtvd2vugW2amKPGVwR7/lER5YyT5yxUAfYutu37yx4jCwg1VHy/dUvbisfbhVw4Oijugaq9UvaCCBcFAGAHxCw8FDaM8qHw6Evh5dJahndcXAyQJaBtv5P/u4gWmh+5GaEVfATdcisAZCGVG87fbomLslz7Gu4Cv1OyA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39830400003)(136003)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(30864003)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +jJ733/tV07NOoWASaRuph2fTCwCVLkan6UwxzZdEsJjRWdjLMwrsScFk8Y/wJUqUulIBpvb5iStnZqLcO7AR7MvjCkSmMXnnGh2MBoLytS/FhIuighWGcAiVM4UMOi2YmpCIOCcorpdY3ZgA7nvnRVMVpaHe6oCG6r6S/2BF4IH2wtDnxnLuRkk0k72kvqHRCGqmcpNIlQy7kS7HC+iyCgsMJ4+lKGDYrcNIemsdkK4jRFQtoIHE89DZ+n3iaLhDuK51ULkFFx/mR3zNK8iEpousKxItZpX1urgIjxj4jgPqQP6bLk0utnxpXUNLInUOZ7sseHy2MsBk/LY0PbFXIqnJkjc1wvR5W87PMpEKF2D9JoohJYxgG1UaOvaH5Wy03vKsiNc1cmgYqh2C9xILigjxn2o0o5FGaUooCZhL/0WvbvGPiSGNCnr+w15564Ao81JZyQEuzfQIZNZwBrk3PsyCAQv1xgxvNU5IeeJbkhsQ6t5Od/sQBLkclBPLUTeG0d0Z9uWWasgZc6/ByQiKWw6CoIkOytBOSyN3Bg+awH8orWaKz3EAIf+eefaSJswXYPCR4sAkf6Y0mZR9aj/P9EkDPU+2aOVfk5oOCe0gErex7Uua1wD9UPEEzZmxkWcfIBBBFsf53XGP4hSqh0BiH8YwjmJLj8McmGyr6eIbex+wzObWY17DrcgZIM1mMEz9fEytkRiPKUJyEvIPVWEMOWgOPCkjeowmNxDaIC1PQd88TPvIRvHDVQTIbynt+XehGusG3k8JKiSweHZ+uw8qADvDdmE4W2Ekfhe7uxVne4Ip2TfY4ELKhv1AHa/vOPHai681tMjh/S3koMnxyY8ITX7WUyWUYCHxu7GOqtA9OMHvzQg7n0qiqsMumJu3SprhurQbT9I5Ny5cp2Maiqwe2rlljysSJIck0FAPWCAL3Uju7SrImC2YhDiLnjXRX5/pWKpt2tBF6TNxa/NOlk5diVA4FeHhLflUcHnLZNR7MYVHio+eyZJDa0p3+XbdeHq80gfIRcyfUmJLQnU5fDvwGscvwuXPFh9ineHoUrWHvz3TyDc5DJBt/1hzeMrt7P+WrxUPeZKChe1/wWq1xjZxG1oYYcCScXQfdUJLPfwrVHTik30driVuTRVXcrlPpPYL7c78jOP53Z8IBwzYhvhGFUKvNwM6FozbO3Z91XMJRfVNpZA7RzcYhEim0Qx7N464/xXUFsRc+8USda/i/+Grc1qMALzJZTvjEBFe/1vghT5XB6/Stju+jotxUGdxeBle1Xc6Y9OiU7rVyIcX1LMmKhxM/QoU6AQzOzKPM5ZQcdNe77Lz6fI3YQTSkNr+eVAWXp/ERConzDDKrI5A7TGpEBWAJ4fxvELkUS0hBvo4rY7B58TPmUDYjcvhOfJl+d7tdJa/Z6F7E4HT/4D9EeKn6/lCTB651pjMfAEuMQ1X8jXYCVlhl6BuFqHfMASWrpECyS5+yzKvZGqvKjfl98UlSwo0jTzyqi9CO7pBRGbEMTpvFj9x8Ijk4FLd2gjNw7LUBj4MPBjY43DiKm9eSxrTSSXiORU5ZTSX8Pnb/Yqgh20NA5SFeyAPwnsMt+zur92mjGmIctc5WJ2VpXR5K/SASkMA5lC/F53I6rTyPhxGCo= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6efaa92-6aad-4ef8-40e2-08db009dc07d X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:14.4075 (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: zcYgJZoHdJmVOmB5RXawlkVgen725TAkGiOCIno2jhzOCAN9NJ5om9XdbGpnEp3lzH+f52ZWIgNQDVJLzox8kI3v8E9fk8mTI+UAic2MWiI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The ocelot_regfields struct is common between several different chips, some of which can only be controlled externally. Export this structure so it doesn't have to be duplicated in these other drivers. Rename the structure as well, to follow the conventions of other shared resources. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- v3-v5 * No changes v2 * Add Reviewed tag v1 from previous RFC: * Remove GCB_SOFT_RST_SWC_RST entry from the regfields struct - it isn't used. * Export the vsc7514_regfields symbol so it can be used as a module. --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 60 +--------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 59 +++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 + 3 files changed, 62 insertions(+), 59 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index a3a36de063e5..8a90b5e8c8fa 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -42,64 +42,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = { [DEV_GMII] = vsc7514_dev_gmii_regmap, }; -static const struct reg_field ocelot_regfields[REGFIELD_MAX] = { - [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), - [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), - [ANA_ANEVENTS_MSTI_DROP] = REG_FIELD(ANA_ANEVENTS, 27, 27), - [ANA_ANEVENTS_ACLKILL] = REG_FIELD(ANA_ANEVENTS, 26, 26), - [ANA_ANEVENTS_ACLUSED] = REG_FIELD(ANA_ANEVENTS, 25, 25), - [ANA_ANEVENTS_AUTOAGE] = REG_FIELD(ANA_ANEVENTS, 24, 24), - [ANA_ANEVENTS_VS2TTL1] = REG_FIELD(ANA_ANEVENTS, 23, 23), - [ANA_ANEVENTS_STORM_DROP] = REG_FIELD(ANA_ANEVENTS, 22, 22), - [ANA_ANEVENTS_LEARN_DROP] = REG_FIELD(ANA_ANEVENTS, 21, 21), - [ANA_ANEVENTS_AGED_ENTRY] = REG_FIELD(ANA_ANEVENTS, 20, 20), - [ANA_ANEVENTS_CPU_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 19, 19), - [ANA_ANEVENTS_AUTO_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 18, 18), - [ANA_ANEVENTS_LEARN_REMOVE] = REG_FIELD(ANA_ANEVENTS, 17, 17), - [ANA_ANEVENTS_AUTO_LEARNED] = REG_FIELD(ANA_ANEVENTS, 16, 16), - [ANA_ANEVENTS_AUTO_MOVED] = REG_FIELD(ANA_ANEVENTS, 15, 15), - [ANA_ANEVENTS_DROPPED] = REG_FIELD(ANA_ANEVENTS, 14, 14), - [ANA_ANEVENTS_CLASSIFIED_DROP] = REG_FIELD(ANA_ANEVENTS, 13, 13), - [ANA_ANEVENTS_CLASSIFIED_COPY] = REG_FIELD(ANA_ANEVENTS, 12, 12), - [ANA_ANEVENTS_VLAN_DISCARD] = REG_FIELD(ANA_ANEVENTS, 11, 11), - [ANA_ANEVENTS_FWD_DISCARD] = REG_FIELD(ANA_ANEVENTS, 10, 10), - [ANA_ANEVENTS_MULTICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 9, 9), - [ANA_ANEVENTS_UNICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 8, 8), - [ANA_ANEVENTS_DEST_KNOWN] = REG_FIELD(ANA_ANEVENTS, 7, 7), - [ANA_ANEVENTS_BUCKET3_MATCH] = REG_FIELD(ANA_ANEVENTS, 6, 6), - [ANA_ANEVENTS_BUCKET2_MATCH] = REG_FIELD(ANA_ANEVENTS, 5, 5), - [ANA_ANEVENTS_BUCKET1_MATCH] = REG_FIELD(ANA_ANEVENTS, 4, 4), - [ANA_ANEVENTS_BUCKET0_MATCH] = REG_FIELD(ANA_ANEVENTS, 3, 3), - [ANA_ANEVENTS_CPU_OPERATION] = REG_FIELD(ANA_ANEVENTS, 2, 2), - [ANA_ANEVENTS_DMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 1, 1), - [ANA_ANEVENTS_SMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 0, 0), - [ANA_TABLES_MACACCESS_B_DOM] = REG_FIELD(ANA_TABLES_MACACCESS, 18, 18), - [ANA_TABLES_MACTINDX_BUCKET] = REG_FIELD(ANA_TABLES_MACTINDX, 10, 11), - [ANA_TABLES_MACTINDX_M_INDEX] = REG_FIELD(ANA_TABLES_MACTINDX, 0, 9), - [QSYS_TIMED_FRAME_ENTRY_TFRM_VLD] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 20, 20), - [QSYS_TIMED_FRAME_ENTRY_TFRM_FP] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 8, 19), - [QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 4, 7), - [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 1, 3), - [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 0, 0), - [SYS_RESET_CFG_CORE_ENA] = REG_FIELD(SYS_RESET_CFG, 2, 2), - [SYS_RESET_CFG_MEM_ENA] = REG_FIELD(SYS_RESET_CFG, 1, 1), - [SYS_RESET_CFG_MEM_INIT] = REG_FIELD(SYS_RESET_CFG, 0, 0), - /* Replicated per number of ports (12), register size 4 per port */ - [QSYS_SWITCH_PORT_MODE_PORT_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 14, 14, 12, 4), - [QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 11, 13, 12, 4), - [QSYS_SWITCH_PORT_MODE_YEL_RSRVD] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 10, 10, 12, 4), - [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 9, 9, 12, 4), - [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 1, 8, 12, 4), - [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 0, 0, 12, 4), - [SYS_PORT_MODE_DATA_WO_TS] = REG_FIELD_ID(SYS_PORT_MODE, 5, 6, 12, 4), - [SYS_PORT_MODE_INCL_INJ_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 3, 4, 12, 4), - [SYS_PORT_MODE_INCL_XTR_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 1, 2, 12, 4), - [SYS_PORT_MODE_INCL_HDR_ERR] = REG_FIELD_ID(SYS_PORT_MODE, 0, 0, 12, 4), - [SYS_PAUSE_CFG_PAUSE_START] = REG_FIELD_ID(SYS_PAUSE_CFG, 10, 18, 12, 4), - [SYS_PAUSE_CFG_PAUSE_STOP] = REG_FIELD_ID(SYS_PAUSE_CFG, 1, 9, 12, 4), - [SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 12, 4), -}; - static void ocelot_pll5_init(struct ocelot *ocelot) { /* Configure PLL5. This will need a proper CCF driver @@ -137,7 +79,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) ocelot->num_mact_rows = 1024; ocelot->ops = ops; - ret = ocelot_regfields_init(ocelot, ocelot_regfields); + ret = ocelot_regfields_init(ocelot, vsc7514_regfields); if (ret) return ret; diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index 9d2d3e13cacf..123175618251 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -9,6 +9,65 @@ #include #include "ocelot.h" +const struct reg_field vsc7514_regfields[REGFIELD_MAX] = { + [ANA_ADVLEARN_VLAN_CHK] = REG_FIELD(ANA_ADVLEARN, 11, 11), + [ANA_ADVLEARN_LEARN_MIRROR] = REG_FIELD(ANA_ADVLEARN, 0, 10), + [ANA_ANEVENTS_MSTI_DROP] = REG_FIELD(ANA_ANEVENTS, 27, 27), + [ANA_ANEVENTS_ACLKILL] = REG_FIELD(ANA_ANEVENTS, 26, 26), + [ANA_ANEVENTS_ACLUSED] = REG_FIELD(ANA_ANEVENTS, 25, 25), + [ANA_ANEVENTS_AUTOAGE] = REG_FIELD(ANA_ANEVENTS, 24, 24), + [ANA_ANEVENTS_VS2TTL1] = REG_FIELD(ANA_ANEVENTS, 23, 23), + [ANA_ANEVENTS_STORM_DROP] = REG_FIELD(ANA_ANEVENTS, 22, 22), + [ANA_ANEVENTS_LEARN_DROP] = REG_FIELD(ANA_ANEVENTS, 21, 21), + [ANA_ANEVENTS_AGED_ENTRY] = REG_FIELD(ANA_ANEVENTS, 20, 20), + [ANA_ANEVENTS_CPU_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 19, 19), + [ANA_ANEVENTS_AUTO_LEARN_FAILED] = REG_FIELD(ANA_ANEVENTS, 18, 18), + [ANA_ANEVENTS_LEARN_REMOVE] = REG_FIELD(ANA_ANEVENTS, 17, 17), + [ANA_ANEVENTS_AUTO_LEARNED] = REG_FIELD(ANA_ANEVENTS, 16, 16), + [ANA_ANEVENTS_AUTO_MOVED] = REG_FIELD(ANA_ANEVENTS, 15, 15), + [ANA_ANEVENTS_DROPPED] = REG_FIELD(ANA_ANEVENTS, 14, 14), + [ANA_ANEVENTS_CLASSIFIED_DROP] = REG_FIELD(ANA_ANEVENTS, 13, 13), + [ANA_ANEVENTS_CLASSIFIED_COPY] = REG_FIELD(ANA_ANEVENTS, 12, 12), + [ANA_ANEVENTS_VLAN_DISCARD] = REG_FIELD(ANA_ANEVENTS, 11, 11), + [ANA_ANEVENTS_FWD_DISCARD] = REG_FIELD(ANA_ANEVENTS, 10, 10), + [ANA_ANEVENTS_MULTICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 9, 9), + [ANA_ANEVENTS_UNICAST_FLOOD] = REG_FIELD(ANA_ANEVENTS, 8, 8), + [ANA_ANEVENTS_DEST_KNOWN] = REG_FIELD(ANA_ANEVENTS, 7, 7), + [ANA_ANEVENTS_BUCKET3_MATCH] = REG_FIELD(ANA_ANEVENTS, 6, 6), + [ANA_ANEVENTS_BUCKET2_MATCH] = REG_FIELD(ANA_ANEVENTS, 5, 5), + [ANA_ANEVENTS_BUCKET1_MATCH] = REG_FIELD(ANA_ANEVENTS, 4, 4), + [ANA_ANEVENTS_BUCKET0_MATCH] = REG_FIELD(ANA_ANEVENTS, 3, 3), + [ANA_ANEVENTS_CPU_OPERATION] = REG_FIELD(ANA_ANEVENTS, 2, 2), + [ANA_ANEVENTS_DMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 1, 1), + [ANA_ANEVENTS_SMAC_LOOKUP] = REG_FIELD(ANA_ANEVENTS, 0, 0), + [ANA_TABLES_MACACCESS_B_DOM] = REG_FIELD(ANA_TABLES_MACACCESS, 18, 18), + [ANA_TABLES_MACTINDX_BUCKET] = REG_FIELD(ANA_TABLES_MACTINDX, 10, 11), + [ANA_TABLES_MACTINDX_M_INDEX] = REG_FIELD(ANA_TABLES_MACTINDX, 0, 9), + [QSYS_TIMED_FRAME_ENTRY_TFRM_VLD] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 20, 20), + [QSYS_TIMED_FRAME_ENTRY_TFRM_FP] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 8, 19), + [QSYS_TIMED_FRAME_ENTRY_TFRM_PORTNO] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 4, 7), + [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_SEL] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 1, 3), + [QSYS_TIMED_FRAME_ENTRY_TFRM_TM_T] = REG_FIELD(QSYS_TIMED_FRAME_ENTRY, 0, 0), + [SYS_RESET_CFG_CORE_ENA] = REG_FIELD(SYS_RESET_CFG, 2, 2), + [SYS_RESET_CFG_MEM_ENA] = REG_FIELD(SYS_RESET_CFG, 1, 1), + [SYS_RESET_CFG_MEM_INIT] = REG_FIELD(SYS_RESET_CFG, 0, 0), + /* Replicated per number of ports (12), register size 4 per port */ + [QSYS_SWITCH_PORT_MODE_PORT_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 14, 14, 12, 4), + [QSYS_SWITCH_PORT_MODE_SCH_NEXT_CFG] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 11, 13, 12, 4), + [QSYS_SWITCH_PORT_MODE_YEL_RSRVD] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 10, 10, 12, 4), + [QSYS_SWITCH_PORT_MODE_INGRESS_DROP_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 9, 9, 12, 4), + [QSYS_SWITCH_PORT_MODE_TX_PFC_ENA] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 1, 8, 12, 4), + [QSYS_SWITCH_PORT_MODE_TX_PFC_MODE] = REG_FIELD_ID(QSYS_SWITCH_PORT_MODE, 0, 0, 12, 4), + [SYS_PORT_MODE_DATA_WO_TS] = REG_FIELD_ID(SYS_PORT_MODE, 5, 6, 12, 4), + [SYS_PORT_MODE_INCL_INJ_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 3, 4, 12, 4), + [SYS_PORT_MODE_INCL_XTR_HDR] = REG_FIELD_ID(SYS_PORT_MODE, 1, 2, 12, 4), + [SYS_PORT_MODE_INCL_HDR_ERR] = REG_FIELD_ID(SYS_PORT_MODE, 0, 0, 12, 4), + [SYS_PAUSE_CFG_PAUSE_START] = REG_FIELD_ID(SYS_PAUSE_CFG, 10, 18, 12, 4), + [SYS_PAUSE_CFG_PAUSE_STOP] = REG_FIELD_ID(SYS_PAUSE_CFG, 1, 9, 12, 4), + [SYS_PAUSE_CFG_PAUSE_ENA] = REG_FIELD_ID(SYS_PAUSE_CFG, 0, 1, 12, 4), +}; +EXPORT_SYMBOL(vsc7514_regfields); + const u32 vsc7514_ana_regmap[] = { REG(ANA_ADVLEARN, 0x009000), REG(ANA_VLANMASK, 0x009004), diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index ceee26c96959..9b40e7d00ec5 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -10,6 +10,8 @@ #include +extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; + extern const u32 vsc7514_ana_regmap[]; extern const u32 vsc7514_qs_regmap[]; extern const u32 vsc7514_qsys_regmap[]; From patchwork Fri Jan 27 19:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119232 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 A84C2C38142 for ; Fri, 27 Jan 2023 19:36:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229542AbjA0Tgf (ORCPT ); Fri, 27 Jan 2023 14:36:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjA0TgU (ORCPT ); Fri, 27 Jan 2023 14:36:20 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8929F7909B; Fri, 27 Jan 2023 11:36:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X3hnszXQPeBvqbHjAwNyZRcl/lJvO0C2DYr07KJduaT0/vBEWBhd3cLASFEEDROW17tAcW55BgoopAsqGRBuTp/P56wUKlD8RAglaRV5ciAXiHPEFmBpl/Nmn1sWYk6tSFekDHYE1oHNYGpyJhwbZcj+XL4g3IcJOB8Jd5drWSfBPnzuwszxsGRiQiz1raSBrrSD5+hU94gRu2FnZZfIdkLF9+IpfBEfxCTzq1zSiXKjQ38iQy7s3+vmOs8oQKHrQtDj5Kl9/PWEXp4+BEd1omNRf1Byi+htYejDVLVuJMyt7Yq1eO7YQmGHsyVcQXoumjkjij2ozStvW3H5H6PKjw== 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=CgF4meZtVzUEh61zhvnHHXuN62U5ooTTV9C+9aRwJO8=; b=dRCRP1KRyOabrErjK2wBhgXiyW4IE6S4C67PCYtP0maFjT/TNfTTGalS8DWaIY+XkPuUX1iuNZBGpmV7/9NCe3AJzynWdp6qXmwMWrHzSoGmOannAU4+VWNSgQezQXBYIb4e+CYTa9fWp63B3BjYl+dMp8tnWLkLXeaSfWifeYuYTqL60wRHujeIHmAVDIsUI34IMno3oyntyyQekeb4o7WMbjQO4wlh18FVxhusRI1KCzSZH0bUDaOuF0QSni69Nhzhfx2rMunaNgQw2m/aFvDxQ+y4vbcP+OAC0MkYqWMw4Y2Fzy5cXD9wbk2YEpzXInzji7HTC2E6CEmU8kHtkA== 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=CgF4meZtVzUEh61zhvnHHXuN62U5ooTTV9C+9aRwJO8=; b=QO2Y2Tp9NITJqHQuTbXqd6sZfbVREv3RpPw1tk19YvMwPXjm/tD3ODthgNO0a0Uk0K2S6ygn6xebyb6b0Vp07h2SunHaxMC8CHC4p1Gfzqr6tk/Aev8QtnF6qh2haR9pcM/NMbhhA6diM200iP2+9QeTt31EhooC6s7E9L1vrDE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:16 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:16 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 03/13] net: mscc: ocelot: expose vcap_props structure Date: Fri, 27 Jan 2023 11:35:49 -0800 Message-Id: <20230127193559.1001051-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 306231f9-6025-4043-f620-08db009dc179 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YOOLbCSa2ColzbKqe+mkH6rnTwQAQF6Pq2n4/KBAmuPp8BlLCOui+qg36S3kWokw4j0qKMqZi7P3znj9vbaokY1AswnnJK90TN3QNM1v0EuWWoXrICPeEiGv4iq7OMJvnChHK0v2Pn9hqXEgox/bX0kltLWbN57V5nWilF7QESmnQHFSUwzkF9B/9fPmG6U2eXH0G5mTzhALQQbDN3kek8PT4J1BptYRTu79cclDqp5Kng8ukE+CBL5mkeimWwtH9TgWVptRPcB2yLfkz2++EJtGZHTFX3eIUaIvjBwZsg4W5ktLBLCvVOGpEB0JdQK/Lsz4OVEbSwaZiYzrSzEfj7AcAGM4+dLawjorC4PbFYqO1SKufwRxGV8w/gUV/Oza6BKiBTwZGKv5MfMneFVsfinDHLPZ2yRXmV6oP/BZMlTNAAm5AjcKW/1Asacyvjo/eYNMoQdECcOURDw/D4+xFpuXHnNTO26S5g6+miT6mERksIBfM2nyFX4VgO8XXj+ZSTxg7KVVQUrlBD+dvInpBN9bXoZU141uOc8O/w3AKI+86jrxzOUpHfFomiQ16zpIkV1rk+xnfyNOR58XGvWr7Ulhh9E7V3WwI5HPIWbfahNlZy9Agun/lijWUh4akbZ/Pujyt6Fdg2NOK6yuVTT3TjSvmlo2Z6x3VKwC1f37uuEWrmRDpNYFYbm7dcBNDjG8QoAfHEzjjRsphfXonDp/gA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39830400003)(136003)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fwB1R71LoT0r49dy1V1O7zl+qpP/nzNDfGm38rwhfNrljZQ44PvO/fGKw4rDeC+GM7AlPNOazXlDQ87CcFL5ndcgW+IaJM5WGiGe+pFd5oiC+pe0ACdWutq7UswZf/F3yp+IeOcBUkgL5RC3n93XkHdT6o5jEFtv4Z1g5mO8aoJ7ZGWC4WixoDdIVxI7CSJTuYr4rAmjRE5VICdPeYEomuMkWLF0wh/tb/E1YTGLAHhbn9vPzxPbLi2w8q5dvnPx5RQIbgFrN1kTVUXXN0a58sSDQHT8g9FPCZFPWHMBNs2N7l5KKOXDLsxaLXqUXdtkGoJZZp5yC9CLaxQBHUBpvzluHIowVlDqjm1kE4EIscVeHUvyv/Xq5sMXe4Tc/L+mMXaH9QudX0CuAzd3CKnB5GcMczjhG4fA0MsIGq08UELtXTLZiGoU81EaTaybKrzo2vMjBDrZh5IueV3scFN4XeOhzRvtW9CgYW58RLjplHvUTlZK6gebAr4LVlBCVrOWOjocDTzx7ClBo3JUhuL9+wKEqMoiMOZYN8rx9tqXUDHIbipWrnK3T3CNn9c1mnrlQIEd8mjkh8nJshCoMXv5XEjO8spQp6w9+9v14ORt3kXH91FaXyaWhZETF+5NAzj9uLwRlyUcGpN/5KjIkoZZDTPNbecgnroGsaCJS8vio0AEEg66J22+XtNArftLhg2MowE5w/uvMUPoz1hMZ94c6c/KRGk0TKpVhkM+fKa2+svUQzHwFf5avEvgb1o6tH9j11Hx4jaQv2WGKnoeefObQnqe/YhaCorY6qWl/Vv1aY4GkrrmpPt2NKW/9lfHfBRAelzzWQ72++sUqD7j+9u40OARLCESfrMU6ZcKrfwIv97QwfVJchLYA6XBLjHXFzEyGD5dSnS91Eu03sGoagcTzRIalKBaulAZW05Ol4zYOrJNQiPgUNlCs89va5bBsu882OQjkgKCAqjl16qcRoJZa15U79ytMcWG1gZ6/T4kHuwoJEXsDCYHpsRruy9WUqCFUwntmqCoIAOwN1sLeAvOK2Iu82+ZcyhXlflLvjBTSAcSwsrSfy9TFttSbHfQFa7+iu1rKpUvPb4H60KJ9t0Ay6COgjSTtE5chDanujdSTmp40U+KKhKMChgaB59QQrON1rfAf1iVDwufqksek8KKsQHseGQWMfp3mE5oCqF+9k8M4mTMgkg1oOnEAi7lSWbm5H5euMRqK+bW6iCEquEZ6spTshFxwziRFaoykcuOCZx13EV/leoeh90ES5sUDr5XUOB107T7rVxj8WKvDsTc+4QC+bPgCc39ZUjenvHSt59YPb40rPRyhQIfIGjjLn1hXnRFFjaKU2/eeb7WEYoCJTS0nFHl8M/mwrFtMaRQh5dElzAIQT1VburtmfbBqs0K5aVXeoLUEqIkRXCRIvLxSWq+fa8KKu/D6IzQxdBpYmXl8/0m7DgA5DLW0ih0BtUDbCV8MldI0NGGXmpfOJiyybqdyKcFXLGoE6fFxsHd3AzXe9EFR+ZSkMRP2B6G/Vtz000Bnaq0spW/oDdZuL4mEO+BYEdZwBc75fgHIScYpmGB+2/x4uV/AtWQagRSfXpjbjK8FC/3Ho7TIlhiLrPFbnKGJEThddhLIXGXH9R/zl8= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 306231f9-6025-4043-f620-08db009dc179 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:16.1105 (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: BeBpkN/n8NoRIrrlB7OMV5XRi5dDGAryCztMdpzOpQf63jcS4yigPiKxZh+Q2zHPeBTGA1ZbHB4s/tEnzy4F1IILJiVjhkmiVLEFXilK1Bc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The vcap_props structure is common to other devices, specifically the VSC7512 chip that can only be controlled externally. Export this structure so it doesn't need to be recreated. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli --- v1 - v5 from previous RFC: * No changes --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 43 --------------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 44 ++++++++++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 + 3 files changed, 46 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 8a90b5e8c8fa..381d099f41b1 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -180,49 +180,6 @@ static const struct ocelot_ops ocelot_ops = { .netdev_to_port = ocelot_netdev_to_port, }; -static struct vcap_props vsc7514_vcap_props[] = { - [VCAP_ES0] = { - .action_type_width = 0, - .action_table = { - [ES0_ACTION_TYPE_NORMAL] = { - .width = 73, /* HIT_STICKY not included */ - .count = 1, - }, - }, - .target = S0, - .keys = vsc7514_vcap_es0_keys, - .actions = vsc7514_vcap_es0_actions, - }, - [VCAP_IS1] = { - .action_type_width = 0, - .action_table = { - [IS1_ACTION_TYPE_NORMAL] = { - .width = 78, /* HIT_STICKY not included */ - .count = 4, - }, - }, - .target = S1, - .keys = vsc7514_vcap_is1_keys, - .actions = vsc7514_vcap_is1_actions, - }, - [VCAP_IS2] = { - .action_type_width = 1, - .action_table = { - [IS2_ACTION_TYPE_NORMAL] = { - .width = 49, - .count = 2 - }, - [IS2_ACTION_TYPE_SMAC_SIP] = { - .width = 6, - .count = 4 - }, - }, - .target = S2, - .keys = vsc7514_vcap_is2_keys, - .actions = vsc7514_vcap_is2_actions, - }, -}; - static struct ptp_clock_info ocelot_ptp_clock_info = { .owner = THIS_MODULE, .name = "ocelot ptp", diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index 123175618251..c3ad01722829 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -639,3 +639,47 @@ const struct vcap_field vsc7514_vcap_is2_actions[] = { [VCAP_IS2_ACT_HIT_CNT] = { 49, 32 }, }; EXPORT_SYMBOL(vsc7514_vcap_is2_actions); + +struct vcap_props vsc7514_vcap_props[] = { + [VCAP_ES0] = { + .action_type_width = 0, + .action_table = { + [ES0_ACTION_TYPE_NORMAL] = { + .width = 73, /* HIT_STICKY not included */ + .count = 1, + }, + }, + .target = S0, + .keys = vsc7514_vcap_es0_keys, + .actions = vsc7514_vcap_es0_actions, + }, + [VCAP_IS1] = { + .action_type_width = 0, + .action_table = { + [IS1_ACTION_TYPE_NORMAL] = { + .width = 78, /* HIT_STICKY not included */ + .count = 4, + }, + }, + .target = S1, + .keys = vsc7514_vcap_is1_keys, + .actions = vsc7514_vcap_is1_actions, + }, + [VCAP_IS2] = { + .action_type_width = 1, + .action_table = { + [IS2_ACTION_TYPE_NORMAL] = { + .width = 49, + .count = 2 + }, + [IS2_ACTION_TYPE_SMAC_SIP] = { + .width = 6, + .count = 4 + }, + }, + .target = S2, + .keys = vsc7514_vcap_is2_keys, + .actions = vsc7514_vcap_is2_actions, + }, +}; +EXPORT_SYMBOL(vsc7514_vcap_props); diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index 9b40e7d00ec5..8cfbc7ec07f8 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -10,6 +10,8 @@ #include +extern struct vcap_props vsc7514_vcap_props[]; + extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; extern const u32 vsc7514_ana_regmap[]; From patchwork Fri Jan 27 19:35:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119233 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 D59D1C38142 for ; Fri, 27 Jan 2023 19:36:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229786AbjA0Tg5 (ORCPT ); Fri, 27 Jan 2023 14:36:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229680AbjA0Tgf (ORCPT ); Fri, 27 Jan 2023 14:36:35 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C66CA80151; Fri, 27 Jan 2023 11:36:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I3gkT0DPvYouwmUTzVqmsQDzT2rIkvlA3hqbtT5aMmP0qZoReWwkO73Oyy9f9+r+gJAKsoO77fG9L7OJImttqWoK2SDH9/aIY1xZwMsIhpYEdlDeFSPJsSBnqkpsNmQhKW5PtJcWysNlbNoXFagXe6E4BY/YoBAJSAJlFJi0b2//4cE/2h48UZ+nVuD300TOV7ZtwILyBB67lXg4DKl53iUWVFJ0RX+ueiFWNSrl3Yh4LbFvaLRt5mHl8QsFwUn1CsmMN3MNMvR76AQzlAcg/LAPFILWJ6bWbzHoNyYf8hZBRXf7ctOECRMqrUcRCFZHkYzjHTZ/lS/CAIWmN3lTLA== 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=8vGvhCW4A931dX/uJVIfNuklqP0RF3G8Gc+B9ahiDAc=; b=BjzkDwtwuK9MYaFpdYNlT7r15Yg4NHoa8L4IUBt2hLS635zKr78ADprK8CZagw3doFSE/cW4hes6h90/IaFUUtLEAFDLQR6maMubMxfaVZHGlAbvbx/28q2yJcsMjBLHKmcX7HU6low8u3JmmXWrSOTNec+JaWP3ymEte2IiKeFMFuMo0f/DHFbIqZC53Z0kKptToLgj4vX902UE2awgn590zfffmhQ0deuZr1K2nS70/kuX+zLWPFe0O7ETh2lw9KExsJtZmjE3yftwpbuvqW7DDK/+EMCvTWe3RIixqsjxkqxep2UBNd7diODpiaMd4CSAci0vQkbdr00KSn2M6g== 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=8vGvhCW4A931dX/uJVIfNuklqP0RF3G8Gc+B9ahiDAc=; b=qOTKw2yYS4fxYaAXCHJbngN6za1Q0U0KIEd6IiiUqtEQ5VandFTK6J+9y2F6VxLYwogddiADxn/HUVF8eD7jSrXoPSkZCbX546l5SVW2DwVdPIySNPFwKAF5+/z9qq9NU3/XkXQvMPlHeSP6iX3hwCzaQWqpRsrkhakGgghrpRw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:18 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:18 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 04/13] net: mscc: ocelot: expose ocelot_reset routine Date: Fri, 27 Jan 2023 11:35:50 -0800 Message-Id: <20230127193559.1001051-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 8b2cd2ca-6be0-456e-fc5f-08db009dc284 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rSNmA0dH//7+az+WHZCf6Kc6+ZEEVa+73a+Jeh8C3D44ZVvXnBXn1+V8JrIu9MofpsVa4h6gWd+mIwhmk6EyrfAGSSneQxTkfP+xS4BkcHsxB6HZzutTwQX93+nS7GlyFPx9gZcn85x4We9e3TO2jv9TSyGYYQF9NZIns2cp6F3z3tBB4uDgvfS4yheX1v/YtT244gBdhTf7I9SAIPKeD5MTwo7lJDc+VACzVN4Snn42HQmCxNe0AapeWWe7l0BWM7TPcl2/dNbH3CBPzsJ8+2sQW6j6r4StX4d4LSU5tm4KpkH5WKb3RGJhhO4I3H4TE6brB3HwLqHDZYzDKYHLJdiFJ0efPQGkarC1LsSKrZMNP//n17dBy7PIq6TsB9HDwkY98rOpmX4zJqhS2D/6wrofs/rNrtLyktVHv+1iU+TbIOvKGzzVTdMNFLVtrUNrLRM48LaDrlh+sIvD1azbAt+GDUG7wdDP1xqtaSOxSe1b4hXzcoeLXOJjQOc6pRrvBqRmiX6gOs54XSeUFPNDtPzjPHuXtUW74wYFHf78mJltkvhewjhKIu91+ulGn30nz+4JsCIZnEXojEPhMeJ2jTT2Sdl4G5snH0NbXKBuU+Ijg7ltH+OUUzPfo68Kja9k6QkkargxY801l2jKurP2i+b2H3gIfkqsyz7G08VMo06YOhu0p5nPAxm9jMWP2Dh74GFa7v+78xoC0hHSZeHeIw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39830400003)(136003)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Olb6F3O+BSvATyshj+z38pSn2/0C+cFW9SM1D6fNTLSi0Qv24KcD7kodi/xcQrMXTZ9rMuDUkZ4Pk940zzy39H28xYGjbYcutwCUDSclL2hPmL2V6ES7sbnJUtGX8hF7f9d6aRMd444uR0/g68e6DcdpjX0LSjwsVqKxtFCJEnmKMRN+19BkAFI+PCUNWJJPKP+eJN25A3+XSrmg7YD2m3PIdexYAwdrZF9jCzUp+7EST2/9KEAiStiNrEAiNad3JEZnQbtA1pbM67UtBkN/85l4uLRjnI0BFoqMImhw0ph/xDo5gmej81WsPQREbHR7hAtM+LukE8+P2O2LMT8BDIiw1Vg+6VmcXzk2xVv8sTHvsq7T50DDm9hmnXm+S/WvmC2xQMaGe9c+97DahsvX19gKyUYSrl6yFeYcJelY8dLauVdvWlXg6uxwcqXeA8MkbFrft3MnpbVaNLet/WuBcCmvVIU4qvRxRO0cDvboc8AALvrH4zIUxHd+OVCaFGAYKt9rVleL5e9NIv6rrvETkXzJAkpefuS0BjTvWkxK2C0dhIL5clGmHN8iqzG4GcfZpJvywSOIaazSUVoL8UXwajtLd5ORE3FUUk58MsDxA1C1dXoHuxR40187RDP/VQXs3xYwvotmD7lJPMI4I5ApGxSUf62+OeYJxkirpl8DBtdCLv6R4+0gqWosb/2WMwg17v7GCyvM5SWqLC/GFyjYkAHanqTj43kFFFWUdsoTtaphKupUKm0YGfbEXgYQvvRlsyOojH8i45lGm4bwfOuubqLFLeASxg5UQ5lGBGMXmlVY/m0CDsBqNiYFjKZ32rZSBrEYuVcoCDEl4PXMtk0zWKoCv+MRP9tn8dGOFubdJLn8maD/Wa1qG88m78GT8wLdZgP2jJM6oN5Pt5NZDpUMNB2USBWDATm3rZTL8hmEbex+0TB5Lx4jEPfDHhtWPc72nYDQeD322lvgzXHipfLEBlcG9BG/tnXOZ6xXPFR/YP1XLLumbKSG0I+0xw+7p14FQM6+Jbq3ig0Y4BsL7tVOQdQjf2e4CTAjrA8kkpiVoSXpE6CJ1jHArDL0OD//i0P/Jil3JCeW0QIf2bhCcnm/Q7PyB9uB/akYoF8A4tDw0e7lnrW5WamM0vE5rdFQfh/B6ANoYq8equfRHEx1MBObkivu+BXa03Dy+tAlUlnx7H4yiKe3MA0P+VunIY1C4jk+/PyWN2YGCzRsq+00ub02nKpPk9uzCdzHjj9EQm1SsazopK5CPmqv2q72S1lYkpvQxGBJr+HvAbx8Ja7ASE4IV+XA4BxFFPUMImsTPdcaAmoSp/MVsvNahlL7i7NkxI61ejI+03An/N8YSPJDWQU49EXhAMcMrk+jrGT906UKtud45/rtHE7aRAGd6t6HUW8I2P4FiqMAWVzVdhAH+ySp1O2/z4jZEUSc66SRiWyfFofAkLCGTyoQ/7AjjDS1IsllRPf+7FQKQljImcKljTw3eaTmmYQJTy4+usMwNx2hgJ5bDmdWq1rW1swPArAYh/ik1gWKiI2TMwSxyuvXM3FdVkFjMlP1j4QxRmgJJjT7xgO4Lo9wi0LuBozqgL5tQzs15OjZRs+C7Dq+Ts6In7BFWw5ed20LNIMACiPXm+ATAB4= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8b2cd2ca-6be0-456e-fc5f-08db009dc284 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:17.9073 (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: N6IMZrU+r9uBADvA+DDi5Sui45mPcg27UEQa8Lc22Ovp27PBNzMvZMbzphETrA+JXLhub0uKyVpcObaZe1V7tZTDr5lugVyKgymcbxlq7ho= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Resetting the switch core is the same whether it is done internally or externally. Move this routine to the ocelot library so it can be used by other drivers. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli --- v3-v5 * No changes v2 * New patch --- drivers/net/ethernet/mscc/ocelot.c | 48 +++++++++++++++++++++- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 44 +------------------- include/soc/mscc/ocelot.h | 1 + 3 files changed, 48 insertions(+), 45 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c index c060b03f7e27..08acb7b89086 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -6,12 +6,16 @@ */ #include #include +#include #include #include "ocelot.h" #include "ocelot_vcap.h" -#define TABLE_UPDATE_SLEEP_US 10 -#define TABLE_UPDATE_TIMEOUT_US 100000 +#define TABLE_UPDATE_SLEEP_US 10 +#define TABLE_UPDATE_TIMEOUT_US 100000 +#define MEM_INIT_SLEEP_US 1000 +#define MEM_INIT_TIMEOUT_US 100000 + #define OCELOT_RSV_VLAN_RANGE_START 4000 struct ocelot_mact_entry { @@ -2713,6 +2717,46 @@ static void ocelot_detect_features(struct ocelot *ocelot) ocelot->num_frame_refs = QSYS_MMGT_EQ_CTRL_FP_FREE_CNT(eq_ctrl); } +static int ocelot_mem_init_status(struct ocelot *ocelot) +{ + unsigned int val; + int err; + + err = regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], + &val); + + return err ?: val; +} + +int ocelot_reset(struct ocelot *ocelot) +{ + int err; + u32 val; + + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); + if (err) + return err; + + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + if (err) + return err; + + /* MEM_INIT is a self-clearing bit. Wait for it to be cleared (should be + * 100us) before enabling the switch core. + */ + err = readx_poll_timeout(ocelot_mem_init_status, ocelot, val, !val, + MEM_INIT_SLEEP_US, MEM_INIT_TIMEOUT_US); + if (err) + return err; + + err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); + if (err) + return err; + + return regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); +} +EXPORT_SYMBOL(ocelot_reset); + int ocelot_init(struct ocelot *ocelot) { int i, ret; diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 381d099f41b1..1e94108ab8bc 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -6,7 +6,6 @@ */ #include #include -#include #include #include #include @@ -17,6 +16,7 @@ #include #include +#include #include #include #include @@ -26,9 +26,6 @@ #define VSC7514_VCAP_POLICER_BASE 128 #define VSC7514_VCAP_POLICER_MAX 191 -#define MEM_INIT_SLEEP_US 1000 -#define MEM_INIT_TIMEOUT_US 100000 - static const u32 *ocelot_regmap[TARGET_MAX] = { [ANA] = vsc7514_ana_regmap, [QS] = vsc7514_qs_regmap, @@ -132,45 +129,6 @@ static const struct of_device_id mscc_ocelot_match[] = { }; MODULE_DEVICE_TABLE(of, mscc_ocelot_match); -static int ocelot_mem_init_status(struct ocelot *ocelot) -{ - unsigned int val; - int err; - - err = regmap_field_read(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], - &val); - - return err ?: val; -} - -static int ocelot_reset(struct ocelot *ocelot) -{ - int err; - u32 val; - - err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_INIT], 1); - if (err) - return err; - - err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); - if (err) - return err; - - /* MEM_INIT is a self-clearing bit. Wait for it to be cleared (should be - * 100us) before enabling the switch core. - */ - err = readx_poll_timeout(ocelot_mem_init_status, ocelot, val, !val, - MEM_INIT_SLEEP_US, MEM_INIT_TIMEOUT_US); - if (err) - return err; - - err = regmap_field_write(ocelot->regfields[SYS_RESET_CFG_MEM_ENA], 1); - if (err) - return err; - - return regmap_field_write(ocelot->regfields[SYS_RESET_CFG_CORE_ENA], 1); -} - 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 0edb16b6087f..2080879e4134 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -967,6 +967,7 @@ void ocelot_ptp_rx_timestamp(struct ocelot *ocelot, struct sk_buff *skb, int ocelot_regfields_init(struct ocelot *ocelot, const struct reg_field *const regfields); struct regmap *ocelot_regmap_init(struct ocelot *ocelot, struct resource *res); +int ocelot_reset(struct ocelot *ocelot); int ocelot_init(struct ocelot *ocelot); void ocelot_deinit(struct ocelot *ocelot); void ocelot_init_port(struct ocelot *ocelot, int port); From patchwork Fri Jan 27 19:35:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119234 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 C4ECFC61DA7 for ; Fri, 27 Jan 2023 19:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229927AbjA0ThA (ORCPT ); Fri, 27 Jan 2023 14:37:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229721AbjA0Tgg (ORCPT ); Fri, 27 Jan 2023 14:36:36 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F333A79CB3; Fri, 27 Jan 2023 11:36:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Eohf6v6lyi/ytOECPcBikoB5MSZLw0IWYb3v2wgTQXu0ud3PIjTTxLhqKxn/3tB8sPUU1gu2DRLwNOhz6l0qY/tfhiOMwyM041O4wLzCAkcTARbjF2Uj28tCWqFr7uFajMLG1GYUazMwZpcLvAjwFrZ7Yp30/Bfg9lhdNreJRkqIBpMb2PC2Xn88QfyemRqi4fACI55DmwD2in88tuSTNCQbuKsjJARfeKwUqlyagoc6HkpsuQAr69YzeJLiH05kGxlrD4SkEVGS6DTTTaE4hMedk/1hX3tCynZhsOySdYF8Gi9Z+lwbScqGM6eqLcYfcFQ6Ri9eDqP8Fkp8v182WQ== 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=9HgUi+P+S3mCJCE3I+qYaHMZsyV6D3kldWfPPaBL0ik=; b=XPdQwbiHgHKfjgt/wUJmnOzSs8B9SJSj+GRJFLj3XPy0H2PgOC8w0Rd1+mvJ8xZqioqOWaEajLXCTXp42BVInDcXXikqepHdGw8TdEQDj7T13/HPk5xrAQtePA2zrE0OHnw7eOCnL/nTzqhe1I3ToHuGeWkdLttjVGS7zCG7BlCuw60n2JWjS7ozRqUn6q8HsEcE8yXvpVbtRg4hUR80pOEc8pGB21/N1LOHIbIGBvi4TPGCLVMDMawhrFYggwuL9DW1dQDQ8JC7xonCZt6Ae8FFNZGYujw4FI7mdCgLLar3Jf6ryTCz3OKyFtnHj8fKnEFp8lCWbGX79+IL1/mhZA== 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=9HgUi+P+S3mCJCE3I+qYaHMZsyV6D3kldWfPPaBL0ik=; b=IaqQgumiQE40SJvONW5vUN4e/FF2Gw8WbzC8V0Yul761cYUJlyRFyrCCEVRh7YAjh8HpkjmHNUffxTrYhGznoToHKIp7KZMNPMzk8RWi69kZxeYWihcqrs8REO2YzAVZNAPKEXB3g6eLCv9cQodnt0rOrJiSYBJGmbAqe8yHBqI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:19 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:19 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 05/13] net: mscc: ocelot: expose vsc7514_regmap definition Date: Fri, 27 Jan 2023 11:35:51 -0800 Message-Id: <20230127193559.1001051-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: d4c7f9b4-fd21-4a3d-5ea5-08db009dc392 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 50IfpK554P6StsPHUxwjgqebqGNZBlfvEJ5nmwqZfGRdvQ6HS8p8OlouyI5wIwAUG+JxGRnRc+Jhnb6qfMj9UigF3LA0T5HoFK3KzzTP07lvb5YxattyuOdW3RYsunHSn/rbVQoybht7QBGfBkVlPM1vNQPTdmNUCZw/E6VtBLjR0Oat/UPKxjAwPB8fP0X5w5/j70ZVNFyyHJbrSzypSD2Oh1GqAd373fBeJtCTXSRkr7gcO7vhPILwqL/8c4ZE6zMwte03CY/NIOsjI0DoO2UPa1KTonpAQ//G8yLWSDx6tHjY+9HP/wC4IPXTr6M+bUpxjvweTtjDlAWOujv5EKKXdehLbXVr2x3KFQA1/RetjDUR/v+YEGjBQTx/pb+y/AAgrU4KIZ3z5SI73lp1oy6JVsXuF9zZ1alFyioRur65DZ5ZGeUuTVi7NjW3Rug+sk3b2lGRnie4YMXELUkU85am3LhiNhUEp76/NBfQDOrMMeTPQQXvlV6qIylTNQPArX2LAOatdsZt3oOi8y331wYKacDP+Ud+cXdhffC3MIBBCzMMjC0ouZ9s6HB9/xiB/RTlP00P6tTvCahj3OcmmDNdpKhMeUL8sM55PqyBbJ1bRElbTAgQIn8Fa/Yg5QHWOxeU26NotGz+3fOZKT0Bqron+Vh9Yc+55zTPMyIKIR53FNCyJdIQmgrfeuMRp0Hz/3soxTRSJxvsC4yqdnxOjw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39830400003)(136003)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: V7aCDuLq8NiFDTVZTr1LDGJmW//t+LFa4+fdIsCkux264edtPzdu8PYnkHEy0RonF0U7UKG/bGluIMvVCxcQx40ghJ6/+D5NY8RdzVSvmgv18iIOEfx88P36nhfKkDa5qZ09yGm/+m402bg7IKfkJ4ZayaCGvWP/DcAkcz9OA01UQBWd1ynbF0OjwnMgp+fNs8n1skE8talcGLLVt6T2Onnc4x0+rqesQq0KrQH0k2DGoHDRip4N5yjqVSxbXASJYN/OaR7iI4Qanfil2x7VW2tccbE+akMqse23BpdPshqbOyi2+bw5/wtCsw3H1QTxYsQQYduJ1dUJuxH63xTLTlJMRM7OnAmuT3tLPGuwdN0vXNOWRvFrw+ewJTzglRa+vxfOdEh8EpBzCKdreZffGj6v12OaFW98++AnOWVR+YXbIrfnL0Kfslg4K4MVBzF9NZj/y9oVFhpYqZqt4HWReC7+k8EaPGuSbi1t60uki/qOa2Uso518nlIAtDS9ntm9ctcVPSedc/gckZ6WFETA74igCzWtoMGvlNwhrt+Br52sp2cL42tzA6V5mKnGBEq2acdCLH4hXs84IZXadVytp1nqsLlWrxGp9VwtVB+d4NCeKcGe3NSTTMnY5TuzRP9lYu4an345gURxofBxEPlIqhALqJRvpZJzvVkCpxhXv4jkpGgBmwTkWffqmucUOjeUoXAArpDahQgs9HMvQxxY6hFckUQ4AGC6LXVDeYmGs1oeXBi9E7h/aGG09C5Gd2a37O2igXhjB4F4DQSwUj0/uiLkspFMUvB7Wvp+HAhKsQA1jgJ7qmMCg8iZjbSVHvjYGhR3gEDDQ7aoOqCyUchs/7nTjmpn129Axpuv+XCacLVQEtj5ojI5AtkQPRyktaIfurvZ0yAkM4pleI5DxLCnw7MIpUOemt0QUUBObcAhhii8HSwJ2yxIbblhRuEfeF/XzIlG53TV2ynGCk4mbEsW2YzKInxZ+1ERwHxIA9ITp29oXSp6KzUEU+3BUSLkLgv0K3zS1Qpk8aRuTeMPKyQr91CRl6uKJmR3e5OQOT/VpBLaQCppk/ct/PhUqLZMFUnlcKk9W3wWBWSBlCNocPZ2BDgLJQpNLYlYsZ2ZdHmO/fq1wq1pCp94jld07SkFKcL/GBRRrTqoI//BhSOQu+rjOOrvYNjwNwrun4VgYx1S7+hHXXyUvKX3hOAc9KB9v4UbfSJI0Ghmlg1w5w0YTo22AuwLwtR922wc3hzmfX/DnePoNVUMBjuQ1odE/dpj6sFMixRw6JhAxNJa9kftzE0ISh2El4V3Wgggbg5ujZkLWWWiThmHi/zNEZHMX1ObxZFhtIxa5VnZyw0GDL4jfeLqViKTxlDH4zfD7DDd/RjVtV0MOPHyvUtj1XQwLcPRur7lD+hlFLdbwFUIaAHfU8x1J+0S2pC/rV3mBtTMQ2f6YpD1l4+CGBZu9BTyDxAWLe1FHlYGRfHCB8rSr73VZsDR6nwtcm/YtmP4JKsxiBmh9X1pMgqbJEEKUEFj8JllsCjbZ23w69yI/vOIQ2AvbA85tzHT46z7aAedr5YyF2PipA1EFdWWrazOWkOFf8xy51q6jkKmDEpEl4qilejrDeivuH1mIle8Ydyi+k5FlQxZ79Y= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: d4c7f9b4-fd21-4a3d-5ea5-08db009dc392 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:19.6103 (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: dt4RHKFLrgOtUCw8YwH6de1ZHiG5FZdZfTy6Y1KnnOMbz3Mz8AvWbAO5ELIf/vyY8YC7pOhajPbNGZo1fpTZ5Q6e+wdanjfmTRSJLTr4h4U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The VSC7514 target regmap is identical for ones shared with similar hardware, specifically the VSC7512. Share this resource, and change the name to match the pattern of other exported resources. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli --- v5 * No change v4 * New patch --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 15 +-------------- drivers/net/ethernet/mscc/vsc7514_regs.c | 14 ++++++++++++++ include/soc/mscc/vsc7514_regs.h | 2 ++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 1e94108ab8bc..7388c3b0535c 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -26,19 +26,6 @@ #define VSC7514_VCAP_POLICER_BASE 128 #define VSC7514_VCAP_POLICER_MAX 191 -static const u32 *ocelot_regmap[TARGET_MAX] = { - [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 void ocelot_pll5_init(struct ocelot *ocelot) { /* Configure PLL5. This will need a proper CCF driver @@ -72,7 +59,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) { int ret; - ocelot->map = ocelot_regmap; + ocelot->map = vsc7514_regmap; ocelot->num_mact_rows = 1024; ocelot->ops = ops; diff --git a/drivers/net/ethernet/mscc/vsc7514_regs.c b/drivers/net/ethernet/mscc/vsc7514_regs.c index c3ad01722829..da0c0dcc8f81 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -429,6 +429,20 @@ const u32 vsc7514_dev_gmii_regmap[] = { }; EXPORT_SYMBOL(vsc7514_dev_gmii_regmap); +const u32 *vsc7514_regmap[TARGET_MAX] = { + [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, +}; +EXPORT_SYMBOL(vsc7514_regmap); + const struct vcap_field vsc7514_vcap_es0_keys[] = { [VCAP_ES0_EGR_PORT] = { 0, 4 }, [VCAP_ES0_IGR_PORT] = { 4, 4 }, diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index 8cfbc7ec07f8..dfb91629c8bd 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -23,6 +23,8 @@ extern const u32 vsc7514_vcap_regmap[]; extern const u32 vsc7514_ptp_regmap[]; extern const u32 vsc7514_dev_gmii_regmap[]; +extern const u32 *vsc7514_regmap[TARGET_MAX]; + 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[]; From patchwork Fri Jan 27 19:35:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119235 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 64888C61DA4 for ; Fri, 27 Jan 2023 19:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbjA0ThN (ORCPT ); Fri, 27 Jan 2023 14:37:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229683AbjA0Tg5 (ORCPT ); Fri, 27 Jan 2023 14:36:57 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AED0682432; Fri, 27 Jan 2023 11:36:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jH19qLRaXb1gmchbHbZhCiuitNmkyOMDqGGfnnTen9PPe8k7FtlsOQUhwhyNyu2ySo0r9AxmGL7Q1bcrn+g4JeT6foW+Xjyd9iomeVmu5RG8qLlSdUX98Xg0hMb5CJB/6SGnaFCSzv0dTyH7LJ4JbO9O3/cLfBI7vihDeCDeuqeHcm6fkjmfMpNAbj6+GZy6HwgznTsUfYmfUEi6XqN9AYbpeyYaTL1BiEIvGvpq3X+E4StoEJnOESh469O6PhRGewBwmI59cVySttKTHy8/PZdFifXK+AGG0UEBRlm9WBI33ZmnM5ytpxYFAz5LaDvZ7DczlxzR7FuTjitwF4LAug== 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=b3dhKwI+miiCdpD4QbyMsSUW0Fl3ZcaQv9YGDa1D0ew=; b=mZ4Jl1jXJOlnzdDfcKsMukB3P2nhmYYuoa17o5eUJzhpwO82E4ZEs0gL4ijuzixG/mUtWaCi4tzW6DoIiB/i/No5IZ+5lOPrjVejtNQvzp+gFjguVu+D1KuEsOotb5HQvWJzEycKSyoIIRhGUl+K+ZHvliUi2y4s3ES6azhqp/Bc0AG+n3rzbLO6+wojwFvKhu0R5y/VDBGBqQhBHSneVOOL6DeUdtUe9arTBd6inzFrnWHRkon3LaNavse7cqnAS1T37QCWz6S2NZsRZ9btlWTTNSGmiIXX9sdO1MBYwZoouroP2zG3+6nnvbzNon9s5zJrdPny0mqjii6n2tyLTg== 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=b3dhKwI+miiCdpD4QbyMsSUW0Fl3ZcaQv9YGDa1D0ew=; b=F5FSzmB98ZGOQraK6nz8kVWteDzHh8piunqs6OOdIK1vlhuWQTNJh8Ib420W5njWLQSEaPgBvH0WL0Uw1Rj/J7NjQHpMfl+OWvLTnWK8GCdN7fBkG/R5L9+kiHQlwJRTm8BhLLywYCtqN5yfIIuYrgALDclqfJibWxGDHmbEO9g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:21 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:21 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 06/13] net: dsa: felix: add configurable device quirks Date: Fri, 27 Jan 2023 11:35:52 -0800 Message-Id: <20230127193559.1001051-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 239e9969-fb3a-4783-3705-08db009dc4d4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tnFQQNA0nyur0Iw9JvnHG3Kzj0MeseVRcgAFQqf7wIHjfqAKnWCvbuQP6hy/SOMdsmtc5oshJrL0FFqWV3LoMFIb5A9a0XggIQR7KLPTfyjEujKZ4PRgPqGe+uvjlXTX8DQXojBhVz8JCYj0PVLKsOXjaaQlWZz9PAquVRXnxdLea06abh3T+vCCoxEDqv7lRqx/1oVT5khNTRIAno9QMoRpbBQJzpHx6L9DvCTBKyUspq4MxIQr3ItCAWX0yoS22fuuQDJokDZlNatFQeiMKPbdHx9ukvORmXw37bDCZgieZ7hRfJX0khNm1BgowyM3WAri+xXOOXtfc9QKTnZ6y+xsYuPYHzBXhRhWJnjV1sk7+QYLJNoM7uPUovkGo7BZLxeM9wHy+8UaIdFC4QdgT+pGzKmz+whfaT72rmCL1q3wz663eUJZvlFuIdHRYuwv2fN5kThQUtId0axJxdWT8th4RkycwZnaSBh+6QCjYQ4OZ3Qqg6PH/LkBShNdGar+w8wJrgibk6sZ5315aftihpe3lu4brVMooCnto4sX3ZmYjYGIzbNiOrT/DMCs/R4prCoMCZztUcI/Tk/8hCEaw7rtoIX9KmThmT+Zm8vqWV4fzHFAHsQ67xGJwQr1xWHCLSxLv6geIfGQ8Q33ryXvTp5dfAHpHTVsyVWi5xM1X8HwXThVj7lYoHBJTIGZ3uqOX8Ucy8ApkuKorveF79dQeg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(39830400003)(136003)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Z9qcycOI1zEkx4fNVc9bsl4Hp4AECm/rRktAeZws6oLCd/HvEdlxzPNlWds0w2lKoi6pVHhs/Ej6nejM4WrYYGzCYprQbYF0MggkQJNQoox0nhEXwqAswNN+IHhd79dwIF0DjtN/Vfv3R/DGr7nfhtD1jaXGSW2FKAlyGnPf11ncHjO8O2rv0JJU3lb6xI1nIIvdUDzXR4kWfCUL//+L88D+qA9FHSeM417rnwC7EDaS82TPgEQukBK2Ky8rc8xj/qkoYqkL78zDMOkmD/TJhEwIEwc+S/F+PsiN9REWWeDdBefxNEI028/6E9kY7noqji+Qet+dRdYVi0NIhy/Isaqo8oAm8uuwYdTx3/9r3WvaHVQFD1+1FDAxCgDRCJ57tt7BukcPM/YlocsobaxwTZuT1x7akrVhKJ4qbo6EGSXcUl8BRNjmj+ZcodS3AWZdkuXHoOAwxuZnEJBQhJBGU4x5/i++WheFcAtGbPPNjJR/nxGe908ojnNs12WeszxG6YCBQaKeBpGzfAh9nxdhU1GQAHrDgBrNvV+3a/Oi6cmuZCjkFXfc5JOYHlB8Ok0uTvYKTYQVJVTA8Eb8W2d+YfkbqTvq7bya5aQSCILpkBsVKC+RAUUAxr2ZeXixHoDnpaOK1nwRJL0bhe5WJSyMVGK6GWgiPWCz2KD2ZH1AyWlF/lIQZrQ5KsA0yke7KCUwbOI8ogk4nPZlWm/uda89K3EJmNRFkbLmDmUw3Vw+3RUBi8e7mEY0qUjUz7Gus1qiUFKRysnCMq6oAdqX0ffalpjGjE0A3luAmiU6EyzdIyGHNeGMGrcanSoAriXnAF+day67hnyZlcS64bwCRE0q2cGHXjQv+3fLGJEe6Y5psuoa9I0mUW+doHjc6RUjxSZ57rXacNYYDKOEFyMR0p63E+QJ4+P6j4EgrWhSZfvHz7XO12w+uMyLJXRjBVjbTUhvIBrTvPuQozBn6ulAXxeAQyp+m+76hdX/r+JgDC4rPANPzbcqOOyb7bEQZJqhRmEC+Ivujq41Voin7EHC78XRJcpZ0qrpcHWnrbhzm7QM4JI1Uw466L174CgKdVAutDKoata/HCaHccxBR4lpQJniYvNdk9d/K8Ngc491EghOQAvdgM1fGuGQ1BS3ZKZA4RhzdbjABQffnqP4WrVyZq19So1ZhobYvqhIpGZBQ0MXxcNOXwbGNhhNiNNaE8TXVp01kNnYEVCombG5n2zn7D/O4pUSyjR9HTOpy8GdwZyc8fWq/N8vbriyjvBw/YUjJwd9iV5IO5XkvPKKK2nvAnze4DP8A1hveHJqMtE/oMAhxETnOhzfRfbTthvVPdbJncJvrP3vDvQ3t8X5weoTrKTPNHEiGTs11FR7Ub5PrnORTqxO1RbnHuqB/0X0DshEnSEWtVSibiTZWs57baUxjdhlHMHctgSnpGk0qHw07KcT+8qIQE90ia4p1g1SZC5+CS+kEmI5XRYh5wrdTihMVWWlZ0b860bkJMrXBk+76dQ7bznjK2tX32bIDOuVfc9aosR0PdAJq7R924E8wCPUoucWH/ZrxK+Q/cj7dZ6yo8jDow9BzxdkUv1x9ApKLJI+RIhLFMO3EcLKVI7vWhHuI7QwWWzwJbt2EV0p0xohEnl0zGU= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 239e9969-fb3a-4783-3705-08db009dc4d4 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:21.6727 (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: z4W8IBy+WaflT1t6VdPehmBkeGJ5WLdxqfpRn/04IkWu53kyTZdNBD0qK8wRworhEBitblXZh9kmWCHDB+cnq45abkEpccE6vJnnb/5ssCo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The define FELIX_MAC_QUIRKS was used directly in the felix.c shared driver. Other devices (VSC7512 for example) don't require the same quirks, so they need to be configured on a per-device basis. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli --- v2-v5 * No changes v1 from previous RFC: * No changes --- drivers/net/dsa/ocelot/felix.c | 7 +++++-- drivers/net/dsa/ocelot/felix.h | 1 + drivers/net/dsa/ocelot/felix_vsc9959.c | 1 + drivers/net/dsa/ocelot/seville_vsc9953.c | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index f57b4095b793..462a1a683996 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1075,9 +1075,12 @@ static void felix_phylink_mac_link_down(struct dsa_switch *ds, int port, phy_interface_t interface) { struct ocelot *ocelot = ds->priv; + struct felix *felix; + + felix = ocelot_to_felix(ocelot); ocelot_phylink_mac_link_down(ocelot, port, link_an_mode, interface, - FELIX_MAC_QUIRKS); + felix->info->quirks); } static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, @@ -1092,7 +1095,7 @@ static void felix_phylink_mac_link_up(struct dsa_switch *ds, int port, ocelot_phylink_mac_link_up(ocelot, port, phydev, link_an_mode, interface, speed, duplex, tx_pause, rx_pause, - FELIX_MAC_QUIRKS); + felix->info->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 be22d6ccd7c8..9e1ae1dde0d9 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -36,6 +36,7 @@ struct felix_info { u16 vcap_pol_base2; u16 vcap_pol_max2; const struct ptp_clock_info *ptp_caps; + unsigned long quirks; /* Some Ocelot switches are integrated into the SoC without the * extraction IRQ line connected to the ARM GIC. By enabling this diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 43dc8ed4854d..354aa3dbfde7 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2593,6 +2593,7 @@ static const struct felix_info felix_info_vsc9959 = { .num_mact_rows = 2048, .num_ports = VSC9959_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, + .quirks = FELIX_MAC_QUIRKS, .quirk_no_xtr_irq = true, .ptp_caps = &vsc9959_ptp_caps, .mdio_bus_alloc = vsc9959_mdio_bus_alloc, diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 88ed3a2e487a..287b64b788db 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -971,6 +971,7 @@ static const struct felix_info seville_info_vsc9953 = { .vcap_pol_max = VSC9953_VCAP_POLICER_MAX, .vcap_pol_base2 = VSC9953_VCAP_POLICER_BASE2, .vcap_pol_max2 = VSC9953_VCAP_POLICER_MAX2, + .quirks = FELIX_MAC_QUIRKS, .num_mact_rows = 2048, .num_ports = VSC9953_NUM_PORTS, .num_tx_queues = OCELOT_NUM_TC, From patchwork Fri Jan 27 19:35:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119236 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 39FC2C54EAA for ; Fri, 27 Jan 2023 19:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231130AbjA0Th1 (ORCPT ); Fri, 27 Jan 2023 14:37:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbjA0Tg7 (ORCPT ); Fri, 27 Jan 2023 14:36:59 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F95F83074; Fri, 27 Jan 2023 11:36:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HrqY6ZPA1iiyh3ojEJEm2JBDxIFKY8IUe2DbjTKJXg68MDGLNu5y3AJhRnOq2etFLPzVRnal5GQ1NuCXjrHVVJaBCRTwY9qRzsUyjBmCkzH1TlI7XBX/8tHrJESPt7Z7sj785iTVX5HGrZpCM7WFrevnyaklB/kYlLdO9tBpGsRA75CSD3IzipUnLHllLQVyshpLZ1DqNsvYdiDNaaVt9UlA/5fRlJjIOxfB0upQTT2WrjMm7OsO0EeAGA7kPNfbSOsPVbz6NONC98TrWXF0+Hzli4EG10Rxsw3rKRZbgEz/um3yIkjMJz/k3L/TojIUlQiRa6OUiribmR87Rj9wcQ== 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=YlPZT1EXglkoXkEs+nucm47znfcXnk4bOI9ZxFdoPnM=; b=Gtp/dxtIYHGN1/r7emQMeFC9xYn3kkppkJw1DK8nc3IWayUnHqcLasMCVO1SmECezlJJGb7PTbctEv4H2GDjWAD4sSaCUwyQduBZUt9JVJzJf57nAozgTfg+G0nx0ENLU16VCnxAmgKNOl2V1Sp87R+OWn9nFGWv65KTHt9JEyrKxNoYlMdbblwdI7Y3hRj+1oQJWMm7XjT8OJmxpT9gtMrIi5a+rQTGI3JXvw0nBFsVd1GupXWTdH7RNFdEqR7iowGDnWPAvp+4BoLIFt6d31VEbtrgCMuDeXioWgA04xHBdNi4wSKlYWIeQ60d+QAwRTozEQwLD7VifD/vttmPHA== 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=YlPZT1EXglkoXkEs+nucm47znfcXnk4bOI9ZxFdoPnM=; b=IrDHXwPwt3LBR1gjGUDuvt3AUdbGjuopCmdH61WpVqvItWC35mqEdJIkfU8I+Tl3vMU/RAj/uRSmcBbiiQsF72JlVb/QGsyfpLcywQtMMFVm1MQDQAWJ/hzyagXlSqRc6zN/t7QGDKZ2sHI7Ijsk4tzC4/lprN5MSR2CIxHKj9E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:23 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:23 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 07/13] net: dsa: felix: add support for MFD configurations Date: Fri, 27 Jan 2023 11:35:53 -0800 Message-Id: <20230127193559.1001051-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 3b5af373-871b-4e11-89f1-08db009dc5ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: crjRVV+KfVq9R+JEx22/NRPkgE02+r5TA+fkWQBFZlCSq9fASdGXqxME8H/cBPEbw4SkfNT8WISuHObTt21BLntYTYMHBF6l87wG6CjlKZ3rWCOOi5vmUCIbb+fzJ3Q+tmqj4FlyzieDLTphQU2jJmqjC8CrEGEMFJ24MH9j9nVsMuoxlxW2nHGuT6WsQ/bLNetKHzvCECHOy7aguFhb9oUso1fqcHLU8FDaLogCE1eaaHkEyaFE1bz5lbS9PF2mrESMIsTEN3TeKVXwgzXiWu0/qms4KSIO2Pc+pz7YTeibQw2HA0Lwt9pAoNY90RFU52gZ4g8FtyQmonA5Wa0sX2+cqA5yLzI7Lrx4ZABn+ykoeJYSe+MQa4nBgsN9A2ucnmADYbzmxglG9/x2tW96uV9tRUwyP6CegrQ9dLUViH1JILtUaPWvrC66njWkvs5p7fESjHUDdyGEgRiK9GDVctzIpIAjt1LGTiAdm0pX6DlkJJgkJ1uC8W4duZEQbpcofFUwyRYAgYtHnBQ47iIIrBh+Zmt+FmmT2P4Z5YTqNQIMQPhjDdubCRIsvTkPWJGPwklAiZdv199rtOFoaGFI7IUAjL4ufSczoxeyQdz/rKnDDFzrb8xdwQWWWORIMFIRW7X2M7dtio2uxlsi9SiKF5Hj2kWUnQxzfbozYgUmlTWlFY94qWUPv+vEwDH3JmpMSRtdcoro/X23Sq5ksgUbOw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5VtjRdd+bPIX/xJewmjJoXJOAYXC8XMuCN0I6T6qU7r9DrjxpuDNWclRrlQWdPKPlup19mwUrq/+NdNGgoxvWacZiW1qSx6Gl1JCG34cNlC65QmxTwYwI/3mAz+VIxMGD0dV+qqsRO+AYGcwANMViRN5TgThCeiAgnrRMsELEylv2S92w9w5Sqd4Gys6GrAuhNfenbrUwAbn417dlEIkG2IXEqYUi5BOSHOelbv5iktG7tiDbsXwa1UZZTza7bjtbGaNgQaE4kfD33staDK65xPinQeJMq2lWpTo0QYc2gTAY9yqA3y/qEI/CF5N66SfdXGdoZ1prxgzA7ggPKeBKJGVYIPE1Q0bIWEDQB302CyDekv36u/YP9tCItVF8jx9mA2sSXLsRSQvGiZtsNAU/HpPiFE0OvFshtCN01cAG7f+/9wPRJoOZeCZdGGsLAtgvua3WN9KEZdYHSGE+dve21AHSxGieEX5zI7rf/v3V9Pm4yJab4RmH4ZBZSSIICm1xhAyxDCBDIOKZfWmkQuPUqW/hnCwhtShbK2ZYHnPWwk9Iq0gwCnJxyG6zZOlRcqfy+pXJ6+tR1D6Egn8JJsOycyfUqTLFHqm8XG9AY4ztyCD/j5fvmnX44aMbeiQBgwCFbFuQC+l/VrJayttOu80izy0biKUC4k5QI00pghTj/xAXAUkYavyzGl+M2NY5jGYn6s0tzlf/mZ8M9pdZ3Y45RzbPIP7PReSaKkFOyKHb+/pKTfbQn+9wgnNkFVGJUaK2se1jJQkpkZgmFdINZcKKUpl34v4Bzqx8EcY0qeUFX1MXQcmqFoRq5eO6wzWnocMCZVvarrVxr5eUYTiCTsMdN5HEMWiRx4pqnjNkoimYvBLrJjuK078XEbW8/W0+kVQvZgJfSfs2FUniPa1mfcESp25zPcEBqZQe7CtLl3Raf23IEgotZT90w7Tcse+LGVzTrITXK/xi+LDw+bIXF8WAH11WDkITXESWxxH0CV5HT2m+CczsQnViVyPL84lsfmYsCN3o5K5zi9pXctU+SFld3tzIknu89xxJrXRzxhGqRF8+NhkJ5BArFhJ4BOaeUx3IL9NLFLgzLO2cCT31XuLbcdKRsfeHJ00dljdwvH0mQhmkMuvheBH1k98eszELcJYFyfmEJ/s/VN1G1aRiX0ArFp6OesfVb5P5FDNdb5PE77n1qbcDFprNHbIF6WL8mqjIvSvU/piErKQF6DyqTu0Ld15jp345BYNm3oV8Yf9+KMeCFu64P2RjUgwGLNRb9XdFrtZGtRQPwdT5iQw1APSxJ0+tUS/BW5YILXMqt9yisFMzF9xF1Tg6Z29VusE3vR6PlhRnszDUG6z+2duq32Wwsj40YjWSEUIq9cmI/Mj031bjRMqL+YFEBniC4Uphee6IMuQiB5dv5iFQBK43zTImV7MgSd0oSpwpOk/Q1TDbT8XRru/gcMbznO02RyzwLI8yytQpNJIak3kx8+eYWbC2+lKE6xU06tiZ/ZWsjHFMLt+Lx/p3drvLLsgILU8MwFzseMDoupz7jb/VWyzuChHG9cFV3ar5QWjB45BwQzHzUeChVssaHUd7vmzMhnuzRWCn5E4YDqdFgEkbXXFJpZz6OvwxmdmsbUbG62B3GCxALU= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3b5af373-871b-4e11-89f1-08db009dc5ce X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:23.3757 (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: zR6qxdTyKLOfHm6FLnbF2pa6OduqDvtf52J1laoErvB22toZakPWpKyRe5smyGiSmV/URAonip295XGRD8EgKrexgwoXyjFhekPa7Wo03n0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The architecture around the VSC7512 differs from existing felix drivers. In order to add support for all the chip's features (pinctrl, MDIO, gpio) the device had to be laid out as a multi-function device (MFD). One difference between an MFD and a standard platform device is that the regmaps are allocated to the parent device before the child devices are probed. As such, there is no need for felix to initialize new regmaps in these configurations, they can simply be requested from the parent device. Add support for MFD configurations by performing this request from the parent device. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli --- v5 * No changes v4 * New patch --- drivers/net/dsa/ocelot/felix.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 462a1a683996..d3ff6e8a82e9 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1315,6 +1315,13 @@ static struct regmap *felix_request_regmap_by_name(struct felix *felix, struct resource res; int i; + /* In an MFD configuration, regmaps are registered directly to the + * parent device before the child devices are probed, so there is no + * need to initialize a new one. + */ + if (!felix->info->resources) + return dev_get_regmap(ocelot->dev->parent, resource_name); + for (i = 0; i < felix->info->num_resources; i++) { if (strcmp(resource_name, felix->info->resources[i].name)) continue; From patchwork Fri Jan 27 19:35:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119237 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 B8B6AC61DA4 for ; Fri, 27 Jan 2023 19:37:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbjA0Thl (ORCPT ); Fri, 27 Jan 2023 14:37:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjA0ThY (ORCPT ); Fri, 27 Jan 2023 14:37:24 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 976A6820C3; Fri, 27 Jan 2023 11:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nMr8CQmTzqiLdaa9KyLbkydc3PNgNbCLYv8Hs1k0fv2LsH9D2baHEpbCtCzSiBEfWK8/8T31SQPk1XdaYgdr9FUH1uud/u+Dp1oz6581GBPLUoQ3XRjYtD3hxmdV/M9O0bpgew2M64gHz0ApiX4dhIm7iWEgClv0rhJUIK+HS2qRpBLjfMg13x8g0M58gU3Ynfhb51eI9HdnZJXIu1TqUfQNkK69W7eyZk9M/FRaVOy+pKom8ndcZHYjP5EKJStmcx+X1BJ8dBroubopavjCcmKlVpO2I/EyC8vfDuCaSzgySUJmPLcpfi3LhsBs+ERprcL58Iv4J01IrEJQ48JWhg== 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=SlpRQM+SXc9wFoCwHURm3MbTg5IhdmuFZMzYZjzHPbU=; b=FEgqZVewE1XQYsoQSY4oqskpIQLqNOlRhYI31QK/WhyE+Hw08IW4VmMFx2pUvvpineZIhFKI8Cp3zcV7HXKKNxK3xdTiZDBkr4b/l+gsTuyS+QXK3VcM6+XUufnHJ0EClcod5GvAs/1ycw/EPIIVkz1DPzyCT6WrUy+IgPl3I7OdynzyVhTeCzs4VUIm3GW0Ojc5toRDmBwXHhGFPBeQwJcmOUbdUA+sVkvf8ra5dGnh2v9ilZS567jRpmIjK84d3tHseBBjt8uB6kZRzuoJ8dPDmU2BXgLgDCyV5ovf6azk538gOfot2bwZc0Uj2v+saV4lMPYDASG1fYGfkzcqGQ== 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=SlpRQM+SXc9wFoCwHURm3MbTg5IhdmuFZMzYZjzHPbU=; b=d+v2elBiT8jznjfWc24ws76Zt2X5jfBVQI/3FH35b3t5J2lJ0mwqSOuHSdtyvBlsnld5BEKEztz76l5pPTin79ik55X5sod8PWg15f67zoey0sDyvK3JEDOwboFOXE/EQm1l2mllckKGdO0g58hHDG2kT3laxh5EVt6RsvjqlLc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:25 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:25 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 08/13] net: dsa: felix: add functionality when not all ports are supported Date: Fri, 27 Jan 2023 11:35:54 -0800 Message-Id: <20230127193559.1001051-9-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: febab0e5-7542-45e4-a178-08db009dc6cd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1lwAPRD6M4B+wyvYGUImBtcdVsxzTjkZCTh6LALcHCxZ3OrXE3AWoM2164Ca2sbxfK/HzK8gAR+OEQvBhSTyCEQv+l3QnYDpQHSwC+/RzEYcQde4clH9u4HZZT8KhZq6CMSgIO+ypA/Ge1VRQh85OGTJNnaQMRhdfuVBBTQ46Y26DI747Xv3NndWB5B+ET31AgbGNL/e3MrCYl42NO2UemLwydIBCSxuIsOMvuxEHvxLOl2b0AOF9UdZTv4W6s2QD+HShR9TgFBeu2ZKH8lPRnsUymd04K2mZgIvwcVO/DSUxmV7+JPNIZjGlM1q/Wndp2CN6gNfdXEnq1A5v2ejpKfCYn8aFCJeUC1dvpXKo9Iw3Kd2x8HLe+s4Cr/uSFNcb9NLegvKTqmXy8Ju/czqyZ+HxtLOLPjAfidN9pJ90vvcy/fMu5H7aPWyftFLuKEGV/7BdLi5BCTCqgmxA7v5I/9r4SCA0+mUlML5aDq1e1Rcy7A792JQEDBDQb0pqYPVT+iRsQTm2rw5jgEr/wi+phNvTe5S+uYLHWFzfBVw2Wb+XkZWFKrUMPg/JyddS9oPkp3zdQqnL0fbacXuJQjWCu5W8Q9VZG+ppcZHGY3mpb5TOp7TMhCW9T1MjR8koD8pf5NSSJyjifLwgwuwz20sX0UpjV0orbzo03xEnDge1DVEQc/rG+NNaAahm8cUrPVzKgptgnSlNtP4LrUTl2RcnA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2p22+13hOr36gq2WCUY/4OGgn6fLG8+vPQwXO6KUiFSjxy0In8cU93pMozHBvJBN1xtMD0kih+vXlHX657Vzw2VgAuCx9WzXEnp6TZ0/5HUGOBw/HNV0asq/uEX8JeMaXEJZ68QqGFu36h2DwueabHbUYjI9Qy1ZXeOxLhW9A0SEuv1W5RwfwcD2z9HQhUtLG1ZvOzmdmKeYKLQvNN11aRekzYzsvoVNarZ8YdWu7hPy34vvgk3pbBXChrZxxlUDBDRLeqdgUAp5AY1J4vwk0khGiU4RzLqaYyFkeBKLRv1yQVWKxsSf0qW/gh8jJI8cNTJWRX8izykjFoYTrw/EOdgKcPoSp0y1A92maNFCvzbvnfQf/kTrqhRXaNcBTANq4hTBJowCE0tMExs6IK6in6D9oe6RZVUMjD14jhTy9wSEcsM6qzcETmPkTHnwwMIKIrz/ztf1h6XVq5QSk9riBTjcJTtoF657pm0Gp81uVJW1RebAIDi2Dtz12EoEG7UggnBJ9QLhmBZpV0REWqj8dp+pPGnAEzcT/4yJPseHWJhXQRuCuuaCuK7EcIO8ctu5K6QSIFwIpIfWgzyk5y/AGPo0iXvaqR4Uh41CduSQZ6Q4E0p+7jK0EPLUs3CJ6iz8k+c3QTk+jprwYYn5TKyqB/qKvUpzow3T5MYmiOjY0u+JadytGGuGh55jkCEuovyZ9JqHYYCaD4huDzFw1P3FL/uMe/ePqrXf1B5C0Vfn56Hc6jk5C6nOIQLXakD2hTllGEmc8cTHB+bZVLYQxc/rGukSUPsQN8qkNrl2o6csLrWIdvazNhjX3IAnN2KaqftQiv0Kt22mA+/E6b229l+o/ywuvdAfAJSPFssO2N89Jn1K2gCtqJJIGHXrdNhz7itgQF8hURt2lu0LBDKV/IYYX1eIIcMwKROikehi+YjNiGBMXnYkYBw/3Jv1kThpePV0znroLs6ycrF+oQxLLIgmVQZvFRRNzCymCY1BvyxJuMFoSW6VZB2yf28vPZFQ4Rw0T1wwQQZqnImdfZHGEBgEwNsKXgyP1az0KMm2tuiBSeUJDSRm5g0JocAF/LWRmKdCIP3eILZ3pr25B7KFPOZk8cRiEB/YhsGcpr7dkaoiOAKsClsJOWU1vmgk9VZrXCwuN0B/nnadEgUJoOO1fWDR3pCJvRZgFgnLwu4Edkhgwg1LxsbPWQo2ITGzxkJK8+QnhlqOUpjJDUtmly2CsaZ9dl2RAiKx/IAyiHfl5AichAuu8WZ2POAuVB1iFtanPtciV/OfOwIAraq6wWy2s9YZ7pVio3RaTMO//CD48tUNyIoxB2wE+0S/OVqVXObDAwzx80mjHHY1sl3lBJUzWj8si8xWDI+T1G5HQzcoyhuYs3jwHodO0Egs1Reh8xrViSXOtgqYvGlJu5PF0WkKQXcPf1s4toTPDL5StE438G8XhhrCL1SbjS79QNWEhmQnvPHrNXuecHkyOxclS5ftqHt5+q4RiVjeCXP7tWa0UwlLA+9kKIkPlY5/ZLZJ5UyWudghql0mcPwZ5bOdOl6WqA9J43F9BpJ5KJHZQKCK5AJE/hvG/49yvpRbbAxIJFVcjFUKGhcQYGbyPMewsh8DtV0EFPGud3NLJWtOahjpdIwfTFo= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: febab0e5-7542-45e4-a178-08db009dc6cd X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:25.0474 (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: lR2ve3vr+tiCpephI7z80is+NijwhaxEcB3TUELbAuH0x7MJAG9LjLwD9+CSPTXtx7Gwl360eLubOnqMUNmWx2C3ox89AptNUCRoKv5r/bs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org When the Felix driver would probe the ports and verify functionality, it would fail if it hit single port mode that wasn't supported by the driver. The initial case for the VSC7512 driver will have physical ports that exist, but aren't supported by the driver implementation. Add the OCELOT_PORT_MODE_NONE macro to handle this scenario, and allow the Felix driver to continue with all the ports that are currently functional. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli --- v5 * No changes v4 * New patch --- drivers/net/dsa/ocelot/felix.c | 11 ++++++++--- drivers/net/dsa/ocelot/felix.h | 1 + 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index d3ff6e8a82e9..d4cc9e60f369 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1273,10 +1273,15 @@ static int felix_parse_ports_node(struct felix *felix, err = felix_validate_phy_mode(felix, port, phy_mode); if (err < 0) { - dev_err(dev, "Unsupported PHY mode %s on port %d\n", - phy_modes(phy_mode), port); + dev_info(dev, "Unsupported PHY mode %s on port %d\n", + phy_modes(phy_mode), port); of_node_put(child); - return err; + + /* Leave port_phy_modes[port] = 0, which is also + * PHY_INTERFACE_MODE_NA. This will perform a + * best-effort to bring up as many ports as possible. + */ + continue; } port_phy_modes[port] = phy_mode; diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index 9e1ae1dde0d9..d5d0b30c0b75 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -7,6 +7,7 @@ #define ocelot_to_felix(o) container_of((o), struct felix, ocelot) #define FELIX_MAC_QUIRKS OCELOT_QUIRK_PCS_PERFORMS_RATE_ADAPTATION +#define OCELOT_PORT_MODE_NONE 0 #define OCELOT_PORT_MODE_INTERNAL BIT(0) #define OCELOT_PORT_MODE_SGMII BIT(1) #define OCELOT_PORT_MODE_QSGMII BIT(2) From patchwork Fri Jan 27 19:35:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119238 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 C0E43C54EAA for ; Fri, 27 Jan 2023 19:38:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231571AbjA0TiJ (ORCPT ); Fri, 27 Jan 2023 14:38:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231587AbjA0Thl (ORCPT ); Fri, 27 Jan 2023 14:37:41 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F1F386621; Fri, 27 Jan 2023 11:36:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AbKRq5SQhYeW3uD5SzgCpZgSSzPT+hCV5pJWUpyfzGr27gLBELFFy9X4kF1qzLU4YVi7Qvun6YfsXCydngnMSIFYSZXBTFcku4JemaHLYNQIgD1OW/1a6SDA6l6w+m9Rg8Rv/dtHRL8vXLNilVorr8Ziw1J+5O+n+jKRoSZBwG2Th/QQkMp0Ae2zwyio4/Va9bASfCqtcYcl0IQNU0ESMb30O0j6YYADpFLdrwGgQPwmnHjICgrn1VsMZfxvZBtaLHum+v88UDnpdI9MPyfDuQHActIbKWe+QCj3YCNLpVUw1oF8QrUhXIMqFhJhJSGA38wl7DARSvJTC41QXpBTTw== 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=9R2qCwkAvCkHMATQRZ0qgLrZkyYVSVzoDygrgX9ZDWw=; b=RCETiVwYWTUWS4ohRJ1IDmzopzfbkNJQSxzzxDdIvFS2ZejMwCP/FkAWCbDzrnGkic7eLxgaOej6iR9H7l/ZWsoXwWX2LRsq5JGVALVaSoxFhpgY3j1BlOYLrY/OLX8p4nLibKjhX6C0CauOHaisQ0645/7jxQZK1rbF1+XoipSFU9VsDXc5v9BJptIci6uzBzWGi9i2fF3DXcrrPh1h052C40ysRALyuqFdzSAHirs8ne87tZ7FZ34NavgpIdLWiLz3dxPAohzyvUQNL3T+gO1XHse0IPS/DDEbO/UgdU0uWO+H4L3Z2lUg3VqAEXgfafD+pH2SEckaLFWJuDR4Yw== 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=9R2qCwkAvCkHMATQRZ0qgLrZkyYVSVzoDygrgX9ZDWw=; b=PqqkiHoqd7TaWXPXk9+D2hL9GHjx9NpmFlV2v2kIVuQLoQuP6xtRyAsS1B3cI6D17SU+XzEjCVy79m2aLkTkv92FKwFBfddR6xhLA3uo3cuP5FXyRi6VQ0ZAu+GQRw4a7i4/9qR3MDwKxRrGg5U8h+bPdu21jCZNxVWcHNCg7YI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:26 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:26 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 09/13] mfd: ocelot: prepend resource size macros to be 32-bit Date: Fri, 27 Jan 2023 11:35:55 -0800 Message-Id: <20230127193559.1001051-10-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 3cf63c3b-812e-4936-1b54-08db009dc7cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UxHNWR4oxz+FPmplmWN710D1Z9waVf3p+hZakcq1fCNDoLkLogdzSITKrRYthMiMLSX8wUnA+Lx6Wyj5TI9YJwTWsMkjNMixvRhGroqxGXAo+8e2SdytODHUvRh6H68jJm2yw9wCtA/6YtzpyH3VDVL4bO08UxwD4jIFdcpQHW0HafO4a6rhKG0lDBoV359YgDC1Jwi4+8jA7rkQBj58YKSuEzfu06jdX6YrlfcEiZW5LoO0djhPlA+KDCElWz1p5TGo0Ot9HC0+1V50z7q6dbRtsQwKbvP7BpWOggRZ0wH90bOKPqNVY/1KtZF8plnVU/nznDBaf03OdnGNxp/2QVCHQNEc0PhGgdzCsXH2C94TpKT7PbPF7EqJdPeYkcBZIMeWDyKbdgAUUzRJWWFDLTzpyk1JuOshfBMbnB7MQYUIcQ0THLjJLsoC+yJYMoyiE2rJkI10gMm6ZQJYvJa9FFhVKlgXziRXYN1dR1TEFPigFczKMYupt4iOJXoZePjZ81XjKjxsVIetCaAwhWoW531U6/XPckg7P8gBrPaxbfBHPadRAsYtXfyhnwsnQrBE/M/zOkGwy2Fc1iE0RloGwnqC27dhBeOzZHQl3JDSMMTA/AGQKoo0NsZ0rtP6gTWHjbBBsgW/7XOixDsmQa+O6NT2wVZvQuWeMzlKC5+eih3RvilRoZ67uiLg/XAFq9iNuZSOeqJ/cIiyzYCkkUgeog== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wxA/LVZUV7gX/sRmzJmBLFYFV4dpwR4sGtEtpaHNLFHAvHCQlehqBEwaEi9823jA5r+g2/7q/47qNGN3FDg9GGzfNtjlSgxdE7q4rlT7wejCitlp4yL0Y764sBFJbvL0BXvSLYXgnlJp3V/ODeriugsEXBcUjH1b9cVdai0bl5xAAN++t3WvG4UsDwtkQGCaJcQUmtXLohAKN57G4DZB8zOsI5zxYeKutPLW0xAExJjEVY1bcPFg2mgclNALaqsg6sGkSqSGdlbmq71qUTeXBTlYQzh7JOVIcO2NWxCNFLu05u4lFrbVOo9SMTlIftJ5ce2zABNgUZj6kOj1QbLhDPyP5y0CsttG2yHRRk8cmTMTauRICMOV/3PlkXqIQ6/ewnIAww5MFpy5+mBheJ76vh9dPIX8SfgbssKetlG5l3mAd86XGFknWkuH4kK+nJ8pLO0AyIMBm0uNB6yiaQ+j6GcHgjGOrP/HsvQeRhoaz8Ps+vncRovhAOpgNuhfhJ+V3TCp6K0JjbaIZSM/CtvJY1kNLlvW4YDTuIjfzuUNOakCqwLFt/G8HoJesVhEjAs1cJYSF4FCmqQrBXii5b3e5MtS8O0lBylnuA384vFA9+H2C+Zru4a326CBXtELILxhjfe2U4h1YRmx+C+dBA3x91zF5KnaiYFjJI0tXdjmUiOKQaG67Yz+owHmGqumvu/bO2Y2EQqpBOn1OY8ipfJXdxHXNmqbYVrY5vKiofEU3vvHC4bjzFV/oCFUlJC4j4UruWzsKiBAxL8SibZYTPatRXRrb4KNYhORyYx2XPTzPws2IcpfrhejhhRAFu0GGlC1CLpS9rrbKKlBtvgs5mM8zTwIbaHeDLR7Dy251Wc5dhQ/jRSWZF1AQlnZ+0I/mEOFw7UPUADZfWQ8+6m/aqAyt/f2Cxh4xjQPhHuCoVuhhx/zetNrh4PDMb1dtYFZgdeQgHs6VA4OQOKoaq3jDY/Z1WiLvDBLYIe38YWkrJlUeEDWVreB1nC+7bPwz6OmqbW5mVUYL+JeXJHDPPuDBles6L2Nxxiwv5qzpAvmuux+15hB6SkZVELyKnTzirjgi6pKVV49ZpdoTkaGtt2uqsJbY7M7eISNtQ/s49lydsWHKlFs8+RygtqJyt/T7uUZUnIphVzR4fFPllgB7wWExWgH64NDpu66fV4RM7mFDjVffdO5AYqZrQC5n4+xW5ZzVUjL5T5j724xvqpWyRzko1GhRUieR0mRSwq2h5YG6NsO3awAKU8of0vhihWaLH0ltuG5rQ679g57GWW4Wa8+qwR5SXQrY0wmqA9ouw0flRD7yKboVSBTkZ2LSVsrbrCx7dXmhJhMtLjMc5HQksE7mGQLMf1KEvhbn2EsL8J8UO4dZuDsHQ70NakAFSFM1ia2Xv0OptcNukxmr7f6BmHJqVypCBjaER8c1D5/YcA0mIfhdvCTdwWHKFUTsnRyu+50/D7HLxGzEc7Q4AagLbHZ0jwO9pS7ASaWkVDF2hOnq9DQWPwgRbutm1QPbiV0kQecsfnUyAkyW8PeOxnc7Ip1ULqfFXY8M49J9kQORALnJ/XWGMCwMpyoG3lYC7Zgms8xsDULKbXUbqr3K11cBApCNbuzl5ZvPrOyaYvRqCebsIq+sSA= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3cf63c3b-812e-4936-1b54-08db009dc7cf X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:26.7348 (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: 1TX7Zo/hnhxp2QXPGYhPzLlWqJ7Qh0GwAQBSK9iwyuuNPR9K0MxKJyfg52/j/jMb9ByUolhK7fJ0xzpjdoFwUUv6po2uBi7+HH7/4H5sr9U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The *_RES_SIZE macros are initally <= 0x100. Future resource sizes will be upwards of 0x200000 in size. To keep things clean, fully align the RES_SIZE macros to 32-bit to do nothing more than make the code more consistent. Signed-off-by: Colin Foster Acked-for-MFD-by: Lee Jones Reviewed-by: Florian Fainelli --- v5 * Add Lee's Acked-for-MFD tag v3-v4 * No change v2 * New patch - broken out from a different one --- drivers/mfd/ocelot-core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c index 1816d52c65c5..013e83173062 100644 --- a/drivers/mfd/ocelot-core.c +++ b/drivers/mfd/ocelot-core.c @@ -34,16 +34,16 @@ #define VSC7512_MIIM0_RES_START 0x7107009c #define VSC7512_MIIM1_RES_START 0x710700c0 -#define VSC7512_MIIM_RES_SIZE 0x024 +#define VSC7512_MIIM_RES_SIZE 0x00000024 #define VSC7512_PHY_RES_START 0x710700f0 -#define VSC7512_PHY_RES_SIZE 0x004 +#define VSC7512_PHY_RES_SIZE 0x00000004 #define VSC7512_GPIO_RES_START 0x71070034 -#define VSC7512_GPIO_RES_SIZE 0x06c +#define VSC7512_GPIO_RES_SIZE 0x0000006c #define VSC7512_SIO_CTRL_RES_START 0x710700f8 -#define VSC7512_SIO_CTRL_RES_SIZE 0x100 +#define VSC7512_SIO_CTRL_RES_SIZE 0x00000100 #define VSC7512_GCB_RST_SLEEP_US 100 #define VSC7512_GCB_RST_TIMEOUT_US 100000 From patchwork Fri Jan 27 19:35:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119240 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 2ABDEC61DA4 for ; Fri, 27 Jan 2023 19:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229742AbjA0Tiw (ORCPT ); Fri, 27 Jan 2023 14:38:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229737AbjA0Ti0 (ORCPT ); Fri, 27 Jan 2023 14:38:26 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::724]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1178E83043; Fri, 27 Jan 2023 11:37:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SChus37wt3S3OUhrVAsYkkntgiyPxoGqoZCAcxQv6tsIfXLH/BN+BNq6wV+yVy1oMuz6PpNQSaS1uOfPPQ7+JcWKeOF8JUEDVbl9djcSSHRUX/UbdLzH0skI1qIi/zGz79wX0Ap84V3qCCUtMFIWBJ6xo5dJejxEeuWcAan6qTwHSy0aMErujo+e9ZxENS5NHmToenfWRFXmXmYN+tVqPrOTH9Eak19e3tA/RRPTU5BbYeuMEDRy3HiVvMNhoKEFMzXuwtxTeOTnsqpcZ7ZEGUq5KJLB1Br0zSWTRZrzGP0E6IyOi6ynYuGoGJtlyZZz64ESZqGojDExildHRjip0Q== 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=kSo1894uCctiM+9QIhhTWhfsqGu/wViz5Ii3s7C61XI=; b=XAPWpUQnPSBtZmePy7TBYA/Fnj73U0c3CV7l9+WCWq09FIJbKCkR+yRZ7ywDBYkTkVuTnIAl7TiM4ciyqoVjoJmccS9Hit3DfkbXQWYxxmMC7b8KYlPUf0N5GE5dTn5j+UaERK1pQo9NDlSMMixK7hZxVof0vmb8a1HbadtWFUhwOC0Ry2C51qwfHz5juhLv5mg29Qpz2vJ2gSHQQLzjavFPDlRhhEtC12kOMUOnfgRgtJYJta9HwXjGVt26NCu3aPcDtG1fRBHGLMSRW5qR/mnubpEQfFzWgthRLU36RN8dcTRuOVEL7ZzlY/9Vj262jrUJhHQGfZN4gZKEcuX7CQ== 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=kSo1894uCctiM+9QIhhTWhfsqGu/wViz5Ii3s7C61XI=; b=wQaO4nSj29ogbG1mFHSdbFfbuT2YKjNmH2te3McvdGjF5ycY/sG8JnIQchwFtuCUB0Bb2H5eRpjVXYy9e1jjRAy2EzlvxETtjt+9dUsfofzKTQUGOr16boGZ+/Hzr/GfaHENg9Sye+1wfxv/NY1MeomgTJm9JgYdvgmda0mxbuE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:28 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:28 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 10/13] dt-bindings: net: mscc,vsc7514-switch: add dsa binding for the vsc7512 Date: Fri, 27 Jan 2023 11:35:56 -0800 Message-Id: <20230127193559.1001051-11-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: f9bb4e86-2fc0-4630-32d4-08db009dc8ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bNXWJxebKRUeRb2+kuKDTOheUZ2jeUzfHN7fFsYRbKQyjr8oMlNvjJ4sZN4cQ3CNpxZS/ELRECsnWnfXr94Fu+yDPg47JqGNXcHU+LrJrykYA0/ZKCWj4+GMNDk/n2h07E+OjIS2p5+YHHrAMWp+SoEcfoO3siWfDban6hsr0L6dYv6ympUdu1t62wp4R17Jnbj+XwsE8I74/S5VPS5Yp8expEStFo0l+tcZMj15TaARi4nfd5LMXmEotaYLWi89RodOtRitintYTE0gcg4kXRfCOvX4B+FqSdgF6I/3cTWuv2NX7H03CZOkGQitjay+8L0trwIgObVf9fMSumrLFWXNoso3Vo8UZOH9WFb+/kmll7LGgveqsO71SnpV/r10E1sT53bRkunGPXsAX7dAoZRbZqUjG/7lH5nnK42vCIg2ZrofzNpsMILuwHO9PNubvNvLHJWGmF4h/sVJwQ5pGcHu29VTyZ+L1Va4PABrNOJI7ZUu4qpUZydOtLyAzPNAYxD/Q7QJZVPCE+cn4/KcBfq62FdJOvU5KPydCFf0v02aMnF7wPY3QbjstnbKZHL4mJ3GWUQMEk4UCdyv5A8dl88RKUpmq1dlg6NUQrnAaMi4W4lhA6lZ6YckGGhetKbU21yceor5FjwzAb2umYJdBYR34vuk6/IexnIDtIH7wpo8JKAc9poZQpUFHlLMZnyQ1kMFXPzpLTA6pgvbjehmTQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5fdmlUz3MnLqyvQ9gbY+GAFWzIOxYLIAtXvc7SeuQV18vXzuhhscpoOZdYya++6cmvIOLLiWqtgf25W4xO27AtvIGrIMWFAYC6mqXAYGQ4iX7dpMpnJXq2eHhu5/a+NTe4NwDukPp/8HK0yoTC3+kOF6DYftKz021WOIsY4L+ckDgzvsk9VYUoSdl2+LKTybHGrHtsWZnbWl0F/bncBIzTvFtalg8kxTIv3ocwXP4LbfaQvAFNBgpzVHJfr4TkMeMuRWs0HFMMFdBHfiNhKnhM2Fil7PJnBsfgXpWxqqXxodH+FqAoZsjq9kc5yRiHAjtlYXuSBlDqAQqUwaDEFZl79NjUC//baK2ZxwSXZO7hj/ye54IPDoZpGw65Nv/T2PVD2MphAinFk/DrmTH7gpvbnMErHMzwaazC/YbISkqYGZTs6G2Dkp/yzDyHTuFJZlhSmftVUPrqaFFhJpf40C+4JzcSfWieK+rO0lKo7XOAE5IVDH2mu24b4q4guSnWSSyTpSTAw3syyYwIJHbckxiPsNQOei5NjtOcp1MSIyXtYBKEAJ0+fZzTdQfZVC6215KWcmx6KiBw+z9QaIw6Ri83/KL89n20wZ9qT5DGf1gKJyfpdvTTPb6mAiX576ZRa4zViE86PJ8Nw1SZUE2ORc/nfNeB6holGXBNsovz8Zs8pbOBvienWEeRMYUr7IpvDnRtx3mN1NXuMmRVmlC27E8VjDqE+2kb3YtC6qP7rgb2RbaQCAobLV6zT17uarV0CTrFa3hwNrErrS7hT2G9gFN7u0h+3cVfqaWp90Lk22aabPumm1hTurtNMOGdDOtYnL10SHLw1dSVWY993EI9EHxli2DpleNm1UL7eiy7E6NH14dZeV6buf7d37+d3oPaOxjj22R3clqoPFFYgc5vmT4n6E1Dq4gGjjusgB4Hpy1ZuT+9XmdWPfyI1YmC5XGf2A86VgSvPkkhmgI3MkFABmd/mO4rODQ7RjFm+kq89fKzhge9hWrIHkHHzxblAXFd/aH8j6jhA8MyhsdMM2IrrQkpetxL0g60Se/Ov4x5OJNYa/QQWwI+fznAZ92wdUVOMf2FPHi85wq7kPHpV5OoB7Ju35gawEAyHcWnetMjcpltMDnLMxQz2k2bTPEsGHT2LIlmWx88INNIED3eiwWbBhLNDhfp6fgDNJm9yl5wL0rLCsTdqYzEFABR9oaTlPV0T0L0bNtrQBa7L8Aa7+y6AAS0cq1pKq+41R3nJb1n4u9Sz3REQiCPEp2I5cHBiTYcFOVvPwc4GHBVNJmoX++r4Weni1zzcRII3/38ZKIsOBhc3S9xDzYOfCxBaA7HLPBSV6150IpGo2ziH0+0gGxKHbCcWxjQ/vqUKbtbBDAIEOc0MxEb6UfNRzoaF4sSc7m33w6qSOeXADergEaeiSxyK4DiXKX75e68yL9Edt7BHmmVQpBMVrEj91hRlqX8b1FGIXPtSUQJsEnQ5PcF5M3MCO+a/wbcVdOk/SoBGbVs4BvBVzvVTP4hSSN7Cdlhaub3gkgP6pRBBVgcfz4uJE+fAoZvqJjVtLH11EM2kfZBhO5SZ8Nu8qRw3q9HIH+FOL4MeKinRuO6ybLsIU8lbnUq3yiJi1OkpL+O9rukw9GE36L5M= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: f9bb4e86-2fc0-4630-32d4-08db009dc8ce X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:28.5941 (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: P5k/GgYaa4QH9kQAho1+YK1aKV5eV2ejYkYE4ciGpLRqcChW8ngLyCVcmBSgpxyscCCAnvdPPcaV1GNeAZT7hd/BfQtkjJXlH2EIxzYUh4M= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The VSC7511, VSC7512, VSC7513 and VSC7514 all have the ability to be controlled either internally by a memory-mapped CPU, or externally via interfaces like SPI and PCIe. The internal CPU of the VSC7511 and 7512 don't have the resources to run Linux, so must be controlled via these external interfaces in a DSA configuration. Add mscc,vsc7512-switch compatible string to indicate that the chips are being controlled externally in a DSA configuration. Signed-off-by: Colin Foster Reviewed-by: Rob Herring --- v5 * New patch after a documentation overhaul series --- .../bindings/net/mscc,vsc7514-switch.yaml | 113 ++++++++++++++---- 1 file changed, 90 insertions(+), 23 deletions(-) diff --git a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml index 5ffe831e59e4..8ee2c7d7ff42 100644 --- a/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml +++ b/Documentation/devicetree/bindings/net/mscc,vsc7514-switch.yaml @@ -18,13 +18,52 @@ description: | packets using CPU. Additionally, PTP is supported as well as FDMA for faster packet extraction/injection. -$ref: ethernet-switch.yaml# +allOf: + - if: + properties: + compatible: + const: mscc,vsc7514-switch + then: + $ref: ethernet-switch.yaml# + required: + - interrupts + - interrupt-names + properties: + reg: + minItems: 21 + reg-names: + minItems: 21 + ethernet-ports: + patternProperties: + "^port@[0-9a-f]+$": + $ref: ethernet-switch-port.yaml# + unevaluatedProperties: false + + - if: + properties: + compatible: + const: mscc,vsc7512-switch + then: + $ref: /schemas/net/dsa/dsa.yaml# + properties: + reg: + maxItems: 20 + reg-names: + maxItems: 20 + ethernet-ports: + patternProperties: + "^port@[0-9a-f]+$": + $ref: /schemas/net/dsa/dsa-port.yaml# + unevaluatedProperties: false properties: compatible: - const: mscc,vsc7514-switch + enum: + - mscc,vsc7512-switch + - mscc,vsc7514-switch reg: + minItems: 20 items: - description: system target - description: rewriter target @@ -49,6 +88,7 @@ properties: - description: fdma target reg-names: + minItems: 20 items: - const: sys - const: rew @@ -86,35 +126,16 @@ properties: - const: xtr - const: fdma - ethernet-ports: - type: object - - properties: - '#address-cells': - const: 1 - '#size-cells': - const: 0 - - additionalProperties: false - - patternProperties: - "^port@[0-9a-f]+$": - - $ref: ethernet-switch-port.yaml# - - unevaluatedProperties: false - required: - compatible - reg - reg-names - - interrupts - - interrupt-names - ethernet-ports -additionalProperties: false +unevaluatedProperties: false examples: + # VSC7514 (Switchdev) - | switch@1010000 { compatible = "mscc,vsc7514-switch"; @@ -162,5 +183,51 @@ examples: }; }; }; + # VSC7512 (DSA) + - | + ethernet-switch@1{ + compatible = "mscc,vsc7512-switch"; + reg = <0x71010000 0x10000>, + <0x71030000 0x10000>, + <0x71080000 0x100>, + <0x710e0000 0x10000>, + <0x711e0000 0x100>, + <0x711f0000 0x100>, + <0x71200000 0x100>, + <0x71210000 0x100>, + <0x71220000 0x100>, + <0x71230000 0x100>, + <0x71240000 0x100>, + <0x71250000 0x100>, + <0x71260000 0x100>, + <0x71270000 0x100>, + <0x71280000 0x100>, + <0x71800000 0x80000>, + <0x71880000 0x10000>, + <0x71040000 0x10000>, + <0x71050000 0x10000>, + <0x71060000 0x10000>; + reg-names = "sys", "rew", "qs", "ptp", "port0", "port1", + "port2", "port3", "port4", "port5", "port6", + "port7", "port8", "port9", "port10", "qsys", + "ana", "s0", "s1", "s2"; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + ethernet = <&mac_sw>; + phy-handle = <&phy0>; + phy-mode = "internal"; + }; + port@1 { + reg = <1>; + phy-handle = <&phy1>; + phy-mode = "internal"; + }; + }; + }; ... From patchwork Fri Jan 27 19:35:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119239 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 CD241C61DA4 for ; Fri, 27 Jan 2023 19:38:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229700AbjA0Tig (ORCPT ); Fri, 27 Jan 2023 14:38:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbjA0TiT (ORCPT ); Fri, 27 Jan 2023 14:38:19 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2106.outbound.protection.outlook.com [40.107.93.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6F058A557; Fri, 27 Jan 2023 11:37:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=e7atpFT0xTmf39gzKjGOlX+EsLmkfU17dHTYU+s5EktfnpreZZSH46En7uKN2ZQO64Q6N6qa/J8xJXv8HAz5qULaquZNI94DeTQNBaZbzKV90nOpJKN2x3nFEyoscTd8LzYR4hiLd5OJ8LbcxJYRKF8PJvHV5xltGgcPsLCwolq67yVVzggs4fNYhXr3gBX+FkdcyaXj1NR6FqltQjnihYWA9qv9cGHNboHNDgAmX14Eeu+0eDP4H5kGQk0LJgqkSKITpt5dn7wwvj9MbqJDRGJD7t3fyySDgn0Y4QOqC2I+VnOoE8JrSpIdfbfAb1TjSgUbMXh/rGOEapu6IibV+A== 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=RdhnVSCLNmHkgWtUzcrvMxgOXOh7kZaU3PvxcLyzANo=; b=B+J5EVgckdzDNjznYxfyhT9hIvEleurbbifQLPExjn1vO6pb7nl5b27QbXQlucbeHgthMbuXo1RY6pdOlZo+yP9MWFn1pOww/tJX/NLQo2Lp28MjkCKQH5uitZXd1XW8bGgIo1jlGPuT6fbzB2xFpHNQVYWyf46dA6aXtejKubVoQ3H126l/mGsqVI8F6xOiWuBQjl+obRJqehmnhWQvZj8sBB8RiH6HF+F70NpkFDkehJ4Dl2TM7bR06GG6lFL8BSRlLz62tGayRGuWj+kkEQd9FCNFLeCHNugRl8K7ZJJ0muoxnqWNz/rUcJJHacIP2im09P4+PYG7f7jv8VBN2w== 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=RdhnVSCLNmHkgWtUzcrvMxgOXOh7kZaU3PvxcLyzANo=; b=ZhUlGlGMd5YJpW7bjwScl5W500OXuuXXj14Gf40OTSaBrpPHcZdV1JCPQPy18h5G+Mh7Eox4rvuThnUEXJ/WwQg+SHDkQs3BmOQFyf+MYN1lA3i+dq+bzfInGeuQqQRl5CyOtWHL+IGVcSawTwKvT6hjp3qnvN1fMH1X/ZOUBnU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:30 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:30 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 11/13] dt-bindings: mfd: ocelot: add ethernet-switch hardware support Date: Fri, 27 Jan 2023 11:35:57 -0800 Message-Id: <20230127193559.1001051-12-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: 0ca9c652-f4d1-4e2c-d1ad-08db009dc9f5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: z9cc7cJAXn0hi5m/oFOjCFCuf91vVdYqP6aT7HSWp6kh8HKtxkHOGAy5httTjXTHhsyTSrcVRTPbDZ0BH6SpUKYsU0mXDY0KO0l0Vd8uYY25i9SUnQveDKyIbNCjRrSlNWt3mQwu1RijUrWBRTBlM3n9PV0YPCmPCpRrXmKPMbTJkOVzNZaRdaoU8tzbU9jpXnfLtPWs7KrzayC37F647sPdaGvR9Fq4zXJywfWN2d5uuv/5n1uRRUoQJf913NuMAIkZ4gcCdWlbYhMjh8jqFhuGQ858awpM5/kgEhdfkWiWONsb3CNKn7pp6yS7M17+DUnhvwa+Cu2yith3qJbk9iCCTTEWBofuaajb0Su3P/VCL0uAq9F8+l3Vjk5f0NrwcoTZGGMOtbdtvuttdVP6/h4jS0wm4KxOwe0DB+oDncyBEOtdvYO34CWP3QZAD2fICM6mepjvrd4NXmCp/JqFtKLgpq1dPkFPj34/oILBZv+XAGfKgmnpw86QXJWMBE59/sZeqnekeqcndIM5IrA8fFU8C6DhgAASCHn2RHGFVdy9jcwd+AxNrOTcqWtfqvO1FUAPCN1MRwe7cXdFapElkgSrFptBUGObNNPB9JUmqC/ba+h/3YAIuBg/oDr9liIroN9ZxNwXELzxBJSh2x18ywV2rAcj46Wl2rHvNb4TjxremF76hD0i07JM+FxKb67MRWSJLYCQm3YjDHeTVdojSg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(4744005)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: mrG/4MMMcUWqWKvNnvFJHF7WodAItmu4VydDgX1HaFw4BJ5pBTrUpd50dLBdcjMRxACDyE6MHc1UMrO8HYA7vtLBiddBZfZSYJf4pSnqW23gsXxIPRGsFZ2BnEr00iuqtuqF6Seo5YPzwy4dYntQOBM3N31iZP6Yy78aXpB74eAQnjaWuT7pdYf9Y/8ov998yNmGfcf2aFoJDWTy8bybeyYPhh645jd+M04+kpmZM4AQ+MDX5Jbz4D7/gYWWVRfoPohUAJrp/3mTwov53NullqyIRbOkXaxz0Z7Fa0ui3WVELIVHZ95PjbbehangqoVvZZ+E1R6z4unFJ15wvUtcCsczeQ8BA+AHwhmeDU8lGdCUuQdrvBgWvJ08T+NNWMujL8D3YJ/5GgvKemPP9cXkpxUCGTB9bLMhL4jtCCV/qAD6R4wk3QOImvktjgqCdueN37Y9dcQLSExbClOCLkSkl+JWlecQk2J0u+wFKc0nMMvXKfGnKFP8yAb2BTlDYetduz1QLKQPbGwAh/6J3XCI3bRQjAyJtls7VgN2KUtnnAGlNsoCPiP/P3anUPMnEaWEsYyf1Yg8ZZv7GDhFM1x88JosYfqmS+RVwQpa7ssIKm+lujhLO5aws5HvEV+fzcCZDFnWmy0whmI5nJ12UOWf/d/8Q7v0leN0tfiV6c/II7iWuAAIWvtGzPDhckB6tYuF5bXq6dJ+LXBIgKyYO9xtujjBIQZoBc5PVZXq04Wxp9Vsu4t3LHuXnCB23UF/Ia3fnemfzQpHdw9+WHazhWRqmaBKRXqiejt3kDbq+HhWcs6PVFviNPv+pkbtE6Oam3GkLxIWFLVEui7pxkA0pwMxwYGnvczEJH62gLTO8qm17/QMfA3pK0CpywlYrfRPNtczmO2LTYpFBCbIrZjFJLXtpyqhR3Y+RvLpKnQZ6YXDViZQJUPU3j4s65ZodE6R5SgvrXKTyjilDf97yYG4LjzXn5+p5QPKka6a+zudYpeqlNxJliF/VLeQeAObPcH5Jrf7orMxztxuRtYQ5YjlHTdPIgXHrcvc04XbyhuzCM9YBM2nEwEFT3uazIskil5wG4EJqsB/mv4gL8Ja2ScWAiMAY3LG7N4gY2RYy93Lm+9S36GlKmqY/F126n0g3hCYK5PzwJ10rghe78tC42knCjBNy0p4ytvVAh41YrdrOA57k3n5yl534eF3axfMrsYoNe0bWOmBFC9yvCCG23f6w8kE42aZ2pYF3fdlxfsiucSJqRjf1vIAIf8vZ5nVVjvQRe1yzIgBMGitO6SRkg/jsXsOOnvzgqlfgDgpQFelHXmj1asuUuzu2JthSzWWKR2RHU1qWijI5dxs7phMYYt1a70Lfe1vAsw0VWG39egCYciivX5zwOHFTQa/YxvCMjpgSUC0k6AOWaRDcRdKIe3r1tCjxeqpc92nTvoow7HMTeGD2dRT8Het/gMHJhj2qlzHoJf2RVG+XuYukdP/OeffTCVY22PrVy3T2KtoXFYUVGso+IkJ9d5BQb+pYkiCDNshu6HsIO9bSKBFL5sGNd4/mh6Mu9mDtQ7iNZYC18xe8lv4vMSi3tR65ywV29sGYNdeIEpGtYZkt/XyVWz/j2XcSvuo9Dp39fLoeosN3PIcKmIaX2k= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0ca9c652-f4d1-4e2c-d1ad-08db009dc9f5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:30.3440 (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: 2LR607aQpoDuhaGtZKl9lw1FzHjBkuwLVz/KBRzFvjiC2HWUiA7xkSrb6zXsU+dnuIOelXFAjuq6zXPRLLRARJu5XwTUNyzfcmWLZ/7rmSM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The main purpose of the Ocelot chips are the Ethernet switching functionalities. Document the support for these features. Signed-off-by: Colin Foster Reviewed-by: Rob Herring --- v5 * Update ref to mscc,vsc7514-switch.yaml instead of mscc.ocelot.yaml * Add unevaluatedProperties: false v4 * New patch --- Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml b/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml index 1d1fee1a16c1..8bd1abfc44d9 100644 --- a/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml +++ b/Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml @@ -57,6 +57,15 @@ patternProperties: enum: - mscc,ocelot-miim + "^ethernet-switch@[0-9a-f]+$": + type: object + $ref: /schemas/net/mscc,vsc7514-switch.yaml + unevaluatedProperties: false + properties: + compatible: + enum: + - mscc,vsc7512-switch + required: - compatible - reg From patchwork Fri Jan 27 19:35:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119242 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 66589C54EAA for ; Fri, 27 Jan 2023 19:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231475AbjA0Tjc (ORCPT ); Fri, 27 Jan 2023 14:39:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231486AbjA0TjD (ORCPT ); Fri, 27 Jan 2023 14:39:03 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::724]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9DEC4B748; Fri, 27 Jan 2023 11:38:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bK2A6sgby0ITNHdZTsGZB9CyJ/tg4z8xz3yPT/HWKUamh25cKVwcztQb6dB0VJmI23hjvJpDS5AAkbv4YSp+lRpwOWVZPuY+SvARVCVxqHQkw9GVBi6SPWWXelFJJPBH4yWHZVuWVNvnP6V9wnG34wAUc9WiI+ETQBHZQRgw0pv4LVfpKTZwYkiJqK943qxLKGs97IyWPt3ss+x1DhVdZaBQ/6zr6xjyx1RCHOXgOn6K1Abk1O+1gdvH3M1Xz/ktC5Sg9I+jCEWkSZOghfFTZskzt2fGFGw5IDUcwfbunJqxWs7tzZ9pid1gooqF+Xl0sYgirjZbGX9r4tOWJ73IIw== 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=E+RMh3NOewZuR53WQ3w+SK6hG+veBXtcC6V9fgHPJ+M=; b=VMU7UXJERqs+cbtB2Kt2aKinKhqb1b3vOfljxusVP1r7Pm/mWlcC6xCSWLOZ6oizdgtyG6tIBGYWdIY8QXqhELYOFzvRuKpxibcQENNY8Bm4LkNId4Ij496iUGH2qzOClzXK6ooHuyjU5OvZ3RlyEnAIK+XLxm7Xm7UwbY1r0NziTG3HBCzJ2Jsgo4/jPB22qmSziFsOcl9yf9QQyYi4nG1SRCPFFUEbqe5cSjBAV0yO/gqo8TJ6vLabH2kP04J3ZrHWPEgKBO1EAnNTtiAbGdiT2x5ktrHiA8h/Ohzc72bc6V74TgY4jGDNFNBluh89w/jAFfDhzv5i9YtcTBcqMQ== 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=E+RMh3NOewZuR53WQ3w+SK6hG+veBXtcC6V9fgHPJ+M=; b=z0gF06Q6NfPcTq1QkiQJLMZU7nQvnrHfzx7xFN95fuDfZzcBd0vCsAYMY9cOndXTag79XoTZ3Vaf7haYg2WiYerHdp7DY4TJnm4GTVGm+2Fu3uwQmhpZU4KQBwhp4dEg6p1e3OE//1KKgjjaEsDTjDftqNiozet3+jBR3YfGdEk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:32 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:32 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 12/13] net: dsa: ocelot: add external ocelot switch control Date: Fri, 27 Jan 2023 11:35:58 -0800 Message-Id: <20230127193559.1001051-13-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: d2a81cc9-676d-45a0-d4cf-08db009dcb00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c8FKH6mqV2OL1VdLBdsHFuD3BuuJ2IyiTBZbGPeA2x8GRRT9wHafeINJH98i9eG5eUJNWTh4h0ZxMWZVnrxT+iJjS2abqqWEg6+KF4tjX+RzK1kdIm2ni2k2yo8W4WRZTBJU12Idgu5aZqGg2q0dkznO26KcPXliVmp5rddCu2uGMoRc6kmR01yQZepLilyj8C/Mi0wTn3koE6QxMzF/JC2U0crZezzuArf//rsBWAOjG6tI4uBGBpVTt/XYU33wDOu/QAEv56MQV35wf1Lw9rdQE9HZxyzpJ3faXHS7+Kp0T162hyR043B817SLdBdOxexs+M+8AzKy6oh34Aj4ROUvk60dXnzmGgOuA/KF6j1DrYOF515fCahx/eO4r7bn+EoXFUh3dWLBeh1AviAmRu31fh1a/iWko51vyKkbKI8jvNmE5Pbn4lY8QpieI8atoVTHRP3ec4F1GOQFwf79+yFi9OVWIFM6DVY+Iu1J3dGwHg2FF6BzhKOBNm6E0/iTIrKX+Vnao9tAK2PF5MP4HgKLSjH7Oq1qrg2vZOgz8TWEtSuVMWm+/h2meO8Qv2N+bs3dc/LxhaJjVfa3gIcaNsGzGKrgDWq59IxlPDp/4KUI2pfQq6qErr4EH0DzkcpkU5JwP+DHjRa+DjI9FJJZKqHMGJQP3VvpHmMAxVdSBzucx6gYhbFCK7JwnABOURUFIVlTPWgH3FNqYHVXDIZXVQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002)(83380400001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LcVPDzfkveQ2vz8D1h36EMM8lCF+UYwV0RWmO4evQE6pKXjpbJHVHMH+g7SsXLbuQH2qLMEtDGAnE+6i581+ceHfS0mA5FHnY6zTZgfbXS8HEEw6UINN4aqHSoS8H4fw4TM0y6ux+TqaplBam/vYV9xaBiGWtl9NtVqNS7sqczSPhrUIvc0rzRPw9x5AcE6GfxP2sJg8wmiwbboTzueQloclJCkmOoRw1dnGjhK8t41RA7Q62GQbzyzRhwjxCcxhUOWaEdu0dbWcJItD3Z8z+NFpmv8kN7aQCg2DragzZH71UqFYDXfpX20uM6pzqN2nSkxTqK/Mgbj9H+osd1w9f+14250Ga1gO6VapLBxUIAxUkH8+nzGB+RMTFbTK5o69FaUlxHDnnfCXuPE7GlDk+DlEgq4FVdF7nyIxYf3goREFbrAj/AILuFo53bXzU6Ia5bI14sGw2SPmKdT/1yP/Z5oiOr34NSwpco5QyvzjGt4spQgcQKLTTZ+7vL/VmlINVpBvY1mEZZSRm6JW5qfU/qrTZIXkJS/omGMZAxUV6Ap2iKg8DiEkY6/gi8ZKOO2MPa8BrS3eSKaxCSGaHu8HoxK20hFBxjbs4CYQYKHzlvbFA4UHsMCo1Zl+LRQxtICeSsCngdlbNOB7bKWAGsNHY7qgbiE1wVt+J994cNMU/nysFZPqNt26NcnCbKqRh3pfPf3gqNuk+flTcqmh/y8qc/fLmUpeVFBd4efek1U5qf6KB2BwdJ1iMkESOEqxTHTGrlATin+Szef15wBtzz9rjNy28AToc+ttMTm5RKUcSGWEU6kIPmk3VtdoRo4hTXuxy6H1qX5+z5nUPTefZ6DXgAdR3KF+VD/O9y2ZSFxlNxGkl4+vQ6OKqo+xYNhyUnoJ/26E/QJAQ6LVA9KDH24FalODs8KJj7C0okjj0ktS6znK/ooxr/y9wW5BPDhE3XtGYcX/PR44fe/V4C3AxZvi1gdgn2y0mwOHCmmC3atau27JLsqaCi4DJodq6DGdxo/qwUsk5teHYbhyA9WP0MpyrChN4ZzKrULWMxmQSxg3SIu53NpJX1XX0SP15F+rq9bYxeD5j/wRN3sCSWl71/eHs/ghuK0wK0KvqP6ww45pY/K6E2dsSSpiBXMm2z5Oe6das0ZpIG5M1Imyb/iCE6IZvrUYAWL5tYjcA1z1jheWtrz2JZ6x7CLeUTZD6OaCo3z/m7MDNGuXzo6M7cAvPbXcWAimxY//6NvdKGeV6yZbOTTN7E0ElJYoxXFTYgPzEWCVcsCesjJOvyE+b7Cl4AP2P2Nm4k7WwjCe8BIflJJZR6/BEKQeh/dtCN0uaTYSDex/e75kNf4Djiy9PMJlVCA6CMUEVIlNWh0I8dufx8eb8MPFl6wOy4HnD4Mgdq7k1aXcvEX0DMREi+CGJF+dIXAPKtpKWcz2sYSC41bbqLgEoFsKb3VCrbREI1Uu5CCaOT1W+J+2gauHdE6Y24C4wXme4JvPfZRq8/6+V6deB4w/nJneBp59tBAvQeD3TaXFJ5DXH8IDZLXTW4DGY4FcQj6rGsEowUN9qTiFmXlHO6G988TNUJJuDJ/52g5qMa5QidVnMgCLaEu2HOpZZ8Qi1hre4L9aOCvihSGzAEJhc1KCWc8= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: d2a81cc9-676d-45a0-d4cf-08db009dcb00 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:32.0783 (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: hvQErYTPUVTqwzdUlDYYKEtTmYtkX/cIJx7fGhviuTjMZoxj1rzSP0Sh1WJiEoMT3W2Ju1dQjBFIfhJ6EqY8wxfwDnHt5elPtAbyKnUPAp8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Add control of an external VSC7512 chip. Currently the four copper phy ports are fully functional. Communication to external phys is also functional, but the SGMII / QSGMII interfaces are currently non-functional. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli --- v5 * Rebase to use NET_DSA_MSCC_FELIX_DSA_LIB * Remove ocelot_ext_phylink_validate as part of the rebase * Remove stats_layout reference as part of the rebase * Remove OCELOT_RES_NAME_* macros v4 * Add forward-compatibility for device trees that have ports 4-7 defined by saying they are OCELOT_PORT_MODE_NONE * Utilize new "resource_names" instead of "*_io_res". Many thanks to Vladimir for making this possible. - Also remove ocelot_ext_regmap_init() function * Remove dev_set_drvdata(dev, NULL) from remove() to match other drivers v3 * Remove additional entry in vsc7512_port_modes array * Add MFD_OCELOT namespace import, which is needed for vsc7512_*_io_res v2 * Add MAINTAINERS update * Remove phrase "by way of the ocelot-mfd interface" from the commit message * Move MFD resource addition to a separate patch * Update Kconfig help * Remove "ocelot_ext_reset()" - it is now shared with ocelot_lib * Remove unnecessary includes * Remove "_EXT" from OCELOT_EXT_PORT_MODE_SERDES * Remove _ext from the compatible string * Remove no-longer-necessary GCB register definitions v1 from previous RFC: * Remove unnecessary byteorder and kconfig header includes. * Create OCELOT_EXT_PORT_MODE_SERDES macro to match vsc9959. * Utilize readx_poll_timeout for SYS_RESET_CFG_MEM_INIT. * *_io_res struct arrays have been moved to the MFD files. * Changes to utilize phylink_generic_validate() have been squashed. * dev_err_probe() is used in the probe function. * Make ocelot_ext_switch_of_match static. * Relocate ocelot_ext_ops structure to be next to vsc7512_info, to match what was done in other felix drivers. * Utilize dev_get_regmap() instead of the obsolete ocelot_init_regmap_from_resource() routine. --- MAINTAINERS | 1 + drivers/net/dsa/ocelot/Kconfig | 20 ++++ drivers/net/dsa/ocelot/Makefile | 2 + drivers/net/dsa/ocelot/ocelot_ext.c | 163 ++++++++++++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c diff --git a/MAINTAINERS b/MAINTAINERS index 6e85524a7443..733e311ee9c6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -15157,6 +15157,7 @@ M: Colin Foster S: Supported F: Documentation/devicetree/bindings/mfd/mscc,ocelot.yaml F: drivers/mfd/ocelot* +F: drivers/net/dsa/ocelot/ocelot_ext.c F: include/linux/mfd/ocelot.h OCXL (Open Coherent Accelerator Processor Interface OpenCAPI) DRIVER diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 60f1f7ada465..640725524d0c 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -8,6 +8,26 @@ config NET_DSA_MSCC_FELIX_DSA_LIB Its name comes from the first hardware chip to make use of it (VSC9959), code named Felix. +config NET_DSA_MSCC_OCELOT_EXT + tristate "Ocelot External Ethernet switch support" + depends on NET_DSA && SPI + depends on NET_VENDOR_MICROSEMI + select MDIO_MSCC_MIIM + select MFD_OCELOT_CORE + select MSCC_OCELOT_SWITCH_LIB + select NET_DSA_MSCC_FELIX_DSA_LIB + select NET_DSA_TAG_OCELOT_8021Q + select NET_DSA_TAG_OCELOT + help + This driver supports the VSC7511, VSC7512, VSC7513 and VSC7514 chips + when controlled through SPI. + + The Ocelot switch family is a set of multi-port networking chips. All + of these chips have the ability to be controlled externally through + SPI or PCIe interfaces. + + Say "Y" here to enable external control to these chips. + config NET_DSA_MSCC_FELIX tristate "Ocelot / Felix Ethernet switch support" depends on NET_DSA && PCI diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile index fd7dde570d4e..ead868a293e3 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -1,8 +1,10 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_NET_DSA_MSCC_FELIX_DSA_LIB) += mscc_felix_dsa_lib.o obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o +obj-$(CONFIG_NET_DSA_MSCC_OCELOT_EXT) += mscc_ocelot_ext.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o mscc_felix_dsa_lib-objs := felix.o mscc_felix-objs := felix_vsc9959.o +mscc_ocelot_ext-objs := ocelot_ext.o mscc_seville-objs := seville_vsc9953.o diff --git a/drivers/net/dsa/ocelot/ocelot_ext.c b/drivers/net/dsa/ocelot/ocelot_ext.c new file mode 100644 index 000000000000..14efa6387bd7 --- /dev/null +++ b/drivers/net/dsa/ocelot/ocelot_ext.c @@ -0,0 +1,163 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright 2021-2022 Innovative Advantage Inc. + */ + +#include +#include +#include +#include +#include +#include +#include "felix.h" + +#define VSC7514_NUM_PORTS 11 + +#define OCELOT_PORT_MODE_SERDES (OCELOT_PORT_MODE_SGMII | \ + OCELOT_PORT_MODE_QSGMII) + +static const u32 vsc7512_port_modes[VSC7514_NUM_PORTS] = { + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_NONE, + OCELOT_PORT_MODE_NONE, + OCELOT_PORT_MODE_NONE, + OCELOT_PORT_MODE_NONE, + OCELOT_PORT_MODE_NONE, + OCELOT_PORT_MODE_NONE, + OCELOT_PORT_MODE_NONE, +}; + +static const struct ocelot_ops ocelot_ext_ops = { + .reset = ocelot_reset, + .wm_enc = ocelot_wm_enc, + .wm_dec = ocelot_wm_dec, + .wm_stat = ocelot_wm_stat, + .port_to_netdev = felix_port_to_netdev, + .netdev_to_port = felix_netdev_to_port, +}; + +static const char * const vsc7512_resource_names[TARGET_MAX] = { + [SYS] = "sys", + [REW] = "rew", + [S0] = "s0", + [S1] = "s1", + [S2] = "s2", + [QS] = "qs", + [QSYS] = "qsys", + [ANA] = "ana", +}; + +static const struct felix_info vsc7512_info = { + .resource_names = vsc7512_resource_names, + .regfields = vsc7514_regfields, + .map = vsc7514_regmap, + .ops = &ocelot_ext_ops, + .vcap = vsc7514_vcap_props, + .num_mact_rows = 1024, + .num_ports = VSC7514_NUM_PORTS, + .num_tx_queues = OCELOT_NUM_TC, + .port_modes = vsc7512_port_modes, +}; + +static int ocelot_ext_probe(struct platform_device *pdev) +{ + struct device *dev = &pdev->dev; + struct dsa_switch *ds; + struct ocelot *ocelot; + struct felix *felix; + int err; + + felix = kzalloc(sizeof(*felix), GFP_KERNEL); + if (!felix) + return -ENOMEM; + + dev_set_drvdata(dev, felix); + + ocelot = &felix->ocelot; + ocelot->dev = dev; + + ocelot->num_flooding_pgids = 1; + + felix->info = &vsc7512_info; + + ds = kzalloc(sizeof(*ds), GFP_KERNEL); + if (!ds) { + err = -ENOMEM; + dev_err_probe(dev, err, "Failed to allocate DSA switch\n"); + goto err_free_felix; + } + + ds->dev = dev; + ds->num_ports = felix->info->num_ports; + ds->num_tx_queues = felix->info->num_tx_queues; + + ds->ops = &felix_switch_ops; + ds->priv = ocelot; + felix->ds = ds; + felix->tag_proto = DSA_TAG_PROTO_OCELOT; + + err = dsa_register_switch(ds); + if (err) { + dev_err_probe(dev, err, "Failed to register DSA switch\n"); + goto err_free_ds; + } + + return 0; + +err_free_ds: + kfree(ds); +err_free_felix: + kfree(felix); + return err; +} + +static int ocelot_ext_remove(struct platform_device *pdev) +{ + struct felix *felix = dev_get_drvdata(&pdev->dev); + + if (!felix) + return 0; + + dsa_unregister_switch(felix->ds); + + kfree(felix->ds); + kfree(felix); + + return 0; +} + +static void ocelot_ext_shutdown(struct platform_device *pdev) +{ + struct felix *felix = dev_get_drvdata(&pdev->dev); + + if (!felix) + return; + + dsa_switch_shutdown(felix->ds); + + dev_set_drvdata(&pdev->dev, NULL); +} + +static const struct of_device_id ocelot_ext_switch_of_match[] = { + { .compatible = "mscc,vsc7512-switch" }, + { }, +}; +MODULE_DEVICE_TABLE(of, ocelot_ext_switch_of_match); + +static struct platform_driver ocelot_ext_switch_driver = { + .driver = { + .name = "ocelot-switch", + .of_match_table = of_match_ptr(ocelot_ext_switch_of_match), + }, + .probe = ocelot_ext_probe, + .remove = ocelot_ext_remove, + .shutdown = ocelot_ext_shutdown, +}; +module_platform_driver(ocelot_ext_switch_driver); + +MODULE_DESCRIPTION("External Ocelot Switch driver"); +MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(MFD_OCELOT); From patchwork Fri Jan 27 19:35:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 13119241 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 D70A1C61DA4 for ; Fri, 27 Jan 2023 19:39:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231769AbjA0Tj2 (ORCPT ); Fri, 27 Jan 2023 14:39:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229714AbjA0Tiy (ORCPT ); Fri, 27 Jan 2023 14:38:54 -0500 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20724.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::724]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E57BF757A9; Fri, 27 Jan 2023 11:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OPyaFhpu7RHT6Ky7JNFtnyI2yRLsvjCzIHVSslpOmsWZ7d/N8KxOVWRhVQHl8DFK1boIjJT+4XOKcyUM7khtQ9xBwSgn5SnVSaMNoF9Xb1aM7vYEJX3txdmltbl27GmpqOk2dXxeANStSHC2bsZgKTPCUHeW7pl2m8tyjgB9piCAosC6r9V70jc4rOqMxQGoSXCclvyf/5eb8KSYaeBgbP5kHMYKzYBhbRjp0WLKlSmqg9gR7Fh2NfLIsRrz7TFVImyR351OYgMsCkmVVryI+CC6qXEE2RSvqFxHrVOtifcp6QyUIlG+1L2PKqhW0/IxqCJZQPx2DqAp217nZPRDkw== 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=CkyMqF4Bc7NMOZIfxwd+ykscnIFJwIuugmuhyzXKYoA=; b=bSFLo2OqPJ05zxTBU1zcKNpeQnOBpYtKZ/GGmUqxL3IA8yAJlLxbIQ18YHrT28cYMWi81mVgsGQY2gZ7LWG9Pv8uGxUerqj2l6Th2O9psOuv5EkKLeRT4mHO+RtpkjPNWsLdxIOvAvG5CvNdjEqgNv12OcWIjOvXbSNh/uREGg6TtffNrfx5DXyHpG+prcITVwJqa8NThVLWGZTgj04WvmCChAlPC+xiQD/FuCYEuQLVExRbcCSr40yPw7vGixRMYLD2wPO3A3LUhQwMqj9JfGL3bxufkLh/4LKtwqgH6UvpH7kKcB37OY9QuK+sp0ZrfmlWH7wZpTeymyWyJrAhvQ== 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=CkyMqF4Bc7NMOZIfxwd+ykscnIFJwIuugmuhyzXKYoA=; b=w9r/3oUP9KyGNgbvTybtii5Qw+8YV79NWWidgGuEM3CNeMmI1B7uZUC9DHJ519lcWht6FyXI+TmxP0xnReyHlwtgCkDIKNcQ8Q07KdN6PD2kLqzGjE782qehLtiWEXx/tpa8RJ9vGgH37QmqIigsdElzB+j9smUD1JePRxhNb5c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) by SA2PR10MB4636.namprd10.prod.outlook.com (2603:10b6:806:11e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.13; Fri, 27 Jan 2023 19:36:33 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::221:4186:6ea3:9097%7]) with mapi id 15.20.6064.010; Fri, 27 Jan 2023 19:36:33 +0000 From: Colin Foster To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Russell King , Richard Cochran , Florian Fainelli , Andrew Lunn , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Krzysztof Kozlowski , Rob Herring , Lee Jones Subject: [PATCH v5 net-next 13/13] mfd: ocelot: add external ocelot switch control Date: Fri, 27 Jan 2023 11:35:59 -0800 Message-Id: <20230127193559.1001051-14-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230127193559.1001051-1-colin.foster@in-advantage.com> References: <20230127193559.1001051-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR02CA0011.namprd02.prod.outlook.com (2603:10b6:a02:ee::24) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4636:EE_ X-MS-Office365-Filtering-Correlation-Id: ccda9539-c093-41ef-b0da-08db009dcc04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: h4JIcBEVGj+QmgK3RW7Q35FzUyLhlT+YpM+LOSo7veMYBeaApaOixIxCnRzGLddG45WiXlb7EprTNGTz1BYLWe3HN2YvnVL6POP03L+g0VeIPFHgHcVXO0dt0qytsLKyfQmNgY2Qdb+QUQZQlA37GLh9HkFOZNpWdx6HXNOE82PKr9bTssLE+ms/TslBHhbm9qO4YEcr//gcK4QKOyx+hEg5ADLBqnZgsrRarwFtC52g/UGegE2dDsf5QdNB4erPHQZTAgyWHC5DrC0443A90599dZYuwCcYvqnGnS6hKgdk90UpSiEisnQVV2QH643COP5GUg4LInQJ4vRtj3B6mw6ubxkyY23DChTjSspmz0p1ld0pTwHb+Yl0QRwaH42ZuDEzpLzB1UOrrTawXvnet2eEGJiqxIKbDJlkt1dlmMes+tJ1K5N3dGEY0uwRpyU9fTazoqD1YQEa5ATmYk7G1XVd0vlJiS95FLi/jFDYQQe1cR9Utja+gni753IULOcAneb4m1qaRjvE9R5zMq83QTg9ic8aArY3lX8/MMtnB0jZpm52Lxltz/Qsw6vbOv4+1o55qefBxlNsPXtipGRTw8rxk64U5wdbLlTVif3YsUB0LUhXZ9va32S4RB2Y4bw/GJaWQILzijc8pBG0JPKLT8UM8ij3bKOkOX9bjF8ifJsbxgcaFqJGSyeNrwZlDN7QbPDjkLlEid8BeEegndPD2w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM5PR1001MB2345.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(136003)(39840400004)(396003)(346002)(366004)(451199018)(36756003)(86362001)(2906002)(2616005)(6512007)(26005)(186003)(66946007)(66556008)(8676002)(4326008)(66476007)(52116002)(316002)(54906003)(6666004)(1076003)(6506007)(6486002)(478600001)(38350700002)(38100700002)(5660300002)(44832011)(41300700001)(7416002)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ld4bWvPTNQGcBZR5rnzV8KJh7xinSZxXbV02IVYb3AybjpJwEGAKgTgwLz51gBE5H14unAmiIXIdLAOcmITGQZgmXLLnL5A44OFzxtHYBYx/THOIjxePbUoETYnZoyXaWe/90BYi4+Fspfvhqhj7H51653joEae7Ih2L75Zrhz9sdqyX0fCtJsNM9qd34a20CjP1ksJr5uIHZIMl+Gcw5UkUO0A6FfF8kSrdK2rr7MM65R9hhi7qG8YYm3pbYNyf+Q6p/XkXZqDv1U6hULyaOmch9YBY81iq9+okLGJSTNWRsvF7qQ72unIM0fmSdUDHWsug3Oxjxip5Y+aF7XXkQZjeSLNnJgvVbvfh9kt6sfnt7Th7O9PxVSmJ3iwg8LqUei8DjLyY8oa4FB2QEtZznAoKlAcaPgCpXGnorjkkrtmgSmqxMDRSLArvilP+pZ75IpCb/zAFjZ24dcR81OpNulF+RcAZyz3/26ucemt4hxFnJQJ+FBFhbvd6Gr150KTqKEiZzAUIkWmfx+Q29QllSQg9icjpVEp0m5WkRNkg5FQDrHo3SZ/Y5GsG17duQW6PN9K7p4M7PSBR8PcZYAGF2k+2lHavDl8E5cKQ30dzdV9t65APw+Sc9tyjnOMvnpi5T7zfw9KkODy2nDPlxzXkRuYraG5fT+20JEUSe3LX0vKU12KDL0xZWThe+HpI5msVhVmJEm251zJS9wkOx/A2Xy0ubP0buR+gUAvL3RL5Xjr4dui/9zls+xwlZ52+gbxhkrI+8bTeGsfRz5gPyll4F2g7cphVRedmlOF1eY7pRkrADYQT8Q5xbKeLGtUTRBXwLi0ZGLl34IswvvWzuXHNzrDHGssDCWCFIsFQR2dL1ZKmtodn1wqJj7KG7YneoeKB/vEYYYEswDrOWObjDnlugWIF4Z4RhdZDNKSn3DZBINOR35m72RYZxpuUO6yQOF2yKJZfKEDMMawDLvDE2ORB9IBmaMpUEVRtJaJXm0FaDWxnfZL4rerWbwnBFhS0vPCYAJnPIFKdSuiNzpSBs8IEotiZ60POMzvYBNcFlIUYChrC7veO91q/MoBCbyjstV1VRrnLqpA2EiT67t+d51nsizGU718ady/oerzkjBvifJ644QRypfTCgLvPCbgrcsiTFuVMhc+dJnOIqXwCqvwKxftwWItzCwE7ZlPH2a3u9SbbXEwoT48JM+VHQ5kx3bNehdkymbJ2tgRvLb13DMBW1GxqgrgOTKUOx9ww5VONexJJMJ0yoFD+uv0H1aKcUM1rVUv1lj77HAdMKW/9uT9tAtqF9ewOt9Yxkrzkw3NfFHybcsEkSIkK4aLilqKtS1orA/dLpgVKkor1L9PE6er3wYqhAd+U2R9FU5Jt4+rZKD6TNYhQWoR62EIGIYU7SikWNe78Wj8MKFfbhu1tmIpHMC6lXnOC0EM6XSS/2H+WVWgSqiIMj6LD9PEXOQNBjrNxfsNOCCaD+4n9rcbbdCm/Mhu3bitS+7disEAb2bGuZ35hikt5PZLPPIjQ+2hfov7o+0jZdSTZ6/+D/9NfEESPwvP3vxml7P+5sGhgtUD7x97bJXl7yDFY+CgD4HYmA9WOQvMZCsa1lxqD1KXFsOiDA7AtDAIEx1Uc8dtezuf7H+4= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: ccda9539-c093-41ef-b0da-08db009dcc04 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jan 2023 19:36:33.7344 (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: 9HfBQfpzu4BlakstwQMluHRcKXXbyCMFLJ0CL7N5Sxuj9lOACBhxdR4BPvbsUSj01HxN0IP9GMhLRRzK++kziGOL63oGbJFpXCI5V8hHBtw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4636 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Utilize the existing ocelot MFD interface to add switch functionality to the Microsemi VSC7512 chip. Signed-off-by: Colin Foster Acked-for-MFD-by: Lee Jones Reviewed-by: Florian Fainelli --- v5 * Add Acked-for-MFD Lee tag * Remove OCELOT_REG_NAME_ macros v4 * Integrate a different patch, so now this one - Adds the resources during this patch. Previouisly this was done in a separate patch - Utilize the standard {,num_}resources initializer v3 * No change v2 * New patch, broken out from a previous one --- drivers/mfd/ocelot-core.c | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c index 013e83173062..b0ff05c1759f 100644 --- a/drivers/mfd/ocelot-core.c +++ b/drivers/mfd/ocelot-core.c @@ -45,6 +45,39 @@ #define VSC7512_SIO_CTRL_RES_START 0x710700f8 #define VSC7512_SIO_CTRL_RES_SIZE 0x00000100 +#define VSC7512_ANA_RES_START 0x71880000 +#define VSC7512_ANA_RES_SIZE 0x00010000 + +#define VSC7512_QS_RES_START 0x71080000 +#define VSC7512_QS_RES_SIZE 0x00000100 + +#define VSC7512_QSYS_RES_START 0x71800000 +#define VSC7512_QSYS_RES_SIZE 0x00200000 + +#define VSC7512_REW_RES_START 0x71030000 +#define VSC7512_REW_RES_SIZE 0x00010000 + +#define VSC7512_SYS_RES_START 0x71010000 +#define VSC7512_SYS_RES_SIZE 0x00010000 + +#define VSC7512_S0_RES_START 0x71040000 +#define VSC7512_S1_RES_START 0x71050000 +#define VSC7512_S2_RES_START 0x71060000 +#define VCAP_RES_SIZE 0x00000400 + +#define VSC7512_PORT_0_RES_START 0x711e0000 +#define VSC7512_PORT_1_RES_START 0x711f0000 +#define VSC7512_PORT_2_RES_START 0x71200000 +#define VSC7512_PORT_3_RES_START 0x71210000 +#define VSC7512_PORT_4_RES_START 0x71220000 +#define VSC7512_PORT_5_RES_START 0x71230000 +#define VSC7512_PORT_6_RES_START 0x71240000 +#define VSC7512_PORT_7_RES_START 0x71250000 +#define VSC7512_PORT_8_RES_START 0x71260000 +#define VSC7512_PORT_9_RES_START 0x71270000 +#define VSC7512_PORT_10_RES_START 0x71280000 +#define VSC7512_PORT_RES_SIZE 0x00010000 + #define VSC7512_GCB_RST_SLEEP_US 100 #define VSC7512_GCB_RST_TIMEOUT_US 100000 @@ -96,6 +129,28 @@ static const struct resource vsc7512_sgpio_resources[] = { DEFINE_RES_REG_NAMED(VSC7512_SIO_CTRL_RES_START, VSC7512_SIO_CTRL_RES_SIZE, "gcb_sio"), }; +static const struct resource vsc7512_switch_resources[] = { + DEFINE_RES_REG_NAMED(VSC7512_ANA_RES_START, VSC7512_ANA_RES_SIZE, "ana"), + DEFINE_RES_REG_NAMED(VSC7512_QS_RES_START, VSC7512_QS_RES_SIZE, "qs"), + DEFINE_RES_REG_NAMED(VSC7512_QSYS_RES_START, VSC7512_QSYS_RES_SIZE, "qsys"), + DEFINE_RES_REG_NAMED(VSC7512_REW_RES_START, VSC7512_REW_RES_SIZE, "rew"), + DEFINE_RES_REG_NAMED(VSC7512_SYS_RES_START, VSC7512_SYS_RES_SIZE, "sys"), + DEFINE_RES_REG_NAMED(VSC7512_S0_RES_START, VCAP_RES_SIZE, "s0"), + DEFINE_RES_REG_NAMED(VSC7512_S1_RES_START, VCAP_RES_SIZE, "s1"), + DEFINE_RES_REG_NAMED(VSC7512_S2_RES_START, VCAP_RES_SIZE, "s2"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_0_RES_START, VSC7512_PORT_RES_SIZE, "port0"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_1_RES_START, VSC7512_PORT_RES_SIZE, "port1"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_2_RES_START, VSC7512_PORT_RES_SIZE, "port2"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_3_RES_START, VSC7512_PORT_RES_SIZE, "port3"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_4_RES_START, VSC7512_PORT_RES_SIZE, "port4"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_5_RES_START, VSC7512_PORT_RES_SIZE, "port5"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_6_RES_START, VSC7512_PORT_RES_SIZE, "port6"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_7_RES_START, VSC7512_PORT_RES_SIZE, "port7"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_8_RES_START, VSC7512_PORT_RES_SIZE, "port8"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_9_RES_START, VSC7512_PORT_RES_SIZE, "port9"), + DEFINE_RES_REG_NAMED(VSC7512_PORT_10_RES_START, VSC7512_PORT_RES_SIZE, "port10") +}; + static const struct mfd_cell vsc7512_devs[] = { { .name = "ocelot-pinctrl", @@ -121,6 +176,11 @@ static const struct mfd_cell vsc7512_devs[] = { .use_of_reg = true, .num_resources = ARRAY_SIZE(vsc7512_miim1_resources), .resources = vsc7512_miim1_resources, + }, { + .name = "ocelot-switch", + .of_compatible = "mscc,vsc7512-switch", + .num_resources = ARRAY_SIZE(vsc7512_switch_resources), + .resources = vsc7512_switch_resources, }, };