Renesas Ethernet AVB driver
Subsystems (7)
PATCH v2 1/1 Renesas Ethernet AVB driver
Ethernet AVB includes an Gigabit Ethernet controller (E-MAC) that is basically compatible with SuperH Gigabit Ethernet E-MAC). Ethernet AVB has a dedicated direct memory access controller (AVB-DMAC) that is a new design compared to the SuperH E-DMAC. The AVB-DMAC is compliant with 3 standards formulated for IEEE 802.1BA: IEEE 802.1AS timing and synchronization protocol, IEEE 802.1Qav real- time transfer, and the IEEE 802.1Qat stream reservation protocol.
Not only the Ethernet driver is enclosed, there is also the PTP driver in the same file. These drivers only support device tree probing, so the binding document is included in this patch.
Based on the original patches by Mitsuhiro Kimura (Ethernet driver) and Masaru Nagai (PTP driver).
---
This patch is against David Miller's 'net-next.git' repo.
Changes in version 2:
- fixed the bug where interrupts weren't re-enabled in ravb_set_ringparam();
- added netif_device_{detach|attach}() calls to ravb_set_ringparam(), fixing TX watchdog being fired during ring resize;
- made ravb_ring_{init|free}(), ravb_free_dma_buffer(), and ravb_[ed]mac_init() calls conditional fixing crash/memory leak when resizing rings of a closed device;
- fixed the order of setting SKBTX_IN_PROGRESS and skb_tx_timestamp() calls;
- implemented ndo_set_rx_mode() method;
- implemented SIOCGHWTSTAMP ioctl(), turning *if* statement in ravb_do_ioctl() into *switch*;
- merged ravb_wait_clear() and ravb_wait_setting() into ravb_wait(), switching to 100 times more frequent polling and simplfying the code;
- replaced unbounded register polling loops with ravb_wait() calls;
- switched to using 'struct timespec64' instead of 'struct timespec' whenever possible, adding code to read/write extra PTP registers;
- added dma_[rw]mb() barrier calls where needed (with comments);
- renamed ravb_reset() to ravb_config(), fixed the comment grammar there;
- renamed ravb_mac_init() to ravb_emac_init(), removing now unneeded parameter, renamed local variable there, simplified the expression assigned to that variable;
- removed now unneeded parameter from ravb_dmac_init() along with the code disabling interrupts, moved netif_start_queue() from this function to its callers;
- renamed ravb_hwtstamp_ioctl() to ravb_hwtstamp_set(), renaming the 2nd parameter, removing unused 3rd parameter, and turning the initializer for one of the local variables into assignment;
- removed unused parameter from ravb_rx();
- renamed variables in ravb_get_tx_tstamp() and ravb_close();
- changed the "compatible" property values;
- removed unneeded parens and netif_queue_stopped() call in ravb_poll(), fixed the comment there;
- simplified ravb_ptp_is_config();
- realigned some lines/names/operators throughout;
- sorted the variable declarations by length descending thoughout;
- capitalize the first letter in the comments thoughout;
- added Masaru Nagai to MODULE_AUTHOR();
- mentioned the PTP driver in the changelog.
Documentation/devicetree/bindings/net/renesas,ravb.txt | 48 drivers/net/ethernet/renesas/Kconfig | 14 drivers/net/ethernet/renesas/Makefile | 1 drivers/net/ethernet/renesas/ravb.c | 3089 +++++++++++++++++ 4 files changed, 3152 insertions(+)
Documentation/devicetree/bindings/net/renesas,ravb.txt new file +48 -0
@@ -0,0 +1,48 @@ +* Renesas Electronics Ethernet AVB + +This file provides information on what the device node for the Ethernet AVB +interface contains. + +Required properties: +- compatible: "renesas,etheravb-r8a7790" if the device is a part of R8A7790 SoC. + "renesas,etheravb-r8a7794" if the device is a part of R8A7794 SoC. +- reg: offset and length of (1) the register block and (2) the stream buffer. +- interrupts: interrupt specifier for the sole interrupt. +- phy-mode: see ethernet.txt file in the same directory. +- phy-handle: see ethernet.txt file in the same directory. +- #address-cells: number of address cells for the MDIO bus, must be equal to 1. +- #size-cells: number of size cells on the MDIO bus, must be equal to 0. +- clocks: clock phandle and specifier pair. +- pinctrl-0: phandle, referring to a default pin configuration node. + +Optional properties: +- interrupt-parent: the phandle for the interrupt controller that services + interrupts for this device. +- pinctrl-names: pin configuration state name ("default"). +- renesas,no-ether-link: boolean, specify when a board does not provide a proper + AVB_LINK signal. +- renesas,ether-link-active-low: boolean, specify when the AVB_LINK signal is + active-low instead of normal active-high. + +Example: + + ethernet@e6800000 { + compatible = "renesas,etheravb-r8a7790"; + reg = <0 0xe6800000 0 0x800>, <0 0xee0e8000 0 0x4000>; + interrupt-parent = <&gic>; + interrupts = <0 163 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&mstp8_clks R8A7790_CLK_ETHERAVB>; + phy-mode = "rmii"; + phy-handle = <&phy0>; + pinctrl-0 = <ðer_pins>; + pinctrl-names = "default"; + renesas,no-ether-link; + #address-cells = <1>; + #size-cells = <0>; + + phy0: ethernet-phy@0 { + reg = <0>; + interrupt-parent = <&gpio2>; + interrupts = <15 IRQ_TYPE_LEVEL_LOW>; + }; + };
drivers/net/ethernet/renesas/Kconfig +14 -0
@@ -15,3 +15,17 @@ config SH_ETH This driver supporting CPUs are: - SH7619, SH7710, SH7712, SH7724, SH7734, SH7763, SH7757, R8A7740, R8A777x and R8A779x. + +config RAVB + tristate "Renesas Ethernet AVB support" + depends on HAS_DMA + depends on ARCH_SHMOBILE || COMPILE_TEST + select CRC32 + select MII + select MDIO_BITBANG + select PHYLIB + select PTP_1588_CLOCK + help + Renesas Ethernet AVB device driver. + This driver supports the following SoCs: + - R8A779x.
drivers/net/ethernet/renesas/Makefile +1 -0
@@ -3,3 +3,4 @@ # obj-$(CONFIG_SH_ETH) += sh_eth.o +obj-$(CONFIG_RAVB) += ravb.o
drivers/net/ethernet/renesas/ravb.c new file +3089 -0
2,931 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.
David Miller
maintainerFrom: Sergei Shtylyov <[email protected]>
Date: Mon, 13 Apr 2015 01:36:56 +0300
Quoted 11 lines
Ethernet AVB includes an Gigabit Ethernet controller (E-MAC) that is basically compatible with SuperH Gigabit Ethernet E-MAC). Ethernet AVB has a dedicated direct memory access controller (AVB-DMAC) that is a new design compared to the SuperH E-DMAC. The AVB-DMAC is compliant with 3 standards formulated for IEEE 802.1BA: IEEE 802.1AS timing and synchronization protocol, IEEE 802.1Qav real- time transfer, and the IEEE 802.1Qat stream reservation protocol.
Not only the Ethernet driver is enclosed, there is also the PTP driver in the same file. These drivers only support device tree probing, so the binding document is included in this patch.
Quoted 6 lines
Based on the original patches by Mitsuhiro Kimura (Ethernet driver) and Masaru Nagai (PTP driver).
Signed-off-by Mitsuhiro Kimura <[email protected]>Signed-off-by Masaru Nagai <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>
Doesn't build properly on x86-64:
CC [M] drivers/net/ethernet/renesas/ravb.odrivers/net/ethernet/renesas/ravb.c: In function ‘ravb_set_buffer_align’:drivers/net/ethernet/renesas/ravb.c:955:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
u32 reserve = (u32)skb->data & (RAVB_ALIGN - 1);
^drivers/net/ethernet/renesas/ravb.c: At top level:drivers/net/ethernet/renesas/ravb.c:2771:2: error: unknown field ‘gettime’ specified in initializer
.gettime = ravb_ptp_gettime,
^drivers/net/ethernet/renesas/ravb.c:2772:2: error: unknown field ‘settime’ specified in initializer
.settime = ravb_ptp_settime,
^
It is not acceptable to fix this by removing COMPILE_TEST from the Kconfig dependencies or something like that.
Thanks.
Hello.
Quoted 25 lines · David Miller
Quoted 11 lines
Ethernet AVB includes an Gigabit Ethernet controller (E-MAC) that is basically compatible with SuperH Gigabit Ethernet E-MAC). Ethernet AVB has a dedicated direct memory access controller (AVB-DMAC) that is a new design compared to the SuperH E-DMAC. The AVB-DMAC is compliant with 3 standards formulated for IEEE 802.1BA: IEEE 802.1AS timing and synchronization protocol, IEEE 802.1Qav real- time transfer, and the IEEE 802.1Qat stream reservation protocol.
Not only the Ethernet driver is enclosed, there is also the PTP driver in the same file. These drivers only support device tree probing, so the binding document is included in this patch.
Quoted 6 lines
Based on the original patches by Mitsuhiro Kimura (Ethernet driver) and Masaru Nagai (PTP driver).
Signed-off-by Mitsuhiro Kimura <[email protected]>Signed-off-by Masaru Nagai <[email protected]>Signed-off-by Sergei Shtylyov <[email protected]>Doesn't build properly on x86-64:
CC [M]
drivers/net/ethernet/renesas/ravb.odrivers/net/ethernet/renesas/ravb.c: In function ‘ravb_set_buffer_align’:drivers/net/ethernet/renesas/ravb.c:955:16: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]u32 reserve = (u32)skb->data & (RAVB_ALIGN - 1); ^
Quoted 7 lines
drivers/net/ethernet/renesas/ravb.c: At top level:drivers/net/ethernet/renesas/ravb.c:2771:2: error: unknown field ‘gettime’ specified in initializer
.gettime =ravb_ptp_gettime,
^drivers/net/ethernet/renesas/ravb.c:2772:2: error: unknown field ‘settime’ specified in initializer
.settime =ravb_ptp_settime,
^
So, timespec64 patches have been merged to net-next... In my haste I just
forgot to compile-test the driver in net-next, sorry about that. :-<
Quoted 2 lines
It is not acceptable to fix this by removing
COMPILE_TESTfrom theKconfigdependencies or something like that.
It's also impossible as the errors themselves don't depend on ARCH. :-)
Quoted 1 line
Thanks.
WBR, Sergei