devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Basharath Hussain Khaja <basharath@couthit.com>
Cc: danishanwar@ti.com, rogerq@kernel.org, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, nm@ti.com, ssantosh@kernel.org,
	tony@atomide.com, richardcochran@gmail.com, parvathi@couthit.com,
	schnelle@linux.ibm.com, rdunlap@infradead.org,
	diogo.ivo@siemens.com, m-karicheri2@ti.com,
	jacob.e.keller@intel.com, m-malladi@ti.com,
	javier.carrasco.cruz@gmail.com, afd@ti.com, s-anna@ti.com,
	linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-omap@vger.kernel.org, pratheesh@ti.com, prajith@ti.com,
	vigneshr@ti.com, praneeth@ti.com, srk@ti.com, rogerq@ti.com,
	krishna@couthit.com, pmohan@couthit.com, mohan@couthit.com
Subject: Re: [RFC v2 PATCH 03/10] net: ti: prueth: Adds PRUETH HW and SW configuration
Date: Thu, 30 Jan 2025 15:47:19 +0000	[thread overview]
Message-ID: <20250130154719.GB13457@kernel.org> (raw)
In-Reply-To: <20250124122353.1457174-4-basharath@couthit.com>

On Fri, Jan 24, 2025 at 05:53:46PM +0530, Basharath Hussain Khaja wrote:
> From: Roger Quadros <rogerq@ti.com>
> 
> Updates for MII_RT hardware peripheral configuration such as RX and TX
> configuration for PRU0 and PRU1, frame sizes, and MUX config.
> 
> Updates for PRU-ICSS firmware register configuration and DRAM, SRAM and
> OCMC memory initialization, which will be used in the runtime for packet
> reception and transmission.
> 
> DUAL-EMAC memory allocation for software queues and its supporting
> components such as the buffer descriptors and queue discriptors. These

nit: descriptors

> software queues are placed in OCMC memory and are shared with CPU by
> PRU-ICSS for packet receive and transmit.
> 
> All declarations and macros are being used from common header file
> for various protocols.
> 
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
> Signed-off-by: Basharath Hussain Khaja <basharath@couthit.com>

...

> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.c b/drivers/net/ethernet/ti/icssm/icssm_prueth.c

...

> +static void icssm_prueth_mii_init(struct prueth *prueth)
> +{
> +	struct regmap *mii_rt;
> +	u32 rxcfg_reg, rxcfg;
> +	u32 txcfg_reg, txcfg;
> +
> +	mii_rt = prueth->mii_rt;
> +
> +	rxcfg = PRUSS_MII_RT_RXCFG_RX_ENABLE |
> +		PRUSS_MII_RT_RXCFG_RX_DATA_RDY_MODE_DIS |
> +		PRUSS_MII_RT_RXCFG_RX_L2_EN |
> +		PRUSS_MII_RT_RXCFG_RX_CUT_PREAMBLE |
> +		PRUSS_MII_RT_RXCFG_RX_L2_EOF_SCLR_DIS;
> +
> +	/* Configuration of Port 0 Rx */
> +	rxcfg_reg = PRUSS_MII_RT_RXCFG0;
> +
> +	regmap_write(mii_rt, rxcfg_reg, rxcfg);
> +
> +	/* Configuration of Port 1 Rx */
> +	rxcfg_reg = PRUSS_MII_RT_RXCFG1;
> +
> +	rxcfg |= PRUSS_MII_RT_RXCFG_RX_MUX_SEL;
> +
> +	regmap_write(mii_rt, rxcfg_reg, rxcfg);
> +
> +	txcfg = PRUSS_MII_RT_TXCFG_TX_ENABLE |
> +		PRUSS_MII_RT_TXCFG_TX_AUTO_PREAMBLE |
> +		PRUSS_MII_RT_TXCFG_TX_32_MODE_EN |
> +		(TX_START_DELAY << PRUSS_MII_RT_TXCFG_TX_START_DELAY_SHIFT) |
> +		(TX_CLK_DELAY_100M << PRUSS_MII_RT_TXCFG_TX_CLK_DELAY_SHIFT);
> +
> +	/* Configuration of Port 0 Tx */
> +	txcfg_reg = PRUSS_MII_RT_TXCFG0;
> +
> +	regmap_write(mii_rt, txcfg_reg, txcfg);
> +
> +	txcfg	|= PRUSS_MII_RT_TXCFG_TX_MUX_SEL;

nit: a space seems more appropriate than a tab before '|='

> +
> +	/* Configuration of Port 1 Tx */
> +	txcfg_reg = PRUSS_MII_RT_TXCFG1;
> +
> +	regmap_write(mii_rt, txcfg_reg, txcfg);
> +
> +	txcfg_reg = PRUSS_MII_RT_RX_FRMS0;
> +
> +	/* Min frame length should be set to 64 to allow receive of standard
> +	 * Ethernet frames such as PTP, LLDP that will not have the tag/rct.
> +	 * Actual size written to register is size - 1 per TRM. This also
> +	 * includes CRC/FCS.
> +	 */
> +	txcfg = (((PRUSS_MII_RT_RX_FRMS_MIN_FRM - 1) <<
> +			PRUSS_MII_RT_RX_FRMS_MIN_FRM_SHIFT) &
> +			PRUSS_MII_RT_RX_FRMS_MIN_FRM_MASK);
> +
> +	/* For EMAC, set Max frame size to 1528 i.e size with VLAN.
> +	 * Actual size written to register is size - 1 as per TRM.
> +	 * Since driver support run time change of protocol, driver
> +	 * must overwrite the values based on Ethernet type.
> +	 */
> +	txcfg |= (((PRUSS_MII_RT_RX_FRMS_MAX_SUPPORT_EMAC - 1) <<
> +			   PRUSS_MII_RT_RX_FRMS_MAX_FRM_SHIFT)	&
> +			   PRUSS_MII_RT_RX_FRMS_MAX_FRM_MASK);
> +
> +	regmap_write(mii_rt, txcfg_reg, txcfg);
> +
> +	txcfg_reg = PRUSS_MII_RT_RX_FRMS1;
> +
> +	regmap_write(mii_rt, txcfg_reg, txcfg);
> +}

...

> @@ -377,6 +705,70 @@ static int icssm_prueth_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> +	pruss = pruss_get(prueth->pru0 ? prueth->pru0 : prueth->pru1);
> +	if (IS_ERR(pruss)) {
> +		ret = PTR_ERR(pruss);
> +		dev_err(dev, "unable to get pruss handle\n");
> +		goto put_pru;
> +	}
> +	prueth->pruss = pruss;
> +
> +	ret = pruss_cfg_ocp_master_ports(prueth->pruss, 1);
> +	if (ret) {
> +		dev_err(dev, "couldn't enabled ocp master port: %d\n", ret);
> +		goto put_pruss;
> +	}

FTR, I applied this patch set on top of the patch at the link below
so that pruss_cfg_ocp_master_ports() is present.

- [PATCH v2 1/1] soc: ti: PRUSS OCP configuration
  https://lore.kernel.org/all/20250108125937.10604-2-basharath@couthit.com/

  ...

> diff --git a/drivers/net/ethernet/ti/icssm/icssm_prueth.h b/drivers/net/ethernet/ti/icssm/icssm_prueth.h

...

> +/**
> + * struct prueth_queue - Information about a queue in memory

struct prueth_queue_info

> + * @buffer_offset: buffer offset in OCMC RAM
> + * @queue_desc_offset: queue descriptor offset in Shared RAM
> + * @buffer_desc_offset: buffer descriptors offset in Shared RAM
> + * @buffer_desc_end: end address of buffer descriptors in Shared RAM
> + */
> +struct prueth_queue_info {
> +	u16 buffer_offset;
> +	u16 queue_desc_offset;
> +	u16 buffer_desc_offset;
> +	u16 buffer_desc_end;
> +} __packed;

...

  reply	other threads:[~2025-01-30 15:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-24 12:23 [RFC v2 PATCH 00/10] PRU-ICSSM Ethernet Driver Basharath Hussain Khaja
2025-01-24 12:23 ` [RFC v2 PATCH 01/10] dt-bindings: net: ti: Adds DUAL-EMAC mode support on PRU-ICSS2 for AM57xx SOCs Basharath Hussain Khaja
2025-01-24 16:39   ` Conor Dooley
2025-01-29  5:16     ` Basharath Hussain Khaja
2025-01-29 17:48       ` Conor Dooley
2025-02-03 12:29         ` Basharath Hussain Khaja
2025-02-04 18:16           ` Conor Dooley
2025-01-24 12:23 ` [RFC v2 PATCH 02/10] net: ti: prueth: Adds ICSSM Ethernet driver Basharath Hussain Khaja
2025-01-30 11:41   ` Simon Horman
2025-02-01 13:25     ` Basharath Hussain Khaja
2025-01-24 12:23 ` [RFC v2 PATCH 03/10] net: ti: prueth: Adds PRUETH HW and SW configuration Basharath Hussain Khaja
2025-01-30 15:47   ` Simon Horman [this message]
2025-02-01 13:34     ` Basharath Hussain Khaja
2025-01-24 12:37 ` [RFC v2 PATCH 04/10] net: ti: prueth: Adds link detection, RX and TX support Basharath Hussain Khaja
2025-01-24 23:13   ` Joe Damato
2025-01-29  5:41     ` Basharath Hussain Khaja
2025-01-30 16:45   ` Simon Horman
2025-02-01 13:37     ` Basharath Hussain Khaja
2025-01-24 13:40 ` Basharath Hussain Khaja
2025-01-24 23:20   ` Joe Damato
2025-01-29  5:43     ` Basharath Hussain Khaja
2025-01-24 13:40 ` [RFC v2 PATCH 05/10] net: ti: prueth: Adds ethtool support for ICSSM PRUETH Driver Basharath Hussain Khaja
2025-01-30 17:23   ` Simon Horman
2025-02-01 13:48     ` Basharath Hussain Khaja
2025-01-24 13:40 ` [RFC v2 PATCH 06/10] net: ti: prueth: Adds HW timestamping support for PTP using PRU-ICSS IEP module Basharath Hussain Khaja
2025-01-31 10:33   ` Simon Horman
2025-02-05 12:24     ` Basharath Hussain Khaja
2025-01-24 13:40 ` [RFC v2 PATCH 07/10] net: ti: prueth: Adds support for network filters for traffic control supported by PRU-ICSS Basharath Hussain Khaja
2025-01-24 14:45 ` [RFC v2 PATCH 08/10] net: ti: prueth: Adds support for RX interrupt coalescing/pacing Basharath Hussain Khaja
2025-01-24 14:45 ` [RFC v2 PATCH 09/10] net: ti: prueth: Adds power management support for PRU-ICSS Basharath Hussain Khaja
2025-01-24 14:45 ` [RFC v2 PATCH 10/10] arm: dts: ti: Adds device tree nodes for PRU Cores, IEP and eCAP modules of PRU-ICSS2 Instance Basharath Hussain Khaja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250130154719.GB13457@kernel.org \
    --to=horms@kernel.org \
    --cc=afd@ti.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=basharath@couthit.com \
    --cc=conor+dt@kernel.org \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=diogo.ivo@siemens.com \
    --cc=edumazet@google.com \
    --cc=jacob.e.keller@intel.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=krishna@couthit.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=m-malladi@ti.com \
    --cc=mohan@couthit.com \
    --cc=netdev@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pabeni@redhat.com \
    --cc=parvathi@couthit.com \
    --cc=pmohan@couthit.com \
    --cc=prajith@ti.com \
    --cc=praneeth@ti.com \
    --cc=pratheesh@ti.com \
    --cc=rdunlap@infradead.org \
    --cc=richardcochran@gmail.com \
    --cc=robh@kernel.org \
    --cc=rogerq@kernel.org \
    --cc=rogerq@ti.com \
    --cc=s-anna@ti.com \
    --cc=schnelle@linux.ibm.com \
    --cc=srk@ti.com \
    --cc=ssantosh@kernel.org \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).