Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1491534lqo; Sat, 18 May 2024 05:43:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUP5lqjPQR8VnRV+nuQuUACXZ/nOY0KEpzjo5ATv/UTGYUvnX1yR5STOC1iWPO1bO/tprDW+GlptxCqYlPSsnRJh3ie4ZNbsCBbetKl8w== X-Google-Smtp-Source: AGHT+IFfgBdAy/YpuUgTCOnA1QpDtkGSrXpwz4zhfYBUFGND0rN4xNur64xolsixZ8F5wKL9/jNC X-Received: by 2002:a05:6830:a47:b0:6f0:5ea6:975 with SMTP id 46e09a7af769-6f0e90f46c3mr24452206a34.7.1716036208184; Sat, 18 May 2024 05:43:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716036208; cv=pass; d=google.com; s=arc-20160816; b=IMhNAnAHlRWdGMZ7ubSauOECay3HHQ+IMZmco8hUbRqaHzvJxitpqYNdNpgvwwVe3g VQWJhpvywr0ukySCf4us6y8tdz/mMKLTbdQfPbuhDWI7urQSLePEMIsvS4bPujKGylJt 5sGOlyolcBF5wn7GGEfSP20B1mdZNJe9B7BKiyJdomZl8qd+cfffz/2NmIHStQjbm+25 LeYDRl5/b3Skgk1kZ8fQArsFk0CCA5uEbHctk94YweCxVW9ajibRB36RmyKMU4I3hHuZ euhboQw7NhIaETOVi+mhYwGqv+Uk6L/JvJd0UJAKz7e6KFOOFbLFfT1gq2xfreEYaxKz t/Ew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4YVnM9yhpbr1F1sysYDYzoQYJXO4G2Ig3wn60U5nDX0=; fh=o09Pg6xF7oDS6d546SEMTPTO411plfH6YfIeKl0U52o=; b=w4MAqKPLADY7ND1K3yrbsBejYnfMbvbt/nGuE5T6z5tORlKPs9D3gDRpB2QOxisMsS IHPKM1+X41WJJ6ccHFWf32W2wkDl5q7yhk3jgAgXnDS12Gn7dicoRqC8ErVufbedzp5U zshcswzW6QoMAiNdiSkh4QQjxjbMNRquyMpampuRN1I7LbMKKgJbiMFnF0HwJj9ElP4X Zo+49sYZTPFMU8CWan359YvJ3CJn7AJ4hAxjJtZZIDDRlUfNgvoRg92u2u9KN5tKLCFh CfW7lSdvbqYD2LzyC6+BwsKJxKRcMawCq8qS41vZK9CVgX7zN8DAGbgMhPD/FKGA4HRt c+KA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NVN7ZSZy; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-182848-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182848-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf364f6asi2052749585a.628.2024.05.18.05.43.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 05:43:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182848-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=NVN7ZSZy; arc=pass (i=1 spf=pass spfdomain=ti.com dkim=pass dkdomain=ti.com dmarc=pass fromdomain=ti.com); spf=pass (google.com: domain of linux-kernel+bounces-182848-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182848-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 87FF81C213F9 for ; Sat, 18 May 2024 12:43:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4271E3FB88; Sat, 18 May 2024 12:43:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="NVN7ZSZy" Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A534312E63; Sat, 18 May 2024 12:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.23.249 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716036187; cv=none; b=UX+fGi7MbgH8QKwAirgFRHEXdBIWhokUdiRH8JgwqisxKPWV3UAJ29baaVN32U3Q9eTajhntWM6VL5Gp7jUdzpCuv1J1pVfXEWGE9ElFClaRsWdPjNM3RgruqYjbGuOiZZs4ERNAYY4i9tzbSk8CygsLdICNdP0hRM5UD55gwKI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716036187; c=relaxed/simple; bh=a1RrRoPKgUMeAZVvSxfDJQCbTiG+xNKv0jTAwceXp/s=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=XpL61eGgVsJtq0Yn+eWgdAFVJ3sWJClLQCXCMlEM1XUmAdG6PFZFBb1aYymvxMRPeo5U/c5IvV5dYiz8c+ffN1+dB/VWNb1Gj/xhMHkFPOPzWIWim9RQq5cNI9IDr48+09498NNb8oRQBvUkIrBP6y14p7oWSNuPaL/tmx2RNWw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=NVN7ZSZy; arc=none smtp.client-ip=198.47.23.249 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 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 "); -- 2.40.1