linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Support the rk3399 gmac pd function
@ 2016-08-31 23:28 Caesar Wang
  2016-08-31 23:28 ` [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399 Caesar Wang
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Caesar Wang @ 2016-08-31 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

This patch add to handle the gmac pd, and support
the rk3399 gmac for devicetree.

The History version:

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


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 (3):
  arm64: dts: rockchip: add the gmac power domain on rk3399
  arm64: dts: rockchip: add the gmac needed node for rk3399
  arm64: dts: rockchip: enable the gmac for rk3399 evb board

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

Roger Chen (1):
  net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off

 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 | 28 +++++---
 3 files changed, 140 insertions(+), 9 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399
  2016-08-31 23:28 [PATCH v3 0/5] Support the rk3399 gmac pd function Caesar Wang
@ 2016-08-31 23:28 ` Caesar Wang
  2016-09-01 11:41   ` Heiko Stübner
  2016-08-31 23:28 ` [PATCH v3 4/5] arm64: dts: rockchip: add the gmac needed node for rk3399 Caesar Wang
  2016-08-31 23:28 ` [PATCH v3 5/5] arm64: dts: rockchip: enable the gmac for rk3399 evb board Caesar Wang
  2 siblings, 1 reply; 7+ messages in thread
From: Caesar Wang @ 2016-08-31 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

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: Roger Chen <roger.chen@rock-chips.com>
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
---

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 at ffa5c000 {
+		compatible = "syscon";
+		reg = <0x0 0xffa5c000 0x0 0x20>;
+	};
+
 	qos_hdcp: qos at ffa90000 {
 		compatible = "syscon";
 		reg = <0x0 0xffa90000 0x0 0x20>;
@@ -739,6 +744,11 @@
 			};
 
 			/* These power domains are grouped by VD_LOGIC */
+			pd_gmac at RK3399_PD_GMAC {
+				reg = <RK3399_PD_GMAC>;
+				clocks = <&cru ACLK_GMAC>;
+				pm_qos = <&qos_gmac>;
+			};
 			pd_vio at RK3399_PD_VIO {
 				reg = <RK3399_PD_VIO>;
 				#address-cells = <1>;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 4/5] arm64: dts: rockchip: add the gmac needed node for rk3399
  2016-08-31 23:28 [PATCH v3 0/5] Support the rk3399 gmac pd function Caesar Wang
  2016-08-31 23:28 ` [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399 Caesar Wang
@ 2016-08-31 23:28 ` Caesar Wang
  2016-09-01 11:43   ` Heiko Stübner
  2016-08-31 23:28 ` [PATCH v3 5/5] arm64: dts: rockchip: enable the gmac for rk3399 evb board Caesar Wang
  2 siblings, 1 reply; 7+ messages in thread
From: Caesar Wang @ 2016-08-31 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

The RK3399 GMAC Ethernet Controller provides a complete Ethernet interface
from processor to a Reduced Media Independent Interface (RMII) and Reduced
Gigabit Media Independent Interface (RGMII) compliant Ethernet PHY.

This patch adds the related needed device information.
e.g.: interrupts, grf, clocks, pinctrl and so on.

The full details are in [0].

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

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

Changes in v3:
- generate a patch from https://patchwork.kernel.org/patch/9306339/.

Changes in v2: None

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

diff --git a/arch/arm64/boot/dts/rockchip/rk3399.dtsi b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
index 2ab233f..092bb45 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399.dtsi
@@ -200,6 +200,26 @@
 		};
 	};
 
+	gmac: ethernet at fe300000 {
+		compatible = "rockchip,rk3399-gmac";
+		reg = <0x0 0xfe300000 0x0 0x10000>;
+		interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>;
+		interrupt-names = "macirq";
+		clocks = <&cru SCLK_MAC>, <&cru SCLK_MAC_RX>,
+			 <&cru SCLK_MAC_TX>, <&cru SCLK_MACREF>,
+			 <&cru SCLK_MACREF_OUT>, <&cru ACLK_GMAC>,
+			 <&cru PCLK_GMAC>;
+		clock-names = "stmmaceth", "mac_clk_rx",
+			      "mac_clk_tx", "clk_mac_ref",
+			      "clk_mac_refout", "aclk_mac",
+			      "pclk_mac";
+		power-domains = <&power RK3399_PD_GMAC>;
+		resets = <&cru SRST_A_GMAC>;
+		reset-names = "stmmaceth";
+		rockchip,grf = <&grf>;
+		status = "disabled";
+	};
+
 	sdio0: dwmmc at fe310000 {
 		compatible = "rockchip,rk3399-dw-mshc",
 			     "rockchip,rk3288-dw-mshc";
@@ -1193,6 +1213,66 @@
 			drive-strength = <13>;
 		};
 
+		gmac {
+			rgmii_pins: rgmii-pins {
+				rockchip,pins =
+					/* mac_txclk */
+					<3 17 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_rxclk */
+					<3 14 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_mdio */
+					<3 13 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_txen */
+					<3 12 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_clk */
+					<3 11 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxdv */
+					<3 9 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_mdc */
+					<3 8 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxd1 */
+					<3 7 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxd0 */
+					<3 6 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_txd1 */
+					<3 5 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_txd0 */
+					<3 4 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_rxd3 */
+					<3 3 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxd2 */
+					<3 2 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_txd3 */
+					<3 1 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_txd2 */
+					<3 0 RK_FUNC_1 &pcfg_pull_none_13ma>;
+			};
+
+			rmii_pins: rmii-pins {
+				rockchip,pins =
+					/* mac_mdio */
+					<3 13 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_txen */
+					<3 12 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_clk */
+					<3 11 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxer */
+					<3 10 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxdv */
+					<3 9 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_mdc */
+					<3 8 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxd1 */
+					<3 7 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_rxd0 */
+					<3 6 RK_FUNC_1 &pcfg_pull_none>,
+					/* mac_txd1 */
+					<3 5 RK_FUNC_1 &pcfg_pull_none_13ma>,
+					/* mac_txd0 */
+					<3 4 RK_FUNC_1 &pcfg_pull_none_13ma>;
+			};
+		};
+
 		i2c0 {
 			i2c0_xfer: i2c0-xfer {
 				rockchip,pins =
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 5/5] arm64: dts: rockchip: enable the gmac for rk3399 evb board
  2016-08-31 23:28 [PATCH v3 0/5] Support the rk3399 gmac pd function Caesar Wang
  2016-08-31 23:28 ` [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399 Caesar Wang
  2016-08-31 23:28 ` [PATCH v3 4/5] arm64: dts: rockchip: add the gmac needed node for rk3399 Caesar Wang
@ 2016-08-31 23:28 ` Caesar Wang
  2 siblings, 0 replies; 7+ messages in thread
From: Caesar Wang @ 2016-08-31 23:28 UTC (permalink / raw)
  To: linux-arm-kernel

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 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

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399
  2016-08-31 23:28 ` [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399 Caesar Wang
@ 2016-09-01 11:41   ` Heiko Stübner
  2016-09-01 17:53     ` Caesar Wang
  0 siblings, 1 reply; 7+ messages in thread
From: Heiko Stübner @ 2016-09-01 11:41 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Caesar,

Am Donnerstag, 1. September 2016, 07:28:50 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: Roger Chen <roger.chen@rock-chips.com>
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

who is the author of this patch? Roger or you? Because we should either drop 
Roger's Signed-off or fix the authorship to list him.


Heiko

> ---
> 
> 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 at ffa5c000 {
> +		compatible = "syscon";
> +		reg = <0x0 0xffa5c000 0x0 0x20>;
> +	};
> +
>  	qos_hdcp: qos at ffa90000 {
>  		compatible = "syscon";
>  		reg = <0x0 0xffa90000 0x0 0x20>;
> @@ -739,6 +744,11 @@
>  			};
> 
>  			/* These power domains are grouped by VD_LOGIC */
> +			pd_gmac at RK3399_PD_GMAC {
> +				reg = <RK3399_PD_GMAC>;
> +				clocks = <&cru ACLK_GMAC>;
> +				pm_qos = <&qos_gmac>;
> +			};
>  			pd_vio at RK3399_PD_VIO {
>  				reg = <RK3399_PD_VIO>;
>  				#address-cells = <1>;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 4/5] arm64: dts: rockchip: add the gmac needed node for rk3399
  2016-08-31 23:28 ` [PATCH v3 4/5] arm64: dts: rockchip: add the gmac needed node for rk3399 Caesar Wang
@ 2016-09-01 11:43   ` Heiko Stübner
  0 siblings, 0 replies; 7+ messages in thread
From: Heiko Stübner @ 2016-09-01 11:43 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Caesar,

Am Donnerstag, 1. September 2016, 07:28:51 schrieb Caesar Wang:
> The RK3399 GMAC Ethernet Controller provides a complete Ethernet interface
> from processor to a Reduced Media Independent Interface (RMII) and Reduced
> Gigabit Media Independent Interface (RGMII) compliant Ethernet PHY.
> 
> This patch adds the related needed device information.
> e.g.: interrupts, grf, clocks, pinctrl and so on.
> 
> The full details are in [0].
> 
> [0]:
> Documentation/devicetree/bindings/net/rockchip-dwmac.txt
> 
> Signed-off-by: Caesar Wang <wxt@rock-chips.com>

the core rk3399 gmac support is still stuck and needs a respin. This patch is 
part of that other series as well which needs a respin itself.

Maybe you could just fold both series into one so that we don't have to track 
two.


Thanks
Heiko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399
  2016-09-01 11:41   ` Heiko Stübner
@ 2016-09-01 17:53     ` Caesar Wang
  0 siblings, 0 replies; 7+ messages in thread
From: Caesar Wang @ 2016-09-01 17:53 UTC (permalink / raw)
  To: linux-arm-kernel


On 2016?09?01? 19:41, Heiko St?bner wrote:
> Hi Caesar,
>
> Am Donnerstag, 1. September 2016, 07:28:50 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: Roger Chen <roger.chen@rock-chips.com>
>> Signed-off-by: Caesar Wang <wxt@rock-chips.com>
> who is the author of this patch? Roger or you? Because we should either drop
> Roger's Signed-off or fix the authorship to list him.

Thanks for reminding me.
Can you take a look at the newer v4 series patches? :)
https://patchwork.kernel.org/patch/9308013/


>
>
> Heiko
>
>> ---
>>
>> 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 at ffa5c000 {
>> +		compatible = "syscon";
>> +		reg = <0x0 0xffa5c000 0x0 0x20>;
>> +	};
>> +
>>   	qos_hdcp: qos at ffa90000 {
>>   		compatible = "syscon";
>>   		reg = <0x0 0xffa90000 0x0 0x20>;
>> @@ -739,6 +744,11 @@
>>   			};
>>
>>   			/* These power domains are grouped by VD_LOGIC */
>> +			pd_gmac at RK3399_PD_GMAC {
>> +				reg = <RK3399_PD_GMAC>;
>> +				clocks = <&cru ACLK_GMAC>;
>> +				pm_qos = <&qos_gmac>;
>> +			};
>>   			pd_vio at RK3399_PD_VIO {
>>   				reg = <RK3399_PD_VIO>;
>>   				#address-cells = <1>;
>
> _______________________________________________
> Linux-rockchip mailing list
> Linux-rockchip at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rockchip


-- 
caesar wang | software engineer | wxt at rock-chip.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-01 17:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-31 23:28 [PATCH v3 0/5] Support the rk3399 gmac pd function Caesar Wang
2016-08-31 23:28 ` [PATCH v3 3/5] arm64: dts: rockchip: add the gmac power domain on rk3399 Caesar Wang
2016-09-01 11:41   ` Heiko Stübner
2016-09-01 17:53     ` Caesar Wang
2016-08-31 23:28 ` [PATCH v3 4/5] arm64: dts: rockchip: add the gmac needed node for rk3399 Caesar Wang
2016-09-01 11:43   ` Heiko Stübner
2016-08-31 23:28 ` [PATCH v3 5/5] arm64: dts: rockchip: enable the gmac for rk3399 evb board Caesar Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).