Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1474703 > unrolled thread

[PATCH v4 0/6] Support the rk3399 gmac and pd function

Started byCaesar Wang <wxt@rock-chips.com>
First post2016-09-01 23:50 +0200
Last post2016-09-03 02:10 +0200
Articles 9 — 5 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v4 0/6] Support the rk3399 gmac and pd function Caesar Wang <wxt@rock-chips.com> - 2016-09-01 23:50 +0200
    [PATCH v4 6/6] arm64: dts: rockchip: enable the gmac for rk3399 evb board Caesar Wang <wxt@rock-chips.com> - 2016-09-02 00:00 +0200
      Re: [PATCH v4 6/6] arm64: dts: rockchip: enable the gmac for rk3399 evb board Heiko Stuebner <heiko@sntech.de> - 2016-09-07 20:20 +0200
    [PATCH v4 2/6] net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off Caesar Wang <wxt@rock-chips.com> - 2016-09-02 00:00 +0200
    Re: [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399 Doug Anderson <dianders@chromium.org> - 2016-09-02 00:00 +0200
    [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399 Caesar Wang <wxt@rock-chips.com> - 2016-09-02 00:10 +0200
      Re: [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399 Heiko Stübner <heiko@sntech.de> - 2016-09-02 13:10 +0200
    [PATCH v4 3/6] net: stmmac: dwmac-rk: add pd_gmac support for rk3399 Caesar Wang <wxt@rock-chips.com> - 2016-09-02 00:10 +0200
    Re: [PATCH v4 0/6] Support the rk3399 gmac and pd function David Miller <davem@davemloft.net> - 2016-09-03 02:10 +0200

#1474703 — [PATCH v4 0/6] Support the rk3399 gmac and pd function

FromCaesar Wang <wxt@rock-chips.com>
Date2016-09-01 23:50 +0200
Subject[PATCH v4 0/6] Support the rk3399 gmac and pd function
Message-ID<scHSj-7dg-57@gated-at.bofh.it>
This patch have the following changes:

7edf13e net: stmmac: dwmac-rk: add rk3366 & rk3399 specific data
26e004e net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off
b216c2f net: stmmac: dwmac-rk: add pd_gmac support for rk3399
848bb71 arm64: dts: rockchip: add the gmac power domain on rk3399
508e41f arm64: dts: rockchip: add the gmac needed node for rk3399
fb26795 arm64: dts: rockchip: enable the gmac for rk3399 evb board

Hi David,
The patch 1,2,3 is related to the rockchip net/stammc driver,

Hi Heiko,
The patch 4,5,6 is related to the dts changes.

The History version:

v1: https://lkml.org/lkml/2016/8/30/668
v2: https://lkml.org/lkml/2016/8/31/27
v3: https://lkml.org/lkml/2016/8/31/981

Thanks your reviewing!

-
Caesar


Changes in v4:
- Fixes from the original patch on https://patchwork.kernel.org/patch/9274557/
- remove the Roger signed-off for domain patch.
- The Roger had posted patch on https://patchwork.kernel.org/patch/9274561/.
- re-fixup to original author.

Changes in v3:
- leave into two patches based on patchv2, and fix nits and commit, as
  comment on https://patchwork.kernel.org/patch/9306339/
- generate a patch from https://patchwork.kernel.org/patch/9306339/.

Changes in v2:
- rk_gmac_powerup instead of the rk_gmac_init.
- fixes the build error on next kernel.
- Fixes the order, ss Heiko commnets on
  https://patchwork.kernel.org/patch/9305991/

Caesar Wang (1):
  arm64: dts: rockchip: add the gmac power domain on rk3399

David Wu (1):
  net: stmmac: dwmac-rk: add pd_gmac support for rk3399

Roger Chen (4):
  net: stmmac: dwmac-rk: add rk3366 & rk3399 specific data
  net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off
  arm64: dts: rockchip: add the gmac needed node for rk3399
  arm64: dts: rockchip: enable the gmac for rk3399 evb board

 .../devicetree/bindings/net/rockchip-dwmac.txt     |   8 +-
 arch/arm64/boot/dts/rockchip/rk3399-evb.dts        |  31 +++
 arch/arm64/boot/dts/rockchip/rk3399.dtsi           |  90 ++++++++
 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c     | 254 ++++++++++++++++++++-
 4 files changed, 372 insertions(+), 11 deletions(-)

-- 
1.9.1

[toc] | [next] | [standalone]


#1474727 — [PATCH v4 6/6] arm64: dts: rockchip: enable the gmac for rk3399 evb board

FromCaesar Wang <wxt@rock-chips.com>
Date2016-09-02 00:00 +0200
Subject[PATCH v4 6/6] arm64: dts: rockchip: enable the gmac for rk3399 evb board
Message-ID<scIbD-7ol-23@gated-at.bofh.it>
In reply to#1474703
From: Roger Chen <roger.chen@rock-chips.com>

We add the required and optional properties for evb board.
See the [0] to get the detail information.

[0]:
Documentation/devicetree/bindings/net/rockchip-dwmac.txt

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2: None

 arch/arm64/boot/dts/rockchip/rk3399-evb.dts | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-evb.dts b/arch/arm64/boot/dts/rockchip/rk3399-evb.dts
index d47b4e9..ed6f2e8 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-evb.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-evb.dts
@@ -94,12 +94,43 @@
 		regulator-always-on;
 		regulator-boot-on;
 	};
+
+	clkin_gmac: external-gmac-clock {
+		compatible = "fixed-clock";
+		clock-frequency = <125000000>;
+		clock-output-names = "clkin_gmac";
+		#clock-cells = <0>;
+	};
+
+	vcc_phy: vcc-phy-regulator {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc_phy";
+		regulator-always-on;
+		regulator-boot-on;
+	};
+
 };
 
 &emmc_phy {
 	status = "okay";
 };
 
+&gmac {
+	phy-supply = <&vcc_phy>;
+	phy-mode = "rgmii";
+	clock_in_out = "input";
+	snps,reset-gpio = <&gpio3 15 GPIO_ACTIVE_LOW>;
+	snps,reset-active-low;
+	snps,reset-delays-us = <0 10000 50000>;
+	assigned-clocks = <&cru SCLK_RMII_SRC>;
+	assigned-clock-parents = <&clkin_gmac>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&rgmii_pins>;
+	tx_delay = <0x28>;
+	rx_delay = <0x11>;
+	status = "okay";
+};
+
 &pwm0 {
 	status = "okay";
 };
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1478537 — Re: [PATCH v4 6/6] arm64: dts: rockchip: enable the gmac for rk3399 evb board

FromHeiko Stuebner <heiko@sntech.de>
Date2016-09-07 20:20 +0200
SubjectRe: [PATCH v4 6/6] arm64: dts: rockchip: enable the gmac for rk3399 evb board
Message-ID<sePC1-3ed-5@gated-at.bofh.it>
In reply to#1474727
Am Freitag, 2. September 2016, 01:50:04 CEST schrieb Caesar Wang:
> From: Roger Chen <roger.chen@rock-chips.com>
> 
> We add the required and optional properties for evb board.
> See the [0] to get the detail information.
> 
> [0]:
> Documentation/devicetree/bindings/net/rockchip-dwmac.txt
> 
> Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my dts64 branch,

after moving clkin_gmac and sorting the gmac properties according to their 
alphabetical position.


Heiko

[toc] | [prev] | [next] | [standalone]


#1474729 — [PATCH v4 2/6] net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off

FromCaesar Wang <wxt@rock-chips.com>
Date2016-09-02 00:00 +0200
Subject[PATCH v4 2/6] net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off
Message-ID<scIbE-7ol-37@gated-at.bofh.it>
In reply to#1474703
From: Roger Chen <roger.chen@rock-chips.com>

GMAC Power Domain(PD) will be disabled during suspend.
That will causes GRF registers reset.
So corresponding GRF registers for GMAC must be setup again.

Signed-off-by: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2:
- rk_gmac_powerup instead of the rk_gmac_init.

 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index 4e6a270..e2ba6c4 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -853,6 +853,16 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
 							"rockchip,grf");
 	bsp_priv->pdev = pdev;
 
+	gmac_clk_init(bsp_priv);
+
+	return bsp_priv;
+}
+
+static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
+{
+	int ret;
+	struct device *dev = &bsp_priv->pdev->dev;
+
 	/*rmii or rgmii*/
 	if (bsp_priv->phy_iface == PHY_INTERFACE_MODE_RGMII) {
 		dev_info(dev, "init for RGMII\n");
@@ -865,15 +875,6 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
 		dev_err(dev, "NO interface defined!\n");
 	}
 
-	gmac_clk_init(bsp_priv);
-
-	return bsp_priv;
-}
-
-static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
-{
-	int ret;
-
 	ret = phy_power_on(bsp_priv, true);
 	if (ret)
 		return ret;
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1474730 — Re: [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399

FromDoug Anderson <dianders@chromium.org>
Date2016-09-02 00:00 +0200
SubjectRe: [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399
Message-ID<scIbD-7ol-29@gated-at.bofh.it>
In reply to#1474703
Hi,

On Thu, Sep 1, 2016 at 10:50 AM, Caesar Wang <wxt@rock-chips.com> wrote:
> This patch supports the gmac pd to save power consumption.
> Even though some boards not need Ethernet support, the driver
> core can also take care of powering up the pd before probe.
>
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
> ---
>
> Changes in v4:
> - remove the Roger signed-off for domain patch.
>
> Changes in v3:
> - leave into two patches based on patchv2, and fix nits and commit, as
>   comment on https://patchwork.kernel.org/patch/9306339/
>
> Changes in v2:
> - Fixes the order, ss Heiko commnets on
>   https://patchwork.kernel.org/patch/9305991/
>
>  arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Reviewed-by: Douglas Anderson <dianders@chromium.org>

[toc] | [prev] | [next] | [standalone]


#1474735 — [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399

FromCaesar Wang <wxt@rock-chips.com>
Date2016-09-02 00:10 +0200
Subject[PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399
Message-ID<scIbD-7ol-31@gated-at.bofh.it>
In reply to#1474703
This patch supports the gmac pd to save power consumption.
Even though some boards not need Ethernet support, the driver
core can also take care of powering up the pd before probe.

Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

Changes in v4:
- remove the Roger signed-off for domain patch.

Changes in v3:
- leave into two patches based on patchv2, and fix nits and commit, as
  comment on https://patchwork.kernel.org/patch/9306339/

Changes in v2:
- Fixes the order, ss Heiko commnets on
  https://patchwork.kernel.org/patch/9305991/

 arch/arm64/boot/dts/rockchip/rk3399.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 32aebc8..2ab233f 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -611,6 +611,11 @@
 		status = "disabled";
 	};
 
+	qos_gmac: qos@ffa5c000 {
+		compatible = "syscon";
+		reg = <0x0 0xffa5c000 0x0 0x20>;
+	};
+
 	qos_hdcp: qos@ffa90000 {
 		compatible = "syscon";
 		reg = <0x0 0xffa90000 0x0 0x20>;
@@ -739,6 +744,11 @@
 			};
 
 			/* These power domains are grouped by VD_LOGIC */
+			pd_gmac@RK3399_PD_GMAC {
+				reg = <RK3399_PD_GMAC>;
+				clocks = <&cru ACLK_GMAC>;
+				pm_qos = <&qos_gmac>;
+			};
 			pd_vio@RK3399_PD_VIO {
 				reg = <RK3399_PD_VIO>;
 				#address-cells = <1>;
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1475038 — Re: [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399

FromHeiko Stübner <heiko@sntech.de>
Date2016-09-02 13:10 +0200
SubjectRe: [PATCH v4 4/6] arm64: dts: rockchip: add the gmac power domain on rk3399
Message-ID<scUw9-7bm-7@gated-at.bofh.it>
In reply to#1474735
Am Freitag, 2. September 2016, 01:50:02 schrieb Caesar Wang:
> This patch supports the gmac pd to save power consumption.
> Even though some boards not need Ethernet support, the driver
> core can also take care of powering up the pd before probe.
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

applied to my dts64 branch for 4.9 with Doug's Review-tag.

I'd like to also pick up the other two dts patches after Dave is satisfied with 
the driver-side changes in patches 1-3.


Heiko

[toc] | [prev] | [next] | [standalone]


#1474740 — [PATCH v4 3/6] net: stmmac: dwmac-rk: add pd_gmac support for rk3399

FromCaesar Wang <wxt@rock-chips.com>
Date2016-09-02 00:10 +0200
Subject[PATCH v4 3/6] net: stmmac: dwmac-rk: add pd_gmac support for rk3399
Message-ID<scIlk-7GM-25@gated-at.bofh.it>
In reply to#1474703
From: David Wu <david.wu@rock-chips.com>

Add the gmac power domain support for rk3399, in order to save more
power consumption.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

Changes in v4: None
Changes in v3: None
Changes in v2:
- fixes the build error on next kernel.

 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
index e2ba6c4..3740a44 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
@@ -30,6 +30,7 @@
 #include <linux/delay.h>
 #include <linux/mfd/syscon.h>
 #include <linux/regmap.h>
+#include <linux/pm_runtime.h>
 
 #include "stmmac_platform.h"
 
@@ -883,11 +884,19 @@ static int rk_gmac_powerup(struct rk_priv_data *bsp_priv)
 	if (ret)
 		return ret;
 
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	return 0;
 }
 
 static void rk_gmac_powerdown(struct rk_priv_data *gmac)
 {
+	struct device *dev = &gmac->pdev->dev;
+
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
+
 	phy_power_on(gmac, false);
 	gmac_clk_enable(gmac, false);
 }
-- 
1.9.1

[toc] | [prev] | [next] | [standalone]


#1475506

FromDavid Miller <davem@davemloft.net>
Date2016-09-03 02:10 +0200
Message-ID<sd6GZ-6lE-9@gated-at.bofh.it>
In reply to#1474703
From: Caesar Wang <wxt@rock-chips.com>
Date: Fri,  2 Sep 2016 01:49:58 +0800

> This patch have the following changes:
> 
> 7edf13e net: stmmac: dwmac-rk: add rk3366 & rk3399 specific data
> 26e004e net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off
> b216c2f net: stmmac: dwmac-rk: add pd_gmac support for rk3399
> 848bb71 arm64: dts: rockchip: add the gmac power domain on rk3399
> 508e41f arm64: dts: rockchip: add the gmac needed node for rk3399
> fb26795 arm64: dts: rockchip: enable the gmac for rk3399 evb board
> 
> Hi David,
> The patch 1,2,3 is related to the rockchip net/stammc driver,
> 
> Hi Heiko,
> The patch 4,5,6 is related to the dts changes.

Patches 1, 2, and 3 applied to net-next, thanks.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web