Support the rk3399 gmac pd function
Subsystems (6)
cover Support the rk3399 gmac pd function
This patch add to handle the gmac pd issue, and support the rk3399 gmac for devicetree.
Caesar Wang (2):
arm64: dts: rockchip: support gmac 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 | 27 +++++--- 3 files changed, 139 insertions(+), 9 deletions(-)
Signature · 1 line
1.9.1
PATCH 1/4 net: stmmac: dwmac-rk: fixes the gmac resume after PD on/off
From: Roger Chen <[email protected]>
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.
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +11 -9
@@ -629,6 +629,17 @@ 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_init (struct platform_device *pdev,void *priv) +{ +struct rk_priv_data *bsp_priv = priv; +int ret; +struct device *dev = &pdev->dev; +/*rmii or rgmii*/ if (bsp_priv->phy_iface ==PHY_INTERFACE_MODE_RGMII ) {dev_info (dev,"init for RGMII\n" );
@@ -641,15 +652,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;
Signature · 1 line
1.9.1
PATCH 2/4 net: stmmac: dwmac-rk: add pd_gmac support for rk3399
In reply to Caesar WangFrom: David Wu <[email protected]>
Add the gmac power domain support for rk3399, in order to save more power consumption.
---
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +7 -0
@@ -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"
@@ -660,11 +661,17 @@ static int rk_gmac_init(struct platform_device *pdev, void *priv)if (ret)return ret; +pm_runtime_enable (&pdev->dev); +pm_runtime_get_sync (&pdev->dev); +return 0 ; }static void rk_gmac_powerdown (struct rk_priv_data *gmac) { +pm_runtime_put_sync (&pdev->dev); +pm_runtime_disable (&pdev->dev); +phy_power_on (gmac, false);gmac_clk_enable (gmac, false); }
Signature · 1 line
1.9.1
kbuild test robot
build botRe: [PATCH 2/4] net: stmmac: dwmac-rk: add pd_gmac support for rk3399
reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree…
Hi David,
[auto build test ERROR on rockchip/for-next]
[also build test ERROR on v4.8-rc4 next-20160825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Caesar-Wang/Support-the-rk3399-gmac-pd-function/20160831-043741 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next config: xtensa-allmodconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa
All errors (new ones prefixed by >>):
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c: In function 'rk_gmac_powerdown':
>> drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:672:23: error: 'pdev' undeclared (first use in this function)
pm_runtime_put_sync(&pdev->dev);
^
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:672:23: note: each undeclared identifier is reported only once for each function it appears in
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c: At top level:
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:679:12: error: redefinition of 'rk_gmac_init'
static int rk_gmac_init(struct platform_device *pdev, void *priv)
^
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:638:12: note: previous definition of 'rk_gmac_init' was here
static int rk_gmac_init(struct platform_device *pdev, void *priv)
^
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c: In function 'rk_gmac_init':
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:683:2: error: implicit declaration of function 'rk_gmac_powerup' [-Werror=implicit-function-declaration]
return rk_gmac_powerup(bsp_priv);
^ drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c: At top level:
drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c:638:12: warning: 'rk_gmac_init' defined but not used [-Wunused-function]
static int rk_gmac_init(struct platform_device *pdev, void *priv)
^
cc1: some warnings being treated as errors
vim +/pdev +672 drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
666
667 return 0;
668 }
669
670 static void rk_gmac_powerdown(struct rk_priv_data *gmac)
671 {
> 672 pm_runtime_put_sync(&pdev->dev);
673 pm_runtime_disable(&pdev->dev);
674
675 phy_power_on(gmac, false);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH 3/4 arm64: dts: rockchip: support gmac for rk3399
In reply to Caesar WangThis patch adds needed gamc information for rk3399, also support the gmac pd.
---
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 90 ++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399.dtsi +90 -0
@@ -200,6 +200,26 @@ }; }; + gmac: eth at fe300000 { + compatible = "rockchip,rk3399-gmac"; + reg = <0x0 0xfe300000 0x0 0x10000>; + rockchip,grf = <&grf>; + 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"; + resets = <&cru SRST_A_GMAC>; + reset-names = "stmmaceth"; + power-domains = <&power RK3399_PD_GMAC>; + status = "disabled"; + }; + sdio0: dwmmc at fe310000 { compatible = "rockchip,rk3399-dw-mshc", "rockchip,rk3288-dw-mshc";
@@ -611,6 +631,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>;
@@ -704,6 +729,11 @@ #size-cells = <0>; /* These power domains are grouped by VD_CENTER */ + pd_gmac at RK3399_PD_GMAC { + reg = <RK3399_PD_GMAC>; + clocks = <&cru ACLK_GMAC>; + pm_qos = <&qos_gmac>; + }; pd_iep at RK3399_PD_IEP { reg = <RK3399_PD_IEP>; clocks = <&cru ACLK_IEP>,
@@ -1183,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 =
Signature · 1 line
1.9.1
Heiko Stübner
maintainerRe: [PATCH 3/4] arm64: dts: rockchip: support gmac for rk3399
Am Mittwoch, 31. August 2016, 04:30:06 schrieb Caesar Wang:
Quoted 15 lines
This patch adds needed gamc information for rk3399, also support the gmac pd.
Signed-off-by Roger Chen <[email protected]>Signed-off-by Caesar Wang <[email protected]>---
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 90++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)
(quoted diff) +0
-0
b/arch/arm64/boot/dts/rockchip/rk3399.dtsiindex 32aebc8..53ac651 100644
arch/arm64/boot/dts/rockchip/rk3399.dtsi line 206
Quoted 7 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +4
-0@@ -200,6 +200,26 @@ }; }; + gmac: eth at fe300000 { + compatible = "rockchip,rk3399-gmac"; + reg = <0x0 0xfe300000 0x0 0x10000>; + rockchip,grf = <&grf>;
should move below the reset-names .
arch/arm64/boot/dts/rockchip/rk3399.dtsi line 219
Quoted 13 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +13
-0+ 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"; + resets = <&cru SRST_A_GMAC>; + reset-names = "stmmaceth"; + power-domains = <&power RK3399_PD_GMAC>;
The driver core should handle regular power-domain handling on device creation already, right? So I should be able to apply patches 3 and 4 even without the dwmac patches, right?
Also if resending please move power-domains above resets
Heiko
Re: [PATCH 3/4] arm64: dts: rockchip: support gmac for rk3399
Hi Heiko,
Thanks the response quickly.
Quoted 19 lines · Heiko St�bner
Am Mittwoch, 31. August 2016, 04:30:06 schrieb Caesar Wang:
Quoted 18 lines
This patch adds needed gamc information for rk3399, also support the gmac pd.
Signed-off-by Roger Chen <[email protected]>Signed-off-by Caesar Wang <[email protected]>---
arch/arm64/boot/dts/rockchip/rk3399.dtsi | 90++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+)
(quoted diff) +0
-0
b/arch/arm64/boot/dts/rockchip/rk3399.dtsiindex 32aebc8..53ac651 100644arch/arm64/boot/dts/rockchip/rk3399.dtsi +0
-0@@ -200,6 +200,26 @@ }; };
Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi line 206
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +4
-0+ gmac: eth@fe300000 { + compatible = "rockchip,rk3399-gmac"; + reg = <0x0 0xfe300000 0x0 0x10000>; + rockchip,grf = <&grf>;should move below the reset-names .
Done.
Quoted 17 lines
Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +3
-0+ interrupts = <GIC_SPI 12 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "macirq"; + clocks = <&cru SCLK_MAC>, <&cru SCLK_MAC_RX>,arch/arm64/boot/dts/rockchip/rk3399.dtsi line 219
Quoted 10 lines
arch/arm64/boot/dts/rockchip/rk3399.dtsi +10
-0+ <&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"; + resets = <&cru SRST_A_GMAC>; + reset-names = "stmmaceth"; + power-domains = <&power RK3399_PD_GMAC>;The driver core should handle regular power-domain handling on device creation already, right? So I should be able to apply patches 3 and 4 even without the dwmac patches, right?
Yup, the patches 3 and 4 needn't depand on the dwmac driver.
Quoted 2 lines
Also if resending please move power-domains above resets
Done.
-
Caesar
Quoted 8 lines
Heiko
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
PATCH 4/4 arm64: dts: rockchip: enable the gmac for rk3399 evb board
In reply to Caesar WangWe 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
---
arch/arm64/boot/dts/rockchip/rk3399-evb.dts | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
arch/arm64/boot/dts/rockchip/rk3399-evb.dts +31 -0
@@ -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"; };
Signature · 1 line
1.9.1