From patchwork Wed Feb 21 15:24:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Diogo Ivo X-Patchwork-Id: 13565710 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39A30C48BC3 for ; Wed, 21 Feb 2024 15:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=00tEEJfRn0NLs2vmXI0gWJk9W8OM/Euy0S5O156G/DA=; b=NHNyer843w+PRi LfZ/MFADQyb4xeSOoNtZPnXv6Ce/hwErhRRNg5ka2xAD4zHxUA62zANPYBjp/yyq/xbt5a+2WAD0F 8+aFFJeOa7qR2cnx2A2WpmUk67tVOdzmiMDw2KSsiGkzgJsAb2BYCnzq17JjLmcANOgwEKme5pZqd JULv569N1xawDjOr1fpQw0DT1JmCk1Dzc8zOjoePnBI0ATXLAIaqCqpZFsBXhAc2Jp8aQoRYy5X2n Inx0B3RMvAbFNTiXv0wbPeJqyOtb1Sr7QvwEdFZ8QVFfi49tutHLyyOalyfBwI75zpn873CQKTr1k qKIFpbPJ4haUO0wYTkyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcoT1-00000001Sks-18qo; Wed, 21 Feb 2024 15:25:03 +0000 Received: from mta-64-227.siemens.flowmailer.net ([185.136.64.227]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rcoSa-00000001SSK-3WKJ for linux-arm-kernel@lists.infradead.org; Wed, 21 Feb 2024 15:24:40 +0000 Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20240221152430a00e96f64e21843a14 for ; Wed, 21 Feb 2024 16:24:30 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm1; d=siemens.com; i=diogo.ivo@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=AZGTLJwLrUkfkXIIlmR2mejSx+suHq4AzNo6yzzzTMA=; b=nR5C/f+Vw/LOJGQ4JR6C62vEO/HFuZ5wAdORv9NG2VcZ+stV2wur+oFdoE66Y1HFldSSLx i6attMUul7EFW1tJfdukyeDY41IZ9QlEoDUTyDVuRW5uWy0bxHa30Wp1mGDzSTp4uTxUeVz/ Lf9bSq3/KTS+tFGqh9iC/RNTpBahM=; From: Diogo Ivo To: danishanwar@ti.com, rogerq@kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, andrew@lunn.ch, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Cc: Diogo Ivo , jan.kiszka@siemens.com Subject: [PATCH net-next v3 04/10] net: ti: icssg-prueth: Add SR1.0-specific configuration bits Date: Wed, 21 Feb 2024 15:24:10 +0000 Message-ID: <20240221152421.112324-5-diogo.ivo@siemens.com> In-Reply-To: <20240221152421.112324-1-diogo.ivo@siemens.com> References: <20240221152421.112324-1-diogo.ivo@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1320519:519-21489:flowmailer X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240221_072437_533298_163EC963 X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Define the firmware configuration structure and commands needed to communicate with SR1.0 firmware, as well as SR1.0 buffer information where it differs from SR2.0. Based on the work of Roger Quadros, Murali Karicheri and Grygorii Strashko in TI's 5.10 SDK [1]. [1]: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/?h=ti-linux-5.10.y Co-developed-by: Jan Kiszka Signed-off-by: Jan Kiszka Signed-off-by: Diogo Ivo --- Changes in v2: - Removed explicit references to SR2.0 drivers/net/ethernet/ti/icssg/icssg_config.h | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/net/ethernet/ti/icssg/icssg_config.h b/drivers/net/ethernet/ti/icssg/icssg_config.h index 43eb0922172a..cb465b3f5355 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_config.h +++ b/drivers/net/ethernet/ti/icssg/icssg_config.h @@ -35,6 +35,23 @@ struct icssg_flow_cfg { (2 * (PRUETH_EMAC_BUF_POOL_SIZE * PRUETH_NUM_BUF_POOLS + \ PRUETH_EMAC_RX_CTX_BUF_SIZE * 2)) +/* SR1.0 defines */ +#define PRUETH_MAX_RX_FLOWS_SR1 4 /* excluding default flow */ +#define PRUETH_RX_FLOW_DATA_SR1 3 /* highest priority flow */ +#define PRUETH_MAX_RX_MGM_DESC 8 +#define PRUETH_MAX_RX_MGM_FLOWS 2 /* excluding default flow */ +#define PRUETH_RX_MGM_FLOW_RESPONSE 0 +#define PRUETH_RX_MGM_FLOW_TIMESTAMP 1 + +#define PRUETH_NUM_BUF_POOLS_SR1 16 +#define PRUETH_EMAC_BUF_POOL_START_SR1 8 +#define PRUETH_EMAC_BUF_POOL_MIN_SIZE_SR1 128 +#define PRUETH_EMAC_BUF_SIZE_SR1 1536 +#define PRUETH_EMAC_NUM_BUF_SR1 4 +#define PRUETH_EMAC_BUF_POOL_SIZE_SR1 (PRUETH_EMAC_NUM_BUF_SR1 * \ + PRUETH_EMAC_BUF_SIZE_SR1) +#define MSMC_RAM_SIZE_SR1 (SZ_64K + SZ_32K + SZ_2K) /* 0x1880 x 8 x 2 */ + struct icssg_rxq_ctx { __le32 start[3]; __le32 end; @@ -104,6 +121,45 @@ enum icssg_port_state_cmd { #define ICSSG_NUM_NORMAL_PDS 64 #define ICSSG_NUM_SPECIAL_PDS 16 +struct icssg_sr1_config { + __le32 status; /* Firmware status */ + __le32 addr_lo; /* MSMC Buffer pool base address low. */ + __le32 addr_hi; /* MSMC Buffer pool base address high. Must be 0 */ + __le32 tx_buf_sz[16]; /* Array of buffer pool sizes */ + __le32 num_tx_threads; /* Number of active egress threads, 1 to 4 */ + __le32 tx_rate_lim_en; /* Bitmask: Egress rate limit en per thread */ + __le32 rx_flow_id; /* RX flow id for first rx ring */ + __le32 rx_mgr_flow_id; /* RX flow id for the first management ring */ + __le32 flags; /* TBD */ + __le32 n_burst; /* for debug */ + __le32 rtu_status; /* RTU status */ + __le32 info; /* reserved */ + __le32 reserve; + __le32 rand_seed; /* Used for the random number generation at fw */ +} __packed; + +/* SR1.0 shutdown command to stop processing at firmware. + * Command format: 0x8101ss00, where + * - ss: sequence number. Currently not used by driver. + */ +#define ICSSG_SHUTDOWN_CMD 0x81010000 + +/* SR1.0 pstate speed/duplex command to set speed and duplex settings + * in firmware. + * Command format: 0x8102ssPN, where + * - ss: sequence number. Currently not used by driver. + * - P: port number (for switch mode). + * - N: Speed/Duplex state: + * 0x0 - 10Mbps/Half duplex; + * 0x8 - 10Mbps/Full duplex; + * 0x2 - 100Mbps/Half duplex; + * 0xa - 100Mbps/Full duplex; + * 0xc - 1Gbps/Full duplex; + * NOTE: The above are the same value as bits [3..1](slice 0) + * or bits [7..5](slice 1) of RGMII CFG register. + */ +#define ICSSG_PSTATE_SPEED_DUPLEX_CMD 0x81020000 + #define ICSSG_NORMAL_PD_SIZE 8 #define ICSSG_SPECIAL_PD_SIZE 20