Commit 9bf5085a authored by Chen-Yu Tsai's avatar Chen-Yu Tsai Committed by David S. Miller

net: stmmac: dwmac-sun8i: Add support for GMAC on Allwinner R40 SoC

The Allwinner R40 SoC has the EMAC controller supported by dwmac-sun8i.
It is named "GMAC", while EMAC refers to the 10/100 Mbps Ethernet
controller supported by sun4i-emac. The controller is the same, but
the R40 has the glue layer controls in the clock control unit (CCU),
with a reduced RX delay chain, and no TX delay chain.

This patch adds support for it using the framework laid out by previous
patches to map the differences.
Signed-off-by: default avatarChen-Yu Tsai <wens@csie.org>
Acked-by: default avatarMaxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7b270b72
...@@ -93,6 +93,13 @@ static const struct reg_field sun8i_syscon_reg_field = { ...@@ -93,6 +93,13 @@ static const struct reg_field sun8i_syscon_reg_field = {
.msb = 31, .msb = 31,
}; };
/* EMAC clock register @ 0x164 in the CCU address range */
static const struct reg_field sun8i_ccu_reg_field = {
.reg = 0x164,
.lsb = 0,
.msb = 31,
};
static const struct emac_variant emac_variant_h3 = { static const struct emac_variant emac_variant_h3 = {
.default_syscon_value = 0x58000, .default_syscon_value = 0x58000,
.syscon_field = &sun8i_syscon_reg_field, .syscon_field = &sun8i_syscon_reg_field,
...@@ -121,6 +128,14 @@ static const struct emac_variant emac_variant_a83t = { ...@@ -121,6 +128,14 @@ static const struct emac_variant emac_variant_a83t = {
.tx_delay_max = 7, .tx_delay_max = 7,
}; };
static const struct emac_variant emac_variant_r40 = {
.default_syscon_value = 0,
.syscon_field = &sun8i_ccu_reg_field,
.support_mii = true,
.support_rgmii = true,
.rx_delay_max = 7,
};
static const struct emac_variant emac_variant_a64 = { static const struct emac_variant emac_variant_a64 = {
.default_syscon_value = 0, .default_syscon_value = 0,
.syscon_field = &sun8i_syscon_reg_field, .syscon_field = &sun8i_syscon_reg_field,
...@@ -1160,6 +1175,8 @@ static const struct of_device_id sun8i_dwmac_match[] = { ...@@ -1160,6 +1175,8 @@ static const struct of_device_id sun8i_dwmac_match[] = {
.data = &emac_variant_v3s }, .data = &emac_variant_v3s },
{ .compatible = "allwinner,sun8i-a83t-emac", { .compatible = "allwinner,sun8i-a83t-emac",
.data = &emac_variant_a83t }, .data = &emac_variant_a83t },
{ .compatible = "allwinner,sun8i-r40-gmac",
.data = &emac_variant_r40 },
{ .compatible = "allwinner,sun50i-a64-emac", { .compatible = "allwinner,sun50i-a64-emac",
.data = &emac_variant_a64 }, .data = &emac_variant_a64 },
{ } { }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment