Skip to content

ARM: sun8i: r40: Add Ethernet support

Chen-Yu Tsai linux-arm-kernel linux-clk linux-devicetree netdev 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest15 patches 17 repliesIn review
  2. v112 patches 15 repliesSuperseded

Changes in v2 from the cover letter

- Default to fetching regmap from device pointed to by syscon phandle, and falling back to syscon API if that fails.

- Dropped .syscon_from_dev field in device data as a result of the previous change.

- Added a large comment block explaining the first change.

- Simplified description of syscon property in sun8i-dwmac binding.

- Regmap now only exposes the EMAC/GMAC register, but retains the offset within its address space.

- Added patches for A64, which reuse the same sun8i-dwmac changes.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/15clk: sunxi-ng: r40: rewrite init code to a platform driverdrivers/clk/sunxi-ng/ccu-sun8i-r40.c+28 -110 replies
2/15clk: sunxi-ng: r40: export a regmap to access the GMAC registerdrivers/clk/sunxi-ng/ccu-sun8i-r40.c+33 -00 replies
3/15dt-bindings: net: dwmac-sun8i: Clean up clock delay chain descriptionsDocumentation/devicetree/bindings/net/dwmac-sun8i.txt+7 -41 reply
4/15dt-bindings: net: dwmac-sun8i: Sort syscon compatibles by alphabetical orderDocumentation/devicetree/bindings/net/dwmac-sun8i.txt+1 -10 replies
5/15dt-bindings: net: dwmac-sun8i: simplify description of syscon propertyDocumentation/devicetree/bindings/net/dwmac-sun8i.txt+1 -61 reply
6/15dt-bindings: net: dwmac-sun8i: Add binding for GMAC on Allwinner R40 SoCDocumentation/devicetree/bindings/net/dwmac-sun8i.txt+3 -01 reply
7/15net: stmmac: dwmac-sun8i: Use regmap_field for syscon register accessdrivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+31 -110 replies
8/15net: stmmac: dwmac-sun8i: Allow getting syscon regmap from external devicedrivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+49 -10 replies
9/15net: stmmac: dwmac-sun8i: Support different ranges for TX/RX delay chainsdrivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+23 -90 replies
10/15net: stmmac: dwmac-sun8i: Add support for GMAC on Allwinner R40 SoCdrivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c+17 -00 replies
11/15ARM: dts: sun8i: r40: bananapi-m2-ultra: Sort device node dereferencesarch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts+35 -340 replies
12/15ARM: dts: sun8i: r40: Add device node and RGMII pinmux node for GMACarch/arm/boot/dts/sun8i-r40.dtsi+34 -00 replies
13/15ARM: dts: sun8i: r40: bananapi-m2-ultra: Enable GMAC ethernet controllerarch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts+30 -00 replies
14/15soc: sunxi: export a regmap for EMAC clock reg on A64drivers/soc/sunxi/sunxi_sram.c+55 -20 replies
15/15arm64: dts: allwinner: a64: add SRAM controller device tree nodearch/arm64/boot/dts/allwinner/sun50i-a64.dtsi+19 -48 replies

Reviews trailers per patch

5 of 15 patches have a Reviewed-by or Acked-by.

PatchRob HerringMaxime Ripard
1/15
2/15
3/15R-b
4/15R-b
5/15R-b
6/15R-b
7/15
8/15
9/15
10/15
11/15
12/15
13/15
14/15
15/15A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH net-next v2 00/15] ARM: sun8i: r40: Add Ethernet support

Hi everyone,

This is v2 of my R40 Ethernet support series.

Changes since v1:

- Default to fetching regmap from device pointed to by syscon phandle, and falling back to syscon API if that fails.

- Dropped .syscon_from_dev field in device data as a result of the previous change.

- Added a large comment block explaining the first change.

- Simplified description of syscon property in sun8i-dwmac binding.

- Regmap now only exposes the EMAC/GMAC register, but retains the offset within its address space.

- Added patches for A64, which reuse the same sun8i-dwmac changes.

This series adds support for the DWMAC based Ethernet controller found on the Allwinner R40 SoC. The controller is either a DWMAC clone or DWMAC core with its registers rearranged. This is already supported by the dwmac-sun8i driver. The glue layer control registers, unlike other sun8i family SoCs, is not in the system controller region, but in the clock control unit, like with the older A20 and A31 SoCs.

While we reuse the bindings for dwmac-sun8i using a syscon phandle reference, we need some custom plumbing for the clock driver to export a regmap that only allows access to the GMAC register to the dwmac-sun8i driver. An alternative would be to allow drivers to register custom syscon devices with their own regmap and locking.

Patch 1 converts the CLK_OF_DECLARE style clock driver to a platform one, so the regmap introduced later has a struct device to tie to.

Patch 2 adds a regmap that is exported by the clock driver for the dwmac-sun8i driver to use.

Patches 3, 4, and 5 clean up the dwmac-sun8i binding.

Patch 6 adds device tree binding for Allwinner R40's Ethernet controller.

Patch 7 converts regmap access of the syscon region in the dwmac-sun8i driver to regmap_field, in anticipation of different field widths on the R40.

Patch 8 introduces custom plumbing in the dwmac-sun8i driver to fetch a regmap from another device, by looking up said device via a phandle, then getting the regmap associated with that device.

Patch 9 adds support for different or absent TX/RX delay chain ranges to the dwmac-sun8i driver.

Patch 10 adds support for the R40's ethernet controller.

Patch 11 cleans up the Bananapi M2 Ultra device tree file.

Patch 12 adds a GMAC device node and RGMII mode pinmux setting for the R40.

Patch 13 enables Ethernet on the Bananapi M2 Ultra.

Patches 14 and 15 are for the A64. They convert the existing syscon device to an SRAM controller device that exports a regmap. The needed driver changes are in patch 14, and the device tree changes are in patch 15.

Please have a look.

Regards
ChenYu

Chen-Yu Tsai (11):
dt-bindings: net: dwmac-sun8i: Clean up clock delay chain descriptions
dt-bindings: net: dwmac-sun8i: Sort syscon compatibles by alphabetical
order
dt-bindings: net: dwmac-sun8i: simplify description of syscon property
dt-bindings: net: dwmac-sun8i: Add binding for GMAC on Allwinner R40
SoC
net: stmmac: dwmac-sun8i: Use regmap_field for syscon register access
net: stmmac: dwmac-sun8i: Allow getting syscon regmap from external
device
net: stmmac: dwmac-sun8i: Support different ranges for TX/RX delay
chains
net: stmmac: dwmac-sun8i: Add support for GMAC on Allwinner R40 SoC
ARM: dts: sun8i: r40: bananapi-m2-ultra: Sort device node dereferences
ARM: dts: sun8i: r40: Add device node and RGMII pinmux node for GMAC
ARM: dts: sun8i: r40: bananapi-m2-ultra: Enable GMAC ethernet
controller

Icenowy Zheng (4):
clk: sunxi-ng: r40: rewrite init code to a platform driver
clk: sunxi-ng: r40: export a regmap to access the GMAC register
soc: sunxi: export a regmap for EMAC clock reg on A64
arm64: dts: allwinner: a64: add SRAM controller device tree node

 .../devicetree/bindings/net/dwmac-sun8i.txt   |  21 +--
 .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts  |  99 ++++++++-----
 arch/arm/boot/dts/sun8i-r40.dtsi              |  34 +++++
 arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi |  23 ++-
 drivers/clk/sunxi-ng/ccu-sun8i-r40.c          |  72 +++++++--
 .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 139 +++++++++++++++---
 drivers/soc/sunxi/sunxi_sram.c                |  57 ++++++-
 7 files changed, 364 insertions(+), 81 deletions(-)
Signature · 1 line
2.17.0