From: ALOK TIWARI <alok.a.tiwari@oracle.com>
To: Parvathi Pudi <parvathi@couthit.com>,
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, ssantosh@kernel.org,
richardcochran@gmail.com, s.hauer@pengutronix.de,
m-karicheri2@ti.com, glaroque@baylibre.com, afd@ti.com,
saikrishnag@marvell.com, m-malladi@ti.com,
jacob.e.keller@intel.com, kory.maincent@bootlin.com,
diogo.ivo@siemens.com, javier.carrasco.cruz@gmail.com,
horms@kernel.org, s-anna@ti.com, basharath@couthit.com
Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
vadim.fedorenko@linux.dev, 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: [PATCH net-next v12 5/5] net: ti: prueth: Adds IEP support for PRUETH on AM33x, AM43x and AM57x SOCs
Date: Fri, 25 Jul 2025 19:34:56 +0530 [thread overview]
Message-ID: <3502ed81-7d97-4a01-806f-5c5ae307b6af@oracle.com> (raw)
In-Reply-To: <20250724091122.3064350-6-parvathi@couthit.com>
On 7/24/2025 2:40 PM, Parvathi Pudi wrote:
> Added API hooks for IEP module (legacy 32-bit model) to support
> timestamping requests from application.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> Signed-off-by: Andrew F. Davis <afd@ti.com>
> Signed-off-by: Basharath Hussain Khaja <basharath@couthit.com>
> Signed-off-by: Parvathi Pudi <parvathi@couthit.com>
> ---
> drivers/net/ethernet/ti/icssg/icss_iep.c | 103 ++++++++++++++++++
> drivers/net/ethernet/ti/icssm/icssm_prueth.c | 72 +++++++++++-
> drivers/net/ethernet/ti/icssm/icssm_prueth.h | 2 +
> .../net/ethernet/ti/icssm/icssm_prueth_ptp.h | 85 +++++++++++++++
> 4 files changed, 260 insertions(+), 2 deletions(-)
> create mode 100644 drivers/net/ethernet/ti/icssm/icssm_prueth_ptp.h
>
> diff --git a/drivers/net/ethernet/ti/icssg/icss_iep.c b/drivers/net/ethernet/ti/icssg/icss_iep.c
> index 2a1c43316f46..59aca63e2fe5 100644
> --- a/drivers/net/ethernet/ti/icssg/icss_iep.c
> +++ b/drivers/net/ethernet/ti/icssg/icss_iep.c
> @@ -968,11 +968,114 @@ static const struct icss_iep_plat_data am654_icss_iep_plat_data = {
> .config = &am654_icss_iep_regmap_config,
> };
>
> +static const struct icss_iep_plat_data am57xx_icss_iep_plat_data = {
> + .flags = ICSS_IEP_64BIT_COUNTER_SUPPORT |
> + ICSS_IEP_SLOW_COMPEN_REG_SUPPORT,
> + .reg_offs = {
> + [ICSS_IEP_GLOBAL_CFG_REG] = 0x00,
> + [ICSS_IEP_COMPEN_REG] = 0x08,
> + [ICSS_IEP_SLOW_COMPEN_REG] = 0x0C,
using both uppercase and lowercase hex
> + [ICSS_IEP_COUNT_REG0] = 0x10,
> + [ICSS_IEP_COUNT_REG1] = 0x14,
> + [ICSS_IEP_CAPTURE_CFG_REG] = 0x18,
> + [ICSS_IEP_CAPTURE_STAT_REG] = 0x1c,
> +
> + [ICSS_IEP_CAP6_RISE_REG0] = 0x50,
> + [ICSS_IEP_CAP6_RISE_REG1] = 0x54,
> +
> + [ICSS_IEP_CAP7_RISE_REG0] = 0x60,
> + [ICSS_IEP_CAP7_RISE_REG1] = 0x64,
> +
> + [ICSS_IEP_CMP_CFG_REG] = 0x70,
> + [ICSS_IEP_CMP_STAT_REG] = 0x74,
> + [ICSS_IEP_CMP0_REG0] = 0x78,
> + [ICSS_IEP_CMP0_REG1] = 0x7c,
> + [ICSS_IEP_CMP1_REG0] = 0x80,
> + [ICSS_IEP_CMP1_REG1] = 0x84,
> +
> + [ICSS_IEP_CMP8_REG0] = 0xc0,
> + [ICSS_IEP_CMP8_REG1] = 0xc4,
> + [ICSS_IEP_SYNC_CTRL_REG] = 0x180,
> + [ICSS_IEP_SYNC0_STAT_REG] = 0x188,
> + [ICSS_IEP_SYNC1_STAT_REG] = 0x18c,
> + [ICSS_IEP_SYNC_PWIDTH_REG] = 0x190,
> + [ICSS_IEP_SYNC0_PERIOD_REG] = 0x194,
> + [ICSS_IEP_SYNC1_DELAY_REG] = 0x198,
> + [ICSS_IEP_SYNC_START_REG] = 0x19c,
> + },
> + .config = &am654_icss_iep_regmap_config,
> +};
> +
> +static bool am335x_icss_iep_valid_reg(struct device *dev, unsigned int reg)
> +{
> + switch (reg) {
> + case ICSS_IEP_GLOBAL_CFG_REG ... ICSS_IEP_CAPTURE_STAT_REG:
> + case ICSS_IEP_CAP6_RISE_REG0:
> + case ICSS_IEP_CMP_CFG_REG ... ICSS_IEP_CMP0_REG0:
> + case ICSS_IEP_CMP8_REG0 ... ICSS_IEP_SYNC_START_REG:
> + return true;
> + default:
> + return false;
> + }
> +
> + return false;
Redundant code after default return
> +}
> +
[clip]
>
> @@ -1434,12 +1490,19 @@ static int icssm_prueth_probe(struct platform_device *pdev)
> }
> }
>
> + prueth->iep = icss_iep_get(np);
> + if (IS_ERR(prueth->iep)) {
> + ret = PTR_ERR(prueth->iep);
> + dev_err(dev, "unable to get IEP\n");
> + goto netdev_exit;
> + }
> +
> /* register the network devices */
> if (eth0_node) {
> ret = register_netdev(prueth->emac[PRUETH_MAC0]->ndev);
> if (ret) {
> dev_err(dev, "can't register netdev for port MII0");
> - goto netdev_exit;
> + goto iep_put;
> }
>
> prueth->registered_netdevs[PRUETH_MAC0] =
> @@ -1473,6 +1536,9 @@ static int icssm_prueth_probe(struct platform_device *pdev)
> unregister_netdev(prueth->registered_netdevs[i]);
> }
>
> +iep_put:
> + icss_iep_put(prueth->iep);
prueth->iep = NULL; avoid potential use-after-free
> +
> netdev_exit:
> for (i = 0; i < PRUETH_NUM_MACS; i++) {
> eth_node = prueth->eth_node[i];
> @@ -1541,6 +1607,8 @@ static void icssm_prueth_remove(struct platform_device *pdev)
> &prueth->mem[i]);
> }
>
> + icss_iep_put(prueth->iep);
> +
> pruss_put(prueth->pruss);
>
Thanks,
Alok
next prev parent reply other threads:[~2025-07-25 14:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 7:23 [PATCH net-next v12 0/5] PRU-ICSSM Ethernet Driver Parvathi Pudi
2025-07-24 7:23 ` [PATCH net-next v12 1/5] dt-bindings: net: ti: Adds DUAL-EMAC mode support on PRU-ICSS2 for AM57xx, AM43xx and AM33xx SOCs Parvathi Pudi
2025-07-24 7:23 ` [PATCH net-next v12 2/5] net: ti: prueth: Adds ICSSM Ethernet driver Parvathi Pudi
2025-07-25 17:55 ` ALOK TIWARI
2025-07-31 14:15 ` Parvathi Pudi
2025-08-06 13:40 ` Bastien Curutchet
2025-08-11 10:14 ` Parvathi Pudi
2025-07-24 7:23 ` [PATCH net-next v12 3/5] net: ti: prueth: Adds PRUETH HW and SW configuration Parvathi Pudi
2025-07-25 17:43 ` ALOK TIWARI
2025-07-31 14:11 ` Parvathi Pudi
2025-07-24 9:10 ` [PATCH net-next v12 4/5] net: ti: prueth: Adds link detection, RX and TX support Parvathi Pudi
2025-07-24 9:10 ` [PATCH net-next v12 5/5] net: ti: prueth: Adds IEP support for PRUETH on AM33x, AM43x and AM57x SOCs Parvathi Pudi
2025-07-25 14:04 ` ALOK TIWARI [this message]
2025-07-31 14:08 ` Parvathi Pudi
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=3502ed81-7d97-4a01-806f-5c5ae307b6af@oracle.com \
--to=alok.a.tiwari@oracle.com \
--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=glaroque@baylibre.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=kory.maincent@bootlin.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=m-karicheri2@ti.com \
--cc=m-malladi@ti.com \
--cc=mohan@couthit.com \
--cc=netdev@vger.kernel.org \
--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=richardcochran@gmail.com \
--cc=robh@kernel.org \
--cc=rogerq@kernel.org \
--cc=rogerq@ti.com \
--cc=s-anna@ti.com \
--cc=s.hauer@pengutronix.de \
--cc=saikrishnag@marvell.com \
--cc=srk@ti.com \
--cc=ssantosh@kernel.org \
--cc=vadim.fedorenko@linux.dev \
--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).