From patchwork Thu Feb 10 04:13:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Foster X-Patchwork-Id: 12741239 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 57819C433EF for ; Thu, 10 Feb 2022 04:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233263AbiBJEPy (ORCPT ); Wed, 9 Feb 2022 23:15:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:58972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233188AbiBJEPj (ORCPT ); Wed, 9 Feb 2022 23:15:39 -0500 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2134.outbound.protection.outlook.com [40.107.243.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98A97272D; Wed, 9 Feb 2022 20:15:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BBeUBeacs5vzvXsFTRaHcZPnDEP7n5Iym45qhJfZGTcozEYRGO8+GG+nOFfBL2AdhjT7Rn6JtF3OfI5rFFnFjb5S9SMhyqkWArJ7KpnMzmkm4at6PbEDDwJkUUBqfXGsSjfqQF1NWyiyXasQqzpguM2fdeoo3Jz9P4ncIt4qnyysnpWvKHHaL1mFFUBi/SmZehdhxtINGABzjf4CQUzizU5xbN8mWRdkQ9PI1nsQz22RSCrKmyM/yvhgeGS3ek1bJzIwp4YtGaUluyYuFFMzCdUrjGrpDFJAcyA5EJdsEQ1+NirugK6Hf/RaBie9QX28mIMrjBX9wTt0Y3h+iBi8Zg== 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=/nv5AjNp/bsPNTC6KiiFtIi7/+Szne1J4+M/2V0nzN8=; b=i5wqJf3sh6Iq6nPFpldFxMBEKWNECJ/tJ3RdClF/jbpi7+5L0o6+YLtpNvxpgq6URUYyzoRkG07ZGtH7SISWdCaLKBnOcxMNtRp7r9odXqPyiqKSh+ZOg9aj2C38xGNFsHtFQKmkEwcG1qFAROvrt6kpK/7N65BvSFkouBBFMPehAAWiMhDzXEbuszBUDdQnWwIYopFLWqZpPUymFXIcgX5LJt7q2fT95lj9M9vumzMrPAiWAErytfifcXqbOX20ty0E6tc7GHAsimwYanRZWi0s1J3wCtwZdLiFmffZOsK97U6M3dFc4NCdSLg7KI8YUun+MVYHGaVtQbRtfM0mBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=/nv5AjNp/bsPNTC6KiiFtIi7/+Szne1J4+M/2V0nzN8=; b=zWOiNrW1ws2OwB0Zx/bQkZeg1v/8UnMcKsIyRehWosktzPPpuTUes4g1TinZxcL0G3Rcfm4HmGNzPXhi/XiRQ+ZAT4FtylsX/YdTG83UudeSYGEtUVrcjagVoNVJK26EuYBZ9nSSkA9B9ZAzT2/tie1Kl9ASYcz+FxQCvgAlm8I= 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 BN0PR10MB5048.namprd10.prod.outlook.com (2603:10b6:408:117::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4951.12; Thu, 10 Feb 2022 04:15:37 +0000 Received: from DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::bcda:8606:7c7a:b1d4]) by DM5PR1001MB2345.namprd10.prod.outlook.com ([fe80::bcda:8606:7c7a:b1d4%3]) with mapi id 15.20.4951.017; Thu, 10 Feb 2022 04:15:37 +0000 From: Colin Foster To: linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Jakub Kicinski , "David S. Miller" , UNGLinuxDriver@microchip.com, Alexandre Belloni , Claudiu Manoil , Vladimir Oltean Subject: [PATCH v6 net-next 4/5] net: mscc: ocelot: add ability to perform bulk reads Date: Wed, 9 Feb 2022 20:13:44 -0800 Message-Id: <20220210041345.321216-5-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220210041345.321216-1-colin.foster@in-advantage.com> References: <20220210041345.321216-1-colin.foster@in-advantage.com> X-ClientProxiedBy: MW4PR04CA0084.namprd04.prod.outlook.com (2603:10b6:303:6b::29) To DM5PR1001MB2345.namprd10.prod.outlook.com (2603:10b6:4:2d::31) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b8d0da1a-ec18-4e4c-76d6-08d9ec4bfdaf X-MS-TrafficTypeDiagnostic: BN0PR10MB5048:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hEaMtEUSzfFQa+35YOEOOG65UayMK9W8ZOK0J1UvzDHJNu8f26qlGMJcB+qlWiTzObAubhIvt1/KcY1SON4TnjanUjoFRQzWFygdgrKj45mZcHfTYkoqJuPImVsE16+0jhfD84VFKkFcxxCJVtXeTPzW9Nlt0hggPr7ghWZWSw0RkDLxmsu2HDkymhGnoQgmNWVQQmHZB/dGK6uv3EJCCpI9uqOSORWGUaMWGuK/+mLOI8sKPfFSVnYf8WcalmpbN0+U6Vjt4painzZKINQC+6DvSiNlbd9nQqZUeV3i1Ja4/ZlRN/CrJZuLdd9KMWhnfRMiDaHu1in5+YSJKbPda6QHyv1jTOvSfwNApbenO+8GJ4x+NM9IVojPftGn4Sn8nZkWAii7t18IeAp2KkSz0Ko9SGb1R3OGPM70O7dJRvgrZSgAwlWPGLTAreRqB0Rb7gDRLEybeZekxI1QhVcRCpPEygWtT7LcF8fOivWXlBoiDM/sUuhpQKQFkKkw7Vd7/sTeWWakCSpE8nZ3bbNkcfGq/xUJslbPO3GA0LiwneacKvGnjmF1Z1vpjd6TIY5eX2iO1t+YNIjSEgPJVX9jWPgBgsebPwnm7KejP0Liu2/F63D3ozMq34r4FLFfrgJhVesT9hAEqJjwoPKPwNfxFHIBSQUa8+BWetjKczYD8piTKmWM0ptO/pMaprbEBt8UyFpXHXmpTAmpRjqpvmvjwg== 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:(13230001)(346002)(366004)(42606007)(136003)(39830400003)(396003)(376002)(316002)(4326008)(44832011)(66946007)(6512007)(86362001)(52116002)(66476007)(8936002)(6506007)(66556008)(54906003)(83380400001)(8676002)(1076003)(36756003)(2906002)(186003)(2616005)(5660300002)(26005)(38350700002)(38100700002)(6486002)(508600001)(6666004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: FkX6hErs5t8jncaHoA7nJaSM43s39VWrOad7sgHDFqBYCYhOXby68pjT0cLyC2bfcBvb1Db4JqMdp/aGiom5mIFwnNN8VlsG+jYpAlMCa9ETrmL3SfF3Ui6s0xI059PnpTincp1Oc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jVB6oFYeg6FzJXnwU1mzjQSY/Ki+8KC+zkjIUc433jtP+PUA4SFYrRa+0DBctVrsjPr4RKjjvRz1p+ADP/43xmg31jfM8w/Vr6nEBKweWtxv6fj/PQSuhoOYYW2HHj8DIcEAXINwtpuEsuPBk1WbNu5jHpNgL5hIB0hgSkLRoZ5/AzQ6v+gTQ2nQpZClVI8Mk8ovL+I+a+wVROglxfgfcWmGdyESZHF6xlfCwY4tqeTPCXQu85k515KVRGrm5ufzsKGu8VA3mRoY2f93PPCs1PinNxDj5s0/1l7Vd0dAO8yqm9c5TajBei9nbHoWDTJLAU52dbAOob1t/zeh2oAkxFNLqTRJP/mTyuEaIwX/ZVsJyTEaZuM+/IFZHL1k/My9gJZopwdq1J8X9eTOhX0JhfVPux77rdeE+/A1bdSrfq1L4X4TvE/pFI0bKTCix9xu3uabc031hv76tNQ== X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: b8d0da1a-ec18-4e4c-76d6-08d9ec4bfdaf X-MS-Exchange-CrossTenant-AuthSource: DM5PR1001MB2345.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Feb 2022 04:15:37.5910 (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: 7dW+pRO8RGVLs/X2CFwt4T0loEzBE/1ehlhjKMDSupoJ6RvaZ+0VZPPR7e142DaQoHWa/r+GBSS5a+lc5hTAvpMaGmoTF7bYshdJnYw/lkU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN0PR10MB5048 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Regmap supports bulk register reads. Ocelot does not. This patch adds support for Ocelot to invoke bulk regmap reads. That will allow any driver that performs consecutive reads over memory regions to optimize that access. Signed-off-by: Colin Foster Reviewed-by: Vladimir Oltean --- drivers/net/ethernet/mscc/ocelot_io.c | 13 +++++++++++++ include/soc/mscc/ocelot.h | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot_io.c b/drivers/net/ethernet/mscc/ocelot_io.c index 7390fa3980ec..2067382d0ee1 100644 --- a/drivers/net/ethernet/mscc/ocelot_io.c +++ b/drivers/net/ethernet/mscc/ocelot_io.c @@ -10,6 +10,19 @@ #include "ocelot.h" +int __ocelot_bulk_read_ix(struct ocelot *ocelot, u32 reg, u32 offset, void *buf, + int count) +{ + u16 target = reg >> TARGET_OFFSET; + + WARN_ON(!target); + + return regmap_bulk_read(ocelot->targets[target], + ocelot->map[target][reg & REG_MASK] + offset, + buf, count); +} +EXPORT_SYMBOL_GPL(__ocelot_bulk_read_ix); + u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset) { u16 target = reg >> TARGET_OFFSET; diff --git a/include/soc/mscc/ocelot.h b/include/soc/mscc/ocelot.h index 14a6f4de8e1f..312b72558659 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -744,6 +744,9 @@ struct ocelot_policer { u32 burst; /* bytes */ }; +#define ocelot_bulk_read_rix(ocelot, reg, ri, buf, count) \ + __ocelot_bulk_read_ix(ocelot, reg, reg##_RSZ * (ri), buf, count) + #define ocelot_read_ix(ocelot, reg, gi, ri) \ __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi) + reg##_RSZ * (ri)) #define ocelot_read_gix(ocelot, reg, gi) \ @@ -800,6 +803,8 @@ struct ocelot_policer { u32 ocelot_port_readl(struct ocelot_port *port, u32 reg); void ocelot_port_writel(struct ocelot_port *port, u32 val, u32 reg); void ocelot_port_rmwl(struct ocelot_port *port, u32 val, u32 mask, u32 reg); +int __ocelot_bulk_read_ix(struct ocelot *ocelot, u32 reg, u32 offset, void *buf, + int count); u32 __ocelot_read_ix(struct ocelot *ocelot, u32 reg, u32 offset); void __ocelot_write_ix(struct ocelot *ocelot, u32 val, u32 reg, u32 offset); void __ocelot_rmw_ix(struct ocelot *ocelot, u32 val, u32 mask, u32 reg,