From patchwork Thu Mar 10 14:51:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ioana Ciornei X-Patchwork-Id: 12776507 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 136F0C433EF for ; Thu, 10 Mar 2022 14:52:36 +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=RH5zG0qMNX52SbEiUoD7ufzSmDcIOpD8feeYJGU1w0E=; b=W/n5uNMHfyqxpD q3L6oy6gF+pyhNt192JaQTwVxWsForqXD5tWnMhvvj/tbPeHcW8TWJzyaGe2azZWqklToSzHqcIn/ VF+yBL6osvTOpw+hjwO2pGjwJY4gxZ7ulESht8Z3HbubemGwoeu2OprtDSI7VIIfoS1+Vdn+6lLTM K2W7bykzQQ7WCuUemO+k7wckmGwIHvJ2j7ZGiamdjbXcKb7waxsIezGjVwgYpShnEp+lA35Ikhn2z u9WXB/5z5rRZcg86Yi0DvbbGkHPJbESqewRrevG3mppIbaWHvvDI+pqatmOaYgSc+XM8e4SaYdvpo PyclJEaBgmj/bhmsDCTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSK9b-00DDt1-FI; Thu, 10 Mar 2022 14:52:35 +0000 Received: from mail-db8eur05on20629.outbound.protection.outlook.com ([2a01:111:f400:7e1a::629] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSK9Y-00DDoR-BE for linux-phy@lists.infradead.org; Thu, 10 Mar 2022 14:52:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KiBkXeINnxGkWlz2bN046TbwafMKit55BBrWP9n39wpgym3ErztldH0oWOcgnHZz7ruaK4ANPMjwmsamhiCahdFS1vfrICXx9mC0GxRakotemAjqXBVhgA9ik2p8ATGaXvoCIJ6CyVsFu87sDc+JOAgtmr+Gsru7+Isqlu2iKQriMXvA5zIzK0P+cTapeLWIhEFBaqcFtXC0k1P3iaKRcqtuPauAjz7VhoVsF2JnhwVxzuiNaa9j7pUmPWGaiy+kjVbIxe4xdfBb+bkEEbLBP/TLf3vbI3S/ZHQgmYTJwZParOd5+yPSRDl0NUOANuLYJer95O5JpaRwdcLH/FvOyw== 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=Pv3gocVvvixSMvX0GbbeV+Q3zExO4FJ3EbUOi3Qh7MQ=; b=IsUR1IGkdErcsWlksSEV5ABRpiRU5YtVtJEPVZOtDeeI/9Xq9fmM0ki5SkOsxHytGMOOqNJrNa61rNvwxE0boZlLFoD9eVS8UQtEvHbQS3M8sBIZEHl8oplsL/EIdB41Ixkjoq1EivbCeTVey6Nic+b7bfM1iex8FewaMWMaT2BjRvQT5ezTi4GJjtM2lE9UBbSv/btNU5GpCiav3ldxLBcsnFG8kgZO+Hr7Ggp7xiWVay6RFnEaMwZHj/CKJL4CT7aIuRpC+KFVD8D6vf+hNw2KY4cweQ/0k4PzkDu/9MPrptrgXSfBxYQFy2AXhOEB38JO3FCHZtFE/Z2sQEdC+Q== 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=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pv3gocVvvixSMvX0GbbeV+Q3zExO4FJ3EbUOi3Qh7MQ=; b=RLWvBCudY7WHxsCcB5HaImvjdn46KbAx+mgC4rE5f2Y68M53vqnk+gmLehGuWwaGTu29eupcpsrhisTBTKCINsd4uq900/URl57x+s5iuQuejKjoPjDDLx7biNmnQxieRAVtxy+orpJp/uD+lpadT1u6lZCNySJTb+2ApTG2wBo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) by AM8PR04MB7281.eurprd04.prod.outlook.com (2603:10a6:20b:1d4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.29; Thu, 10 Mar 2022 14:52:25 +0000 Received: from AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579]) by AM9PR04MB8555.eurprd04.prod.outlook.com ([fe80::c58c:4cac:5bf9:5579%7]) with mapi id 15.20.5038.027; Thu, 10 Mar 2022 14:52:25 +0000 From: Ioana Ciornei To: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org Cc: kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, leoyang.li@nxp.com, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux@armlinux.org.uk, shawnguo@kernel.org, hongxing.zhu@nxp.com, Ioana Ciornei Subject: [PATCH net-next v3 3/8] dpaa2-mac: add the MC API for retrieving the version Date: Thu, 10 Mar 2022 16:51:55 +0200 Message-Id: <20220310145200.3645763-4-ioana.ciornei@nxp.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220310145200.3645763-1-ioana.ciornei@nxp.com> References: <20220310145200.3645763-1-ioana.ciornei@nxp.com> X-ClientProxiedBy: AS9PR06CA0288.eurprd06.prod.outlook.com (2603:10a6:20b:45a::19) To AM9PR04MB8555.eurprd04.prod.outlook.com (2603:10a6:20b:436::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8d9c2968-805f-4015-25b4-08da02a596e9 X-MS-TrafficTypeDiagnostic: AM8PR04MB7281:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BmmCDpJxy8WH38OBfDbmgOxLRvzQCN9XvHCV/oVSJSSc2QdPTdtXO2GgY5Dlx2po3gAm1AxfrfQ0s8UOvRJLyNUQnmezFb6jIg04+PfmLIdOjvyWaNpP4y866U/uO1RKZE76zZojiha8tP7wDc3QrSVKqqkTbcLowdEyhJDRu1mUmRIZVIxkhaK4RM37iQORNTGNlk5q+8pE3wZdwKgM4EuIPJjKkBwwD4BT4fHIksZwRksnsj+DnsOUJF6ZdoxF4ZDHt273MbwXWh8yr7K+MB52bDM5hm4j48xXurUZPcg2Rcw86XuJ67skZK1LFJG/xpPtkzWgDugzul+4mAmFAUbLD3N2Kj0XrFCOgli98lNBsjhHIQFQWh+pVuNz09M55j9ZR5fR1/JCMWpkOy8qoiQ3aLVK8ETRLxSwFsO2H9NhvbL+ok3HcDnwwVUULVvG0HYTZm8YaJTEFiwfnA3Ewbn30ANYfr9dlrg+gWh+c4AmG3mI1AzrsUBhCeZn9fmfTJVZd7aVtH3VEnrrXBfKwB1qDrEl4WmpAd3isWgIqIRSYzPDI9Kh/MsqGMQpZ4GkX9mEAShSioevAAwe9E3m1nVOqyAo7r32UtvkrRH5nng49fS4hGzpEMXMmMN8iHrBwTt2brNF7woTdLOYl5of5stF8xoeT00c2HAf1gtCCYR7BWfIHGJt9Wd5Hg/QnCAT+EdGR7wqCi+6zBjsbWM5dQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM9PR04MB8555.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(1076003)(316002)(66556008)(6486002)(52116002)(66476007)(8676002)(5660300002)(6506007)(66946007)(4326008)(2616005)(2906002)(8936002)(86362001)(186003)(44832011)(38350700002)(38100700002)(6666004)(508600001)(36756003)(26005)(83380400001)(7416002)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 1UJafzpLbLhfQBiEsw4YNADFrTc7d3mUMaAlPFGgKqJtAynz7cXmeJHuFjKgtXBHjjCi/OAqnW3VRlFZ91GAwVUjj9d5GUY1tDqokAqxkqwqM32OHHMoNc3uo972lFkuyrfWomp2mvt9xeyUcvHUit11kGP88ko9FpBQEbykqW+8QoiB3GXTrjJUSdw+bkUruzRrrOiIMLFKJRj0ji+XFNzf9X1PhhLHHLXOEbC7j1aC1lY4P07qKr+KNVBH27gsizOvg6hbAfp23HYWe5vMh5m19K3kp0xLqBCE5qM4AslNhpZ1RoiTFHgqeRC7kNTmhR9KbKvMU4qCaYZiBdCe1GWWA/EQ0BQX9qsM+gUaUPA0E3C22q6WYAy8C2L+DAU1tDdPvHXTFqKAe1VErZOFLQMPEMdP43psJbCZUHZwQom1rla6bESNHiDK7M5V2p/O3IfZJiovUvo9KGeJ0tTPY1PnFv5ddOnidIuiY0EdY+u0VGrfJuEaM/uiJC9bqDwd2gRuwZ44mrJRNJgdMA5+t+osd9cyUA9GwbtTX3VVmaEzm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FfPndfI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d9c2968-805f-4015-25b4-08da02a596e9 X-MS-Exchange-CrossTenant-AuthSource: AM9PR04MB8555.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Mar 2022 14:52:25.2630 (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: qMIMPIP7M3EszXb7uOx6TPvaieVMEo8UNA4tERauyvgYSFpd9aGPu40dJKAEAqRKWM8R+QSOJxq6i+bSPx1e/A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7281 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220310_065232_419184_C6EA1060 X-CRM114-Status: GOOD ( 14.16 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The dpmac_get_api_version command will be used in the next patches to determine if the current firmware is capable or not to change the Ethernet protocol running on the MAC. Signed-off-by: Ioana Ciornei --- Changes in v2: - none Changes in v3: - none .../net/ethernet/freescale/dpaa2/dpmac-cmd.h | 7 +++++ drivers/net/ethernet/freescale/dpaa2/dpmac.c | 31 +++++++++++++++++++ drivers/net/ethernet/freescale/dpaa2/dpmac.h | 2 ++ 3 files changed, 40 insertions(+) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h index a24b20f76938..e1e06b21110d 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h @@ -19,6 +19,8 @@ #define DPMAC_CMDID_CLOSE DPMAC_CMD(0x800) #define DPMAC_CMDID_OPEN DPMAC_CMD(0x80c) +#define DPMAC_CMDID_GET_API_VERSION DPMAC_CMD(0xa0c) + #define DPMAC_CMDID_GET_ATTR DPMAC_CMD(0x004) #define DPMAC_CMDID_SET_LINK_STATE DPMAC_CMD_V2(0x0c3) @@ -70,4 +72,9 @@ struct dpmac_rsp_get_counter { __le64 counter; }; +struct dpmac_rsp_get_api_version { + __le16 major; + __le16 minor; +}; + #endif /* _FSL_DPMAC_CMD_H */ diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.c b/drivers/net/ethernet/freescale/dpaa2/dpmac.c index d5997b654562..d348a7567d87 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.c @@ -181,3 +181,34 @@ int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, return 0; } + +/** + * dpmac_get_api_version() - Get Data Path MAC version + * @mc_io: Pointer to MC portal's I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @major_ver: Major version of data path mac API + * @minor_ver: Minor version of data path mac API + * + * Return: '0' on Success; Error code otherwise. + */ +int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, + u16 *major_ver, u16 *minor_ver) +{ + struct dpmac_rsp_get_api_version *rsp_params; + struct fsl_mc_command cmd = { 0 }; + int err; + + cmd.header = mc_encode_cmd_header(DPMAC_CMDID_GET_API_VERSION, + cmd_flags, + 0); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + rsp_params = (struct dpmac_rsp_get_api_version *)cmd.params; + *major_ver = le16_to_cpu(rsp_params->major); + *minor_ver = le16_to_cpu(rsp_params->minor); + + return 0; +} diff --git a/drivers/net/ethernet/freescale/dpaa2/dpmac.h b/drivers/net/ethernet/freescale/dpaa2/dpmac.h index 8f7ceb731282..b580fb4164b5 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpmac.h +++ b/drivers/net/ethernet/freescale/dpaa2/dpmac.h @@ -205,4 +205,6 @@ enum dpmac_counter_id { int dpmac_get_counter(struct fsl_mc_io *mc_io, u32 cmd_flags, u16 token, enum dpmac_counter_id id, u64 *value); +int dpmac_get_api_version(struct fsl_mc_io *mc_io, u32 cmd_flags, + u16 *major_ver, u16 *minor_ver); #endif /* __FSL_DPMAC_H */