netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <harini.katakam@xilinx.com>, <Nicolas.Ferre@microchip.com>,
	<davem@davemloft.net>, <richardcochran@gmail.com>,
	<kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<michal.simek@xilinx.com>, <harinikatakamlinux@gmail.com>,
	<radhey.shyam.pandey@xilinx.com>
Subject: Re: [PATCH 2/3] net: macb: Enable PTP unicast
Date: Thu, 19 May 2022 08:54:19 +0000	[thread overview]
Message-ID: <ca4c97c9-1117-a465-5202-e1bf276fe75b@microchip.com> (raw)
In-Reply-To: <20220517073259.23476-3-harini.katakam@xilinx.com>

Hi, Harini,

On 17.05.2022 10:32, Harini Katakam wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Enable transmission and reception of PTP unicast packets by
> updating PTP unicast config bit and setting current HW mac
> address as allowed address in PTP unicast filter registers.
> 
> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
> ---
>  drivers/net/ethernet/cadence/macb.h      | 4 ++++
>  drivers/net/ethernet/cadence/macb_main.c | 7 +++++--
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 7ca077b65eaa..d245fd78ec51 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -95,6 +95,8 @@
>  #define GEM_SA4B               0x00A0 /* Specific4 Bottom */
>  #define GEM_SA4T               0x00A4 /* Specific4 Top */
>  #define GEM_WOL                        0x00b8 /* Wake on LAN */
> +#define GEM_RXPTPUNI           0x00D4 /* PTP RX Unicast address */
> +#define GEM_TXPTPUNI           0x00D8 /* PTP TX Unicast address */
>  #define GEM_EFTSH              0x00e8 /* PTP Event Frame Transmitted Seconds Register 47:32 */
>  #define GEM_EFRSH              0x00ec /* PTP Event Frame Received Seconds Register 47:32 */
>  #define GEM_PEFTSH             0x00f0 /* PTP Peer Event Frame Transmitted Seconds Register 47:32 */
> @@ -245,6 +247,8 @@
>  #define MACB_TZQ_OFFSET                12 /* Transmit zero quantum pause frame */
>  #define MACB_TZQ_SIZE          1
>  #define MACB_SRTSM_OFFSET      15 /* Store Receive Timestamp to Memory */
> +#define MACB_PTPUNI_OFFSET     20 /* PTP Unicast packet enable */
> +#define MACB_PTPUNI_SIZE       1
>  #define MACB_OSSMODE_OFFSET    24 /* Enable One Step Synchro Mode */
>  #define MACB_OSSMODE_SIZE      1
>  #define MACB_MIIONRGMII_OFFSET 28 /* MII Usage on RGMII Interface */
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index e23a03e8badf..19276583811e 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -290,6 +290,9 @@ static void macb_set_hwaddr(struct macb *bp)
>         top = cpu_to_le16(*((u16 *)(bp->dev->dev_addr + 4)));
>         macb_or_gem_writel(bp, SA1T, top);
> 
> +       gem_writel(bp, RXPTPUNI, bottom);
> +       gem_writel(bp, TXPTPUNI, bottom);

Please call these only if gem_has_ptp() returns true as macb_set_hwaddr()
is called either on emac, gem variants or gem variants w/o ptp support or
w/o ptp support enabled.

> +
>         /* Clear unused address register sets */
>         macb_or_gem_writel(bp, SA2B, 0);
>         macb_or_gem_writel(bp, SA2T, 0);
> @@ -723,8 +726,8 @@ static void macb_mac_link_up(struct phylink_config *config,
> 
>         spin_unlock_irqrestore(&bp->lock, flags);
> 
> -       /* Enable Rx and Tx */
> -       macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE));
> +       /* Enable Rx and Tx; Enable PTP unicast */
> +       macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(RE) | MACB_BIT(TE) | MACB_BIT(PTPUNI));

Same here.

> 
>         netif_tx_wake_all_queues(ndev);
>  }
> --
> 2.17.1
> 


  reply	other threads:[~2022-05-19  8:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  7:32 [PATCH 0/3] Macb PTP updates Harini Katakam
2022-05-17  7:32 ` [PATCH 1/3] net: macb: Fix PTP one step sync support Harini Katakam
2022-05-18  2:42   ` Jakub Kicinski
2022-05-18  4:23     ` Harini Katakam
2022-05-18  5:06       ` Jakub Kicinski
2022-05-18 10:31         ` Harini Katakam
2022-05-17  7:32 ` [PATCH 2/3] net: macb: Enable PTP unicast Harini Katakam
2022-05-19  8:54   ` Claudiu.Beznea [this message]
2022-05-17  7:32 ` [PATCH 3/3] net: macb: Optimize reading HW timestamp Harini Katakam
2022-05-17 13:55 ` [PATCH 0/3] Macb PTP updates Richard Cochran

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=ca4c97c9-1117-a465-5202-e1bf276fe75b@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Nicolas.Ferre@microchip.com \
    --cc=davem@davemloft.net \
    --cc=harini.katakam@xilinx.com \
    --cc=harinikatakamlinux@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=radhey.shyam.pandey@xilinx.com \
    --cc=richardcochran@gmail.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).