From patchwork Sat May 18 12:42:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddharth Vadapalli X-Patchwork-Id: 13667636 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 E2BA2C25B74 for ; Sat, 18 May 2024 12:43:11 +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=CxLXO2Ocv36NaqD5Fj+9d1F4NGJjU3HshfX7TiC/BVA=; b=QpMdesQYOkCE5V EXFN5ne9uY/hLaE+4PK+V3wMC0uEQNI8RTGDHu06d0+lPX/guLPvJ766qvghPSw4P2+oMJTw2DfpK pr0YJJ3CwqE3HbyRU3c+wZsZpyj2qYv0WA/XnnWG1vmS0O4STlyV6U1g1plzcU0Q8fVEa5s3n3v/y 5WFiJyKsw1A0CJG9RTw9+4bUdmfdDTnAGRcyUhJTC2DmfWYWi6Z4KSC4W363dlbSV6BtgvxXCcUTo yTcAbf9ICqBGbjnAfj+PW/NuYiADtHMJtEkbtluZ1CFJKT80/UsgDFexys9oLbTLHSpDJmX9mjAza W8jq01d3NVJMfapuqK6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8JOu-0000000A4oa-055n; Sat, 18 May 2024 12:43:00 +0000 Received: from lelv0142.ext.ti.com ([198.47.23.249]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s8JOs-0000000A4o4-0BJv for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2024 12:42:59 +0000 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 44ICgr45017243; Sat, 18 May 2024 07:42:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1716036173; bh=4YVnM9yhpbr1F1sysYDYzoQYJXO4G2Ig3wn60U5nDX0=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=NVN7ZSZy1L/XG9ILEj3nf/hfI74IbVwXDPwM9ik5J8/gNopf1fGo4RRf0w3Gq+k0B Gk3Olp3Mc6E8gBtHkwb4z328znEIERSWLHnp5SCdRBMvf14+ftSOUO1ukcblivK3Oj hDFOowVdsvv2RU+yBnMsBlOm/1PPr9t3pwHok9w0= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 44ICgrow003903 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Sat, 18 May 2024 07:42:53 -0500 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Sat, 18 May 2024 07:42:53 -0500 Received: from lelvsmtp6.itg.ti.com (10.180.75.249) by DFLE101.ent.ti.com (10.64.6.22) 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; Sat, 18 May 2024 07:42:53 -0500 Received: from uda0492258.dhcp.ti.com (uda0492258.dhcp.ti.com [172.24.227.9]) by lelvsmtp6.itg.ti.com (8.15.2/8.15.2) with ESMTP id 44ICgY9J041511; Sat, 18 May 2024 07:42:49 -0500 From: Siddharth Vadapalli To: , , , , , , , CC: , , , , , , , Subject: [RFC PATCH net-next 03/28] net: ethernet: ti: introduce the CPSW Proxy Client Date: Sat, 18 May 2024 18:12:09 +0530 Message-ID: <20240518124234.2671651-4-s-vadapalli@ti.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240518124234.2671651-1-s-vadapalli@ti.com> References: <20240518124234.2671651-1-s-vadapalli@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240518_054258_196120_04790CBD X-CRM114-Status: GOOD ( 19.91 ) 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 The CPSW Proxy Client driver in Linux communicates with Ethernet Switch Firmware (EthFw) running on a remote core via RPMsg. EthFw announces its RPMsg Endpoint over the RPMsg-Bus notifying its presence to all Clients. Register the CPSW Proxy Client driver with the RPMsg framework. Signed-off-by: Siddharth Vadapalli --- drivers/net/ethernet/ti/Kconfig | 14 +++++ drivers/net/ethernet/ti/Makefile | 3 + drivers/net/ethernet/ti/cpsw-proxy-client.c | 70 +++++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 drivers/net/ethernet/ti/cpsw-proxy-client.c diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig index 1729eb0e0b41..ffbfd625625d 100644 --- a/drivers/net/ethernet/ti/Kconfig +++ b/drivers/net/ethernet/ti/Kconfig @@ -79,6 +79,20 @@ config TI_CPSW_SWITCHDEV To compile this driver as a module, choose M here: the module will be called cpsw_new. +config TI_CPSW_PROXY_CLIENT + tristate "TI CPSW Proxy Client" + depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER + help + This driver supports Ethernet functionality for CPSWnG + Ethernet Subsystem which is configured by Ethernet Switch + Firmware (EthFw). + + The Ethernet Switch Firmware acts as a proxy to the Linux + Client driver by performing all the necessary configuration + of the CPSW Peripheral while enabling network data transfer + to/from the Linux Client to CPSW over the allocated TX DMA + Channels and RX DMA Flows. + config TI_CPTS tristate "TI Common Platform Time Sync (CPTS) Support" depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || COMPILE_TEST diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile index 6e086b4c0384..229b828f099e 100644 --- a/drivers/net/ethernet/ti/Makefile +++ b/drivers/net/ethernet/ti/Makefile @@ -7,6 +7,9 @@ obj-$(CONFIG_TI_CPSW) += cpsw-common.o obj-$(CONFIG_TI_DAVINCI_EMAC) += cpsw-common.o obj-$(CONFIG_TI_CPSW_SWITCHDEV) += cpsw-common.o +obj-$(CONFIG_TI_CPSW_PROXY_CLIENT) += ti-cpsw-proxy-client.o +ti-cpsw-proxy-client-y := cpsw-proxy-client.o + obj-$(CONFIG_TLAN) += tlan.o obj-$(CONFIG_TI_DAVINCI_EMAC) += ti_davinci_emac.o ti_davinci_emac-y := davinci_emac.o davinci_cpdma.o diff --git a/drivers/net/ethernet/ti/cpsw-proxy-client.c b/drivers/net/ethernet/ti/cpsw-proxy-client.c new file mode 100644 index 000000000000..91d3338b3788 --- /dev/null +++ b/drivers/net/ethernet/ti/cpsw-proxy-client.c @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0-only or MIT +/* Texas Instruments CPSW Proxy Client Driver + * + * Copyright (C) 2024 Texas Instruments Incorporated - https://www.ti.com/ + * + */ + +#include +#include +#include + +#include "ethfw_abi.h" + +struct cpsw_proxy_priv { + struct rpmsg_device *rpdev; + struct device *dev; +}; + +static int cpsw_proxy_client_cb(struct rpmsg_device *rpdev, void *data, + int len, void *priv, u32 src) +{ + struct device *dev = &rpdev->dev; + + dev_dbg(dev, "callback invoked\n"); + + return 0; +} + +static int cpsw_proxy_client_probe(struct rpmsg_device *rpdev) +{ + struct cpsw_proxy_priv *proxy_priv; + + proxy_priv = devm_kzalloc(&rpdev->dev, sizeof(struct cpsw_proxy_priv), GFP_KERNEL); + if (!proxy_priv) + return -ENOMEM; + + proxy_priv->rpdev = rpdev; + proxy_priv->dev = &rpdev->dev; + dev_dbg(proxy_priv->dev, "driver probed\n"); + + return 0; +} + +static void cpsw_proxy_client_remove(struct rpmsg_device *rpdev) +{ + struct device *dev = &rpdev->dev; + + dev_dbg(dev, "driver removed\n"); +} + +static struct rpmsg_device_id cpsw_proxy_client_id_table[] = { + { + .name = ETHFW_SERVICE_EP_NAME, + }, + {}, +}; +MODULE_DEVICE_TABLE(rpmsg, cpsw_proxy_client_id_table); + +static struct rpmsg_driver cpsw_proxy_client_driver = { + .drv.name = KBUILD_MODNAME, + .id_table = cpsw_proxy_client_id_table, + .probe = cpsw_proxy_client_probe, + .callback = cpsw_proxy_client_cb, + .remove = cpsw_proxy_client_remove, +}; +module_rpmsg_driver(cpsw_proxy_client_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("CPSW Proxy Client Driver"); +MODULE_AUTHOR("Siddharth Vadapalli ");