2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:32 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6, 01/21] net-next: stmmac: export
|
|
|
|
stmmac_set_mac_addr/stmmac_get_mac_addr
|
2016-11-08 11:05:09 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756043
|
|
|
|
Message-Id: <20170531071852.12422-2-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:32 +0200
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
Thoses symbol will be needed for the dwmac-sun8i ethernet driver.
|
|
|
|
For letting it to be build as module, they need to be exported.
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 3 ++-
|
|
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
|
2017-06-14 15:24:24 +00:00
|
|
|
index 38f94305aab5..67af0bdd7f10 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c
|
|
|
|
@@ -248,6 +248,7 @@ void stmmac_set_mac_addr(void __iomem *ioaddr, u8 addr[6],
|
|
|
|
data = (addr[3] << 24) | (addr[2] << 16) | (addr[1] << 8) | addr[0];
|
|
|
|
writel(data, ioaddr + low);
|
|
|
|
}
|
|
|
|
+EXPORT_SYMBOL_GPL(stmmac_set_mac_addr);
|
|
|
|
|
|
|
|
/* Enable disable MAC RX/TX */
|
|
|
|
void stmmac_set_mac(void __iomem *ioaddr, bool enable)
|
|
|
|
@@ -279,4 +280,4 @@ void stmmac_get_mac_addr(void __iomem *ioaddr, unsigned char *addr,
|
|
|
|
addr[4] = hi_addr & 0xff;
|
|
|
|
addr[5] = (hi_addr >> 8) & 0xff;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
+EXPORT_SYMBOL_GPL(stmmac_get_mac_addr);
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:33 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,02/21] net-next: stmmac: add optional setup function
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9755987
|
|
|
|
Message-Id: <20170531071852.12422-3-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:33 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
|
|
|
Instead of adding more ifthen logic for adding a new mac_device_info
|
2017-03-20 09:46:22 +00:00
|
|
|
setup function, it is easier to add a function pointer to the function
|
|
|
|
needed.
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-03-20 09:46:22 +00:00
|
|
|
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 +++-
|
2017-05-03 17:50:25 +00:00
|
|
|
include/linux/stmmac.h | 1 +
|
|
|
|
2 files changed, 4 insertions(+), 1 deletion(-)
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
2017-06-14 15:24:24 +00:00
|
|
|
index f158273eab9b..c80c9c3b67db 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -3933,7 +3933,9 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
|
2017-03-20 09:46:22 +00:00
|
|
|
struct mac_device_info *mac;
|
|
|
|
|
|
|
|
/* Identify the MAC HW device */
|
|
|
|
- if (priv->plat->has_gmac) {
|
|
|
|
+ if (priv->plat->setup) {
|
|
|
|
+ mac = priv->plat->setup(priv);
|
|
|
|
+ } else if (priv->plat->has_gmac) {
|
|
|
|
priv->dev->priv_flags |= IFF_UNICAST_FLT;
|
|
|
|
mac = dwmac1000_setup(priv->ioaddr,
|
|
|
|
priv->plat->multicast_filter_bins,
|
|
|
|
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
|
2017-06-14 15:24:24 +00:00
|
|
|
index 3921cb9dfadb..8bb550bca96d 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/include/linux/stmmac.h
|
|
|
|
+++ b/include/linux/stmmac.h
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -177,6 +177,7 @@ struct plat_stmmacenet_data {
|
2017-03-20 09:46:22 +00:00
|
|
|
void (*fix_mac_speed)(void *priv, unsigned int speed);
|
|
|
|
int (*init)(struct platform_device *pdev, void *priv);
|
|
|
|
void (*exit)(struct platform_device *pdev, void *priv);
|
2017-05-03 17:50:25 +00:00
|
|
|
+ struct mac_device_info *(*setup)(void *priv);
|
2017-03-20 09:46:22 +00:00
|
|
|
void *bsp_priv;
|
|
|
|
struct clk *stmmac_clk;
|
|
|
|
struct clk *pclk;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:34 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6, 03/21] dt-bindings: net-next: Add DT bindings documentation for
|
|
|
|
Allwinner dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9755997
|
|
|
|
Message-Id: <20170531071852.12422-4-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:34 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
This patch adds documentation for Device-Tree bindings for the
|
|
|
|
Allwinner dwmac-sun8i driver.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
2017-05-03 17:50:25 +00:00
|
|
|
Acked-by: Rob Herring <robh@kernel.org>
|
2017-03-20 09:46:22 +00:00
|
|
|
---
|
2017-06-14 15:24:24 +00:00
|
|
|
.../devicetree/bindings/net/dwmac-sun8i.txt | 78 ++++++++++++++++++++++
|
|
|
|
1 file changed, 78 insertions(+)
|
2017-03-20 09:46:22 +00:00
|
|
|
create mode 100644 Documentation/devicetree/bindings/net/dwmac-sun8i.txt
|
|
|
|
|
|
|
|
diff --git a/Documentation/devicetree/bindings/net/dwmac-sun8i.txt b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
|
|
|
|
new file mode 100644
|
2017-06-14 15:24:24 +00:00
|
|
|
index 000000000000..08e708c73193
|
2017-03-20 09:46:22 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/Documentation/devicetree/bindings/net/dwmac-sun8i.txt
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -0,0 +1,78 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
+* Allwinner sun8i GMAC ethernet controller
|
|
|
|
+
|
|
|
|
+This device is a platform glue layer for stmmac.
|
|
|
|
+Please see stmmac.txt for the other unchanged properties.
|
|
|
|
+
|
|
|
|
+Required properties:
|
|
|
|
+- compatible: should be one of the following string:
|
|
|
|
+ "allwinner,sun8i-a83t-emac"
|
|
|
|
+ "allwinner,sun8i-h3-emac"
|
|
|
|
+ "allwinner,sun50i-a64-emac"
|
|
|
|
+- reg: address and length of the register for the device.
|
|
|
|
+- interrupts: interrupt for the device
|
|
|
|
+- interrupt-names: should be "macirq"
|
|
|
|
+- clocks: A phandle to the reference clock for this device
|
|
|
|
+- clock-names: should be "stmmaceth"
|
|
|
|
+- resets: A phandle to the reset control for this device
|
|
|
|
+- reset-names: should be "stmmaceth"
|
|
|
|
+- phy-mode: See ethernet.txt
|
|
|
|
+- phy-handle: See ethernet.txt
|
|
|
|
+- #address-cells: shall be 1
|
|
|
|
+- #size-cells: shall be 0
|
|
|
|
+- syscon: A phandle to the syscon of the SoC with one of the following
|
|
|
|
+ compatible string:
|
|
|
|
+ - allwinner,sun8i-h3-system-controller
|
2017-05-03 17:50:25 +00:00
|
|
|
+ - allwinner,sun50i-a64-system-controller
|
2017-03-20 09:46:22 +00:00
|
|
|
+ - allwinner,sun8i-a83t-system-controller
|
|
|
|
+
|
|
|
|
+Optional properties:
|
2017-05-03 17:50:25 +00:00
|
|
|
+- allwinner,tx-delay-ps: TX clock delay chain value in ps. Range value is 0-700. Default is 0)
|
|
|
|
+- allwinner,rx-delay-ps: RX clock delay chain value in ps. Range value is 0-3100. Default is 0)
|
2017-06-14 15:24:24 +00:00
|
|
|
+Both delay properties need to be a multiple of 100. They control the delay for
|
|
|
|
+external PHY.
|
2017-03-20 09:46:22 +00:00
|
|
|
+
|
|
|
|
+Optional properties for "allwinner,sun8i-h3-emac":
|
|
|
|
+- allwinner,leds-active-low: EPHY LEDs are active low
|
|
|
|
+
|
|
|
|
+Required child node of emac:
|
|
|
|
+- mdio bus node: should be named mdio
|
|
|
|
+
|
|
|
|
+Required properties of the mdio node:
|
|
|
|
+- #address-cells: shall be 1
|
|
|
|
+- #size-cells: shall be 0
|
|
|
|
+
|
|
|
|
+The device node referenced by "phy" or "phy-handle" should be a child node
|
|
|
|
+of the mdio node. See phy.txt for the generic PHY bindings.
|
|
|
|
+
|
|
|
|
+Required properties of the phy node with "allwinner,sun8i-h3-emac":
|
|
|
|
+- clocks: a phandle to the reference clock for the EPHY
|
|
|
|
+- resets: a phandle to the reset control for the EPHY
|
|
|
|
+
|
|
|
|
+Example:
|
|
|
|
+
|
|
|
|
+emac: ethernet@1c0b000 {
|
|
|
|
+ compatible = "allwinner,sun8i-h3-emac";
|
|
|
|
+ syscon = <&syscon>;
|
|
|
|
+ reg = <0x01c0b000 0x104>;
|
|
|
|
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
|
|
|
|
+ interrupt-names = "macirq";
|
|
|
|
+ resets = <&ccu RST_BUS_EMAC>;
|
|
|
|
+ reset-names = "stmmaceth";
|
|
|
|
+ clocks = <&ccu CLK_BUS_EMAC>;
|
|
|
|
+ clock-names = "stmmaceth";
|
|
|
|
+ #address-cells = <1>;
|
|
|
|
+ #size-cells = <0>;
|
|
|
|
+
|
2017-06-14 15:24:24 +00:00
|
|
|
+ phy-handle = <&int_mii_phy>;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ phy-mode = "mii";
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ mdio: mdio {
|
|
|
|
+ #address-cells = <1>;
|
|
|
|
+ #size-cells = <0>;
|
|
|
|
+ int_mii_phy: ethernet-phy@1 {
|
|
|
|
+ reg = <1>;
|
|
|
|
+ clocks = <&ccu CLK_BUS_EPHY>;
|
|
|
|
+ resets = <&ccu RST_BUS_EPHY>;
|
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+};
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:35 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6, 04/21] dt-bindings: syscon: Add DT bindings documentation for
|
2017-05-03 17:50:25 +00:00
|
|
|
Allwinner syscon
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756039
|
|
|
|
Message-Id: <20170531071852.12422-5-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:35 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
|
|
|
This patch adds documentation for Device-Tree bindings for the
|
|
|
|
syscon present in allwinner devices.
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
Acked-by: Rob Herring <robh@kernel.org>
|
2017-03-20 09:46:22 +00:00
|
|
|
---
|
|
|
|
.../devicetree/bindings/misc/allwinner,syscon.txt | 19 +++++++++++++++++++
|
|
|
|
1 file changed, 19 insertions(+)
|
|
|
|
create mode 100644 Documentation/devicetree/bindings/misc/allwinner,syscon.txt
|
|
|
|
|
|
|
|
diff --git a/Documentation/devicetree/bindings/misc/allwinner,syscon.txt b/Documentation/devicetree/bindings/misc/allwinner,syscon.txt
|
|
|
|
new file mode 100644
|
2017-06-14 15:24:24 +00:00
|
|
|
index 000000000000..cb5769137c6c
|
2017-03-20 09:46:22 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/Documentation/devicetree/bindings/misc/allwinner,syscon.txt
|
|
|
|
@@ -0,0 +1,19 @@
|
|
|
|
+* Allwinner sun8i system controller
|
|
|
|
+
|
|
|
|
+This file describes the bindings for the system controller present in
|
|
|
|
+Allwinner SoC H3, A83T and A64.
|
|
|
|
+The principal function of this syscon is to control EMAC PHY choice and
|
|
|
|
+config.
|
|
|
|
+
|
|
|
|
+Required properties for the system controller:
|
|
|
|
+- reg: address and length of the register for the device.
|
|
|
|
+- compatible: should be "syscon" and one of the following string:
|
|
|
|
+ "allwinner,sun8i-h3-system-controller"
|
2017-05-03 17:50:25 +00:00
|
|
|
+ "allwinner,sun50i-a64-system-controller"
|
2017-03-20 09:46:22 +00:00
|
|
|
+ "allwinner,sun8i-a83t-system-controller"
|
|
|
|
+
|
|
|
|
+Example:
|
2017-05-03 17:50:25 +00:00
|
|
|
+syscon: syscon@1c00000 {
|
|
|
|
+ compatible = "allwinner,sun8i-h3-system-controller", "syscon";
|
2017-03-20 09:46:22 +00:00
|
|
|
+ reg = <0x01c00000 0x1000>;
|
|
|
|
+};
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:36 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,05/21] net-next: stmmac: Add dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756029
|
|
|
|
Message-Id: <20170531071852.12422-6-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:36 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i is a heavy hacked version of stmmac hardware by
|
|
|
|
allwinner.
|
|
|
|
In fact the only common part is the descriptor management and the first
|
|
|
|
register function.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/stmicro/stmmac/Kconfig | 11 +
|
|
|
|
drivers/net/ethernet/stmicro/stmmac/Makefile | 1 +
|
2017-06-14 15:24:24 +00:00
|
|
|
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 990 +++++++++++++++++++++
|
|
|
|
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +
|
2017-03-20 09:46:22 +00:00
|
|
|
.../net/ethernet/stmicro/stmmac/stmmac_platform.c | 9 +-
|
|
|
|
include/linux/stmmac.h | 1 +
|
2017-06-14 15:24:24 +00:00
|
|
|
6 files changed, 1025 insertions(+), 2 deletions(-)
|
2017-03-20 09:46:22 +00:00
|
|
|
create mode 100644 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
|
|
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
|
2017-06-14 15:24:24 +00:00
|
|
|
index cfbe3634dfa1..85c0e41f8021 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
|
|
|
|
@@ -145,6 +145,17 @@ config DWMAC_SUNXI
|
|
|
|
This selects Allwinner SoC glue layer support for the
|
|
|
|
stmmac device driver. This driver is used for A20/A31
|
|
|
|
GMAC ethernet controller.
|
|
|
|
+
|
|
|
|
+config DWMAC_SUN8I
|
|
|
|
+ tristate "Allwinner sun8i GMAC support"
|
|
|
|
+ default ARCH_SUNXI
|
|
|
|
+ depends on OF && (ARCH_SUNXI || COMPILE_TEST)
|
|
|
|
+ ---help---
|
|
|
|
+ Support for Allwinner H3 A83T A64 EMAC ethernet controllers.
|
|
|
|
+
|
|
|
|
+ This selects Allwinner SoC glue layer support for the
|
|
|
|
+ stmmac device driver. This driver is used for H3/A83T/A64
|
|
|
|
+ EMAC ethernet controller.
|
|
|
|
endif
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
config STMMAC_PCI
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/Makefile b/drivers/net/ethernet/stmicro/stmmac/Makefile
|
2017-06-14 15:24:24 +00:00
|
|
|
index 700c60336674..fd4937a7fcab 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/Makefile
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/Makefile
|
|
|
|
@@ -16,6 +16,7 @@ obj-$(CONFIG_DWMAC_SOCFPGA) += dwmac-altr-socfpga.o
|
|
|
|
obj-$(CONFIG_DWMAC_STI) += dwmac-sti.o
|
|
|
|
obj-$(CONFIG_DWMAC_STM32) += dwmac-stm32.o
|
|
|
|
obj-$(CONFIG_DWMAC_SUNXI) += dwmac-sunxi.o
|
|
|
|
+obj-$(CONFIG_DWMAC_SUN8I) += dwmac-sun8i.o
|
|
|
|
obj-$(CONFIG_DWMAC_DWC_QOS_ETH) += dwmac-dwc-qos-eth.o
|
|
|
|
obj-$(CONFIG_DWMAC_GENERIC) += dwmac-generic.o
|
|
|
|
stmmac-platform-objs:= stmmac_platform.o
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
2016-11-08 11:05:09 +00:00
|
|
|
new file mode 100644
|
2017-06-14 15:24:24 +00:00
|
|
|
index 000000000000..1a6bfe6c958f
|
2016-11-08 11:05:09 +00:00
|
|
|
--- /dev/null
|
2017-03-20 09:46:22 +00:00
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -0,0 +1,990 @@
|
2016-11-08 11:05:09 +00:00
|
|
|
+/*
|
2017-03-20 09:46:22 +00:00
|
|
|
+ * dwmac-sun8i.c - Allwinner sun8i DWMAC specific glue layer
|
2016-11-08 11:05:09 +00:00
|
|
|
+ *
|
2017-03-20 09:46:22 +00:00
|
|
|
+ * Copyright (C) 2017 Corentin Labbe <clabbe.montjoie@gmail.com>
|
2016-11-08 11:05:09 +00:00
|
|
|
+ *
|
2017-03-20 09:46:22 +00:00
|
|
|
+ * This program is free software; you can redistribute it and/or modify
|
|
|
|
+ * it under the terms of the GNU General Public License as published by
|
|
|
|
+ * the Free Software Foundation; either version 2 of the License, or
|
|
|
|
+ * (at your option) any later version.
|
2016-11-08 11:05:09 +00:00
|
|
|
+ *
|
2017-03-20 09:46:22 +00:00
|
|
|
+ * This program is distributed in the hope that it will be useful,
|
|
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
+ * GNU General Public License for more details.
|
2016-11-08 11:05:09 +00:00
|
|
|
+ */
|
2017-03-20 09:46:22 +00:00
|
|
|
+
|
2016-11-08 11:05:09 +00:00
|
|
|
+#include <linux/clk.h>
|
2017-03-20 09:46:22 +00:00
|
|
|
+#include <linux/io.h>
|
2016-11-08 11:05:09 +00:00
|
|
|
+#include <linux/iopoll.h>
|
2017-03-20 09:46:22 +00:00
|
|
|
+#include <linux/mfd/syscon.h>
|
2016-11-08 11:05:09 +00:00
|
|
|
+#include <linux/module.h>
|
|
|
|
+#include <linux/of_device.h>
|
|
|
|
+#include <linux/of_mdio.h>
|
|
|
|
+#include <linux/of_net.h>
|
|
|
|
+#include <linux/phy.h>
|
|
|
|
+#include <linux/platform_device.h>
|
2017-03-20 09:46:22 +00:00
|
|
|
+#include <linux/regulator/consumer.h>
|
2016-11-08 11:05:09 +00:00
|
|
|
+#include <linux/regmap.h>
|
2017-03-20 09:46:22 +00:00
|
|
|
+#include <linux/stmmac.h>
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+#include "stmmac.h"
|
|
|
|
+#include "stmmac_platform.h"
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* General notes on dwmac-sun8i:
|
|
|
|
+ * Locking: no locking is necessary in this file because all necessary locking
|
|
|
|
+ * is done in the "stmmac files"
|
|
|
|
+ */
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* struct emac_variant - Descrive dwmac-sun8i hardware variant
|
|
|
|
+ * @default_syscon_value: The default value of the EMAC register in syscon
|
|
|
|
+ * This value is used for disabling properly EMAC
|
|
|
|
+ * and used as a good starting value in case of the
|
|
|
|
+ * boot process(uboot) leave some stuff.
|
|
|
|
+ * @internal_phy: Does the MAC embed an internal PHY
|
|
|
|
+ * @support_mii: Does the MAC handle MII
|
|
|
|
+ * @support_rmii: Does the MAC handle RMII
|
|
|
|
+ * @support_rgmii: Does the MAC handle RGMII
|
2016-11-08 11:05:09 +00:00
|
|
|
+ */
|
|
|
|
+struct emac_variant {
|
|
|
|
+ u32 default_syscon_value;
|
|
|
|
+ int internal_phy;
|
|
|
|
+ bool support_mii;
|
|
|
|
+ bool support_rmii;
|
|
|
|
+ bool support_rgmii;
|
|
|
|
+};
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* struct sunxi_priv_data - hold all sunxi private data
|
|
|
|
+ * @tx_clk: reference to MAC TX clock
|
|
|
|
+ * @ephy_clk: reference to the optional EPHY clock for the internal PHY
|
|
|
|
+ * @regulator: reference to the optional regulator
|
|
|
|
+ * @rst_ephy: reference to the optional EPHY reset for the internal PHY
|
|
|
|
+ * @variant: reference to the current board variant
|
|
|
|
+ * @regmap: regmap for using the syscon
|
|
|
|
+ * @use_internal_phy: Does the current PHY choice imply using the internal PHY
|
|
|
|
+ */
|
|
|
|
+struct sunxi_priv_data {
|
|
|
|
+ struct clk *tx_clk;
|
|
|
|
+ struct clk *ephy_clk;
|
|
|
|
+ struct regulator *regulator;
|
|
|
|
+ struct reset_control *rst_ephy;
|
|
|
|
+ const struct emac_variant *variant;
|
|
|
|
+ struct regmap *regmap;
|
|
|
|
+ bool use_internal_phy;
|
|
|
|
+};
|
|
|
|
+
|
2016-11-08 11:05:09 +00:00
|
|
|
+static const struct emac_variant emac_variant_h3 = {
|
|
|
|
+ .default_syscon_value = 0x58000,
|
|
|
|
+ .internal_phy = PHY_INTERFACE_MODE_MII,
|
|
|
|
+ .support_mii = true,
|
|
|
|
+ .support_rmii = true,
|
|
|
|
+ .support_rgmii = true
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct emac_variant emac_variant_a83t = {
|
|
|
|
+ .default_syscon_value = 0,
|
|
|
|
+ .internal_phy = 0,
|
|
|
|
+ .support_mii = true,
|
|
|
|
+ .support_rgmii = true
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+static const struct emac_variant emac_variant_a64 = {
|
|
|
|
+ .default_syscon_value = 0,
|
|
|
|
+ .internal_phy = 0,
|
|
|
|
+ .support_mii = true,
|
|
|
|
+ .support_rmii = true,
|
|
|
|
+ .support_rgmii = true
|
|
|
|
+};
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+#define EMAC_BASIC_CTL0 0x00
|
|
|
|
+#define EMAC_BASIC_CTL1 0x04
|
|
|
|
+#define EMAC_INT_STA 0x08
|
|
|
|
+#define EMAC_INT_EN 0x0C
|
|
|
|
+#define EMAC_TX_CTL0 0x10
|
|
|
|
+#define EMAC_TX_CTL1 0x14
|
|
|
|
+#define EMAC_TX_FLOW_CTL 0x1C
|
|
|
|
+#define EMAC_TX_DESC_LIST 0x20
|
|
|
|
+#define EMAC_RX_CTL0 0x24
|
|
|
|
+#define EMAC_RX_CTL1 0x28
|
|
|
|
+#define EMAC_RX_DESC_LIST 0x34
|
|
|
|
+#define EMAC_RX_FRM_FLT 0x38
|
|
|
|
+#define EMAC_MDIO_CMD 0x48
|
|
|
|
+#define EMAC_MDIO_DATA 0x4C
|
|
|
|
+#define EMAC_MACADDR_HI(reg) (0x50 + (reg) * 8)
|
|
|
|
+#define EMAC_MACADDR_LO(reg) (0x54 + (reg) * 8)
|
|
|
|
+#define EMAC_TX_DMA_STA 0xB0
|
|
|
|
+#define EMAC_TX_CUR_DESC 0xB4
|
|
|
|
+#define EMAC_TX_CUR_BUF 0xB8
|
|
|
|
+#define EMAC_RX_DMA_STA 0xC0
|
|
|
|
+#define EMAC_RX_CUR_DESC 0xC4
|
|
|
|
+#define EMAC_RX_CUR_BUF 0xC8
|
|
|
|
+
|
2017-06-14 15:24:24 +00:00
|
|
|
+/* Use in EMAC_BASIC_CTL0 */
|
|
|
|
+#define EMAC_DUPLEX_FULL BIT(0)
|
|
|
|
+#define EMAC_LOOPBACK BIT(1)
|
|
|
|
+#define EMAC_SPEED_1000 0
|
|
|
|
+#define EMAC_SPEED_100 (0x03 << 2)
|
|
|
|
+#define EMAC_SPEED_10 (0x02 << 2)
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* Use in EMAC_BASIC_CTL1 */
|
|
|
|
+#define EMAC_BURSTLEN_SHIFT 24
|
|
|
|
+
|
|
|
|
+/* Used in EMAC_RX_FRM_FLT */
|
|
|
|
+#define EMAC_FRM_FLT_RXALL BIT(0)
|
|
|
|
+#define EMAC_FRM_FLT_CTL BIT(13)
|
|
|
|
+#define EMAC_FRM_FLT_MULTICAST BIT(16)
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* Used in RX_CTL1*/
|
|
|
|
+#define EMAC_RX_MD BIT(1)
|
|
|
|
+#define EMAC_RX_TH_MASK GENMASK(4, 5)
|
|
|
|
+#define EMAC_RX_TH_32 0
|
|
|
|
+#define EMAC_RX_TH_64 (0x1 << 4)
|
|
|
|
+#define EMAC_RX_TH_96 (0x2 << 4)
|
|
|
|
+#define EMAC_RX_TH_128 (0x3 << 4)
|
|
|
|
+#define EMAC_RX_DMA_EN BIT(30)
|
|
|
|
+#define EMAC_RX_DMA_START BIT(31)
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* Used in TX_CTL1*/
|
|
|
|
+#define EMAC_TX_MD BIT(1)
|
|
|
|
+#define EMAC_TX_NEXT_FRM BIT(2)
|
|
|
|
+#define EMAC_TX_TH_MASK GENMASK(8, 10)
|
|
|
|
+#define EMAC_TX_TH_64 0
|
|
|
|
+#define EMAC_TX_TH_128 (0x1 << 8)
|
|
|
|
+#define EMAC_TX_TH_192 (0x2 << 8)
|
|
|
|
+#define EMAC_TX_TH_256 (0x3 << 8)
|
|
|
|
+#define EMAC_TX_DMA_EN BIT(30)
|
|
|
|
+#define EMAC_TX_DMA_START BIT(31)
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* Used in RX_CTL0 */
|
|
|
|
+#define EMAC_RX_RECEIVER_EN BIT(31)
|
|
|
|
+#define EMAC_RX_DO_CRC BIT(27)
|
|
|
|
+#define EMAC_RX_FLOW_CTL_EN BIT(16)
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* Used in TX_CTL0 */
|
|
|
|
+#define EMAC_TX_TRANSMITTER_EN BIT(31)
|
|
|
|
+
|
|
|
|
+/* Used in EMAC_TX_FLOW_CTL */
|
|
|
|
+#define EMAC_TX_FLOW_CTL_EN BIT(0)
|
|
|
|
+
|
|
|
|
+/* Used in EMAC_INT_STA */
|
|
|
|
+#define EMAC_TX_INT BIT(0)
|
|
|
|
+#define EMAC_TX_DMA_STOP_INT BIT(1)
|
|
|
|
+#define EMAC_TX_BUF_UA_INT BIT(2)
|
|
|
|
+#define EMAC_TX_TIMEOUT_INT BIT(3)
|
|
|
|
+#define EMAC_TX_UNDERFLOW_INT BIT(4)
|
|
|
|
+#define EMAC_TX_EARLY_INT BIT(5)
|
|
|
|
+#define EMAC_RX_INT BIT(8)
|
|
|
|
+#define EMAC_RX_BUF_UA_INT BIT(9)
|
|
|
|
+#define EMAC_RX_DMA_STOP_INT BIT(10)
|
|
|
|
+#define EMAC_RX_TIMEOUT_INT BIT(11)
|
|
|
|
+#define EMAC_RX_OVERFLOW_INT BIT(12)
|
|
|
|
+#define EMAC_RX_EARLY_INT BIT(13)
|
|
|
|
+#define EMAC_RGMII_STA_INT BIT(16)
|
|
|
|
+
|
|
|
|
+#define MAC_ADDR_TYPE_DST BIT(31)
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* H3 specific bits for EPHY */
|
|
|
|
+#define H3_EPHY_ADDR_SHIFT 20
|
|
|
|
+#define H3_EPHY_LED_POL BIT(17) /* 1: active low, 0: active high */
|
|
|
|
+#define H3_EPHY_SHUTDOWN BIT(16) /* 1: shutdown, 0: power up */
|
|
|
|
+#define H3_EPHY_SELECT BIT(15) /* 1: internal PHY, 0: external PHY */
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* H3/A64 specific bits */
|
|
|
|
+#define SYSCON_RMII_EN BIT(13) /* 1: enable RMII (overrides EPIT) */
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* Generic system control EMAC_CLK bits */
|
|
|
|
+#define SYSCON_ETXDC_MASK GENMASK(2, 0)
|
|
|
|
+#define SYSCON_ETXDC_SHIFT 10
|
|
|
|
+#define SYSCON_ERXDC_MASK GENMASK(4, 0)
|
|
|
|
+#define SYSCON_ERXDC_SHIFT 5
|
|
|
|
+/* EMAC PHY Interface Type */
|
|
|
|
+#define SYSCON_EPIT BIT(2) /* 1: RGMII, 0: MII */
|
|
|
|
+#define SYSCON_ETCS_MASK GENMASK(1, 0)
|
|
|
|
+#define SYSCON_ETCS_MII 0x0
|
|
|
|
+#define SYSCON_ETCS_EXT_GMII 0x1
|
|
|
|
+#define SYSCON_ETCS_INT_GMII 0x2
|
|
|
|
+#define SYSCON_EMAC_REG 0x30
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* sun8i_dwmac_dma_reset() - reset the EMAC
|
|
|
|
+ * Called from stmmac via stmmac_dma_ops->reset
|
|
|
|
+ */
|
|
|
|
+static int sun8i_dwmac_dma_reset(void __iomem *ioaddr)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ writel(0, ioaddr + EMAC_RX_CTL1);
|
|
|
|
+ writel(0, ioaddr + EMAC_TX_CTL1);
|
|
|
|
+ writel(0, ioaddr + EMAC_RX_FRM_FLT);
|
|
|
|
+ writel(0, ioaddr + EMAC_RX_DESC_LIST);
|
|
|
|
+ writel(0, ioaddr + EMAC_TX_DESC_LIST);
|
|
|
|
+ writel(0, ioaddr + EMAC_INT_EN);
|
|
|
|
+ writel(0x1FFFFFF, ioaddr + EMAC_INT_STA);
|
|
|
|
+ return 0;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* sun8i_dwmac_dma_init() - initialize the EMAC
|
|
|
|
+ * Called from stmmac via stmmac_dma_ops->init
|
2016-11-08 11:05:09 +00:00
|
|
|
+ */
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_dma_init(void __iomem *ioaddr,
|
|
|
|
+ struct stmmac_dma_cfg *dma_cfg,
|
|
|
|
+ u32 dma_tx, u32 dma_rx, int atds)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ /* Write TX and RX descriptors address */
|
|
|
|
+ writel(dma_rx, ioaddr + EMAC_RX_DESC_LIST);
|
|
|
|
+ writel(dma_tx, ioaddr + EMAC_TX_DESC_LIST);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ writel(EMAC_RX_INT | EMAC_TX_INT, ioaddr + EMAC_INT_EN);
|
|
|
|
+ writel(0x1FFFFFF, ioaddr + EMAC_INT_STA);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* sun8i_dwmac_dump_regs() - Dump EMAC address space
|
|
|
|
+ * Called from stmmac_dma_ops->dump_regs
|
|
|
|
+ * Used for ethtool
|
|
|
|
+ */
|
|
|
|
+static void sun8i_dwmac_dump_regs(void __iomem *ioaddr, u32 *reg_space)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ int i;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ for (i = 0; i < 0xC8; i += 4) {
|
|
|
|
+ if (i == 0x32 || i == 0x3C)
|
|
|
|
+ continue;
|
|
|
|
+ reg_space[i / 4] = readl(ioaddr + i);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* sun8i_dwmac_dump_mac_regs() - Dump EMAC address space
|
|
|
|
+ * Called from stmmac_ops->dump_regs
|
|
|
|
+ * Used for ethtool
|
|
|
|
+ */
|
|
|
|
+static void sun8i_dwmac_dump_mac_regs(struct mac_device_info *hw,
|
|
|
|
+ u32 *reg_space)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ int i;
|
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ for (i = 0; i < 0xC8; i += 4) {
|
|
|
|
+ if (i == 0x32 || i == 0x3C)
|
|
|
|
+ continue;
|
|
|
|
+ reg_space[i / 4] = readl(ioaddr + i);
|
|
|
|
+ }
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_enable_dma_irq(void __iomem *ioaddr, u32 chan)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ writel(EMAC_RX_INT | EMAC_TX_INT, ioaddr + EMAC_INT_EN);
|
|
|
|
+}
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_disable_dma_irq(void __iomem *ioaddr, u32 chan)
|
2017-03-20 09:46:22 +00:00
|
|
|
+{
|
|
|
|
+ writel(0, ioaddr + EMAC_INT_EN);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_dma_start_tx(void __iomem *ioaddr, u32 chan)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
|
|
|
+ u32 v;
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_TX_CTL1);
|
|
|
|
+ v |= EMAC_TX_DMA_START;
|
|
|
|
+ v |= EMAC_TX_DMA_EN;
|
|
|
|
+ writel(v, ioaddr + EMAC_TX_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_enable_dma_transmission(void __iomem *ioaddr)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
|
|
|
+ u32 v;
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_TX_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ v |= EMAC_TX_DMA_START;
|
|
|
|
+ v |= EMAC_TX_DMA_EN;
|
2017-05-03 17:50:25 +00:00
|
|
|
+ writel(v, ioaddr + EMAC_TX_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_dma_stop_tx(void __iomem *ioaddr, u32 chan)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
|
|
|
+ u32 v;
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_TX_CTL1);
|
|
|
|
+ v &= ~EMAC_TX_DMA_EN;
|
|
|
|
+ writel(v, ioaddr + EMAC_TX_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_dma_start_rx(void __iomem *ioaddr, u32 chan)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
|
|
|
+ u32 v;
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_RX_CTL1);
|
|
|
|
+ v |= EMAC_RX_DMA_START;
|
|
|
|
+ v |= EMAC_RX_DMA_EN;
|
|
|
|
+ writel(v, ioaddr + EMAC_RX_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_dma_stop_rx(void __iomem *ioaddr, u32 chan)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ u32 v;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_RX_CTL1);
|
|
|
|
+ v &= ~EMAC_RX_DMA_EN;
|
|
|
|
+ writel(v, ioaddr + EMAC_RX_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_dma_interrupt(void __iomem *ioaddr,
|
2017-05-03 17:50:25 +00:00
|
|
|
+ struct stmmac_extra_stats *x, u32 chan)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ u32 v;
|
|
|
|
+ int ret = 0;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_INT_STA);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_TX_INT) {
|
|
|
|
+ ret |= handle_tx;
|
|
|
|
+ x->tx_normal_irq_n++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_TX_DMA_STOP_INT)
|
|
|
|
+ x->tx_process_stopped_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_TX_BUF_UA_INT)
|
|
|
|
+ x->tx_process_stopped_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_TX_TIMEOUT_INT)
|
|
|
|
+ ret |= tx_hard_error;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_TX_UNDERFLOW_INT) {
|
|
|
|
+ ret |= tx_hard_error;
|
|
|
|
+ x->tx_undeflow_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_TX_EARLY_INT)
|
|
|
|
+ x->tx_early_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_RX_INT) {
|
|
|
|
+ ret |= handle_rx;
|
|
|
|
+ x->rx_normal_irq_n++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_RX_BUF_UA_INT)
|
|
|
|
+ x->rx_buf_unav_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_RX_DMA_STOP_INT)
|
|
|
|
+ x->rx_process_stopped_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_RX_TIMEOUT_INT)
|
|
|
|
+ ret |= tx_hard_error;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_RX_OVERFLOW_INT) {
|
|
|
|
+ ret |= tx_hard_error;
|
|
|
|
+ x->rx_overflow_irq++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (v & EMAC_RX_EARLY_INT)
|
|
|
|
+ x->rx_early_irq++;
|
|
|
|
+
|
|
|
|
+ if (v & EMAC_RGMII_STA_INT)
|
|
|
|
+ x->irq_rgmii_n++;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ writel(v, ioaddr + EMAC_INT_STA);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_dma_operation_mode(void __iomem *ioaddr, int txmode,
|
|
|
|
+ int rxmode, int rxfifosz)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ u32 v;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_TX_CTL1);
|
|
|
|
+ if (txmode == SF_DMA_MODE) {
|
|
|
|
+ v |= EMAC_TX_MD;
|
|
|
|
+ /* Undocumented bit (called TX_NEXT_FRM in BSP), the original
|
|
|
|
+ * comment is
|
|
|
|
+ * "Operating on second frame increase the performance
|
|
|
|
+ * especially when transmit store-and-forward is used."
|
|
|
|
+ */
|
|
|
|
+ v |= EMAC_TX_NEXT_FRM;
|
|
|
|
+ } else {
|
|
|
|
+ v &= ~EMAC_TX_MD;
|
|
|
|
+ v &= ~EMAC_TX_TH_MASK;
|
|
|
|
+ if (txmode < 64)
|
|
|
|
+ v |= EMAC_TX_TH_64;
|
|
|
|
+ else if (txmode < 128)
|
|
|
|
+ v |= EMAC_TX_TH_128;
|
|
|
|
+ else if (txmode < 192)
|
|
|
|
+ v |= EMAC_TX_TH_192;
|
|
|
|
+ else if (txmode < 256)
|
|
|
|
+ v |= EMAC_TX_TH_256;
|
|
|
|
+ }
|
|
|
|
+ writel(v, ioaddr + EMAC_TX_CTL1);
|
|
|
|
+
|
|
|
|
+ v = readl(ioaddr + EMAC_RX_CTL1);
|
|
|
|
+ if (rxmode == SF_DMA_MODE) {
|
|
|
|
+ v |= EMAC_RX_MD;
|
|
|
|
+ } else {
|
|
|
|
+ v &= ~EMAC_RX_MD;
|
|
|
|
+ v &= ~EMAC_RX_TH_MASK;
|
|
|
|
+ if (rxmode < 32)
|
|
|
|
+ v |= EMAC_RX_TH_32;
|
|
|
|
+ else if (rxmode < 64)
|
|
|
|
+ v |= EMAC_RX_TH_64;
|
|
|
|
+ else if (rxmode < 96)
|
|
|
|
+ v |= EMAC_RX_TH_96;
|
|
|
|
+ else if (rxmode < 128)
|
|
|
|
+ v |= EMAC_RX_TH_128;
|
|
|
|
+ }
|
|
|
|
+ writel(v, ioaddr + EMAC_RX_CTL1);
|
|
|
|
+}
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static const struct stmmac_dma_ops sun8i_dwmac_dma_ops = {
|
|
|
|
+ .reset = sun8i_dwmac_dma_reset,
|
|
|
|
+ .init = sun8i_dwmac_dma_init,
|
|
|
|
+ .dump_regs = sun8i_dwmac_dump_regs,
|
|
|
|
+ .dma_mode = sun8i_dwmac_dma_operation_mode,
|
|
|
|
+ .enable_dma_transmission = sun8i_dwmac_enable_dma_transmission,
|
|
|
|
+ .enable_dma_irq = sun8i_dwmac_enable_dma_irq,
|
|
|
|
+ .disable_dma_irq = sun8i_dwmac_disable_dma_irq,
|
|
|
|
+ .start_tx = sun8i_dwmac_dma_start_tx,
|
|
|
|
+ .stop_tx = sun8i_dwmac_dma_stop_tx,
|
|
|
|
+ .start_rx = sun8i_dwmac_dma_start_rx,
|
|
|
|
+ .stop_rx = sun8i_dwmac_dma_stop_rx,
|
|
|
|
+ .dma_interrupt = sun8i_dwmac_dma_interrupt,
|
|
|
|
+};
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_init(struct platform_device *pdev, void *priv)
|
|
|
|
+{
|
|
|
|
+ struct sunxi_priv_data *gmac = priv;
|
|
|
|
+ int ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (gmac->regulator) {
|
|
|
|
+ ret = regulator_enable(gmac->regulator);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(&pdev->dev, "Fail to enable regulator\n");
|
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
2017-03-20 09:46:22 +00:00
|
|
|
+ }
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = clk_prepare_enable(gmac->tx_clk);
|
|
|
|
+ if (ret) {
|
|
|
|
+ if (gmac->regulator)
|
|
|
|
+ regulator_disable(gmac->regulator);
|
|
|
|
+ dev_err(&pdev->dev, "Could not enable AHB clock\n");
|
|
|
|
+ return ret;
|
|
|
|
+ }
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return 0;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_core_init(struct mac_device_info *hw, int mtu)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
|
|
|
+ u32 v;
|
|
|
|
+
|
|
|
|
+ v = (8 << EMAC_BURSTLEN_SHIFT); /* burst len */
|
|
|
|
+ writel(v, ioaddr + EMAC_BASIC_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static void sun8i_dwmac_set_mac(void __iomem *ioaddr, bool enable)
|
|
|
|
+{
|
|
|
|
+ u32 t, r;
|
|
|
|
+
|
|
|
|
+ t = readl(ioaddr + EMAC_TX_CTL0);
|
|
|
|
+ r = readl(ioaddr + EMAC_RX_CTL0);
|
|
|
|
+ if (enable) {
|
|
|
|
+ t |= EMAC_TX_TRANSMITTER_EN;
|
|
|
|
+ r |= EMAC_RX_RECEIVER_EN;
|
|
|
|
+ } else {
|
|
|
|
+ t &= ~EMAC_TX_TRANSMITTER_EN;
|
|
|
|
+ r &= ~EMAC_RX_RECEIVER_EN;
|
|
|
|
+ }
|
|
|
|
+ writel(t, ioaddr + EMAC_TX_CTL0);
|
|
|
|
+ writel(r, ioaddr + EMAC_RX_CTL0);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/* Set MAC address at slot reg_n
|
|
|
|
+ * All slot > 0 need to be enabled with MAC_ADDR_TYPE_DST
|
|
|
|
+ * If addr is NULL, clear the slot
|
|
|
|
+ */
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_set_umac_addr(struct mac_device_info *hw,
|
|
|
|
+ unsigned char *addr,
|
|
|
|
+ unsigned int reg_n)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
|
|
|
+ u32 v;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ if (!addr) {
|
|
|
|
+ writel(0, ioaddr + EMAC_MACADDR_HI(reg_n));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ stmmac_set_mac_addr(ioaddr, addr, EMAC_MACADDR_HI(reg_n),
|
|
|
|
+ EMAC_MACADDR_LO(reg_n));
|
|
|
|
+ if (reg_n > 0) {
|
|
|
|
+ v = readl(ioaddr + EMAC_MACADDR_HI(reg_n));
|
|
|
|
+ v |= MAC_ADDR_TYPE_DST;
|
|
|
|
+ writel(v, ioaddr + EMAC_MACADDR_HI(reg_n));
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_get_umac_addr(struct mac_device_info *hw,
|
|
|
|
+ unsigned char *addr,
|
|
|
|
+ unsigned int reg_n)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ stmmac_get_mac_addr(ioaddr, addr, EMAC_MACADDR_HI(reg_n),
|
|
|
|
+ EMAC_MACADDR_LO(reg_n));
|
|
|
|
+}
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+/* caution this function must return non 0 to work */
|
|
|
|
+static int sun8i_dwmac_rx_ipc_enable(struct mac_device_info *hw)
|
|
|
|
+{
|
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
|
|
|
+ u32 v;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_RX_CTL0);
|
|
|
|
+ v |= EMAC_RX_DO_CRC;
|
|
|
|
+ writel(v, ioaddr + EMAC_RX_CTL0);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return 1;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_set_filter(struct mac_device_info *hw,
|
|
|
|
+ struct net_device *dev)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
|
|
|
+ u32 v;
|
2017-05-03 17:50:25 +00:00
|
|
|
+ int i = 1;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ struct netdev_hw_addr *ha;
|
2017-05-03 17:50:25 +00:00
|
|
|
+ int macaddrs = netdev_uc_count(dev) + netdev_mc_count(dev) + 1;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ v = EMAC_FRM_FLT_CTL;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (dev->flags & IFF_PROMISC) {
|
|
|
|
+ v = EMAC_FRM_FLT_RXALL;
|
|
|
|
+ } else if (dev->flags & IFF_ALLMULTI) {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ v |= EMAC_FRM_FLT_MULTICAST;
|
|
|
|
+ } else if (macaddrs <= hw->unicast_filter_entries) {
|
|
|
|
+ if (!netdev_mc_empty(dev)) {
|
|
|
|
+ netdev_for_each_mc_addr(ha, dev) {
|
|
|
|
+ sun8i_dwmac_set_umac_addr(hw, ha->addr, i);
|
|
|
|
+ i++;
|
|
|
|
+ }
|
2017-03-20 09:46:22 +00:00
|
|
|
+ }
|
2017-05-03 17:50:25 +00:00
|
|
|
+ if (!netdev_uc_empty(dev)) {
|
|
|
|
+ netdev_for_each_uc_addr(ha, dev) {
|
|
|
|
+ sun8i_dwmac_set_umac_addr(hw, ha->addr, i);
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
2017-03-20 09:46:22 +00:00
|
|
|
+ netdev_info(dev, "Too many address, switching to promiscuous\n");
|
|
|
|
+ v = EMAC_FRM_FLT_RXALL;
|
|
|
|
+ }
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
+ /* Disable unused address filter slots */
|
|
|
|
+ while (i < hw->unicast_filter_entries)
|
|
|
|
+ sun8i_dwmac_set_umac_addr(hw, NULL, i++);
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ writel(v, ioaddr + EMAC_RX_FRM_FLT);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_flow_ctrl(struct mac_device_info *hw,
|
2017-05-03 17:50:25 +00:00
|
|
|
+ unsigned int duplex, unsigned int fc,
|
|
|
|
+ unsigned int pause_time, u32 tx_cnt)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ void __iomem *ioaddr = hw->pcsr;
|
|
|
|
+ u32 v;
|
|
|
|
+
|
|
|
|
+ v = readl(ioaddr + EMAC_RX_CTL0);
|
|
|
|
+ if (fc == FLOW_AUTO)
|
|
|
|
+ v |= EMAC_RX_FLOW_CTL_EN;
|
|
|
|
+ else
|
|
|
|
+ v &= ~EMAC_RX_FLOW_CTL_EN;
|
|
|
|
+ writel(v, ioaddr + EMAC_RX_CTL0);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(ioaddr + EMAC_TX_FLOW_CTL);
|
|
|
|
+ if (fc == FLOW_AUTO)
|
|
|
|
+ v |= EMAC_TX_FLOW_CTL_EN;
|
|
|
|
+ else
|
|
|
|
+ v &= ~EMAC_TX_FLOW_CTL_EN;
|
|
|
|
+ writel(v, ioaddr + EMAC_TX_FLOW_CTL);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_reset(struct stmmac_priv *priv)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ u32 v;
|
|
|
|
+ int err;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ v = readl(priv->ioaddr + EMAC_BASIC_CTL1);
|
|
|
|
+ writel(v | 0x01, priv->ioaddr + EMAC_BASIC_CTL1);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-06-14 15:24:24 +00:00
|
|
|
+ /* The timeout was previoulsy set to 10ms, but some board (OrangePI0)
|
|
|
|
+ * need more if no cable plugged. 100ms seems OK
|
|
|
|
+ */
|
2017-03-20 09:46:22 +00:00
|
|
|
+ err = readl_poll_timeout(priv->ioaddr + EMAC_BASIC_CTL1, v,
|
2017-06-14 15:24:24 +00:00
|
|
|
+ !(v & 0x01), 100, 100000);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (err) {
|
|
|
|
+ dev_err(priv->device, "EMAC reset timeout\n");
|
|
|
|
+ return -EFAULT;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return 0;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_set_syscon(struct stmmac_priv *priv)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
|
|
|
|
+ struct device_node *node = priv->device->of_node;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ int ret;
|
|
|
|
+ u32 reg, val;
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ regmap_read(gmac->regmap, SYSCON_EMAC_REG, &val);
|
|
|
|
+ reg = gmac->variant->default_syscon_value;
|
|
|
|
+ if (reg != val)
|
|
|
|
+ dev_warn(priv->device,
|
|
|
|
+ "Current syscon value is not the default %x (expect %x)\n",
|
|
|
|
+ val, reg);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (gmac->variant->internal_phy) {
|
|
|
|
+ if (!gmac->use_internal_phy) {
|
2016-11-08 11:05:09 +00:00
|
|
|
+ /* switch to external PHY interface */
|
|
|
|
+ reg &= ~H3_EPHY_SELECT;
|
|
|
|
+ } else {
|
|
|
|
+ reg |= H3_EPHY_SELECT;
|
|
|
|
+ reg &= ~H3_EPHY_SHUTDOWN;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_dbg(priv->device, "Select internal_phy %x\n", reg);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (of_property_read_bool(priv->plat->phy_node,
|
2016-11-08 11:05:09 +00:00
|
|
|
+ "allwinner,leds-active-low"))
|
|
|
|
+ reg |= H3_EPHY_LED_POL;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ else
|
|
|
|
+ reg &= ~H3_EPHY_LED_POL;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = of_mdio_parse_addr(priv->device,
|
|
|
|
+ priv->plat->phy_node);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ if (ret < 0) {
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_err(priv->device, "Could not parse MDIO addr\n");
|
2016-11-08 11:05:09 +00:00
|
|
|
+ return ret;
|
|
|
|
+ }
|
|
|
|
+ /* of_mdio_parse_addr returns a valid (0 ~ 31) PHY
|
|
|
|
+ * address. No need to mask it again.
|
|
|
|
+ */
|
|
|
|
+ reg |= ret << H3_EPHY_ADDR_SHIFT;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ if (!of_property_read_u32(node, "allwinner,tx-delay-ps", &val)) {
|
|
|
|
+ if (val % 100) {
|
|
|
|
+ dev_err(priv->device, "tx-delay must be a multiple of 100\n");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+ val /= 100;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_dbg(priv->device, "set tx-delay to %x\n", val);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ if (val <= SYSCON_ETXDC_MASK) {
|
|
|
|
+ reg &= ~(SYSCON_ETXDC_MASK << SYSCON_ETXDC_SHIFT);
|
|
|
|
+ reg |= (val << SYSCON_ETXDC_SHIFT);
|
|
|
|
+ } else {
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_err(priv->device, "Invalid TX clock delay: %d\n",
|
|
|
|
+ val);
|
|
|
|
+ return -EINVAL;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ if (!of_property_read_u32(node, "allwinner,rx-delay-ps", &val)) {
|
|
|
|
+ if (val % 100) {
|
|
|
|
+ dev_err(priv->device, "rx-delay must be a multiple of 100\n");
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+ val /= 100;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_dbg(priv->device, "set rx-delay to %x\n", val);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ if (val <= SYSCON_ERXDC_MASK) {
|
|
|
|
+ reg &= ~(SYSCON_ERXDC_MASK << SYSCON_ERXDC_SHIFT);
|
|
|
|
+ reg |= (val << SYSCON_ERXDC_SHIFT);
|
|
|
|
+ } else {
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_err(priv->device, "Invalid RX clock delay: %d\n",
|
|
|
|
+ val);
|
|
|
|
+ return -EINVAL;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* Clear interface mode bits */
|
|
|
|
+ reg &= ~(SYSCON_ETCS_MASK | SYSCON_EPIT);
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (gmac->variant->support_rmii)
|
2016-11-08 11:05:09 +00:00
|
|
|
+ reg &= ~SYSCON_RMII_EN;
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ switch (priv->plat->interface) {
|
2016-11-08 11:05:09 +00:00
|
|
|
+ case PHY_INTERFACE_MODE_MII:
|
|
|
|
+ /* default */
|
|
|
|
+ break;
|
|
|
|
+ case PHY_INTERFACE_MODE_RGMII:
|
|
|
|
+ reg |= SYSCON_EPIT | SYSCON_ETCS_INT_GMII;
|
|
|
|
+ break;
|
|
|
|
+ case PHY_INTERFACE_MODE_RMII:
|
|
|
|
+ reg |= SYSCON_RMII_EN | SYSCON_ETCS_EXT_GMII;
|
|
|
|
+ break;
|
|
|
|
+ default:
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_err(priv->device, "Unsupported interface mode: %s",
|
|
|
|
+ phy_modes(priv->plat->interface));
|
2016-11-08 11:05:09 +00:00
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ regmap_write(gmac->regmap, SYSCON_EMAC_REG, reg);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_unset_syscon(struct sunxi_priv_data *gmac)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ u32 reg = gmac->variant->default_syscon_value;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ regmap_write(gmac->regmap, SYSCON_EMAC_REG, reg);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ struct sunxi_priv_data *gmac = priv->plat->bsp_priv;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ int ret;
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ if (!gmac->use_internal_phy)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ ret = clk_prepare_enable(gmac->ephy_clk);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(priv->device, "Cannot enable ephy\n");
|
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+ ret = reset_control_deassert(gmac->rst_ephy);
|
|
|
|
+ if (ret) {
|
|
|
|
+ dev_err(priv->device, "Cannot deassert ephy\n");
|
|
|
|
+ clk_disable_unprepare(gmac->ephy_clk);
|
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_unpower_internal_phy(struct sunxi_priv_data *gmac)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-05-03 17:50:25 +00:00
|
|
|
+ if (!gmac->use_internal_phy)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
|
|
+ clk_disable_unprepare(gmac->ephy_clk);
|
|
|
|
+ reset_control_assert(gmac->rst_ephy);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2017-06-14 15:24:24 +00:00
|
|
|
+/* sun8i_power_phy() - Activate the PHY:
|
|
|
|
+ * In case of error, no need to call sun8i_unpower_phy(),
|
|
|
|
+ * it will be called anyway by sun8i_dwmac_exit()
|
|
|
|
+ */
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_power_phy(struct stmmac_priv *priv)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ int ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = sun8i_dwmac_power_internal_phy(priv);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = sun8i_dwmac_set_syscon(priv);
|
|
|
|
+ if (ret)
|
2017-06-14 15:24:24 +00:00
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-06-14 15:24:24 +00:00
|
|
|
+ /* After changing syscon value, the MAC need reset or it will use
|
|
|
|
+ * the last value (and so the last PHY set.
|
|
|
|
+ */
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = sun8i_dwmac_reset(priv);
|
|
|
|
+ if (ret)
|
2017-06-14 15:24:24 +00:00
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_unpower_phy(struct sunxi_priv_data *gmac)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ sun8i_dwmac_unset_syscon(gmac);
|
|
|
|
+ sun8i_dwmac_unpower_internal_phy(gmac);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static void sun8i_dwmac_exit(struct platform_device *pdev, void *priv)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ struct sunxi_priv_data *gmac = priv;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ sun8i_unpower_phy(gmac);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ clk_disable_unprepare(gmac->tx_clk);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ if (gmac->regulator)
|
|
|
|
+ regulator_disable(gmac->regulator);
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static const struct stmmac_ops sun8i_dwmac_ops = {
|
|
|
|
+ .core_init = sun8i_dwmac_core_init,
|
2017-05-03 17:50:25 +00:00
|
|
|
+ .set_mac = sun8i_dwmac_set_mac,
|
2017-03-20 09:46:22 +00:00
|
|
|
+ .dump_regs = sun8i_dwmac_dump_mac_regs,
|
|
|
|
+ .rx_ipc = sun8i_dwmac_rx_ipc_enable,
|
|
|
|
+ .set_filter = sun8i_dwmac_set_filter,
|
|
|
|
+ .flow_ctrl = sun8i_dwmac_flow_ctrl,
|
|
|
|
+ .set_umac_addr = sun8i_dwmac_set_umac_addr,
|
|
|
|
+ .get_umac_addr = sun8i_dwmac_get_umac_addr,
|
|
|
|
+};
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-05-03 17:50:25 +00:00
|
|
|
+static struct mac_device_info *sun8i_dwmac_setup(void *ppriv)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ struct mac_device_info *mac;
|
2017-05-03 17:50:25 +00:00
|
|
|
+ struct stmmac_priv *priv = ppriv;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ int ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ mac = devm_kzalloc(priv->device, sizeof(*mac), GFP_KERNEL);
|
|
|
|
+ if (!mac)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ ret = sun8i_power_phy(priv);
|
|
|
|
+ if (ret)
|
|
|
|
+ return NULL;
|
|
|
|
+
|
|
|
|
+ mac->pcsr = priv->ioaddr;
|
|
|
|
+ mac->mac = &sun8i_dwmac_ops;
|
|
|
|
+ mac->dma = &sun8i_dwmac_dma_ops;
|
|
|
|
+
|
2017-06-14 15:24:24 +00:00
|
|
|
+ /* The loopback bit seems to be re-set when link change
|
|
|
|
+ * Simply mask it each time
|
|
|
|
+ * Speed 10/100/1000 are set in BIT(2)/BIT(3)
|
|
|
|
+ */
|
|
|
|
+ mac->link.speed_mask = GENMASK(3, 2) | EMAC_LOOPBACK;
|
|
|
|
+ mac->link.speed10 = EMAC_SPEED_10;
|
|
|
|
+ mac->link.speed100 = EMAC_SPEED_100;
|
|
|
|
+ mac->link.speed1000 = EMAC_SPEED_1000;
|
|
|
|
+ mac->link.duplex = EMAC_DUPLEX_FULL;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ mac->mii.addr = EMAC_MDIO_CMD;
|
|
|
|
+ mac->mii.data = EMAC_MDIO_DATA;
|
|
|
|
+ mac->mii.reg_shift = 4;
|
|
|
|
+ mac->mii.reg_mask = GENMASK(8, 4);
|
|
|
|
+ mac->mii.addr_shift = 12;
|
|
|
|
+ mac->mii.addr_mask = GENMASK(16, 12);
|
|
|
|
+ mac->mii.clk_csr_shift = 20;
|
|
|
|
+ mac->mii.clk_csr_mask = GENMASK(22, 20);
|
|
|
|
+ mac->unicast_filter_entries = 8;
|
|
|
|
+
|
|
|
|
+ /* Synopsys Id is not available */
|
|
|
|
+ priv->synopsys_id = 0;
|
|
|
|
+
|
|
|
|
+ return mac;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static int sun8i_dwmac_probe(struct platform_device *pdev)
|
2016-11-08 11:05:09 +00:00
|
|
|
+{
|
2017-03-20 09:46:22 +00:00
|
|
|
+ struct plat_stmmacenet_data *plat_dat;
|
|
|
|
+ struct stmmac_resources stmmac_res;
|
|
|
|
+ struct sunxi_priv_data *gmac;
|
|
|
|
+ struct device *dev = &pdev->dev;
|
|
|
|
+ int ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = stmmac_get_platform_resources(pdev, &stmmac_res);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ plat_dat = stmmac_probe_config_dt(pdev, &stmmac_res.mac);
|
|
|
|
+ if (IS_ERR(plat_dat))
|
|
|
|
+ return PTR_ERR(plat_dat);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL);
|
|
|
|
+ if (!gmac)
|
|
|
|
+ return -ENOMEM;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ gmac->variant = of_device_get_match_data(&pdev->dev);
|
|
|
|
+ if (!gmac->variant) {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ dev_err(&pdev->dev, "Missing dwmac-sun8i variant\n");
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return -EINVAL;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ gmac->tx_clk = devm_clk_get(dev, "stmmaceth");
|
|
|
|
+ if (IS_ERR(gmac->tx_clk)) {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ dev_err(dev, "Could not get TX clock\n");
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return PTR_ERR(gmac->tx_clk);
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ /* Optional regulator for PHY */
|
|
|
|
+ gmac->regulator = devm_regulator_get_optional(dev, "phy");
|
|
|
|
+ if (IS_ERR(gmac->regulator)) {
|
|
|
|
+ if (PTR_ERR(gmac->regulator) == -EPROBE_DEFER)
|
|
|
|
+ return -EPROBE_DEFER;
|
2017-05-03 17:50:25 +00:00
|
|
|
+ dev_info(dev, "No regulator found\n");
|
2017-03-20 09:46:22 +00:00
|
|
|
+ gmac->regulator = NULL;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ gmac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
|
|
|
|
+ "syscon");
|
|
|
|
+ if (IS_ERR(gmac->regmap)) {
|
|
|
|
+ ret = PTR_ERR(gmac->regmap);
|
2017-05-03 17:50:25 +00:00
|
|
|
+ dev_err(&pdev->dev, "Unable to map syscon: %d\n", ret);
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ plat_dat->interface = of_get_phy_mode(dev->of_node);
|
|
|
|
+ if (plat_dat->interface == gmac->variant->internal_phy) {
|
|
|
|
+ dev_info(&pdev->dev, "Will use internal PHY\n");
|
|
|
|
+ gmac->use_internal_phy = true;
|
|
|
|
+ gmac->ephy_clk = of_clk_get(plat_dat->phy_node, 0);
|
|
|
|
+ if (IS_ERR(gmac->ephy_clk)) {
|
|
|
|
+ ret = PTR_ERR(gmac->ephy_clk);
|
2017-05-03 17:50:25 +00:00
|
|
|
+ dev_err(&pdev->dev, "Cannot get EPHY clock: %d\n", ret);
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ gmac->rst_ephy = of_reset_control_get(plat_dat->phy_node, NULL);
|
|
|
|
+ if (IS_ERR(gmac->rst_ephy)) {
|
|
|
|
+ ret = PTR_ERR(gmac->rst_ephy);
|
|
|
|
+ if (ret == -EPROBE_DEFER)
|
|
|
|
+ return ret;
|
|
|
|
+ dev_err(&pdev->dev, "No EPHY reset control found %d\n",
|
|
|
|
+ ret);
|
|
|
|
+ return -EINVAL;
|
|
|
|
+ }
|
2016-11-08 11:05:09 +00:00
|
|
|
+ } else {
|
2017-03-20 09:46:22 +00:00
|
|
|
+ dev_info(&pdev->dev, "Will use external PHY\n");
|
|
|
|
+ gmac->use_internal_phy = false;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ }
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ /* platform data specifying hardware features and callbacks.
|
|
|
|
+ * hardware features were copied from Allwinner drivers.
|
|
|
|
+ */
|
|
|
|
+ plat_dat->rx_coe = STMMAC_RX_COE_TYPE2;
|
|
|
|
+ plat_dat->tx_coe = 1;
|
|
|
|
+ plat_dat->has_sun8i = true;
|
|
|
|
+ plat_dat->bsp_priv = gmac;
|
|
|
|
+ plat_dat->init = sun8i_dwmac_init;
|
|
|
|
+ plat_dat->exit = sun8i_dwmac_exit;
|
|
|
|
+ plat_dat->setup = sun8i_dwmac_setup;
|
|
|
|
+
|
|
|
|
+ ret = sun8i_dwmac_init(pdev, plat_dat->bsp_priv);
|
|
|
|
+ if (ret)
|
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res);
|
|
|
|
+ if (ret)
|
|
|
|
+ sun8i_dwmac_exit(pdev, plat_dat->bsp_priv);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+ return ret;
|
2016-11-08 11:05:09 +00:00
|
|
|
+}
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+static const struct of_device_id sun8i_dwmac_match[] = {
|
2016-11-08 11:05:09 +00:00
|
|
|
+ { .compatible = "allwinner,sun8i-h3-emac",
|
2017-03-20 09:46:22 +00:00
|
|
|
+ .data = &emac_variant_h3 },
|
|
|
|
+ { .compatible = "allwinner,sun8i-a83t-emac",
|
|
|
|
+ .data = &emac_variant_a83t },
|
2016-11-08 11:05:09 +00:00
|
|
|
+ { .compatible = "allwinner,sun50i-a64-emac",
|
2017-03-20 09:46:22 +00:00
|
|
|
+ .data = &emac_variant_a64 },
|
|
|
|
+ { }
|
2016-11-08 11:05:09 +00:00
|
|
|
+};
|
2017-03-20 09:46:22 +00:00
|
|
|
+MODULE_DEVICE_TABLE(of, sun8i_dwmac_match);
|
|
|
|
+
|
|
|
|
+static struct platform_driver sun8i_dwmac_driver = {
|
|
|
|
+ .probe = sun8i_dwmac_probe,
|
|
|
|
+ .remove = stmmac_pltfr_remove,
|
|
|
|
+ .driver = {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ .name = "dwmac-sun8i",
|
2017-03-20 09:46:22 +00:00
|
|
|
+ .pm = &stmmac_pltfr_pm_ops,
|
|
|
|
+ .of_match_table = sun8i_dwmac_match,
|
2016-11-08 11:05:09 +00:00
|
|
|
+ },
|
|
|
|
+};
|
2017-03-20 09:46:22 +00:00
|
|
|
+module_platform_driver(sun8i_dwmac_driver);
|
2016-11-08 11:05:09 +00:00
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
+MODULE_AUTHOR("Corentin Labbe <clabbe.montjoie@gmail.com>");
|
|
|
|
+MODULE_DESCRIPTION("Allwinner sun8i DWMAC specific glue layer");
|
2016-11-08 11:05:09 +00:00
|
|
|
+MODULE_LICENSE("GPL");
|
2017-03-20 09:46:22 +00:00
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
2017-06-14 15:24:24 +00:00
|
|
|
index c80c9c3b67db..68a188e74c54 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -235,6 +235,17 @@ static void stmmac_clk_csr_set(struct stmmac_priv *priv)
|
2017-03-20 09:46:22 +00:00
|
|
|
else if ((clk_rate >= CSR_F_250M) && (clk_rate < CSR_F_300M))
|
|
|
|
priv->clk_csr = STMMAC_CSR_250_300M;
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ if (priv->plat->has_sun8i) {
|
|
|
|
+ if (clk_rate > 160000000)
|
|
|
|
+ priv->clk_csr = 0x03;
|
|
|
|
+ else if (clk_rate > 80000000)
|
|
|
|
+ priv->clk_csr = 0x02;
|
|
|
|
+ else if (clk_rate > 40000000)
|
|
|
|
+ priv->clk_csr = 0x01;
|
|
|
|
+ else
|
|
|
|
+ priv->clk_csr = 0;
|
|
|
|
+ }
|
|
|
|
}
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
static void print_pkt(unsigned char *buf, int len)
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -3955,6 +3966,10 @@ static int stmmac_hw_init(struct stmmac_priv *priv)
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
priv->hw = mac;
|
|
|
|
|
|
|
|
+ /* dwmac-sun8i only work in chain mode */
|
|
|
|
+ if (priv->plat->has_sun8i)
|
|
|
|
+ chain_mode = 1;
|
|
|
|
+
|
|
|
|
/* To use the chained or ring mode */
|
|
|
|
if (priv->synopsys_id >= DWMAC_CORE_4_00) {
|
|
|
|
priv->hw->mode = &dwmac4_ring_mode_ops;
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
|
2017-06-14 15:24:24 +00:00
|
|
|
index 7fc3a1ef395a..3840529344ed 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -309,6 +309,12 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
|
2017-03-20 09:46:22 +00:00
|
|
|
struct device_node *np, struct device *dev)
|
|
|
|
{
|
|
|
|
bool mdio = true;
|
|
|
|
+ static const struct of_device_id need_mdio_ids[] = {
|
|
|
|
+ { .compatible = "snps,dwc-qos-ethernet-4.10" },
|
|
|
|
+ { .compatible = "allwinner,sun8i-a83t-emac" },
|
|
|
|
+ { .compatible = "allwinner,sun8i-h3-emac" },
|
|
|
|
+ { .compatible = "allwinner,sun50i-a64-emac" },
|
2016-11-08 11:05:09 +00:00
|
|
|
+ };
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
/* If phy-handle property is passed from DT, use it as the PHY */
|
|
|
|
plat->phy_node = of_parse_phandle(np, "phy-handle", 0);
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -325,8 +331,7 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
|
2017-03-20 09:46:22 +00:00
|
|
|
mdio = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
- /* exception for dwmac-dwc-qos-eth glue logic */
|
|
|
|
- if (of_device_is_compatible(np, "snps,dwc-qos-ethernet-4.10")) {
|
|
|
|
+ if (of_match_node(need_mdio_ids, np)) {
|
|
|
|
plat->mdio_node = of_get_child_by_name(np, "mdio");
|
|
|
|
} else {
|
|
|
|
/**
|
|
|
|
diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h
|
2017-06-14 15:24:24 +00:00
|
|
|
index 8bb550bca96d..108739ff9223 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/include/linux/stmmac.h
|
|
|
|
+++ b/include/linux/stmmac.h
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -186,6 +186,7 @@ struct plat_stmmacenet_data {
|
2017-03-20 09:46:22 +00:00
|
|
|
struct reset_control *stmmac_rst;
|
|
|
|
struct stmmac_axi *axi;
|
|
|
|
int has_gmac4;
|
|
|
|
+ bool has_sun8i;
|
|
|
|
bool tso_en;
|
|
|
|
int mac_port_sel_speed;
|
|
|
|
bool en_tx_lpi_clockgating;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:37 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,
|
|
|
|
06/21] arm: sun8i: sunxi-h3-h5: Add dt node for the syscon control
|
2016-11-08 11:05:09 +00:00
|
|
|
module
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756021
|
|
|
|
Message-Id: <20170531071852.12422-7-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:37 +0200
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
This patch add the dt node for the syscon register present on the
|
2017-03-20 09:46:22 +00:00
|
|
|
Allwinner H3/H5
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
Only two register are present in this syscon and the only one useful is
|
2017-03-20 09:46:22 +00:00
|
|
|
the one dedicated to EMAC clock..
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-03-20 09:46:22 +00:00
|
|
|
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
2017-06-14 15:24:24 +00:00
|
|
|
index d0067fec99de..3a28be5ab641 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
|
|
|
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -83,6 +83,12 @@
|
2016-11-08 11:05:09 +00:00
|
|
|
#size-cells = <1>;
|
|
|
|
ranges;
|
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
+ syscon: syscon@1c00000 {
|
|
|
|
+ compatible = "allwinner,sun8i-h3-system-controller",
|
|
|
|
+ "syscon";
|
2016-11-08 11:05:09 +00:00
|
|
|
+ reg = <0x01c00000 0x1000>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
dma: dma-controller@01c02000 {
|
|
|
|
compatible = "allwinner,sun8i-h3-dma";
|
|
|
|
reg = <0x01c02000 0x1000>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:38 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,07/21] arm: sun8i: sunxi-h3-h5: add dwmac-sun8i ethernet driver
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9755999
|
|
|
|
Message-Id: <20170531071852.12422-8-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:38 +0200
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
The dwmac-sun8i is an ethernet MAC hardware that support 10/100/1000
|
2016-11-08 11:05:09 +00:00
|
|
|
speed.
|
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
This patch enable the dwmac-sun8i on Allwinner H3/H5 SoC Device-tree.
|
|
|
|
SoC H3/H5 have an internal PHY, so optionals syscon and ephy are set.
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
arch/arm/boot/dts/sunxi-h3-h5.dtsi | 34 ++++++++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 34 insertions(+)
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
diff --git a/arch/arm/boot/dts/sunxi-h3-h5.dtsi b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
2017-06-14 15:24:24 +00:00
|
|
|
index 3a28be5ab641..9e4a496f3cca 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
|
|
|
+++ b/arch/arm/boot/dts/sunxi-h3-h5.dtsi
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -285,6 +285,14 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
interrupt-controller;
|
|
|
|
#interrupt-cells = <3>;
|
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
+ emac_rgmii_pins: emac0 {
|
2017-03-20 09:46:22 +00:00
|
|
|
+ pins = "PD0", "PD1", "PD2", "PD3", "PD4",
|
2017-05-03 17:50:25 +00:00
|
|
|
+ "PD5", "PD7", "PD8", "PD9", "PD10",
|
|
|
|
+ "PD12", "PD13", "PD15", "PD16", "PD17";
|
2017-03-20 09:46:22 +00:00
|
|
|
+ function = "emac";
|
|
|
|
+ drive-strength = <40>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
i2c0_pins: i2c0 {
|
|
|
|
pins = "PA11", "PA12";
|
|
|
|
function = "i2c0";
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -381,6 +389,32 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
clocks = <&osc24M>;
|
2016-11-08 11:05:09 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
+ emac: ethernet@1c30000 {
|
|
|
|
+ compatible = "allwinner,sun8i-h3-emac";
|
|
|
|
+ syscon = <&syscon>;
|
|
|
|
+ reg = <0x01c30000 0x104>;
|
|
|
|
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ interrupt-names = "macirq";
|
2016-11-08 11:05:09 +00:00
|
|
|
+ resets = <&ccu RST_BUS_EMAC>;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ reset-names = "stmmaceth";
|
2016-11-08 11:05:09 +00:00
|
|
|
+ clocks = <&ccu CLK_BUS_EMAC>;
|
2017-03-20 09:46:22 +00:00
|
|
|
+ clock-names = "stmmaceth";
|
2016-11-08 11:05:09 +00:00
|
|
|
+ #address-cells = <1>;
|
|
|
|
+ #size-cells = <0>;
|
|
|
|
+ status = "disabled";
|
|
|
|
+
|
|
|
|
+ mdio: mdio {
|
|
|
|
+ #address-cells = <1>;
|
|
|
|
+ #size-cells = <0>;
|
|
|
|
+ int_mii_phy: ethernet-phy@1 {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <1>;
|
|
|
|
+ clocks = <&ccu CLK_BUS_EPHY>;
|
|
|
|
+ resets = <&ccu RST_BUS_EPHY>;
|
2016-11-08 11:05:09 +00:00
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+
|
2017-03-20 09:46:22 +00:00
|
|
|
spi0: spi@01c68000 {
|
|
|
|
compatible = "allwinner,sun8i-h3-spi";
|
|
|
|
reg = <0x01c68000 0x1000>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:39 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,08/21] arm: sun8i: orangepi-pc: Enable dwmac-sun8i
|
2016-11-08 11:05:09 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756007
|
|
|
|
Message-Id: <20170531071852.12422-9-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:39 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i hardware is present on the Orange PI PC.
|
2016-11-08 11:05:09 +00:00
|
|
|
It uses the internal PHY.
|
|
|
|
|
|
|
|
This patch create the needed emac node.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts | 8 ++++++++
|
|
|
|
1 file changed, 8 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 1a044b17d6c6..998b60f8d295 100644
|
2016-11-08 11:05:09 +00:00
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc.dts
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -52,6 +52,7 @@
|
|
|
|
compatible = "xunlong,orangepi-pc", "allwinner,sun8i-h3";
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
aliases {
|
|
|
|
+ ethernet0 = &emac;
|
2017-05-03 17:50:25 +00:00
|
|
|
serial0 = &uart0;
|
2016-11-08 11:05:09 +00:00
|
|
|
};
|
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -113,6 +114,13 @@
|
2016-11-08 11:05:09 +00:00
|
|
|
status = "okay";
|
|
|
|
};
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2016-11-08 11:05:09 +00:00
|
|
|
+&emac {
|
|
|
|
+ phy-handle = <&int_mii_phy>;
|
|
|
|
+ phy-mode = "mii";
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
&ir {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&ir_pins_a>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:40 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,09/21] arm: sun8i: orangepi-zero: Enable dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756075
|
|
|
|
Message-Id: <20170531071852.12422-10-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:40 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
The dwmac-sun8i hardware is present on the Orange PI Zero.
|
2017-03-20 09:46:22 +00:00
|
|
|
It uses the internal PHY.
|
|
|
|
|
|
|
|
This patch create the needed emac node.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts | 8 ++++++++
|
2017-03-20 09:46:22 +00:00
|
|
|
1 file changed, 8 insertions(+)
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 9e8b082c134f..dd3525a0f06a 100644
|
2017-05-03 17:50:25 +00:00
|
|
|
--- a/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts
|
|
|
|
@@ -57,6 +57,7 @@
|
|
|
|
aliases {
|
2017-03-20 09:46:22 +00:00
|
|
|
serial0 = &uart0;
|
|
|
|
/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
|
|
|
|
+ ethernet0 = &emac;
|
2017-05-03 17:50:25 +00:00
|
|
|
ethernet1 = &xr819;
|
2017-03-20 09:46:22 +00:00
|
|
|
};
|
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -103,6 +104,13 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
status = "okay";
|
|
|
|
};
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
+&emac {
|
|
|
|
+ phy-handle = <&int_mii_phy>;
|
|
|
|
+ phy-mode = "mii";
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
&mmc0 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc0_pins_a>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:41 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,10/21] arm: sun8i: orangepi-one: Enable dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756073
|
|
|
|
Message-Id: <20170531071852.12422-11-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:41 +0200
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
The dwmac-sun8i hardware is present on the Orange PI One.
|
2016-11-08 11:05:09 +00:00
|
|
|
It uses the internal PHY.
|
|
|
|
|
|
|
|
This patch create the needed emac node.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
arch/arm/boot/dts/sun8i-h3-orangepi-one.dts | 8 ++++++++
|
|
|
|
1 file changed, 8 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 5fea430e0eb1..6880268e8b87 100644
|
2016-11-08 11:05:09 +00:00
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-one.dts
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -52,6 +52,7 @@
|
|
|
|
compatible = "xunlong,orangepi-one", "allwinner,sun8i-h3";
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
aliases {
|
|
|
|
+ ethernet0 = &emac;
|
2017-05-03 17:50:25 +00:00
|
|
|
serial0 = &uart0;
|
2016-11-08 11:05:09 +00:00
|
|
|
};
|
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -97,6 +98,13 @@
|
2016-11-08 11:05:09 +00:00
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
|
|
|
|
+&emac {
|
|
|
|
+ phy-handle = <&int_mii_phy>;
|
|
|
|
+ phy-mode = "mii";
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&mmc0 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:42 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,11/21] arm: sun8i: orangepi-2: Enable dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756071
|
|
|
|
Message-Id: <20170531071852.12422-12-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:42 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i hardware is present on the Orange PI 2.
|
|
|
|
It uses the internal PHY.
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
This patch create the needed emac node.
|
2016-11-08 11:05:09 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
arch/arm/boot/dts/sun8i-h3-orangepi-2.dts | 8 ++++++++
|
|
|
|
1 file changed, 8 insertions(+)
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 8ff71b1bb45b..17cdeae19c6f 100644
|
2017-05-03 17:50:25 +00:00
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-2.dts
|
|
|
|
@@ -54,6 +54,7 @@
|
|
|
|
aliases {
|
|
|
|
serial0 = &uart0;
|
|
|
|
/* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
|
|
|
|
+ ethernet0 = &emac;
|
|
|
|
ethernet1 = &rtl8189;
|
2017-03-20 09:46:22 +00:00
|
|
|
};
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -117,6 +118,13 @@
|
2017-05-03 17:50:25 +00:00
|
|
|
status = "okay";
|
2016-11-08 11:05:09 +00:00
|
|
|
};
|
2017-03-20 09:46:22 +00:00
|
|
|
|
2016-11-08 11:05:09 +00:00
|
|
|
+&emac {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ phy-handle = <&int_mii_phy>;
|
|
|
|
+ phy-mode = "mii";
|
2016-11-08 11:05:09 +00:00
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
&ir {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&ir_pins_a>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:43 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,
|
|
|
|
12/21] arm: sun8i: orangepi-pc-plus: Set EMAC activity LEDs to active
|
2017-05-03 17:50:25 +00:00
|
|
|
high
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756005
|
|
|
|
Message-Id: <20170531071852.12422-13-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:43 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
On the Orange Pi PC Plus, the polarity of the LEDs on the RJ45 Ethernet
|
|
|
|
port were changed from active low to active high.
|
|
|
|
|
|
|
|
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts | 5 +++++
|
|
|
|
1 file changed, 5 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 8b93f5c781a7..a10281b455f5 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-pc-plus.dts
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -53,6 +53,11 @@
|
|
|
|
};
|
2017-03-20 09:46:22 +00:00
|
|
|
};
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
+&emac {
|
|
|
|
+ /* LEDs changed to active high on the plus */
|
|
|
|
+ /delete-property/ allwinner,leds-active-low;
|
|
|
|
+};
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
&mmc1 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc1_pins_a>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:44 2017
|
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Subject: [v6,13/21] arm: sun8i: nanopi-neo: Enable dwmac-sun8i
|
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
|
|
|
X-Patchwork-Id: 9756089
|
|
|
|
Message-Id: <20170531071852.12422-14-clabbe.montjoie@gmail.com>
|
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:44 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
The dwmac-sun8i hardware is present on the NanoPi Neo.
|
|
|
|
It uses the internal PHY.
|
|
|
|
This patch create the needed emac node.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts | 7 +++++++
|
|
|
|
1 file changed, 7 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
|
|
|
|
index 8d2cc6e9a03f..78f6c24952dd 100644
|
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts
|
|
|
|
@@ -46,3 +46,10 @@
|
|
|
|
model = "FriendlyARM NanoPi NEO";
|
|
|
|
compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3";
|
|
|
|
};
|
|
|
|
+
|
|
|
|
+&emac {
|
|
|
|
+ phy-handle = <&int_mii_phy>;
|
|
|
|
+ phy-mode = "mii";
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
|
|
|
From patchwork Wed May 31 07:18:45 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6, 14/21] arm64: allwinner: sun50i-a64: Add dt node for the syscon
|
2017-05-03 17:50:25 +00:00
|
|
|
control module
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756069
|
|
|
|
Message-Id: <20170531071852.12422-15-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:45 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
This patch add the dt node for the syscon register present on the
|
|
|
|
Allwinner A64.
|
|
|
|
|
|
|
|
Only two register are present in this syscon and the only one useful is
|
|
|
|
the one dedicated to EMAC clock.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
|
|
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 6 ++++++
|
|
|
|
1 file changed, 6 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
2017-06-14 15:24:24 +00:00
|
|
|
index 90dc4ec79485..2eeba0d44074 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
|
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -129,6 +129,12 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
#size-cells = <1>;
|
|
|
|
ranges;
|
|
|
|
|
2017-05-03 17:50:25 +00:00
|
|
|
+ syscon: syscon@1c00000 {
|
|
|
|
+ compatible = "allwinner,sun50i-a64-system-controller",
|
|
|
|
+ "syscon";
|
2017-03-20 09:46:22 +00:00
|
|
|
+ reg = <0x01c00000 0x1000>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
mmc0: mmc@1c0f000 {
|
|
|
|
compatible = "allwinner,sun50i-a64-mmc";
|
|
|
|
reg = <0x01c0f000 0x1000>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:46 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,
|
|
|
|
15/21] arm64: allwinner: sun50i-a64: add dwmac-sun8i Ethernet driver
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756015
|
|
|
|
Message-Id: <20170531071852.12422-16-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:46 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i is an Ethernet MAC that supports 10/100/1000 Mbit
|
|
|
|
connections. It is very similar to the device found in the Allwinner
|
|
|
|
H3, but lacks the internal 100 Mbit PHY and its associated control
|
|
|
|
bits.
|
|
|
|
This adds the necessary bits to the Allwinner A64 SoC .dtsi, but keeps
|
|
|
|
it disabled at this level.
|
2016-11-08 11:05:09 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 35 +++++++++++++++++++++++++++
|
|
|
|
1 file changed, 35 insertions(+)
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
2017-06-14 15:24:24 +00:00
|
|
|
index 2eeba0d44074..7a07353ac1f6 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
|
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -309,6 +309,21 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
bias-pull-up;
|
|
|
|
};
|
|
|
|
|
|
|
|
+ rmii_pins: rmii_pins {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ pins = "PD10", "PD11", "PD13", "PD14", "PD17",
|
|
|
|
+ "PD18", "PD19", "PD20", "PD22", "PD23";
|
2017-03-20 09:46:22 +00:00
|
|
|
+ function = "emac";
|
|
|
|
+ drive-strength = <40>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ rgmii_pins: rgmii_pins {
|
2017-05-03 17:50:25 +00:00
|
|
|
+ pins = "PD8", "PD9", "PD10", "PD11", "PD12",
|
|
|
|
+ "PD13", "PD15", "PD16", "PD17", "PD18",
|
|
|
|
+ "PD19", "PD20", "PD21", "PD22", "PD23";
|
2017-03-20 09:46:22 +00:00
|
|
|
+ function = "emac";
|
|
|
|
+ drive-strength = <40>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
uart0_pins_a: uart0@0 {
|
|
|
|
pins = "PB8", "PB9";
|
|
|
|
function = "uart0";
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -433,6 +448,26 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
#size-cells = <0>;
|
|
|
|
};
|
|
|
|
|
|
|
|
+ emac: ethernet@1c30000 {
|
|
|
|
+ compatible = "allwinner,sun50i-a64-emac";
|
|
|
|
+ syscon = <&syscon>;
|
|
|
|
+ reg = <0x01c30000 0x100>;
|
|
|
|
+ interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
|
|
|
|
+ interrupt-names = "macirq";
|
|
|
|
+ resets = <&ccu RST_BUS_EMAC>;
|
|
|
|
+ reset-names = "stmmaceth";
|
|
|
|
+ clocks = <&ccu CLK_BUS_EMAC>;
|
|
|
|
+ clock-names = "stmmaceth";
|
|
|
|
+ status = "disabled";
|
|
|
|
+ #address-cells = <1>;
|
|
|
|
+ #size-cells = <0>;
|
|
|
|
+
|
|
|
|
+ mdio: mdio {
|
|
|
|
+ #address-cells = <1>;
|
|
|
|
+ #size-cells = <0>;
|
|
|
|
+ };
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
gic: interrupt-controller@1c81000 {
|
|
|
|
compatible = "arm,gic-400";
|
|
|
|
reg = <0x01c81000 0x1000>,
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:47 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,16/21] arm64: allwinner: pine64: Enable dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756067
|
|
|
|
Message-Id: <20170531071852.12422-17-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:47 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i hardware is present on the pine64
|
|
|
|
It uses an external PHY via RMII.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts | 16 ++++++++++++++++
|
|
|
|
1 file changed, 16 insertions(+)
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 7c533b6d4ba9..08cda24ea194 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
|
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -78,6 +78,15 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
status = "okay";
|
|
|
|
};
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-03-20 09:46:22 +00:00
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&rmii_pins>;
|
|
|
|
+ phy-mode = "rmii";
|
|
|
|
+ phy-handle = <&ext_rmii_phy1>;
|
|
|
|
+ status = "okay";
|
|
|
|
+
|
|
|
|
+};
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
&i2c1 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&i2c1_pins>;
|
2017-06-14 15:24:24 +00:00
|
|
|
@@ -88,6 +97,13 @@
|
2017-05-03 17:50:25 +00:00
|
|
|
bias-pull-up;
|
|
|
|
};
|
|
|
|
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rmii_phy1: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <1>;
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&mmc0 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc0_pins>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:48 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,17/21] arm64: allwinner: pine64-plus: Enable dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756065
|
|
|
|
Message-Id: <20170531071852.12422-18-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:48 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i hardware is present on the pine64 plus.
|
|
|
|
It uses an external PHY rtl8211e via RGMII.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
.../arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts | 17 ++++++++++++++++-
|
|
|
|
1 file changed, 16 insertions(+), 1 deletion(-)
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 790d14daaa6a..24f1aac366d6 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
|
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pine64-plus.dts
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -46,5 +46,20 @@
|
2017-03-20 09:46:22 +00:00
|
|
|
model = "Pine64+";
|
|
|
|
compatible = "pine64,pine64-plus", "allwinner,sun50i-a64";
|
|
|
|
|
|
|
|
- /* TODO: Camera, Ethernet PHY, touchscreen, etc. */
|
|
|
|
+ /* TODO: Camera, touchscreen, etc. */
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&rgmii_pins>;
|
|
|
|
+ phy-mode = "rgmii";
|
|
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
|
|
+ status = "okay";
|
2017-05-03 17:50:25 +00:00
|
|
|
+};
|
|
|
|
+
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <1>;
|
|
|
|
+ };
|
2017-03-20 09:46:22 +00:00
|
|
|
};
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Wed May 31 07:18:49 2017
|
2017-03-20 09:46:22 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [v6,18/21] arm64: allwinner: bananapi-m64: Enable dwmac-sun8i
|
2017-03-20 09:46:22 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9756025
|
|
|
|
Message-Id: <20170531071852.12422-19-clabbe.montjoie@gmail.com>
|
2017-03-20 09:46:22 +00:00
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com,
|
2017-06-14 15:24:24 +00:00
|
|
|
maxime.ripard@free-electrons.com,
|
|
|
|
wens@csie.org, linux@armlinux.org.uk, catalin.marinas@arm.com,
|
2017-05-03 17:50:25 +00:00
|
|
|
will.deacon@arm.com, peppe.cavallaro@st.com, alexandre.torgue@st.com
|
2017-06-14 15:24:24 +00:00
|
|
|
Cc: devicetree@vger.kernel.org, netdev@vger.kernel.org,
|
|
|
|
linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Wed, 31 May 2017 09:18:49 +0200
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
The dwmac-sun8i hardware is present on the BananaPi M64.
|
|
|
|
It uses an external PHY rtl8211e via RGMII.
|
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-05-03 17:50:25 +00:00
|
|
|
arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts | 15 +++++++++++++++
|
|
|
|
1 file changed, 15 insertions(+)
|
2017-03-20 09:46:22 +00:00
|
|
|
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
|
2017-06-14 15:24:24 +00:00
|
|
|
index 6872135d7f84..0d1f026d831a 100644
|
2017-03-20 09:46:22 +00:00
|
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
|
|
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-bananapi-m64.dts
|
2017-05-03 17:50:25 +00:00
|
|
|
@@ -67,6 +67,14 @@
|
|
|
|
};
|
2017-03-20 09:46:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&rgmii_pins>;
|
|
|
|
+ phy-mode = "rgmii";
|
|
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
2017-05-03 17:50:25 +00:00
|
|
|
+
|
|
|
|
&i2c1 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&i2c1_pins>;
|
|
|
|
@@ -77,6 +85,13 @@
|
|
|
|
bias-pull-up;
|
|
|
|
};
|
|
|
|
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <1>;
|
|
|
|
+ };
|
|
|
|
+};
|
2017-03-20 09:46:22 +00:00
|
|
|
+
|
|
|
|
&mmc0 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc0_pins>;
|
2017-06-14 15:24:24 +00:00
|
|
|
From patchwork Sun Jun 4 17:53:23 2017
|
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Subject: net-next: stmmac: dwmac-sun8i: ensure the EPHY is properly reseted
|
|
|
|
From: Icenowy Zheng <icenowy@aosc.io>
|
|
|
|
X-Patchwork-Id: 9765125
|
|
|
|
Message-Id: <20170604175323.62124-1-icenowy@aosc.io>
|
|
|
|
To: Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
"David S . Miller" <davem@davemloft.net>
|
|
|
|
Cc: netdev@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
|
|
|
|
Icenowy Zheng <icenowy@aosc.io>
|
|
|
|
Date: Mon, 5 Jun 2017 01:53:23 +0800
|
|
|
|
|
|
|
|
The EPHY may be already enabled by bootloaders which have Ethernet
|
|
|
|
capability (e.g. current U-Boot). Thus it should be reseted properly
|
|
|
|
before doing the enabling sequence in the dwmac-sun8i driver, otherwise
|
|
|
|
the EMAC reset process may fail if no cable is plugged, and then fail
|
|
|
|
the dwmac-sun8i probing.
|
|
|
|
|
|
|
|
Tested on Orange Pi PC, One and Zero. All the boards fail to have
|
|
|
|
dwmac-sun8i probed with "EMAC reset timeout" without cable plugged
|
|
|
|
before, and with this fix they're now all able to successfully probe the
|
|
|
|
EMAC without cable plugged and then use the connection after a cable is
|
|
|
|
hot-plugged in.
|
|
|
|
|
|
|
|
Fixes: 9f93ac8d408 ("net-next: stmmac: Add dwmac-sun8i")
|
|
|
|
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
|
|
|
|
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
Reviewed-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
Acked-by: is not as formal as Signed-off-by:. It is a record that the acker
|
|
|
|
Reviewed-by: is similar.
|
|
|
|
---
|
|
|
|
drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 5 +++++
|
|
|
|
1 file changed, 5 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
|
|
index 1a6bfe6c958f..54f93ee53ef7 100644
|
|
|
|
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
|
|
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
|
|
|
|
@@ -750,6 +750,11 @@ static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ /* Make sure the EPHY is properly reseted, as U-Boot may leave
|
|
|
|
+ * it at deasserted state, and thus it may fail to reset EMAC.
|
|
|
|
+ */
|
|
|
|
+ reset_control_assert(gmac->rst_ephy);
|
|
|
|
+
|
|
|
|
ret = reset_control_deassert(gmac->rst_ephy);
|
|
|
|
if (ret) {
|
|
|
|
dev_err(priv->device, "Cannot deassert ephy\n");
|
|
|
|
From patchwork Fri Jun 9 15:34:36 2017
|
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
|
|
|
Subject: ARM: sun8i: h3: Enable EMAC with external PHY on Orange Pi Plus 2E
|
|
|
|
From: Chen-Yu Tsai <wens@csie.org>
|
|
|
|
X-Patchwork-Id: 9778837
|
|
|
|
Message-Id: <20170609153436.18370-1-wens@csie.org>
|
|
|
|
To: Maxime Ripard <maxime.ripard@free-electrons.com>
|
|
|
|
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
|
|
|
|
Chen-Yu Tsai <wens@csie.org>, Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-sunxi@googlegroups.co, linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Fri, 9 Jun 2017 23:34:36 +0800
|
|
|
|
|
|
|
|
The Orange Pi Plus 2E, unlike the Orange Pi PC and PC Plus which its
|
|
|
|
schematics are based on, uses an external Realtek RTL8211E PHY in
|
|
|
|
RGMII mode, with a GPIO enabling the regulator for I/O signalling
|
|
|
|
power supplies. The PHY's main power supply is enabled by the main
|
|
|
|
5V power supply.
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
Add the regulator and PHY nodes, and override the PHY phandle under
|
|
|
|
the EMAC node, so that the EMAC works properly on this board.
|
|
|
|
|
|
|
|
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
|
|
|
|
---
|
|
|
|
arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts | 26 ++++++++++++++++++++++++++
|
|
|
|
1 file changed, 26 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
|
|
|
|
index 5851a47a3089..80026f3caafc 100644
|
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus2e.dts
|
|
|
|
@@ -50,4 +50,30 @@
|
|
|
|
/ {
|
|
|
|
model = "Xunlong Orange Pi Plus 2E";
|
|
|
|
compatible = "xunlong,orangepi-plus2e", "allwinner,sun8i-h3";
|
|
|
|
+
|
|
|
|
+ reg_gmac_3v3: gmac-3v3 {
|
|
|
|
+ compatible = "regulator-fixed";
|
|
|
|
+ regulator-name = "gmac-3v3";
|
|
|
|
+ regulator-min-microvolt = <3300000>;
|
|
|
|
+ regulator-max-microvolt = <3300000>;
|
|
|
|
+ startup-delay-us = <100000>;
|
|
|
|
+ enable-active-high;
|
|
|
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
|
|
|
+ phy-supply = <®_gmac_3v3>;
|
|
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
|
|
+ phy-mode = "rgmii";
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <1>;
|
|
|
|
+ };
|
|
|
|
};
|
|
|
|
From patchwork Mon Jun 5 19:21:26 2017
|
2017-05-03 17:50:25 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [1/5] ARM: sun8i: orangepi-plus: Enable dwmac-sun8i
|
2017-05-03 17:50:25 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9767313
|
|
|
|
Message-Id: <20170605192130.25320-2-clabbe.montjoie@gmail.com>
|
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk,
|
2017-05-03 17:50:25 +00:00
|
|
|
maxime.ripard@free-electrons.com, wens@csie.org,
|
2017-06-14 15:24:24 +00:00
|
|
|
catalin.marinas@arm.com, will.deacon@arm.com
|
|
|
|
Cc: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Mon, 5 Jun 2017 21:21:26 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
The dwmac-sun8i hardware is present on the Orange PI plus.
|
|
|
|
It uses an external PHY rtl8211e via RGMII.
|
|
|
|
|
|
|
|
This patch create the needed regulator, emac and phy nodes.
|
2017-05-03 17:50:25 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-06-14 15:24:24 +00:00
|
|
|
arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts | 32 ++++++++++++++++++++++++++++
|
|
|
|
1 file changed, 32 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
|
|
|
|
index 8c40ab7bfa72..331ed683ac62 100644
|
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-orangepi-plus.dts
|
|
|
|
@@ -47,6 +47,20 @@
|
|
|
|
model = "Xunlong Orange Pi Plus / Plus 2";
|
|
|
|
compatible = "xunlong,orangepi-plus", "allwinner,sun8i-h3";
|
|
|
|
|
|
|
|
+ aliases {
|
|
|
|
+ ethernet0 = &emac;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ reg_gmac_3v3: gmac-3v3 {
|
|
|
|
+ compatible = "regulator-fixed";
|
|
|
|
+ regulator-name = "gmac-3v3";
|
|
|
|
+ regulator-min-microvolt = <3300000>;
|
|
|
|
+ regulator-max-microvolt = <3300000>;
|
|
|
|
+ startup-delay-us = <100000>;
|
|
|
|
+ enable-active-high;
|
|
|
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
reg_usb3_vbus: usb3-vbus {
|
|
|
|
compatible = "regulator-fixed";
|
|
|
|
pinctrl-names = "default";
|
|
|
|
@@ -64,6 +78,24 @@
|
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
|
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
|
|
|
+ phy-supply = <®_gmac_3v3>;
|
|
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
|
|
+ phy-mode = "rgmii";
|
|
|
|
+
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <0>;
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&mmc2 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc2_8bit_pins>;
|
|
|
|
From patchwork Mon Jun 5 19:21:27 2017
|
2017-05-03 17:50:25 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [2/5] ARM: sun8i: bananapi-m2-plus: Enable dwmac-sun8i
|
2017-05-03 17:50:25 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9767321
|
|
|
|
Message-Id: <20170605192130.25320-3-clabbe.montjoie@gmail.com>
|
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk,
|
2017-05-03 17:50:25 +00:00
|
|
|
maxime.ripard@free-electrons.com, wens@csie.org,
|
2017-06-14 15:24:24 +00:00
|
|
|
catalin.marinas@arm.com, will.deacon@arm.com
|
|
|
|
Cc: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Mon, 5 Jun 2017 21:21:27 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
The dwmac-sun8i hardware is present on the Banana Pi M2+
|
|
|
|
It uses an external PHY rtl8211e via RGMII.
|
|
|
|
|
|
|
|
This patch create the needed regulator, emac and phy nodes.
|
2017-05-03 17:50:25 +00:00
|
|
|
|
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-06-14 15:24:24 +00:00
|
|
|
arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts | 29 +++++++++++++++++++++++++
|
|
|
|
1 file changed, 29 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts b/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
|
|
|
|
index 883072b611fa..d756ff825116 100644
|
|
|
|
--- a/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
|
|
|
|
+++ b/arch/arm/boot/dts/sun8i-h3-bananapi-m2-plus.dts
|
|
|
|
@@ -52,6 +52,7 @@
|
|
|
|
compatible = "sinovoip,bpi-m2-plus", "allwinner,sun8i-h3";
|
|
|
|
|
|
|
|
aliases {
|
|
|
|
+ ethernet0 = &emac;
|
|
|
|
serial0 = &uart0;
|
|
|
|
serial1 = &uart1;
|
|
|
|
};
|
|
|
|
@@ -84,6 +85,16 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
+ reg_gmac_3v3: gmac-3v3 {
|
|
|
|
+ compatible = "regulator-fixed";
|
|
|
|
+ regulator-name = "gmac-3v3";
|
|
|
|
+ regulator-min-microvolt = <3300000>;
|
|
|
|
+ regulator-max-microvolt = <3300000>;
|
|
|
|
+ startup-delay-us = <100000>;
|
|
|
|
+ enable-active-high;
|
|
|
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
wifi_pwrseq: wifi_pwrseq {
|
|
|
|
compatible = "mmc-pwrseq-simple";
|
|
|
|
pinctrl-names = "default";
|
|
|
|
@@ -104,12 +115,30 @@
|
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
|
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
|
|
|
+ phy-supply = <®_gmac_3v3>;
|
|
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
|
|
+ phy-mode = "rgmii";
|
|
|
|
+
|
|
|
|
+ allwinner,leds-active-low;
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&ir {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&ir_pins_a>;
|
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <0>;
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&mmc0 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
|
|
|
|
From patchwork Mon Jun 5 19:21:28 2017
|
2017-05-03 17:50:25 +00:00
|
|
|
Content-Type: text/plain; charset="utf-8"
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Transfer-Encoding: 7bit
|
2017-06-14 15:24:24 +00:00
|
|
|
Subject: [3/5] ARM: sun50i: orangepi-pc2: Enable dwmac-sun8i
|
2017-05-03 17:50:25 +00:00
|
|
|
From: Corentin LABBE <clabbe.montjoie@gmail.com>
|
2017-06-14 15:24:24 +00:00
|
|
|
X-Patchwork-Id: 9767347
|
|
|
|
Message-Id: <20170605192130.25320-4-clabbe.montjoie@gmail.com>
|
|
|
|
To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk,
|
2017-05-03 17:50:25 +00:00
|
|
|
maxime.ripard@free-electrons.com, wens@csie.org,
|
2017-06-14 15:24:24 +00:00
|
|
|
catalin.marinas@arm.com, will.deacon@arm.com
|
|
|
|
Cc: devicetree@vger.kernel.org, linux-sunxi@googlegroups.com,
|
|
|
|
Corentin Labbe <clabbe.montjoie@gmail.com>,
|
|
|
|
linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org
|
|
|
|
Date: Mon, 5 Jun 2017 21:21:28 +0200
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
The dwmac-sun8i hardware is present on the Orange PI PC2.
|
|
|
|
It uses an external PHY rtl8211e via RGMII.
|
2017-05-03 17:50:25 +00:00
|
|
|
|
2017-06-14 15:24:24 +00:00
|
|
|
This patch create the needed regulator, emac and phy nodes.
|
2017-05-03 17:50:25 +00:00
|
|
|
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
|
|
|
|
---
|
2017-06-14 15:24:24 +00:00
|
|
|
.../boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts | 27 ++++++++++++++++++++++
|
|
|
|
1 file changed, 27 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
|
|
|
|
index dfecc17dcc92..a8296feee884 100644
|
|
|
|
--- a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
|
|
|
|
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts
|
|
|
|
@@ -59,6 +59,7 @@
|
|
|
|
};
|
|
|
|
|
|
|
|
aliases {
|
|
|
|
+ ethernet0 = &emac;
|
|
|
|
serial0 = &uart0;
|
|
|
|
};
|
|
|
|
|
|
|
|
@@ -91,6 +92,16 @@
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
+ reg_gmac_3v3: gmac-3v3 {
|
|
|
|
+ compatible = "regulator-fixed";
|
|
|
|
+ regulator-name = "gmac-3v3";
|
|
|
|
+ regulator-min-microvolt = <3300000>;
|
|
|
|
+ regulator-max-microvolt = <3300000>;
|
|
|
|
+ startup-delay-us = <100000>;
|
|
|
|
+ enable-active-high;
|
|
|
|
+ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>;
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
reg_usb0_vbus: usb0-vbus {
|
|
|
|
compatible = "regulator-fixed";
|
|
|
|
regulator-name = "usb0-vbus";
|
|
|
|
@@ -126,12 +137,28 @@
|
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
|
|
|
|
+&emac {
|
|
|
|
+ pinctrl-names = "default";
|
|
|
|
+ pinctrl-0 = <&emac_rgmii_pins>;
|
|
|
|
+ phy-supply = <®_gmac_3v3>;
|
|
|
|
+ phy-handle = <&ext_rgmii_phy>;
|
|
|
|
+ phy-mode = "rgmii";
|
|
|
|
+ status = "okay";
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&ir {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&ir_pins_a>;
|
|
|
|
status = "okay";
|
|
|
|
};
|
|
|
|
|
|
|
|
+&mdio {
|
|
|
|
+ ext_rgmii_phy: ethernet-phy@1 {
|
|
|
|
+ compatible = "ethernet-phy-ieee802.3-c22";
|
|
|
|
+ reg = <1>;
|
|
|
|
+ };
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
&mmc0 {
|
|
|
|
pinctrl-names = "default";
|
|
|
|
pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>;
|