XO1.5 SD suspend

From OLPC
Revision as of 18:49, 20 March 2011 by Quozl (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

XO-1.5 WLAN SD suspend/resume testing has been completed, so this page is obsolete.

Stop hand.png WARNING:
The content of this section is considered
DEPRECATED and OBSOLETE
It is preserved for historical or documenting reasons.

This describes the current setup for testing WLAN SD suspend/resume on prototypes of the XO-1.5 laptop.

Software Installation

You should start by obtaining the OS31 Linux image for the XO-1.5 from http://dev.laptop.org/~cjb/f11-1.5/os31/os31.zd.

  1. Place the image on a USB stick, and insert it into the XO-1.5 laptop's USB port.
  2. Boot the laptop, pressing the escape key ('X' in upper left hand corner of keyboard) within a few seconds after boot to enter Open Firmware (OFW).
  3. To install onto the internal SD card, type:
fs-update u:\os31.zd

Now upgrade the kernel to one supporting Marvell's SD patches. The following sequence of commands should work:

wget http://dev.laptop.org/~dilinger/olpc-2.6.30/kernel-2.6.30_xo1.5-20091005.1546.1.olpc.61c1a98.i586.rpm
wget http://dev.laptop.org/~dilinger/olpc-2.6.30/kernel-firmware-2.6.30_xo1.5-20091005.1546.1.olpc.61c1a98.i586.rpm
rpm -ivh kernel-*
reboot

Hardware Modification

WLAN SDIO slot

The internal WLAN SD slot has a problem maintaining power during suspend. This modification is only necessary when testing the internal slot. The external SD card slot should function fine during suspend.

In order to disconnect the SD_PWOFF signal, preventing it from powering off the WLAN card in suspend, you should remove Q38. This is in an SOT-323 package, located on the "bottom" side of the motherboard (the same side as the processor) right below the WLAN card connector.

Serial Port

You will also need to connect a serial terminal to the laptop, as the laptop display doesn't work after resume (Trac ticket #9477)

  1. Using an OLPC serial adapter, connect the laptop to your personal laptop. On the laptop's motherboard, the serial adapter should be connected to J3. J3 is a small white connector located in the upper left hand corner of the motherboard, near the two USB connectors (location, pinout, photo)
  2. JP1 (immediately behind J3) will need pin 1 shorted to pin 3 to enable the serial port.
  3. Use a program like minicom (for Linux) or HyperTerminal (for Windows) to access the laptop serially
  4. The serial port settings should be 115200 baud, 8 data bits, no parity, and 1 stop bit and handshake parameter is disabled.

Test Procedure

If modified by removing Q38 and using the internal WLAN card, the laptop must be powered down to power cycle the WLAN (not rebooted).

Boot the laptop. Due to a problem with OS31, it will halt in Open Firmware. Boot Linux by typing:

boot int:\olpc.fth

When Linux has booted, you can place the system into suspend by typing:

echo mem > /sys/power/state

It may take a few seconds to suspend if there are filesystem modifications that have to be flushed to non-volatile storage.

In order to wake the laptop from suspend, press the power button. This should bring you back to a Linux prompt.

Automating resumes

To have the laptop resume itself 50ms after it goes to sleep, boot Open Firmware version Q3A16 or later, then type:

d# 50 autowack-delay
autowack-on

You can also place these two commands at the beginning of the olpc.fth file located in /bootpart/boot, to have them run automatically when booting Linux.

Now boot OS42. To enable wakeups from the EC, type (as root):

echo EC > /proc/acpi/wakeup

You can now run a suspend/resume loop, such as:

for i in `seq 1 10000`; do echo $i; sleep 1; echo mem > /sys/power/state; done;

Caveats

It is currently recommended (OS42) that you do the following first, to insure that networking isn't restarted:

service NetworkManager stop
ifconfig eth0 down
rmmod libertas_sdio libertas lib80211
mv /lib/modules/`uname -r`/kernel/drivers/net/wireless/libertas /root/

Using interactive OFW

It is possible to enter Open Firmware from Linux, to perform low-level hardware manipulations. If the kernel is patched appropriately (as is OS42), this is done with a System Request. Sometimes bound to a key, this may also be generated by typing (as root):

echo y > /proc/sysrq-trigger

You can return to Linux by typing:

resume

Automatic entry when suspending

This requires a special kernel patch that is not included in the above software.

This kernel will complete the Linux suspend operations (calling all drivers), the drop the system into OFW right before actually suspending the hardware. You should see the "ok" prompt, although it may take a few seconds if there are filesystem modifications that have to be flushed to non-volatile storage.

All commands after this HAVE to be typed through the serial port.

In order to actually finish suspending the system, type:

resume

In order to wake the laptop from suspend, press the power button. This will bring you back to an OFW prompt ("+rok"). In order to start Linux executing again, type "resume" one more time. This should bring you back to a Linux prompt.

Exploring from Open Firmware

While we are mainly dropping into OFW on suspend and resume in order to allow for orderly testing (OFW by default ignores SCI wakeup events, which tend to wake Linux at random times), it is possible to explore the state of hardware registers or manually trigger a suspend (without returning to Linux).

You can set up to examine registers in the SD controller using these commands:

ok select /sd  0 3 set-address  map-regs

Now you can read the contents of the registers using the cw@ (config-word-read) command (which takes a register offset from the stack as an argument):

ok 2c cw@ .

You can modify the contents of a register using the cw! (config-word-write) command (which takes a register offset and a value from the stack as arguments).

In order to manually trigger a suspend, type:

ok select /wlan
ok 2400 404 pw!

Monitoring

The signals to the internal WLAN card may easily be probed at the WLAN connector (pdf):

  1. SD_CLK
  2. WLAN_3.3V
  3. SD_CMD
  4. GND
  5. SD_DAT0
  6. RESET#
  7. SD_DAT1
  8. N.C.
  9. SD_DAT2
  10. POWER_DOWN#
  11. CARD_DETECT#
  12. N.C.
  13. SD_DAT3
  14. ...

The signals on odd pins are accessible from the "bottom" side of the motherboard (the side with the processor). The signals on even pins are only accessible from the top side of the motherboard.