From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Hi,
Series adds Ethernet support for Renesas RZ/G3S SoC. Ethernet driver
has been enhanced with runtime PM support. The suspend to RAM support
was also improved.
Series is split as follows:
- patch 01: add clock and reset support for the Ethernet IPs
- patches 02-07: add pinctrl support for the Ethernet IPs
- patches 08-43: add support for suspend to RAM and runtime PM on
the Ethernet driver; in this set there are many preparatory
patches for runtime PM support (as runtime PM enable/disables
the Ethernet module clock and this influences the Ethernet
module state leanding to registers setup being lost)
along with improvements
- patches 45-47: add device tree support
Thank you,
Claudiu Beznea
Biju Das (2):
ravb: Add Rx checksum offload support for GbEth
ravb: Add Tx checksum offload support for GbEth
Christophe JAILLET (1):
ravb: Use GFP_KERNEL instead of GFP_ATOMIC when possible
Claudiu Beznea (36):
clk: renesas: r9a08g045: Add clock and reset support for ETH0 and ETH1
pinctrl: renesas: rzg2l: Move arg and index in the main function block
pinctrl: renesas: rzg2l: Add pin configuration support for pinmux
groups
pinctrl: renesas: rzg2l: Add support to select power source for
Ethernet pins
pinctrl: renesas: rzg2l: Add output enable support
pinctrl: renesas: rzg2l: Add input enable to the Ethernet pins
pinctrl: renesas: rzg2l: Fix locking in rzg2l_dt_subnode_to_map()
net: ravb: Check return value of reset_control_deassert()
net: ravb: Make write access to CXR35 first before accessing other
EMAC registers
net: ravb: Stop DMA in case of failures on ravb_open()
net: ravb: Keep reverse order of operations in ravb_remove()
net: ravb: Wait for operating mode to be applied
dt-bindings: net: renesas,etheravb: Document RZ/G3S support
net: ravb: Let IP-specific receive function to interrogate descriptors
net: ravb: Rely on PM domain to enable gptp_clk
net: ravb: Make reset controller support mandatory
net: ravb: Assert/de-assert reset on suspend/resume
net: ravb: Move reference clock enable/disable on runtime PM APIs
net: ravb: Move getting/requesting IRQs in the probe() method
net: ravb: Split GTI computation and set operations
net: ravb: Move delay mode set in the driver's ndo_open API
net: ravb: Move DBAT configuration to the driver's ndo_open API
net: ravb: Move PTP initialization in the driver's ndo_open API for
ccc_gac platorms
net: ravb: Set config mode in ndo_open and reset mode in ndo_close
net: ravb: Simplify ravb_suspend()
net: ravb: Simplify ravb_resume()
net: ravb: Get rid of the temporary variable irq
net: ravb: Keep the reverse order of operations in ravb_close()
net: ravb: Return cached statistics if the interface is down
net: ravb: Move the update of ndev->features to ravb_set_features()
net: ravb: Do not apply features to hardware if the interface is down
net: ravb: Add runtime PM support
arm64: dts: renesas: r9a08g045: Add Ethernet nodes
arm64: dts: renesas: rzg3s-smarc-som: Use switches' names to select
on-board functionalities
arm64: dts: renesas: rzg3s-smarc-som: Enable the Ethernet interfaces
arm64: dts: renesas: rzg3s-smarc-som: Guard Ethernet IRQ GPIO hogs
Geert Uytterhoeven (1):
net: ravb: Fix registered interrupt names
Paul Barker (3):
net: ravb: Count packets instead of descriptors in GbEth RX path
net: ravb: Fix GbEth jumbo packet RX checksum handling
net: ravb: Fix RX byte accounting for jumbo packets
Sergey Shtylyov (1):
ravb: ravb_close() always returns 0
Yang Li (1):
ethernet: renesas: Use div64_ul instead of do_div
Yoshihiro Shimoda (1):
net: ravb: Fix lack of register setting after system resumed for Gen3
YueHaibing (1):
ravb: Fix potential use-after-free in ravb_rx_gbeth()
.../bindings/net/renesas,etheravb.yaml | 1 +
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 38 +
.../boot/dts/renesas/rzg3s-smarc-som.dtsi | 177 ++-
drivers/clk/renesas/r9a08g045-cpg.c | 10 +
drivers/net/ethernet/renesas/Kconfig | 1 +
drivers/net/ethernet/renesas/ravb.h | 40 +-
drivers/net/ethernet/renesas/ravb_main.c | 1074 ++++++++++-------
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 164 ++-
8 files changed, 1030 insertions(+), 475 deletions(-)
--
2.39.2
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 906b545b16594e45f2d3433028dcf649d2c05ebb upstream.
Move arg and index in the main block of the function as they are used by
more than one case block of switch-case (3 out of 4 for arg, 2 out of 4
for index). In this way some lines of code are removed.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231207070700.4156557-4-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 51996952b8b50942ed3069141ebc1dee13756b95 upstream.
The GPIO controller available on RZ/G3S (but also on RZ/G2L) supports
setting the power source for Ethernet pins. Based on the interface b/w
the Ethernet controller and the Ethernet PHY, and on board design, a
specific power source needs to be selected. The GPIO controller
supports 1.8V, 2.5V, and 3.3V power source selection for the Ethernet
pins. This can be selected though the ETHx_POC registers (x={0, 1}).
Adjust the driver to support this, and to do proper instantiation for
the RZ/G3S and RZ/G2L SoCs. On RZ/G2L only the get operation has been
tested at the moment.
While at it, as the power registers on RZ/G2L support access sizes of 8
bits, and these registers on RZ/G3S support access sizes of 8/16/32
bits, replace writel()/readl() on these registers with writeb()/readb().
This should allow us to use the same code on both SoCs w/o any issues.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231207070700.4156557-6-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 42 +++++++++++++++++++++++--
1 file changed, 39 insertions(+), 3 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit bd433c25ca81b2ac6dca7ea288a8474eea4fb8a0 upstream.
Commit d3aaa7203a17 ("pinctrl: renesas: rzg2l: Add pin configuration
support for pinmux groups") introduced the possibility to parse pin
configuration for pinmux groups. It did that by calling
rzg2l_map_add_config() at the end of rzg2l_dt_subnode_to_map() and
jumping to the remove_group label in case rzg2l_map_add_config() failed.
But if that happens, the mutex will already be unlocked, thus this it will
lead to double mutex unlock operation. To fix this move the
rzg2l_map_add_config() call just after all the name argument is ready and
before the mutex is locked. There is no harm in doing this, as this only
parses the data from device tree that will be further processed by
pinctrl core code.
Fixes: d3aaa7203a17 ("pinctrl: renesas: rzg2l: Add pin configuration support for pinmux groups")
Reported-by: Dan Carpenter <redacted>
Closes: https://lore.kernel.org/all/f8c3a3a0-7c48-4e40-8af0-ed4e9d9b049f@moroto.mountain
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20240115153453.99226-1-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
@@ -443,6 +443,16 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,name=np->name;}+if(num_configs){+ret=rzg2l_map_add_config(&maps[idx],name,+PIN_MAP_TYPE_CONFIGS_GROUP,+configs,num_configs);+if(ret<0)+gotodone;++idx++;+}+mutex_lock(&pctrl->mutex);/* Register a single pin group listing all the pins we read from DT */
@@ -470,16 +480,6 @@ static int rzg2l_dt_subnode_to_map(struct pinctrl_dev *pctldev,maps[idx].data.mux.function=name;idx++;-if(num_configs){-ret=rzg2l_map_add_config(&maps[idx],name,-PIN_MAP_TYPE_CONFIGS_GROUP,-configs,num_configs);-if(ret<0)-gotoremove_group;--idx++;-}-dev_dbg(pctrl->dev,"Parsed %pOF with %d pins\n",np,num_pinmux);ret=0;gotodone;
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 1bbc8ee40826164d16e32d377654c93ef48d1458 upstream.
Some of the Ethernet pins on RZ/G3S (but also valid for RZ/G2L) need to
have the direction of the IO buffer set as output for Ethernet to work
properly. On RZ/G3S, these pins are P1_0/P7_0, P1_1/P7_1, and can have
the following Ethernet functions: TXC/TX_CLK or TX_CTL/TX_EN.
As the pins supporting output enable are SoC specific, and there is a
limited number of these pins (TXC/TX_CLK and/or TX_CTL/TX_EN), specify
output enable capable port limits in the platform-based configuration
data structure, to ensure proper validation.
The OEN support has been intantiated for RZ/G3S at the moment.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231207070700.4156557-7-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 87 ++++++++++++++++++++++++-
1 file changed, 85 insertions(+), 2 deletions(-)
@@ -1953,6 +2034,8 @@ static const struct rzg2l_hwcfg rzg3s_hwcfg = {},.drive_strength_ua=true,.func_base=1,+.oen_max_pin=1,/* Pin 1 of P0 and P7 is the maximum OEN pin. */+.oen_max_port=7,/* P7_1 is the maximum OEN port. */};staticstructrzg2l_pinctrl_datar9a07g043_data={
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit d3aaa7203a17e8399df41e7c3f088f51368b001c upstream.
On RZ/G3S different Ethernet pins need to be configured with different
settings (e.g. power-source needs to be set, RGMII TXC and TX_CTL pins
need output-enable). Adjust the driver to allow specifying pin
configuration for pinmux groups. With this, DT settings like the
following are taken into account by the driver:
eth0_pins: eth0 {
tx_ctl {
pinmux = <RZG2L_PORT_PINMUX(1, 1, 1)>; /* ET0_TX_CTL */
power-source = <1800>;
output-enable;
drive-strength-microamp = <5200>;
};
};
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231207070700.4156557-5-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit d78c0ced60d5e2f8b5a4a0468a5c400b24aeadf2 upstream.
Hardware manual of RZ/G3S (and RZ/G2L) specifies the following on the
description of CXR35 register (chapter "PHY interface select register
(CXR35)"): "After release reset, make write-access to this register before
making write-access to other registers (except MDIOMOD). Even if not need
to change the value of this register, make write-access to this register
at least one time. Because RGMII/MII MODE is recognized by accessing this
register".
The setup procedure for EMAC module (chapter "Setup procedure" of RZ/G3S,
RZ/G2L manuals) specifies the E-MAC.CXR35 register is the first EMAC
register that is to be configured.
Note [A] from chapter "PHY interface select register (CXR35)" specifies
the following:
[A] The case which CXR35 SEL_XMII is used for the selection of RGMII/MII
in APB Clock 100 MHz.
(1) To use RGMII interface, Set ‘H’03E8_0000’ to this register.
(2) To use MII interface, Set ‘H’03E8_0002’ to this register.
Take into account these indication.
Fixes: 1089877ada8d ("ravb: Add RZ/G2L MII interface support")
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
commit c2b6cdee1d13ffbb24baca3c9b8a572d6b541e4e upstream.
After system entered Suspend to RAM, registers setting of this
hardware is reset because the SoC will be turned off. On R-Car Gen3
(info->ccc_gac), ravb_ptp_init() is called in ravb_probe() only. So,
after system resumed, it lacks of the initial settings for ptp. So,
add ravb_ptp_{init,stop}() into ravb_{resume,suspend}().
Fixes: f5d7837f96e5 ("ravb: ptp: Add CONFIG mode support")
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 6 ++++++
1 file changed, 6 insertions(+)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit d8eb6ea4b302e7ff78535c205510e359ac10a0bd upstream.
reset_control_deassert() could return an error. Some devices cannot work
if reset signal de-assert operation fails. To avoid this check the return
code of reset_control_deassert() in ravb_probe() and take proper action.
Along with it, the free_netdev() call from the error path was moved after
reset_control_assert() on its own label (out_free_netdev) to free
netdev in case reset_control_deassert() fails.
Fixes: 0d13a1a464a0 ("ravb: Add reset support")
Reviewed-by: Sergey Shtylyov <redacted>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
From: Paul Barker <redacted>
commit ed4adc07207d9165a4b3b36199231a22e9f51a55 upstream.
The units of "work done" in the RX path should be packets instead of
descriptors, as large packets can be spread over multiple descriptors.
Fixes: 1c59eb678cbd ("ravb: Fillup ravb_rx_gbeth() stub")
Signed-off-by: Paul Barker <redacted>
Reviewed-by: Sergey Shtylyov <redacted>
Link: https://lore.kernel.org/r/20240214151204.2976-1-paul.barker.ct@bp.renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
@@ -771,29 +771,25 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)structravb_rx_desc*desc;structsk_buff*skb;dma_addr_tdma_addr;+intrx_packets=0;u8desc_status;-intboguscnt;u16pkt_len;u8die_dt;intentry;intlimit;+inti;entry=priv->cur_rx[q]%priv->num_rx_ring[q];-boguscnt=priv->dirty_rx[q]+priv->num_rx_ring[q]-priv->cur_rx[q];+limit=priv->dirty_rx[q]+priv->num_rx_ring[q]-priv->cur_rx[q];stats=&priv->stats[q];-boguscnt=min(boguscnt,*quota);-limit=boguscnt;desc=&priv->gbeth_rx_ring[entry];-while(desc->die_dt!=DT_FEMPTY){+for(i=0;i<limit&&rx_packets<*quota&&desc->die_dt!=DT_FEMPTY;i++){/* Descriptor type must be checked before all other reads */dma_rmb();desc_status=desc->msc;pkt_len=le16_to_cpu(desc->ds_cc)&RX_DS;-if(--boguscnt<0)-break;-/* We use 0-byte descriptors to mark the DMA mapping errors */if(!pkt_len)continue;
@@ -819,7 +815,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)skb_put(skb,pkt_len);skb->protocol=eth_type_trans(skb,ndev);napi_gro_receive(&priv->napi[q],skb);-stats->rx_packets++;+rx_packets++;stats->rx_bytes+=pkt_len;break;caseDT_FSTART:
@@ -847,7 +843,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)eth_type_trans(priv->rx_1st_skb,ndev);napi_gro_receive(&priv->napi[q],priv->rx_1st_skb);-stats->rx_packets++;+rx_packets++;stats->rx_bytes+=pkt_len;break;}
@@ -886,9 +882,9 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)desc->die_dt=DT_FEMPTY;}-*quota-=limit-(++boguscnt);--returnboguscnt<=0;+stats->rx_packets+=rx_packets;+*quota-=rx_packets;+return*quota==0;}/* Packet receive function for Ethernet AVB */
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit edf9bc396e05081ca281ffb0cd41e44db478ff26 upstream.
On RZ/G3S SMARC Carrier II board having RGMII connections b/w Ethernet
MACs and PHYs it has been discovered that doing unbind/bind for ravb
driver in a loop leads to wrong speed and duplex for Ethernet links and
broken connectivity (the connectivity cannot be restored even with
bringing interface down/up). Before doing unbind/bind the Ethernet
interfaces were configured though systemd. The sh instructions used to
do unbind/bind were:
$ cd /sys/bus/platform/drivers/ravb/
$ while :; do echo 11c30000.ethernet > unbind ; \
echo 11c30000.ethernet > bind; done
It has been discovered that there is a race b/w IOCTLs initialized by
systemd at the response of success binding and the
"ravb_write(ndev, CCC_OPC_RESET, CCC)" call in ravb_remove() as
follows:
1/ as a result of bind success the user space open/configures the
interfaces tough an IOCTL; the following stack trace has been
identified on RZ/G3S:
Call trace:
dump_backtrace+0x9c/0x100
show_stack+0x20/0x38
dump_stack_lvl+0x48/0x60
dump_stack+0x18/0x28
ravb_open+0x70/0xa58
__dev_open+0xf4/0x1e8
__dev_change_flags+0x198/0x218
dev_change_flags+0x2c/0x80
devinet_ioctl+0x640/0x708
inet_ioctl+0x1e4/0x200
sock_do_ioctl+0x50/0x108
sock_ioctl+0x240/0x358
__arm64_sys_ioctl+0xb0/0x100
invoke_syscall+0x50/0x128
el0_svc_common.constprop.0+0xc8/0xf0
do_el0_svc+0x24/0x38
el0_svc+0x34/0xb8
el0t_64_sync_handler+0xc0/0xc8
el0t_64_sync+0x190/0x198
2/ this call may execute concurrently with ravb_remove() as the
unbind/bind operation was executed in a loop
3/ if the operation mode is changed to RESET (through
ravb_write(ndev, CCC_OPC_RESET, CCC) call in ravb_remove())
while the above ravb_open() is in progress it may lead to MAC
(or PHY, or MAC-PHY connection, the right point hasn't been identified
at the moment) to be broken, thus the Ethernet connectivity fails to
restore.
The simple fix for this is to move ravb_write(ndev, CCC_OPC_RESET, CCC))
after unregister_netdev() to avoid resetting the controller while the
netdev interface is still registered.
To avoid future issues in ravb_remove(), the patch follows the proper order
of operations in ravb_remove(): reverse order compared with ravb_probe().
This avoids described races as the IOCTLs as well as unregister_netdev()
(called now at the beginning of ravb_remove()) calls rtnl_lock() before
continuing and IOCTLs check (though devinet_ioctl()) if device is still
registered just after taking the lock:
int devinet_ioctl(struct net *net, unsigned int cmd, struct ifreq *ifr)
{
// ...
rtnl_lock();
ret = -ENODEV;
dev = __dev_get_by_name(net, ifr->ifr_name);
if (!dev)
goto done;
// ...
done:
rtnl_unlock();
out:
return ret;
}
Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
From: Christophe JAILLET <redacted>
commit 91398a960edf50d27206d808182e3357f9f5c668 upstream.
'max_rx_len' can be up to GBETH_RX_BUFF_MAX (i.e. 8192) (see
'gbeth_hw_info').
The default value of 'num_rx_ring' can be BE_RX_RING_SIZE (i.e. 1024).
So this loop can allocate 8 Mo of memory.
Previous memory allocations in this function already use GFP_KERNEL, so
use __netdev_alloc_skb() and an explicit GFP_KERNEL instead of a
implicit GFP_ATOMIC.
This gives more opportunities of successful allocation.
Signed-off-by: Christophe JAILLET <redacted>
Reviewed-by: Sergey Shtylyov <redacted>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Sergey Shtylyov <redacted>
commit be94a51f3e5eee72ba4251c1b1c463872b03cf54 upstream.
ravb_close() always returns 0, hence the check in ravb_wol_restore() is
pointless (however, we cannot change the prototype of ravb_close() as it
implements the driver's ndo_stop() method).
Found by Linux Verification Center (linuxtesting.org) with the SVACE static
analysis tool.
Signed-off-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
From: Yang Li <redacted>
commit d9f31aeaa1e5aefa68130878af3c3513d41c1e2d upstream.
do_div() does a 64-by-32 division. Here the divisor is an
unsigned long which on some platforms is 64 bit wide. So use
div64_ul instead of do_div to avoid a possible truncation.
Eliminate the following coccicheck warning:
./drivers/net/ethernet/renesas/ravb_main.c:2492:1-7: WARNING:
do_div() does a 64-by-32 division, please consider using div64_ul
instead.
Reported-by: Abaci Robot <redacted>
Signed-off-by: Yang Li <redacted>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Sergey Shtylyov <redacted>
Link: https://lore.kernel.org/r/1637228883-100100-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
@@ -2563,8 +2562,7 @@ static int ravb_set_gti(struct net_device *ndev)if(!rate)return-EINVAL;-inc=1000000000ULL<<20;-do_div(inc,rate);+inc=div64_ul(1000000000ULL<<20,rate);if(inc<GTI_TIV_MIN||inc>GTI_TIV_MAX){dev_err(dev,"gti.tiv increment 0x%llx is outside the range 0x%x - 0x%x\n",
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 9039cd4c61635b2d541009a7cd5e2cc052402f28 upstream.
CSR.OPS bits specify the current operating mode and (according to
documentation) they are updated by HW when the operating mode change
request is processed. To comply with this check CSR.OPS before proceeding.
Commit introduces ravb_set_opmode() that does all the necessities for
setting the operating mode (set CCC.OPC (and CCC.GAC, CCC.CSEL, if any) and
wait for CSR.OPS) and call it where needed. This should comply with all the
HW manuals requirements as different manual variants specify that different
modes need to be checked in CSR.OPS when setting CCC.OPC.
If gPTP active in config mode is supported and it needs to be enabled, the
CCC.GAC and CCC.CSEL needs to be configured along with CCC.OPC in the same
write access. For this, ravb_set_opmode() allows passing GAC and CSEL as
part of opmode and the function updates accordingly CCC register.
Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 65 +++++++++++++++---------
1 file changed, 42 insertions(+), 23 deletions(-)
@@ -69,16 +69,27 @@ int ravb_wait(struct net_device *ndev, enum ravb_reg reg, u32 mask, u32 value)return-ETIMEDOUT;}-staticintravb_config(structnet_device*ndev)+staticintravb_set_opmode(structnet_device*ndev,u32opmode){+u32csr_ops=1U<<(opmode&CCC_OPC);+u32ccc_mask=CCC_OPC;interror;-/* Set config mode */-ravb_modify(ndev,CCC,CCC_OPC,CCC_OPC_CONFIG);-/* Check if the operating mode is changed to the config mode */-error=ravb_wait(ndev,CSR,CSR_OPS,CSR_OPS_CONFIG);-if(error)-netdev_err(ndev,"failed to switch device to config mode\n");+/* If gPTP active in config mode is supported it needs to be configured+*alongwithCSELandoperatingmodeinthesameaccess.Thisisa+*hardwarelimitation.+*/+if(opmode&CCC_GAC)+ccc_mask|=CCC_GAC|CCC_CSEL;++/* Set operating mode */+ravb_modify(ndev,CCC,ccc_mask,opmode);+/* Check if the operating mode is changed to the requested one */+error=ravb_wait(ndev,CSR,CSR_OPS,csr_ops);+if(error){+netdev_err(ndev,"failed to switch device to requested mode (%u)\n",+opmode&CCC_OPC);+}returnerror;}
@@ -672,7 +683,7 @@ static int ravb_dmac_init(struct net_device *ndev)interror;/* Set CONFIG mode */-error=ravb_config(ndev);+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);if(error)returnerror;
@@ -681,9 +692,7 @@ static int ravb_dmac_init(struct net_device *ndev)returnerror;/* Setting the control will start the AVB-DMAC process. */-ravb_modify(ndev,CCC,CCC_OPC,CCC_OPC_OPERATION);--return0;+returnravb_set_opmode(ndev,CCC_OPC_OPERATION);}staticvoidravb_get_tx_tstamp(structnet_device*ndev)
@@ -1045,7 +1054,7 @@ static int ravb_stop_dma(struct net_device *ndev)returnerror;/* Stop AVB-DMAC process */-returnravb_config(ndev);+returnravb_set_opmode(ndev,CCC_OPC_CONFIG);}/* E-MAC interrupt handler */
@@ -2572,21 +2581,25 @@ static int ravb_set_gti(struct net_device *ndev)return0;}-staticvoidravb_set_config_mode(structnet_device*ndev)+staticintravb_set_config_mode(structnet_device*ndev){structravb_private*priv=netdev_priv(ndev);conststructravb_hw_info*info=priv->info;+interror;if(info->gptp){-ravb_modify(ndev,CCC,CCC_OPC,CCC_OPC_CONFIG);+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);+if(error)+returnerror;/* Set CSEL value */ravb_modify(ndev,CCC,CCC_CSEL,CCC_CSEL_HPB);}elseif(info->ccc_gac){-ravb_modify(ndev,CCC,CCC_OPC,CCC_OPC_CONFIG|-CCC_GAC|CCC_CSEL_HPB);+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG|CCC_GAC|CCC_CSEL_HPB);}else{-ravb_modify(ndev,CCC,CCC_OPC,CCC_OPC_CONFIG);+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);}++returnerror;}/* Set tx and rx clock internal delay modes */
@@ -2806,7 +2819,9 @@ static int ravb_probe(struct platform_device *pdev)ndev->ethtool_ops=&ravb_ethtool_ops;/* Set AVB config mode */-ravb_set_config_mode(ndev);+error=ravb_set_config_mode(ndev);+if(error)+gotoout_disable_gptp_clk;if(info->gptp||info->ccc_gac){/* Set GTI value */
@@ -2929,8 +2944,7 @@ static int ravb_remove(struct platform_device *pdev)dma_free_coherent(ndev->dev.parent,priv->desc_bat_size,priv->desc_bat,priv->desc_bat_dma);-/* Set reset mode */-ravb_write(ndev,CCC_OPC_RESET,CCC);+ravb_set_opmode(ndev,CCC_OPC_RESET);clk_disable_unprepare(priv->gptp_clk);clk_disable_unprepare(priv->refclk);
@@ -3017,8 +3031,11 @@ static int __maybe_unused ravb_resume(struct device *dev)intret=0;/* If WoL is enabled set reset mode to rearm the WoL logic */-if(priv->wol_enabled)-ravb_write(ndev,CCC_OPC_RESET,CCC);+if(priv->wol_enabled){+ret=ravb_set_opmode(ndev,CCC_OPC_RESET);+if(ret)+returnret;+}/* All register have been reset to default values.*Restoreallregisterswhichwheresetupatprobetimeand
@@ -3026,7 +3043,9 @@ static int __maybe_unused ravb_resume(struct device *dev)*//* Set AVB config mode */-ravb_set_config_mode(ndev);+ret=ravb_set_config_mode(ndev);+if(ret)+returnret;if(info->gptp||info->ccc_gac){/* Set GTI value */
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit e1da043f2b2d956818728ca74c8eacd17feccf5c upstream.
ravb_rzv2m_hw_info::gptp_ref_clk is enabled only for RZ/V2M. RZ/V2M
is an ARM64-based device which selects power domains by default and
CONFIG_PM. The RZ/V2M Ethernet DT node has proper power-domain binding
available in device tree from the commit that added the Ethernet node.
(4872ca1f92b0 ("arm64: dts: renesas: r9a09g011: Add ethernet nodes")).
Power domain support was available in the rzg2l-cpg.c driver when the
Ethernet DT node has been enabled in RZ/V2M device tree.
(ef3c613ccd68 ("clk: renesas: Add CPG core wrapper for RZ/G2L SoC")).
Thus, remove the explicit clock enable for gptp_clk (and treat it as the
other clocks are treated) as it is not needed and removing it doesn't
break the ABI according to the above explanations.
By removing the enable/disable operation from the driver we can add
runtime PM support (which operates on clocks) w/o the need to handle
the gptp_clk in the Ethernet driver functions like ravb_runtime_nop().
PM domain does all that is needed.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit c5c0714e29508fd748ee5df09ae242476bf2e451 upstream.
RZ/G3S can go to deep sleep states where power to most of the SoC parts is
off. When resuming from such a state, the Ethernet controller needs to be
reinitialized. De-asserting the reset signal for it should also be done.
Thus, add reset assert/de-assert on suspend/resume functions.
On the resume function, the de-assert was not reverted in case of failures
to give the user a chance to restore the interface (e.g., bringing down/up
the interface) in case suspend/resume failed.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
@@ -2983,7 +2983,7 @@ static int __maybe_unused ravb_suspend(struct device *dev)intret;if(!netif_running(ndev))-return0;+gotoreset_assert;netif_device_detach(ndev);
@@ -2995,7 +2995,11 @@ static int __maybe_unused ravb_suspend(struct device *dev)if(priv->info->ccc_gac)ravb_ptp_stop(ndev);-returnret;+if(priv->wol_enabled)+returnret;++reset_assert:+returnreset_control_assert(priv->rstc);}staticint__maybe_unusedravb_resume(structdevice*dev)
@@ -3003,7 +3007,11 @@ static int __maybe_unused ravb_resume(struct device *dev)structnet_device*ndev=dev_get_drvdata(dev);structravb_private*priv=netdev_priv(ndev);conststructravb_hw_info*info=priv->info;-intret=0;+intret;++ret=reset_control_deassert(priv->rstc);+if(ret)+returnret;/* If WoL is enabled set reset mode to rearm the WoL logic */if(priv->wol_enabled){
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit b1768e3dc47792ac5876643604be25bc8ed17cd4 upstream.
On the RZ/G3S SoC the reset controller is mandatory for the IP to work.
The device tree binding documentation for the ravb driver specifies that
the resets are mandatory. Based on this, make the resets mandatory also in
driver for all ravb devices.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[claudiu.beznea: fixed conflict in Kconfig]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/Kconfig | 1 +
drivers/net/ethernet/renesas/ravb_main.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
@@ -2648,7 +2648,7 @@ static int ravb_probe(struct platform_device *pdev)return-EINVAL;}-rstc=devm_reset_control_get_optional_exclusive(&pdev->dev,NULL);+rstc=devm_reset_control_get_exclusive(&pdev->dev,NULL);if(IS_ERR(rstc))returndev_err_probe(&pdev->dev,PTR_ERR(rstc),"failed to get cpg reset\n");
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a654f6e875b753d11643840e266f7fd75e5ee1fa upstream.
Reference clock could be or not be part of the power domain. If it is part
of the power domain, the power domain takes care of properly setting it. In
case it is not part of the power domain and full runtime PM support is
available in driver the clock will not be propertly disabled/enabled at
runtime. For this, keep the prepare/unprepare operations in the driver's
probe()/remove() functions and move the enable/disable in runtime PM
functions.
By doing this, the previous ravb_runtime_nop() function was renamed
ravb_runtime_suspend() and the comment was removed. A proper runtime PM
resume function was added (ravb_runtime_resume()). The current driver
still don't need to make any register settings on runtime suspend/resume
(as expressed in the removed comment) because, currently,
pm_runtime_put_sync() is called on the driver remove function. This will be
changed in the next commits (that extends the runtime PM support) such
that proper register settings (along with runtime resume/suspend) will be
done on ravb_open()/ravb_close().
Along with it, the other clock request operations were moved close to
reference clock request and prepare to have all the clock requests
specific code grouped together.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[claudiu.beznea:
- added __maybe_unused to ravb_runtime_suspend(),
ravb_runtime_resume()
- fixed conflict around SET_RUNTIME_PM_OPS()]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 110 ++++++++++++-----------
1 file changed, 57 insertions(+), 53 deletions(-)
@@ -2667,11 +2667,6 @@ static int ravb_probe(struct platform_device *pdev)if(error)gotoout_free_netdev;-pm_runtime_enable(&pdev->dev);-error=pm_runtime_resume_and_get(&pdev->dev);-if(error<0)-gotoout_rpm_disable;-if(info->multi_irqs){if(info->err_mgmt_irqs)irq=platform_get_irq_byname(pdev,"dia");
@@ -2682,7 +2677,7 @@ static int ravb_probe(struct platform_device *pdev)}if(irq<0){error=irq;-gotoout_release;+gotoout_reset_assert;}ndev->irq=irq;
@@ -2700,10 +2695,37 @@ static int ravb_probe(struct platform_device *pdev)priv->num_rx_ring[RAVB_NC]=NC_RX_RING_SIZE;}+priv->clk=devm_clk_get(&pdev->dev,NULL);+if(IS_ERR(priv->clk)){+error=PTR_ERR(priv->clk);+gotoout_reset_assert;+}++if(info->gptp_ref_clk){+priv->gptp_clk=devm_clk_get(&pdev->dev,"gptp");+if(IS_ERR(priv->gptp_clk)){+error=PTR_ERR(priv->gptp_clk);+gotoout_reset_assert;+}+}++priv->refclk=devm_clk_get_optional(&pdev->dev,"refclk");+if(IS_ERR(priv->refclk)){+error=PTR_ERR(priv->refclk);+gotoout_reset_assert;+}+clk_prepare(priv->refclk);++platform_set_drvdata(pdev,ndev);+pm_runtime_enable(&pdev->dev);+error=pm_runtime_resume_and_get(&pdev->dev);+if(error<0)+gotoout_rpm_disable;+priv->addr=devm_platform_get_and_ioremap_resource(pdev,0,&res);if(IS_ERR(priv->addr)){error=PTR_ERR(priv->addr);-gotoout_release;+gotoout_rpm_put;}/* The Ether-specific entries in the device structure. */
@@ -2714,7 +2736,7 @@ static int ravb_probe(struct platform_device *pdev)error=of_get_phy_mode(np,&priv->phy_interface);if(error&&error!=-ENODEV)-gotoout_release;+gotoout_rpm_put;priv->no_avb_link=of_property_read_bool(np,"renesas,no-ether-link");priv->avb_link_active_low=
@@ -2727,14 +2749,14 @@ static int ravb_probe(struct platform_device *pdev)irq=platform_get_irq_byname(pdev,"ch24");if(irq<0){error=irq;-gotoout_release;+gotoout_rpm_put;}priv->emac_irq=irq;for(i=0;i<NUM_RX_QUEUE;i++){irq=platform_get_irq_byname(pdev,ravb_rx_irqs[i]);if(irq<0){error=irq;-gotoout_release;+gotoout_rpm_put;}priv->rx_irqs[i]=irq;}
@@ -2742,7 +2764,7 @@ static int ravb_probe(struct platform_device *pdev)irq=platform_get_irq_byname(pdev,ravb_tx_irqs[i]);if(irq<0){error=irq;-gotoout_release;+gotoout_rpm_put;}priv->tx_irqs[i]=irq;}
@@ -2751,40 +2773,19 @@ static int ravb_probe(struct platform_device *pdev)irq=platform_get_irq_byname(pdev,"err_a");if(irq<0){error=irq;-gotoout_release;+gotoout_rpm_put;}priv->erra_irq=irq;irq=platform_get_irq_byname(pdev,"mgmt_a");if(irq<0){error=irq;-gotoout_release;+gotoout_rpm_put;}priv->mgmta_irq=irq;}}-priv->clk=devm_clk_get(&pdev->dev,NULL);-if(IS_ERR(priv->clk)){-error=PTR_ERR(priv->clk);-gotoout_release;-}--priv->refclk=devm_clk_get_optional(&pdev->dev,"refclk");-if(IS_ERR(priv->refclk)){-error=PTR_ERR(priv->refclk);-gotoout_release;-}-clk_prepare_enable(priv->refclk);--if(info->gptp_ref_clk){-priv->gptp_clk=devm_clk_get(&pdev->dev,"gptp");-if(IS_ERR(priv->gptp_clk)){-error=PTR_ERR(priv->gptp_clk);-gotoout_disable_refclk;-}-}-ndev->max_mtu=info->rx_max_buf_size-(ETH_HLEN+VLAN_HLEN+ETH_FCS_LEN);ndev->min_mtu=ETH_MIN_MTU;
@@ -2802,13 +2803,13 @@ static int ravb_probe(struct platform_device *pdev)/* Set AVB config mode */error=ravb_set_config_mode(ndev);if(error)-gotoout_disable_refclk;+gotoout_rpm_put;if(info->gptp||info->ccc_gac){/* Set GTI value */error=ravb_set_gti(ndev);if(error)-gotoout_disable_refclk;+gotoout_rpm_put;/* Request GTI loading */ravb_modify(ndev,GCCR,GCCR_LTI,GCCR_LTI);
@@ -2828,7 +2829,7 @@ static int ravb_probe(struct platform_device *pdev)"Cannot allocate desc base address table (size %d bytes)\n",priv->desc_bat_size);error=-ENOMEM;-gotoout_disable_refclk;+gotoout_rpm_put;}for(q=RAVB_BE;q<DBAT_ENTRY_NUM;q++)priv->desc_bat[q].die_dt=DT_EOS;
@@ -2874,8 +2875,6 @@ static int ravb_probe(struct platform_device *pdev)netdev_info(ndev,"Base address at %#x, %pM, IRQ %d.\n",(u32)ndev->base_addr,ndev->dev_addr,ndev->irq);-platform_set_drvdata(pdev,ndev);-return0;out_napi_del:
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 32f012b8c01ca9fd26a28134cc2165ead93c22d0 upstream.
The runtime PM implementation will disable clocks at the end of
ravb_probe(). As some IP variants switch to reset mode as a result of
setting module standby through clock disable APIs, to implement runtime PM
the resource parsing and requesting are moved in the probe function and IP
settings are moved in the open function. This is done because at the end of
the probe some IP variants will switch anyway to reset mode and the
registers content is lost. Also keeping only register settings operations
in the ravb_open()/ravb_close() functions will make them faster.
Commit moves IRQ requests to ravb_probe() to have all the IRQs ready when
the interface is open. As now getting/requesting IRQs is done in a single
place there is no need to keep intermediary data (like ravb_rx_irqs[] and
ravb_tx_irqs[] arrays or IRQs in struct ravb_private).
In order to avoid accessing the IP registers while the IP is runtime
suspended (e.g. in the timeframe b/w the probe requests shared IRQs and
IP clocks are enabled) in the interrupt handlers were introduced
pm_runtime_active() checks. The device runtime PM usage counter has been
incremented to avoid disabling the device's clocks while the check is in
progress (if any).
This is a preparatory change to add runtime PM support for all IP variants.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb.h | 4 -
drivers/net/ethernet/renesas/ravb_main.c | 299 ++++++++++-------------
2 files changed, 130 insertions(+), 173 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 2b993bfdb47b3aaafd8fe9cd5038b5e297b18ee1 upstream.
ravb_poll() initial code used to interrogate the first descriptor of the
RX queue in case gPTP is false to determine if ravb_rx() should be called.
This is done for non-gPTP IPs. For gPTP IPs the driver PTP-specific
information was used to determine if receive function should be called. As
every IP has its own receive function that interrogates the RX descriptors
list in the same way the ravb_poll() was doing there is no need to double
check this in ravb_poll(). Removing the code from ravb_poll() leads to a
cleaner code.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[claudiu.beznea: fixed conflict in ravb_poll()]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 16 ++--------------
1 file changed, 2 insertions(+), 14 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit f384ab481cab6ad71afdf9c80a8b407a70a8624c upstream.
ravb_set_gti() was computing the value of GTI based on the reference clock
rate and then applied it to register. This was done on the driver's probe
function. In order to implement runtime PM for all IP variants (as some IP
variants switches to reset mode (and thus the registers content is lost)
when module standby is configured through clock APIs) the GTI setup was
split in 2 parts: one computing the value of the GTI register (done in the
driver's probe function) and one applying the computed value to register
(done in the driver's ndo_open API).
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb.h | 2 +
drivers/net/ethernet/renesas/ravb_main.c | 96 ++++++++++++------------
2 files changed, 52 insertions(+), 46 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit cd1fb46e02de3c70d6379b00c0e860ca44954574 upstream.
DBAT setup was done in the driver's probe API. As some IP variants switch
to reset mode (and thus registers content is lost) when setting clocks
(due to module standby functionality) to be able to implement runtime PM
move the DBAT configuration in the driver's ndo_open API.
This commit prepares the code for the addition of runtime PM.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit b07bc55cbb1cf88a527d687fccd4a12bac744486 upstream.
As ravb_close() contains now the call to ravb_ptp_stop() for both ccc_gac
and gPTP aware platforms, there is no need to keep the separate call in
ravb_suspend(). Instead, move it to ravb_wol_setup(). In this way the
resulting code is cleaner.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a6a85ba36fd0d3e5595a4fcf57e0811826254ff7 upstream.
The initialization sequence for PTP is the same for platforms with ccc_gac
and gptp (according to "Figure 50.71 Flow of gPTP Initialization (Normal,
Common to All Modes)" of the R-Car Series, 3rd generation hardware
manual and "Figure 37A.53 Flow of gPTP Initialization (Normal, Common to
All Modes)" of the RZ/G Series hardware manual).
As some IP variants switch to reset mode (and thus the registers content is
lost) when setting clocks (due to module standby functionality) to be able
to implement runtime PM, move the PTP initialization to the driver's
ndo_open API.
This commit prepares the code for the addition of runtime PM.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
@@ -2210,7 +2210,7 @@ static int ravb_close(struct net_device *ndev)ravb_write(ndev,0,TIC);/* Stop PTP Clock driver */-if(info->gptp)+if(info->gptp||info->ccc_gac)ravb_ptp_stop(ndev);/* Set the config mode to stop the AVB-DMAC's processes */
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 76fd52c1007785fcea1d3405907cec940d44f403 upstream.
As some IP variants switch to reset mode (and thus the register contents is
lost) when setting clocks (due to module standby functionality) to be able
to implement runtime PM and save more power, set the IP's operating mode to
reset at the end of the probe. Along with it, in the ndo_open API the IP
will be switched to configuration, then operation mode. In the ndo_close
API, the IP will be switched back to reset mode. This allows implementing
runtime PM and, along with it, save more power when the IP is not used.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
[claudiu.beznea: fixed conflict]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 78 ++++++++++++++----------
1 file changed, 46 insertions(+), 32 deletions(-)
@@ -1766,6 +1766,27 @@ static const struct ethtool_ops ravb_ethtool_ops = {.set_wol=ravb_set_wol,};+staticintravb_set_config_mode(structnet_device*ndev)+{+structravb_private*priv=netdev_priv(ndev);+conststructravb_hw_info*info=priv->info;+interror;++if(info->gptp){+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);+if(error)+returnerror;+/* Set CSEL value */+ravb_modify(ndev,CCC,CCC_CSEL,CCC_CSEL_HPB);+}elseif(info->ccc_gac){+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG|CCC_GAC|CCC_CSEL_HPB);+}else{+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);+}++returnerror;+}+staticvoidravb_set_gti(structnet_device*ndev){structravb_private*priv=netdev_priv(ndev);
@@ -1874,13 +1895,19 @@ static int ravb_open(struct net_device *ndev)if(info->nc_queues)napi_enable(&priv->napi[RAVB_NC]);+/* Set AVB config mode */+error=ravb_set_config_mode(ndev);+if(error)+gotoout_napi_off;+ravb_set_delay_mode(ndev);ravb_write(ndev,priv->desc_bat_dma,DBAT);/* Device init */error=ravb_dmac_init(ndev);if(error)-gotoout_napi_off;+gotoout_set_reset;+ravb_emac_init(ndev);ravb_set_gti(ndev);
@@ -1903,6 +1930,8 @@ static int ravb_open(struct net_device *ndev)if(info->gptp||info->ccc_gac)ravb_ptp_stop(ndev);ravb_stop_dma(ndev);+out_set_reset:+ravb_set_opmode(ndev,CCC_OPC_RESET);out_napi_off:if(info->nc_queues)napi_disable(&priv->napi[RAVB_NC]);
@@ -2246,7 +2275,8 @@ static int ravb_close(struct net_device *ndev)if(info->nc_queues)ravb_ring_free(ndev,RAVB_NC);-return0;+/* Set reset mode. */+returnravb_set_opmode(ndev,CCC_OPC_RESET);}staticintravb_hwtstamp_get(structnet_device*ndev,structifreq*req)
@@ -2569,27 +2599,6 @@ static const struct of_device_id ravb_match_table[] = {};MODULE_DEVICE_TABLE(of,ravb_match_table);-staticintravb_set_config_mode(structnet_device*ndev)-{-structravb_private*priv=netdev_priv(ndev);-conststructravb_hw_info*info=priv->info;-interror;--if(info->gptp){-error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);-if(error)-returnerror;-/* Set CSEL value */-ravb_modify(ndev,CCC,CCC_CSEL,CCC_CSEL_HPB);-}elseif(info->ccc_gac){-error=ravb_set_opmode(ndev,CCC_OPC_CONFIG|CCC_GAC|CCC_CSEL_HPB);-}else{-error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);-}--returnerror;-}-staticintravb_setup_irq(structravb_private*priv,constchar*irq_name,constchar*ch,int*irq,irq_handler_thandler){
@@ -2788,11 +2797,6 @@ static int ravb_probe(struct platform_device *pdev)ndev->netdev_ops=&ravb_netdev_ops;ndev->ethtool_ops=&ravb_ethtool_ops;-/* Set AVB config mode */-error=ravb_set_config_mode(ndev);-if(error)-gotoout_rpm_put;-error=ravb_compute_gti(ndev);if(error)gotoout_rpm_put;
@@ -2819,6 +2823,11 @@ static int ravb_probe(struct platform_device *pdev)/* Debug message level */priv->msg_enable=RAVB_DEF_MSG_ENABLE;+/* Set config mode as this is needed for PHY initialization. */+error=ravb_set_opmode(ndev,CCC_OPC_CONFIG);+if(error)+gotoout_rpm_put;+/* Read and set MAC address */ravb_read_mac_address(ndev,of_get_mac_address(np));if(!is_valid_ether_addr(ndev->dev_addr)){
@@ -2831,9 +2840,14 @@ static int ravb_probe(struct platform_device *pdev)error=ravb_mdio_init(priv);if(error){dev_err(&pdev->dev,"failed to initialize MDIO\n");-gotoout_dma_free;+gotoout_reset_mode;}+/* Undo previous switch to config opmode. */+error=ravb_set_opmode(ndev,CCC_OPC_RESET);+if(error)+gotoout_mdio_release;+netif_napi_add(ndev,&priv->napi[RAVB_BE],ravb_poll,64);if(info->nc_queues)netif_napi_add(ndev,&priv->napi[RAVB_NC],ravb_poll,64);
@@ -2856,8 +2870,10 @@ static int ravb_probe(struct platform_device *pdev)netif_napi_del(&priv->napi[RAVB_NC]);netif_napi_del(&priv->napi[RAVB_BE]);+out_mdio_release:ravb_mdio_release(priv);-out_dma_free:+out_reset_mode:+ravb_set_opmode(ndev,CCC_OPC_RESET);dma_free_coherent(ndev->dev.parent,priv->desc_bat_size,priv->desc_bat,priv->desc_bat_dma);out_rpm_put:
@@ -2888,8 +2904,6 @@ static int ravb_remove(struct platform_device *pdev)dma_free_coherent(ndev->dev.parent,priv->desc_bat_size,priv->desc_bat,priv->desc_bat_dma);-ravb_set_opmode(ndev,CCC_OPC_RESET);-pm_runtime_put_sync(&pdev->dev);pm_runtime_disable(&pdev->dev);clk_unprepare(priv->refclk);
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 23698a9abb629009b42ef419072e567b43ca6866 upstream.
Delay parsing and setting were done in the driver's probe API. As some IP
variants switch to reset mode (and thus the register contents is lost) when
setting clocks (due to module standby functionality) to be able to
implement runtime PM keep the delay parsing in the driver's probe function
and move the delay applying function to the driver's ndo_open API.
Along with it, ravb_parse_delay_mode() function was moved close to
ravb_set_delay_mode() function to have the delay specific code in the
same place.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 107 ++++++++++++-----------
1 file changed, 56 insertions(+), 51 deletions(-)
@@ -1810,6 +1810,59 @@ static int ravb_compute_gti(struct net_device *ndev)return0;}+/* Set tx and rx clock internal delay modes */+staticvoidravb_parse_delay_mode(structdevice_node*np,structnet_device*ndev)+{+structravb_private*priv=netdev_priv(ndev);+boolexplicit_delay=false;+u32delay;++if(!priv->info->internal_delay)+return;++if(!of_property_read_u32(np,"rx-internal-delay-ps",&delay)){+/* Valid values are 0 and 1800, according to DT bindings */+priv->rxcidm=!!delay;+explicit_delay=true;+}+if(!of_property_read_u32(np,"tx-internal-delay-ps",&delay)){+/* Valid values are 0 and 2000, according to DT bindings */+priv->txcidm=!!delay;+explicit_delay=true;+}++if(explicit_delay)+return;++/* Fall back to legacy rgmii-*id behavior */+if(priv->phy_interface==PHY_INTERFACE_MODE_RGMII_ID||+priv->phy_interface==PHY_INTERFACE_MODE_RGMII_RXID){+priv->rxcidm=1;+priv->rgmii_override=1;+}++if(priv->phy_interface==PHY_INTERFACE_MODE_RGMII_ID||+priv->phy_interface==PHY_INTERFACE_MODE_RGMII_TXID){+priv->txcidm=1;+priv->rgmii_override=1;+}+}++staticvoidravb_set_delay_mode(structnet_device*ndev)+{+structravb_private*priv=netdev_priv(ndev);+u32set=0;++if(!priv->info->internal_delay)+return;++if(priv->rxcidm)+set|=APSR_RDM;+if(priv->txcidm)+set|=APSR_TDM;+ravb_modify(ndev,APSR,APSR_RDM|APSR_TDM,set);+}+/* Network device open function for Ethernet AVB */staticintravb_open(structnet_device*ndev){
@@ -2534,41 +2589,6 @@ static int ravb_set_config_mode(struct net_device *ndev)returnerror;}-/* Set tx and rx clock internal delay modes */-staticvoidravb_parse_delay_mode(structdevice_node*np,structnet_device*ndev)-{-structravb_private*priv=netdev_priv(ndev);-boolexplicit_delay=false;-u32delay;--if(!of_property_read_u32(np,"rx-internal-delay-ps",&delay)){-/* Valid values are 0 and 1800, according to DT bindings */-priv->rxcidm=!!delay;-explicit_delay=true;-}-if(!of_property_read_u32(np,"tx-internal-delay-ps",&delay)){-/* Valid values are 0 and 2000, according to DT bindings */-priv->txcidm=!!delay;-explicit_delay=true;-}--if(explicit_delay)-return;--/* Fall back to legacy rgmii-*id behavior */-if(priv->phy_interface==PHY_INTERFACE_MODE_RGMII_ID||-priv->phy_interface==PHY_INTERFACE_MODE_RGMII_RXID){-priv->rxcidm=1;-priv->rgmii_override=1;-}--if(priv->phy_interface==PHY_INTERFACE_MODE_RGMII_ID||-priv->phy_interface==PHY_INTERFACE_MODE_RGMII_TXID){-priv->txcidm=1;-priv->rgmii_override=1;-}-}-staticintravb_setup_irq(structravb_private*priv,constchar*irq_name,constchar*ch,int*irq,irq_handler_thandler){
@@ -2653,18 +2673,6 @@ static int ravb_setup_irqs(struct ravb_private *priv)returnravb_setup_irq(priv,"ch19","ch19:tx_nc",&irq,ravb_nc_interrupt);}-staticvoidravb_set_delay_mode(structnet_device*ndev)-{-structravb_private*priv=netdev_priv(ndev);-u32set=0;--if(priv->rxcidm)-set|=APSR_RDM;-if(priv->txcidm)-set|=APSR_TDM;-ravb_modify(ndev,APSR,APSR_RDM|APSR_TDM,set);-}-staticintravb_probe(structplatform_device*pdev){structdevice_node*np=pdev->dev.of_node;
@@ -2788,10 +2796,7 @@ static int ravb_probe(struct platform_device *pdev)if(error)gotoout_rpm_put;-if(info->internal_delay){-ravb_parse_delay_mode(np,ndev);-ravb_set_delay_mode(ndev);-}+ravb_parse_delay_mode(np,ndev);/* Allocate descriptor base address table */priv->desc_bat_size=sizeof(structravb_desc)*DBAT_ENTRY_NUM;
From: Biju Das <biju.das.jz@bp.renesas.com>
commit 6c8e2803ef36d3c0c20c7019a19c668c3b0ac1d1 upstream.
TOE has hardware support for calculating IP header and TCP/UDP/ICMP
checksum for both IPv4 and IPv6.
Add Tx checksum offload supported by TOE for IPv4 and TCP/UDP.
For Tx, the result of checksum calculation is set to the checksum field of
each IPv4 Header/TCP/UDP/ICMP of ethernet frames. For the unsupported
frames, those fields are not changed. If a transmission frame is an UDPv4
frame and its checksum value in the UDP header field is 0x0000, TOE does
not calculate checksum for UDP part of this frame as it is optional
function as per standards.
We can test this functionality by the below commands
ethtool -K eth0 tx on --> to turn on Tx checksum offload
ethtool -K eth0 tx off --> to turn off Tx checksum offload
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Link: https://lore.kernel.org/r/20240207092838.160627-3-biju.das.jz@bp.renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb.h | 15 +++++
drivers/net/ethernet/renesas/ravb_main.c | 71 +++++++++++++++++++++---
2 files changed, 79 insertions(+), 7 deletions(-)
@@ -512,16 +513,28 @@ static int ravb_ring_init(struct net_device *ndev, int q)staticvoidravb_csum_init_gbeth(structnet_device*ndev){-if(!(ndev->features&NETIF_F_RXCSUM))+booltx_enable=ndev->features&NETIF_F_HW_CSUM;+boolrx_enable=ndev->features&NETIF_F_RXCSUM;++if(!(tx_enable||rx_enable))gotodone;ravb_write(ndev,0,CSR0);-if(ravb_wait(ndev,CSR0,CSR0_RPE,0)){+if(ravb_wait(ndev,CSR0,CSR0_TPE|CSR0_RPE,0)){netdev_err(ndev,"Timeout enabling hardware checksum\n");-ndev->features&=~NETIF_F_RXCSUM;++if(tx_enable)+ndev->features&=~NETIF_F_HW_CSUM;++if(rx_enable)+ndev->features&=~NETIF_F_RXCSUM;}else{-ravb_write(ndev,CSR2_RIP4|CSR2_RTCP4|CSR2_RUDP4|CSR2_RICMP4,-CSR2);+if(tx_enable)+ravb_write(ndev,CSR1_TIP4|CSR1_TTCP4|CSR1_TUDP4,CSR1);++if(rx_enable)+ravb_write(ndev,CSR2_RIP4|CSR2_RTCP4|CSR2_RUDP4|CSR2_RICMP4,+CSR2);}done:
@@ -2063,6 +2076,36 @@ static void ravb_tx_timeout_work(struct work_struct *work)rtnl_unlock();}+staticboolravb_can_tx_csum_gbeth(structsk_buff*skb)+{+structiphdr*ip=ip_hdr(skb);++/* TODO: Need to add support for VLAN tag 802.1Q */+if(skb_vlan_tag_present(skb))+returnfalse;++/* TODO: Need to add hardware checksum for IPv6 */+if(skb->protocol!=htons(ETH_P_IP))+returnfalse;++switch(ip->protocol){+caseIPPROTO_TCP:+break;+caseIPPROTO_UDP:+/* If the checksum value in the UDP header field is 0, TOE does+*notcalculatechecksumforUDPpartofthisframeasitis+*optionalfunctionasperstandards.+*/+if(udp_hdr(skb)->check==0)+returnfalse;+break;+default:+returnfalse;+}++returntrue;+}+/* Packet transmit function for Ethernet AVB */staticnetdev_tx_travb_start_xmit(structsk_buff*skb,structnet_device*ndev){
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a5f149a97d09cc9340d8fb4e22a3074a7bc1e02d upstream.
Keep the reverse order of operations in ravb_close() when compared with
ravb_open(). This is the recommended configuration sequence.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit e95273fe4d02a6096ba5fe8287bcd9513396ec71 upstream.
Remove explicit calls to functions that are called by ravb_open(). There is
no need to have them doubled now that the ravb_open() already contains
what is needed for the interface configuration. Along with it,
configurations needed by PTP were moved to ravb_wol_restore(). With this,
code in ravb_resume() becomes simpler.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 58 ++++++++++--------------
1 file changed, 24 insertions(+), 34 deletions(-)
@@ -2944,6 +2944,20 @@ static int ravb_wol_restore(struct net_device *ndev){structravb_private*priv=netdev_priv(ndev);conststructravb_hw_info*info=priv->info;+interror;++/* Set reset mode to rearm the WoL logic. */+error=ravb_set_opmode(ndev,CCC_OPC_RESET);+if(error)+returnerror;++/* Set AVB config mode. */+error=ravb_set_config_mode(ndev);+if(error)+returnerror;++if(priv->info->ccc_gac)+ravb_ptp_init(ndev,priv->pdev);if(info->nc_queues)napi_enable(&priv->napi[RAVB_NC]);
@@ -2983,53 +2997,29 @@ static int __maybe_unused ravb_resume(struct device *dev){structnet_device*ndev=dev_get_drvdata(dev);structravb_private*priv=netdev_priv(ndev);-conststructravb_hw_info*info=priv->info;intret;ret=reset_control_deassert(priv->rstc);if(ret)returnret;-/* If WoL is enabled set reset mode to rearm the WoL logic */+if(!netif_running(ndev))+return0;++/* If WoL is enabled restore the interface. */if(priv->wol_enabled){-ret=ravb_set_opmode(ndev,CCC_OPC_RESET);+ret=ravb_wol_restore(ndev);if(ret)returnret;}-/* All register have been reset to default values.-*Restoreallregisterswhichwheresetupatprobetimeand-*reopendeviceifitwasrunningbeforesystemsuspended.-*/--/* Set AVB config mode */-ret=ravb_set_config_mode(ndev);-if(ret)+/* Reopening the interface will restore the device to the working state. */+ret=ravb_open(ndev);+if(ret<0)returnret;-ravb_set_gti(ndev);--if(info->internal_delay)-ravb_set_delay_mode(ndev);--/* Restore descriptor base address table */-ravb_write(ndev,priv->desc_bat_dma,DBAT);--if(priv->info->ccc_gac)-ravb_ptp_init(ndev,priv->pdev);--if(netif_running(ndev)){-if(priv->wol_enabled){-ret=ravb_wol_restore(ndev);-if(ret)-returnret;-}-ret=ravb_open(ndev);-if(ret<0)-returnret;-ravb_set_rx_mode(ndev);-netif_device_attach(ndev);-}+ravb_set_rx_mode(ndev);+netif_device_attach(ndev);returnret;}
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a260f080660ef8bac97404dd0b9ddbe35a608426 upstream.
The 4th argument of ravb_setup_irq() is used to save the IRQ number that
will be further used by the driver code. Not all ravb_setup_irqs() calls
need to save the IRQ number. The previous code used to pass a dummy
variable as the 4th argument in case the IRQ is not needed for further
usage. That is not necessary as the code from ravb_setup_irq() can detect
by itself if the IRQ needs to be saved. Thus, get rid of the code that is
not needed.
Reported-by: Sergey Shtylyov <redacted>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 29 +++++++++++++-----------
1 file changed, 16 insertions(+), 13 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit bbf2345fa6582c5292bc5c537e7a29aad918be0c upstream.
Return the cached statistics in case the interface is down. There should be
no drawback to this, as cached statistics are updated in ravb_close().
In order to avoid accessing the IP registers while the IP is runtime
suspended pm_runtime_active() check was introduced. The device runtime
PM usage counter has been incremented to avoid disabling the device clocks
while the check is in progress (if any).
The commit prepares the code for the addition of runtime PM support.
Suggested-by: Sergey Shtylyov <redacted>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 7bddccc9911cdff377e16b9a5a386721279b4438 upstream.
Commit c2da9408579d ("ravb: Add Rx checksum offload support for GbEth")
introduced support for setting GbEth features. With this the IP-specific
features update functions update the ndev->features individually.
Next commits add runtime PM support for the ravb driver. The runtime PM
implementation will enable/disable the IP clocks on
the ravb_open()/ravb_close() functions. Accessing the IP registers with
clocks disabled blocks the system.
The ravb_set_features() function could be executed when the Ethernet
interface is closed so we need to ensure we don't access IP registers while
the interface is down when runtime PM support will be in place.
For these, move the update of ndev->features to ravb_set_features(). In
this way we update the ndev->features only when the IP-specific features
set function returns success and we can avoid code duplication when
introducing runtime PM registers protection.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
From: Biju Das <biju.das.jz@bp.renesas.com>
commit c2da9408579d52fdf9b0ec494534d6ac66d4511e upstream.
TOE has hardware support for calculating IP header and TCP/UDP/ICMP
checksum for both IPv4 and IPv6.
Add Rx checksum offload supported by TOE for IPv4 and TCP/UDP protocols.
For Rx, the 4-byte result of checksum calculation is attached to the
Ethernet frames.First 2-bytes is result of IPv4 header checksum and next
2-bytes is TCP/UDP/ICMP checksum.
If a frame does not have checksum error, 0x0000 is attached as checksum
calculation result. For unsupported frames 0xFFFF is attached as checksum
calculation result. In case of an IPv6 packet, IPv4 checksum is always set
to 0xFFFF.
We can test this functionality by the below commands
ethtool -K eth0 rx on --> to turn on Rx checksum offload
ethtool -K eth0 rx off --> to turn off Rx checksum offload
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Link: https://lore.kernel.org/r/20240207092838.160627-2-biju.das.jz@bp.renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb.h | 19 ++++-
drivers/net/ethernet/renesas/ravb_main.c | 92 +++++++++++++++++++++++-
2 files changed, 107 insertions(+), 4 deletions(-)
From: Paul Barker <redacted>
commit c7c449502b51c5b5de79f97a42be750b28f6ecee upstream.
Sending a 7kB ping packet to the RZ/G2L in v6.9-rc2 causes the following
backtrace:
WARNING: CPU: 0 PID: 0 at include/linux/skbuff.h:3127 skb_trim+0x30/0x38
Hardware name: Renesas SMARC EVK based on r9a07g044l2 (DT)
pc : skb_trim+0x30/0x38
lr : ravb_rx_csum_gbeth+0x40/0x90
Call trace:
skb_trim+0x30/0x38
ravb_rx_gbeth+0x56c/0x5cc
ravb_poll+0xa0/0x204
__napi_poll+0x38/0x17c
This is caused by ravb_rx_gbeth() calling ravb_rx_csum_gbeth() with the
wrong skb for a packet which spans multiple descriptors. To fix this,
use the correct skb.
Fixes: c2da9408579d ("ravb: Add Rx checksum offload support for GbEth")
Signed-off-by: Paul Barker <redacted>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit a71a50e391bf00fdc88bb13a867620c59ad744da upstream.
Do not apply features to hardware if the interface is down. In case runtime
PM is enabled, and while the interface is down, the IP will be in reset
mode (as for some platforms disabling the clocks will switch the IP to
reset mode, which will lead to losing register contents) and applying
settings in reset mode is not an option. Instead, cache the features and
apply them in ravb_open() through ravb_emac_init().
To avoid accessing the hardware while the interface is down
pm_runtime_active() check was introduced. Along with it the device runtime
PM usage counter has been incremented to avoid disabling the device clocks
while the check is in progress (if any).
Commit prepares for the addition of runtime PM.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
From: Paul Barker <redacted>
commit 2e36c9fbc476f95a1b19e3fa0a2cdf408475ff56 upstream.
The RX byte accounting for jumbo packets was changed to fix a potential
use-after-free bug. However, that fix used the wrong variable and so
only accounted for the number of bytes in the final descriptor, not the
number of bytes in the whole packet.
To fix this, we can simply update our stats with the correct number of
bytes before calling napi_gro_receive().
Also rename pkt_len to desc_len in ravb_rx_gbeth() to avoid any future
confusion. The variable name pkt_len is correct in ravb_rx_rcar() as
that function does not handle packets spanning multiple descriptors.
Fixes: 5a5a3e564de6 ("ravb: Fix potential use-after-free in ravb_rx_gbeth()")
Signed-off-by: Paul Barker <redacted>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
@@ -818,7 +818,7 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)dma_addr_tdma_addr;intrx_packets=0;u8desc_status;-u16pkt_len;+u16desc_len;u8die_dt;intentry;intlimit;
@@ -833,10 +833,10 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)/* Descriptor type must be checked before all other reads */dma_rmb();desc_status=desc->msc;-pkt_len=le16_to_cpu(desc->ds_cc)&RX_DS;+desc_len=le16_to_cpu(desc->ds_cc)&RX_DS;/* We use 0-byte descriptors to mark the DMA mapping errors */-if(!pkt_len)+if(!desc_len)continue;if(desc_status&MSC_MC)
@@ -857,25 +857,25 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)switch(die_dt){caseDT_FSINGLE:skb=ravb_get_skb_gbeth(ndev,entry,desc);-skb_put(skb,pkt_len);+skb_put(skb,desc_len);skb->protocol=eth_type_trans(skb,ndev);if(ndev->features&NETIF_F_RXCSUM)ravb_rx_csum_gbeth(skb);napi_gro_receive(&priv->napi[q],skb);rx_packets++;-stats->rx_bytes+=pkt_len;+stats->rx_bytes+=desc_len;break;caseDT_FSTART:priv->rx_1st_skb=ravb_get_skb_gbeth(ndev,entry,desc);-skb_put(priv->rx_1st_skb,pkt_len);+skb_put(priv->rx_1st_skb,desc_len);break;caseDT_FMID:skb=ravb_get_skb_gbeth(ndev,entry,desc);skb_copy_to_linear_data_offset(priv->rx_1st_skb,priv->rx_1st_skb->len,skb->data,-pkt_len);-skb_put(priv->rx_1st_skb,pkt_len);+desc_len);+skb_put(priv->rx_1st_skb,desc_len);dev_kfree_skb(skb);break;caseDT_FEND:
@@ -883,17 +883,17 @@ static bool ravb_rx_gbeth(struct net_device *ndev, int *quota, int q)skb_copy_to_linear_data_offset(priv->rx_1st_skb,priv->rx_1st_skb->len,skb->data,-pkt_len);-skb_put(priv->rx_1st_skb,pkt_len);+desc_len);+skb_put(priv->rx_1st_skb,desc_len);dev_kfree_skb(skb);priv->rx_1st_skb->protocol=eth_type_trans(priv->rx_1st_skb,ndev);if(ndev->features&NETIF_F_RXCSUM)ravb_rx_csum_gbeth(priv->rx_1st_skb);+stats->rx_bytes+=priv->rx_1st_skb->len;napi_gro_receive(&priv->napi[q],priv->rx_1st_skb);rx_packets++;-stats->rx_bytes+=pkt_len;break;}}
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 48f894ab07c444b9b26a0913d2032de663f4aecb upstream.
Add runtime PM support for the ravb driver. As the driver is used by
different IP variants, with different behaviors, to be able to have the
runtime PM support available for all devices, the preparatory commits
moved all the resources parsing and allocations in the driver's probe
function and kept the settings for ravb_open(). This is due to the fact
that on some IP variants-platforms tuples disabling/enabling the clocks
will switch the IP to the reset operation mode where register contents is
lost and reconfiguration needs to be done. For this the rabv_open()
function enables the clocks, switches the IP to configuration mode, applies
all the register settings and switches the IP to the operational mode. At
the end of ravb_open() IP is ready to send/receive data.
In ravb_close() necessary reverts are done (compared with ravb_open()), the
IP is switched to reset mode and clocks are disabled.
The ethtool APIs or IOCTLs that might execute while the interface is down
are either cached (and applied in ravb_open()) or rejected (as at that time
the IP is in reset mode). Keeping the IP in the reset mode also increases
the power saved (according to the hardware manual).
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Sergey Shtylyov <redacted>
Signed-off-by: David S. Miller <davem@davemloft.net>
[claudiu.beznea: adjusted to return error in ravb_remove() if
pm_runtime_resume_and_get() fail]
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
drivers/net/ethernet/renesas/ravb_main.c | 54 ++++++++++++++++++++++--
1 file changed, 50 insertions(+), 4 deletions(-)
@@ -1949,16 +1949,21 @@ static int ravb_open(struct net_device *ndev){structravb_private*priv=netdev_priv(ndev);conststructravb_hw_info*info=priv->info;+structdevice*dev=&priv->pdev->dev;interror;napi_enable(&priv->napi[RAVB_BE]);if(info->nc_queues)napi_enable(&priv->napi[RAVB_NC]);+error=pm_runtime_resume_and_get(dev);+if(error<0)+gotoout_napi_off;+/* Set AVB config mode */error=ravb_set_config_mode(ndev);if(error)-gotoout_napi_off;+gotoout_rpm_put;ravb_set_delay_mode(ndev);ravb_write(ndev,priv->desc_bat_dma,DBAT);
@@ -1992,6 +1997,9 @@ static int ravb_open(struct net_device *ndev)ravb_stop_dma(ndev);out_set_reset:ravb_set_opmode(ndev,CCC_OPC_RESET);+out_rpm_put:+pm_runtime_mark_last_busy(dev);+pm_runtime_put_autosuspend(dev);out_napi_off:if(info->nc_queues)napi_disable(&priv->napi[RAVB_NC]);
@@ -2332,6 +2340,8 @@ static int ravb_close(struct net_device *ndev)structravb_private*priv=netdev_priv(ndev);conststructravb_hw_info*info=priv->info;structravb_tstamp_skb*ts_skb,*ts_skb2;+structdevice*dev=&priv->pdev->dev;+interror;netif_tx_stop_all_queues(ndev);
@@ -2381,7 +2391,14 @@ static int ravb_close(struct net_device *ndev)ravb_get_stats(ndev);/* Set reset mode. */-returnravb_set_opmode(ndev,CCC_OPC_RESET);+error=ravb_set_opmode(ndev,CCC_OPC_RESET);+if(error)+returnerror;++pm_runtime_mark_last_busy(dev);+pm_runtime_put_autosuspend(dev);++return0;}staticintravb_hwtstamp_get(structnet_device*ndev,structifreq*req)
@@ -2929,6 +2946,8 @@ static int ravb_probe(struct platform_device *pdev)clk_prepare(priv->refclk);platform_set_drvdata(pdev,ndev);+pm_runtime_set_autosuspend_delay(&pdev->dev,100);+pm_runtime_use_autosuspend(&pdev->dev);pm_runtime_enable(&pdev->dev);error=pm_runtime_resume_and_get(&pdev->dev);if(error<0)
@@ -3034,6 +3053,9 @@ static int ravb_probe(struct platform_device *pdev)netdev_info(ndev,"Base address at %#x, %pM, IRQ %d.\n",(u32)ndev->base_addr,ndev->dev_addr,ndev->irq);+pm_runtime_mark_last_busy(&pdev->dev);+pm_runtime_put_autosuspend(&pdev->dev);+return0;out_napi_del:
@@ -3051,6 +3073,7 @@ static int ravb_probe(struct platform_device *pdev)pm_runtime_put(&pdev->dev);out_rpm_disable:pm_runtime_disable(&pdev->dev);+pm_runtime_dont_use_autosuspend(&pdev->dev);clk_unprepare(priv->refclk);out_reset_assert:reset_control_assert(rstc);
@@ -3064,6 +3087,12 @@ static int ravb_remove(struct platform_device *pdev)structnet_device*ndev=platform_get_drvdata(pdev);structravb_private*priv=netdev_priv(ndev);conststructravb_hw_info*info=priv->info;+structdevice*dev=&priv->pdev->dev;+interror;++error=pm_runtime_resume_and_get(dev);+if(error<0)+returnerror;unregister_netdev(ndev);if(info->nc_queues)
@@ -3075,8 +3104,9 @@ static int ravb_remove(struct platform_device *pdev)dma_free_coherent(ndev->dev.parent,priv->desc_bat_size,priv->desc_bat,priv->desc_bat_dma);-pm_runtime_put_sync(&pdev->dev);+pm_runtime_put_sync_suspend(&pdev->dev);pm_runtime_disable(&pdev->dev);+pm_runtime_dont_use_autosuspend(dev);clk_unprepare(priv->refclk);reset_control_assert(priv->rstc);free_netdev(ndev);
@@ -3160,6 +3190,10 @@ static int __maybe_unused ravb_suspend(struct device *dev)if(ret)returnret;+ret=pm_runtime_force_suspend(&priv->pdev->dev);+if(ret)+returnret;+reset_assert:returnreset_control_assert(priv->rstc);}
@@ -3182,16 +3216,28 @@ static int __maybe_unused ravb_resume(struct device *dev)ret=ravb_wol_restore(ndev);if(ret)returnret;+}else{+ret=pm_runtime_force_resume(dev);+if(ret)+returnret;}/* Reopening the interface will restore the device to the working state. */ret=ravb_open(ndev);if(ret<0)-returnret;+gotoout_rpm_put;ravb_set_rx_mode(ndev);netif_device_attach(ndev);+return0;++out_rpm_put:+if(!priv->wol_enabled){+pm_runtime_mark_last_busy(dev);+pm_runtime_put_autosuspend(dev);+}+returnret;}
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 447765986dbfc321e37b13d7c276b106a469ec0b upstream.
The intention of the SW_SD0_DEV_SEL and SW_SD2_EN macros was to reflect the
state of the SW_CONFIG individual switches available on the RZ/G3S Smarc
Module, and at the same time to have a descriptive name for the switches
themselves. Each individual switch is associated with a signal name,
which might be active-low or not on the board. Using signal names
instead of SW_CONFIG switch names may be confusing for a user who just
playes with switches to select individual functionalities, but also for
an advanced user who looks at the schematics. To avoid even further
confusion, use the switches' names here and instantiate them with an
ON/OFF state. This should be simpler, even though the name of the
switches is not that intuitive. The switches' names documentation
reflects the switches' purposes.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231207070700.4156557-11-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
.../boot/dts/renesas/rzg3s-smarc-som.dtsi | 34 ++++++++++++-------
1 file changed, 21 insertions(+), 13 deletions(-)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 150d81f7a260f36c118cbec253fdd493c671dc29 upstream.
Ethernet IRQ GPIOs are marked as GPIO hogs. Thus, these GPIOs are
requested at probe time without considering if there are other
peripherals that need them. The Ethernet IRQ GPIOs are shared with
SDHI2. Selection between Ethernet and SDHI2 is done through a hardware
switch. To avoid scenarios where one wants to boot with SDHI2 support
and some SDHI pins are not propertly configured because of the GPIO
hogs, guard the Ethernet IRQ GPIO hogs with the proper build flag.
Fixes: 932ff0c802c6 ("arm64: dts: renesas: rzg3s-smarc-som: Enable the Ethernet interfaces")
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20240208124300.2740313-13-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/rzg3s-smarc-som.dtsi | 4 ++++
1 file changed, 4 insertions(+)
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
commit 932ff0c802c678bb6c7a98740eff930dad41fece upstream.
The RZ/G3S Smarc Module has Ethernet PHYs (KSZ9131) connected to each
Ethernet IP. For this, add proper DT descriptions to enable Ethernet
communication through these PHYs.
The interface b/w PHYs and MACs is RGMII. The skew settings were set to
zero as based on phy-mode (rgmii-id) the KSZ9131 driver enables internal
DLL, which adds a 2ns delay b/w clocks (TX/RX) and data signals.
Different pin settings were applied to TXC and TX_CTL compared with the
rest of the RGMII pins to comply with requirements for these pins
imposed by HW manual of RZ/G3S (see chapters "Ether Ch0 Voltage Mode
Control Register (ETH0_POC)", "Ether Ch1 Voltage Mode Control Register
(ETH1_POC)", for power source selection, "Ether MII/RGMII Mode Control
Register (ETH_MODE)" for output-enable and "Input Enable Control
Register (IEN_m)" for input-enable configurations).
Also enable the Ethernet interfaces by selecting SW_CONFIG3 = SW_ON.
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20231207070700.4156557-12-claudiu.beznea.uj@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
.../boot/dts/renesas/rzg3s-smarc-som.dtsi | 141 +++++++++++++++++-
1 file changed, 140 insertions(+), 1 deletion(-)
-----Original Message-----
From: Claudiu <claudiu.beznea@tuxon.dev>
Sent: Wednesday, May 29, 2024 5:10 PM
To: iwamatsu nobuhiro(岩松 信洋 ○DITC□DIT○OST)
[off-list ref]; pavel@denx.de
Cc: cip-dev@lists.cip-project.org; biju.das.jz@bp.renesas.com;
prabhakar.mahadev-lad.rj@bp.renesas.com; paul.barker.ct@bp.renesas.com
Subject: [PATCH 5.10.y-cip 00/47] Add Ethernet support for Renesas RZ/G3S
SoC
From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Hi,
Series adds Ethernet support for Renesas RZ/G3S SoC. Ethernet driver has
been enhanced with runtime PM support. The suspend to RAM support was
also improved.
Series is split as follows:
- patch 01: add clock and reset support for the Ethernet IPs
- patches 02-07: add pinctrl support for the Ethernet IPs
- patches 08-43: add support for suspend to RAM and runtime PM on
the Ethernet driver; in this set there are many preparatory
patches for runtime PM support (as runtime PM
enable/disables
the Ethernet module clock and this influences the Ethernet
module state leanding to registers setup being lost)
along with improvements
- patches 45-47: add device tree support
Thank you,
Claudiu Beznea
Biju Das (2):
ravb: Add Rx checksum offload support for GbEth
ravb: Add Tx checksum offload support for GbEth
Christophe JAILLET (1):
ravb: Use GFP_KERNEL instead of GFP_ATOMIC when possible
Claudiu Beznea (36):
clk: renesas: r9a08g045: Add clock and reset support for ETH0 and ETH1
pinctrl: renesas: rzg2l: Move arg and index in the main function block
pinctrl: renesas: rzg2l: Add pin configuration support for pinmux
groups
pinctrl: renesas: rzg2l: Add support to select power source for
Ethernet pins
pinctrl: renesas: rzg2l: Add output enable support
pinctrl: renesas: rzg2l: Add input enable to the Ethernet pins
pinctrl: renesas: rzg2l: Fix locking in rzg2l_dt_subnode_to_map()
net: ravb: Check return value of reset_control_deassert()
net: ravb: Make write access to CXR35 first before accessing other
EMAC registers
net: ravb: Stop DMA in case of failures on ravb_open()
net: ravb: Keep reverse order of operations in ravb_remove()
net: ravb: Wait for operating mode to be applied
dt-bindings: net: renesas,etheravb: Document RZ/G3S support
net: ravb: Let IP-specific receive function to interrogate descriptors
net: ravb: Rely on PM domain to enable gptp_clk
net: ravb: Make reset controller support mandatory
net: ravb: Assert/de-assert reset on suspend/resume
net: ravb: Move reference clock enable/disable on runtime PM APIs
net: ravb: Move getting/requesting IRQs in the probe() method
net: ravb: Split GTI computation and set operations
net: ravb: Move delay mode set in the driver's ndo_open API
net: ravb: Move DBAT configuration to the driver's ndo_open API
net: ravb: Move PTP initialization in the driver's ndo_open API for
ccc_gac platorms
net: ravb: Set config mode in ndo_open and reset mode in ndo_close
net: ravb: Simplify ravb_suspend()
net: ravb: Simplify ravb_resume()
net: ravb: Get rid of the temporary variable irq
net: ravb: Keep the reverse order of operations in ravb_close()
net: ravb: Return cached statistics if the interface is down
net: ravb: Move the update of ndev->features to ravb_set_features()
net: ravb: Do not apply features to hardware if the interface is down
net: ravb: Add runtime PM support
arm64: dts: renesas: r9a08g045: Add Ethernet nodes
arm64: dts: renesas: rzg3s-smarc-som: Use switches' names to select
on-board functionalities
arm64: dts: renesas: rzg3s-smarc-som: Enable the Ethernet interfaces
arm64: dts: renesas: rzg3s-smarc-som: Guard Ethernet IRQ GPIO hogs
Geert Uytterhoeven (1):
net: ravb: Fix registered interrupt names
Paul Barker (3):
net: ravb: Count packets instead of descriptors in GbEth RX path
net: ravb: Fix GbEth jumbo packet RX checksum handling
net: ravb: Fix RX byte accounting for jumbo packets
Sergey Shtylyov (1):
ravb: ravb_close() always returns 0
Yang Li (1):
ethernet: renesas: Use div64_ul instead of do_div
Yoshihiro Shimoda (1):
net: ravb: Fix lack of register setting after system resumed for Gen3
YueHaibing (1):
ravb: Fix potential use-after-free in ravb_rx_gbeth()
.../bindings/net/renesas,etheravb.yaml | 1 +
arch/arm64/boot/dts/renesas/r9a08g045.dtsi | 38 +
.../boot/dts/renesas/rzg3s-smarc-som.dtsi | 177 ++-
drivers/clk/renesas/r9a08g045-cpg.c | 10 +
drivers/net/ethernet/renesas/Kconfig | 1 +
drivers/net/ethernet/renesas/ravb.h | 40 +-
drivers/net/ethernet/renesas/ravb_main.c | 1074
++++++++++-------
drivers/pinctrl/renesas/pinctrl-rzg2l.c | 164 ++-
8 files changed, 1030 insertions(+), 475 deletions(-)