Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp2266266rwb; Thu, 27 Jul 2023 04:59:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlHfAMq/UkxC6oqWykgDEF5FpP+Y8XXBQASrvVH6hKIaG5tMnhlgEYabT+jjXLpLUhl8Peku X-Received: by 2002:a05:6a20:12c3:b0:137:514a:9835 with SMTP id v3-20020a056a2012c300b00137514a9835mr4802774pzg.9.1690459144377; Thu, 27 Jul 2023 04:59:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690459144; cv=none; d=google.com; s=arc-20160816; b=rqlDFNjCQ0HmsUBS89HR7RHmuCJHxuy6fMlZsZEpQgILN1LHv56Q1Aznc89PsTZv/z GAFq/1KkJZm0jmWan0QcwZr/B9Prv0VTFfLzrqWqLUAURdv8zlp1R1L07nAnPhnwAVGj gZntjx/vDKVH6oFYsjhDVunRgNctpOQdZuDNzqyOSNi91ZeSRhxpss6K7mHEw4EMr55U 6TvE2OPyRC00SEIFma+h/mK7vOPK2uAEkMV8J0Lbo3Q9IbwJt+GOhiFBc3a9pw3anB1h 93LRLnzIc1+uLmhUKH0KwdCsNKYgwOzIMbb7xGjil0ojRFe4DGw6trVu4fmbvI68KjaV igAg== 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=IEH4yTi10RkH3tJJvcjqP8HsfdZ0N5m89bHnFN/xamk=; fh=TO4fkcEI9b5r/wMetIII7RIVPqbK0XaoWpj6Tf2aW8M=; b=Ld556tDMkCaD4pQUqWjvOvIzJ8w4DSJgSGIMyrgk6MmR9KP0kWnzkbtDb6L9roOvK0 12iQc0dR8R0AbDWJK4pZnOt6cF8aO+gMjxevEIB33F1zi9stVKbtA13UWiNZOPqlPCCP ufhKobY/xbeMePiF6pumJJSrExAgb841kJra4mQGDiY+jLPExBvLq82u0HSePZUSmh0G kRCh0Z/+rA1YYJE73F6PvYz/nf67IEt3qWpYYM3SG9gjdEXwRhoAigAS4/kSRniVonp9 oMhHDm1x5AWzdJo55G2R6DjECCUwOsAhEsuQC+lBh+9z1lbULGKkhmdDaBVPPlTtqQ+q 81mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=pxwW5tTu; 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 i11-20020a636d0b000000b00563df8b134esi1120587pgc.213.2023.07.27.04.58.52; Thu, 27 Jul 2023 04:59:04 -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=pxwW5tTu; 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 S232287AbjG0LaH (ORCPT + 99 others); Thu, 27 Jul 2023 07:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232086AbjG0L3w (ORCPT ); Thu, 27 Jul 2023 07:29:52 -0400 Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF2A7358A; Thu, 27 Jul 2023 04:29:40 -0700 (PDT) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 36RBT1Tr119121; Thu, 27 Jul 2023 06:29:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1690457341; bh=IEH4yTi10RkH3tJJvcjqP8HsfdZ0N5m89bHnFN/xamk=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=pxwW5tTuVKQk/9K5LE0U9BkNIkp5SItZC1M7SdjdELzM/IVgvRa3303GLuTxyRSPm DOi6OaIiEvJkZnWacE1xs9ruxS5xptjcUlUi/jlN4FuJJ3/1mCepqNyb+7PJd3sQsE TR6UtcF4EeHiYCqn25qKjDqQtM970gbc8JK0cMYg= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 36RBT1u0020211 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 27 Jul 2023 06:29:01 -0500 Received: from DFLE100.ent.ti.com (10.64.6.21) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 27 Jul 2023 06:29:01 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE100.ent.ti.com (10.64.6.21) 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; Thu, 27 Jul 2023 06:29:01 -0500 Received: from lelv0854.itg.ti.com (lelv0854.itg.ti.com [10.181.64.140]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 36RBT1qn014787; Thu, 27 Jul 2023 06:29:01 -0500 Received: from localhost (uda0501179.dhcp.ti.com [172.24.227.217]) by lelv0854.itg.ti.com (8.14.7/8.14.7) with ESMTP id 36RBT09M001377; Thu, 27 Jul 2023 06:29:00 -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 v12 04/10] net: ti: icssg-prueth: Add icssg queues APIs and macros Date: Thu, 27 Jul 2023 16:58:21 +0530 Message-ID: <20230727112827.3977534-5-danishanwar@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727112827.3977534-1-danishanwar@ti.com> References: <20230727112827.3977534-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, 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 Add icssg_queue.c file. This file introduces macros and APIs related to ICSSG queues. These will be used by ICSSG Ethernet driver. Reviewed-by: Andrew Lunn Signed-off-by: MD Danish Anwar --- drivers/net/ethernet/ti/icssg/icssg_queues.c | 38 ++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 drivers/net/ethernet/ti/icssg/icssg_queues.c diff --git a/drivers/net/ethernet/ti/icssg/icssg_queues.c b/drivers/net/ethernet/ti/icssg/icssg_queues.c new file mode 100644 index 000000000000..2e3f7db43db7 --- /dev/null +++ b/drivers/net/ethernet/ti/icssg/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 __maybe_unused 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 __maybe_unused 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