From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BBBBD4686A; Mon, 9 Jun 2025 04:55:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24A1A4067B; Mon, 9 Jun 2025 04:55:36 +0200 (CEST) Received: from DUZPR83CU001.outbound.protection.outlook.com (mail-northeuropeazon11012003.outbound.protection.outlook.com [52.101.66.3]) by mails.dpdk.org (Postfix) with ESMTP id CBBBB4066C for <dev@dpdk.org>; Mon, 9 Jun 2025 04:55:19 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kCW3yFDqHfSwxqTVU7DCbSTPQffDigK7fQCaxEbVGDDbinIaB2QP/x4ixdlmipWFfiUiP4VagpOeSJ8i4HG6H2SR6gTXYcNy3IBQwl45BiY2YFEAUqGXrREAz1aQ+o+lKKJMMi17IQNQdR1qaF00CtxTXoHQCGRM5tSj7mWOtUWmKUk43C45g5I9zGuLD5ilGKPIF/mq79cT06BAmvJ0u++tbkls2o9Riou4oCE1vxB99PKA6DizP45zhOrMtmG0qUY4O9Xm2P80DreGX7kMznqKEo5DkiOPZ+G8JstebJZCsDbwmN/ZZVP2zjw3dwf12cwR6j0W4IZkKo1MpXEtkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=uHFH0GrvyUJWy4AGyUbFAmoTDTgzzXw8BdUSz0+Vebw=; b=nFa8MGFn62GGivzrU+avC8UwOmDc/X/gJ+BJwaiuHbeED3e9p6Jq/t/ir5KNgECWI5Fhc9jB0di7KT6fGv1XsUThChz/BJ+vDfTdsqAsoqIsg8vzzhiAx82QyDxJGB/XqQ6GXyAk+Ebtzq6+N8rsEsvctwK+Zxy/A7eGOXWYOwDoX+hnwip15hFq8r7yGK+CP8qJqufJEQa3mBwAiDezGn3mjfG4ujp4SQEEfyIsvlxRbnmLuUscQSnB4Vkke0odqr6E6D3hUKZ+FnossPf2QUbOL1dDbPYmfVbanqbpEnEntTxjMsAnPUgLs9NDtUY7VxbUGX+1NdIGx44Kug8dGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uHFH0GrvyUJWy4AGyUbFAmoTDTgzzXw8BdUSz0+Vebw=; b=SZbX3c6DqFmVyYvNSYrG5W/mUGcXA2W/jMLTQg6pHkoPrlZMWlY8wp5doxWDJIojU8oSbnfcDeWLQVYAN/2fQaUTL9JA6ZlfE+bOH20FnCXLoSyK4gOKgm+Qmp2+sVQ66tF2wAoi8vNn3D4ywim3as/AhRUIXltl2aSCy/+CJNzDnphPEb/T/IA6eUY1BDfvp3cZiMBCHL5cqaZEzU20Z0sjrn9g4F+WPoGzUre7GPckPluTWYreaCJ8lwyh05cfmfNum1WHagy2h2lJOnfafJahxX/ZDPZryxj86R7mb8rdUwYH6EOSidNltwPNe4/F6Vgqy590Hhokbnsvnocauw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) by AS8PR04MB9093.eurprd04.prod.outlook.com (2603:10a6:20b:444::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8813.20; Mon, 9 Jun 2025 02:55:19 +0000 Received: from AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195]) by AS8PR04MB8198.eurprd04.prod.outlook.com ([fe80::2e32:1a4a:7d29:195%4]) with mapi id 15.20.8813.024; Mon, 9 Jun 2025 02:55:19 +0000 From: Gagandeep Singh <g.singh@nxp.com> To: dev@dpdk.org, Hemant Agrawal <hemant.agrawal@nxp.com>, Sachin Saxena <sachin.saxena@nxp.com> Cc: Apeksha Gupta <apeksha.gupta@nxp.com> Subject: [PATCH v3 05/11] net/dpaa2: add dpmac MC header file Date: Mon, 9 Jun 2025 08:24:44 +0530 Message-Id: <20250609025450.3997062-6-g.singh@nxp.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20250609025450.3997062-1-g.singh@nxp.com> References: <20250602104041.3322164-1-g.singh@nxp.com> <20250609025450.3997062-1-g.singh@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SI1PR02CA0015.apcprd02.prod.outlook.com (2603:1096:4:1f7::18) To AS8PR04MB8198.eurprd04.prod.outlook.com (2603:10a6:20b:3b0::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8PR04MB8198:EE_|AS8PR04MB9093:EE_ X-MS-Office365-Filtering-Correlation-Id: 140eefcb-128a-456e-f89c-08dda7011173 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|52116014|366016|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Uz5PP0nOeAv5sYTAFs49mRRrUZxv/60MNgcMLG++NJY86dpzb49+pQiZUz6W?= =?us-ascii?Q?WHd8YLZ8BGwmyjKoaJHfbZw9kOI0tmIjwruQ1XJQrznizB0g0Rxpa8PXQvSL?= =?us-ascii?Q?bZvkpaIZV6oaReDHedyAVPnprrX1dhdAWoN0Gs8/YvSFGUsehtFY9PSBQUH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X+1L78Sxrj9cjgEKRefASuL0E2Tpz7PfutCG63AUQzK+B?= =?us-ascii?Q?sFqqFFNnppbbow6KSYY8iExeumpW0I7COx0TlTkenfsJeyZllMgFZv8Oe1za?= =?us-ascii?Q?p0at1xmhddp0KNKSR2fNCSK6QGrr3GBQmAYihqvBjz9WjCUb0ffTBIXfuui0?= =?us-ascii?Q?v6wg+huPtkWvgrB8ObzqUKx9SPvl6Cs9pEuoAQCa75x/We5vUV7/dGAL/J1W?= =?us-ascii?Q?44nytNTlIK4tmvWQCEBc9usiUqcWO1DFls660MaGtdl70D8ahw5t8hUfxufg?= =?us-ascii?Q?+PWfRf2hGkNwKHpZKFQY/DCgMuOfGU6YtU3wiPl7/bkpLpBT42EWLU3+T50M?= =?us-ascii?Q?wdeaGZs5olv3L4bI1KBJZZ5tIsCvF8ke3xoXpfxpNPi4BhAXSBVGai6YQ0h9?= =?us-ascii?Q?6f0xU/+5OEu3WVAv4iB941sTHIdonUhRlLbUlm8/LWVqqNmXNo8bDuJH4JZa?= =?us-ascii?Q?/+08DN0kGTT0PXc=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AS8PR04MB8198.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(376014)(52116014)(366016)(1800799024)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?F8nkB5CUEiIdBcd0VbnFlhY6EOkp4Vd47GAa4nbvzuCMqB633HjtIeg7FzIm?= =?us-ascii?Q?8qDpyhnybYSXGAHy/b8iS7mJgd/Vh2ic1KlaGtnJor5BSRFOS52RuB111JY2?= =?us-ascii?Q?J24F3OcVloCHYC3UDDV4PFHH8tQX73RQpEWGlIoyWiktDitMS4YXt6uT5mbM?= =?us-ascii?Q?sWJbYh7FgZawhnqiloUfDOTgwPWtffVy9eNA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Wak+4B0fXVv+7q8II4tfjYOgV/GEFo4mWvsI82lffoCpcm3t?= =?us-ascii?Q?fsEycpTAFuDBczYJjzFh4kqelX2YDyLk4E0HjD2u61iqOV0MjPH7WMYD0Fef?= =?us-ascii?Q?YwfNcIZ5DexIF79JUN4RfqO1nZc43h75JGmqwOuHd+eW+Y1O3qcG5pjNM+0V?= =?us-ascii?Q?06RCTNXZM+VgFeHQsbqz4fnmLzKQc4zISOgsLIC7t182Sqxit2o8hRi5NKun?= =?us-ascii?Q?wBgoWYh20yBmzEtyyfp5z3JpMdPWALKGOWdTKrDlHE6ZZ+ZjdJr4F0GjjGbq?= =?us-ascii?Q?gPjJICMQl5Hj3OIvd57gqwjcnNt1kAQcwBu43JKUbAUzT6LG23VMgzai/5iZ?= =?us-ascii?Q?wY8PmapFJxdKfsnzpb8NaR7q1bCJSZzlm6UeGPpuq9dPzo6A1SelV5DyzWOI?= =?us-ascii?Q?04HoDnLPeJRUv7Pcc8L9+QDmLeVFKw2U9za8C3xsFDbEyZZek2STJLvpadik?= =?us-ascii?Q?Qi0oYwKM8ekCf064Hkc=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 140eefcb-128a-456e-f89c-08dda7011173 X-MS-Exchange-CrossTenant-AuthSource: AS8PR04MB8198.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2025 02:55:18.9623 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M3O8X3RhfQ7TxgI+A3jkkmvKjWoroynIpF2trMr496dUzk2aOWvfDVMk6sw2L6F6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9093 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org From: Apeksha Gupta <apeksha.gupta@nxp.com> This patch upgrades the MC firmware release API compatibility to 10.39.0. Added mc/fsl_dpmac.h file. Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com> --- drivers/net/dpaa2/mc/fsl_dpmac.h | 465 +++++++++++++++++++++++++++++++ 1 file changed, 465 insertions(+) create mode 100644 drivers/net/dpaa2/mc/fsl_dpmac.h diff --git a/drivers/net/dpaa2/mc/fsl_dpmac.h b/drivers/net/dpaa2/mc/fsl_dpmac.h new file mode 100644 index 0000000000..41eca47cfa --- /dev/null +++ b/drivers/net/dpaa2/mc/fsl_dpmac.h @@ -0,0 +1,465 @@ +/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0) + * + * Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright 2018-2025 NXP + * + */ + +#ifndef __FSL_DPMAC_H +#define __FSL_DPMAC_H + +/** @addtogroup dpmac Data Path MAC API + * Contains initialization APIs and runtime control APIs for DPMAC + * @{ + */ + +struct fsl_mc_io; + +int dpmac_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpmac_id, + uint16_t *token); + +int dpmac_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * enum dpmac_link_type - DPMAC link type + * @DPMAC_LINK_TYPE_NONE: No link + * @DPMAC_LINK_TYPE_FIXED: Link is fixed type + * @DPMAC_LINK_TYPE_PHY: Link by PHY ID + * @DPMAC_LINK_TYPE_BACKPLANE: Backplane link type + */ +enum dpmac_link_type { + DPMAC_LINK_TYPE_NONE, + DPMAC_LINK_TYPE_FIXED, + DPMAC_LINK_TYPE_PHY, + DPMAC_LINK_TYPE_BACKPLANE +}; + +/** + * enum dpmac_eth_if - DPMAC Ethrnet interface + * @DPMAC_ETH_IF_MII: MII interface + * @DPMAC_ETH_IF_RMII: RMII interface + * @DPMAC_ETH_IF_SMII: SMII interface + * @DPMAC_ETH_IF_GMII: GMII interface + * @DPMAC_ETH_IF_RGMII: RGMII interface + * @DPMAC_ETH_IF_SGMII: SGMII interface + * @DPMAC_ETH_IF_QSGMII: QSGMII interface + * @DPMAC_ETH_IF_XAUI: XAUI interface + * @DPMAC_ETH_IF_XFI: XFI interface + * @DPMAC_ETH_IF_CAUI: CAUI interface + * @DPMAC_ETH_IF_1000BASEX: 1000BASEX interface + * @DPMAC_ETH_IF_USXGMII: USXGMII interface + */ +enum dpmac_eth_if { + DPMAC_ETH_IF_MII, + DPMAC_ETH_IF_RMII, + DPMAC_ETH_IF_SMII, + DPMAC_ETH_IF_GMII, + DPMAC_ETH_IF_RGMII, + DPMAC_ETH_IF_SGMII, + DPMAC_ETH_IF_QSGMII, + DPMAC_ETH_IF_XAUI, + DPMAC_ETH_IF_XFI, + DPMAC_ETH_IF_CAUI, + DPMAC_ETH_IF_1000BASEX, + DPMAC_ETH_IF_USXGMII, +}; +/* + * @DPMAC_FEC_NONE: RS-FEC (enabled by default) is disabled + * @DPMAC_FEC_RS: RS-FEC (Clause 91) mode configured + * @DPMAC_FEC_FC: FC-FEC (Clause 74) mode configured (not yet supported) + */ +enum dpmac_fec_mode { + DPMAC_FEC_NONE, + DPMAC_FEC_RS, + DPMAC_FEC_FC, +}; + +/* serdes sfi/custom settings feature internals + * @SERDES_CFG_DEFAULT: the default configuration. + * @SERDES_CFG_SFI: default operating mode for XFI interfaces + * @SERDES_CFG_CUSTOM: It allows the user to manually configure the type of equalization, + * amplitude, preq and post1q settings. Can be used with all interfaces except RGMII. + */ +enum serdes_eq_cfg_mode { + SERDES_CFG_DEFAULT = 0, + SERDES_CFG_SFI, + SERDES_CFG_CUSTOM, +}; + +/** + * struct dpmac_cfg - Structure representing DPMAC configuration + * @mac_id: Represents the Hardware MAC ID; in case of multiple WRIOP, + * the MAC IDs are continuous. + * For example: 2 WRIOPs, 16 MACs in each: + * MAC IDs for the 1st WRIOP: 1-16, + * MAC IDs for the 2nd WRIOP: 17-32. + */ +struct dpmac_cfg { + uint16_t mac_id; +}; + +int dpmac_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpmac_cfg *cfg, + uint32_t *obj_id); + +int dpmac_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id); + +/** + * DPMAC IRQ Index and Events + */ + +/** + * IRQ index + */ +#define DPMAC_IRQ_INDEX 0 +/** + * IRQ event - indicates a change in link state + */ +#define DPMAC_IRQ_EVENT_LINK_CFG_REQ 0x00000001 +/** + * IRQ event - Indicates that the link state changed + */ +#define DPMAC_IRQ_EVENT_LINK_CHANGED 0x00000002 +/** + * IRQ event - The object requests link up + */ +#define DPMAC_IRQ_EVENT_LINK_UP_REQ 0x00000004 +/** + * IRQ event - The object requests link down + */ +#define DPMAC_IRQ_EVENT_LINK_DOWN_REQ 0x00000008 +/** + * IRQ event - indicates a change in endpoint + */ +#define DPMAC_IRQ_EVENT_ENDPOINT_CHANGED 0x00000010 + +int dpmac_set_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint8_t en); + +int dpmac_get_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint8_t *en); + +int dpmac_set_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t mask); + +int dpmac_get_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t *mask); + +int dpmac_get_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t *status); + +int dpmac_clear_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t status); + +/** + * @brief Inter-Frame Gap mode + * + * LAN/WAN uses different Inter-Frame Gap mode + */ +enum dpmac_ifg_mode { + DPMAC_IFG_MODE_FIXED, + /*!< IFG length represents number of octets in steps of 4 */ + DPMAC_IFG_MODE_STRETCHED + /*!< IFG length represents the stretch factor */ +}; + +/** + * @brief Structure representing Inter-Frame Gap mode configuration + */ +struct dpmac_ifg_cfg { + enum dpmac_ifg_mode ipg_mode; /*!< WAN/LAN mode */ + uint8_t ipg_length; /*!< IPG Length, default value is 0xC */ +}; + +/** + * @brief Structure used to read through MDIO + */ +struct dpmac_mdio_read { + uint8_t cl45; /*!< Clause 45 */ + uint8_t phy_addr; /*!< MDIO PHY address */ + uint16_t reg; /*!< PHY register */ +}; + +/** + * @brief Structure used to write through MDIO + */ +struct dpmac_mdio_write { + uint8_t cl45; /*!< Clause 45 */ + uint8_t phy_addr; /*!< MDIO PHY address */ + uint16_t reg; /*!< PHY register */ + uint16_t data; /*!< Data to be written */ +}; + +#define DPMAC_SET_PARAMS_IFG 0x1 + +/** + * struct serdes_eq_settings - Structure SerDes equalization settings + * cfg: serdes sfi/custom/default settings feature internals + * @eq_type: Number of levels of TX equalization + * @sgn_preq: Precursor sign indicating direction of eye closure + * @eq_preq: Drive strength of TX full swing transition bit to precursor + * @sgn_post1q: First post-cursor sign indicating direction of eye closure + * @eq_post1q: Drive strength of full swing transition bit to first post-cursor + * @eq_amp_red: Overall transmit amplitude reduction + */ +struct serdes_eq_settings { + enum serdes_eq_cfg_mode cfg; + int eq_type; + int sgn_preq; + int eq_preq; + int sgn_post1q; + int eq_post1q; + int eq_amp_red; +}; + +/** + * struct dpmac_attr - Structure representing DPMAC attributes + * @id: DPMAC object ID + * @max_rate: Maximum supported rate - in Mbps + * @eth_if: Ethernet interface + * @link_type: link type + * @fec_mode: FEC mode - Configurable only for 25G interfaces + * serdes_cfg: SerDes equalization settings + */ +struct dpmac_attr { + uint16_t id; + uint32_t max_rate; + enum dpmac_eth_if eth_if; + enum dpmac_link_type link_type; + enum dpmac_fec_mode fec_mode; + struct serdes_eq_settings serdes_cfg; + struct dpmac_ifg_cfg ifg_cfg; +}; + +int dpmac_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpmac_attr *attr); + +int dpmac_set_params(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint32_t flags, + struct dpmac_ifg_cfg ifg_cfg); + +int dpmac_get_mac_addr(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t mac_addr[6]); + +/** + * DPMAC link configuration/state options + */ + +/** + * Enable auto-negotiation + */ +#define DPMAC_LINK_OPT_AUTONEG 0x0000000000000001ULL +/** + * Enable half-duplex mode + */ +#define DPMAC_LINK_OPT_HALF_DUPLEX 0x0000000000000002ULL +/** + * Enable pause frames + */ +#define DPMAC_LINK_OPT_PAUSE 0x0000000000000004ULL +/** + * Enable a-symmetric pause frames + */ +#define DPMAC_LINK_OPT_ASYM_PAUSE 0x0000000000000008ULL +/** + * Advertise 10MB full duplex + */ +#define DPMAC_ADVERTISED_10BASET_FULL 0x0000000000000001ULL +/** + * Advertise 100MB full duplex + */ +#define DPMAC_ADVERTISED_100BASET_FULL 0x0000000000000002ULL +/** + * Advertise 1GB full duplex + */ +#define DPMAC_ADVERTISED_1000BASET_FULL 0x0000000000000004ULL +/** + * Advertise auto-negotiation enable + */ +#define DPMAC_ADVERTISED_AUTONEG 0x0000000000000008ULL +/** + * Advertise 10GB full duplex + */ +#define DPMAC_ADVERTISED_10000BASET_FULL 0x0000000000000010ULL +/** + * Advertise 2.5GB full duplex + */ +#define DPMAC_ADVERTISED_2500BASEX_FULL 0x0000000000000020ULL +/** + * Advertise 5GB full duplex + */ +#define DPMAC_ADVERTISED_5000BASET_FULL 0x0000000000000040ULL + +/** + * struct dpmac_link_cfg - Structure representing DPMAC link configuration + * @rate: Link's rate - in Mbps + * @options: Enable/Disable DPMAC link cfg features (bitmap) + * @advertising: Speeds that are advertised for autoneg (bitmap) + */ +struct dpmac_link_cfg { + uint32_t rate; + uint64_t options; + uint64_t advertising; +}; + +int dpmac_get_link_cfg(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpmac_link_cfg *cfg); + +/** + * struct dpmac_link_state - DPMAC link configuration request + * @rate: Rate in Mbps + * @options: Enable/Disable DPMAC link cfg features (bitmap) + * @up: Link state + * @state_valid: Ignore/Update the state of the link + * @supported: Speeds capability of the phy (bitmap) + * @advertising: Speeds that are advertised for autoneg (bitmap) + */ +struct dpmac_link_state { + uint32_t rate; + uint64_t options; + int up; + int state_valid; + uint64_t supported; + uint64_t advertising; +}; + +int dpmac_set_link_state(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpmac_link_state *link_state); + +/** + * enum dpmac_counter - DPMAC counter types + * @DPMAC_CNT_ING_FRAME_64: counts 64-bytes frames, good or bad. + * @DPMAC_CNT_ING_FRAME_127: counts 65- to 127-bytes frames, good or bad. + * @DPMAC_CNT_ING_FRAME_255: counts 128- to 255-bytes frames, good or bad. + * @DPMAC_CNT_ING_FRAME_511: counts 256- to 511-bytes frames, good or bad. + * @DPMAC_CNT_ING_FRAME_1023: counts 512- to 1023-bytes frames, good or bad. + * @DPMAC_CNT_ING_FRAME_1518: counts 1024- to 1518-bytes frames, good or bad. + * @DPMAC_CNT_ING_FRAME_1519_MAX: counts 1519-bytes frames and larger + * (up to max frame length specified), + * good or bad. + * @DPMAC_CNT_ING_FRAG: counts frames which are shorter than 64 bytes received + * with a wrong CRC + * @DPMAC_CNT_ING_JABBER: counts frames longer than the maximum frame length + * specified, with a bad frame check sequence. + * @DPMAC_CNT_ING_FRAME_DISCARD: counts dropped frames due to internal errors. + * Occurs when a receive FIFO overflows. + * Includes also frames truncated as a result of + * the receive FIFO overflow. + * @DPMAC_CNT_ING_ALIGN_ERR: counts frames with an alignment error + * (optional used for wrong SFD). + * @DPMAC_CNT_EGR_UNDERSIZED: counts frames transmitted that was less than 64 + * bytes long with a good CRC. + * @DPMAC_CNT_ING_OVERSIZED: counts frames longer than the maximum frame length + * specified, with a good frame check sequence. + * @DPMAC_CNT_ING_VALID_PAUSE_FRAME: counts valid pause frames (regular and PFC) + * @DPMAC_CNT_EGR_VALID_PAUSE_FRAME: counts valid pause frames transmitted + * (regular and PFC). + * @DPMAC_CNT_ING_BYTE: counts bytes received except preamble for all valid + * frames and valid pause frames. + * @DPMAC_CNT_ING_MCAST_FRAME: counts received multicast frames. + * @DPMAC_CNT_ING_BCAST_FRAME: counts received broadcast frames. + * @DPMAC_CNT_ING_ALL_FRAME: counts each good or bad frames received. + * @DPMAC_CNT_ING_UCAST_FRAME: counts received unicast frames. + * @DPMAC_CNT_ING_ERR_FRAME: counts frames received with an error + * (except for undersized/fragment frame). + * @DPMAC_CNT_EGR_BYTE: counts bytes transmitted except preamble for all valid + * frames and valid pause frames transmitted. + * @DPMAC_CNT_EGR_MCAST_FRAME: counts transmitted multicast frames. + * @DPMAC_CNT_EGR_BCAST_FRAME: counts transmitted broadcast frames. + * @DPMAC_CNT_EGR_UCAST_FRAME: counts transmitted unicast frames. + * @DPMAC_CNT_EGR_ERR_FRAME: counts frames transmitted with an error. + * @DPMAC_CNT_ING_GOOD_FRAME: counts frames received without error, including + * pause frames. + * @DPMAC_CNT_EGR_GOOD_FRAME: counts frames transmitted without error, including + * pause frames. + */ +enum dpmac_counter { + DPMAC_CNT_ING_FRAME_64, + DPMAC_CNT_ING_FRAME_127, + DPMAC_CNT_ING_FRAME_255, + DPMAC_CNT_ING_FRAME_511, + DPMAC_CNT_ING_FRAME_1023, + DPMAC_CNT_ING_FRAME_1518, + DPMAC_CNT_ING_FRAME_1519_MAX, + DPMAC_CNT_ING_FRAG, + DPMAC_CNT_ING_JABBER, + DPMAC_CNT_ING_FRAME_DISCARD, + DPMAC_CNT_ING_ALIGN_ERR, + DPMAC_CNT_EGR_UNDERSIZED, + DPMAC_CNT_ING_OVERSIZED, + DPMAC_CNT_ING_VALID_PAUSE_FRAME, + DPMAC_CNT_EGR_VALID_PAUSE_FRAME, + DPMAC_CNT_ING_BYTE, + DPMAC_CNT_ING_MCAST_FRAME, + DPMAC_CNT_ING_BCAST_FRAME, + DPMAC_CNT_ING_ALL_FRAME, + DPMAC_CNT_ING_UCAST_FRAME, + DPMAC_CNT_ING_ERR_FRAME, + DPMAC_CNT_EGR_BYTE, + DPMAC_CNT_EGR_MCAST_FRAME, + DPMAC_CNT_EGR_BCAST_FRAME, + DPMAC_CNT_EGR_UCAST_FRAME, + DPMAC_CNT_EGR_ERR_FRAME, + DPMAC_CNT_ING_GOOD_FRAME, + DPMAC_CNT_EGR_GOOD_FRAME +}; + +int dpmac_get_counter(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + enum dpmac_counter type, + uint64_t *counter); + +int dpmac_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver); + +int dpmac_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +int dpmac_set_protocol(struct fsl_mc_io *mc_io, uint32_t cmd_flags, + uint16_t token, enum dpmac_eth_if protocol); + +int dpmac_get_statistics(struct fsl_mc_io *mc_io, uint32_t cmd_flags, uint16_t token, + uint64_t iova_cnt, uint64_t iova_values, uint32_t num_cnt); + +#endif /* __FSL_DPMAC_H */ -- 2.25.1