Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2748853pxb; Mon, 31 Jan 2022 03:32:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJzThoMIoIXV9+DvjgR1S6fGNS00og8k6/29aWIAizvFHEZLvnyhA2+Rplk3cd0j5qVpoHYA X-Received: by 2002:a62:1813:: with SMTP id 19mr19566798pfy.14.1643628752547; Mon, 31 Jan 2022 03:32:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1643628752; cv=pass; d=google.com; s=arc-20160816; b=zVo+lzoJf7QMqE8/NDhyj4E5z1bJKcgebvCAgl2I9mktX6t6g52nxkiiyHmF9lH+YP luSWGWDyBLT15WrZOoGSmKIW8wqOzL/i5EM0Q1CnZK1vKmnBVB788wbk9F0WLywq8CkE Udo5FckJ59M8KQLT0XVU4Q3ws3CC8fCZlK+8F/DYI1SZOBK3A2uF1EE5pJNS8dVYDUTw FzkjyHj1IhanITh+QsU2yqJGeIWvptb8PKOyMqZHyPFqVNpFCXfLy4plnF8jy844axoI ZAYM+VkUIEEjJEI/7EMifv7FBQ0vZXgS3dh/FHCQ99ifvWIBmWr2p/hRR+YdQMHRQGKW R70A== 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=mQDF4oCS4oyLJbH4+gGFq/wxc013Q8C8cVc0ZWNaAXo=; b=UsWnzYk/eTTlukVuL9zghjxasW2aIJpKBAJCUmvp+lcCoICihPDtUxQ+ZkorKz86ZH lijFxmYFiaj4aQlPu4490hN8jB+j5QT0So602ezKTSl8WKzSbb4ZA7GqJRWkkRoVC6kg MWUzvR444R/eqb7JFqUOLVcSDAGNCf6l1xop29kOWhnbUHTuWhgvyJPPyDHtw84tK9pE 81BgGqFdWcqFVUZftE6ADLAgvt+forYqo0gqmVXyilc5HC0hi0MbxdvhF8O5STcsul4z G8ynf/E1fsKqMNFi18fNudXs5VPJFVeIqfwF/I1UuGX7KqCP5rJ2iIwEZRZJG3TqAsme 4jFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=jRmmy2gB; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si13379233pgv.688.2022.01.31.03.32.21; Mon, 31 Jan 2022 03:32:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@inadvantage.onmicrosoft.com header.s=selector2-inadvantage-onmicrosoft-com header.b=jRmmy2gB; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1351061AbiA1UGJ (ORCPT + 99 others); Fri, 28 Jan 2022 15:06:09 -0500 Received: from mail-dm6nam12on2138.outbound.protection.outlook.com ([40.107.243.138]:24992 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S234456AbiA1UGE (ORCPT ); Fri, 28 Jan 2022 15:06:04 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CtyvyelrZACqVQKzxuNrJB9pdIxwVapRavHtmUydhRewYTBXjBUys/LdoILsQpcRzvAf6IXyVojDZ3eybin5WnLmjdaVyR5W0CBVhZznz73PQmShg24njLBijGhBpxrcHgZn/R20Po/PSVHrnUuQeLDoR9sIuQa3WHFmGyXGfxLajyVfJWaD74WTzUwSs0+HUEbwuHuZWRwqiOKd7seoJ9l4UPFMqi6jFmclmkzdoFgm2Y59oqRchS8G7gHn+cdS/ClsvBxDQl/COMuUj2nqQQcKxjs+FUPIt0iPK6lzjsRhrsMMgbRTFMql9jfU6Cd4hKFDwFlOF+NaOkziOw2B/Q== 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=mQDF4oCS4oyLJbH4+gGFq/wxc013Q8C8cVc0ZWNaAXo=; b=Are2QZZiGFcgXriZO74I7Bk5PsQfIgf/vAFhsa+cS+2mqyKvm5oX/ImEaL3PWjxdq42dGsOy6FHFUy+DTfkX0XlKgiuJw2RU149AH4e6hNuD3/H2J/ru96r34oMhDgmZX8WlSjlnfTCUHxGzPP7QkdUfo9MYSPq9fEReDdaNns1MtZJtnEmoN8zd19Nn+OnLxPgjPKOk/rxyGEf1kMArzSoUMLpi3jil4LB73UVn5Oix4fiKsjC78ekOxDSVAi5RdrQ3IX5WPkKih5Ys8QQ+xTqZcBEwa3UzZMvl9hZiY5GOXC/QL8za8MeL8wVNPYCkF0lEUm9Dkb8a1iXAWxNr1g== 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=mQDF4oCS4oyLJbH4+gGFq/wxc013Q8C8cVc0ZWNaAXo=; b=jRmmy2gBvKuPH362BrGYGxQ+tiGjvChW5qUYqYO0blLHbcWLVbZULl3nbTbp1dM1rLpT4UZ01fvTnWrquPHnU862M1jEd8IbJIW8hk4g/nubT1o+20ftsyGx84W3V0v6Hh3gkvN2NQ1w+UKWEpFinn9R7hxImOyB6jXgYRGFfMI= 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 CH0PR10MB4969.namprd10.prod.outlook.com (2603:10b6:610:c8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4930.15; Fri, 28 Jan 2022 20:06:03 +0000 Received: from MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f]) by MWHPR1001MB2351.namprd10.prod.outlook.com ([fe80::2d52:2a96:7e6c:460f%4]) with mapi id 15.20.4909.017; Fri, 28 Jan 2022 20:06:02 +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 v4 net-next 1/2] net: mscc: ocelot: add ability to perform bulk reads Date: Fri, 28 Jan 2022 12:05:48 -0800 Message-Id: <20220128200549.1634446-2-colin.foster@in-advantage.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220128200549.1634446-1-colin.foster@in-advantage.com> References: <20220128200549.1634446-1-colin.foster@in-advantage.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MW4PR03CA0152.namprd03.prod.outlook.com (2603:10b6:303:8d::7) 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: 48ea875b-850c-401e-fdc5-08d9e2999be4 X-MS-TrafficTypeDiagnostic: CH0PR10MB4969: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: 2Oza6eEQxEBDSYqRGE3vIDmOGv1RW89jVBiVMihPbGZyOHp58SFn/KlvYsp0tMUi0hD6fwjGaMK27roBipi91Nnm46VPoSkTqD8r2cpqU9uXVTEvflxfEJKkXp+ERxIYWwGx++6Y0Z3lcfu/Hl/BfkhXntPnwL0VY7JJCiLcxYp+cXpqI2VYDK3+OWMkhpjQE6xvWOBUijhWCBIANSe9DzO7BbOHBy4Sb2hIR6IqEaC5BCaepbZZrARijpSC9ppxPDobY9d0E+bJBz8JDDNw9dXvrUSXNMEbB09jpumy2mtGLpoWUr0fzfKd545vwPNZ+ygorzjwurg8ktNRgA0sFEe41jLFcDSjpLFXXjCaU6qZlcDZJ86pKRismmfv6I7Ksl7WX8RLUHp0mB+dk1oe47eoeu+BBxQLvPdiR63m7TH8L0ExCCiFHF5nbF6bYXBefvBWc5n0sUN4Z/5zLe8lcJWSgzM5Bl7xXGhx1ZcXw9nw4qxHXQpethNM8KIiA0s6sHUoWndrQChS2TyTFJXVIwW/0mn25eAGxg5DMjDBCLCXYSMIcro4ZSDosHdMl8NkiIc+sAUL9BJ8SBfq/V9+cYwGDOP/kdTMC9g5Sw8I6qObzZA/bvRBRgjzzeKu4vim7q19sdo4P9+LhXNrdVINLi6wfP11XT1iT8RNz9/yQeNpegH1SYwGaz5HqqjaVO3pvpVAz6vo9B1IlEQdKJQ3mA== 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)(39830400003)(396003)(376002)(136003)(42606007)(346002)(366004)(83380400001)(2616005)(66556008)(66946007)(66476007)(36756003)(6506007)(6512007)(8676002)(6666004)(4326008)(8936002)(52116002)(38100700002)(38350700002)(26005)(44832011)(54906003)(5660300002)(316002)(508600001)(86362001)(6486002)(2906002)(186003)(1076003)(20210929001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?H1HFo8xhpWfjx1Yi4NTvxGquk1DcxM9XNnEXnim35N/6+ueY/lX9FlawG9uJ?= =?us-ascii?Q?eCjGwBY7fPf3nVwsjgbf78Y6t2dU3EwKMsycP3vrFCWF5HtbliyqwMzr6nwW?= =?us-ascii?Q?K8LA4a8q/rAnNg/dSiQGfGWim7eyJLSqEwe0DeFcoQKn7pgMga88MBwdNbcl?= =?us-ascii?Q?Dg6vMGpLg51yHjQQv3Q+DoPTqr5kkJ9izIM1PteVXilbxM21xQyJGb+eP3Bp?= =?us-ascii?Q?xSTQonHOuL59Gx7GtdsiOq/igxK5SWgR42OzPLXf56iFOWYdIFNP6mkGWVd0?= =?us-ascii?Q?OIWnqDOGAtDW1eL7AZ/UJys+V7FKdPFUrDGPVfWeOC5iGSketnxYaaNiKF/N?= =?us-ascii?Q?ulzDLL9IHrLg+d9stqrAVkExlHxPnvHRxDU76htzI0/WytTPFq1d64ZvTL18?= =?us-ascii?Q?a59T7a5PE20oVP53XYhnZfkgL0T6C+KgHuQXK0wE2NfCrrGZSMqUserLJ+xR?= =?us-ascii?Q?OFwXVK5IZNWVg7DKDS84kDRhuKZmaL2FTGhlKf1lauNkseHVLhkKNjTwveHH?= =?us-ascii?Q?dS66CuoE2Bn5Ufs0afXfI+sAthOVhRZW7HCdiwifJSjmbQElohCgzNd9lJZ7?= =?us-ascii?Q?CRHuOBTevu0h27rBOuS/Cd5dzz0wmUidmNvdmf7q1QXoeZM1FeXVWHD63olR?= =?us-ascii?Q?hPQS7JyuY6FnNvUPDXeudbdX7G7CmeHdbiCXT5IT7xYvlCXcxyu7w+2Tz2G8?= =?us-ascii?Q?5pETI+wmeLwAV3HTaqJ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ii?= =?us-ascii?Q?g5hyLB30Tsh41EqPI8CAbnIX0iEt1YFYJsHEI0kZzs2EQbDgEPKYW2XSwjpw?= =?us-ascii?Q?HzmQSQ=3D=3D?= X-OriginatorOrg: in-advantage.com X-MS-Exchange-CrossTenant-Network-Message-Id: 48ea875b-850c-401e-fdc5-08d9e2999be4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1001MB2351.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Jan 2022 20:06:02.5484 (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: zvho/WcSSQZ9+tg5QaPdjbWURjqDMPwenYB1QE8c6ZYqjkAIuOZtOu3RP/olDfwU/jiIenHBN8TnxMr097AvU9bJfM7Gv/Dhi44LmmNfiFA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR10MB4969 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 --- drivers/net/ethernet/mscc/ocelot_io.c | 13 +++++++++++++ include/soc/mscc/ocelot.h | 4 ++++ 2 files changed, 17 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 62cd61d4142e..b66e5abe04a7 100644 --- a/include/soc/mscc/ocelot.h +++ b/include/soc/mscc/ocelot.h @@ -744,6 +744,8 @@ 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) __ocelot_read_ix(ocelot, reg, reg##_GSZ * (gi)) #define ocelot_read_rix(ocelot, reg, ri) __ocelot_read_ix(ocelot, reg, reg##_RSZ * (ri)) @@ -786,6 +788,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