echo standby > /sys/power/state does not switch off power to Ethernet (CPSW).
Is there a way to suspend and resume Ethernet(CPSW) from a script? How?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
echo standby > /sys/power/state does not switch off power to Ethernet (CPSW).
Is there a way to suspend and resume Ethernet(CPSW) from a script? How?
Hi,
Standby and Suspend are two different low-power modes. Check this wiki pages:
http://processors.wiki.ti.com/index.php/AM335x_Power_Management_User_Guide
http://processors.wiki.ti.com/index.php/AM335x_Linux_Power_Management_User_Guide
http://processors.wiki.ti.com/index.php/AM335x_Power_Management_Standby_User%27s_Guide
I have read the docs in the links you provided......I am specifically looking for suspend/resume of ethernet implemented in CPSW driver.
The following code is present in kernel/drivers/net/ethernet/ti/cpsw.c
static int cpsw_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev = platform_get_drvdata(pdev);
cpsw_stop_slaves_interface(ndev);
pm_runtime_put_sync(&pdev->dev);
return 0;
}
static int cpsw_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct net_device *ndev = platform_get_drvdata(pdev);
pm_runtime_get_sync(&pdev->dev);
cpsw_start_slaves_interface(ndev);
return 0;
}
static const struct dev_pm_ops cpsw_pm_ops = {
.suspend = cpsw_suspend,
.resume = cpsw_resume,
};
static struct platform_driver cpsw_driver = {
.driver = {
.name = "cpsw",
.owner = THIS_MODULE,
.pm = &cpsw_pm_ops,
},
.probe = cpsw_probe,
.remove = __devexit_p(cpsw_remove),
};
I am looking for a way to call the suspend/resume functions by setting a value in /sys probably. Please let me know how I can achieve this.
I am putting the TI AM335x processor in low power(standby) mode by "echo standby > /sys/power/state". But with this the ethernet is still active. I want to put ethernet to low power mode as well, when the TI processor goes in standby mode. How to do that?
Also the low power modes in order of power saving is as follows --
Active,Standby,DeepSleep1,DeepSleep0,RTC-only.
Ignition pin is gpio0_7 in our board.
To put the processor in standby mode --"echo standby > /sys/power/state". I noticed that ignition pin detection is happening when processor is in this mode.
To put the processor in deepsleep mode --"echo mem > /sys/power/state".(is it DS0 or DS1?). Also I noticed that ignition pin detection is not happening when processor is in this mode. How to resolve that?
What command is there to put the processor in DS0,DS1 and RTC-only modes? Is ignition pin detection possible in these modes?
Regarding the Ethernet start/stop, this is the feedback from the factory team:
"While it might appear simplistic using ifdown/ifup commands is a good way to suspend network activity. The ifdown/ifup will take the interface all the way down or up, not only the driver is affected but also the network layer in the kernel. For example an ifup call on an interface will initialize the driver and the network stack and start a DHCP process to get an ip address."
Regarding power modes, see section 8.1.4.3 of the AM335X TRM Rev. K. Wakeup from GPIO0 is possible in all low-power modes, except RTC-only. For RTC-only mode the ext_wakeup0 is the only possible external wakeup source.
"ifdown eth0" is bringing down the ethernet interface probably(as after this command I don't see eth0 using ifconfig command). However there is no decrease in the current drawn and the LEDs on the ethernet port continues to glow, suggesting ethrnet power is not turned off with ifdown( I guess the behaviour should be similar to when the ethernet cable is pulled off). Please suggest how to achieve power consumption reduction using ifdown eth0.
also I have read the TRM and it does not specify how to go to DS0,DS1 or RTC-only modes. Please suggest what command to issue on the os console in order to go to these modes.....like for standby we use "echo standby > /sys/power/state".
There are no ready to use software tools that can power down your external PHY. Depending on the PHY you should see what power-down modes it supports and how these can be invoked (most likely via the MDIO interface).
For low-power modes supported in Linux see these wiki pages:
http://processors.wiki.ti.com/index.php/AM335x_Power_Management_User_Guide
http://processors.wiki.ti.com/index.php/AM335x_Linux_Power_Management_User_Guide
http://processors.wiki.ti.com/index.php/AM335x_Power_Management_Standby_User%27s_Guide
I am trying to be more specific --
We are using TI AM335x processor and Atheros 8035 PHY. The requirement is to shutdown power to the ethernet PHY when ifconfig eth0/eth1 down happens. The TI processor uses TI CPSW Ethernet driver(cpsw.c). The functions cpsw_resume() and cpsw_suspend() defined in the mentioned file(and registered to platform device), should have been called by the linux kernel ethernet subsystem. But I'm sure these functions are not getting called(verified by putting printk in those functions and checking console messages).
Similar behaviour is observed for Atheros 8035 ethernet driver --the .susped and .resume functions are not getting called.
Doubts which I have are --
1> why is the linux kernel ethernet subsystem not calling the .suspend and .resume functions registered by cpsw to paltform_device ? How to make these functions get called from the linux kernel ethernet susbsystem?Please mention specific files and functions.
2> why is the linux kernel ethernet subsystem not calling the .suspend and .resume functions registered by at803x to paltform_device ? How to make these functions get called from the linux kernel ethernet susbsystem?Please mention specific files and functions.
3> is there any other better way of achieving power save by shutting down of ethernet PHYs when TI processor is put into standby powersave mode?