The LAN9512 is the hardware device which controls Ethernet and USB ports. This chip consumes almost 200mA, and it will be very useful to disable it to save energy when I don't need USB or Ethernet. The LAN9512 datasheet explains some states of the device to save energy - these modes are SUSPEND2, SUSPEND1 and SUSPEND0. Therefore, it seems to be possible.

I have already found a partial solution:

  • echo 0x0 > /sys/devices/platform/bcm2708_usb/buspower will effectively disable the device and wake up it again with echo 0x1 to the same file. However, once the device has been stopped and started a certain number of times, it won't wake up again until the next reboot of the operating system.

Is there a method to disable LAN9512 and start it again reliably? (Maybe can I reload some driver that controls LAN9512?)

Motivation

When a raspberry pi model B is idle, it consumes 400 mA. When it's stressed, 470mA. When the LAN9512 is disabled, it consumes 200mA on idle and 260mA stressed.

Others

  • I have tested the fiability of disabling the chip through "buspower" by using a script that disables the LAN9512, tries to mount an usb device to check for activity and reboots. Until now, the raspberry pi has rebooted 9222 times without errors.
  • echo 1 > /sys/devices/platform/bcm2708_usb/bussuspend Disables the LAN9512 But won't wake it up again when doing echo 0 to the same file. After disabling it, the raspberry pi goes extremly slow reporting a load average up to 4.
  • 1
    Just out of curiosity; Does the power consumption drop when you disable it, using one of the above commands? – Gerben Jul 18 '13 at 20:49
  • 2
    Yes! Both buspower and bussuspend files reduces the consumption 200mA. When a raspberry pi is idle, it consumes 400 mA. When it's stressed, 470mA. With the chip disabled, it consumes 200mA on idle and 260mA stressed. – aleixrocks Jul 19 '13 at 8:40
  • Really nice. Thanks you. Sorry I can't help though – Gerben Jul 19 '13 at 11:59
  • Just curious: if you disable USB and Ethernet, how do you send the wakeup command? With a cron-job or after a sleep? – Moshe Katz Jul 19 '13 at 19:19
  • I prefer sleep for simplicity. While debugging, I use "echo 0x0 > /sys/devices/platform/bcm2708_usb/buspower; sleep 2; echo 0x1 > /sys/devices/platform/bcm2708_usb/buspower; sleep 30; reboot". Thus, if USB don't wake up, it will restart automatically. "sleep 2" is just to give some time to the hardware to react. – aleixrocks Jul 22 '13 at 8:42

After doing some experimentation of my own I done the following to experiment:

USB to TTL / Debug cable with 5V via multimeter.

Normal boot at login screen with just the power and network connected was about 420-380Ma

I first turned off networking via /etc/init.d/networking stop and then the chip by echo 0 > /sys/devices/platform/bcm2708_usb/buspower and indeed it did go down to ~ 240Ma

I was also able to unsuccessfully ping google! (Which is good)

I then turned it back on by echoing 1 to the bus power and running the network start command. And once again I was back to around 370-420ma. Pinging google then worked.

I then put this into an SH file that looped and it lasted more than 10 times without needing to be rebooted. In your command I could see it rebooting every time no matter what due to you putting the reboot command in.

The code for the test can be found @ Ubuntu Paste of auto reboot code.

This can then simply be used to stop and start. You could do the first part of it as a stop command and the second part as a start command.

I also done a full write up of this @ My Blog

  • That's just the problem. The sooner or later, you need to reboot because the LAN9512 stop working. I'm searching for a solution that doesn't need to reboot. (On my script I rebooted every time only if the keyboard stop working, because just before rebooting I tried to kill manually the script. It the keyboard works I could kill it with ctrl + c. If not, it just reboot) – aleixrocks Jul 30 '13 at 10:20
  • Well like I said I tested it out well more than 50 times in the end on a constant loop with each one working for the network ping. Maybe the keyboard just needs plugging in again or USB needs resetting? Like others have said it isn't designed for it. If it can its a bonus. Hence one of the reasons for the Model A – Ryan Walmsley Jul 30 '13 at 16:42
  • In my case, it last no more than 10 loops all the times I executed your script. I tried plugging again USB and still didn't work. No idea why this difference maybe is my raspberry pi. It would be greate if someone else more could try. – aleixrocks Jul 31 '13 at 10:38
up vote 3 down vote accepted

The feature of disabling and enabling LAN9512 trough:

  • echo 0x0 > /sys/devices/platform/bcm2708_usb/buspower (disable)
  • echo 0x1 > /sys/devices/platform/bcm2708_usb/buspower (enable)

Has been debuged on the newer kernels and now is working perfectly without modifications. I have made a couple of scripts to test it.

The purpose of the first one is to test disabling through software feature. The script disables the LAN9512 and tries to mount an USB device. If it can, then the test fail. If not, then the test succeed. Finally reboots and start again. The script has been running for four days and has reported 8039 reboots without failures on raspbian 2013-9-25.

The second script is meant to test the enabling feature. First of all, the script disables the LAN9512. Then waits some seconds to let the pi rest. Next it enables the LAN9512 and finally it tries to execute “lsusb” command. It lists all the USB devices. If the kernel can recognize all the USB devices, then the LAN9512 is working again. If not, the test has failed. The test has been running along a week and reported 7209 loops without errors on raspbian 2013-9-25 and 5374 loops on raspbian 2014-1-7.

Kernels and firmwares

On raspbian 2014-1-7:

kernel: Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/LINUX firmware: b00bb3ae73bd2799df0e938b7a5f17f45303fb53 (clean) (release)

On raspbian 2013-9-25

kernel: Linux raspberrypi 3.6.11+ #538 PREEMPT Fri Aug 30 20:42:08 BST 2013 armv61 GNU/LINUX firmware: 4f9d19896166f46a3255801bc1834561bf092732 (clean) (release)

  • "The feature of disabling and enabling LAN9512 has been debuged on the newer kernels." Can you report which kernel and firmware you've seen that allow thousands of successful sleep/wake cycles? Thanks! I'm interested in progress towards a more sleepable Pi! – Tai Viinikka Feb 9 '14 at 1:05

These answers above were correct when offered, but some time in 2015, Raspbian made changes and interested users had to go looking for the relevant controls.

Off:  echo 0x0 > /sys/devices/platform/soc/20980000.usb/buspower   
 On:  echo 0x1 > /sys/devices/platform/soc/20980000.usb/buspower

My thanks to user Adrian! https://raspberrypi.stackexchange.com/users/37611/adrian

  • Hi Tai! Could you provide some reference for the interested users? Which raspberry pi are you using? – aleixrocks Apr 23 at 10:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.