diff options
author | Zhao Chenhui <chenhui.zhao@freescale.com> | 2014-05-12 11:58:16 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-05-14 14:00:01 (GMT) |
commit | 8955b8d89328ec7bf2345c07f12baf2e985ec8cf (patch) | |
tree | 55010562091653bdd92083ce06e6386c1bf095ed /arch/powerpc | |
parent | 777f69697b8960939977ac916fbfcce622af5c8e (diff) | |
download | linux-fsl-qoriq-8955b8d89328ec7bf2345c07f12baf2e985ec8cf.tar.xz |
powerpc/pm: add API for setting powerdown exception
Add fsl_set_power_except() for setting powerdown exception when sleep.
The drivers can call this function to set the corresponding bits if
the devices will power down when sleep.
This patch also fixed an issue which is that FMan ports can not work after
wake-up from deep sleep using Wake-on-LAN. Set FMan bit and MAC bits of the
register IPPDEXPCR seperately, instead of setting them together.
Change-Id: I8f632efb8ca54a5d32deb7ee1d42b333fa66d5cd
Signed-off-by: Zhao Chenhui <chenhui.zhao@freescale.com>
Reviewed-on: http://git.am.freescale.net:8181/12219
Reviewed-by: Yang Li <LeoLi@freescale.com>
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/boot/dts/t1040rdb.dts | 12 | ||||
-rw-r--r-- | arch/powerpc/boot/dts/t1042rdb_pi.dts | 9 | ||||
-rw-r--r-- | arch/powerpc/boot/dts/t104xqds.dtsi | 12 | ||||
-rw-r--r-- | arch/powerpc/include/asm/fsl_pm.h | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/qoriq_pm.c | 56 |
5 files changed, 70 insertions, 20 deletions
diff --git a/arch/powerpc/boot/dts/t1040rdb.dts b/arch/powerpc/boot/dts/t1040rdb.dts index 06182be..4b0c092 100644 --- a/arch/powerpc/boot/dts/t1040rdb.dts +++ b/arch/powerpc/boot/dts/t1040rdb.dts @@ -146,29 +146,36 @@ }; fman0: fman@400000 { + sleep = <&rcpm 0x00000008>; + enet0: ethernet@e0000 { fixed-link = <0 1 1000 0 0>; phy-connection-type = "sgmii"; + sleep = <&rcpm 0x80000000>; }; enet1: ethernet@e2000 { fixed-link = <1 1 1000 0 0>; phy-connection-type = "sgmii"; + sleep = <&rcpm 0x40000000>; }; enet2: ethernet@e4000 { phy-handle = <&phy_sgmii_2>; phy-connection-type = "sgmii"; + sleep = <&rcpm 0x20000000>; }; enet3: ethernet@e6000 { phy-handle = <&phy_rgmii_0>; phy-connection-type = "rgmii"; + sleep = <&rcpm 0x10000000>; }; enet4: ethernet@e8000 { phy-handle = <&phy_rgmii_1>; phy-connection-type = "rgmii"; + sleep = <&rcpm 0x08000000>; }; mdio0: mdio@fc000 { @@ -317,27 +324,22 @@ ethernet@0 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet0>; - sleep = <&rcpm 0x80000008>; }; ethernet@1 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet1>; - sleep = <&rcpm 0x40000008>; }; ethernet@2 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet2>; - sleep = <&rcpm 0x20000008>; }; ethernet@3 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet3>; - sleep = <&rcpm 0x10000008>; }; ethernet@4 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet4>; - sleep = <&rcpm 0x08000008>; }; /* enable one offline port */ dpa-fman0-oh@2 { diff --git a/arch/powerpc/boot/dts/t1042rdb_pi.dts b/arch/powerpc/boot/dts/t1042rdb_pi.dts index f89fee9..3b5cf98 100644 --- a/arch/powerpc/boot/dts/t1042rdb_pi.dts +++ b/arch/powerpc/boot/dts/t1042rdb_pi.dts @@ -153,26 +153,33 @@ }; fman0: fman@400000 { + sleep = <&rcpm 0x00000008>; + enet0: ethernet@e0000 { status = "disabled"; + sleep = <&rcpm 0x80000000>; }; enet1: ethernet@e2000 { status = "disabled"; + sleep = <&rcpm 0x40000000>; }; enet2: ethernet@e4000 { status = "disabled"; + sleep = <&rcpm 0x20000000>; }; enet3: ethernet@e6000 { phy-handle = <&phy_rgmii_0>; phy-connection-type = "rgmii"; + sleep = <&rcpm 0x10000000>; }; enet4: ethernet@e8000 { phy-handle = <&phy_rgmii_1>; phy-connection-type = "rgmii"; + sleep = <&rcpm 0x08000000>; }; mdio0: mdio@fc000 { @@ -267,12 +274,10 @@ ethernet@3 { compatible = "fsl,t1042-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet3>; - sleep = <&rcpm 0x10000008>; }; ethernet@4 { compatible = "fsl,t1042-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet4>; - sleep = <&rcpm 0x08000008>; }; }; }; diff --git a/arch/powerpc/boot/dts/t104xqds.dtsi b/arch/powerpc/boot/dts/t104xqds.dtsi index b819ce0..69dff11 100644 --- a/arch/powerpc/boot/dts/t104xqds.dtsi +++ b/arch/powerpc/boot/dts/t104xqds.dtsi @@ -300,29 +300,36 @@ }; fman0: fman@400000 { + sleep = <&rcpm 0x00000008>; + enet0: ethernet@e0000 { fixed-link = <0 1 1000 0 0>; phy-connection-type = "sgmii"; + sleep = <&rcpm 0x80000000>; }; enet1: ethernet@e2000 { fixed-link = <1 1 1000 0 0>; phy-connection-type = "sgmii"; + sleep = <&rcpm 0x40000000>; }; enet2: ethernet@e4000 { phy-handle = <&phy_s7_03>; phy-connection-type = "sgmii"; + sleep = <&rcpm 0x20000000>; }; enet3: ethernet@e6000 { phy-handle = <&rgmii_phy1>; phy-connection-type = "rgmii"; + sleep = <&rcpm 0x10000000>; }; enet4: ethernet@e8000 { phy-handle = <&rgmii_phy2>; phy-connection-type = "rgmii"; + sleep = <&rcpm 0x08000000>; }; mdio0: mdio@fc000 { @@ -342,27 +349,22 @@ ethernet@0 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet0>; - sleep = <&rcpm 0x80000008>; }; ethernet@1 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet1>; - sleep = <&rcpm 0x40000008>; }; ethernet@2 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet2>; - sleep = <&rcpm 0x20000008>; }; ethernet@3 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet3>; - sleep = <&rcpm 0x10000008>; }; ethernet@4 { compatible = "fsl,t1040-dpa-ethernet", "fsl,dpa-ethernet"; fsl,fman-mac = <&enet4>; - sleep = <&rcpm 0x08000008>; }; /* Enable one offline port as default to support HW based LAG */ dpa-fman0-oh@2 { diff --git a/arch/powerpc/include/asm/fsl_pm.h b/arch/powerpc/include/asm/fsl_pm.h index 742cf22..8e6a656 100644 --- a/arch/powerpc/include/asm/fsl_pm.h +++ b/arch/powerpc/include/asm/fsl_pm.h @@ -61,6 +61,7 @@ unsigned long get_rcpm_version(void); void set_pm_suspend_state(suspend_state_t state); suspend_state_t pm_suspend_state(void); +void fsl_set_power_except(struct device *dev, int on); #endif /* __ASSEMBLY__ */ #define T1040QDS_TETRA_FLAG 1 diff --git a/arch/powerpc/platforms/85xx/qoriq_pm.c b/arch/powerpc/platforms/85xx/qoriq_pm.c index 9f656e9..155dc28 100644 --- a/arch/powerpc/platforms/85xx/qoriq_pm.c +++ b/arch/powerpc/platforms/85xx/qoriq_pm.c @@ -27,20 +27,54 @@ unsigned int sleep_pm_state; /* supported sleep modes by the present platform */ static unsigned int sleep_modes; -void qoriq_enable_wakeup_source(struct device *dev, void *data) +/** + * fsl_set_power_except - set which IP block is not powerdown when sleep, + * such as MAC, USB, etc. + * + * @dev: a pointer to the struct device + * @on: if 1, do not power down; if 0, power down. + */ +void fsl_set_power_except(struct device *dev, int on) { u32 value[2]; u32 pw_mask; + const phandle *phandle_prop; + struct device_node *mac_node; + int ret; + + ret = of_property_read_u32_array(dev->of_node, "sleep", value, 2); + if (ret) { + /* search fman mac node */ + phandle_prop = of_get_property(dev->of_node, "fsl,fman-mac", + NULL); + if (phandle_prop == NULL) + goto err; + + mac_node = of_find_node_by_phandle(*phandle_prop); + ret = of_property_read_u32_array(mac_node, "sleep", value, 2); + of_node_put(mac_node); + if (ret) + goto err; + } - if (!device_may_wakeup(dev)) - return; + /* get the second value, it is a mask */ + pw_mask = value[1]; + qoriq_pm_ops->set_ip_power(on, pw_mask); - if (of_property_read_u32_array(dev->of_node, "sleep", value, 2)) + return; + +err: + dev_err(dev, "Can not set wakeup sources\n"); + return; +} +EXPORT_SYMBOL_GPL(fsl_set_power_except); + +void qoriq_set_wakeup_source(struct device *dev, void *enable) +{ + if (!device_may_wakeup(dev)) return; - /* get the second value, it is a mask */ - pw_mask = value[1]; - qoriq_pm_ops->set_ip_power(1, pw_mask); + fsl_set_power_except(dev, *((int *)enable)); } static int qoriq_suspend_enter(suspend_state_t state) @@ -93,7 +127,9 @@ static int qoriq_suspend_valid(suspend_state_t state) static int qoriq_suspend_begin(suspend_state_t state) { - dpm_for_each_dev(NULL, qoriq_enable_wakeup_source); + const int enable = 1; + + dpm_for_each_dev((void *)&enable, qoriq_set_wakeup_source); if (state == PM_SUSPEND_MEM) return fsl_dp_iomap(); @@ -103,6 +139,10 @@ static int qoriq_suspend_begin(suspend_state_t state) static void qoriq_suspend_end(void) { + const int enable = 0; + + dpm_for_each_dev((void *)&enable, qoriq_set_wakeup_source); + set_pm_suspend_state(PM_SUSPEND_ON); fsl_dp_iounmap(); } |