diff options
author | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
---|---|---|
committer | takeshi_hoshina <takeshi_hoshina@mail.toyota.co.jp> | 2020-11-02 11:07:33 +0900 |
commit | 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf (patch) | |
tree | cd70a267a5ef105ba32f200aa088e281fbd85747 /bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp | |
parent | 4204309872da5cb401cbb2729d9e2d4869a87f42 (diff) |
basesystem-jjsandbox/ToshikazuOhiwa/master-jj
recipes
Diffstat (limited to 'bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp')
15 files changed, 800 insertions, 6 deletions
diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0003-plat-renesas-rcar-Add-R-Car-V3M-support.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0003-plat-renesas-rcar-Add-R-Car-V3M-support.patch index 08b0cd4a..d6a6f6d5 100644 --- a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0003-plat-renesas-rcar-Add-R-Car-V3M-support.patch +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0003-plat-renesas-rcar-Add-R-Car-V3M-support.patch @@ -123,7 +123,7 @@ index 2377cd2..32a6746 100644 case RCAR_PRODUCT_M3N: bl2_realtime_cpg_init_m3n(); break; -+ case RCAR_PRODUCT_v3m: ++ case RCAR_PRODUCT_V3M: + bl2_realtime_cpg_init_v3m(); + break; default: diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0004-plat-renesas-rcar-Add-R-Car-V3H-support.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0004-plat-renesas-rcar-Add-R-Car-V3H-support.patch index 9d2c7b95..841db094 100644 --- a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0004-plat-renesas-rcar-Add-R-Car-V3H-support.patch +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/arm-trusted-firmware/files/0004-plat-renesas-rcar-Add-R-Car-V3H-support.patch @@ -110,10 +110,10 @@ index 32a6746..1481029 100644 { uint32_t modemr; @@ -454,6 +512,9 @@ void bl2_cpg_init(void) - case RCAR_PRODUCT_v3m: + case RCAR_PRODUCT_V3M: bl2_realtime_cpg_init_v3m(); break; -+ case RCAR_PRODUCT_v3h: ++ case RCAR_PRODUCT_V3H: + bl2_realtime_cpg_init_v3h(); + break; default: diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/linux-firmware/linux-firmware_git.bbappend b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/linux-firmware/linux-firmware_20200122.bbappend index fdee4b08..fdee4b08 100644 --- a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/linux-firmware/linux-firmware_git.bbappend +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/linux-firmware/linux-firmware_20200122.bbappend diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz Binary files differindex f1eaacb7..e13d1343 100644 --- a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/most-tools/files/most-tools.tar.gz diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0022-arm-dts-r8a77970-Disable-RPC-on-all-R-Car-V3M-boards.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0022-arm-dts-r8a77970-Disable-RPC-on-all-R-Car-V3M-boards.patch new file mode 100644 index 00000000..c756eafe --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0022-arm-dts-r8a77970-Disable-RPC-on-all-R-Car-V3M-boards.patch @@ -0,0 +1,58 @@ +From a807c19c45eb347a2d5b4391ff396b94a875d9dc Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Tue, 26 Nov 2019 21:52:37 +0300 +Subject: [PATCH 1/2] arm: dts: r8a77970: Disable RPC on all R-Car V3M boards + +This disables RPC device on all R-Car V3M boards. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + arch/arm/dts/r8a77970-eagle-u-boot.dts | 4 ++-- + arch/arm/dts/r8a77970-v3msk-u-boot.dts | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/dts/r8a77970-eagle-u-boot.dts b/arch/arm/dts/r8a77970-eagle-u-boot.dts +index 5b17f1d..6c910c2 100644 +--- a/arch/arm/dts/r8a77970-eagle-u-boot.dts ++++ b/arch/arm/dts/r8a77970-eagle-u-boot.dts +@@ -36,7 +36,7 @@ + + &rpc { + num-cs = <1>; +- status = "okay"; ++ status = "disabled"; + spi-max-frequency = <50000000>; + #address-cells = <1>; + #size-cells = <0>; +@@ -49,6 +49,6 @@ + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + reg = <0>; +- status = "okay"; ++ status = "disabled"; + }; + }; +diff --git a/arch/arm/dts/r8a77970-v3msk-u-boot.dts b/arch/arm/dts/r8a77970-v3msk-u-boot.dts +index 6ee06d7..5ae02ae 100644 +--- a/arch/arm/dts/r8a77970-v3msk-u-boot.dts ++++ b/arch/arm/dts/r8a77970-v3msk-u-boot.dts +@@ -47,7 +47,7 @@ + + &rpc { + num-cs = <1>; +- status = "okay"; ++ status = "disabled"; + spi-max-frequency = <50000000>; + #address-cells = <1>; + #size-cells = <0>; +@@ -60,6 +60,6 @@ + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + reg = <0>; +- status = "okay"; ++ status = "disabled"; + }; + }; +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0023-arm-dts-r8a77980-Disable-RPC-on-all-R-Car-V3H-boards.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0023-arm-dts-r8a77980-Disable-RPC-on-all-R-Car-V3H-boards.patch new file mode 100644 index 00000000..1819c8d9 --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0023-arm-dts-r8a77980-Disable-RPC-on-all-R-Car-V3H-boards.patch @@ -0,0 +1,59 @@ +From 076a4721fde3f02eca24e4e3a218b35c62127cb9 Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Tue, 26 Nov 2019 21:53:28 +0300 +Subject: [PATCH 2/2] arm: dts: r8a77980: Disable RPC on all R-Car V3H boards + +This disables RPC device on all R-Car V3H boards. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + arch/arm/dts/r8a77980-condor-u-boot.dts | 4 ++-- + arch/arm/dts/r8a77980-v3hsk-u-boot.dts | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/dts/r8a77980-condor-u-boot.dts b/arch/arm/dts/r8a77980-condor-u-boot.dts +index 68897ed..8a101bf 100644 +--- a/arch/arm/dts/r8a77980-condor-u-boot.dts ++++ b/arch/arm/dts/r8a77980-condor-u-boot.dts +@@ -16,7 +16,7 @@ + + &rpc { + num-cs = <1>; +- status = "okay"; ++ status = "disabled"; + spi-max-frequency = <50000000>; + #address-cells = <1>; + #size-cells = <0>; +@@ -29,6 +29,6 @@ + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + reg = <0>; +- status = "okay"; ++ status = "disabled"; + }; + }; +diff --git a/arch/arm/dts/r8a77980-v3hsk-u-boot.dts b/arch/arm/dts/r8a77980-v3hsk-u-boot.dts +index d083df6..4842314 100644 +--- a/arch/arm/dts/r8a77980-v3hsk-u-boot.dts ++++ b/arch/arm/dts/r8a77980-v3hsk-u-boot.dts +@@ -16,7 +16,7 @@ + + &rpc { + num-cs = <1>; +- status = "okay"; ++ status = "disabled"; + spi-max-frequency = <50000000>; + #address-cells = <1>; + #size-cells = <0>; +@@ -29,7 +29,7 @@ + spi-tx-bus-width = <1>; + spi-rx-bus-width = <1>; + reg = <0>; +- status = "okay"; ++ status = "disabled"; + }; + }; + +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0024-mmc-mmc-Set-clock-when-reverting-to-safe-bus-mode.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0024-mmc-mmc-Set-clock-when-reverting-to-safe-bus-mode.patch new file mode 100644 index 00000000..3f695c74 --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0024-mmc-mmc-Set-clock-when-reverting-to-safe-bus-mode.patch @@ -0,0 +1,29 @@ +From d299ca847ab26f76fcd49eb14aecff9ea37b1bc8 Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Fri, 25 Oct 2019 01:06:46 +0300 +Subject: [PATCH] mmc: mmc: Set clock when reverting to safe bus mode + +Set MMC clock when reverting to safe bus mode and speed +in case current MMC mode fails. Otherwise, trying out +the other modes may fail as well. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + drivers/mmc/mmc.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c +index 0cecb10..b3f29ee 100644 +--- a/drivers/mmc/mmc.c ++++ b/drivers/mmc/mmc.c +@@ -2033,6 +2033,7 @@ error: + mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL, + EXT_CSD_BUS_WIDTH, EXT_CSD_BUS_WIDTH_1); + mmc_select_mode(mmc, MMC_LEGACY); ++ mmc_set_clock(mmc, mmc->tran_speed, MMC_CLK_ENABLE); + mmc_set_bus_width(mmc, 1); + } + } +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0025-net-Add-an-accessor-to-know-if-waiting-for-ARP.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0025-net-Add-an-accessor-to-know-if-waiting-for-ARP.patch new file mode 100644 index 00000000..96cac426 --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0025-net-Add-an-accessor-to-know-if-waiting-for-ARP.patch @@ -0,0 +1,66 @@ +From 3ce40bb31bf1785bfa541805ada5f5f872a683a6 Mon Sep 17 00:00:00 2001 +From: Joe Hershberger <joe.hershberger@ni.com> +Date: Wed, 26 Sep 2018 16:48:58 -0500 +Subject: [PATCH 1/2] net: Add an accessor to know if waiting for ARP + +This single-sources the state of the ARP. + +Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> +Reviewed-by: Simon Glass <sjg@chromium.org> +Reviewed-by: Bin Meng <bmeng.cn@gmail.com> + +(cherry picked from commit 3f02c98bd1000fc26ee2700fd5a75112cdeaca6c) +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + include/net.h | 1 + + net/arp.c | 11 ++++++++--- + 2 files changed, 9 insertions(+), 3 deletions(-) + +diff --git a/include/net.h b/include/net.h +index 2b2deb5..259c4a7 100644 +--- a/include/net.h ++++ b/include/net.h +@@ -635,6 +635,7 @@ rxhand_f *net_get_udp_handler(void); /* Get UDP RX packet handler */ + void net_set_udp_handler(rxhand_f *); /* Set UDP RX packet handler */ + rxhand_f *net_get_arp_handler(void); /* Get ARP RX packet handler */ + void net_set_arp_handler(rxhand_f *); /* Set ARP RX packet handler */ ++bool arp_is_waiting(void); /* Waiting for ARP reply? */ + void net_set_icmp_handler(rxhand_icmp_f *f); /* Set ICMP RX handler */ + void net_set_timeout_handler(ulong, thand_f *);/* Set timeout handler */ + +diff --git a/net/arp.c b/net/arp.c +index b8a7168..ea685d9 100644 +--- a/net/arp.c ++++ b/net/arp.c +@@ -100,7 +100,7 @@ int arp_timeout_check(void) + { + ulong t; + +- if (!net_arp_wait_packet_ip.s_addr) ++ if (!arp_is_waiting()) + return 0; + + t = get_timer(0); +@@ -187,8 +187,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) + return; + + case ARPOP_REPLY: /* arp reply */ +- /* are we waiting for a reply */ +- if (!net_arp_wait_packet_ip.s_addr) ++ /* are we waiting for a reply? */ ++ if (!arp_is_waiting()) + break; + + #ifdef CONFIG_KEEP_SERVERADDR +@@ -233,3 +233,8 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) + return; + } + } ++ ++bool arp_is_waiting(void) ++{ ++ return !!net_arp_wait_packet_ip.s_addr; ++} +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0026-net-Don-t-overwrite-waiting-packets-with-asynchronou.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0026-net-Don-t-overwrite-waiting-packets-with-asynchronou.patch new file mode 100644 index 00000000..3456ac1f --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0026-net-Don-t-overwrite-waiting-packets-with-asynchronou.patch @@ -0,0 +1,158 @@ +From c8ecac854c314fa4bf8955991ca59c178ced8a64 Mon Sep 17 00:00:00 2001 +From: Joe Hershberger <joe.hershberger@ni.com> +Date: Wed, 26 Sep 2018 16:49:02 -0500 +Subject: [PATCH 2/2] net: Don't overwrite waiting packets with asynchronous + replies + +Peter originally sent a fix, but it breaks a number of other things. +This addresses the original reported issue in a different way. + +That report was: + +> U-Boot has 1 common buffer to send Ethernet frames, pointed to by +> net_tx_packet. When sending to an IP address without knowing the MAC +> address, U-Boot makes an ARP request (using the arp_tx_packet buffer) +> to find out the MAC address of the IP addressr. When a matching ARP +> reply is received, U-Boot continues sending the frame stored in the +> net_tx_packet buffer. +> +> However, in the mean time, if U-Boot needs to send out any network +> packets (e.g. replying ping packets or ARP requests for its own IP +> address etc.), it will use the net_tx_packet buffer to prepare the +> new packet. Thus this buffer is no longer the original packet meant +> to be transmitted after the ARP reply. The original packet will be +> lost. + +This instead uses the ARP tx buffer to send async replies in the case +where we are actively waiting for an ARP reply. + +Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> + +Reported-by: Tran Tien Dat <peter.trantiendat@gmail.com> +Reviewed-by: Simon Glass <sjg@chromium.org> +Reviewed-by: Bin Meng <bmeng.cn@gmail.com> +Tested-by: Bin Meng <bmeng.cn@gmail.com> + +(cherry picked from commit ac3f26cc15ad7e3e9efc2b0b0e18c6e84d93af77) +[valentine.barshak: removed test/dm/eth.c part as not applicable] +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + include/net.h | 8 ++++++++ + net/arp.c | 9 +++++---- + net/arp.h | 1 + + net/net.c | 8 ++++++++ + net/ping.c | 7 +++++-- + 5 files changed, 27 insertions(+), 6 deletions(-) + +diff --git a/include/net.h b/include/net.h +index 259c4a7..a789a38 100644 +--- a/include/net.h ++++ b/include/net.h +@@ -654,6 +654,14 @@ static inline void net_set_state(enum net_loop_state state) + net_state = state; + } + ++/* ++ * net_get_async_tx_pkt_buf - Get a packet buffer that is not in use for ++ * sending an asynchronous reply ++ * ++ * returns - ptr to packet buffer ++ */ ++uchar * net_get_async_tx_pkt_buf(void); ++ + /* Transmit a packet */ + static inline void net_send_packet(uchar *pkt, int len) + { +diff --git a/net/arp.c b/net/arp.c +index ea685d9..b49c3d3 100644 +--- a/net/arp.c ++++ b/net/arp.c +@@ -34,8 +34,7 @@ uchar *arp_wait_packet_ethaddr; + int arp_wait_tx_packet_size; + ulong arp_wait_timer_start; + int arp_wait_try; +- +-static uchar *arp_tx_packet; /* THE ARP transmit packet */ ++uchar *arp_tx_packet; /* THE ARP transmit packet */ + static uchar arp_tx_packet_buf[PKTSIZE_ALIGN + PKTALIGN]; + + void arp_init(void) +@@ -126,6 +125,7 @@ void arp_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) + struct arp_hdr *arp; + struct in_addr reply_ip_addr; + int eth_hdr_size; ++ uchar *tx_packet; + + /* + * We have to deal with two types of ARP packets: +@@ -182,8 +182,9 @@ 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 +- memcpy(net_tx_packet, et, eth_hdr_size + ARP_HDR_SIZE); +- net_send_packet(net_tx_packet, eth_hdr_size + ARP_HDR_SIZE); ++ tx_packet = net_get_async_tx_pkt_buf(); ++ memcpy(tx_packet, et, eth_hdr_size + ARP_HDR_SIZE); ++ net_send_packet(tx_packet, eth_hdr_size + ARP_HDR_SIZE); + return; + + case ARPOP_REPLY: /* arp reply */ +diff --git a/net/arp.h b/net/arp.h +index afb8695..25b3c00 100644 +--- a/net/arp.h ++++ b/net/arp.h +@@ -20,6 +20,7 @@ extern uchar *arp_wait_packet_ethaddr; + extern int arp_wait_tx_packet_size; + extern ulong arp_wait_timer_start; + extern int arp_wait_try; ++extern uchar *arp_tx_packet; + + void arp_init(void); + void arp_request(void); +diff --git a/net/net.c b/net/net.c +index 31cf306..77a7141 100644 +--- a/net/net.c ++++ b/net/net.c +@@ -799,6 +799,14 @@ void net_set_timeout_handler(ulong iv, thand_f *f) + } + } + ++uchar *net_get_async_tx_pkt_buf(void) ++{ ++ if (arp_is_waiting()) ++ return arp_tx_packet; /* If we are waiting, we already sent */ ++ else ++ return net_tx_packet; ++} ++ + int net_send_udp_packet(uchar *ether, struct in_addr dest, int dport, int sport, + int payload_len) + { +diff --git a/net/ping.c b/net/ping.c +index 3e5461a..821d35d 100644 +--- a/net/ping.c ++++ b/net/ping.c +@@ -84,6 +84,7 @@ void ping_receive(struct ethernet_hdr *et, struct ip_udp_hdr *ip, int len) + struct icmp_hdr *icmph = (struct icmp_hdr *)&ip->udp_src; + struct in_addr src_ip; + int eth_hdr_size; ++ uchar *tx_packet; + + switch (icmph->type) { + case ICMP_ECHO_REPLY: +@@ -107,8 +108,10 @@ 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); +- memcpy(net_tx_packet, et, eth_hdr_size + len); +- net_send_packet(net_tx_packet, eth_hdr_size + len); ++ ++ tx_packet = net_get_async_tx_pkt_buf(); ++ memcpy(tx_packet, et, eth_hdr_size + len); ++ net_send_packet(tx_packet, eth_hdr_size + len); + return; + /* default: + return;*/ +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0027-net-sh_eth-Keep-phy-running.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0027-net-sh_eth-Keep-phy-running.patch new file mode 100644 index 00000000..38f7f0e0 --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0027-net-sh_eth-Keep-phy-running.patch @@ -0,0 +1,126 @@ +From 04b535af397c8302f306952e09d531fc96fe523e Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Wed, 27 Nov 2019 03:46:52 +0300 +Subject: [PATCH 1/4] net: sh_eth: Keep phy running + +This doesn't stop the PHY, and disable the clock once the Ethernet +transfer is complete. We need PHY initialized for the "mii" console +commands to work. This also reduces Ethernet start time since we +don't have to reinitialize the PHY and restart auto-negotiation +every time an Ethernet command is issued. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + drivers/net/sh_eth.c | 52 +++++++++++++++++++++++++++------------------------- + 1 file changed, 27 insertions(+), 25 deletions(-) + +diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c +index be8c3d2..b120977 100644 +--- a/drivers/net/sh_eth.c ++++ b/drivers/net/sh_eth.c +@@ -778,35 +778,17 @@ static int sh_eth_phy_config(struct udevice *dev) + static int sh_ether_start(struct udevice *dev) + { + struct sh_ether_priv *priv = dev_get_priv(dev); +- struct eth_pdata *pdata = dev_get_platdata(dev); + struct sh_eth_dev *eth = &priv->shdev; ++ struct sh_eth_info *port_info = ð->port_info[eth->port]; + int ret; + +- ret = clk_enable(&priv->clk); +- if (ret) +- return ret; +- +- ret = sh_eth_init_common(eth, pdata->enetaddr); +- if (ret) +- goto err_clk; +- +- ret = sh_eth_phy_config(dev); ++ ret = phy_startup(port_info->phydev); + if (ret) { +- printf(SHETHER_NAME ": phy config timeout\n"); +- goto err_start; ++ printf(SHETHER_NAME ": phy startup failure\n"); ++ return ret; + } + + ret = sh_eth_start_common(eth); +- if (ret) +- goto err_start; +- +- return 0; +- +-err_start: +- sh_eth_tx_desc_free(eth); +- sh_eth_rx_desc_free(eth); +-err_clk: +- clk_disable(&priv->clk); + return ret; + } + +@@ -815,7 +797,6 @@ static void sh_ether_stop(struct udevice *dev) + struct sh_ether_priv *priv = dev_get_priv(dev); + + sh_eth_stop(&priv->shdev); +- clk_disable(&priv->clk); + } + + static int sh_ether_probe(struct udevice *udev) +@@ -857,7 +838,7 @@ static int sh_ether_probe(struct udevice *udev) + + ret = mdio_register(mdiodev); + if (ret < 0) +- goto err_mdio_register; ++ goto err_mdio; + + priv->bus = miiphy_get_dev_by_name(udev->name); + +@@ -866,9 +847,25 @@ static int sh_ether_probe(struct udevice *udev) + eth->port_info[eth->port].iobase = + (void __iomem *)(BASE_IO_ADDR + 0x800 * eth->port); + ++ ret = clk_enable(&priv->clk); ++ if (ret) ++ goto err_mdio; ++ ++ ret = sh_eth_init_common(eth, pdata->enetaddr); ++ if (ret) ++ goto err_clk; ++ ++ ret = sh_eth_phy_config(udev); ++ if (ret) { ++ printf(SHETHER_NAME ": phy config timeout\n"); ++ goto err_clk; ++ } ++ + return 0; + +-err_mdio_register: ++err_clk: ++ clk_disable(&priv->clk); ++err_mdio: + mdio_free(mdiodev); + return ret; + } +@@ -879,13 +876,18 @@ static int sh_ether_remove(struct udevice *udev) + struct sh_eth_dev *eth = &priv->shdev; + struct sh_eth_info *port_info = ð->port_info[eth->port]; + ++ sh_eth_tx_desc_free(eth); ++ sh_eth_rx_desc_free(eth); ++ + free(port_info->phydev); ++ + mdio_unregister(priv->bus); + mdio_free(priv->bus); + + if (dm_gpio_is_valid(&priv->reset_gpio)) + dm_gpio_free(udev, &priv->reset_gpio); + ++ clk_disable(&priv->clk); + return 0; + } + +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0028-net-sh_eth-Fix-compilation-warnings.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0028-net-sh_eth-Fix-compilation-warnings.patch new file mode 100644 index 00000000..2e878538 --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0028-net-sh_eth-Fix-compilation-warnings.patch @@ -0,0 +1,135 @@ +From 4d00819431c519c143242b230f6afaf59dc57051 Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Mon, 2 Dec 2019 01:08:01 +0300 +Subject: [PATCH 2/4] net: sh_eth: Fix compilation warnings + +This fixes multiple type cast warnings: + "warning: cast to pointer from integer of different size" + +In most cases we use uintptr_t type instead of int or u32. +Also, use iobase address obtained from the device tree +instead of hard-coded macro for the phy address. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + drivers/net/sh_eth.c | 24 ++++++++++++------------ + drivers/net/sh_eth.h | 8 ++++---- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c +index b120977..fbae6ce 100644 +--- a/drivers/net/sh_eth.c ++++ b/drivers/net/sh_eth.c +@@ -36,8 +36,8 @@ + + #if defined(CONFIG_SH_ETHER_CACHE_WRITEBACK) && !defined(CONFIG_SYS_DCACHE_OFF) + #define flush_cache_wback(addr, len) \ +- flush_dcache_range((u32)addr, \ +- (u32)(addr + ALIGN(len, CONFIG_SH_ETHER_ALIGNE_SIZE))) ++ flush_dcache_range((uintptr_t)(addr), \ ++ (uintptr_t)(addr) + ALIGN((len), CONFIG_SH_ETHER_ALIGNE_SIZE)) + #else + #define flush_cache_wback(...) + #endif +@@ -45,11 +45,11 @@ + #if defined(CONFIG_SH_ETHER_CACHE_INVALIDATE) && defined(CONFIG_ARM) + #define invalidate_cache(addr, len) \ + { \ +- u32 line_size = CONFIG_SH_ETHER_ALIGNE_SIZE; \ +- u32 start, end; \ ++ uintptr_t line_size = CONFIG_SH_ETHER_ALIGNE_SIZE; \ ++ uintptr_t start, end; \ + \ +- start = (u32)addr; \ +- end = start + len; \ ++ start = (uintptr_t)(addr); \ ++ end = start + (len); \ + start &= ~(line_size - 1); \ + end = ((end + line_size - 1) & ~(line_size - 1)); \ + \ +@@ -73,7 +73,7 @@ static int sh_eth_send_common(struct sh_eth_dev *eth, void *packet, int len) + } + + /* packet must be a 4 byte boundary */ +- if ((int)packet & 3) { ++ if ((uintptr_t)packet & 3) { + printf(SHETHER_NAME ": %s: packet not 4 byte aligned\n" + , __func__); + ret = -EFAULT; +@@ -210,7 +210,7 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth) + + /* Make sure we use a P2 address (non-cacheable) */ + port_info->tx_desc_base = +- (struct tx_desc_s *)ADDR_TO_P2((u32)port_info->tx_desc_alloc); ++ (struct tx_desc_s *)ADDR_TO_P2((uintptr_t)port_info->tx_desc_alloc); + port_info->tx_desc_cur = port_info->tx_desc_base; + + /* Initialize all descriptors */ +@@ -264,7 +264,7 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth) + + /* Make sure we use a P2 address (non-cacheable) */ + port_info->rx_desc_base = +- (struct rx_desc_s *)ADDR_TO_P2((u32)port_info->rx_desc_alloc); ++ (struct rx_desc_s *)ADDR_TO_P2((uintptr_t)port_info->rx_desc_alloc); + + port_info->rx_desc_cur = port_info->rx_desc_base; + +@@ -280,7 +280,7 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth) + goto err_buf_alloc; + } + +- port_info->rx_buf_base = (u8 *)ADDR_TO_P2((u32)port_info->rx_buf_alloc); ++ port_info->rx_buf_base = (u8 *)ADDR_TO_P2((uintptr_t)port_info->rx_buf_alloc); + + /* Initialize all descriptors */ + for (cur_rx_desc = port_info->rx_desc_base, +@@ -699,7 +699,7 @@ static int sh_ether_recv(struct udevice *dev, int flags, uchar **packetp) + struct sh_ether_priv *priv = dev_get_priv(dev); + struct sh_eth_dev *eth = &priv->shdev; + struct sh_eth_info *port_info = ð->port_info[eth->port]; +- uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2); ++ uchar *packet = (uchar *)ADDR_TO_P2((uintptr_t)port_info->rx_desc_cur->rd2); + int len; + + len = sh_eth_recv_start(eth); +@@ -845,7 +845,7 @@ static int sh_ether_probe(struct udevice *udev) + eth->port = CONFIG_SH_ETHER_USE_PORT; + eth->port_info[eth->port].phy_addr = CONFIG_SH_ETHER_PHY_ADDR; + eth->port_info[eth->port].iobase = +- (void __iomem *)(BASE_IO_ADDR + 0x800 * eth->port); ++ (void __iomem *)(priv->iobase + 0x800 * eth->port); + + ret = clk_enable(&priv->clk); + if (ret) +diff --git a/drivers/net/sh_eth.h b/drivers/net/sh_eth.h +index 1fa38e7..61fe0c9 100644 +--- a/drivers/net/sh_eth.h ++++ b/drivers/net/sh_eth.h +@@ -15,20 +15,20 @@ + #if defined(CONFIG_SH) + /* Malloc returns addresses in the P1 area (cacheable). However we need to + use area P2 (non-cacheable) */ +-#define ADDR_TO_P2(addr) ((((int)(addr) & ~0xe0000000) | 0xa0000000)) ++#define ADDR_TO_P2(addr) ((((uintptr_t)(addr) & ~0xe0000000) | 0xa0000000)) + + /* The ethernet controller needs to use physical addresses */ + #if defined(CONFIG_SH_32BIT) +-#define ADDR_TO_PHY(addr) ((((int)(addr) & ~0xe0000000) | 0x40000000)) ++#define ADDR_TO_PHY(addr) ((((uintptr_t)(addr) & ~0xe0000000) | 0x40000000)) + #else +-#define ADDR_TO_PHY(addr) ((int)(addr) & ~0xe0000000) ++#define ADDR_TO_PHY(addr) ((uintptr_t)(addr) & ~0xe0000000) + #endif + #elif defined(CONFIG_ARM) + #ifndef inl + #define inl readl + #define outl writel + #endif +-#define ADDR_TO_PHY(addr) ((int)(addr)) ++#define ADDR_TO_PHY(addr) ((uintptr_t)(addr)) + #define ADDR_TO_P2(addr) (addr) + #endif /* defined(CONFIG_SH) */ + +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0029-net-sh_eth-Workaround-cache-issues.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0029-net-sh_eth-Workaround-cache-issues.patch new file mode 100644 index 00000000..79eba33b --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0029-net-sh_eth-Workaround-cache-issues.patch @@ -0,0 +1,74 @@ +From 869da2f4ee518558382f4a929ca302d1b2f91274 Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Mon, 2 Dec 2019 01:13:19 +0300 +Subject: [PATCH 3/4] net: sh_eth: Workaround cache issues + +U-Boot writes to RX packets when constructing replies. +This can cause stale cached data to be written to RX +buffer while we're receiving a packet. This causes RX +packet corruption because we invalidate the cache right +before processing the packet. Invalidate packet buffer +cache when preparing RX descriptor as well. This seems +to fix RX packet drops with high RX traffic. + +While at it flush the descriptors right before enabling +RX/TX in sh_eth_tx_desc_init/sh_eth_rx_desc_init callbacks +when they are ready instead of flushing after allocation. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + drivers/net/sh_eth.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c +index fbae6ce..5df078d 100644 +--- a/drivers/net/sh_eth.c ++++ b/drivers/net/sh_eth.c +@@ -138,6 +138,8 @@ static void sh_eth_recv_finish(struct sh_eth_dev *eth) + { + struct sh_eth_info *port_info = ð->port_info[eth->port]; + ++ invalidate_cache(ADDR_TO_P2(port_info->rx_desc_cur->rd2), MAX_BUF_SIZE); ++ + /* Make current descriptor available again */ + if (port_info->rx_desc_cur->rd0 & RD_RDLE) + port_info->rx_desc_cur->rd0 = RD_RACT | RD_RDLE; +@@ -206,8 +208,6 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth) + goto err; + } + +- flush_cache_wback(port_info->tx_desc_alloc, alloc_desc_size); +- + /* Make sure we use a P2 address (non-cacheable) */ + port_info->tx_desc_base = + (struct tx_desc_s *)ADDR_TO_P2((uintptr_t)port_info->tx_desc_alloc); +@@ -225,6 +225,7 @@ static int sh_eth_tx_desc_init(struct sh_eth_dev *eth) + cur_tx_desc--; + cur_tx_desc->td0 |= TD_TDLE; + ++ flush_cache_wback(port_info->tx_desc_alloc, alloc_desc_size); + /* + * Point the controller to the tx descriptor list. Must use physical + * addresses +@@ -260,8 +261,6 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth) + goto err; + } + +- flush_cache_wback(port_info->rx_desc_alloc, alloc_desc_size); +- + /* Make sure we use a P2 address (non-cacheable) */ + port_info->rx_desc_base = + (struct rx_desc_s *)ADDR_TO_P2((uintptr_t)port_info->rx_desc_alloc); +@@ -295,6 +294,9 @@ static int sh_eth_rx_desc_init(struct sh_eth_dev *eth) + cur_rx_desc--; + cur_rx_desc->rd0 |= RD_RDLE; + ++ invalidate_cache(port_info->rx_buf_alloc, NUM_RX_DESC * MAX_BUF_SIZE); ++ flush_cache_wback(port_info->rx_desc_alloc, alloc_desc_size); ++ + /* Point the controller to the rx descriptor list */ + sh_eth_write(port_info, ADDR_TO_PHY(port_info->rx_desc_base), RDLAR); + #if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ) +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0030-net-sh_eth-Fix-RX-error-handling.patch b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0030-net-sh_eth-Fix-RX-error-handling.patch new file mode 100644 index 00000000..a93ce617 --- /dev/null +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot/0030-net-sh_eth-Fix-RX-error-handling.patch @@ -0,0 +1,73 @@ +From d71076d2f04dace4483f184899e365a27a74d07d Mon Sep 17 00:00:00 2001 +From: Valentine Barshak <valentine.barshak@cogentembedded.com> +Date: Mon, 2 Dec 2019 01:20:34 +0300 +Subject: [PATCH 4/4] net: sh_eth: Fix RX error handling + +In case RX error occurs, and the RD_RFE bit is set, the descriptor +is never returned back to the queue. Make sh_eth_recv_start return +zero length in this case so that the descriptor can be released +and pushed back to the list. Also return the more appropriate +-EAGAIN instead of -EINVAL if the descriptor is not ready yet. + +Signed-off-by: Valentine Barshak <valentine.barshak@cogentembedded.com> +--- + drivers/net/sh_eth.c | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c +index 5df078d..eeb1d32 100644 +--- a/drivers/net/sh_eth.c ++++ b/drivers/net/sh_eth.c +@@ -125,11 +125,11 @@ static int sh_eth_recv_start(struct sh_eth_dev *eth) + /* Check if the rx descriptor is ready */ + invalidate_cache(port_info->rx_desc_cur, sizeof(struct rx_desc_s)); + if (port_info->rx_desc_cur->rd0 & RD_RACT) +- return -EINVAL; ++ return -EAGAIN; + + /* Check for errors */ + if (port_info->rx_desc_cur->rd0 & RD_RFE) +- return -EINVAL; ++ return 0; + + return port_info->rx_desc_cur->rd1 & 0xffff; + } +@@ -553,9 +553,11 @@ static int sh_eth_recv_common(struct sh_eth_dev *eth) + uchar *packet = (uchar *)ADDR_TO_P2(port_info->rx_desc_cur->rd2); + + len = sh_eth_recv_start(eth); +- if (len > 0) { +- invalidate_cache(packet, len); +- net_process_received_packet(packet, len); ++ if (len >= 0) { ++ if (len > 0) { ++ invalidate_cache(packet, len); ++ net_process_received_packet(packet, len); ++ } + sh_eth_recv_finish(eth); + } else + len = 0; +@@ -710,15 +712,13 @@ static int sh_ether_recv(struct udevice *dev, int flags, uchar **packetp) + *packetp = packet; + + return len; +- } else { +- len = 0; ++ } + +- /* Restart the receiver if disabled */ +- if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R)) +- sh_eth_write(port_info, EDRRR_R, EDRRR); ++ /* Restart the receiver if disabled */ ++ if (!(sh_eth_read(port_info, EDRRR) & EDRRR_R)) ++ sh_eth_write(port_info, EDRRR_R, EDRRR); + +- return -EAGAIN; +- } ++ return len; + } + + static int sh_ether_free_pkt(struct udevice *dev, uchar *packet, int length) +-- +2.7.4 + diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2018.09.bbappend b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2018.09.bbappend index 6e28e5e9..ebc38928 100644 --- a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2018.09.bbappend +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/u-boot/u-boot_2018.09.bbappend @@ -1,5 +1,15 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" +RPC_ENABLED = " \ + file://0022-arm-renesas-Enable-RPC-HF-MTD-support-for-all-Salvat.patch \ + file://0023-arm-renesas-Enable-RPC-HF-MTD-support-for-all-ULCB-b.patch \ +" + +RPC_DISABLED = " \ + file://0022-arm-dts-r8a77970-Disable-RPC-on-all-R-Car-V3M-boards.patch \ + file://0023-arm-dts-r8a77980-Disable-RPC-on-all-R-Car-V3H-boards.patch \ +" + SRC_URI_append = " \ file://0001-uboot-ravb-remove-APSR-quirk.patch \ file://0002-net-ravb-fix-unsafe-phy-access.patch \ @@ -22,6 +32,12 @@ SRC_URI_append = " \ file://0019-ARM-rmobile-Add-R8A7795-H3ULCB-HAD-board-support.patch \ file://0020-arm-renesas-v3msk-Add-CPLD-support.patch \ file://0021-arm-renesas-v3hsk-Add-CPLD-support.patch \ - file://0022-arm-renesas-Enable-RPC-HF-MTD-support-for-all-Salvat.patch \ - file://0023-arm-renesas-Enable-RPC-HF-MTD-support-for-all-ULCB-b.patch \ + ${@oe.utils.conditional("DISABLE_RPC_ACCESS", "1", "${RPC_DISABLED}", "${RPC_ENABLED}", d)} \ + file://0024-mmc-mmc-Set-clock-when-reverting-to-safe-bus-mode.patch \ + file://0025-net-Add-an-accessor-to-know-if-waiting-for-ARP.patch \ + file://0026-net-Don-t-overwrite-waiting-packets-with-asynchronou.patch \ + file://0027-net-sh_eth-Keep-phy-running.patch \ + file://0028-net-sh_eth-Fix-compilation-warnings.patch \ + file://0029-net-sh_eth-Workaround-cache-issues.patch \ + file://0030-net-sh_eth-Fix-RX-error-handling.patch \ " diff --git a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb index 7b834ce9..945a2b08 100644 --- a/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb +++ b/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-bsp/utest-apps/utest-cam-imr-drm.bb @@ -7,7 +7,7 @@ S = "${WORKDIR}/git" BRANCH = "rcar_gen3" SRC_URI = "git://github.com/CogentEmbedded/utest-cam-imr-drm.git;branch=${BRANCH}" -SRCREV = "27e5984c05357194759a1f81d0ffa20d523d0103" +SRCREV = "fd160edb99b34223f2c49fecbef3cca3daddbe59" PV = "v1.0+renesas+git" |