lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1d39a02c-92e6-4ebe-8917-cc7c2ebb70b2@oracle.com>
Date: Fri, 25 Jul 2025 23:25:26 +0530
From: ALOK TIWARI <alok.a.tiwari@...cle.com>
To: Parvathi Pudi <parvathi@...thit.com>, danishanwar@...com,
        rogerq@...nel.org, andrew+netdev@...n.ch, davem@...emloft.net,
        edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
        robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
        ssantosh@...nel.org, richardcochran@...il.com, s.hauer@...gutronix.de,
        m-karicheri2@...com, glaroque@...libre.com, afd@...com,
        saikrishnag@...vell.com, m-malladi@...com, jacob.e.keller@...el.com,
        kory.maincent@...tlin.com, diogo.ivo@...mens.com,
        javier.carrasco.cruz@...il.com, horms@...nel.org, s-anna@...com,
        basharath@...thit.com
Cc: linux-arm-kernel@...ts.infradead.org, netdev@...r.kernel.org,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        vadim.fedorenko@...ux.dev, pratheesh@...com, prajith@...com,
        vigneshr@...com, praneeth@...com, srk@...com, rogerq@...com,
        krishna@...thit.com, pmohan@...thit.com, mohan@...thit.com
Subject: Re: [PATCH net-next v12 2/5] net: ti: prueth: Adds ICSSM Ethernet
 driver



On 7/24/2025 12:53 PM, Parvathi Pudi wrote:
> From: Roger Quadros <rogerq@...com>
> 
> Updates Kernel configuration to enable PRUETH driver and its dependencies
> along with makefile changes to add the new PRUETH driver.
> 
> Changes includes init and deinit of ICSSM PRU Ethernet driver including
> net dev registration and firmware loading for DUAL-MAC mode running on
> PRU-ICSS2 instance.
> 
> Changes also includes link handling, PRU booting, default firmware loading
> and PRU stopping using existing remoteproc driver APIs.
> 
> Signed-off-by: Roger Quadros <rogerq@...com>
> Signed-off-by: Andrew F. Davis <afd@...com>
> Signed-off-by: Basharath Hussain Khaja <basharath@...thit.com>
> Signed-off-by: Parvathi Pudi <parvathi@...thit.com>
> ---
>   drivers/net/ethernet/ti/Kconfig              |  12 +
>   drivers/net/ethernet/ti/Makefile             |   3 +
>   drivers/net/ethernet/ti/icssm/icssm_prueth.c | 610 +++++++++++++++++++
>   drivers/net/ethernet/ti/icssm/icssm_prueth.h | 100 +++
>   4 files changed, 725 insertions(+)
>   create mode 100644 drivers/net/ethernet/ti/icssm/icssm_prueth.c
>   create mode 100644 drivers/net/ethernet/ti/icssm/icssm_prueth.h
> 
> diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
> index a07c910c497a..ab20f22524cb 100644
> --- a/drivers/net/ethernet/ti/Kconfig
> +++ b/drivers/net/ethernet/ti/Kconfig
> @@ -229,4 +229,16 @@ config TI_ICSS_IEP
>   	  To compile this driver as a module, choose M here. The module
>   	  will be called icss_iep.
>   
> +config TI_PRUETH
> +	tristate "TI PRU Ethernet EMAC driver"
> +	depends on PRU_REMOTEPROC
> +	depends on NET_SWITCHDEV
> +	select TI_ICSS_IEP
> +	imply PTP_1588_CLOCK
> +	help
> +	  Some TI SoCs has Programmable Realtime Units (PRUs) cores which can

Some TI SoCs have Programmable Realtime Unit (PRU)

> +	  support Single or Dual Ethernet ports with help of firmware code running

with the help of firmware code running

> +	  on PRU cores. This driver supports remoteproc based communication to
> +	  PRU firmware to expose ethernet interface to Linux.

ethernet -> Ethernet

> +
>   endif # NET_VENDOR_TI
> diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
> index cbcf44806924..93c0a4d0e33a 100644
> --- a/drivers/net/ethernet/ti/Makefile
> +++ b/drivers/net/ethernet/ti/Makefile
> @@ -3,6 +3,9 @@
>   # Makefile for the TI network device drivers.
>   #
>   
> +obj-$(CONFIG_TI_PRUETH) += icssm-prueth.o
> +icssm-prueth-y := icssm/icssm_prueth.o
> +
>   obj-$(CONFIG_TI_CPSW) += cpsw-common.o
>   obj-$(CONFIG_TI_DAVINCI_EMAC) += cpsw-common.o
>   obj-$(CONFIG_TI_CPSW_SWITCHDEV) += cpsw-common.o
> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> new file mode 100644
> index 000000000000..375fd636684d
> --- /dev/null
> +++ b/drivers/net/ethernet/ti/icssm/icssm_prueth.c
> @@ -0,0 +1,610 @@
> +// SPDX-License-Identifier: GPL-2.0
> +
> +/* Texas Instruments ICSSM Ethernet Driver
> + *
> + * Copyright (C) 2018-2022 Texas Instruments Incorporated - https://urldefense.com/v3/__https://www.ti.com/__;!!ACWV5N9M2RV99hQ!KJSw49T9tFMkKlUCkufdpPMrYbxZqO8afwgd1oNYrR_r0dienongkVB3K8jc1UDBehhE_eMQGHAGYrvO9wPpJQ$
> + *
> + */
> +
> +#include <linux/etherdevice.h>
> +#include <linux/genalloc.h>
> +#include <linux/if_bridge.h>
> +#include <linux/if_hsr.h>
> +#include <linux/if_vlan.h>
> +#include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/module.h>
> +#include <linux/net_tstamp.h>
> +#include <linux/of.h>
> +#include <linux/of_irq.h>
> +#include <linux/of_mdio.h>
> +#include <linux/of_net.h>
> +#include <linux/platform_device.h>
> +#include <linux/phy.h>
> +#include <linux/remoteproc/pruss.h>
> +#include <linux/ptp_classify.h>
> +#include <linux/regmap.h>
> +#include <linux/remoteproc.h>
> +#include <net/pkt_cls.h>
> +
> +#include "icssm_prueth.h"
> +
> +/* called back by PHY layer if there is change in link state of hw port*/
> +static void icssm_emac_adjust_link(struct net_device *ndev)
> +{
> +	struct prueth_emac *emac = netdev_priv(ndev);
> +	struct phy_device *phydev = emac->phydev;
> +	bool new_state = false;
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&emac->lock, flags);
> +
> +	if (phydev->link) {
> +		/* check the mode of operation */
> +		if (phydev->duplex != emac->duplex) {
> +			new_state = true;
> +			emac->duplex = phydev->duplex;
> +		}
> +		if (phydev->speed != emac->speed) {
> +			new_state = true;
> +			emac->speed = phydev->speed;
> +		}
> +		if (!emac->link) {
> +			new_state = true;
> +			emac->link = 1;
> +		}
> +	} else if (emac->link) {
> +		new_state = true;
> +		emac->link = 0;
> +	}
> +
> +	if (new_state)
> +		phy_print_status(phydev);
> +
> +	if (emac->link) {
> +	       /* reactivate the transmit queue if it is stopped */
> +		if (netif_running(ndev) && netif_queue_stopped(ndev))
> +			netif_wake_queue(ndev);
> +	} else {
> +		if (!netif_queue_stopped(ndev))
> +			netif_stop_queue(ndev);
> +	}
> +
> +	spin_unlock_irqrestore(&emac->lock, flags);
> +}
> +
> +static int icssm_emac_set_boot_pru(struct prueth_emac *emac,
> +				   struct net_device *ndev)
> +{
> +	const struct prueth_firmware *pru_firmwares;
> +	struct prueth *prueth = emac->prueth;
> +	const char *fw_name;
> +	int ret;
> +
> +	pru_firmwares = &prueth->fw_data->fw_pru[emac->port_id - 1];

If emac->port_id == 0, this will index at -1

> +	fw_name = pru_firmwares->fw_name[prueth->eth_type];
> +	if (!fw_name) {
> +		netdev_err(ndev, "eth_type %d not supported\n",
> +			   prueth->eth_type);
> +		return -ENODEV;
> +	}
> +
> +	ret = rproc_set_firmware(emac->pru, fw_name);
> +	if (ret) {
> +		netdev_err(ndev, "failed to set PRU0 firmware %s: %d\n",

Hardcoded PRU0 in Logs, what if PRU1

> +			   fw_name, ret);
> +		return ret;
> +	}
> +
> +	ret = rproc_boot(emac->pru);
> +	if (ret) {
> +		netdev_err(ndev, "failed to boot PRU0: %d\n", ret);
> +		return ret;
> +	}
> +
> +	return ret;
> +}
> +
> +/**
> + * icssm_emac_ndo_open - EMAC device open
> + * @ndev: network adapter device
> + *
> + * Called when system wants to start the interface.
> + *
> + * Return: 0 for a successful open, or appropriate error code
> + */
> +static int icssm_emac_ndo_open(struct net_device *ndev)
> +{
> +	struct prueth_emac *emac = netdev_priv(ndev);
> +	int ret;
> +
> +	ret = icssm_emac_set_boot_pru(emac, ndev);
> +	if (ret)
> +		return ret;
> +
> +	/* start PHY */
> +	phy_start(emac->phydev);
> +
> +	return 0;
> +}

Thanks,
Alok

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ