Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2978862rwo; Mon, 24 Jul 2023 04:36:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGQtrmRE0+I1DgrDdGX5OYoCrAptrSdVbnOCxhYS00jMgmJrXiLfY8AHPD7V4kb3+KDrCJq X-Received: by 2002:a2e:9ad2:0:b0:2b9:563b:7e3a with SMTP id p18-20020a2e9ad2000000b002b9563b7e3amr5622808ljj.32.1690198589494; Mon, 24 Jul 2023 04:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690198589; cv=none; d=google.com; s=arc-20160816; b=Be5BZ5VmIZGTBZBftepCFYthQ7qcsbAVkaczj5ILsOnk1X9NZ1DoyvDZNfueRwlLKI 4ioN4/BeK0/WrXJZdn5SiC0a/UjGd5ESzFthShgH34zQyHTXlgdrNrCKs49CL3oK/AR/ 8O3txuUMQjTp9dvb4ijmVMu6I2vkTria2quxFOZAGtKb8riqWcxNLktkHqDhhFyTGAr4 ChVTy2Y4p+shORY3WJuvAoxQuMDi5b40Tlu4jGeqv40j9Pb/YyNIcQO3RR/nby64jZkr 5ZK8YoHIHeevAXQZkWwPKFuFEzBL6KGgkpS3M8Zz4PCqzo/NtBDzpkjuUp6IB+i07GHO FHwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Aam2VkrDYezZoaNnsx9v8jtr0SXx7JR4BqWP70FbZcA=; fh=TO4fkcEI9b5r/wMetIII7RIVPqbK0XaoWpj6Tf2aW8M=; b=mN/HIXsYt894+TJSgZJlwCtPHX5z3ZyTCtaQX1ljBZbQbmymOskl2dDRkIKrVLAoDk pkGqTdR760SUA0hzpGQSrkEXNqJsEttNB4k/wlbOfXR8ZNQ0s1j26tzT0KuWE2PfnZhT h/xvcl8U0obLkTErYQmlSWyDVxG5nfiH26GrI89mxp3Q+ga28sluNFr6i61O7vqoK31e dTyHrJ0zvEnmh+sQpzDUMKNtUU8+r8UxqK8YBdzpnda3+fDadvVWxH96IbE0SA4dSdsQ WroG/QAAkUHXqJTm31B7Jf4phYEEekhEk5AwleIZm+RwAeWqykj7bJpHCN9JHwNsOq+/ phyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SBL7XNYc; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mj20-20020a170906af9400b00997d002ae21si5877914ejb.90.2023.07.24.04.36.05; Mon, 24 Jul 2023 04:36:29 -0700 (PDT) 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=@ti.com header.s=ti-com-17Q1 header.b=SBL7XNYc; 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=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229664AbjGXLa5 (ORCPT + 99 others); Mon, 24 Jul 2023 07:30:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230013AbjGXLam (ORCPT ); Mon, 24 Jul 2023 07:30:42 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB501E74; Mon, 24 Jul 2023 04:30:31 -0700 (PDT) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 36OBU9Mm071974; Mon, 24 Jul 2023 06:30:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690198209; bh=Aam2VkrDYezZoaNnsx9v8jtr0SXx7JR4BqWP70FbZcA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=SBL7XNYcndsHqZKsUgzIIp3mCmA0//eb+DyexZfwOm2xNrZy9MspnhSjR8srnhngI VGkfQn2VKZ9yNAZMGFbvDU3WbtAr+nS+ZQJXecqpGqrvIvkadx94eXhetRlZ2XnZda XFSz7unoILulM8A5Q5IpNKIPkn5C1Ss81RLmGaz8= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 36OBU90w064741 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 24 Jul 2023 06:30:09 -0500 Received: from DLEE101.ent.ti.com (157.170.170.31) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 24 Jul 2023 06:30:08 -0500 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE101.ent.ti.com (157.170.170.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 24 Jul 2023 06:30:09 -0500 Received: from fllv0122.itg.ti.com (fllv0122.itg.ti.com [10.247.120.72]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 36OBU8qJ076244; Mon, 24 Jul 2023 06:30:08 -0500 Received: from localhost (uda0501179.dhcp.ti.com [172.24.227.217]) by fllv0122.itg.ti.com (8.14.7/8.14.7) with ESMTP id 36OBU8Qr007617; Mon, 24 Jul 2023 06:30:08 -0500 From: MD Danish Anwar To: Randy Dunlap , Roger Quadros , Simon Horman , Vignesh Raghavendra , Andrew Lunn , Richard Cochran , Conor Dooley , Krzysztof Kozlowski , Rob Herring , Paolo Abeni , Jakub Kicinski , Eric Dumazet , "David S. Miller" , MD Danish Anwar CC: , , , , , , Subject: [PATCH v11 04/10] net: ti: icssg-prueth: Add icssg queues APIs and macros Date: Mon, 24 Jul 2023 16:59:28 +0530 Message-ID: <20230724112934.2637802-5-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230724112934.2637802-1-danishanwar@ti.com> References: <20230724112934.2637802-1-danishanwar@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 Add icssg_queue.c file. This file introduces macros and APIs related to ICSSG queues. These will be used by ICSSG Ethernet driver. Signed-off-by: MD Danish Anwar Reviewed-by: Andrew Lunn --- drivers/net/ethernet/ti/icssg_queues.c | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 drivers/net/ethernet/ti/icssg_queues.c diff --git a/drivers/net/ethernet/ti/icssg_queues.c b/drivers/net/ethernet/ti/icssg_queues.c new file mode 100644 index 000000000000..1c2b92dbcb59 --- /dev/null +++ b/drivers/net/ethernet/ti/icssg_queues.c @@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 +/* ICSSG Buffer queue helpers + * + * Copyright (C) 2021 Texas Instruments Incorporated - https://www.ti.com + */ + +#include +#include "icssg_prueth.h" + +#define ICSSG_QUEUES_MAX 64 +#define ICSSG_QUEUE_OFFSET 0xd00 +#define ICSSG_QUEUE_PEEK_OFFSET 0xe00 +#define ICSSG_QUEUE_CNT_OFFSET 0xe40 +#define ICSSG_QUEUE_RESET_OFFSET 0xf40 + +int icssg_queue_pop(struct prueth *prueth, u8 queue) +{ + u32 val, cnt; + + if (queue >= ICSSG_QUEUES_MAX) + return -EINVAL; + + regmap_read(prueth->miig_rt, ICSSG_QUEUE_CNT_OFFSET + 4 * queue, &cnt); + if (!cnt) + return -EINVAL; + + regmap_read(prueth->miig_rt, ICSSG_QUEUE_OFFSET + 4 * queue, &val); + + return val; +} + +void icssg_queue_push(struct prueth *prueth, int queue, u16 addr) +{ + if (queue >= ICSSG_QUEUES_MAX) + return; + + regmap_write(prueth->miig_rt, ICSSG_QUEUE_OFFSET + 4 * queue, addr); +} -- 2.34.1