All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/4] net: Always align tx packets
@ 2018-03-28 12:38 Mario Six
  2018-03-28 12:38 ` [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible Mario Six
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Mario Six @ 2018-03-28 12:38 UTC (permalink / raw)
  To: u-boot

Make sure that TX packets are always cache-aligned.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 net/arp.c  | 3 ++-
 net/ping.c | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/arp.c b/net/arp.c
index 4c79e09ccb..191434f5e2 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -182,7 +182,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		    (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
 			udelay(5000);
 #endif
-		net_send_packet((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
+		memcpy(net_tx_packet, et, eth_hdr_size + ARP_HDR_SIZE);
+		net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);
 		return;

 	case ARPOP_REPLY:		/* arp reply */
diff --git a/net/ping.c b/net/ping.c
index 9508cf1160..db14209bf6 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -107,7 +107,8 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
 		icmph->type = ICMP_ECHO_REPLY;
 		icmph->checksum = 0;
 		icmph->checksum = compute_ip_checksum(icmph, len - IP_HDR_SIZE);
-		net_send_packet((uchar *)et, eth_hdr_size + len);
+		memcpy(net_tx_packet, et, eth_hdr_size + len);
+		net_send_packet(net_tx_packet, eth_hdr_size + len);
 		return;
 /*	default:
 		return;*/
--
2.16.1

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

* [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible
  2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
@ 2018-03-28 12:38 ` Mario Six
  2018-03-29  3:51   ` Joe Hershberger
  2018-03-28 12:38 ` [U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT Mario Six
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Mario Six @ 2018-03-28 12:38 UTC (permalink / raw)
  To: u-boot

On devices that have their first network interface provided by a FPGA,
the initialization of further interfaces will fail if the FPGA is not
yet programmed. This leads to problems during factory setup when the
data is supposed to be loaded over secondary netowork interfaces.

To avoid this, use the uclass_{first,next}_device_check functions to
initialize as many ethernet devices as possible.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 net/eth-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 240b596534..2877700ff4 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -396,7 +396,7 @@ int eth_initialize(void)
 	 * This is accomplished by attempting to probe each device and calling
 	 * their write_hwaddr() operation.
 	 */
-	uclass_first_device(UCLASS_ETH, &dev);
+	uclass_first_device_check(UCLASS_ETH, &dev);
 	if (!dev) {
 		printf("No ethernet found.\n");
 		bootstage_error(BOOTSTAGE_ID_NET_ETH_START);
@@ -425,7 +425,7 @@ int eth_initialize(void)

 			eth_write_hwaddr(dev);

-			uclass_next_device(&dev);
+			uclass_next_device_check(&dev);
 			num_devices++;
 		} while (dev);

--
2.16.1

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

* [U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT
  2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
  2018-03-28 12:38 ` [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible Mario Six
@ 2018-03-28 12:38 ` Mario Six
  2018-03-29  3:52   ` Joe Hershberger
  2018-03-28 12:38 ` [U-Boot] [PATCH 4/4] phylib: Don't re-define CONFIG_PHY_MARVELL Mario Six
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Mario Six @ 2018-03-28 12:38 UTC (permalink / raw)
  To: u-boot

Bus translations should be applied when reading the address of the sgmii
phy registers from the DT. Use ofnode_get_addr_index instead of the
plain ofnode_read_u32_default to fix this.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 drivers/net/tsec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index 6829e32dae..7a7ae1dccc 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -797,8 +797,9 @@ int tsec_probe(struct udevice *dev)
 
 	parent = ofnode_get_parent(phandle_args.node);
 	if (ofnode_valid(parent)) {
-		int reg = ofnode_read_u32_default(parent, "reg", 0);
-		priv->phyregs_sgmii = (struct tsec_mii_mng *)(reg + 0x520);
+		int reg = ofnode_get_addr_index(parent, 0);
+
+		priv->phyregs_sgmii = (struct tsec_mii_mng *)reg;
 	} else {
 		debug("No parent node for PHY?\n");
 		return -ENOENT;
-- 
2.16.1

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

* [U-Boot] [PATCH 4/4] phylib: Don't re-define CONFIG_PHY_MARVELL
  2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
  2018-03-28 12:38 ` [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible Mario Six
  2018-03-28 12:38 ` [U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT Mario Six
@ 2018-03-28 12:38 ` Mario Six
  2018-03-29  3:54   ` Joe Hershberger
  2018-03-29  3:50 ` [U-Boot] [PATCH 1/4] net: Always align tx packets Joe Hershberger
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 10+ messages in thread
From: Mario Six @ 2018-03-28 12:38 UTC (permalink / raw)
  To: u-boot

For certain boards, having CONFIG_PHY_MARVELL in the defconfig will
result in a redefinition warning, because it is also defined in
config_phylib_all_drivers.h.

Add a check to stop this redefinition, but keep it for those boards that
still don't have it in their defconfig.

Signed-off-by: Mario Six <mario.six@gdsys.cc>
---
 include/config_phylib_all_drivers.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/config_phylib_all_drivers.h b/include/config_phylib_all_drivers.h
index 496ef58db0..264f220c5f 100644
--- a/include/config_phylib_all_drivers.h
+++ b/include/config_phylib_all_drivers.h
@@ -15,7 +15,9 @@
 #ifdef CONFIG_PHYLIB
 
 #define CONFIG_PHY_VITESSE
+#ifndef CONFIG_PHY_MARVELL
 #define CONFIG_PHY_MARVELL
+#endif
 #define CONFIG_PHY_BROADCOM
 #define CONFIG_PHY_DAVICOM
 #define CONFIG_PHY_REALTEK
-- 
2.16.1

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

* [U-Boot] [PATCH 1/4] net: Always align tx packets
  2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
                   ` (2 preceding siblings ...)
  2018-03-28 12:38 ` [U-Boot] [PATCH 4/4] phylib: Don't re-define CONFIG_PHY_MARVELL Mario Six
@ 2018-03-29  3:50 ` Joe Hershberger
  2018-06-12 21:09 ` Joe Hershberger
  2018-06-13 19:01 ` [U-Boot] " Joe Hershberger
  5 siblings, 0 replies; 10+ messages in thread
From: Joe Hershberger @ 2018-03-29  3:50 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 28, 2018 at 7:38 AM, Mario Six <mario.six@gdsys.cc> wrote:
> Make sure that TX packets are always cache-aligned.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>
> ---
>  net/arp.c  | 3 ++-
>  net/ping.c | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/arp.c b/net/arp.c
> index 4c79e09ccb..191434f5e2 100644
> --- a/net/arp.c
> +++ b/net/arp.c
> @@ -182,7 +182,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
>                     (net_read_ip(&arp->ar_spa).s_addr & net_netmask.s_addr))
>                         udelay(5000);
>  #endif
> -               net_send_packet((uchar *)et, eth_hdr_size + ARP_HDR_SIZE);
> +               memcpy(net_tx_packet, et, eth_hdr_size + ARP_HDR_SIZE);
> +               net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE);

Rather than always incurring a copy here, why not have the device
driver that requires this do the copy?

>                 return;
>
>         case ARPOP_REPLY:               /* arp reply */
> diff --git a/net/ping.c b/net/ping.c
> index 9508cf1160..db14209bf6 100644
> --- a/net/ping.c
> +++ b/net/ping.c
> @@ -107,7 +107,8 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len)
>                 icmph->type = ICMP_ECHO_REPLY;
>                 icmph->checksum = 0;
>                 icmph->checksum = compute_ip_checksum(icmph, len - IP_HDR_SIZE);
> -               net_send_packet((uchar *)et, eth_hdr_size + len);
> +               memcpy(net_tx_packet, et, eth_hdr_size + len);
> +               net_send_packet(net_tx_packet, eth_hdr_size + len);
>                 return;
>  /*     default:
>                 return;*/
> --
> 2.16.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible
  2018-03-28 12:38 ` [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible Mario Six
@ 2018-03-29  3:51   ` Joe Hershberger
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Hershberger @ 2018-03-29  3:51 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 28, 2018 at 7:38 AM, Mario Six <mario.six@gdsys.cc> wrote:
> On devices that have their first network interface provided by a FPGA,
> the initialization of further interfaces will fail if the FPGA is not
> yet programmed. This leads to problems during factory setup when the
> data is supposed to be loaded over secondary netowork interfaces.
>
> To avoid this, use the uclass_{first,next}_device_check functions to
> initialize as many ethernet devices as possible.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>

Seems reasonable.

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT
  2018-03-28 12:38 ` [U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT Mario Six
@ 2018-03-29  3:52   ` Joe Hershberger
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Hershberger @ 2018-03-29  3:52 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 28, 2018 at 7:38 AM, Mario Six <mario.six@gdsys.cc> wrote:
> Bus translations should be applied when reading the address of the sgmii
> phy registers from the DT. Use ofnode_get_addr_index instead of the
> plain ofnode_read_u32_default to fix this.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] [PATCH 4/4] phylib: Don't re-define CONFIG_PHY_MARVELL
  2018-03-28 12:38 ` [U-Boot] [PATCH 4/4] phylib: Don't re-define CONFIG_PHY_MARVELL Mario Six
@ 2018-03-29  3:54   ` Joe Hershberger
  0 siblings, 0 replies; 10+ messages in thread
From: Joe Hershberger @ 2018-03-29  3:54 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 28, 2018 at 7:38 AM, Mario Six <mario.six@gdsys.cc> wrote:
> For certain boards, having CONFIG_PHY_MARVELL in the defconfig will
> result in a redefinition warning, because it is also defined in
> config_phylib_all_drivers.h.
>
> Add a check to stop this redefinition, but keep it for those boards that
> still don't have it in their defconfig.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>
> ---
>  include/config_phylib_all_drivers.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/include/config_phylib_all_drivers.h b/include/config_phylib_all_drivers.h
> index 496ef58db0..264f220c5f 100644
> --- a/include/config_phylib_all_drivers.h
> +++ b/include/config_phylib_all_drivers.h
> @@ -15,7 +15,9 @@
>  #ifdef CONFIG_PHYLIB
>
>  #define CONFIG_PHY_VITESSE
> +#ifndef CONFIG_PHY_MARVELL
>  #define CONFIG_PHY_MARVELL
> +#endif

How many boards are we talking about? Why not just add it to the defconfig?

>  #define CONFIG_PHY_BROADCOM
>  #define CONFIG_PHY_DAVICOM
>  #define CONFIG_PHY_REALTEK
> --
> 2.16.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> https://lists.denx.de/listinfo/u-boot

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

* [U-Boot] [PATCH 1/4] net: Always align tx packets
  2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
                   ` (3 preceding siblings ...)
  2018-03-29  3:50 ` [U-Boot] [PATCH 1/4] net: Always align tx packets Joe Hershberger
@ 2018-06-12 21:09 ` Joe Hershberger
  2018-06-13 19:01 ` [U-Boot] " Joe Hershberger
  5 siblings, 0 replies; 10+ messages in thread
From: Joe Hershberger @ 2018-06-12 21:09 UTC (permalink / raw)
  To: u-boot

On Wed, Mar 28, 2018 at 7:38 AM, Mario Six <mario.six@gdsys.cc> wrote:
> Make sure that TX packets are always cache-aligned.
>
> Signed-off-by: Mario Six <mario.six@gdsys.cc>

Acked-by: Joe Hershberger <joe.hershberger@ni.com>

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

* [U-Boot] net: Always align tx packets
  2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
                   ` (4 preceding siblings ...)
  2018-06-12 21:09 ` Joe Hershberger
@ 2018-06-13 19:01 ` Joe Hershberger
  5 siblings, 0 replies; 10+ messages in thread
From: Joe Hershberger @ 2018-06-13 19:01 UTC (permalink / raw)
  To: u-boot

Hi Mario,

https://patchwork.ozlabs.org/patch/892179/ was applied to http://git.denx.de/?p=u-boot/u-boot-net.git

Thanks!
-Joe

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

end of thread, other threads:[~2018-06-13 19:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28 12:38 [U-Boot] [PATCH 1/4] net: Always align tx packets Mario Six
2018-03-28 12:38 ` [U-Boot] [PATCH 2/4] net: Initialize as many ethernet devices as possible Mario Six
2018-03-29  3:51   ` Joe Hershberger
2018-03-28 12:38 ` [U-Boot] [PATCH 3/4] tsec: Fix reading phy registers from DT Mario Six
2018-03-29  3:52   ` Joe Hershberger
2018-03-28 12:38 ` [U-Boot] [PATCH 4/4] phylib: Don't re-define CONFIG_PHY_MARVELL Mario Six
2018-03-29  3:54   ` Joe Hershberger
2018-03-29  3:50 ` [U-Boot] [PATCH 1/4] net: Always align tx packets Joe Hershberger
2018-06-12 21:09 ` Joe Hershberger
2018-06-13 19:01 ` [U-Boot] " Joe Hershberger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.