mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Karumanchi, Vineeth" <vineeth@amd.com>
To: linux@armlinux.org.uk, vineeth.karumanchi@amd.com
Cc: nicolas.ferre@microchip.com, claudiu.beznea@tuxon.dev,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, andrew@lunn.ch, netdev@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	git@amd.com
Subject: Re: [RFC PATCH net-next 4/5] net: macb: Configure High Speed Mac for given speed.
Date: Thu, 10 Oct 2024 19:39:16 +0530	[thread overview]
Message-ID: <6fc42ade-66cf-4462-914c-3dd5589c9a9f@amd.com> (raw)
In-Reply-To: <ZwZKumS3IEy54Jsk@shell.armlinux.org.uk>

Hi Russel,

On 10/9/2024 2:49 PM, Russell King (Oracle) wrote:
> On Wed, Oct 09, 2024 at 11:09:45AM +0530, Vineeth Karumanchi wrote:
>> HS Mac configuration steps:
>> - Configure speed and serdes rate bits of USX_CONTROL register from
>>    user specified speed in the device-tree.
>> - Enable HS Mac for 5G and 10G speeds.
>> - Reset RX receive path to achieve USX block lock for the
>>    configured serdes rate.
>> - Wait for USX block lock synchronization.
>>
>> Move the initialization instances to macb_usx_pcs_link_up().
> It only partly moves stuff there, creating what I can only call a mess
> which probably doesn't work correctly.
>
> Please consider the MAC and PCS as two separate boxes - register
> settings controlled in one box should not be touched by the other box.
>
> For example, macb_mac_config() now does this:
>
>          old_ncr = ncr = macb_or_gem_readl(bp, NCR);
> ...
>          } else if (macb_is_gem(bp)) {
> ...
>                  ncr &= ~GEM_BIT(ENABLE_HS_MAC);
> ...
>          if (old_ncr ^ ncr)
>                  macb_or_gem_writel(bp, NCR, ncr);
>
> meanwhile:
>
>> @@ -564,14 +565,59 @@ static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
>>   				 int duplex)
>>   {
>>   	struct macb *bp = container_of(pcs, struct macb, phylink_usx_pcs);
> ...
>> +	/* Enable HS MAC for high speeds */
>> +	if (hs_mac) {
>> +		config = macb_or_gem_readl(bp, NCR);
>> +		config |= GEM_BIT(ENABLE_HS_MAC);
>> +		macb_or_gem_writel(bp, NCR, config);
>> +	}
> Arguably, the time that this would happen is when the interface mode
> changes which would cause a full reconfiguration and thus both of
> these functions will be called, but it's not easy to follow that's
> what is going on here.
>
> It also looks like you're messing with MAC registers in the PCS code,
> setting the MAC speed there. Are the PCS and MAC so integrated together
> that abstracting the PCS into its own separate code block leads to
> problems?

Agreed, Since our current hardware configuration lacks AN and PHY, I've 
relocated the ENABLE_HS_MAC configuration into PCS to
allow speed changes using ethtool. When more hardware with a PHY that 
supports AN becomes available,
the phylink will invoke macb_mac_config() with the communicated speed 
(phylinkstate->speed).
It is possible to make ENABLE_HS_MAC conditional based on speed.

Currently, for fixed-link, will keep the earlier implementation.

Please let me know your thoughts and comments.

-- 
🙏 vineeth


  reply	other threads:[~2024-10-10 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-09  5:39 [RFC PATCH net-next 0/5] net: macb: Add versal2 10GBE device support Vineeth Karumanchi
2024-10-09  5:39 ` [RFC PATCH net-next 1/5] dt-bindings: net: macb: Add support for versal2 10gbe device Vineeth Karumanchi
2024-10-09  6:43   ` Krzysztof Kozlowski
2024-10-09  5:39 ` [RFC PATCH net-next 2/5] net: macb: Add versal2 10GBE device support Vineeth Karumanchi
2024-10-09  5:39 ` [RFC PATCH net-next 3/5] net: macb: Update USX_CONTROL reg's bitfields and constants Vineeth Karumanchi
2024-10-09  9:04   ` Russell King (Oracle)
2024-10-09  5:39 ` [RFC PATCH net-next 4/5] net: macb: Configure High Speed Mac for given speed Vineeth Karumanchi
2024-10-09  6:36   ` Maxime Chevallier
2024-10-10 13:53     ` Karumanchi, Vineeth
2024-10-09  9:19   ` Russell King (Oracle)
2024-10-10 14:09     ` Karumanchi, Vineeth [this message]
2024-10-10 14:17       ` Russell King (Oracle)
2024-10-09  5:39 ` [RFC PATCH net-next 5/5] net: macb: Get speed and link status runtime Vineeth Karumanchi

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=6fc42ade-66cf-4462-914c-3dd5589c9a9f@amd.com \
    --to=vineeth@amd.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=git@amd.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=vineeth.karumanchi@amd.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

all inboxes | Powered by JetHome®