Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5714516pxb; Mon, 14 Feb 2022 06:03:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcaYpM6DyaBTIdiHlX9cQUpjw2GhKaW33nvN3z69lmL6p9q7B1hTEWAUErYgmjSzWU4lr4 X-Received: by 2002:a17:906:2bd9:: with SMTP id n25mr11541313ejg.359.1644847410937; Mon, 14 Feb 2022 06:03:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1644847410; cv=pass; d=google.com; s=arc-20160816; b=LrrYZ+GpeLe43ujLK3KA6sqiaMdcmRChHuv/E2U55N29nhUIwZnrH2WfEx/H04XjlO dP420aJI1sQIv7pJyU5KLiNJKGsSNdgxDR9TyjyLbeNQhcjCW+feVGI+Xi4qk5ulGu9Y nYqED0i8pTtIjBbqzJWEQ0LBCKKBF2pKH0bVZK7eZuBGwNfrq+0OiEXBTAduanRXUJpg G3NZZw3fXUBw1I84cWsaYFl5F93iPMNPQBZ1k7SeBPhP/FQmLzHJIHpq7uZOcSONa4i/ H21HkhbWwluSdp65w7wSA0D3DF5XlMbd6ilUP6DkPsx8fLizZhSM5d6irvxx6mNdOKXr INkA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/nv5AjNp/bsPNTC6KiiFtIi7/+Szne1J4+M/2V0nzN8=; b=d9keORiDckZq6YDm+4NeZaxNIrNfsUBVpoK4XVJNd3Ki/gvl2//OsguXoE2xzypFNp P8z5fhB59zM0POCcnyp03UIGATTKK2VJcJXdf6JqtszjSAePdF1yH4wlAbmc21DQrF3v zpkShH33TafvQ+/ZQHioMFwHqmQugEufscBhH8wOI6t4XJGSqSgUJa2hHbz+dFQ2f8He G+HBTcx9yQY2jMkhSWEHi1R75E+RXrphBfAyqFe4N8w9K93xfVnYA77erMwIb1z6VqxN W1F4eL6/SYC9Srer8id/YLsyLdZhM2skSOfPLkB4//zhk5Sc3iO6GYmT/KtCo9JAUdL3 sJLg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=mKAF4Ret; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3si3682015eds.472.2022.02.14.06.03.06; Mon, 14 Feb 2022 06:03:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=mKAF4Ret; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=in-advantage.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237973AbiBMTNa (ORCPT + 99 others); Sun, 13 Feb 2022 14:13:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237941AbiBMTNS (ORCPT ); Sun, 13 Feb 2022 14:13:18 -0500 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2130.outbound.protection.outlook.com [40.107.236.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20C7B593BC; Sun, 13 Feb 2022 11:13:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Y4C8VSePQBYrAeNL41t1aNly6xfji0iC2a/JTySLjZhjXMvfXK4DjEZFTNEvkzVPd6lv/M5FgKgRQBAFYbaBW25iVWsr+cEqTIFysS0cWVvrtCPfIyusvUkUOpNCHBeiVmIDszIpFP51QV7qlIk7fURiTgJSsShSrgGlotZqVz5F/rbR0LNEVJRiYre8MFyx8TyhnpL8z5HsqLNiA3oZT4hbl8TKv+133nrSvPUMXvkdLRujSJS3f7IkqSJvBhHU6RFDJpDXgkQDqstj52mmXGzgi78v43pI/Ts8MoVfKaP0kjANfbpq0ULkQzfImf8dmyoU7cY+WQMpqOvBYt6xvQ== 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=NFhk6mP7LGLDiVtTqM3UKkXSpk2nOLi20TmewCz2i/LhsKEURQaG3zK65JzL4u8c/yAs9eeEmujF8TjdzkqVyUPPCez8bpxoAOw3i0HSilxROqEu6Dq/o5vcoweQLSFnSDwCdP7Vqx7e3RxJ6r1uG7x8c9ZiiYP1fPILvJ6eFavAq7XFhZ9EVidYxNHeAYF+n8sHai/3GBqZl0Xs0FSALQ2AGR+61FGIkiq/Ha86SHyqo5wa/NBgqtqLzssVG29N0CwNp+ckHxYZCxb/9re4YyAFuidVW0t8lszj9+9BnKX3ZwtdvJx+py+5VdEmp/3xMMnQHAD3CBptaz+Dbf783g== 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=mKAF4RetFHvD3js6GL95XaijUEJgi8bFRJaqCcrWXQ12nc+PP5eG8w6nrOavnbsFQ5NsMApuEMU6vloa+QSaI3XEyWjLvVOwHVRXG5vY48gHQDcv7c/PbyCxxPxLV47GvKnrJtfCEDAqctzQHRZJTtlw8fEip8Ulqj1o+fMSCNQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=in-advantage.com; Received: from MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) by BN8PR10MB3315.namprd10.prod.outlook.com (2603:10b6:408:c8::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4975.11; Sun, 13 Feb 2022 19:13:08 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::7c:dc80:7f24:67c5%6]) with mapi id 15.20.4975.012; Sun, 13 Feb 2022 19:13:08 +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 v7 net-next 3/4] net: mscc: ocelot: add ability to perform bulk reads Date: Sun, 13 Feb 2022 11:12:53 -0800 Message-Id: <20220213191254.1480765-4-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220213191254.1480765-1-colin.foster@in-advantage.com> References: <20220213191254.1480765-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR04CA0346.namprd04.prod.outlook.com (2603:10b6:303:8a::21) To MWHPR1001MB2351.namprd10.prod.outlook.com (2603:10b6:301:35::37) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 71411400-7bd6-4783-f53c-08d9ef24dce2 X-MS-TrafficTypeDiagnostic: BN8PR10MB3315: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: dYepqvpusFGjj4HoyFxVfDUBf7nR9tuFP/ZnU1ZRUKkD5gufd/pD6oQ72kEQzcO5Z0UmxphJzUvKItoMRnnnGmuuhaTKDrDuD/RUVrFoM2AAjJTw4USefoZibYOdxNsJgZuW7/8eJSS6fWkOwdsTIOizBU4nL8BNZc3Fb1A6x8ILQ+O1OaomEq/DhM3obb2Q7Hde4QZM8DbJ5E8GDqplbg0khkPXnMF9aaKB6JboHF0q0k65d28cJ+OkVGPaJxp8Dv5mMSnNUCbZU2cCXUrpVqlFXEi05FY0x3nYlH+T0MSPOwT5WrXEPvH1gbLrmNSPtq22OTthXSpwrlTYZNdP3qQydx1eWhocscl3BEmnWugpPShHIglLhjqu6/p03oQMBAs2/m8w42QYyScgK2tjjEsgF2RmEqbVoqCETN7YsaYtgtpJlwDmEYWqWqYLdVG3VN7fcSSs5gSgtmJwSRnUBwwFja4qbPYKQYF37YDkE3uKY5BWFY4SaqTjdQMSC5ay9WmpHi4rN9rAheNz3tDb3H2TjaAL+HeIN1eiArIp8yBvZkW2ZjN95xcfM2c7Urj3APK9844Gc4WU0imNfuQu8er+mJmP/l+3glBIpTKaDxRMOArTx4NGiv6oUCM0TSbLfhrGpDvNl88VxDp5RXrQ8JOt8/9cBz+wWZwOcgzE7AL8TMoQE4yPN/Pw42mfLPiG+/3920fF6t2qYe673m6gZQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1001MB2351.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(136003)(42606007)(366004)(376002)(39830400003)(346002)(396003)(26005)(186003)(2616005)(508600001)(6486002)(6512007)(66556008)(66476007)(38100700002)(4326008)(66946007)(44832011)(1076003)(38350700002)(5660300002)(8676002)(36756003)(83380400001)(52116002)(6506007)(86362001)(6666004)(8936002)(2906002)(54906003)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?EUZAwI4yCEEIZKuV5/DgwQlPPAuaxNUsVM9g3dDNjFqct0/FnY57Rhig+ViS?= =?us-ascii?Q?OjK11kvKOhGfyayXXOGG80vpwIclXgMJHOWWBEZ3hdO446VlJ+WZblOjh4Yt?= =?us-ascii?Q?tIdWiaUTC++DNqeIfW+yk423CwCao7T0UQX4jAVchcwAau3iAUD14Cx3rUhq?= =?us-ascii?Q?V6eNYJOhg3hcR1z8MkqhBpGTL0HmLW+YzpXYc2RFeixqGuMpERhsV7hvjnem?= =?us-ascii?Q?5AejV6ApjRWYTJ1cN4HDmyaLKqMH+etvM8S/AuFRuFbvCo/NOYSgXFy7QwIh?= =?us-ascii?Q?eaHKm9kWCNszDNNejhjlEaNksX5uoR7iE2daPjIPYF4syEnLaeEuiP2DKOyy?= =?us-ascii?Q?vm+7hUWf2YEW5z1OSaD7yKRvRbhotMaAOplYEfwn3E9y5R5sBftPKktu3nhu?= =?us-ascii?Q?FSIMuf+8/AYIJ9/d+8fLllzXuSNBMef+KxpN5r/C+WLBAJfsvtnP5cgDnKXJ?= =?us-ascii?Q?GEEhrRFuEH3rfdy5dCtND0i6BKJg/june476lNNTXendGwxhCQG6/yIhRUOR?= =?us-ascii?Q?Ei1TMBMznSwlg5MVqRx2/J6lo1j0eRk+2CcYQ2bFU+CUMlN/BHKKox5yphrm?= =?us-ascii?Q?BxjZk2v/BwsNEt2yXSgqk4LttOVPcakCGtQLeFtEkNTqDfKK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4VzzmmYR8U+mgeAyTg+sqtGkbGNSV/YEoPN9kp3gFQBj?= =?us-ascii?Q?G459xDeChHwrlOJBT6C3fyzfXxB03If/BUdRem5dcUzzN+Im1VBLZ14Ubzdc?= =?us-ascii?Q?tKSk+E/lSoDxqZdwyCVfCfmCEbMKJHdgw/KrxeY5h3DCj5ZZhkA55z8ppLp4?= =?us-ascii?Q?bpOLEQ=3D=3D?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 71411400-7bd6-4783-f53c-08d9ef24dce2 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2022 19:13:05.4452 (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: h41jt6jzMSKJwo3uIUlnW2cKJqo542SjIdKCs5cZiGZlT4TrZ/F/KsOF78jHdnKMY6f6z0awT03dcFSxQDVumP+n7ifix5BCPREIG+Ieo+0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR10MB3315 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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, -- 2.25.1