35

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.
aleixrocks
  • 566
  • 1
  • 4
  • 8

3 Answers3

7

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

Diederik de Haas
  • 809
  • 8
  • 12
Ryan Walmsley
  • 411
  • 2
  • 14
3

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)

aleixrocks
  • 566
  • 1
  • 4
  • 8
1

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

Tai Viinikka
  • 1,549
  • 1
  • 10
  • 8