From patchwork Thu Sep 22 04:00:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984516 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 B9584C6FA92 for ; Thu, 22 Sep 2022 04:01:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbiIVEBY (ORCPT ); Thu, 22 Sep 2022 00:01:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbiIVEBW (ORCPT ); Thu, 22 Sep 2022 00:01:22 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA54ABD68; Wed, 21 Sep 2022 21:01:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gp6xCg+WXfqRZOt48bipj/nKBeHz64XF/VxaPQFRCTFsgRL8dGltW24pEpzKQE/vGkFh5yxDsjUxvzr+asUSIQ/vhT5CkmXpJJTewY9gotJOj/bxF0SdWiHpqWJMTUSj4sBUr9iH2wPB6GNmn+acSqKzYo3zLZe7W7bahrcpbTFR89ihl52I/pIH2UVrAqNC1fQ0RxgSQ6gMwGoS+Kexs3QWhZEAMdXCHRUoyaFTu/qoxcRwnpR0BrbSGhgn9JgqArci0qgtMGXKyjoRZNvfvAH9vC7tszeDSG412tvJw7AHqAYlEtgWPAtKvQzLR8VceXWv4rPn9OuGyorhAXr06A== 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=OH7PDXeOu/oAycNZzrDod17exL2vm7gJso58+xKZCTM=; b=KcPyOTCKU23CPSxsS6reSgdCksTOAwMfpedEvZGvM7+AF+qGhr1Q9rODqatN8LTVvEwi6pUrXU29YvO4et026xEiFb67WUyZqQUBQJNWb+rwICFewY1rhkTBPZM4S+NvHlbc8kwD1a47ugi/xK7AnYr/sELKIOWa7L2I6Ip3T6NoT3N3OtN0Cu3ykbSFiZ0rGTaC1DNlWJozBgeVYX3+/CCrSc1bwNTJl2+VCXgn1ZY1xjoqsrjgnbS85O+O3hHY9DvfYzoZ+GYkqmBt14wU7j3rIiEvIW5X49wfIXlIC7jI9YtwKGFuN6IoPLj6JfbLBEO0U6gfpOX8AGA0GXaH8w== 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=OH7PDXeOu/oAycNZzrDod17exL2vm7gJso58+xKZCTM=; b=cXJ0TpCjZ8G4a8u3HtLQloptTrJH37eBVCywqNerbRYrH2X9bA0fqHNRNOosD0lvR0ZAkMCh8q943n/NEPiaTqxIppvYfg9vGK4zqVH7ZYMKtGUeWdk1RWerVfgFFUsNy5vBSrxVuTFcaX5mv5LDZgY3W9Anuwpq+ozi9cw/hFY= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:18 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:18 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean Subject: [PATCH v2 net-next 01/14] net: mscc: ocelot: expose ocelot wm functions Date: Wed, 21 Sep 2022 21:00:49 -0700 Message-Id: <20220922040102.1554459-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 0d467d56-18f9-4afd-6f56-08da9c4f1a04 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 34ZFQPZkxzqm3iUJUKBvwd3x8trLsaxTTPFWgx90aA9fIAJUqYI85q/CVA12xyEnQuA4UOma0ZkJFe0pLuWy+vYDAo59P/UHwAddkUy+q0ZOzBnDBPdf/gEmSaW99o6OMfPFDweDZOifksmyQovnOiW51MqRhNFIyia1PpawhYHjZ+nc+vkK0hCmnVoIoL3ygUrvFWzCf8AUfJ8F6bkHG8BfR7hratVupEJSIHDeouHJsSysOh388dqxrH6+zyKEMdPua8URogVuBGHHxgcTAIx2S/14Wdq7RzTLDkzBA8A/sSYyGvAxBIRc+Lwx79cxRIsm/Bf2devRoEZmuRCZVpq1c3X+Vzyxr6ETlQX+gNsLhTNQ3s6252zkTQAIrA3AS1GLBCr6DurCZZrIhuNMcAdJZVceRjjxHhdfEJoQjd/J9fMRz3Lkicc/OEd3DB3erDbQBfpVTJfGTMCAeo0WEzwj6ZAQnG8PqSwqPWy19KFnlJCUJUgJpLa5fjg/z8koabFJgx4NL786EPFvveHh3PdHBDiD3wdQeshqjOwMjAl/HUq4LyTGxDupS/Cn6Bcbl+3XZW5qp3shMgnil3+Q4xEybgTyZQs2BDEhWsQfRceCIvr+fDVIU+uWFg6H2y4JFC1eOUlrVdV0hhWkcx4MXjJ9MalKI1zejZXRudQu7kfxt+G5JvIcpK3tRWvfsBHYNz0Vqjt7EyTGKTBuH2CmdD1rHBSrORuufETImq32ZmueF8Tfrd117uLoQVg51fF+ZGXT4EtUfSpOc1r1KlxxSA== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: c9jGtDw/WmPg1ynUWadzK8rdbF7JIdtU8qsPuXM5fo/q4qaDGh9rcE+bOnI34UoEmkPRtZruh11e9wgx/Mi1kadJdtUhDcX1Ao43E3VoSzZiaKxRhvflWjZiEPiBhpkgzn8ZpMXDe/0PC+FCwMZQvcGfvmoNRINnyUhHgXo/m8Wqjpk/vNHAbFR5jz5aHfsiXT75il4ttMz24VNbNzyghpZxI8BX2Zxn5WPzFwdIE8RAkiEGWU+XQdzy1kgiHySDKbGV4FNQZwwyuxEfYEyDSOYXdh8ny0GXbs4w2hASj5UA8Nw7xoGUcxuLEygVLXFg1EXxNoX9L+hGkFPivNtacWLbRtYYETy9Rycw0fAuYDU2//tojPwXkc3LtfSLXr1ofPbRrf6uipqzSMA+MwfGs4gBt2fZCMICJl3VQ7V1OiSG0kzg16F9cpNNP5GkHklIyZGZeU8x9N/Oaxl6Sd+4c7iSCakAiNEKDOBy3sIF4mx9h/g5xzu5Z6R+109j8GpAeTPDS2NZ4aOVRgql0lSOxREc9Nvxb/fXGKZv9e+eEqdKutAlNwne1ywfa1t23eQC6S/3LTrPplfCgS5rb8sSPu6gNTaqpV583IrwHwiQBL1sp56F86Qksqgzs/VpXcnMwQ3zbpBtbHzfJYl0VhrqJR8VsA5raXR0ghmcSQe5CUwmeS1I4Oo87Y8V2BigAfLbO9HwvnVZCvQ6/ngAxUe6+r1QSwnbMQ5HWiL9HTys1xAj+zxZToINXNiQj7QZvhgdvEh/ETiiBcmmfTlhcEyQHwZPvBK8LBCTq/kuIkS5xZYFJwUzlR2ef6C81owZX8Ux/04EPyVKT4jOP1TgEb3Xi2+wv6DASmiPyEJRA9zdimn/c2Kk/u0TNi+Ikn8Q9cS/12xNDYyjMaljXbZlTAlggPRVtvY+Giz7JxLh+yEoNL7w5wrIYdRFiLmKirTnmna+eDYvFBnteghy0k/ORfC3frxR/cXm1lygPSN1n4YdFD2NuhSjtZjFwa4TUtOypUXotIFzvKzbIUaG1+Xh1QQK8FV6ZQ0SJI/lW8H+ZgzX2oI00kboYlf53rilEiMl1+zLWh0Xg2VSweGhVwiooCp9BRJrgI2se5Clnr30iiism1O2fsUlylcEWHKWS22Gm5P+pWODGpwX0piRE5c7aGW8zlKyczEY2IP6qWtajJOkY3g/nniIleyGRbOtI830L+4Ri5cVutyN4w/LFVE6saqUWzBx3jTMkzmSSOZ7hnELneNjIOh42skEjckl9HikvEpVcGJulGhPiQfnfo1B6dDV8tM+uh9iLFDQ5HIV/Op2YfeG/eR9WrSIDeBAKD37HzSBuiJYVjENLFLxVh0EsJpTsLVtllQfS7KHAlnmMLD8rp1IhlCCBrXFdWc3rFvp3yTw7LHFabGaO8qu5e8ztqUNVejH4ZcvPRyZKTa+s41DQEoLqNJPNr0KIuaD6s7QTkZtZ7JVFZ3v4oNg3RN0JQZJQZ2n0FFc+9mGoWJniZNGCEDKFE5vitiaihfWU/Hzo7HvMLThbdlTEKJYCk6xU2QfknGOE4t8aGJAbCyvlo/2aCg7m6Gyb1F9qgE/Xl4BCu53Kp/PT0igTXBeTGG8Q4hu9EW47zpDjsiJTCukoieUyIA= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0d467d56-18f9-4afd-6f56-08da9c4f1a04 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:18.2162 (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: o5GfjymCMwtjyriMMWvxy1JbCMJN3BgMxw1l12K1FHfix0Kb31+FXUba4Zpubrsn32iR9zwHwe28+e8hBmGsgnMaQs4i88hziCDZVf5RhsA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 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 --- v1 & v2: * 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 6f22aea08a64..bac0ee9126f8 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -234,34 +234,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 967ba30ea636..55bbd5319128 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -1145,6 +1145,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 Thu Sep 22 04:00:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984517 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 66645ECAAD8 for ; Thu, 22 Sep 2022 04:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229930AbiIVEBa (ORCPT ); Thu, 22 Sep 2022 00:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229822AbiIVEBX (ORCPT ); Thu, 22 Sep 2022 00:01:23 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5A72ABD5C; Wed, 21 Sep 2022 21:01:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuaT8pj0lDDNKgpi0Gaa3+VcyLeKCsQKBi38kbiryhRoJhgkFo4aRLvygQQcQBMXo/iYIpbHgh/IKZ1TZ5cJpWQn0KFNRePJdtUCYupVAbi7rnsjBaQI63Xj9Ki+U1t2Gww6etG6LPJZLH37+0NumhIn73G8y5o1qDGX6kDkQYNA/rDE9Gudj7/LxTpAuDm6V4j5sqaAhjHMfIXcBPkVDuaBlGpPgd9h/i0UgxxDSlpzDrNX0ftTO9a2EzcVNGBdXAe/jLig+q5+A7uOnUKTvJfojTbiGFoURg96NYO6zHlDyZeFFe/j5X2sK0oGluNQJHCamSfB0CgOfQaZbCUjXg== 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=xQm7cVLkFrqX06T8GiJS35gj5rrkvhiC+kGrADrQuWA=; b=Ll0JZgnFRqylJtcdH7bxZA+V6sO2kfjJawuGwJOpr8kZ7noh6kohMJiXr+tUz8UW+O0GOUmLvqsd0UAwtH2BzyUGN4YZj81inJ/2uExEBUpSC99SUsDiSTxxyeHXzfXHqJy7Frkkb5rRhbn2AB7rcAcc3bquWIE7XmYdP1VINPNC1EwCLt01PRb4E0CAkh2tsq5yf/tXTOPcz/1H9FnS3LuRsuMj4U0DO4VFOfeOiFzIefrbShb8tMuqUmDyFpX6KJIQnE5cb/gRGtY0hpp/w1sUhyz0RjAgIJvylCi+KErH7FupIpKGQiAiT44yfxY70iME0wNwDKaotaLziGp71w== 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=xQm7cVLkFrqX06T8GiJS35gj5rrkvhiC+kGrADrQuWA=; b=y51jMyXchqoS/l9XeaRu5VTq/zOKTddD6AAjKub3W+4wTwMTE0i2CvfwPP9aU5Q04VuwFh7DQatNgpZyPzuTuPfdl2qEqZ2S0lGDK04i8OnAP6VQl/f/YFVDPetMLLTDK+jpu+WdO5SQd8hlLSHWgXf+zW3XTyXGPwUTVpoYrm0= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:20 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:20 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean Subject: [PATCH v2 net-next 02/14] net: mscc: ocelot: expose regfield definition to be used by other drivers Date: Wed, 21 Sep 2022 21:00:50 -0700 Message-Id: <20220922040102.1554459-3-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: b2580750-5cec-431b-d276-08da9c4f1b30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UTAMoC11ZVsa1BDqvK7lojCaw2h6JJwEeUILW4rk9MQAd/ueg4jXPe8OleeXMY8Nxdwu4AECd7o7+D07Aet9PzB3ehGR5zHAZBbg9VpfbIVbkDhL64rEGd1z/+Sz6mBlLplC60w9F41z/K4+uuuXdsM00uIYd5aIEZefH6QskPU8TZQV6xWUbF/eyhrnmi1xmyn6HsnYMU3YXDqR4/fvgimE9zvx7oqdpIC3r4x6NuNmxaANogpiaZgKw0D2hdS6FjwNxZJpcetv98OXYNGAM/cdTYhAWE11bX6Af0iThZ0SsSNJqwibRHfGb7m3p3uFwKrm96Ve6H4pXCawMIcNjsjRfWHRvkotBf8gbykZ/c/FTOoDd9zdpG16ztrrFzMeIrYJ+6C6CrSJ7SXjYJp4D6P4OkAqh3MAzG7A9+KdlCjo/7hHpUiupGK3MX8HElmB9PwWBWS62Ve1NeWNAVM+4E6a4YqkaaGRUj4gQkPaVJjN6qHTCrhRpBp8OiGA1Qz7eQQnK35TvxsXRLQitWFxaFhZxqDEq1aKvbKllKeDh1NqTBXXpXY70VKNHvpAblsmc6wxsNfh0T42f3OJ8WBhLKwZaxJAY92tAzwTBIby2Cxyx3fVA/MCo8twsM9oIhGEpdukICs0ujHWnvuK/yF2KZNRj7UmdYBxfYSgSjqmHLj1F+IJ/o0Ko7x0JD8nL6hUq9R79vTbAhCsHl6stKuBrdTF0UJhdkJNmOFaRxyiJp+29Fo2YwHi/I4uEas1l0p6TQeY5+Qs3sd+5PtTpBe+5A== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(30864003)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9TwPFLX5Z+E1Z8oDMfEuuMFMDyG+di889oyVsHHNc12YJrMyNuyfKuxh7e792BvdtD9O5jPbE54iVWUDP5pgmX3js+V7wy1T3xRZrd6ysnHszLXvbgb1UINIHnVnnpcU9OmgoOoT5g/GCIJkcQqRONSR/GcRP3+UYAtrAjlhSb0w4hltY2y5nyirhK7i16OeBIXLDGuGcvtxwQ0Su/mYm4oQSlz3XPLDOmIAGJ6J19GfGHUrY+Rhc2s7I0ahv1WjU71Iu1i7lB27kajnQe6WcUg2PFNFe5t/oOxyHvN6tsLgt4mRDR88dkJGH++xLEOB4FOnqS2ln2iovq8VtZhyzvMFinBpdlXVYLO7aMcpajg4lzcprAuAqNFSOIctSSgf2bK68Bg/XJcIMqrNmFUrkdznbTCmuiXXGM+WUwPpQ2pF4xb222Ytl+5woUFhd+B6D1B3D84V3pWwG7RMvEkhXqLoEpRvuRx6lznNdnGwaWNirNkSvDd3VNMUr5XiMzYlS6e0rcl6YlbJp1w/MHs2+grDrWG+W6i/nTJhIa7MxRYmGSQI4c1pDyspTF7FeNhrKzpiZBSQ9lXVsHlLvEAbXgdJ8uOTtMbuVxvvrRmCgizZ1lPM9Equ8XE8sZv0kYacvHBDqq1OpvNsbobZOFutx8oUBuENQ6gTE5q1B6d6HpXDoQD+spoLNCIQ766WPNEMi4NPvSHnySTCl/JAy2otkvi6nbrUD3wkpYufWbjxBuQr6Dv6ELIdmqwIM4FVhg+VHLVW1s4E7HcTUthyrJ39SPi+6aJmHLK22KOTjENiKigvrzPPHFTYv+IJ0RWM4e+qNwX6ej/FmrlzKxUZ7lbplMO5YsVtFwJolqP7ToPg8WcUiOMRSMpcJecNGaGwt2qzeYxuPK3mo320OGIkdLnf5THwgNZRyloKf7kQD1OzYDc3ySBchMpyupUNqxO/JYfi7TmwirNz1n54o0bBjCWQh8eUOSq0CJv2B7Jksywi9dMi41o63w5d2fKP0S5HSpU52KnoTwr3DAG5DolGslWsgU0cp0uGd0tG8X4yKVe+gNL1JUia5woENpyScilVQeRVcUi61kCj+z1hnl8JR2P1ttqeHzVcCrawpIJDuQI1ZDpFhh7VUPGs7J5TbMC341Vq7trV7yRhVODMJHps2OaiYLXBrL36GSnNLa6VYO/xXV6kV5jtx4IBlGLP8JRkbp6cKukHyrVav+Re40S4c7SqffxtfOLRgRJH0CzFZ+IDeXfzPG2kt+doIkpTPvmMU3fyfWlnxx28YXtq0AYbYZeT32PiymJsJ+YIrBJoA+FhYyHQIM6UJL+WIRFn7kpGeYmZthqbuKyDTOdmMCCdox/BndtPjhA3yA+EPEn7esneIPjlTi/iUmE/z/qqfWWr0brBDL1X/SY4f2p1WPGBD8HT+yZh2ZbmH3j80DdeWhbOEqMXAIc7Z6E/6/zVjJG3lkjSrLJTuEzvLxDUP3JRD5wkkjAdmreJOcH8qPAQXVEuVJ3DsGWiNZsbYB4Q+1LfY7TBZ0x2I5Ne/VtbZfabCFnostZF09FQL1A1LbncDAxp0igF6dfah313VNQr+fNdl6fpbYE4qcgNlySmp4+a1e7+rVVWNNcziMRICbiALQlRdUc= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b2580750-5cec-431b-d276-08da9c4f1b30 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:20.0286 (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: YXrYbV12oUfzP5/Dl1StfPLiM11Y6tBAvSZ2vJqT5vaBmzkqL5r0DiR6mSg6JiGYJwWkvm0lC6yTOQ+xUSLKodNEab4o6pOVhXsf+GswNU8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 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 --- 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 bac0ee9126f8..6d695375b14b 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 const struct ocelot_stat_layout ocelot_stats_layout[OCELOT_NUM_STATS] = { OCELOT_COMMON_STATS, }; @@ -142,7 +84,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 Thu Sep 22 04:00:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984518 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 27C4BECAAD8 for ; Thu, 22 Sep 2022 04:01:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229980AbiIVEBr (ORCPT ); Thu, 22 Sep 2022 00:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiIVEBY (ORCPT ); Thu, 22 Sep 2022 00:01:24 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E5C1ABD68; Wed, 21 Sep 2022 21:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AQcc2o5djNirwFXljuhnxzaXDMkJ52zA6KUY8ou8OsLA1IAPcPxuWTFnGIs53C3zj3K8P2SdtsObLIKrTIkZZ8WuE+GrePZR13XrEs6nkbOn0tmhculS7M0NF/R0XaaDnLm7OS3VwTMLSVBsOHBEby7IaAgFZCtToJgADO/+h0Z8TstxrqHP+E6902lo/t1XfbqSHLF3Rv1E0YH6dAfT6YRsrEcBqHYCXdUL5GPiwkVf6SQoRSC62Jl82ouMVI8d3Xom0ulpB42npTw30ArcKUP2wPY5Agomg7exNviZrbzKJb3ry2W5NPwNfABjkcLh7/E1HNHsh7Q/YMRVExdvzQ== 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=JTXVjLxZigSY5WQHrpgFogC1j9QeVR3uAKFZ11Wo5L4=; b=dcD+7vSFgHBLV+oxFKVdKip1Ge+rN+T/bs5nCkB+l+TRf/pI4n5zJkZRoXEMmBmPusC8+Ew/cdyCvJZGJc0OVwWWWUfjUCnWRBpnitvhTHSM4olK0TtHkP7Qh+10n9wd/t8IzasEOX75/g1J5hUdYUoSKILVkmTqDEx9BB9O0CxA6KqhwQMbtJSA7mjQLAleSOOwPwBg5xkq7JeX2prQJqFZH5aZLwEgv6Ag2swPOEtanF+Nl+fR71EoSim7u749onP2M33ccHPs8SkX7z5Tw6YJsswh9eaucM0w9Tof0DaTbwN7UFWT1syDcEVlvT8oULD/t/T3g8lFkpM8ytPoVQ== 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=JTXVjLxZigSY5WQHrpgFogC1j9QeVR3uAKFZ11Wo5L4=; b=CYZvtLn/VFPNHh531lkk+6oQe/38lmsVDsuu8uICRkeigT8yuFPYTKazBJmOPlPNbQdZyWqtDSboA7PvD83agidCTH5egefxW7NEtY8z8q7dAEw3O4OZNyZdrjqaWB9YtUtSq4FNmscY/HlKySDzGbudpMP0G3slgPUt+t1nzc8= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:21 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:21 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 03/14] net: mscc: ocelot: expose stats layout definition to be used by other drivers Date: Wed, 21 Sep 2022 21:00:51 -0700 Message-Id: <20220922040102.1554459-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: ee868c1b-0128-49bd-72e7-08da9c4f1c39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FKMPX2rOAWcRvEk5DB0ILloCx3Xtk9ddLKdiAHzs+8jfQFgPSIw0F7rkzoRrC2wjhdpWMTlx5/ZYDnLIG7QDCn/7sgOfsmvyTCdpjHKmX6Sx6EPMX7W0e//yiGsRERB+j/KW+zI/TpiogPHMob0OR2x4x6zpfUVHMt1c5Eg13/HYK1VwPvY5Rrz0gxGESigXte7uXW6n2mkrPc2IjasoF52ZmMcCdB8F4c4QOeUULOPehW1jbgfwCWBpClRqgiPdJZ7rk74+co468yFMT7tDdelCUsdIcaSSjqbAsWDGQ9nie82ekO0wVN8ftxhKZtcjehOwrRqjv40XWq/Dot3pCVmYZPRY0DVBuNlejCokwVxGpJGHwizvJ+SUqcx47aRMe1P+FBCByPelD/ZX10p2MVtR+b5pZlwyfHoxSkLVbJwGQPLyO9jPTHEvhVq6sx6gdb+Vfw5RsxgRSIHMJBOWMvUabewmlCEp/CsVNDq9VfvDmblBbJQ0kBO/1IAmjK/CYuU1D0lfdsIzGZ/2nKiLjrV5PP96r5IL4yPV/4WcGE4tBYma9T7MHKJYowAINmYXnM+RDOJ3bifPMBfGmMkllS3A39lhF6iIp0tbEB/02iDx5zEkveBrS7XRIvJlpeOkJYISUnoY/irpTx1NihSWUQZqOjFK74albJMnwqkf3wbzahPpH8Gd3evi9r8X324C43L0Fh5ENWplHD2rOeFZmsxp38l1CZB9b9jivzqamNbr7EvmFgGezqENJQPW4kYtxOEBXmIvLxqzce7q5RFhig== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6HYf3L6UR1mI32ngI7CqkKZnH1znH/QLpnpWx2FX6tP+tPR0l0MKeaNU85LsvdS/uugc+ZgIyRZuTng2VsS1jlRvuetCbvd6GUyTlAmzs5Yi2NROVmKmz9hyVOolEGBnDbvuxYdaTK1/YTD+lcZVrqo4Dsuxg+KEoi6GpIYoj9yVGTZdOgRITsgVUQ5qvgc3ToYZGjarvUcbY33pJkJamDqWFRNrkPTPZsn+lKSA+oGvwyJlRo+SiEWl05bthQaaohdH0xwey1o7BArdXP2Tlh1nSfdsP6cH1eP8HR2nhBWSuC+2fU+4CVSVQOyT8whYj+n208I29eLM633jcazUuw0MsPm6BnRNZxv00TmrsQ0GIz4HbnMQc2omPcMS1HVXM6Ntly4Km1XG/gBk4iBGxvoYJQ9jKxnu373pUomZhMaLAXQAhaABI0C78R5L6XRQJIU1P/bn0I68TmziE+VjE2zA1EEjQ3UPXHYwwjFiiZoXj/9VEOBUzvLu29QNTFyBjAyvOICpMY42dkQ/nFiDDiyuU7VVvDjzaZizca5lBXwU17vNFb10dUgqXCBmKP7xi4g33sUd5JdKvqh1VENOEWRZ0qPZMyJRfGyqteHg9sWMLBijRPWGfjtCv6PX9zjxCkzSIU3bJsuS2bprRbjQ8h7Abva8w66h1lssX2KTMstabPKjkomjPb4t5xDAirRkL6wqsDrmh74Qt8QwGF+CYoSZDjAv5fYuVekknBWv7g7qrLgCsf6XNOPbzh/BtphJbBkdGR+XVCQ9Fc0nW/z3Ov40oR8L91LATcoa2u/WkTpdLvD0XzFPvZTPE31Ew5u5L69bjFGG3Z9fDdApukBnstu4CPMGCv4diEh/uq0LyNphOOIqO7waJ53VEL3OVteBlqK70Z/gPYIVgHgniN++g3i75L+bn+5Xf41IkZgY8td6GEcbDaX1IN210GrOsfcrUVSp9pnBzYKR+jMiIwHMvJT+MqN5YPbV/zP5fsXQDZhoDvH4QuBL0Vtd+vbi6HhqYxtWlzS4pOD9iOwLv3wtSeizEB7rFzQQlVLUMtRFO5vuTFRC74O+IFIQAE8/y38N7sorQRiyUqCdqjFm8gTbAi8tWhxPSfNrEYuF7xjPbod2MEnP6esFobrmri1prwf7cTPbvjZvRcGxWCpFXo+JQrRIhmKakXBvHm6SPSB89hgX/e5/JxGSnBQz+oOlzGnv7h2ofwQLPIjbjSv3PYg8jCHohx+ImRyojpE83ypg23Q+OEE2gAVTy6cW0xDmXiiznflHSrNjorSC/VMODEd6mAl2kpaMHyMc1/bSTDI/JSoJFiWIrpOq/b7KrNhjm4OmLxETYzgcbizMO57jsJfrJcrf0lUVvrAGSN4/ZuPlEgspt4Nep1+hxQ9QTJ+8Jylq705HZok6FPNSjY83WNu+PzOypmaXogf4Rj1e16wW/N4noRID71E4vkW4N5g1YN0Dpo13SohlzoijfzlXFOHirnLYKXCDsSZ16X6FObjXDQS8Fh9pfXN066yK3MTDviL+4EFnIm3Z1id21wUXULNHgU/SuyplDe7q5ID06qiwV73FVY5q4aY2R1Iu/er6hZ8RHHcB/7NrpwtE5CDJ2xJFlbbWHNzckybQkJN6siik11w= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: ee868c1b-0128-49bd-72e7-08da9c4f1c39 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:21.7316 (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: POxTUdGkpNACNj+PUPNvxV0NxFuT3ddc91H89SdSJ7mMIdyK5GmIeNIk0hs2cxBOtTpa/YALGpcp6VrMbRWeWObNHW4pXwnIjfn3wEpUD+A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The ocelot_stats_layout array 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 --- v2 * No change v1 from previous RFC: * Utilize OCELOT_COMMON_STATS --- drivers/net/ethernet/mscc/ocelot_vsc7514.c | 6 +----- drivers/net/ethernet/mscc/vsc7514_regs.c | 5 +++++ include/soc/mscc/vsc7514_regs.h | 3 +++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 6d695375b14b..4fb525f071ac 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -42,10 +42,6 @@ static const u32 *ocelot_regmap[TARGET_MAX] = { [DEV_GMII] = vsc7514_dev_gmii_regmap, }; -static const struct ocelot_stat_layout ocelot_stats_layout[OCELOT_NUM_STATS] = { - OCELOT_COMMON_STATS, -}; - static void ocelot_pll5_init(struct ocelot *ocelot) { /* Configure PLL5. This will need a proper CCF driver @@ -80,7 +76,7 @@ static int ocelot_chip_init(struct ocelot *ocelot, const struct ocelot_ops *ops) int ret; ocelot->map = ocelot_regmap; - ocelot->stats_layout = ocelot_stats_layout; + ocelot->stats_layout = vsc7514_stats_layout; 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 123175618251..d665522e18c6 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -9,6 +9,11 @@ #include #include "ocelot.h" +const struct ocelot_stat_layout vsc7514_stats_layout[OCELOT_NUM_STATS] = { + OCELOT_COMMON_STATS, +}; +EXPORT_SYMBOL(vsc7514_stats_layout); + 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), diff --git a/include/soc/mscc/vsc7514_regs.h b/include/soc/mscc/vsc7514_regs.h index 9b40e7d00ec5..d2b5b6b86aff 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -8,8 +8,11 @@ #ifndef VSC7514_REGS_H #define VSC7514_REGS_H +#include #include +extern const struct ocelot_stat_layout vsc7514_stats_layout[]; + extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; extern const u32 vsc7514_ana_regmap[]; From patchwork Thu Sep 22 04:00:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984519 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 E0302ECAAD8 for ; Thu, 22 Sep 2022 04:01:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229449AbiIVEBt (ORCPT ); Thu, 22 Sep 2022 00:01:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229459AbiIVEB0 (ORCPT ); Thu, 22 Sep 2022 00:01:26 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F2E7ABD77; Wed, 21 Sep 2022 21:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a8GPbcPB3RkqCqmh8ekRa/l/B1sSD0fuD8W5v5/yqEn8nF3y9vSQyqAkvvAGxPDski4TCsZAZM3oylHFpzWISgjhU7yblSpez+qbgQ8/MjiDTb57DKnzyzR40rIKFuPM9serEknm9/jmUOHidXm8f1pK2abHyT+eQfOwroJrwKplzoyB6E562eIhcnTaIRVUcSbCH1BkoQZ3sg4P+23b8opUGvALB/pQXcemi0H6xPViLqSq+efukvbt4D/p++rUlfprWKP2qnmdae/kuabGOFOhZ8sAGm8No3j5skPAQVX1KiU304nrNM4E2iMss2nMfT/xbCU+1xGrcDI5hfElQw== 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=q/MiZTdOrE2a4EtP7WT3Tipii5x7dNqyfidmZ+i0mdA=; b=FECl/Niv0BJMnv7k0dk6axorsaBQ0lWQI+FoYiFvNxqKJGwyaj1QEavcRLs5ZW2SrHzPka1cpxFFZGjsU0JN5yyPyPnlSYjd7gOn18TaXSn3ANTON22qBgfq2TCrTwgyPapi+vxA+WaqiYa21OERga/PJRa+8LR9W+RsgJDcG06rKBqh+KBZu6lBvJgWPKWLmQMY1MvsLI0OB7fsDGcbaMxSjqNzXquns2Ash4ULe1hBcuPkImy0SrrEoCM6jf25VkgW4b5r83QDn/ASiXkRg61rDUpvOAsO2+tGaPlpPc0c+6B4d3lCt+XJYMG2fh//MAKGfwX63kX5v5kn1QTM+Q== 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=q/MiZTdOrE2a4EtP7WT3Tipii5x7dNqyfidmZ+i0mdA=; b=gukNywk3L1TSZKq0dEZmBQuvKc/PM0JdCZo43loIy9y2i4hSLwRQBHQM8TRxWri3cgf5aXp2ngHnsLVtxvjZI5Z+z3ZxLY28xTAnyIqXQfDzg1Z+sDbnlLtOChN90BNdPHZoVAQSZ8CK1jhGieRyTFgiVG2hoIDWht92mhiVYCI= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:23 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:23 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 04/14] net: mscc: ocelot: expose vcap_props structure Date: Wed, 21 Sep 2022 21:00:52 -0700 Message-Id: <20220922040102.1554459-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c100bec-8eeb-4e66-ec7c-08da9c4f1d3a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: g+qQCC8xkecV2+bOG0qd8ObaW46w0c0XgcFMgQ2mVYKhZsJljvhFo0om6pgJaQmO+hRL1z3KXtgjWFjGSZ5RD8q+yPi7ZAmYJwVe8vFN/P3Nws/9hAChlLO6eOl3GXWCbJR3Bt+C3fz+HuyzheCCAT/5OALnulQ5FexZ250mOhdrzfHyibQv91PSmcvO6aD6tuDUvPX4kS6fObezF9PXTuy8Uu7TP3EMLE67KEupZl23vdeUlZczMEve9tzwxo3Kvmku/nsCSVUiG9VZY4iaqqXjkZwJl1E4iHXokUnxsciLJ15ahrGNrv7JqUdlkYCvEux98ASl4SjRTXFq8dQ1WMOTIswFrWD1001xNk5wlDMG4oGNHSmRxRmpAiz6G/noRp2MKLRlJtTWrigrMvUx2MWPxq3zv63kzu2XILAjeecLwiry6wcxahxbSi37ZZMYea+w1/a5I7a0B3J1z9hyV1bhWVekluHR9f/UoAIrxxMjgNgIdexNuogwnPVhVNp8ih8V+kXmRzcqBesIUsCpsmGe2IWU16Enaa7ggKamET5Hx9BqcmoJOyr7AsIGvi3cBDl4a94PCBLkiqKJUw+JPLNMisbh4PN+yLwtvYYwnBk9C1C9Jbfsk0Fon9+3lNY6DCb113xY/FmUYB9Jt4cNXtYfxEvjVE0Pfih9D618fYBK2IuW0foZfXGe+p6k3EHgtMAbrguKZgxieQgu1/8oAcarTaSZiQ3DQVb8V1QwXaOuc8g93PFXtUrPsU7fQXuxIMcKJk81IC2UT9dN8x3/xQ== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GhZS7bff/s14Z59yFXj8/nzPdgJr81u0gBSMDu0XAaTIRW/cr9A58vS2loZxPE1O30wUtfNxZT2yylMlOG81FnI8a1SGPrD9pOVb13WeMWSb6H+6/HiU/eTuMiOQVVONZc4okXiHe6ErTiD6ZMKAHcaqHG2PmZjvT5KjTEXBcy/9zcOHBKp4DqO7fyQO0gaLW6ptzeOhlRdb7Ox5QbtOHbLqzK+jxR6KoLrrgd+DSEOGI/NEs3/zJKBsWfDb0m7IIfILlSPPvxl6IOo/1PVUCIDfpq6HoxFu194afRoON0tgsa541DDZx74Lh+Oxhhd4UmoWqhrG9qC3+eY68Oq334+XRhYnMXeeCMjzaRMtOLezS3G6hx8XzwqrrxeLmUoh4LLuiOeWP9f0PrZHr2ELVyIzhUY3lHlnuO3ITn/5vU6/ur7fvqlVDqPwnwk7hShcCOUCau0mwFVunQ25+GhLjNcre1NJwGJqE8h0YyqX0yAWYFmpy+vipHIsRR0Qq4eq23YYmjhXsdGRji8OFLmV4pbCfO/2NNCmMG2Sf0r6htYQLz492vR1hpl9DDWx+yNSHG7MVhX4f1g2rQL5nfbylON6uM4jLj6KazcnpMtS89aq5hU6Orf3+LMpFuNAJd0YwOPhwLVsz99qblQxtkFTg7SWsFNuGeb0IrbRm9mipfCVk1K2XvwxLWgUFHP/0bLGoXotFgqhaPY2GthpUb+7HFDfN1UQqJ4HF/GG0B9AAaMqY1srPydvKnXg0Fwk8voucIsv/zNdJhpWZei7uM4F35g8vOV9IofYGY+sHiH6SfBHZ9EJTWsJVNWwqXjgkmsVFRk9d5cN9Hxn+1UTv+kCMpt7Ow49T8337utfmYA4lBdymu4K9/hGuZXTOOhtwQYqd57JSx6zBErwfJIwnh3QiEcktMwBojUG8vwmBhebpoqjZ0PR8v7JQdE3uXET5tO5kqbgOxrnLkgtO6vHVShB/dspioch+I5nHrgDZMXxrWCpaSC4pybAsvkMQiho0amTxUtFGmcryUvfKS6YhPBNUtytlp/saw9/rIJCWVGS3w7ydAgsoA6atMa/AmZJ8YZL8hgkKTt88/9hRna28b3EVfuK3l1xSMPjAyzpF+oj296MkjpfHorTUSoKLcp0Trk3Mz/CwxgvEiw2QsRtuWIyl+ckOjJDPiKtzNBGBty0Hq8mZgKoUIfIM740kqaucJ2gKLNSbQFREvc6WPEqX6Pl3LazJ2oSQC4JIXX+ID2cBl+wbGIR1+Wfcj//dzB23YYZ6zn/z+kSolpBiZOzx9ARQPASyeD+g9VLzt9zNeQVh2j9ZfgkI/oiCS5QxYUw5d4rXDgrcUvTJAqEEv4Uuvwo03RDioKuXHrHcWNxl1ovLYfPWxrgUjbP+jmqDJ9VF4+CtZ6ALdh9kxR/AcldAwH71yE08VOesIBTgUWBpwhwv3yz8/ybm0T8kJn3tYV3axwBDLxZUH39jWaJyKPYdywIqEiLf6z4EB8Pj+u4c05VGXl0W65sRDFCcdtkWv+cspq+jCYvhNpamOg3SLEzdLUepqyZWTjYrn2WSFDKo4s1zMiYi/OyhacDF+RAgSQudgAsBF2N3O/l9EQdUNqSWh99tA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c100bec-8eeb-4e66-ec7c-08da9c4f1d3a X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:23.4346 (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: WlBjZnvUsZA/XmGr2Ki0BE0pJ/a7zEbo63QxovKgLPKcOLBM8CoUS0K868krrS2IgZzFnsh52wOjEI7kE4iN8aJsYi9242O3orPKdjxoO0A= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 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 --- v1 & v2 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 | 1 + 3 files changed, 45 insertions(+), 43 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot_vsc7514.c b/drivers/net/ethernet/mscc/ocelot_vsc7514.c index 4fb525f071ac..19e5486d1dbd 100644 --- a/drivers/net/ethernet/mscc/ocelot_vsc7514.c +++ b/drivers/net/ethernet/mscc/ocelot_vsc7514.c @@ -181,49 +181,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 d665522e18c6..c943da4dd1f1 100644 --- a/drivers/net/ethernet/mscc/vsc7514_regs.c +++ b/drivers/net/ethernet/mscc/vsc7514_regs.c @@ -644,3 +644,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 d2b5b6b86aff..a939849efd91 100644 --- a/include/soc/mscc/vsc7514_regs.h +++ b/include/soc/mscc/vsc7514_regs.h @@ -12,6 +12,7 @@ #include extern const struct ocelot_stat_layout vsc7514_stats_layout[]; +extern struct vcap_props vsc7514_vcap_props[]; extern const struct reg_field vsc7514_regfields[REGFIELD_MAX]; From patchwork Thu Sep 22 04:00:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984520 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 5FE9FECAAD8 for ; Thu, 22 Sep 2022 04:02:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230080AbiIVECV (ORCPT ); Thu, 22 Sep 2022 00:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229976AbiIVEBr (ORCPT ); Thu, 22 Sep 2022 00:01:47 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4A74ABF34; Wed, 21 Sep 2022 21:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hPEUeJ9id+zndVNEaXCh5x7Va8JfDD0tH9NWtzzP/E7q02OaBu0Va6LwfxmoK1taiwyKCzC196Pt01s6ae3m8sopl1SvPDLl0ULq3iNH12+Plgqv+IfEMhy4WFCTCQFrTy9OFyqvFAMR8X74N4IFDQbzWMKFsi/hH+O5y7F62gk30GSkwfoBqOXs3avrXv3As4VGVO2HjE9g9EDL9YqL5wy7X7ZMCRLJcRL7cEqjyWpBNb0/iylbq0GugmzvITDTdW4kOL3G2JGKqqMPZdXuJmuXu9Jy8RX2qrJ5hZMgHO5ftLlpTal+xsoIRHqZDalKcV5mYiNeFTltsaJ/OMhJOA== 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=0ZIdQp0VoRTiPr0r5rBFo3Bz4Idl+gY1W7OMLzeIMzI=; b=jEykubIrloIRTLixoPfk86zU0Msty70sDDfG38wMn0DZlcBiK79QDVLTwRX0suM0InfvlxUEIR2L5jVtW9m2E82zobYddm4sPCWzg4PWJbJpZzzkgZUxMMEpLhs2biO5BaX4a3U1YCKh7jC2tehT9/XmmGL6iC74uJYWVwyey/I/R9Oi1Fp6ElBY3s5SoB8b9eHJjz+fH6lBZ93f84SHDjydIQOQyEEqgjFv1Inqdagpu5X8kZfFlAiRSQIpH7X670eIefGGjXJ5j+ibQdAy39VynBKD70xt03lKgsB5fsou/I+tY6f62zVBmxyWJHThp7MKvfc73SBvZpQ21nz9Yg== 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=0ZIdQp0VoRTiPr0r5rBFo3Bz4Idl+gY1W7OMLzeIMzI=; b=MeLvxELVkf0kOC6a/sdnnVS0jKHSF6dQWeC1HwyVQf1yR00qcpp7iQjMZaqjmx2N27FZV4olBZPPaGl3peSnpLWgoc2B8sQocJi7kGChyaItuOxqqLBIee6eYlW5rL3OUIWqXJOu5Oc2j0Ml57LvEYNVBE2ytzhfPSDtSouUgic= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:25 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:25 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 05/14] net: mscc: ocelot: expose ocelot_reset routine Date: Wed, 21 Sep 2022 21:00:53 -0700 Message-Id: <20220922040102.1554459-6-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 72f1c559-4c46-4f59-c858-08da9c4f1e3e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XxhRcPXCiWMbrrLcEIQwRVNiUEUUYzSv4eVJzAVGRiU16fJRm78mdvFFDbmyJvzGx6VuyvHzJO0nTdXeDh/eMz/wzc10A7QrH0q76d6NlYG4QgQWarwdslZH4ahdPLGimvE8uQy4bvs3S3Nd/RN5b5u8QPKT+As2m4+SQeIfbiu94TQ81hZnQosYASwlCbF1FHbPBpNkdjGAHZd6+MZgQF05PIJ69lvQssyviF0S+hzQskV+QWo6djAoJrx3DlwZshLiiAKnANygwaIzrEpjNpmXVe8EmxxsvFjfpIMNlVD1LXxBRCg8FnfEnjhUJfcIQv35dOjx0lN/OzpJn9NeRH8w2ZmTB/uoO8b8Mk4U5bSSPbU6rhKDcwl3lttW1LjpGPc71Lh9aoylmHiZDI/RWjSMWiaVfxKQ8k8nRT1VqaRJl4lC3aciImlWQdhp28LSTPECl6c2fzsw0AlIpbqV7EfNZNPjeqt2Me2cBAeAjMQipM7RfG0koQIr6oDXKNbviTQVZkZ41iYOQSxPCrwfKE9zNQmZJy76DGdSyxn8AmmCsISDRyohCywX5vzuNFd/z27yqOo4WwjsIPZKUFRwfO1zP5gsi1x28qoyRpxdvpsr5RZHcWdLoWfzqrO1LhGrFJVfgoHJBwfzCk0T/iaHV98cwZGPdVsnKJKcsmW0AeejZh9/CWMi7wLuIcCMN0uLyYSVNL2r53+N/aEDf6BWnHwGb5wPUtTFH/Yg8Qy/jRN0kC7I/2GttAGWgnOiSCa9 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ZVjV25Zb0bMk/mnY0URxTCEuPJBQwoeddK0v4aSij+TgScZCYwp9O2044Rx62VsyVT5T3vicVasZKWG6iUFRTPZBjfISbfquIpd722nI/VaiBcRSvqOnpQ7+jxw3ZbifXwzHkliJGM2znQLnqTN8IIsj3SRORFLBo6loPEZJWFSAbIpwPu8ij3q3E6HaBuDRLUaLaBF0vvYte9NdAmygse+4c6qRL+w+Ro8YBA1Z7WIMc8PxKqtV9yNLOQ1L7G35NvwAvPEwEZ5DEUO6sFZ7e70xZFtLIOXI7aSCnELzSIHzu7Fs+mTezgkdVnyM4zpnug0LNtYnvHO2Lm6PqNJdkT3+PtHljLTvbv56Q0cVQGypCBvZ5LjLAsUH+uZ6GxTCY7RlHC6h8FnTcKR2oX0Ls7+WUaXehFlV3MkOvSg4i6i6NcorGbnrREeNJmbYIOZe5TbiWS87l+qHk/T8E1qLPDeuh6iqul38rke+Oj/jNxDv/99yrRLj6izKDD9ZJLnUliM9IXkyB4KanEnqwP4hYLJKMXCigTws5mKVlrXMRCq+Ha2zWNSKQdvNtDd7VroNR7B9ZHBI5l7a/5uP4N12UK4gFG/x4MeK0SvpHOp4JMS+qC06Obq0D02m00UJHQjB6xGwejywwAPGH8crOXXlIyp/FuOviXsaQnVP6Ywj16ppCSpglFdxv6eHWhADodM7SBr4/hoOPdK9geosVRl8RaVmj6extW7Y2hMSoxkjMakl1u5e4WINN3KXhIHK+/660lUPEOQKFvFaUQfJVBPmb4Bu2MIkCXIEBRkcnKAQND2QYKYxjBBT/0xKtAB/TCHknpiPQIOknqWrYUBVNJ2kNPnnoM1H0MqLaGeZk6kwv08wkkWTEMucf51K8n5Nj5/+dSHRoN7d5qaGfGn3SjraPM8tlGHyNoiHnUI1Rqjr/+8VN8Dkr6rVuIgMO2oXls6tWunyHKT3GYCKvBRNMVxzH94zngfraWXORvoKjhh7mg7GqEMC7OW8BjoK14d6UFg3NBSiIxe0xoYfP8W8Xtt9oJQwApBx1meHnzmH0qfxT7V94aFXrkfPYQvRykhwmuDP2+Ntt5A5KCJGrgDcz68fg+Vvds1Hahx/7bygeUj8IzDX2xBorFQms5xsLOJPM5IgvZierDf/Zm8hMU28RH3kpD2QP97K05XYqo5OS8zHvOdCbA4eVLaDMM9puaA8h/AGiXIOpL6Gp7GmIBE6opSDhtPU0ynJcjQq1oMk8Yssd30SQBNZ4tAxOu0kSqVkGykUYQttyPpzVjwkhJN5nJrx6DqVEzkTf72bIQ4InWnvOVnO9dB4iJBwyKGxA1YXavjq2oZVbj1bZKo2C+f6TBbv/jz91NI96r+fVJr8MVqseL1Akvgrzq6tWkobqOdE7AhU/GoZ0OZim9Iqo4/ElW+8qW8GFcergiz5sRufF/q96fxHleyFrtkaPoAgRWSpYNduEYk6NnCAqPkkRWq3FsJ6vP8B1p4eF9U8smUCPXLEiqkaZ2yUx0ivHwtebe+emJ0dc+cm4jFocdoDyST86SG/k62CJgWEUwfVuDu/psNyhCrsynsFitjusAV+l4WgEGPRcsIseBWR/z9QhILgUiw3hw== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 72f1c559-4c46-4f59-c858-08da9c4f1e3e X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:25.1845 (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: X+uLbH6Np1uxZR2omdC8qxbxUFrhDXGnfXJ3sXyvsSmsy6WC/+AIR5uKzw8sBG4hR1P77EQSsN+6ascgqCKp0EqN8Tz2mL0sqdq8Sp98d2o= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 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 --- 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 7a613b52787d..d43106e386e6 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 { @@ -2708,6 +2712,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 19e5486d1dbd..822b11d33288 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, @@ -133,45 +130,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 55bbd5319128..9c1c9b8c43f5 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -1134,6 +1134,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 Thu Sep 22 04:00:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984521 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 80738ECAAD8 for ; Thu, 22 Sep 2022 04:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbiIVECZ (ORCPT ); Thu, 22 Sep 2022 00:02:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230030AbiIVECT (ORCPT ); Thu, 22 Sep 2022 00:02:19 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4DD8ABF1B; Wed, 21 Sep 2022 21:01:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DEom0gi1xsxgWQoHCmAwZclEO51Ni9zU2aOort7prwM1ivXY/Zx9jPPHDuKIzJaxC3l7pjx0zuHJHfRjLBsKB5llP0DqmtoUKzcjdxtxJo6TwH5e/eoPdB1L4y5nloqJIJYOQc8JS7w0C4W54sHoovqWBHbVQ72KDj03XpQJvi5XOqGbpnGa3a2hJ/PZpVVaJ/+OEqsgoN8Op8cfIPVuDIVU6vE9qWlj0Y4XuECXveWOex8AMdUVBwruDeTP6W9OE85C9ZVtI8sElWdRMP4LsxP7QeE2DKQrViWoGaHffHPYCHSXxXpjyW9T4ea7e1oHBu7R2epkz/0QK8jb4cJnDg== 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=ONGQW62+yNyoZT3WnR5IAKDU5JdjQ2yDFLrDWUVUYLQ=; b=DPd8f519570vtrqHe2phjf8MAv53csPpoz9Sz9kP4b52Wa9ILe7r5m1ZwoRtBW5pTxnpWA2NagPxVoIfPHw9btFczO0DscaVH3sMAaSEsPaSytayYFd0MTrwuNDfpAiWgSPpEHyyqQPpiWvM0917CC3wYtvKTJWUq/dXrdvMFidO2ulWCG3VVe0WdsSaoZz6Q62GQYEpmJl+jeXl2HtpGXmbzUMEgz1kbBjKjGKuea0dSPmZ/saLPdtblKeTdhw+PnHxZmaG33tPsyqjGZ/nNNwjDoL/nTv6NCj7XpeguVYYMBhzOkd4BGuFYVg6uw23nCmRztsau2ihaAqk9x5uOQ== 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=ONGQW62+yNyoZT3WnR5IAKDU5JdjQ2yDFLrDWUVUYLQ=; b=VoUp0Vy/qVR/s0GHCj7c6ts9G8xnPs2S65gr8t0pQKAiXZBtRNAu4WNYZXYvWkFxvo6umOAG57PDYxvDbKVMvnBvPfU542Q4okTB1CU0hvszSuJR+eRjI5c9AImODxoDvY1TmSkpbSaazNQTEPKlqokcAjS/mB4R2DPqW3yATNM= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:27 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:27 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn , Vladimir Oltean Subject: [PATCH v2 net-next 06/14] net: dsa: felix: add configurable device quirks Date: Wed, 21 Sep 2022 21:00:54 -0700 Message-Id: <20220922040102.1554459-7-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 15fd9cb1-acc8-44ea-191c-08da9c4f1f58 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JVq4meG3R4XwgL8ZmRW3H7kdhUYyK9p+FLuuM9IBE5SFII2MiIP6VNvUq7qMAN5FgiJI3ySvAhIYuswMHJEK4TgS3bKc91EyZi9utKKw1mDnZVVIwR3fV930vfPxpujymSqkAppf1w0LEZSlJHmJVZKHiHf7sVjcdspx4Qp09m77sWuxavrpA3lGrMcLJAtuuKH4ZTfvjbpzkCfPWX3oDjNuttQPn8/3RmTXtkBnMOMliX2EKyxRbP67tTVRVjIIvOCvWf8+N7DKeeW6lWnBmNIG51FW0+kUYcrOZZUJXA+i+FhD2tw+VbcEhVx8IKzOhcj84LuIL3vGdYG6ORAubxUc0v1HoEock1MKU5qdrEkCTGj8fkYrJaHbFhxP24lsyCpADvUjj63AYH3fgk0qu3Hs5LgLD8U7kaY9uW/O4sREeK8OIaF9azGv6fl8sqwaV/6jG65RptTTan2C+WaOakg4Onx7C61bEvC3W2ANg3Q8u/ya6eyHQX3w+LDaN/+9kRrOakNF8iWDWYHS+O2Mp28yGvKD9RyuO3fvixqjhveSapGXUm3rvkziYhhA7eOZtagxbHS7wv/Ye5hBmIv4W0GI2WTxCuQ4vZ6d+/Tq078ku0zY7n7X0F7evia0nwBh3xCwp+UPjGxSHfrIkZkVWwj3Ek/9C3eg4KFZNAX+qbz/Y5690b4PD0vdUmyvdpNSCLZOLEH0OZXXcTj4ixlccN9UjaTQqod9iiV7CeyeAqXxDBSN8D6RUl+UCm/AAf21 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Mgh2e1qTvAujyAiu2Gcbmhm3id5UTeeo3FFCFQ3Xp9gFvEx5SyyUb6t/GV5lj524Au4nAUJyp1Mq+xPaLk1a2vcxsb5GkMzm4awH22cMBGxxOVQ1EQzrqNivmUdJCnryz8vKveSS8acsOKcRL72cNHMrvueBojIkuj1UXs0ETLOI/zTeyIXyCtBNl77/kEgET0erckmGkerZEtvifu9pQ850IR1PmFT//cduzc/rCHMp4B3QgauLlWhq0R6/jyBEO4K3hRf95nwyhtwqsoFGXndPzpd2HCtR5tkFdgJddiVPm+9HSAj/asacCcSewVpvUGQT0CHJScBorqMj0EH/kT6mGs+UsA7e/9WQ3+BUPhMT9ODwMU1ybDQ3rbpFEXfdvFCGfhQLvnU9C+hqCsMnGX/R9NcE747PtnIkDBTHkhVleWPLh2R+vmCX4fMk3AahKUkJY9iGq6t8lkDoALG/XZJSxZUfJ5x+EUBy3TQKhSdEMdgi2xt/yPOPizZi/0i2dfflGjGakUvbV+hPqdhVf6iCzVOtHsAUdoQpeMtbG5Llhnv5Vsx3qUmxPE4hjfBTscxUHuqHQqGPaRD9iJ55uiSzTVFV4fKzN1FuqnhYCEtZH5H2YKTwBwGwuUCvgX3A0jfo2gvw6C86rwWmnR0pOFX3USieZgaLoqBVuyaACsXFTbC2PsK2mu553iat873qcB5pYVd1QLpJvjEA1VLxHX/t0zC0hbFKFWhuyz7jwL8eJQI96J3jCB3K79FtJyyKWgb7OrPy00oBnNv7T4hs0L/+6EBk7hJFJpHD5VRmTTMK1pYwDigu8BSUE2gO2shdkgKGMLOrhrZFjHuaKEIHmIGyyjEQap0eIcR9quDMdneidQPQxAwVOAKrjW69pPwZ82CbDwhAMV1J1x9oW6HPNxJF98VGC11CLXngtOELMz9MFlnegjpBwtWIBIY36zlNyK03TAbjLEH/M4ADk4dd5raFxAWsAZ8BIFN/lQVcJeuVVa6n1nDcbSXe8QzcWflXW+cMcphDz65sQPEV5xTgSfsY22h2UT9tdaiWG9RPRXwXXHQRde3eHVgEYCmJJSrwEulBKRZNk2izBWNQYq60imgX48806U1CRxS1UjGmGHaNEVYLUkchsLSUiUkyym37ckal4IceZX+GHD4htnMheZTOYPNFWp6SaNY1qlOIaM1XyTQLJ1VgsSrx45flNr4Lz05UoxNBmr/R/lCA6qBmOtSDh5CIQkVTFLBbUOtSFdAY8S76eF4mcJyvtfkRNXUEn/nb8SffSXyFUQhl5iENbXUd5PsvpI2YV8/OauJebWQ3oGTEBhznATUtOmr/2RKrgObipz4SpZ3vJiB52NzX8BX6cVdl9lSaHSdtWC2mPDun6/QujqEeGv5VR6MzsuKMeSYTdyecnwXMgG7ZBZii/t3h0DByBKCVjrBD3t730B6zLBEN204XUHqTCetjt6AD9fFw9EByyZpuIQJrJrjjuiScGxWVx7ujKp5Ku8s7Q5Zmj6BArxIbSmwvtwgua5h3GETNMRQ6UCU9JJW9bTavHlTIvhCFFU66HO2czjR0sVav9IYQjKG68jFg3MaMptSOtI8EVLrb2Hl80/nAJGcxtQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 15fd9cb1-acc8-44ea-191c-08da9c4f1f58 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:27.2781 (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: iN9x2nxNAcEuMdbdXc6RO1juCg4OsgDkiksJqXIRyPsE5aypIVi8piioINZB6TJ36tv3hV1g7S8JCasXeQpNAFGt4x7qLay0TaAz3WG76dk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 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 --- v2 * 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 d2a9d292160c..07c2f1b6913d 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1082,9 +1082,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, @@ -1099,7 +1102,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 e4fd5eef57a0..f94a445c2542 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -33,6 +33,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 459288d6222c..4adb109c2e77 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2605,6 +2605,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 3ce1cd1a8d4a..ba71e5fa5921 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1071,6 +1071,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 Thu Sep 22 04:00:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984523 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 C2B2FC6FA8B for ; Thu, 22 Sep 2022 04:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230240AbiIVEDD (ORCPT ); Thu, 22 Sep 2022 00:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiIVECn (ORCPT ); Thu, 22 Sep 2022 00:02:43 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4190DAE857; Wed, 21 Sep 2022 21:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qf0OsrHOdvoss8dZvQZ65uw6DAIdsffnpbhZStmYb4dJz91HQ5JIkhP7ENDNqenZtFYGjkHqEiauReWP9KhpqGL/rVF1pZXoRDlcdZXXvfxVyGSJTeE6U/woIbr2OrlQ83rnsf05aO5js5NEhCrWW/GFiwKjlaWWmAuuhXePDZQ9fG/cMr1weKdBEdxxHZN+Ey8XmNNvm7mfZ/XPLJGLZmWlxAqR5iFMSTA/wNZ/X8gNBqUbY7ZbDzsgg/0so3oTxBtamhkvP+8Gb7D4Kxy04+9xrX2pWBaH7Ct1RCyD1D+bqlQgKQpugXG3JkFkUqr0JdtuR5QAgY2HzDR/OuuP7Q== 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=Y2St/wnhFy3eCvX39K5BODxMvf/1cHD8HMPYGL2JVFw=; b=icQABE4Ppd74/5vYskb/xdg7/CJXV28LMOqVK3MtmwDsMS1yxkBx4Il3B0wPBW/iYz7i61E94rcSQKHNKvT8d5JlgKmbg75wyCo/Oj1Ze/HYwqfBPQD8o6hpl2LtrFA/Wtv1yCF+A2P0GqTo+zCM9PqpqAk1Xh9F7zip5vh3TzFFlTjNeHSQFeRe745SBtQvj/y4wBD99vd4QdoAu39eXl2LhQzJpGQ9Pvt5m2yl5m/AicAN/Os8PEypn3LmYn8SPL84pnTxWUJlyc5KlWoXJgEoSfQGsJ9jUo5hsfimkAiZj++/HI+U4FNLFgyZkM/DDxrpRbTHOpVeJ7FojWJycQ== 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=Y2St/wnhFy3eCvX39K5BODxMvf/1cHD8HMPYGL2JVFw=; b=nkHQEd8x7LeOkEjZ9+tIF56oNaGd0sVbsXO8WyRVRXGV4qn61cEqLB7XJnR/bQrtQG//ZRaSg5AuJWY8v/Yvg9OrErq8Q7lxmsACJq5jI/hmZMgJBUnnx3BldDCVhAocdNB7MLqS8P/jmtoEhrVjOxO9ux51wn10jIqeXMcMwdY= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:29 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:29 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 07/14] net: dsa: felix: populate mac_capabilities for all ports Date: Wed, 21 Sep 2022 21:00:55 -0700 Message-Id: <20220922040102.1554459-8-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: e7d63a46-9bc6-49d4-a30f-08da9c4f208b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 09GcxhPr5grRb5rnF0hp+USYes9n0LVwK5JwU7iTEGyEXn2NQVmmhRw3KD7wlDBvvLKY8EVpLjaa+NrzC/ThvAgSLtNxstr66agGz2COchMKQ1vISDfK9h/iO6gr+4kbZO+PiPd7Yw4/H5jzxCxUgtLQQ/QgUItYg/aHI+fKdPMopuxTF/tHzVpyYcx+dNxb9MTg/w2ekp83DV76d7h2RHIslv+FXR+0MWlJ0Sgxfl35R4GHHjtmpHwe6PxxHLi6/PHp1CdYX1V2D5nTtXG0N+pRtbbA6lAoXUfZgFNEsKVbOiKdgJ0KdFRP50wazRQ4sTLwifzlVDkxoHdVb9L5eY22wkTkwoGCvLJRLUANdc2z7OPdefkYd1RswFZG7jTOTvwVnvg9DPk/T0n+LzSxj4A6qE1YjOg7dS08weZifV37TRUk5syJA7k3SWOmSdtM+42l7UXrv6fVerz7vS23/REti5CKxkfxUPJ0qpNpbIeetvYz/N4KiUxwxU1PWXU4CKqIq34c9uWNA8b9wB06sL00Ufh6aDTEUYCXx/GoMVf5cn+ujrcpEmDWRBtCcklQ7cER8IyHAr9Jyzf5f+7OXvVP6bb325BXreZ9d5+zPLnwFTlaDrBli/fmRyizeUH32wFIBvGTczAwmQXDfsMULmUbhttj38gopR0H8RaiEQ64/Uq4QLt7/jBwYAojjjLcgv+i6coqcQiNpxHLOOUOeiYyu/+4jpR4BgU0984DukiviFpgsENONOXusmTjlzo90d5LBesmlmsFPxMFD4X10g== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KzzdkszRb/tM68/dS0/ZjdvXQzU05+cQJ8ODMnQ5v3bQsPY7Vc6oU43b2xjof0ZA1OhooXbPfWasKj3CbILwRaWV5Q84rGTS2x5uutCZ3qWM+hinS+Jnt8on+mHVeogycywxijOp6c8C2Snshr0i8qBVJPs0S0k+hxTh8+yCjMLFBnDpQi0jNM79lJEP6ztfnF0A9IoC/MCtGpayYb5mePptnkkVxT64fDIe2aQzWXt9KW+ZKg8q1boEvVvWxpYJiYvHqBjbRQ1zGdSk+98JW954iQ8lyuCMYUZNekFpX1v8vDfwnyWmx3FTPVAgmf+UZ+83NhYuYvrnI9DDfxLXh+BuuBmWl+9ZGCMB9QOZmQhWW3swC43ukjKmyhgCYNmiNXbnQv4+pQtjX1GOFwdLGDKc9gvcQ0s2KRHcaPi8PA8ZKIrnAZAmyoSDJc2KA68dfjivPdCfkKACufaw+CSZbEV0RgbqP3q9QBcRcqdGIUCMzll+teXteHCL9tpsQ6PRw5Hx3VnOU4IdH3gNPz8nalUQS5yEdwPpu1/c8uQ1krZUSpoUjH2M0JLYeJDiSYgmQ4khXMZ0MxPR0I5u/l92sR+qLTK5KfxwhTRYGwFsCAXmS/DNLwT7c1sYK9lTpiQdE3izLxoG5bbxEazzfVkdvmGn6ZYHEx7SPEcTx8MCUVM1vWB7BDZ9omR+BPd17DKBsZNcPgbxJyV0pT5v/KSqsernNkejOiHQBiqjga/FSViXtv6jS62SeF5sllUEUyKNxVK60NKlmDss+6Mxs88iNfE6SiteaNdxTd5AUD2fDTvMaS7S254k5QS8A88z20J0Zm47D3haB3rFL4R72GzzfCVEZnGcxsLA2RnzDIBrELRVARYH3FzJOA+VpqwtTaTs6Kpe/nV7e0vOBHx4rR8c6J9i9ReQ8/A09UrAATrYVZT5r65J8lTtyAq2nWyj6aq1Mw9RtD//xYJXP9myyK2EdtsCR01ZbJ6rO1lfB+RiWVthnFGged2QcF+4hEJ+qmJvaPBfcu1Eq4LybjEiVEZxlzjoh3RfuT3Efj/oJviwf2+mFy/0IYFf5Sgd4fzTJGli7d0yWjGn2ZLGcHG0heEwOFCjtdA973EI2HqlJj180WCR2HX70q59LhVDhbiMCIzVIVV3W0VGeLS3VIUp9T4o2TsUDe75yUdd1tLShHtEUUXiKXDPhZm/Oa8K1Z2HRGWo8XBmBMHnRB8lknT2+BOVsK6OL3xzVJT3zasE6NCXVxcCLMWkf+XkgLp+FSwopfjNz5jrU67ukLUDrF2+akzYtneeVzASDgfPRSx/ntEqnfyF52pO2lNZ/3+0bvaGJeVdPbIMMFgD8a1g30oCmmG053V/8bN03AfGkvmRkZS3joPhxyEOZdRxI/HKITpZN/O8s4CEnmapwuRdwLD6KBO/cqoZ/qTusVupq4oUo5JRWLGo8kYOomwrDwK4epVbQ4F1+oKUI9M5EBpA5/eCi95AcNQ+qcN21ltsVQALEuSmw6UF3lZbHMZnnvT58qOEP1+UrB7NVmdUTtdZPFMRVEOCVu3QTPNnR2dCJ7wToH535kKIyrMg+F9OB7S0/jPtTPpoZX1gIO4Ptoug50tL/6j6dA== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e7d63a46-9bc6-49d4-a30f-08da9c4f208b X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:29.0592 (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: mMpe1oCSv6B5CUL5pIMGxPCo3K7cnz6uOIVvh+cFDfye08M8Py7rZmFVt0vLQecjB1aPzclTImETQeZoPh0U1H/73tFF9tt8KX1wEW4o1Yo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org phylink_generic_validate() requires that mac_capabilities is correctly populated. While no existing felix drivers have used phylink_generic_validate(), the ocelot_ext.c driver will. Populate this element so the use of existing functions is possible. Signed-off-by: Colin Foster --- v2 * Updated commit message to indicate "no existing felix drivers" instead of "no existing drivers" v1 from previous RFC: * New patch --- drivers/net/dsa/ocelot/felix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 07c2f1b6913d..a8196cdedcc5 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1050,6 +1050,9 @@ static void felix_phylink_get_caps(struct dsa_switch *ds, int port, __set_bit(ocelot->ports[port]->phy_mode, config->supported_interfaces); + + config->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10 | + MAC_100 | MAC_1000FD | MAC_2500FD; } static void felix_phylink_validate(struct dsa_switch *ds, int port, From patchwork Thu Sep 22 04:00:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984525 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 A0F4FC6FA90 for ; Thu, 22 Sep 2022 04:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230380AbiIVEDe (ORCPT ); Thu, 22 Sep 2022 00:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230372AbiIVECt (ORCPT ); Thu, 22 Sep 2022 00:02:49 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4690AEDB8; Wed, 21 Sep 2022 21:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1/OhebMpCuISDkj+VXDC0Yld+6kJWNVlIgTbbKNwdYTriowTvSmLLLIndoa80UQxzMXI6PSvrkkvD34hr8hwLVDZ7YOCHwKVNEu8plwehkXClS/L3yK1xxjYXsYDzZ4WSVARn3PY8C6BnZeX8wJWZ2Akz/E5nCxnTFnJWwlXyDwWllEVthWIEi29GsXJBCxkqsQnqrZw9hhoEyGXOZySssF1cFUWqN8j2GoopgtB9L9TI/VIW73Qro87l7p1+Jnn8tgOrUiVHk13tW9RtKwZFYX4/cyul/mSb7qNAhQEWRc7zcK+6d1bpzQkDRqYLAA0KUF23MI1Fv90aJFBlPmuw== 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=Ge0/0bsnUSNKMHWoEvOOtlwjEquTDRXoESOzy4fmmgI=; b=UK0QOFqgeNBBb+zVN098EXGRMdd4KRVH2X6AI//94IwO5lLZNa0AKTNzaiYZ7dbHZ6UbqiRSHkCwiTvOz/8rNbs4YQkm4MUznhLDtmAzV411ThTSdkLpyqHb3Xd1b68TKIQsLO4pwgHpIWM1R/tAgsHrnRFLfqnhfROneKi37hW1Ea324WgQaryEO1F6y8ctlzWbta5XhQ+tb2JinIqTfAr2ASoAwZ88yGG9FmCygXP05Fg2eiESS92935T0F08jD7PgX3veRUE5S+nv8vhQmt3ktObbiNRfozCcw1mYL3/leyq9knaPAoxfdLs6x7HqQRo+8J94ehooMzSn4HZ14Q== 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=Ge0/0bsnUSNKMHWoEvOOtlwjEquTDRXoESOzy4fmmgI=; b=0czX5LPIH7vZvO9vcvouYdrhN8D+uYMVdJAdpWsSNVTGL+G4TEF4XrlxFpfE5mxyxQQezYemJJHa4SyY8Sh3J7kLGK5HaN3TLE72DijEaXNM+9tvAm9iN0oh/kDMQTUdvC8Tk8aSMaPOdvaz7W+Oyxke8QPXdAgtageAA0VXyjo= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:30 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:30 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 08/14] net: dsa: felix: update init_regmap to be string-based Date: Wed, 21 Sep 2022 21:00:56 -0700 Message-Id: <20220922040102.1554459-9-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 6232379b-aa2d-46bb-b86a-08da9c4f21a9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TbGnAdbHEjunIkSvhx/s/Zv2OqAattxYcuC0SvsyQYk9rlu9VHY6HpsbdC9nTxJMpq4FjKCN/X2DyaKi4ydy7W5WAhtqj6sWBcw3LLRBT98affu3AfmxYtbXNsFRmVdjqTMvX7Rd8bHKAmkPYyK+yDREYQMALYQWVBgSRmjo4xbipWSkCQSvScxvwBNJGxBgyJLqCV2lZxXYG7rk4icvkt2O82/8IXGCDR+jJGDjXeDMudNPs5dR5yfnoYjPxxLbKweSkdpNNxy3xmPUQIRtBsHp5drdtz8bUrBgJocnvID+N4pCtfYSdlUtWDHqJ3KZYarb7lkSECrhNxWD5kQUXddLWb4tqVB1jw0hIkBEGdofO2fp+gfnqNR3jS2kfh5tmUBVEJi3J7yBFZ3vppPg5ygganuaVaevxYC82iQykPkOnC23iIXXn8tQcyy86Ig2k6o8xh8+sw5B+J51vjDaWdDNGe1cpi741wgyPTSlCbN0S2bCqeCh1HJp4Vyo1pSTRE0lxajxnYN/ISkXMdNus7KRhgeBV9p9RIhVKltWENV6Jv0CaDTI2PgHXzu5qQwIza5pAMb6ovm74nPFgQ+bjH8eEfYB7ffJ9uKQvGWGCq1+NFJA/uB8LRM2qElz1+2Ppvv2yTnSw/4xXlbBoIkXupfP2nQ7ZfgeHVkveNwx3OeHuMHmR+U/VbTT3V9zxJ0mKRRWQVfFDxj48xh4eokdAm/6+Q9xwB20G69p3MV/SLx1HjHqoDOH1ia6QoyNi2+HIsfIZlPYEFe0YqYiGCjbVw== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(83380400001)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OFKnAXYWMrm+esq1YRXSKzHoPVUfgp8RL8DLGGH9zrYikdxubuaWZCbEiYhdxf2NC75tESdb2Gn4D0V6T+M8enAXuzXM3mwyhuHYnGO/sz0hXezaLgSnfRY/mU59VFGvYOKi8y6bp3BoShSPdGpvxRddxLiZWNBNvlAqw7/kYzv5yJeCKjN7ZbDxoXmHJGFTYd85fmo2gFUibAW05YSvJo6Ka8O21jaCcJdCVX9jDs1piOWPiEPXwPdVJeXBYQIvQ0KFldksuT1lSDfO/3xUuyRpM2BIX/JKb/fucL5UvpYC8iXe2yV1LOKy91o4NyG1VZNaP1zuI3eKxTVQy28OfbGUZmM6c47FN9uUDbgpJckGoa8b/aludlvtmjo4RszNjrR4LC5tgpzZwM8IF3J1CtmDaxSfMYispg/XsX09TTUfx2/u3OYaTjBJt4bx0zr5eaoUXxnjIobyh8Okpae9MKlVwFmCU8YtUpJBs4kbeScSb87oJ7kfCBz8+6MpXlL341XbcB7kQGpTtMLN/pREUKT360QWGM3YStEsyI3BZuwo7LQ6Bpd2JQv7UbFGBHfyCr3npl4tUB55jHd+YjW/3se6T6UHa4eGM85vr3FzOmmFFmaihKDzbBuTr0fgeQImZuD6xF/pTjaM8pyxyWcXJeFv5EbSN3COvC5793JEUyXVD6K++wWxBz1jZF2egZ+OxaLAgd2FzKYI92FCquzD9TA8egOXzK3L0gbgwTm8Nx5tgPGlRYEojg+lyEgVbqSbU1tXgjRs3ob8gALona4yGW6WIX1r8FN7FTcxgPH160P7ljIprsOh3JB6FSau/JFRt6JaHm91WbBdpNMaqb1dUm3GqIHeVaensCruBFrsRH+vijAVyI5NW4EuXDEsR6WacSrcphYjyfot4JmB9xfkUmx0DRf15jFdKXSlpWCs5cHV5J/s7hJY3dUL9S74Glt2BJrXJHJ1WjLTa9SOFa0w7xWcNw5eoycSMxB51jTDypVVpXJru8QuVNMrum7HurYFppPZptwtr3/yyqy07S1WbYRWW2AUATInamrXeudAOAdYzYvnIoKP9KHLweuYN9vzAsxf4Ta1ZdzBZXtMFtRHl5py6yld+DlRFfDGESvVQq4PW+oOqlIL/FlIIV2hVo5M//WcwCSOU2cR3ACGzHjEvK2lhm+6+r7M8wMdvPI6ZckU+8/SC5hE2ekcJibG9bLscq2Qgn1m8zj/398K50RVnab0IevG7ywOje5RmayQzj6wM/SNYe3n/CCau1petQiDwBd5zWQXTPSWEIM+CKbXV4HoLAiEscXvvDksUMAJKIdtMSodjFR5lvFdOsOob1dXB1N0QxOwq81k6LbIzgEtLfzVJPXbzpwPvjPAbZFbc2TuLnOsEWHZSq4anIcCiIDWByU3aDO+sWJi1wMYy7BplQAVK4ru9MynszOkbeWaD9/cmg1H5FAZqFU59R0FPEe7IWu4d/Yrdy+SqUwv2fOQuI7myT973qBL5cWBF+DXQANoL59nfQwgjFtCzfRdI7+PkGKyNw1/6/suARca6j8xPglA2sYDtz0dWG0UAXtGvTp+DuPKi7d6LCJyiQBW9rWbz0aALuOTedO04rB2pxn2Jg== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6232379b-aa2d-46bb-b86a-08da9c4f21a9 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:30.8873 (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: tFXSy147e5ebhJ50DnLJeDaMKuhI1sQvLBVLx0jACbiCsJ7li5wxM1Gpx+EM/OQC+I5trWV/ILOi48VZp6ZxVqs5ciDOBNKQ5y9zLZZncAc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org During development, it was believed that a wrapper for ocelot_regmap_init() would be sufficient for the felix driver to work in non-mmio scenarios. This was merged in during commit 242bd0c10bbd ("net: dsa: ocelot: felix: add interface for custom regmaps") As the external ocelot DSA driver grew closer to an acceptable state, it was realized that most of the parameters that were passed in from struct resource *res were useless and ignored. This is due to the fact that the external ocelot DSA driver utilizes dev_get_regmap(dev, resource->name). Instead of simply ignoring those parameters, refactor the API to only require the name as an argument. MMIO scenarios this will reconstruct the struct resource before calling ocelot_regmap_init(ocelot, resource). MFD scenarios need only call dev_get_regmap(dev, name). Signed-off-by: Colin Foster --- v2 * New patch --- drivers/net/dsa/ocelot/felix.c | 59 ++++++++++++++++++------ drivers/net/dsa/ocelot/felix.h | 4 +- drivers/net/dsa/ocelot/felix_vsc9959.c | 2 +- drivers/net/dsa/ocelot/seville_vsc9953.c | 2 +- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index a8196cdedcc5..d600a14872e3 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -1318,11 +1318,49 @@ static int felix_parse_dt(struct felix *felix, phy_interface_t *port_phy_modes) return err; } +struct regmap *felix_init_regmap(struct ocelot *ocelot, const char *name) +{ + struct felix *felix = ocelot_to_felix(ocelot); + const struct resource *match; + struct resource res; + int i; + + for (i = 0; i < TARGET_MAX; i++) { + if (!felix->info->target_io_res[i].name) + continue; + + if (!strcmp(name, felix->info->target_io_res[i].name)) { + match = &felix->info->target_io_res[i]; + break; + } + } + + if (!match) { + for (i = 0; i < ocelot->num_phys_ports; i++) { + if (!strcmp(name, felix->info->port_io_res[i].name)) { + match = &felix->info->port_io_res[i]; + break; + } + } + } + + if (!match) + return ERR_PTR(-EINVAL); + + memcpy(&res, match, sizeof(res)); + res.flags = IORESOURCE_MEM; + res.start += felix->switch_base; + res.end += felix->switch_base; + + return ocelot_regmap_init(ocelot, &res); +} +EXPORT_SYMBOL(felix_init_regmap); + static int felix_init_structs(struct felix *felix, int num_phys_ports) { struct ocelot *ocelot = &felix->ocelot; phy_interface_t *port_phy_modes; - struct resource res; + const char *name; int port, i, err; ocelot->num_phys_ports = num_phys_ports; @@ -1358,15 +1396,12 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) for (i = 0; i < TARGET_MAX; i++) { struct regmap *target; - if (!felix->info->target_io_res[i].name) - continue; + name = felix->info->target_io_res[i].name; - memcpy(&res, &felix->info->target_io_res[i], sizeof(res)); - res.flags = IORESOURCE_MEM; - res.start += felix->switch_base; - res.end += felix->switch_base; + if (!name) + continue; - target = felix->info->init_regmap(ocelot, &res); + target = felix->info->init_regmap(ocelot, name); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map device memory space\n"); @@ -1398,12 +1433,8 @@ static int felix_init_structs(struct felix *felix, int num_phys_ports) return -ENOMEM; } - memcpy(&res, &felix->info->port_io_res[port], sizeof(res)); - res.flags = IORESOURCE_MEM; - res.start += felix->switch_base; - res.end += felix->switch_base; - - target = felix->info->init_regmap(ocelot, &res); + name = felix->info->port_io_res[port].name; + target = felix->info->init_regmap(ocelot, name); if (IS_ERR(target)) { dev_err(ocelot->dev, "Failed to map memory space for port %d\n", diff --git a/drivers/net/dsa/ocelot/felix.h b/drivers/net/dsa/ocelot/felix.h index f94a445c2542..e623806eb8ee 100644 --- a/drivers/net/dsa/ocelot/felix.h +++ b/drivers/net/dsa/ocelot/felix.h @@ -57,8 +57,7 @@ struct felix_info { void (*tas_guard_bands_update)(struct ocelot *ocelot, int port); void (*port_sched_speed_set)(struct ocelot *ocelot, int port, u32 speed); - struct regmap *(*init_regmap)(struct ocelot *ocelot, - struct resource *res); + struct regmap *(*init_regmap)(struct ocelot *ocelot, const char *name); }; /* Methods for initializing the hardware resources specific to a tagging @@ -97,5 +96,6 @@ struct felix { struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port); int felix_netdev_to_port(struct net_device *dev); +struct regmap *felix_init_regmap(struct ocelot *ocelot, const char *name); #endif diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 4adb109c2e77..87a38a57613c 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2615,7 +2615,7 @@ static const struct felix_info felix_info_vsc9959 = { .port_setup_tc = vsc9959_port_setup_tc, .port_sched_speed_set = vsc9959_sched_speed_set, .tas_guard_bands_update = vsc9959_tas_guard_bands_update, - .init_regmap = ocelot_regmap_init, + .init_regmap = felix_init_regmap, }; static irqreturn_t felix_irq_handler(int irq, void *data) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index ba71e5fa5921..a66bd35ce4ee 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1079,7 +1079,7 @@ static const struct felix_info seville_info_vsc9953 = { .mdio_bus_free = vsc9953_mdio_bus_free, .phylink_validate = vsc9953_phylink_validate, .port_modes = vsc9953_port_modes, - .init_regmap = ocelot_regmap_init, + .init_regmap = felix_init_regmap, }; static int seville_probe(struct platform_device *pdev) From patchwork Thu Sep 22 04:00:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984527 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 32F4DC54EE9 for ; Thu, 22 Sep 2022 04:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229459AbiIVEEF (ORCPT ); Thu, 22 Sep 2022 00:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbiIVEDD (ORCPT ); Thu, 22 Sep 2022 00:03:03 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2093.outbound.protection.outlook.com [40.107.94.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B251CAF0FC; Wed, 21 Sep 2022 21:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Um0mP8r8pCy/9Piy7ifeFPechKyVFCKPtbeB5Psle3/0G0L9tVTlYrGCWAzYdnxq1I0ZBEL/4HzCgXSAuJ5eldpf133NptJ17fvKLJ/1tLj3uKBYGI/Bi9sI6W64XVm79zPkoOB5nN8KM1XH24bfjLT35gq/nxTpwqdkXbGytgV1J9tjusQ3YxcVknLBwnWJvtNhCXjowogb3jR05JmI1F2ZQOCT1VyJvuFkXz3F1cHneLmSW9NV8YYV/LoL7Tq9WD30o6f92sQIKqxg5U668WP3bGBCWnCy5/2Nm3CPJnzJD0v4gn7SP0qQ/FPpwd7SWz8Ke6fX9n60ptIXViHOZg== 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=1EqDZLeGa1PGjXMcCdYL4dKOADUpamKDgDZTr0W7P9c=; b=mZ0d05D6UzbI9hfgJSgo3aIVDLyq7aLl3axJJph9BSDY1IVT+0UHd7N9/+p700b9fC4RF/SUkDBae5oo16FTSO+fgl2fOWXxHkK5sPLz2d9LTuMARHrjZmI0x1YSjPiwL1av+h8jDC/bD7RLQgMjUMSf7M8LPK15yu/Lncw2b83BpDh7ujBu0Su728cHPJzlCegsYZ1fJGw4AOVz4DGHctG0RoLPcZ9CjbtynnbsosOsVHLvws6ICOE+UU4pyJBXy29/WpTwTUFV+HEVYYkTXtMHKJeGz+1iCZVEg/IKybhEABCnUPHFo+QdAFs8tyLPkdR7MuHybZQKeWmzW6s7vw== 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=1EqDZLeGa1PGjXMcCdYL4dKOADUpamKDgDZTr0W7P9c=; b=ttetO8EjOhSOuJ1dw+eW+sFTy+C92uhHxg5uzcxwNAiJNADGP3lB5m81fTRul8li2vPW+m/VHFFRKH04w4snNTugvDlZWmEh3YyOMnxZN4zzbHFwcSHysotk2Cm+XOO8N97hbviBm+eFCs2IeKNzNcZYnYFTMm+Hoep0YUWJxGU= 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 BN0PR10MB5158.namprd10.prod.outlook.com (2603:10b6:408:120::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.17; Thu, 22 Sep 2022 04:01:32 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:32 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 09/14] pinctrl: ocelot: avoid macro redefinition Date: Wed, 21 Sep 2022 21:00:57 -0700 Message-Id: <20220922040102.1554459-10-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|BN0PR10MB5158:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c88097b-e343-4dfa-1d74-08da9c4f22b7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JtWz1DClgfOJDpUOjOqRarRQynfYOzGUvrYychaAJ+74hLckPg7UM/V938DApCJTSbspnnV+nwVmRXJNVczz4y2k40gTFrcDyhSdtFLgYkRjFOCjNX/e90XGVF0QPxunPN0DnRnYvD4x7tZyMEszLU48lhyfkfM7kM42o5WWAml4mbdY/PmYQ+qJeB88fqOeoxDcNbi9szUl8jf5IascCfeC3a1a0w38t/tcd8GrnK+gWBqDa7civtrGL2qNpJwtWbI/cpGbW+aFFvk+7FdmnVe9oCxaC/Qn4csr5G5flEFuRlI0w1vwvQrVFLXuOQrFmPjM7n/FV0XvPyzo+mVau3l2T1FmjRxzOWdReUYkM7977NnGBritt3cuhAZ09uGWUhPZk+W/CbT9n4vw6Djd9N+gmnB3ihB23mXQT9D+NUBpc4JlZVzRQDwRmWgSgzEPNHkT1fY+FqbCHAD9QNg/e4/zgpaxf+gR9z0VAdRpFKV/lYTJ2ESR2Hr2RIqmp4EONlVg4FyS918mNtUt00DHTtWYdhVCGAfCb4Kl2prbz06c6E7Z2SAVck9go1BtQoMozodruwCGogtWEmQfqm8oJ+AzuRV7DR2pmDYOzNXgR8vkEWJpX0uDnKgBQNH5SLT1QefUc8ELc1G60g2SV6bTf0HV6kxPrQ6JRJgwoLOhHv7feyEwUCvPAOk3dNOcdFPr20reLvQm5ApEke7wOTL2gX+xA+5tk93cD84U98FZboyFxT6Uog4oXAXDEGbiq/mieBVpiJucUa79/42Vq2fhfA== 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:(13230022)(376002)(396003)(39840400004)(366004)(136003)(346002)(451199015)(6666004)(36756003)(41300700001)(8936002)(44832011)(26005)(6512007)(7416002)(6506007)(5660300002)(316002)(478600001)(54906003)(6486002)(38100700002)(8676002)(66476007)(66556008)(38350700002)(4326008)(66946007)(52116002)(1076003)(186003)(2616005)(86362001)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1pprJVUMIvBL5V5/BJWoILn4jdxNMC7sRHccc6gE5ta+nItn5SJR0s2og9yRV2KypZt3II1QtlNR7sGWoH5Of0/kv/lCx1ob8VtYfMsIwGZQ/qxWoGRKQ/AIpFhS/JVBFLYl9jJT1ETTH+LyAaaS/flBllvIWVD8PK/9RO1WmZw2MdVpds0GifOvASF8WYEb8L8CcZQ/kxvurQwCAyj9vw40kigErD3nrk+DWepDoX/FRN30VfLUiAOrfj6c2SCoYGl2JgyQyjRwnSSYjsB4Ii6O+SsYEFMK743SffDoCagQbb2L2CLYoaDGmDFF1Pttnr0eoh6NvVwVU05ACiRf45T/MmByXRI0zBvl76fbZxuw3hxOCWG1LbpJIcKsCwyS5fPcXkE7Mc0iwFjRmjIs9PAZjJGlNer28iNMRT0++t0Yv6GLz5AB7qkMFlXxN6ATX6VRWxcfGy2LhLn0kaM/Bkj+wJy55Mk9mtrprv5zCLAwPGlT/F5o7vOyQ7QJQnggk4pHJ3nxJ9W7VOjuL6n5r2Z1+cOlVBDXwWtRKBumVCHFyybmaxLE7rj075S0zRWkWrV0qtlVZ5F5kW1P5m2Cthq4mYOREVx2yuTxJbpFgoCOIwGt1+H1sBLOOgT9lSZUz8Jk5nXfzlNwYNzoACTsXUmxtQqbNtazNrF0eR/imz6u9LNmadX5Hzn6wfuiaAsFs/5fDXdCJczGlW6jseXq6msGv1a9L2MrUEWzMo3SrtjgGwvIT3Bquloa+IcIbnYAV+wYZ1oda/DPEboTYaKcJJ2HBpIxtU+7lTBwP56UoceS53GWzSNZwV1Npr+u4vguOJEudNJN9GQLpFjI1x202oYejJNcQpq4rbRTsxPr5NNa6Qf671zAe0cZWII/bxpcdSiZb4d9XN2Ez4jJzY0LEeGfZCe1PeBSL4Z8pITbDa0hbrpQracow3mxk0zffzHdp8do6vZbZSEvApHDXQ0kJOMnmOidDtilHi+6a/lnnZ02+ymqNHCk02D9qhSXoruRHukVUgsPgHH6B8dW5kxdSv4I7InHJwOAGmTuCDmYrm0Zup/NdssjEQT7EVj+wLaajpE6Jnj/bwX69/fIc4EUhc3zjOPxkV3as2lr13F6r7IuMjNslxgtPGmwNgYPmo+mXBf6oRcsCbkLbr5jbgV05p5/Mbpz4Po/peTo63RB+RlGrP+gz0IHO5nN2HnSOBX8qeevvOob4/w2bgVpY7Mxw9w5wtBVe83bokuMbcfwkORmay1H8Nqo9O8mxrEFKVIjvCy6Fcw+H2WaStXZJi/L/cgjTiVZmFpNbFJYrpjX3hbzRq7Sf/yUGpcOGldOF90pId2i3waZTf6ukxmsaHkEZa/FfeSGbhWbeingy3mz1DpgyZNm49FBY5sJqRDHqmBfO5JxubjdgtRUbfb67+pOFzf4hRxQTDbcUSdrnR4q+j94xdYJ4ixYcqvsetIPxVS9L1OumrNBt78h7TRJOK4rmFlg9djIMdPYw1R0t3BS+sm00asaWal6luNfk+UW3cMEYILqrUuM+CUWoPGikUfLvcbZp61rUPOlXZlo2iZB0E+Autc07afcx4x+2Di22ugJOC7hr9dSPpZpPls37aZirahBAqK9FiGkpASZMhzClRs= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9c88097b-e343-4dfa-1d74-08da9c4f22b7 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:32.6684 (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: fEYA+oDOdMsXMl7EM2ZTD4UVy85vsaEJc35XZkbJBt4GQekezAEo1tOYw3K/k51QzbBfy7fO29gBZ4zGnA+YkuySzSF0AXGlbUnC3dPE5Vw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5158 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The macro REG gets defined in at least two locations - drivers/pinctrl/pinctrl-ocelot.c and include/soc/mscc/ocelot.h. While pinctrl-ocelot.c doesn't include include/soc/mscc/ocelot.h, it does in fact include include/linux/mfd/ocelot.h. This was all fine, until include/linux/mfd/ocelot.h needed resources from include/soc/mscc/ocelot.h. At that point the REG macro becomes redefined, and will throw a compiler error. Undefine the REG macro in drivers/pinctrl/pinctrl-ocelot.c before it is defined to avoid this error. Signed-off-by: Colin Foster --- v2 * New patch --- drivers/pinctrl/pinctrl-ocelot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pinctrl/pinctrl-ocelot.c b/drivers/pinctrl/pinctrl-ocelot.c index f635743a639d..b2191407fc1a 100644 --- a/drivers/pinctrl/pinctrl-ocelot.c +++ b/drivers/pinctrl/pinctrl-ocelot.c @@ -1231,6 +1231,7 @@ static int lan966x_pinmux_set_mux(struct pinctrl_dev *pctldev, return 0; } +#undef REG #define REG(r, info, p) ((r) * (info)->stride + (4 * ((p) / 32))) static int ocelot_gpio_set_direction(struct pinctrl_dev *pctldev, From patchwork Thu Sep 22 04:00:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984522 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 CBFCEC6FA8B for ; Thu, 22 Sep 2022 04:02:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230309AbiIVECr (ORCPT ); Thu, 22 Sep 2022 00:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230115AbiIVECX (ORCPT ); Thu, 22 Sep 2022 00:02:23 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2106.outbound.protection.outlook.com [40.107.223.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7A1CAD984; Wed, 21 Sep 2022 21:01:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ldqxsPMmq5hnWDZ5OfLpO8HZA08YeVfr2wKmTtoXnepTRBox6ac8We+iVejo3ZOEDanzt+ryNQbg70AeIvvD1NewG9YAxsOdE8tzMkkubajg6CUnz3HmG/x/XcXIRjEnjXshD6G2Y9ZfB+psZZ2QYtaR8kt91SvfGTYPdp9KWwgwvIY+ho/XhTl9P3IQqUdXr5sCwqevGwVQYueQvyR5BWeFmF2r7lks0BaQMmEc+QPmFDV6Ei6LitXqWBLykrotzR90XQHSDJ75EyhImXOXlCfqI6CEkcrfAXdlULyWVFR1pu2bQeXl5352Uui6czyfi+D9zqLfeuGiSJePjZYKfw== 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=RBxdHaMV1L2lRGI6mAzHE9MKi2hjTWKBF/SkZEFqzH4=; b=M/l//kIVGEZj9zEql+rM2hjFcLSTauJdbUkP2EwAHhAoyxOs1c/zz3jVUxQmeIwZPVS5ovvuFX0gPjz/JTh7ZunxYDZaOC8j/nLtJbwcRsIC6bR88xAvBBosqw0sUFIkGLhmTOxj4y4agDYLo4lv+Ty46V7Wh5YixgFOdzsEr2UyjRfdK0CeV3YvwUd5dcxnRt3Xjo/eyEP5h9mCw5kNGCxmBrqNc8TfJsOeOIA0GktipmLGrTsJcwGN0sRU+JeD3wy2XSAhTInSOQZGk6FZGRmHv8kQTMmtRnphxd7mphhTx9x2jSsTJ9OVaN4o0gRmoFuAqdyOMYO4pEcgGBDJeA== 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=RBxdHaMV1L2lRGI6mAzHE9MKi2hjTWKBF/SkZEFqzH4=; b=B7N2t4j1lH7K55/0RnDLGU+OuDCE+JzzoVRB5rDUodPoRkM+Ylh4UaOqVljVingZaT1zvCeZnc0GElH82hBxzcMqFWDeuqo5wCvGkSOILYTfw5riGv3AhW+J20r9v8ceV2lP/RS2DAmfcmFKE8SiMAz1jSLYdwrojFagC5PeBUA= 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 SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Thu, 22 Sep 2022 04:01:35 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:34 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 10/14] mfd: ocelot: prepend resource size macros to be 32-bit Date: Wed, 21 Sep 2022 21:00:58 -0700 Message-Id: <20220922040102.1554459-11-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 7f4163b7-4e9e-4a3e-32b2-08da9c4f23d5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wOWvm2b8NYDS8ZkISb8j8f+pAB+XulpzUCT+QMkeaHeRR+4yuOcjqBiSPzhNlZTYo+0pjIh1UW8GONTyYkSq9W2ARcuVHBrEyhQIr8MF4gibybNSEMsNDJ/wTg0jVs4hVdPt1Gq0ObimR5KgtAa8R/NmR402fFxOaerpehcroy7/B1C5XiMBvyCgLbw05JRSSgxEpI2yIF6cueHRRUKcprhVlf5wv0amMMUtbzhWKyTMp3GSA+IDgSo+gz4X1Vepvn/4zJKyc9yZaZlcug8cXIIlj2g0J4lcoxa/+4qp/z/6X5wf3NbT6E1s/rt9ptNst8e497ThjCGPkRED99YL90Z8X9oWu+f1vD9oPuimny+AGgHnH11JvF2wsNMDZcvEbVc5c6t/RTTHrWXaOLQIjvIGxPWyVzMGaffqXJHHQGJfUMfQBREcMc2wa6A3cW69EIDvgGID3F4eSMBnUP7S+llybRq7gBm/FMprWXYZi7eUAuLr7auBzxiSrWhzH9PUteyjy/Ud8tWW5/t9mLCHlAVLZLA4ne1BnmH1lPOiqWQEDWioK8IsQ1Bc0Mig23C1H4M+sO2kO05lpT0XP9QkUPeTBTwz5tfC4dLBT9ooIfp/hp3En4qgSksCwQxyn8TBSX2nPJWm8+ZOmCdz/kdw2SOPFT+G1cDVu+ykE/vg2yo77w+M57LrzEllTKZvhK6/1Vjfp0KOpi8TPnYpibIeIba6Yh/+E9Z+rJxErnBhNOTXS6oZHvP4blHokoz6UaZ5h+XnReBBgyplKLwh/hTDWA== 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:(13230022)(366004)(376002)(396003)(346002)(136003)(39830400003)(451199015)(36756003)(6506007)(6666004)(52116002)(6512007)(26005)(86362001)(66476007)(66556008)(54906003)(4326008)(66946007)(41300700001)(8676002)(6486002)(38350700002)(38100700002)(83380400001)(2616005)(186003)(478600001)(1076003)(2906002)(316002)(5660300002)(7416002)(44832011)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ScR2F9SE4pFi6UYafZfVOwvsAMUxeXzlV88fTh/KUF/ds5JM0sAerMnuuFb3UTAgVorOIoBM6wcyHHV/TDbaV75Nm2c8LM5SfB7k+22woDXCj4NoPgRTsRDfL2MjM/x7yVNTVnHIy6RDlfzaPGHECK44YVev9zCvx8ifW9bdjY8sWSpbiNB5HWj/CFdyej3HQwOlSUSkTzRihpJhg4+BNXSEfG7ZXpTNwg5bV3Ds3uGHmQPDO5yDZM7lyfLN6jG0VAfIkyewDCdppqGlsedS7RbLvF7JgUdqMZsn5hW1bCckVDSSQlhR+tAqhGKu0SkwLalBiAT6yoab5XWbSExCSMsugiCGnZpobT758XxwKMYCdIC9wKGOjbcwU+twdDg9IelERh6vXxCmdUvotJJf5W3uqZBP/StXjSxrJB6ZwcMJ1J+a05s0UquopABI5ivUqMgsLQIAMA51awUCbQ/BQmAc2Z5kT8UFCf0RGTi6Huw8DQF+4sJ0IdNNkV62IXcSW/9wKnXxHtYH2Ze6aQ/56AWxf0NRkzl43jqpf8t0wu+LkeyXskMaCeE0JR9J0NFhM8Q/FK3DZEl4OkAoBoRslz+J5G9/igfTF3o/BhmdbJXeNDCkt7faBzeuyQHfLEiJnDTXsahHC3k1x7ZOK5SfC8SQaC6brMXiHfptHiqcJgwMLgNeLmmnwGoSAWnoSJFv5xosfyVIdi6oei2xh685rjvIrnV+uyxnBw12wf5/lMsdaMRKBBvAHRwn/EsuWtNjdc5pY2xEsmiwwh0xXdHshdgOpRktKTq2iFtG92jgKM/9+aIZ1uf63n3+7AvCe/M6ZbieLjVgP5R9FNJBfxCG4drPY2d/5DUxyB8ySQLthwMDJFXwl0anvv3NqmrlZU3T4qKbqDBdEeiNsEFwsC+IgVaaYmPnmp6RvzeP64oPlBoWLZPMLATlDq0AZT1yFiPZavyjJtwzcRksp1676cXG/lrDouLproNw7oIhSkXjvHgcZt8WELkHjJBuxq9IeSuxBI6qy2mRdBsS8vs0Aw/yp73EFP2NscvRxuNMXLLSOOrxJqSJ7ddeMkFa4P0OfxQFO83xwuA8FU7noHeQS3fDbGPQXaYMvM/3GdLbXnMo+X3ApQQwxEhxmNX1Kcq6jWItYREUNWPCQTRASg34fl/Q/TTvXrIOkx7FCJA8qwIeUO31hnynzgMeT9LAnwE9TcMvLZ/LzY1Ag6Txx7gR5+sxrhxt69V3A/HkfbvwCbOpQAPZY63dyiXOQP0E1fNJWCplfu3WyKYHHmLuXzZxcFWYiFokmvncPZEYJuhaM4TIkEUdZUrdi0YDwXOrJWCAABC6u3NizbkoPHjsJ+kiUfZCfuKTLh3hGvgPh3k4R4mOgBGIBSZDO1nFQTt0yay6oraWnKvuFvMznZdIyu3skXqLLFqrDpAChgrLF60+RlygtFURSxAGYkMeB+oMB3VHEWJ3Ft2QZiSR7eyRk/HVeoeaS/RDFH8mIwtO8DRtI9E4b9M6aTu1IgqNkVT79xcMrzYgXIFoI71zi68eXw6md1GSj4qbjEeS5Szi2YIFJq7WTMGo/qgHsk5uDcv5X8A4kaBYZEl652OKfn10r756C45HaG0WRQxpqyVplx1H320deYA= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7f4163b7-4e9e-4a3e-32b2-08da9c4f23d5 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:34.5901 (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: UwODeQeTGGvoN6T1DncxkqQeRviD1VqJ+MmDBwgWyz/HPMJXxKq6X8xlQVaWJUBKwAepFxTX/NYA7DaDcxQ/pgecD1mrR2H0XqCaMuJ2l7E= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 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 --- 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 Thu Sep 22 04:00:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984524 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 37116ECAAD8 for ; Thu, 22 Sep 2022 04:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230234AbiIVEDK (ORCPT ); Thu, 22 Sep 2022 00:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230266AbiIVECp (ORCPT ); Thu, 22 Sep 2022 00:02:45 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2106.outbound.protection.outlook.com [40.107.223.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90532ABD77; Wed, 21 Sep 2022 21:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CBYzmxA2tDnVmpjl+n/bIzH0kWzLc4dOy0Ewlfp9FeZK/7qyKRf+4BdTHjH6H8ntlPSsSpEw2Qs4JxgNv2SgSwASDS2XgEORZY2cseIwP0qIHBAxrUcVo2ONNFY7FrfQyRXvebHdT3ghxUDxMmTtJVAkOLyDSxmzUL3g/185giNChyhxfe2Q8EBXzlGpNWX62Motqi13oWDVWHjtzPYdGAEf9gFF/C9eMZ3hFQ/+CuLRqCG+/bg55aBUvPzrROEUqQ1FMHh1KMQCuM0PsbcWefopeoP3mNNWwurUJYzbTf5Ro+xqxDDm2eMArBdV/FxdUJA45Uyn/3T6TAxNJSZLhA== 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=gbcnFXvawu7TBipigyeUhP3Q1xoSGhvv26KUsCIXP9w=; b=eP/TsOzG6NcDcrfPm6fl+lAY9pEArA1pIyJgOps2m0WR8o96IPRrZWNpYWjvgeCoYAYvGsVvpQmNGe0kflV9BJUc9uCyn3p7Ul7yPIp/lFJi4dehRx6WayOsQtVm9H8m5PEyzBgxDwl37F+0l3ZAbDcNrOvY08RmnKzSohQIWxuGX6Adc1XGudjHO37Ns0PWcMBEj3+bWiaJTNKFLiT6BBNUlzv+0IqJu7IcWAKZdQeDXcwux+RTE25zcoQOYV6CuXiBKxmGdGBBLNmPV955WVzvGUHyHEGCqYoOZqxGZZBWxKRj/o81BPXNOdZd73wzVHCCk8osjpMT0sYYnyPJmw== 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=gbcnFXvawu7TBipigyeUhP3Q1xoSGhvv26KUsCIXP9w=; b=NjvUsp+TcbjMiV/MBjmS5VSStMgQYXet+vHmuy/OIMWZ90meFYcQChkPQjEiRCsG37QqZ1Vvv8BJw94BlzR1OgQGwsQnU3clM7zkbVLjkwmcmsq1xePqLkgUUQcZe4u7P0cmem1Fe5td4rkO9LWjpPja3t7k/1rxmBTffoW9Q4I= 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 SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Thu, 22 Sep 2022 04:01:36 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:36 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 11/14] mfd: ocelot: add regmaps for ocelot_ext Date: Wed, 21 Sep 2022 21:00:59 -0700 Message-Id: <20220922040102.1554459-12-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: e2ee67d6-5b1a-4509-3587-08da9c4f24e0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FVGXIeXMZJn63RY3+tHPZtOhkb3RbrJFdyBXzApeI4Bb3cxOsLgdXf8n/uvHuEkPJVKo3P4XHw6MqP1fWs7mRyl6O7h7/FtaBjpdwMnto39mUNqxv+ZOHXq2BumAzN+Jo00J7l/S2nIXT6ABPUMihij14fJZzWt3HczVQKYiKHvMAFOmiXGyhENP209cmJiKk52oedzUsDAwquIwknQnZxTHUxqZ2kxubFr/eed4d14JU+ee5781YLe2f7hVv+oIZ9HfY3VWoQ0FKS9Qu7py7Rxca6jrOVVDU++aeZqZ4EtUGOwkBp1O+QpdS/EZpBH8RoHmCgmFO8X3haf+52XgHJED2wasxRtiNfRCbvd9juX7xQNlFt9KBgbc2brTlSw+GF/lEAoxvLBLpoL26wIgrnY0Ehwm0vbJX1CHHbSM1bHyUO2BSboYxJPH9ZFhIWlrAYIf3M85KUD2E+n4vSjL5s+Muq8t8bDWkGd2lKGMLQg4yPpmXgHZipB0cKrAKemhAIoocAZzxt8qG94JoPAT7W7b6Ein8QusWeuY/iCKnK/YSDJbJskdsgAVp3o9EoqiU9uCF41LoaDKh3SGV9SiDoJHuMpf3qGBpchiVl13j9YXjyXFaePivN9zXZMEdInK1RxCsGNugsNCby+fL3B1Fg7QLFBM0giYu0T+aqNH4VVubviWHz//UYDf7v1/B3Z1ZRI30uj0xPCiVm8Z9yW14iyjrJY/yXOIdNjlvwSRKXLAzw+PtQCEfrtz9Cl9RUsphMYnYbD7QkRQuCWYstVZFg== 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:(13230022)(366004)(376002)(396003)(346002)(136003)(39830400003)(451199015)(36756003)(6506007)(6666004)(52116002)(6512007)(26005)(86362001)(66476007)(66556008)(54906003)(4326008)(66946007)(41300700001)(8676002)(6486002)(38350700002)(38100700002)(2616005)(186003)(478600001)(1076003)(2906002)(316002)(5660300002)(7416002)(44832011)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: U68AKxuW1oqG2eIg5wMKEAWLTCBU8vfXwq/PODQb763m1hpK9qYtjgVMY2u2uzpDZSbN4DOgcB4S2hOsOouOmUeBVLHYf7MI1DV6wwXk0edLFPkhoOpS8nGWuq7Kn7NmOMUVlTejk88VZy7/Ju+frY4g9H3dbbEGhvaTJZxh89lyF9d3OoO3er/LxHMCpsIndyYIXcEavpvnxfWmBcQzfpsRIp5w7NxQatvoooVz8dA6P1N/214eFAiwKjSjP16ONNTB/MH2NVA+BvuvirZ6FWmwtYxUEoCZFkNyGv5wPUWZa2marCFGFnvrHJA4IyNmbhiWPSha31n2qDBXgSXgkJXYSTnnGv0L/8c6OUNHx7q2Yd3mesC+I7XoBlDjw8ZeoEHfmU8KOlSSZ2+xcDCuZqR3fMgvbDnx0T5Y3aImicNckiEPtb5Z11QSjXrA9YTTuEnGCvgACc5jX7xUAVSd/eCuj3kwLk2+hP+6beofu3+NK/qQmay1s9TuK/UQ9/4DalESCEfpOBP5MiTNmW0C/zd+cKxdwi1rQuOzuDX1T/mOV9KhhMfPw/tvErvfTw1yYAYGwBTQVcxrEaFjAcCcFwEHAsznnaT+a20we5PuXA6JogbzdG1FEqnn+DjOSUPARU9kH2QqAt8giPYkitXGRWhWjpsdxezH2mBqTWYaXwOKynEQcahyd4ilEexZwkN4iI+fb4UwcmRq+oQhM8euOlOJVib4wEoXhsMJbTX+8yu53LnztIUX60fldTpBZ4kt2dYt+jTZqZyn+hikEIvTHtN/rvGO43ZoSttRSbT+3+AumNODqDVO8lhIEVP7jvVbPB251kjlTnwocwjLd79mNefovuzQq48Qfu/F7ZeOy1hcCggPj3uxius6Wb9kUURYrOqU1PWMuNzgpvWZ6hZ8IgdQsHKiJ4UO7sdW7wfszmG1r5zXbbGee+8/BTt/ibg2dJxkFr4ozw9ckky5sGDZwwX0197fKWf9DL2aAHdAER7DVjCBaiCTPr0Ld+p/LCobrx4KcBElp1l/AwXlxFSgxh1U/iIon2oyMwZ+Lcur8I707vQRiRVmH9l+C1NPzAXffC1n1HCB5lISBJec/FoAfyYIrcZeNGIiJZtKM2EK5T4vmsjn0WUPBkH9ZZvEy5pWq4S7yzdkubbUYEmUiYruk1f5aI2rgbz919MDZgA7exgISPXUoRXT8zGuklYzebB+J6wGR/8/5lzqVWcn3lPB1wJapQvvA1Z2eB765ogPdENDY/HIIHv/aWV1ZWa7QEPXJQVVReFGO3d+5DkNgcuhkRVAJk+7KoHQyC0qYJ9t0xcaD68aehN6Mwuz1OJ4+HhJKP3zITMKk2BYp6fjo/qUQKnvcnyBAa25BEIzwKlHMpneVyMpSbmyQVUk55SfxsCmz9/IWztw9EuHbW9+eEU+lj2mGmmqNGhivDESjh26M9WILYNTgUvIjouvlRcpPPfzaH85PNs/wmOlwxiEg98ebIfDPmloZnYIm/UGGrk0I2rnKtADuQUAzM6ecnfE/AtEOcuYuybA3/h3NLDymgtFRVrSihFukskW7ODWnLBhHI4iAMwJFNAp1hAGCddne4J3VZGVJqf9dJyW8oMyquC4VL1tqpuAXEkWjJsg+OzJ84g= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: e2ee67d6-5b1a-4509-3587-08da9c4f24e0 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:36.2619 (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: C/komwOJpYQYXnxlFjHWxSBVh7LZnGR93nvwUtSeBarN2IA6F1ppq+jAU1dvnPLFj1ytvQCsvrTTiUE/WWZ9vQhDuohniTxzYlcMjYba3wk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The Ocelot switch core driver relies heavily on a fixed array of resources for both ports and peripherals. This is in contrast to existing peripherals - pinctrl for example - which have a one-to-one mapping of driver <> resource. As such, these regmaps must be created differently so that enumeration-based offsets are preserved. Register the regmaps to the core MFD device unconditionally so they can be referenced by the Ocelot switch / Felix DSA systems. Signed-off-by: Colin Foster --- v2 * Alignment of variables broken out to a separate patch * Structs now correctly use EXPORT_SYMBOL* * Logic moved and comments added to clear up conditionals around vsc7512_target_io_res[i].start v1 from previous RFC: * New patch --- drivers/mfd/ocelot-core.c | 87 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/ocelot.h | 5 +++ 2 files changed, 92 insertions(+) diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c index 013e83173062..702555fbdcc5 100644 --- a/drivers/mfd/ocelot-core.c +++ b/drivers/mfd/ocelot-core.c @@ -45,6 +45,45 @@ #define VSC7512_SIO_CTRL_RES_START 0x710700f8 #define VSC7512_SIO_CTRL_RES_SIZE 0x00000100 +#define VSC7512_HSIO_RES_START 0x710d0000 +#define VSC7512_HSIO_RES_SIZE 0x00000128 + +#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 VSC7512_S_RES_SIZE 0x00000400 + +#define VSC7512_GCB_RES_START 0x71070000 +#define VSC7512_GCB_RES_SIZE 0x0000022c + +#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 +135,36 @@ static const struct resource vsc7512_sgpio_resources[] = { DEFINE_RES_REG_NAMED(VSC7512_SIO_CTRL_RES_START, VSC7512_SIO_CTRL_RES_SIZE, "gcb_sio"), }; +const struct resource vsc7512_target_io_res[TARGET_MAX] = { + [ANA] = DEFINE_RES_REG_NAMED(VSC7512_ANA_RES_START, VSC7512_ANA_RES_SIZE, "ana"), + [QS] = DEFINE_RES_REG_NAMED(VSC7512_QS_RES_START, VSC7512_QS_RES_SIZE, "qs"), + [QSYS] = DEFINE_RES_REG_NAMED(VSC7512_QSYS_RES_START, VSC7512_QSYS_RES_SIZE, "qsys"), + [REW] = DEFINE_RES_REG_NAMED(VSC7512_REW_RES_START, VSC7512_REW_RES_SIZE, "rew"), + [SYS] = DEFINE_RES_REG_NAMED(VSC7512_SYS_RES_START, VSC7512_SYS_RES_SIZE, "sys"), + [S0] = DEFINE_RES_REG_NAMED(VSC7512_S0_RES_START, VSC7512_S_RES_SIZE, "s0"), + [S1] = DEFINE_RES_REG_NAMED(VSC7512_S1_RES_START, VSC7512_S_RES_SIZE, "s1"), + [S2] = DEFINE_RES_REG_NAMED(VSC7512_S2_RES_START, VSC7512_S_RES_SIZE, "s2"), + [GCB] = DEFINE_RES_REG_NAMED(VSC7512_GCB_RES_START, VSC7512_GCB_RES_SIZE, "devcpu_gcb"), + [HSIO] = DEFINE_RES_REG_NAMED(VSC7512_HSIO_RES_START, VSC7512_HSIO_RES_SIZE, "hsio"), +}; +EXPORT_SYMBOL_NS(vsc7512_target_io_res, MFD_OCELOT); + +const struct resource vsc7512_port_io_res[] = { + 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"), + {} +}; +EXPORT_SYMBOL_NS(vsc7512_port_io_res, MFD_OCELOT); + static const struct mfd_cell vsc7512_devs[] = { { .name = "ocelot-pinctrl", @@ -144,6 +213,7 @@ static void ocelot_core_try_add_regmaps(struct device *dev, int ocelot_core_init(struct device *dev) { + const struct resource *port_res; int i, ndevs; ndevs = ARRAY_SIZE(vsc7512_devs); @@ -151,6 +221,23 @@ int ocelot_core_init(struct device *dev) for (i = 0; i < ndevs; i++) ocelot_core_try_add_regmaps(dev, &vsc7512_devs[i]); + /* + * Both the target_io_res and the port_io_res structs need to be referenced directly by + * the ocelot_ext driver, so they can't be attached to the dev directly and referenced by + * offset like the rest of the drivers. Instead, create these regmaps always and allow any + * children look these up by name. + */ + for (i = 0; i < TARGET_MAX; i++) + /* + * The target_io_res array is sparsely populated. Use .start as an indication that + * the entry isn't defined + */ + if (vsc7512_target_io_res[i].start) + ocelot_core_try_add_regmap(dev, &vsc7512_target_io_res[i]); + + for (port_res = vsc7512_port_io_res; port_res->start; port_res++) + ocelot_core_try_add_regmap(dev, port_res); + return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO, vsc7512_devs, ndevs, NULL, 0, NULL); } EXPORT_SYMBOL_NS(ocelot_core_init, MFD_OCELOT); diff --git a/include/linux/mfd/ocelot.h b/include/linux/mfd/ocelot.h index dd72073d2d4f..439ff5256cf0 100644 --- a/include/linux/mfd/ocelot.h +++ b/include/linux/mfd/ocelot.h @@ -11,8 +11,13 @@ #include #include +#include + struct resource; +extern const struct resource vsc7512_target_io_res[TARGET_MAX]; +extern const struct resource vsc7512_port_io_res[]; + static inline struct regmap * ocelot_regmap_from_resource_optional(struct platform_device *pdev, unsigned int index, From patchwork Thu Sep 22 04:01:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984526 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 45A34C6FA90 for ; Thu, 22 Sep 2022 04:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230037AbiIVEDk (ORCPT ); Thu, 22 Sep 2022 00:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230416AbiIVEC7 (ORCPT ); Thu, 22 Sep 2022 00:02:59 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2106.outbound.protection.outlook.com [40.107.223.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45EFFAF0D2; Wed, 21 Sep 2022 21:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=guYnVkGtxHCdr3mkmNv4sfqMaZ3zoASOcqLG0fe4A++lTG/jRiDKhksAl5HZlerrnWZlWQsuBnll8unhFObcp9j2qwwU3f20IIlntALO9cEUuGG8v4ZveV4JkE63QI6glOqpQBZCcK11LyG1w6kw7Ga16958ZK+/HI6+JkYWwu62v3yC6c2XxSiNVynwnePbBLQqmv0SUQnozld3xhKwE7PHK7FB6dyJGw601njGrZw2cAa39FbBfHSdMSJ16WpQ8/sPSxNlO2+WEyF4XenypnrBNvbOlFfhWW5TYyBe8o5EWayOMpYV8xQ8vYLjS51+R13StrN4MZ9qKbdSTdF2iQ== 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=zyFOEQrVbuTW9yv5arpehu6Lgsn+VHs1TRSEjnm167w=; b=JQgKnNr6B/ofYgEtQK1+hUEPfVPLUlvXkAjmKhVW1zRWWDVhVXJpByLRTzxbiXBwvSGNlTEAtCo6G/UhcJmt2OPQMBdDgxwMbx7QRhQWl4SczRYxiULclM7CgRI0btvNgPCw5bYPo008wP3axoWGnZli4CJZR4dZ4Oe2tYbq1Z3IKD/xlYpYZacMbuLAJWqo0/IAiN4RAzJI74jhAZZ6x7uUlegwtbtbEkpBZZzafQE1d9Qzrvs5zJUdtsF0Za3ROa115XCPSAdjU1v85BMxDrqmXDcROf+VNiws3N27Uc9pQeVzVJwgld7QrOM5jXX+hQ93ma5bO/kPywJySnZ8HQ== 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=zyFOEQrVbuTW9yv5arpehu6Lgsn+VHs1TRSEjnm167w=; b=zQmMbbbuz7FIMQVW7BO83bOgFSkuApy1c0Xv3CEOU6njSO80aHnjjWvFYz2Otf20MFAf+HrLZfk3JHfrqOkcEpCUJU4jytj4At6QfHy9ohtMHZ3zFBFwx5F7pojsMtKF+nUTDI6HWYtD1y5nBEQjZRyo3HYnqGlaGHMQtggwYJM= 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 SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Thu, 22 Sep 2022 04:01:38 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:38 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 12/14] dt-bindings: net: dsa: ocelot: add ocelot-ext documentation Date: Wed, 21 Sep 2022 21:01:00 -0700 Message-Id: <20220922040102.1554459-13-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 199c23bc-46c4-4d36-e878-08da9c4f25fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WBSt81BzwFVRksNqzkIGcDgEV+BTsSuNo2JqsfXgIpORRWg5kvY2C6cnXB5C9kthclyzWog83mhsDonqu8h5V0Ywl+WaWbJPt8RQ6wIUX+ZRltzbe7oMGYgdSQVBEfXtf2c6OSw4rSPQs+Tp4OfAnCOMnv5LXyhNctoDo5iEaDL9iJgDTiKbkiP/iSPiTbNPaGsvl0Zbygxzp5u6AuUQXF3sN7c1dL2YLz1PrRwy1gdxBa4D3QQOI5yfwm9JCUL3QNaN5Hnk4EqoLq2+nE0uwbQFVlKTj11fdrQdNNKrn8Exs08BVCvOrsaYB9V2bn7tBUxD4r+GueI9s0p0503jbalFQpDOcHnBYpswbOTa6plykJ5MvBA8MesQ7c8Uz50CX1vT7H+pKZZnWNM6286oZuC6sIjbkzCUxdmb7/LK8NXrf9lNS/KfESx3oa/kuOJjH+o7pUV2dyA+MfUmohBOm+2VGdRWEjLWaecoZrG1Rdf6dzVp7zy+XR6D07+pgJsvx/IpASENxPtDVTwuH/qw2sJfE00UfV72t8dpdUqxd7w3W9ai6gmwjDClADXqn6SNp+j0lakmoxAWYkLT1ZJ10P23QAMpwKP7/b0a2NhpKnPDluIc8MNvqYUnaiP3ev+kb/FREleHoF8HNRv+a1Xt5K68zkZj1lx30lvUaoYTKJVpXdEKDv3Pxx48fukhj8kJ93+8T12Rlr3GN01yKCEoOpPDQCkjxG0847Z2seaVBzEZD3TmjNHmaEgudl07q+PgC3Q+bpphjIHi3Kn/FwVwmg== 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:(13230022)(366004)(376002)(396003)(346002)(136003)(39830400003)(451199015)(36756003)(6506007)(6666004)(52116002)(6512007)(26005)(86362001)(66476007)(66556008)(54906003)(4326008)(66946007)(41300700001)(8676002)(6486002)(38350700002)(38100700002)(2616005)(186003)(478600001)(1076003)(2906002)(316002)(5660300002)(7416002)(44832011)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t4xjSUvgcBmDEXvRzzp1D1VIbNrJPbwioz74TXYBNcNaKKLLMjpFRcn9sj+bO4kCpfarE5nt2VxaLxRquwomuogu9X96vs9k6q8aZyaruTEbMvlNhtYiBL5EHJ6xCOR92ecQpjjxM3xdyrrssstWIMXzZSMwVYQ6U0ZucAKrU9wb9l/6N5ZPGVexwjPTqXGuAdLQwV6MeIKJ+NmBE2zhJ3/e7YVIG+si+GG9tNn7OnSAH3PJvVHvNwLgdgKAYEpww5RIULWbYv0ePXObB393Fo4LZDPrG+qzSKiBANQ3a2jSnnqjJVrgBQfO0VKWRc5uu5W6dQCmEKumWga18guZ07rG9LWKL+6o9KSLqQScx0olzxt9OXoXM76/FV22W8BrpB8xspIKVjSvNbDAl7tYrUOPkgnEhKhU63qohzsbn5F+JHPvCNyeiOBP44n7giMBBbja/rgQGiz8YNJ8SmeXpMbfFOUc+5wruixIJL1UDRP4piS+WAgSGiRImFUVNWJetuEGfgcs6h+xmzZGJIhgqIliIVyOYNgebExDFNHjaE/o/KBL0C6umaTTqihmyQXft65vHGaAltwlXOD3ge3C6K56lnAd1rrOr6Bs/aRm6m4mTfyFAQj3QwQ2Lqi0Nd4yzCHy/CTeJ22oNWHrtaDAubhvnOAtiJ/8jyW+bgajVdN24B4b7/h5quOGxARtSLQzxb73Ydx8NKfvn2TRq9UaAk1ikugAoL9PBiGljDCYh3zign5F/p/DOUiUYFaPfK3/NkoKpJRdRio2WcQxcXwb68s/hqHbPNSoixaS8dkQE5N2Arf/Y500XemnUkb10H4XeBHcdjthk1Q9lspeFu52ZFmJNyLPByaabuU96Z6O18ljUtj1M8LMu8U+OhPpmO6wtMv06TxixeH5/Fr+TrGD+tgoWK2t9NfOWVbEp/JLsQPT5zguiHiyfLMo2bXCk0/lrs2dSr6xWHW1p8EKu97r2/l7cf+2noetgAgHISFV8f7y6Vramu2ItFimquQTsA+cf/yWtuC3n5qhn7hvRub1K14UXOtN435gMbHCw+julP1lsxJmpxXvtqAXZml2EuCZrrQiDMrop9QcGkjEIq4schJGQUM0AqwAh2QE+iEiE4UkS5//VgVLP2pdRdE1PRMw7he6pcwljqlgxrq3wGf7jyQTWbT80shZldbsYuvF+CTfbzRlvvyV6Jpqd4Ig8/Kuw74Igfb7SrnbmDoiqMU95RcaBg25WpqcGZgNn+OjRadLC3Wlb9/2QQhiFkmgnU4VxP6CmI5wkxLgcRQhT5Jecwgg1ca8U8b+BP0ogScFgd8+yjqbBPR+bc/pLuYvFrYs4ktGbZZGlT9eXN7/7nze3FvsoaGeTh43Z5KP0+yFIuTR+FqrNpqdIO0FpXF+FilIyDv9C0D4XC9um7NTJFFmRZDomdfQI7rqTLOONywqTQpTSF7r7KKxeDisHgaprC1Sunf+HMJMweO0PwQeSczUwmO6oO5iBjaKGplWKp/4gK7pBax+6YNQ3W78Owd+R2r4B+OjqcA6WmCvZT+UBw+HSwbQO8ad7MVFXDVYCkf2DwO1qYsy+2MwAtZtKDklZYXGzeZUr7hLrr1N7qlVtmIQBY9y7mXTi0AO/rRSEsU+qf8= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 199c23bc-46c4-4d36-e878-08da9c4f25fb X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:38.1211 (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: Z47gHS5tsYqFmq6udqSxwbF6HzYS/qEyhP/wwhd5SpogasOSQczeunTnZxrnFudjsOqLchWMZAbjCAyReyn2b37lVAU2g2aMFoQNeiLvXRI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The ocelot-ext driver is another sub-device of the Ocelot / Felix driver system, which currently supports the four internal copper phys. Signed-off-by: Colin Foster --- v2 * New patch --- .../bindings/net/dsa/mscc,ocelot.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml b/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml index 8d93ed9c172c..bed575236261 100644 --- a/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml +++ b/Documentation/devicetree/bindings/net/dsa/mscc,ocelot.yaml @@ -54,9 +54,21 @@ description: | - phy-mode = "1000base-x": on ports 0, 1, 2, 3 - phy-mode = "2500base-x": on ports 0, 1, 2, 3 + VSC7412 (Ocelot-Ext): + + The Ocelot family consists of four devices, the VSC7511, VSC7512, VSC7513, + and the VSC7514. The VSC7513 and VSC7514 both have an internal MIPS + processor that natively support Linux. Additionally, all four devices + support control over external interfaces, SPI and PCIe. The Ocelot-Ext + driver is for the external control portion. + + The following PHY interface type are currently supported: + - phy-mode = "internal": on ports 0, 1, 2, 3 + properties: compatible: enum: + - mscc,vsc7512-switch - mscc,vsc9953-switch - pci1957,eef0 @@ -258,3 +270,49 @@ examples: }; }; }; + # Ocelot-ext VSC7512 + - | + spi { + soc@0 { + compatible = "mscc,vsc7512"; + #address-cells = <1>; + #size-cells = <1>; + + ethernet-switch@0 { + compatible = "mscc,vsc7512-switch"; + reg = <0 0>; + + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "cpu"; + ethernet = <&mac_sw>; + phy-handle = <&phy0>; + phy-mode = "internal"; + }; + + port@1 { + reg = <1>; + label = "swp1"; + phy-mode = "internal"; + phy-handle = <&phy1>; + }; + + port@2 { + reg = <2>; + phy-mode = "internal"; + phy-handle = <&phy2>; + }; + + port@3 { + reg = <3>; + phy-mode = "internal"; + phy-handle = <&phy3>; + }; + }; + }; + }; + }; From patchwork Thu Sep 22 04:01:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984528 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 4C063C6FA8B for ; Thu, 22 Sep 2022 04:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230475AbiIVEEM (ORCPT ); Thu, 22 Sep 2022 00:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbiIVEDQ (ORCPT ); Thu, 22 Sep 2022 00:03:16 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2106.outbound.protection.outlook.com [40.107.223.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9ECAE217; Wed, 21 Sep 2022 21:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LUjK0JKTIW9m6XgMI2cl3ihhhVx1TE+l8JA/A5k3tr7VcYhBWUeO8i9txVNXrPo0auRC6IbBuMr05Tsy5d9Tw7L4wvKiiPtDHo5kVhwDebDDYZDLLhNOPowokrxEhsKnCMKTDc5R7BfeIq6RQttKYjS0E2zySnOW78z2Kyx0hPkWZ2LXdeMWBhbHDiUcImDhcJ2nB3BK8w4SsuxpAALmYzwJ6V6LEXB9ZF98pQCLTcIIyfqWco6eXr32CYYphilxYFVj1uIXQZBxiTrGDzInqd4/tYVHBTG8O2bwf7BLL4V74wspir8NcxRdmz1SffF9kAh2b7MCgSaUgmYQS1xtEA== 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=jHgzDR5G6kNB+IUJg2oz3zQaHP/FTuWOuq3MvpneilY=; b=RF1r2rTOmhCJkDh4+Dqo5Oovy0fMlCTnw7qvyk1y30RbXLUID17C29iHBG/a+DAUkvnMyB0H3rZbnfxCfaR2nd6uocS+xo1LD8QtC49ebw8oJ4B9UYsbLsmlt0wjiE4Q4QO1lT3bXyaiAvWQmutVd/9TtdGkVixkY2/VDiEemhvY97ifnxZinLxG6aCFc00abQPbHFYo/eJwAez6xYmcIxTKzIicS58xGi9xsVgv3nAVPAb6JFnXj84lplBsjAXtd482Na5zBfTjcuqA9MkOX8bZUh4nTFJXTkNTUlMVXGFxPNkvSI7dHym36TnTPMrDKWVdrzM0Z+0XgBvZLvaO3w== 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=jHgzDR5G6kNB+IUJg2oz3zQaHP/FTuWOuq3MvpneilY=; b=XL6UUNs1q/nJqVvzM6DWGaEcuD4Xc7dIxIikAF+WDLhR13VjYT4oVubgqGudNzsK7Ubrn6bVRdWXlX8tO33SctC3hNs0UGr5CGAHUWYluXnAnqVsMAOWdlpQyjFF3A5DbmM/Qsg577TcTE6q6Ur0lS4/ap+SP3yQexjCd9cqHHw= 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 SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Thu, 22 Sep 2022 04:01:40 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:39 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 13/14] net: dsa: ocelot: add external ocelot switch control Date: Wed, 21 Sep 2022 21:01:01 -0700 Message-Id: <20220922040102.1554459-14-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: 787fa305-b628-4fab-26a0-08da9c4f2702 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3UcN+2Mq6hhYKvHJVdp39WV2Phd3SChdhYb4JpaU2OCiFNrfsEsqmY0qqHedE9zwexZwWabODrcQ5g+/74yLPhyzVciSgFFNP1F3EVJh7s+L2nEynKsxqlbSzijrjFnb8+sX5Nw01Q4XbQsbbHyNt9354qOc8thHfBLpok6xHSOetDPEMpOyginovAUHYBSFQpRvnftby6ScI9d55K5zPtgX0+TzHn47d/QMYPvYfoQKEvIfqtdEPprubotzHIp5UrQAUVi1iHZ/ORj98t3VWys5f8uzNqf9eCAdL+N2SSkTjUjznOHUCb7h6H13dFzr+4sCYjHGlzcoFb0kDihFx9EREyEt3c5+skANzgy6QqTz9UriHAeF92JwnGPRgc1MBMtKl31ewftF3CFLuIGES3Jz7vdyCwnqcdUSEKufckKqe4BxrsLZy+2IZvZn1sXHFEsjSR2NEageskWfVyvJ/KJWrYFOvvjUdUTM1xzmlZ2i1YwbwgtKNKdr7BfUA0FTr+MPgGUZZGUzBodt0SKYqVRXO7bKtUtMkBd7J/aiUgpghw7p0rnN6ci+KCw5yq7MY176rOwNWW/xOUofzxwBClecCth2JI71CWTg7NpplI3KXAPoXdeCPEmkhW0VI2LD8jvPiv7r2IpD8PC6U3N49rogqpCU7T/0iiRZqvuSxV8C9KSpzLBnVXqAJ8BRnFI2D2tLjviGlITIcmtFIH8R2LsiMTKDblfhJ6CWyNTv2BNtqC2iNYg+4Ics+anYOEgoS/vzlbnrjzeDdYK2HGIjPg== 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:(13230022)(366004)(376002)(396003)(346002)(136003)(39830400003)(451199015)(36756003)(6506007)(6666004)(52116002)(6512007)(26005)(86362001)(66476007)(66556008)(54906003)(4326008)(66946007)(41300700001)(8676002)(6486002)(38350700002)(38100700002)(83380400001)(2616005)(186003)(478600001)(1076003)(2906002)(316002)(5660300002)(7416002)(44832011)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nSCF3yf7Eh5ENprSLFPtNNF9Z5iN+iGVjugAbKuWA/EWQsEgyNLcI/18GIF4/8h18ZxVFoaAfAZA9MGQdq0zrY9vCboACxxQ89QjfUntXSQY/1U4/t4RD2WMQ4zET9Zi7qZ6iDjuvAHrEw59hqO6KbILCu6T1Eq2FyRBdleop4vpJGz6CgesazD8ue6A/D5oN+GyWAUNExwCLLiRP3bUuVGfJYroHRVKeT93OwxYCppwiY1Cg+nK2u6ar8AynHGmItOf8nZfTzA18/PKM6DT4E94JXzO42HLLcAfewVaWz+6bIZtfhJT2693TdcuvwM7KmY/GVIjKPez1DNAmMhVpY7KBKLtaQ7fTgIyTLvFQSzphLy4LTLYKiNOp2UvL7Vcstgya2X8NM+EZzEFRrIdww0nLqcCn3orP2KXTAUQuk0dmdd86tmktq30Tr8YE7EXf+8vMOYprGQbELcmvSNuFe8AXtda2qr0jP7naOTuZl9ptv1SxUa//pSUY23b1mw4Et8A8fPMrqAI9Q54DobbsT7HAQ1R9ULPQts9dZTlak55BEpUxbdBTOLOeGXl6HhBvRPqrZ62bn3T5GSQe0L2Ne73tohpOHUy4NXtYsrdg0snjYZ8grQLbO+vBuwORpnQREWg5IaDOrtCDaFj8zGTUkI29vZBKvl9Ofjblxo8zrvh1TYit7Mmeq4QbWllKeOVSADrnbZD/M0WArzg/7L9qqUjw3tfRN/fbOIzdDxMSYl4k9yrah0AyFF+VPR8rR3id3K8XqyoYMGJVitzlxn5BXrUCGEEAdKbbd+kZmUcpJ165TauSEV+YlIB0rcsO+ASzO0nydYA4lA14g8hg7BgJkYrIlnJ7kkO8VEaO43lMJA4+B4qrtXQmspAUqoUPn9ttRDHL03OkJXDv57Yw031mlbhYsSAXsw4xcgEkV0tm2cTXJWf7+YyY8VdKk52CoPpFhCmbeQP/cZwx1yqNJ3qjb8xWCgR8CaGGBOFvHRlpfRxeGLIVhVsMufDFcV+E5E2Y4PC9Ho0we8MJkutw9oamBEjJQbAOQaLYUcxoBPMTPXM8ysTAuJaQlgDu1MQu4atnunoH5yPiMWkSK5Ons3ms/YAUNmposrDscrUgJ1jfPCvENuWhuwrZWKYmeKehSPt4//vUpXElPYMZBWXPYTDdRYLWergmxY6xuP4b++cGw2RDSxRrkntEucpT2mC1BvQC0kWBCwSgd3HSsUL82mcbfqgKs9WCNe0VPUsfKs3mTAwte3HtE/n/9pwTq2+gA7OowsaeXGdmBuLNhihmyUrJGVCU7wp/vRwk2JQu5+zxECYSLnJJU6fixb4sjxQWVNBARCkQfDtx8fMrdnXZI8ZyJ0968phNErHl/WkwhxVzB2ksWkM91pUB15zZ0QXcXPPkqrymuRqVz7A93lyrP0h4zqJ0mmzMfWbrUrOSkX7HiV8Ph10LXt5l07z1EMFKQB4V4VlP4uQiGXEEJc9K5hWm4BIvcwygN8R2toU9bD8CnGBEGO9fb9m13Ca0JNfd88IyKY9BzUqM9WkUNQCsoexvKR4Lg0x2+iwPSiXMUxUgeOPyOWHjQ4sp41fMwfoP2cMWDAu/n7q+R8UCr+G0KT/pal/9MTy20i/u6gS+uYxYMs= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 787fa305-b628-4fab-26a0-08da9c4f2702 X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:39.8710 (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: IdWFxFfdT+YY9sml+cE1UovFLZXktlkeU4K+s0IE8I1mF70xa7+DTm1t9xP8hC0mPawdcsQZ7pECmN1ZI6K2hyAQuMopfv9uTmDEm+UwEIs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 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 --- 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 | 19 +++ drivers/net/dsa/ocelot/Makefile | 5 + drivers/net/dsa/ocelot/ocelot_ext.c | 194 ++++++++++++++++++++++++++++ 4 files changed, 219 insertions(+) create mode 100644 drivers/net/dsa/ocelot/ocelot_ext.c diff --git a/MAINTAINERS b/MAINTAINERS index 6705fb8bfd3a..56192a218cb5 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14751,6 +14751,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 08db9cf76818..74a900e16d76 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -1,4 +1,23 @@ # SPDX-License-Identifier: GPL-2.0-only +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_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 f6dd131e7491..d7f3f5a4461c 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -1,11 +1,16 @@ # SPDX-License-Identifier: GPL-2.0-only 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-objs := \ felix.o \ felix_vsc9959.o +mscc_ocelot_ext-objs := \ + felix.o \ + ocelot_ext.o + mscc_seville-objs := \ felix.o \ 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..751e8b6a57a0 --- /dev/null +++ b/drivers/net/dsa/ocelot/ocelot_ext.c @@ -0,0 +1,194 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) +/* + * Copyright 2021-2022 Innovative Advantage Inc. + */ + +#include +#include +#include +#include +#include +#include +#include "felix.h" + +#define VSC7512_NUM_PORTS 11 + +#define OCELOT_PORT_MODE_SERDES (OCELOT_PORT_MODE_SGMII | \ + OCELOT_PORT_MODE_QSGMII) + +static const u32 vsc7512_port_modes[VSC7512_NUM_PORTS] = { + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_INTERNAL, + OCELOT_PORT_MODE_SERDES, + OCELOT_PORT_MODE_SERDES, + OCELOT_PORT_MODE_SERDES, + OCELOT_PORT_MODE_SERDES, + OCELOT_PORT_MODE_SERDES, + OCELOT_PORT_MODE_SERDES, + OCELOT_PORT_MODE_SGMII, + OCELOT_PORT_MODE_SERDES, +}; + +static const u32 *vsc7512_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_ext_phylink_validate(struct ocelot *ocelot, int port, + unsigned long *supported, + struct phylink_link_state *state) +{ + struct felix *felix = ocelot_to_felix(ocelot); + struct dsa_switch *ds = felix->ds; + struct dsa_port *dp; + + dp = dsa_to_port(ds, port); + + phylink_generic_validate(&dp->pl_config, supported, state); +} + +static struct regmap *ocelot_ext_regmap_init(struct ocelot *ocelot, + const char *name) +{ + /* In the ocelot-mfd configuration, regmaps are attached to the device + * by name alone, so dev_get_regmap will return the requested regmap + * without the need to fully define the resource + */ + return dev_get_regmap(ocelot->dev->parent, name); +} + +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 struct felix_info vsc7512_info = { + .target_io_res = vsc7512_target_io_res, + .port_io_res = vsc7512_port_io_res, + .regfields = vsc7514_regfields, + .map = vsc7512_regmap, + .ops = &ocelot_ext_ops, + .stats_layout = vsc7514_stats_layout, + .vcap = vsc7514_vcap_props, + .num_mact_rows = 1024, + .num_ports = VSC7512_NUM_PORTS, + .num_tx_queues = OCELOT_NUM_TC, + .phylink_validate = ocelot_ext_phylink_validate, + .port_modes = vsc7512_port_modes, + .init_regmap = ocelot_ext_regmap_init, +}; + +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); + + dev_set_drvdata(&pdev->dev, NULL); + + 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"); From patchwork Thu Sep 22 04:01:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12984529 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 2A1D6C6FA90 for ; Thu, 22 Sep 2022 04:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231209AbiIVEEn (ORCPT ); Thu, 22 Sep 2022 00:04:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230386AbiIVEEC (ORCPT ); Thu, 22 Sep 2022 00:04:02 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2106.outbound.protection.outlook.com [40.107.223.106]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D72C3AF48E; Wed, 21 Sep 2022 21:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Rgk1kyYT5AY3V+soItT8SKhc6zIX5HI8wDgUXcwfv8SxbZ3Gwofq+PdOuPVYWGybNc1nJmxIRKISd6z1UaSIUvpVuCVrU31ULzbgfw6PXq/DRTvH0lDEAnIoZDlVjtPX9PC305SDN8rlxiXdrHjmjsv2/j3KZ09Bjbt2MF+uwb6Nk2rGgT6FHRoItasmd8CX6S4lB1CfgFB65jBCoz4OI+0hacxDSljYwy/8P/Po5nMiCl1CzpAUDlF/wl215RFdcPJdldijxOZ1FwAra+CrOH125E5PomUdLFKstttoygjPZKtZEcApI9n7Tj1pZD5Nv0CmKiq0Bpn6RWiu+SHlYQ== 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=2/n8RK0v98+d7c0SY9gkcOV6pbpiXqD6OzHjwmVs/J4=; b=UURB3USGYVnggrBmiBjuiI4UvU5Rqd/1Y9EeguI6oLO6MQAmNQ3u/XLwX5PRP7T1+/vQCeEFFU0tm1fvG39eIzTzjlP2oAj1ss3p8+SaUyXEzC3kgQzmEkL4f+HRL3UYM5iciFpwfHB0ebIMS5wI98irlhcCSy9tl6/ew5qx91L5xZiF8lDONivCsnbH/MCGJRruXpShST3WBIE82xBYZ7yrytCAeVmcAMvJODpzwJPr7ENxnnYQ0LDbQaSJGZpHvD/OVCGlh5yyzCVxdcQJVb9P3xbb72WlTVBt2MhYHITnIpu/flwYkdqIlIqH3zvBCKDu5y/owt/k2Vv3mlir1A== 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=2/n8RK0v98+d7c0SY9gkcOV6pbpiXqD6OzHjwmVs/J4=; b=aeCWbU9fppzm/Wqu181W0TS5U/7buWr/3Ptre51qp+cwmrRC//KB5CFpwYLP21anRo+w8mvUHtBbZ+9O8rIsi+9yjMCnrJ+spkaqh4jPcU/qrteALqKZgPSA0TmZToxn3rExvmS6fBdPoWwAJec3puR6sYXButVVItPOXUrViDY= 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 SA2PR10MB4412.namprd10.prod.outlook.com (2603:10b6:806:117::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.16; Thu, 22 Sep 2022 04:01:41 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::b594:405e:50f0:468e%5]) with mapi id 15.20.5654.014; Thu, 22 Sep 2022 04:01:41 +0000 From: Colin Foster To: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, netdev@vger.kernel.org Cc: Russell King , Linus Walleij , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Lee Jones , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , Vladimir Oltean , Florian Fainelli , Vivien Didelot , Andrew Lunn Subject: [PATCH v2 net-next 14/14] mfd: ocelot: add external ocelot switch control Date: Wed, 21 Sep 2022 21:01:02 -0700 Message-Id: <20220922040102.1554459-15-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220922040102.1554459-1-colin.foster@in-advantage.com> References: <20220922040102.1554459-1-colin.foster@in-advantage.com> X-ClientProxiedBy: BYAPR05CA0009.namprd05.prod.outlook.com (2603:10b6:a03:c0::22) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR1001MB2345:EE_|SA2PR10MB4412:EE_ X-MS-Office365-Filtering-Correlation-Id: a731b424-cf7e-49ff-2967-08da9c4f280d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UOi699KGPr9jzPD+alRqSYZcxLiWuloNJS+2lZWuBitU/xYMF2ac2Ys3lkEMsWYWCBT08rjba9fdgUQMORos+lYvEumpoGD+CzrLKLmmHMg3ZnODYYnSgLXDSghnfhqWe+HxkHrqpdG2elAB2Ws8KDt2dXnBGJJ50WhNVcaGlLpH/DLmFvxAWANpjzlKcZiOx4gpa5F1Pqh/J0T3jJCPWGcK4j6t84rhNdiUc96yrqzIej5VV4sOGuikfU7qR1Z9IJncPRaSrJgDaY5F8pLntD/u70UQA3w1rfSX+z7MQaTjHGdVVpm5gwV2l6JYi1wKrRUgktARIGo814G5gWicmGkbN2UAcaoqEwSqxvDwjT1YRcNLiqqj4NHQqeM3OoQ0/wZCGyjrEzvp0Zckv2BwjgZVdeL6e+tst3WigMrRiyiqL9nutxY7Z9a/pYzc6Uvp+AcajccdUjAZT+0ZDwDnRnxG218GqqHt+J/R+RF0uw9YhnFZpA+8jcKAEXm0Vl8nC/qZvPSJ5mWQ8EABUl/h3d1cgfxjLnSVflDLuDm752A3AfbHHMujWPg9F7H4rI9OcRO8kMpfV8ApmDqIjmYFqmEedEq9I/8oy2eGq5d2O0ZYixfyQHql5OJO1hS7dj5Rtt3wz/1fxOdYUojOgp9rJo9nvCnhLletFbS+5z+fPxGy1PxAdM73Vp70lIeneeObOpXu6QL6OeihJtqOfC7TF3MpTb2guiqJQNW8KnvYwbAD2Hik9HiABFhUcdsq/FbRqOmdpSXV+7J5r/VKIJBKdw== 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:(13230022)(366004)(376002)(396003)(346002)(136003)(39830400003)(451199015)(36756003)(6506007)(6666004)(52116002)(6512007)(26005)(86362001)(66476007)(66556008)(54906003)(4326008)(66946007)(41300700001)(8676002)(6486002)(38350700002)(38100700002)(2616005)(186003)(478600001)(1076003)(2906002)(316002)(5660300002)(7416002)(44832011)(4744005)(8936002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: nwNkTbTtJC/bzKYQpcVlFaVbK0/3ZmfwHeSvFghemCY6jXC9lq514Zd48UG0tvrrBwA0jFdO26I2nQNZZcT5RX3zpscC6zIWDXunWQYDe7tWrhRSxdP4lfMRkHqOV4G1iOOVDKqCsIz4cjyoKjSU+EBOoSHAW7EQxxm3ix/LUoDJ+VyKvgFc4H+FL5rPRxQsW8rMgCLvtnS/uuFeD83meqCr16BsFyPZtJia0WN1aai3cE54JeuJqOcRsLTzcrUgm9AgNepCG68Usg17+5cp8zxIG+rH3wRJT8EvsMSOxXVC18YpAjiy5OaHcviTl9xnNP6u0YY7+fvwmRxjAgnpQXngbxJiYnzRVlPGqPjCBjtWlTTfuNAutWcfws89KExtAC3xRyzb4y3WO9BliV7gS1o4GtcgoC1XcCiogyCKzdppg1pomo54XHE9ibgp0AhglptK08qI2EaXewmtF7jusrmOpa1EYneP7y5PQrggb6Wlpy7CpNc/XIVstlrfQRV6ZfEzclPBpz0JJeH/SyX9WTWIdHlDO4EEn0aRTcOqs/bpty1uhynzWh2m2HomWtpqsurJ5XJ1xcTW0EcnwKyF+pMitK8NIQvLCIJqXASBYUsXU4T/foHg45O+T30J3guqC9dhP55FIpbCrQMf+xChSEbBSnqMxTi/tG4Q8Z2geEKOSk6nJjJehsyCQXehZ5avoflbjf4O6YmUtaLggcEMZg9Dd0x9APLzjd2G5hRY5TXlbNXojSiv27dI27ZvngcdV1rsHy/4RQexiNPTe0on4wCmosj9qN52vZ+IchWfoxyKTZp3k1013qdJQbQDOwtPQHO+ToUyXpxdsKET6sPxLbY7f6yk7VpLWF2NEwzbLP3ZIQrpEU4syYuGqgbj5iUnBpz832LVDKEcvrxzbqjGVbXFIhnWb9Btt1AXZeJQamrI4IbsjObrCoJX92Boys5GOLYRCXkBQvpXOZ/fmGdGBuNjP2e9dOSz19ab0aPRDebp0vpBxWWa8aSyo20xnwr5yVoo9btZTA1lmz89NicpMnJGnUrjvrah1oCQeG1iXtQedo8dxK1l+T0PtRRgTaCCKLh7f1DiaWGsrAAeOIDc2IhtUSyiSk0fzeU2yJGDz1B4gajH1G5jMOwx1Ymumw5x8SIDkrv0uaGzvzU7DtGaNvVkWORzuGZ2CACiAV3p8VABiJc9Gp79UdbKfCsoriS3BG/L2ifO0ebHYCPZ0BzpDveoFJx9/wv6rnoA+zib50rerMkpyGfXsH0eAJsy2SrpkO66DzoL/rrsmId0eDcNvLMOeyCTUuk0TGu1jP+CRgsbxQPrH2wdYsru+5IXteJUlx4fCnhNspGCA+DWX9kyxbRjWqu2BaP/f6cqTSB8PYA5IUMM260dWFde+Oy7vstW2voUSAyPax+AeAo8AXfmrxr44/6+RYfPdTpffIBqEVfYaD3htGMkybiHkHAgIauJ7SirjS43Bp8+P5uACRgL0JlgNBQ18VuF8w2xWT88ftm6UOR3c/IEkVsjZQwJJVUsLm05Tfdsa3bh3Mk+SfpU/HnLROUMQURNQFkd4v9nu/x0ZVAxcncskA2ZtX5mhqeA1pbz9ouIrjQNEz7yaUaLYi7aAF6QEd6F/yaLjcvNDGM= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: a731b424-cf7e-49ff-2967-08da9c4f280d X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2022 04:01:41.6365 (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: 4sUdL+VEoDkOuKLm7Nl5S5vpus9Ze9lfdSz2AF3/bPyiG2BLAehEEvOuUVjYYDVbS9FyYlPJUfZksYhbT78JP9HoP7BKiyFKLq72xxGEvEQ= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA2PR10MB4412 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 --- v2 * New patch, broken out from a previous one --- drivers/mfd/ocelot-core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mfd/ocelot-core.c b/drivers/mfd/ocelot-core.c index 702555fbdcc5..8b4d813d3139 100644 --- a/drivers/mfd/ocelot-core.c +++ b/drivers/mfd/ocelot-core.c @@ -190,6 +190,9 @@ 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", }, };