Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] ptp: fix typo of "mechanism" in Kconfig help text
@ 2019-10-07 15:43 Antonio Borneo
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix length of PTP clock's name string Antonio Borneo
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Antonio Borneo @ 2019-10-07 15:43 UTC (permalink / raw)
  To: Richard Cochran, netdev; +Cc: Antonio Borneo, linux-kernel

Fix typo s/mechansim/mechanism/

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
---
 drivers/ptp/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index 960961fb0d7c..0517272a268e 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -97,8 +97,8 @@ config PTP_1588_CLOCK_PCH
 	help
 	  This driver adds support for using the PCH EG20T as a PTP
 	  clock. The hardware supports time stamping of PTP packets
-	  when using the end-to-end delay (E2E) mechansim. The peer
-	  delay mechansim (P2P) is not supported.
+	  when using the end-to-end delay (E2E) mechanism. The peer
+	  delay mechanism (P2P) is not supported.
 
 	  This clock is only useful if your PTP programs are getting
 	  hardware time stamps on the PTP Ethernet packets using the
-- 
2.23.0


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

* [PATCH] net: stmmac: fix length of PTP clock's name string
  2019-10-07 15:43 [PATCH] ptp: fix typo of "mechanism" in Kconfig help text Antonio Borneo
@ 2019-10-07 15:43 ` Antonio Borneo
  2019-10-09 23:10   ` Jakub Kicinski
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix disabling flexible PPS output Antonio Borneo
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Antonio Borneo @ 2019-10-07 15:43 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, netdev
  Cc: Antonio Borneo, Maxime Coquelin, linux-stm32, linux-arm-kernel,
	linux-kernel

The field "name" in struct ptp_clock_info has a fixed size of 16
chars and is used as zero terminated string by clock_name_show()
in drivers/ptp/ptp_sysfs.c
The current initialization value requires 17 chars to fit also the
null termination, and this causes overflow to the next bytes in
the struct when the string is read as null terminated:
	hexdump -C /sys/class/ptp/ptp0/clock_name
	00000000  73 74 6d 6d 61 63 5f 70  74 70 5f 63 6c 6f 63 6b  |stmmac_ptp_clock|
	00000010  a0 ac b9 03 0a                                    |.....|
where the extra 4 bytes (excluding the newline) after the string
represent the integer 0x03b9aca0 = 62500000 assigned to the field
"max_adj" that follows "name" in the same struct.

There is no strict requirement for the "name" content and in the
comment in ptp_clock_kernel.h it's reported it should just be 'A
short "friendly name" to identify the clock'.
Replace it with "stmmac ptp".

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Fixes: 92ba6888510c ("stmmac: add the support for PTP hw clock driver")
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
index 173493db038c..df638b18b72c 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c
@@ -164,7 +164,7 @@ static int stmmac_enable(struct ptp_clock_info *ptp,
 /* structure describing a PTP hardware clock */
 static struct ptp_clock_info stmmac_ptp_clock_ops = {
 	.owner = THIS_MODULE,
-	.name = "stmmac_ptp_clock",
+	.name = "stmmac ptp",
 	.max_adj = 62500000,
 	.n_alarm = 0,
 	.n_ext_ts = 0,
-- 
2.23.0


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

* [PATCH] net: stmmac: fix disabling flexible PPS output
  2019-10-07 15:43 [PATCH] ptp: fix typo of "mechanism" in Kconfig help text Antonio Borneo
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix length of PTP clock's name string Antonio Borneo
@ 2019-10-07 15:43 ` Antonio Borneo
  2019-10-09 23:10   ` Jakub Kicinski
  2019-10-07 15:43 ` [PATCH] net: stmmac: add flexible PPS to dwmac 4.10a Antonio Borneo
  2019-10-07 19:04 ` [PATCH] ptp: fix typo of "mechanism" in Kconfig help text David Miller
  3 siblings, 1 reply; 8+ messages in thread
From: Antonio Borneo @ 2019-10-07 15:43 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, netdev
  Cc: Antonio Borneo, Maxime Coquelin, linux-stm32, linux-arm-kernel,
	linux-kernel

Accordingly to Synopsys documentation [1] and [2], when bit PPSEN0
in register MAC_PPS_CONTROL is set it selects the functionality
command in the same register, otherwise selects the functionality
control.
Command functionality is required to either enable (command 0x2)
and disable (command 0x5) the flexible PPS output, but the bit
PPSEN0 is currently set only for enabling.

Set the bit PPSEN0 to properly disable flexible PPS output.

Tested on STM32MP15x, based on dwmac 4.10a.

[1] DWC Ethernet QoS Databook 4.10a October 2014
[2] DWC Ethernet QoS Databook 5.00a September 2017

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Fixes: 9a8a02c9d46d ("net: stmmac: Add Flexible PPS support")
---
 drivers/net/ethernet/stmicro/stmmac/dwmac5.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
index 3f4f3132e16b..e436fa160c7d 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
@@ -515,6 +515,7 @@ int dwmac5_flex_pps_config(void __iomem *ioaddr, int index,
 
 	if (!enable) {
 		val |= PPSCMDx(index, 0x5);
+		val |= PPSEN0;
 		writel(val, ioaddr + MAC_PPS_CONTROL);
 		return 0;
 	}
-- 
2.23.0


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

* [PATCH] net: stmmac: add flexible PPS to dwmac 4.10a
  2019-10-07 15:43 [PATCH] ptp: fix typo of "mechanism" in Kconfig help text Antonio Borneo
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix length of PTP clock's name string Antonio Borneo
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix disabling flexible PPS output Antonio Borneo
@ 2019-10-07 15:43 ` Antonio Borneo
  2019-10-09 22:26   ` Jakub Kicinski
  2019-10-07 19:04 ` [PATCH] ptp: fix typo of "mechanism" in Kconfig help text David Miller
  3 siblings, 1 reply; 8+ messages in thread
From: Antonio Borneo @ 2019-10-07 15:43 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, netdev
  Cc: Antonio Borneo, Maxime Coquelin, linux-stm32, linux-arm-kernel,
	linux-kernel

All the registers and the functionalities used in the callback
dwmac5_flex_pps_config() are common between dwmac 4.10a [1] and
5.00a [2].

Reuse the same callback for dwmac 4.10a too.

Tested on STM32MP15x, based on dwmac 4.10a.

[1] DWC Ethernet QoS Databook 4.10a October 2014
[2] DWC Ethernet QoS Databook 5.00a September 2017

Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
index 2cb9c53f93b8..3006047213ea 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c
@@ -864,6 +864,7 @@ const struct stmmac_ops dwmac410_ops = {
 	.pcs_get_adv_lp = dwmac4_get_adv_lp,
 	.debug = dwmac4_debug,
 	.set_filter = dwmac4_set_filter,
+	.flex_pps_config = dwmac5_flex_pps_config,
 	.set_mac_loopback = dwmac4_set_mac_loopback,
 	.update_vlan_hash = dwmac4_update_vlan_hash,
 	.sarc_configure = dwmac4_sarc_configure,
-- 
2.23.0


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

* Re: [PATCH] ptp: fix typo of "mechanism" in Kconfig help text
  2019-10-07 15:43 [PATCH] ptp: fix typo of "mechanism" in Kconfig help text Antonio Borneo
                   ` (2 preceding siblings ...)
  2019-10-07 15:43 ` [PATCH] net: stmmac: add flexible PPS to dwmac 4.10a Antonio Borneo
@ 2019-10-07 19:04 ` David Miller
  3 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2019-10-07 19:04 UTC (permalink / raw)
  To: antonio.borneo; +Cc: richardcochran, netdev, linux-kernel

From: Antonio Borneo <antonio.borneo@st.com>
Date: Mon, 7 Oct 2019 17:43:02 +0200

> Fix typo s/mechansim/mechanism/
> 
> Signed-off-by: Antonio Borneo <antonio.borneo@st.com>

Applied, thank you.

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

* Re: [PATCH] net: stmmac: add flexible PPS to dwmac 4.10a
  2019-10-07 15:43 ` [PATCH] net: stmmac: add flexible PPS to dwmac 4.10a Antonio Borneo
@ 2019-10-09 22:26   ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2019-10-09 22:26 UTC (permalink / raw)
  To: Antonio Borneo
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, netdev, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

On Mon, 7 Oct 2019 17:43:06 +0200, Antonio Borneo wrote:
> All the registers and the functionalities used in the callback
> dwmac5_flex_pps_config() are common between dwmac 4.10a [1] and
> 5.00a [2].
> 
> Reuse the same callback for dwmac 4.10a too.
> 
> Tested on STM32MP15x, based on dwmac 4.10a.
> 
> [1] DWC Ethernet QoS Databook 4.10a October 2014
> [2] DWC Ethernet QoS Databook 5.00a September 2017
> 
> Signed-off-by: Antonio Borneo <antonio.borneo@st.com>

Applied to net-next.

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

* Re: [PATCH] net: stmmac: fix disabling flexible PPS output
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix disabling flexible PPS output Antonio Borneo
@ 2019-10-09 23:10   ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2019-10-09 23:10 UTC (permalink / raw)
  To: Antonio Borneo
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, netdev, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

On Mon, 7 Oct 2019 17:43:05 +0200, Antonio Borneo wrote:
> Accordingly to Synopsys documentation [1] and [2], when bit PPSEN0
> in register MAC_PPS_CONTROL is set it selects the functionality
> command in the same register, otherwise selects the functionality
> control.
> Command functionality is required to either enable (command 0x2)
> and disable (command 0x5) the flexible PPS output, but the bit
> PPSEN0 is currently set only for enabling.
> 
> Set the bit PPSEN0 to properly disable flexible PPS output.
> 
> Tested on STM32MP15x, based on dwmac 4.10a.
> 
> [1] DWC Ethernet QoS Databook 4.10a October 2014
> [2] DWC Ethernet QoS Databook 5.00a September 2017
> 
> Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
> Fixes: 9a8a02c9d46d ("net: stmmac: Add Flexible PPS support")

Applied to net, queued for stable.

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

* Re: [PATCH] net: stmmac: fix length of PTP clock's name string
  2019-10-07 15:43 ` [PATCH] net: stmmac: fix length of PTP clock's name string Antonio Borneo
@ 2019-10-09 23:10   ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2019-10-09 23:10 UTC (permalink / raw)
  To: Antonio Borneo
  Cc: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, netdev, Maxime Coquelin, linux-stm32,
	linux-arm-kernel, linux-kernel

On Mon, 7 Oct 2019 17:43:04 +0200, Antonio Borneo wrote:
> The field "name" in struct ptp_clock_info has a fixed size of 16
> chars and is used as zero terminated string by clock_name_show()
> in drivers/ptp/ptp_sysfs.c
> The current initialization value requires 17 chars to fit also the
> null termination, and this causes overflow to the next bytes in
> the struct when the string is read as null terminated:
> 	hexdump -C /sys/class/ptp/ptp0/clock_name
> 	00000000  73 74 6d 6d 61 63 5f 70  74 70 5f 63 6c 6f 63 6b  |stmmac_ptp_clock|
> 	00000010  a0 ac b9 03 0a                                    |.....|
> where the extra 4 bytes (excluding the newline) after the string
> represent the integer 0x03b9aca0 = 62500000 assigned to the field
> "max_adj" that follows "name" in the same struct.
> 
> There is no strict requirement for the "name" content and in the
> comment in ptp_clock_kernel.h it's reported it should just be 'A
> short "friendly name" to identify the clock'.
> Replace it with "stmmac ptp".
> 
> Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
> Fixes: 92ba6888510c ("stmmac: add the support for PTP hw clock driver")

Applied to net, queued for stable.

For future submissions please indicate the target tree. Networking fixes
should go to the net tree and have [PATCH net] in the subject, while
normal patches such as new features and clean ups should be tagged as
[PATCH net-next].

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

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-07 15:43 [PATCH] ptp: fix typo of "mechanism" in Kconfig help text Antonio Borneo
2019-10-07 15:43 ` [PATCH] net: stmmac: fix length of PTP clock's name string Antonio Borneo
2019-10-09 23:10   ` Jakub Kicinski
2019-10-07 15:43 ` [PATCH] net: stmmac: fix disabling flexible PPS output Antonio Borneo
2019-10-09 23:10   ` Jakub Kicinski
2019-10-07 15:43 ` [PATCH] net: stmmac: add flexible PPS to dwmac 4.10a Antonio Borneo
2019-10-09 22:26   ` Jakub Kicinski
2019-10-07 19:04 ` [PATCH] ptp: fix typo of "mechanism" in Kconfig help text David Miller

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org netdev@archiver.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/ public-inbox