linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
@ 2018-03-15 16:56 SZ Lin (林上智)
  2018-03-15 17:39 ` Grygorii Strashko
  2018-03-17 23:50 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: SZ Lin (林上智) @ 2018-03-15 16:56 UTC (permalink / raw)
  Cc: SZ Lin (林上智),
	Schuyler Patton, Grygorii Strashko, David S. Miller,
	Ivan Khoronzhuk, Keerthy, Sekhar Nori, linux-omap, netdev,
	linux-kernel

According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and
DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register is only
available when PHY is configured in RGMII mode with 10Mbps speed. It will
cause some networking issues without RGMII mode, such as carrier sense
errors and low throughput. TI also mentioned this issue in their forum[4].

This patch adds the check mechanism for PHY interface with RGMII interface
type, the in-band mode can only be set in RGMII mode with 10Mbps speed.

References:
[1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
[2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf
[3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf
[4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155

Suggested-by: Holsety Chen (陳憲輝) <Holsety.Chen@moxa.com>
Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
Signed-off-by: Schuyler Patton <spatton@ti.com>
---
Changes from v1:
- Use phy_interface_is_rgmii helper function
- Remove blank line

 drivers/net/ethernet/ti/cpsw.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1b1b78fdc138..b2b30c9df037 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1014,7 +1014,8 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave,
 		/* set speed_in input in case RMII mode is used in 100Mbps */
 		if (phy->speed == 100)
 			mac_control |= BIT(15);
-		else if (phy->speed == 10)
+		/* in band mode only works in 10Mbps RGMII mode */
+		else if ((phy->speed == 10) && phy_interface_is_rgmii(phy))
 			mac_control |= BIT(18); /* In Band mode */
 
 		if (priv->rx_pause)
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
  2018-03-15 16:56 [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface SZ Lin (林上智)
@ 2018-03-15 17:39 ` Grygorii Strashko
  2018-03-15 18:18   ` Grygorii Strashko
  2018-03-17 23:50 ` David Miller
  1 sibling, 1 reply; 6+ messages in thread
From: Grygorii Strashko @ 2018-03-15 17:39 UTC (permalink / raw)
  To: SZ Lin (林上智)
  Cc: Schuyler Patton, David S. Miller, Ivan Khoronzhuk, Keerthy,
	Sekhar Nori, linux-omap, netdev, linux-kernel



On 03/15/2018 11:56 AM, SZ Lin (林上智) wrote:
> According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and
> DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register is only
> available when PHY is configured in RGMII mode with 10Mbps speed. It will
> cause some networking issues without RGMII mode, such as carrier sense
> errors and low throughput. TI also mentioned this issue in their forum[4].
> 
> This patch adds the check mechanism for PHY interface with RGMII interface
> type, the in-band mode can only be set in RGMII mode with 10Mbps speed.
> 
> References:
> [1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
> [2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf
> [3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf
> [4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155
> 
> Suggested-by: Holsety Chen (陳憲輝) <Holsety.Chen@moxa.com>
> Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
> Signed-off-by: Schuyler Patton <spatton@ti.com>
> ---
> Changes from v1:
> - Use phy_interface_is_rgmii helper function
> - Remove blank line
> 

Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

>   drivers/net/ethernet/ti/cpsw.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
> index 1b1b78fdc138..b2b30c9df037 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -1014,7 +1014,8 @@ static void _cpsw_adjust_link(struct cpsw_slave *slave,
>   		/* set speed_in input in case RMII mode is used in 100Mbps */
>   		if (phy->speed == 100)
>   			mac_control |= BIT(15);
> -		else if (phy->speed == 10)
> +		/* in band mode only works in 10Mbps RGMII mode */
> +		else if ((phy->speed == 10) && phy_interface_is_rgmii(phy))
>   			mac_control |= BIT(18); /* In Band mode */
>   
>   		if (priv->rx_pause)
> 

-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
  2018-03-15 17:39 ` Grygorii Strashko
@ 2018-03-15 18:18   ` Grygorii Strashko
  2018-03-15 18:29     ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Grygorii Strashko @ 2018-03-15 18:18 UTC (permalink / raw)
  To: SZ Lin (林上智), David S. Miller
  Cc: Schuyler Patton, Ivan Khoronzhuk, Keerthy, Sekhar Nori,
	linux-omap, netdev, linux-kernel



On 03/15/2018 12:39 PM, Grygorii Strashko wrote:
> 
> 
> On 03/15/2018 11:56 AM, SZ Lin (林上智) wrote:
>> According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and
>> DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register is 
>> only
>> available when PHY is configured in RGMII mode with 10Mbps speed. It will
>> cause some networking issues without RGMII mode, such as carrier sense
>> errors and low throughput. TI also mentioned this issue in their 
>> forum[4].
>>
>> This patch adds the check mechanism for PHY interface with RGMII 
>> interface
>> type, the in-band mode can only be set in RGMII mode with 10Mbps speed.
>>
>> References:
>> [1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
>> [2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf
>> [3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf
>> [4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155
>>
>> Suggested-by: Holsety Chen (陳憲輝) <Holsety.Chen@moxa.com>
>> Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
>> Signed-off-by: Schuyler Patton <spatton@ti.com>
>> ---
>> Changes from v1:
>> - Use phy_interface_is_rgmii helper function
>> - Remove blank line
>>
> 
> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
> 

Also could this be marked as stable material 4.9+?

-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
  2018-03-15 18:18   ` Grygorii Strashko
@ 2018-03-15 18:29     ` Florian Fainelli
  2018-03-15 19:19       ` Grygorii Strashko
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2018-03-15 18:29 UTC (permalink / raw)
  To: Grygorii Strashko, SZ Lin (林上智), David S. Miller
  Cc: Schuyler Patton, Ivan Khoronzhuk, Keerthy, Sekhar Nori,
	linux-omap, netdev, linux-kernel

On 03/15/2018 11:18 AM, Grygorii Strashko wrote:
> 
> 
> On 03/15/2018 12:39 PM, Grygorii Strashko wrote:
>>
>>
>> On 03/15/2018 11:56 AM, SZ Lin (林上智) wrote:
>>> According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and
>>> DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register
>>> is only
>>> available when PHY is configured in RGMII mode with 10Mbps speed. It
>>> will
>>> cause some networking issues without RGMII mode, such as carrier sense
>>> errors and low throughput. TI also mentioned this issue in their
>>> forum[4].
>>>
>>> This patch adds the check mechanism for PHY interface with RGMII
>>> interface
>>> type, the in-band mode can only be set in RGMII mode with 10Mbps speed.
>>>
>>> References:
>>> [1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
>>> [2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf
>>> [3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf
>>> [4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155
>>>
>>> Suggested-by: Holsety Chen (陳憲輝) <Holsety.Chen@moxa.com>
>>> Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
>>> Signed-off-by: Schuyler Patton <spatton@ti.com>
>>> ---
>>> Changes from v1:
>>> - Use phy_interface_is_rgmii helper function
>>> - Remove blank line
>>>
>>
>> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
>>
> 
> Also could this be marked as stable material 4.9+?

This is not how it works for networking changes, just make sure you
provide a "Fixes:" tag, and David would usually take care of queueing
the change to -stable accordingly:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.txt#n148
-- 
Florian

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
  2018-03-15 18:29     ` Florian Fainelli
@ 2018-03-15 19:19       ` Grygorii Strashko
  0 siblings, 0 replies; 6+ messages in thread
From: Grygorii Strashko @ 2018-03-15 19:19 UTC (permalink / raw)
  To: Florian Fainelli, SZ Lin (林上智), David S. Miller
  Cc: Schuyler Patton, Ivan Khoronzhuk, Keerthy, Sekhar Nori,
	linux-omap, netdev, linux-kernel



On 03/15/2018 01:29 PM, Florian Fainelli wrote:
> On 03/15/2018 11:18 AM, Grygorii Strashko wrote:
>>
>>
>> On 03/15/2018 12:39 PM, Grygorii Strashko wrote:
>>>
>>>
>>> On 03/15/2018 11:56 AM, SZ Lin (林上智) wrote:
>>>> According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and
>>>> DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register
>>>> is only
>>>> available when PHY is configured in RGMII mode with 10Mbps speed. It
>>>> will
>>>> cause some networking issues without RGMII mode, such as carrier sense
>>>> errors and low throughput. TI also mentioned this issue in their
>>>> forum[4].
>>>>
>>>> This patch adds the check mechanism for PHY interface with RGMII
>>>> interface
>>>> type, the in-band mode can only be set in RGMII mode with 10Mbps speed.
>>>>
>>>> References:
>>>> [1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
>>>> [2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf
>>>> [3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf
>>>> [4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155
>>>>
>>>> Suggested-by: Holsety Chen (陳憲輝) <Holsety.Chen@moxa.com>
>>>> Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
>>>> Signed-off-by: Schuyler Patton <spatton@ti.com>
>>>> ---
>>>> Changes from v1:
>>>> - Use phy_interface_is_rgmii helper function
>>>> - Remove blank line
>>>>
>>>
>>> Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
>>>
>>
>> Also could this be marked as stable material 4.9+?
> 
> This is not how it works for networking changes, just make sure you
> provide a "Fixes:" tag, and David would usually take care of queueing
> the change to -stable accordingly:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/netdev-FAQ.txt#n148
> 

Sry, I know that, but this patch fixes very old commit [1] and it can't be
applied to old Kernels without merge conflicts or build errors:(, 
so I've manually checked if it can be applied to most recent stable kernels
and noted kernel versions here.
Also there is dependency from phy_interface_is_rgmii() which was merged in v4.2.

[1] commit a81d8762d713 ("drivers: net cpsw: Enable In Band mode in cpsw for 10 mbps")
^ went in v3.13
-- 
regards,
-grygorii

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface
  2018-03-15 16:56 [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface SZ Lin (林上智)
  2018-03-15 17:39 ` Grygorii Strashko
@ 2018-03-17 23:50 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2018-03-17 23:50 UTC (permalink / raw)
  To: sz.lin
  Cc: spatton, grygorii.strashko, ivan.khoronzhuk, j-keerthy, nsekhar,
	linux-omap, netdev, linux-kernel

From: SZ Lin (林上智) <sz.lin@moxa.com>
Date: Fri, 16 Mar 2018 00:56:01 +0800

> According to AM335x TRM[1] 14.3.6.2, AM437x TRM[2] 15.3.6.2 and
> DRA7 TRM[3] 24.11.4.8.7.3.3, in-band mode in EXT_EN(bit18) register is only
> available when PHY is configured in RGMII mode with 10Mbps speed. It will
> cause some networking issues without RGMII mode, such as carrier sense
> errors and low throughput. TI also mentioned this issue in their forum[4].
> 
> This patch adds the check mechanism for PHY interface with RGMII interface
> type, the in-band mode can only be set in RGMII mode with 10Mbps speed.
> 
> References:
> [1]: https://www.ti.com/lit/ug/spruh73p/spruh73p.pdf
> [2]: http://www.ti.com/lit/ug/spruhl7h/spruhl7h.pdf
> [3]: http://www.ti.com/lit/ug/spruic2b/spruic2b.pdf
> [4]: https://e2e.ti.com/support/arm/sitara_arm/f/791/p/640765/2392155
> 
> Suggested-by: Holsety Chen (陳憲輝) <Holsety.Chen@moxa.com>
> Signed-off-by: SZ Lin (林上智) <sz.lin@moxa.com>
> Signed-off-by: Schuyler Patton <spatton@ti.com>

Applied and queued up for -stable, thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-03-17 23:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-15 16:56 [PATCH v2] net: ethernet: ti: cpsw: add check for in-band mode setting with RGMII PHY interface SZ Lin (林上智)
2018-03-15 17:39 ` Grygorii Strashko
2018-03-15 18:18   ` Grygorii Strashko
2018-03-15 18:29     ` Florian Fainelli
2018-03-15 19:19       ` Grygorii Strashko
2018-03-17 23:50 ` David Miller

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).