V4FX PPC suspend/resume

We want to be able to save our PPC state to ram, shut off our fpga, and be able to restore the PPC when we wake up later. Seems like this should be a pretty common problem. Can anyone suggest how best to do this or maybe provide a working example?

Thanks, Clark

Reply to
cpope
Loading thread data ...

Clark,

I asked around, and no one had anything handy to do this. This is their recommendation:

Shutdown sequence:

1) Trigger the shutdown sequence with an interrupt. 2) The shutdown routine should save all registers and state. It must not use the stack. Next, copy all of memory to a non-volatile storage device. 3) Write to a non-volatile memory location a flag that at next boot a warm-boot should be performed. I recommend a 32 bit word with a unique pattern. Ex: 1234_CDEFh 4) Processor then signals the power supply to turn off.

Restart sequence:

1) At boot the processor checks the warm-boot flag. If set follow the steps below. Again, don't use the stack. 2) Copy the saved memory from the non-volatile storage device to system memory. 3) Restore all saved processor registers. 4) Execute a return from interrupt.

This assumes power is lost after suspend. If power is not lost, then there is no need for the non-volatile memory.

Austin

Reply to
austin

Or you could do pretty much what is given in 1, 2, 3, and 4 except overwrite the address that the bootloader loads from to the first "resume" instruction. But, Austin's answers seems more robust assuming you clear the "warm boot" flag in step 5 of the resume process.

---Matthew Hicks

Reply to
Matthew Hicks

One final note,

This assumes you copy the stack into the external memory when suspending, and the copy the external memory back into the stack before executing the "return" instruction.

The comment "do not use stack" just implies that the suspend, and restart code should save the stack, and restore the stack, and not use any subroutine calls (as that would make managing the stack pointer and stack contents more difficult).

Aust> Or you could do pretty much what is given in 1, 2, 3, and 4 except

Reply to
austin

Yes, this is the right sequence. In our case we have sdram that we plan to put in self refresh mode (another issue I'm not sure how to do from the xilinx ddr core?) so there's no need for the NV memory.

I don't know if I mentioned that we're using Linux 2.6. There are a lot of architectures in the kernel tree that have suspend/resume functions but nothing for ppc405. Since every V2Pro or V4fx user needs this same function I'm surprised there isn't some mature code out there.

Thanks, Clark

Reply to
cpope

You will need to add to Austin's procedure when using Linux, i.e. you will also need to save the state of the peripheral registers.

Alternatively, to get a clean restart you could work with kernel modules. Unload modules before shutting down and reload upon start. In that case peripherals get reinitialized when the kernel modules are loaded.

- Peter

cp>> Clark,

Reply to
Peter Ryser

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.