* [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs
@ 2024-08-02 10:04 Paul Menzel
2024-08-02 19:51 ` Michael Chan
0 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2024-08-02 10:04 UTC (permalink / raw)
To: Pavan Chebbi, Michael Chan, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Roy Lee, Paul Menzel, netdev, linux-kernel
From: Roy Lee <roy_lee@accton.com>
Add parameter to enable *short preamble* for MAC, so MDIO access to some
external PHY, like BCM54616, can be validated.
Applies to the five platforms below, that have the ethernet controller
BCM5720:
as7116_54x, as7326_56x, as7716_32x-r0, as7716_32xb, and as7816_64x
Verified by mii-tool. (31 is the address of external phy).
root@sonic:/home/admin# mii-tool -v eth0 -p 31
using the specified MII index 31.
eth0: negotiated, link ok
product info: vendor 00:d8:97, model 17 rev 2
basic mode: autonegotiation enabled
basic status: autonegotiation complete, link ok
capabilities: 1000baseT-HD 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
advertising: flow-control
link partner: 1000baseT-FD 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD
Note, this upstreams a patch to the SONiC Linux kernel added in 2018
[1][2][3].
[1]: https://github.com/sonic-net/sonic-linux-kernel/pull/71/
[2]: https://github.com/sonic-net/sonic-linux-kernel/commit/ad754bdcc094f6499b3fd6af067c828b0546f96c
[3]: https://github.com/sonic-net/sonic-buildimage/pull/2318
Signed-off-by: Roy Lee <roy_lee@accton.com>
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
---
drivers/net/ethernet/broadcom/tg3.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 0ec5f01551f9..9b4ab201fd9a 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -233,6 +233,10 @@ static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */
module_param(tg3_debug, int, 0);
MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value");
+static int short_preamble = 0;
+module_param(short_preamble, int, 0);
+MODULE_PARM_DESC(short_preamble, "Enable short preamble.");
+
#define TG3_DRV_DATA_FLAG_10_100_ONLY 0x0001
#define TG3_DRV_DATA_FLAG_5705_10_100 0x0002
@@ -1493,6 +1497,11 @@ static void tg3_mdio_config_5785(struct tg3 *tp)
static void tg3_mdio_start(struct tg3 *tp)
{
tp->mi_mode &= ~MAC_MI_MODE_AUTO_POLL;
+
+ if(short_preamble) {
+ tp->mi_mode |= MAC_MI_MODE_SHORT_PREAMBLE;
+ }
+
tw32_f(MAC_MI_MODE, tp->mi_mode);
udelay(80);
--
2.45.2
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs
2024-08-02 10:04 [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs Paul Menzel
@ 2024-08-02 19:51 ` Michael Chan
2024-08-02 20:55 ` Paul Menzel
2024-08-02 23:34 ` Andrew Lunn
0 siblings, 2 replies; 5+ messages in thread
From: Michael Chan @ 2024-08-02 19:51 UTC (permalink / raw)
To: Paul Menzel
Cc: Pavan Chebbi, Michael Chan, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Roy Lee, netdev, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 819 bytes --]
On Fri, Aug 2, 2024 at 3:05 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 0ec5f01551f9..9b4ab201fd9a 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -233,6 +233,10 @@ static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */
> module_param(tg3_debug, int, 0);
> MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value");
>
> +static int short_preamble = 0;
> +module_param(short_preamble, int, 0);
> +MODULE_PARM_DESC(short_preamble, "Enable short preamble.");
> +
Module parameters are generally not accepted. If this is something
other devices can potentially use, it's better to use a more common
interface.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs
2024-08-02 19:51 ` Michael Chan
@ 2024-08-02 20:55 ` Paul Menzel
2024-08-02 21:25 ` Michael Chan
2024-08-02 23:34 ` Andrew Lunn
1 sibling, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2024-08-02 20:55 UTC (permalink / raw)
To: Michael Chan
Cc: Pavan Chebbi, Michael Chan, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Roy Lee, netdev, linux-kernel,
Saikrishna Arcot, Guohan Lu
[Cc: +SONiC Linux kernel maintainers, cf patch submission [1]]
Dear Michael,
Thank you for the quick reply.
Am 02.08.24 um 21:51 schrieb Michael Chan:
> On Fri, Aug 2, 2024 at 3:05 AM Paul Menzel wrote:
>
>> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
>> index 0ec5f01551f9..9b4ab201fd9a 100644
>> --- a/drivers/net/ethernet/broadcom/tg3.c
>> +++ b/drivers/net/ethernet/broadcom/tg3.c
>> @@ -233,6 +233,10 @@ static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */
>> module_param(tg3_debug, int, 0);
>> MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value");
>>
>> +static int short_preamble = 0;
>> +module_param(short_preamble, int, 0);
>> +MODULE_PARM_DESC(short_preamble, "Enable short preamble.");
>> +
>
> Module parameters are generally not accepted. If this is something
> other devices can potentially use, it's better to use a more common
> interface.
I saw the patch in the SONiC repository and took a shot at upstreaming
it. `tg.h` defines the macro:
#define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002
Any idea how this should be used? Can it be enabled unconditionally? I
do not even have the datasheet.
Kind regards,
Paul
[1]:
https://lore.kernel.org/netdev/20240802100448.10745-1-pmenzel@molgen.mpg.de/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs
2024-08-02 20:55 ` Paul Menzel
@ 2024-08-02 21:25 ` Michael Chan
0 siblings, 0 replies; 5+ messages in thread
From: Michael Chan @ 2024-08-02 21:25 UTC (permalink / raw)
To: Paul Menzel
Cc: Pavan Chebbi, Michael Chan, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Roy Lee, netdev, linux-kernel,
Saikrishna Arcot, Guohan Lu
[-- Attachment #1: Type: text/plain, Size: 911 bytes --]
On Fri, Aug 2, 2024 at 1:55 PM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> >> +static int short_preamble = 0;
> >> +module_param(short_preamble, int, 0);
> >> +MODULE_PARM_DESC(short_preamble, "Enable short preamble.");
> >> +
> >
> > Module parameters are generally not accepted. If this is something
> > other devices can potentially use, it's better to use a more common
> > interface.
>
> I saw the patch in the SONiC repository and took a shot at upstreaming
> it. `tg.h` defines the macro:
>
> #define MAC_MI_MODE_SHORT_PREAMBLE 0x00000002
>
> Any idea how this should be used? Can it be enabled unconditionally? I
> do not even have the datasheet.
>
Here's the programmer's reference:
https://docs.broadcom.com/doc/571X-5720-PG1XX
But there is not much additional information about the SHORT_PREAMBLE
bit. I will need to ask internally about this bit. Thanks.
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs
2024-08-02 19:51 ` Michael Chan
2024-08-02 20:55 ` Paul Menzel
@ 2024-08-02 23:34 ` Andrew Lunn
1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2024-08-02 23:34 UTC (permalink / raw)
To: Michael Chan
Cc: Paul Menzel, Pavan Chebbi, Michael Chan, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Roy Lee, netdev,
linux-kernel
On Fri, Aug 02, 2024 at 12:51:15PM -0700, Michael Chan wrote:
> On Fri, Aug 2, 2024 at 3:05 AM Paul Menzel <pmenzel@molgen.mpg.de> wrote:
>
> > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> > index 0ec5f01551f9..9b4ab201fd9a 100644
> > --- a/drivers/net/ethernet/broadcom/tg3.c
> > +++ b/drivers/net/ethernet/broadcom/tg3.c
> > @@ -233,6 +233,10 @@ static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */
> > module_param(tg3_debug, int, 0);
> > MODULE_PARM_DESC(tg3_debug, "Tigon3 bitmapped debugging message enable value");
> >
> > +static int short_preamble = 0;
> > +module_param(short_preamble, int, 0);
> > +MODULE_PARM_DESC(short_preamble, "Enable short preamble.");
> > +
>
> Module parameters are generally not accepted. If this is something
> other devices can potentially use, it's better to use a more common
> interface.
+1
Most systems supporting suppressed preamble do this using the DT
property 'suppress-preamble'. See:
Documentation/devicetree/bindings/net/mdio.yaml
You could add an ACPI parameter for x86. You could also consider
implementing clock-frequency if the MDIO bus master and all the
devices on the bus support faster than 2.5MHz.
Andrew
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-08-02 23:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-02 10:04 [PATCH] tg3: Add param `short_preamble` to enable MDIO traffic to external PHYs Paul Menzel
2024-08-02 19:51 ` Michael Chan
2024-08-02 20:55 ` Paul Menzel
2024-08-02 21:25 ` Michael Chan
2024-08-02 23:34 ` Andrew Lunn
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®