All times are UTC-06:00




Post new topic  Reply to topic  [ 10 posts ] 
Author Message
 Post subject: Efika and ACPI
PostPosted: Tue Aug 07, 2007 1:41 pm 
Offline

Joined: Wed Dec 13, 2006 2:04 am
Posts: 2
Hello,

I would like to cleanly shutdown linux on the Efika by pressing the power button.
Under PC platform this is handled by ACPI. Do I have chance to make working ACPI with the Efika?
Thanks

Sylvain


Top
   
 Post subject: Re: Efika and ACPI
PostPosted: Wed Aug 08, 2007 2:53 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
Hello,

I would like to cleanly shutdown linux on the Efika by pressing the power button.
Under PC platform this is handled by ACPI. Do I have chance to make working ACPI with the Efika?
Thanks

Sylvain
You don't, ACPI is a PC configuration system meant to replace plug and play by more accurately defining (and scripting) devices and events.

Therefore, ACPI will define (via a table of devices and events presented by the BIOS) things like a power button and it's behaviour and the required power state to shift into when it is pushed.

Power Architecture has historically has had Open Firmware and RTAS, which has been doing much the same - presenting a heirarchical tree of devices and possible events handled by those devices - since what may as well be the dawn of time.

What there needs to be is an interrupt which is fired and caught by the MPC5200B when the power button is pressed. On Pegasos it was routed into the southbridge SMI (Systems Management Interrupt) which is an ACPI thing. Nobody ever implemented the handling of the SMI on a Power Architecture platform, so Pegasos happily kernel panics when it's pushed. What should happen is that some userspace process is informed and it pops up a "Standby Shutdown Hibernate" box like Windows does.

Unfortunately the MPC5200B does not HAVE a power button interrupt or SMI feature of a PC southbridge.

What you would need to do is write a driver which caught an interrupt from some other switch or source (IrDA port has voltage, two wakeup GPIO pins and a 'simple' GPIO, be careful as you can fry your board). There is already code in Linux for a "sleep" mode, you can set your system to sleep using the /proc or /sys interface and wake it back up with the switch connected to certain IrDA pins.

Can anyone here sit down and detail this as an article, for both electronic additions (switch, capacitor or logic required?) and software (linux driver..)?

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Tue Aug 28, 2007 9:05 pm 
Offline

Joined: Tue Dec 05, 2006 6:26 am
Posts: 34
Location: Santiago, Chile
Hi Matt!
Just noticed your question at the end. Are the schematics of the board available somehow to support this article? It would be handy too for the port assignment of the FreeBSD BSP... Not to copy it, promised ;-)

Cheers
Olivier


Top
   
 Post subject:
PostPosted: Wed Aug 29, 2007 4:05 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
Hi Matt!
Just noticed your question at the end. Are the schematics of the board available somehow to support this article? It would be handy too for the port assignment of the FreeBSD BSP... Not to copy it, promised ;-)

Cheers
Olivier
Did you not notice the very large, pretty Platform Support box at the bottom of the front page of this very site?

I do realise that not everyone scrolls past the forum update box but :D

Pegasos Schematics are there, Efika support (detailing which PSC6 pins are available) and MPC5200B documentation is there. That's all you need.

The operation of such an addition (in the question) would be that the standard power switch acts simply to turn board power on and off. Maybe you'd implement this as a switch at the back of the case. This is your master "power goes to the board" switch.

Then, a standby switch would be on the front of the case, masquerading as power on/power off. In fact it would tell Linux to go into deep sleep and wake up from deep sleep.

The reset switch, I would prefer implemented as one of those cdrom-style pin-push switches. If someone implements this in a design or case, I suggest shipping a paper clip with every one :D

It may be possible through some clever tricks to write some PIC software such that the real power switch and the standby power switch are the same but they act differently depending on the system state, toggled through a GPIO 'ping' from Linux (the default is to act as main power, when Linux tells the PIC to change method, it can then report standby events. I am sure there are plenty of PICs which can react to these events)

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Thu Aug 30, 2007 9:12 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
I'm not sure whether I had forgotten the technical description or whether it was not detailed enough last time I looked at it - a long time ago - but the info should be sufficient to get started.

However the schematics seem to refer to the OpenDesktop, i.e. the previous version... or your hardware team can make miracles to pack all this electronics in such a small board ;-)


The schematics are for Pegasos. It at least shows the routing of interrupts and SMI on the Via bridge.

The rest of the information for PSC6 and IrDA on the Efika is MORE than you need. It's actually fairly easily derivable from the MPC5200B pinout sheet and the details of a standard IrDA connector.

[query]By the way, is the 5V of the IRDA port connected to the permanent 5V of the power supply? If not, the microcontroller will be left without energy to activate the power supply :-S[/quote]

I have no idea. And no idea if I could read the schematic to find out..
Back to top
View user's profile Send private message Send e-mail

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Thu Aug 30, 2007 9:13 am 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Uh-oh. I think Firefox hiccuped..

Oliver you don't remember your original post do you?

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Thu Aug 30, 2007 12:04 pm 
Offline

Joined: Tue Dec 05, 2006 6:26 am
Posts: 34
Location: Santiago, Chile
Ooops Matt! Sounds like my last post got lost... No I don't have a copy (I blindly trusted the forum server :) )

If you need help with the schematics, I can offer my helpful hand, although I'm sure you already have zillions of others. A way to find out which of the power supply lines is used for the IRDA port is with a multimeter... but I would have to shutdown my web server (yes, it's true! :-) ) and disassemble the box to reach the connectors.

By the way, do you know whether the "hard switch off" (by pressing the "Power On" button for 5s) is implemented in HW or SW? I mean if it is done by some resource on the board or by the OFW? It's a critical piece of info for the ACPI emulation in the post that originated this thread.


Top
   
 Post subject:
PostPosted: Thu Aug 30, 2007 2:30 pm 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
If you need help with the schematics
I can't give you the Efika schematics :D
Quote:
A way to find out which of the power supply lines is used for the IRDA port is with a multimeter...
It's a PC standard IrDA connector. The Specification page links to the connector format. It's like that. The pin marked N/A is actually a GPIO wakeup pin or UART CTS depending on port config. That's the only difference (but it's not relevant to IrDA, this is a throwback to the original MPC5200 chip which had a more dedicated IrDA controller)
Quote:
shutdown my web server (yes, it's true! :-) ) and disassemble the box to reach the connectors.
You would have to do that to use them anyway. Shorting connectors while the board is on could fry the MPC5200B.

Absolutely 100% of the information required to use the exposed ports on the board is in the manual. Some clever guesswork and conservative software management can expose some more.
Quote:
By the way, do you know whether the "hard switch off" (by pressing the "Power On" button for 5s) is implemented in HW or SW? I mean if it is done by some resource on the board or by the OFW? It's a critical piece of info for the ACPI emulation in the post that originated this thread.
It's part of the ATX power supply standard, if you hold the switch long enough the PSU will turn itself off. If there is any software control it is handled by the onboard PIC/nvram controller which you *must not even consider touching under any circumstance*.

Do not emulate ACPI. ACPI is plug and play and power management scripting, and device abstraction. Open Firmware does this for you. There is no need for AML or interrupt emulation. Support Open Firmware instead, and the MPC5200B specification. There are plenty of hooks in drivers for power management and configuration via the device tree.

To shut down the Efika using software, simply write a driver which uses the PSC6 pins and reconfigures them for GPIO. You have a voltage, ground and 3 GPIO on that connector, two of which can cause a hardware interrupt.

This is how Sylvain Munaut's "deep sleep" driver works, however in reverse (GPIO wakeup handles it automatically, any wakeup interrupt source will restore the MPC5200B to "normal" mode). Simply capture that interrupt in a Linux driver. You will get a real hardware power switch (connected to PWR pins) and a software controlled switch which can be configured how you like. There are even enough pins left over for I2C control so you can connect a PIC on a piece of breadboard if you need fancier control or other operations.

_________________
Matt Sealey


Top
   
 Post subject:
PostPosted: Thu Aug 30, 2007 10:33 pm 
Offline

Joined: Tue Dec 05, 2006 6:26 am
Posts: 34
Location: Santiago, Chile
Quote:
It's part of the ATX power supply standard, if you hold the switch long enough the PSU will turn itself off. If there is any software control it is handled by the onboard PIC/nvram controller which you *must not even consider touching under any circumstance*.
I'll try to check with you guys off line: the info I found on the Intel site about the ATX power supplies tends to indicate that another piece of hardware (or software) handles the 5s stuff. I would bet on the PIC that you mentioned...
Quote:
Do not emulate ACPI. ACPI is plug and play and power management scripting, and device abstraction. Open Firmware does this for you. There is no need for AML or interrupt emulation. Support Open Firmware instead, and the MPC5200B specification. There are plenty of hooks in drivers for power management and configuration via the device tree.

Sounds like the death of a native support for other OSes then, unless the Open Firmware interaction with the hardware can be accurately specified (as seems to be the case with the IDE port - I have doubts about the serial ports, though). But that's another project.

Sylvain, sounds like we should exchange some ideas about this. I've thrown a few ideas into a White Paper draft (skeleton at this stage, I would say) for a possible implementation when I get my hands on a microcontroller... See: http://www.gautherot.net/efika .
Happy reading ;-)


Top
   
 Post subject:
PostPosted: Fri Aug 31, 2007 4:56 pm 
Offline
Site Admin

Joined: Fri Sep 24, 2004 1:39 am
Posts: 1589
Location: Austin, TX
Quote:
Sounds like the death of a native support for other OSes then, unless the Open Firmware interaction with the hardware can be accurately specified (as seems to be the case with the IDE port - I have doubts about the serial ports, though).
Olivier, pardon me for being so frank, but that is the most simple minded and naive thing I have ever heard anyone say.

Open Firmware, the device tree specification, client interface, MPC5200B, Power ISA etc. are all VERY VERY well documented.

Native OS support is a matter of someone reading the documentation which, let me just say, is not even reasonable for Genesi to provide simply because we *invented nothing* here. It is all Open Standards and Documented By The Manufacturers. We put it all in one place where it is relevant, not because it is inaccessible elsewhere or doesn't exist at all.

The same goes for the Pegasos; there was never ANY problem getting Linux or OpenBSD to port to the system. There is no Marvell controller code in either when you compile a CHRP kernel for Pegasos, besides the ethernet code. The Via southbridge is documented from a google search, the firewire, a billion quirks.

The operation of the MPC5200B is all in the manual, for which parts of the chip are NOT governed by some industry standard like PCI, OHCI USB, ATA4, AC97, I2C, SPI or whatever you may want to pick out of the chip.

_________________
Matt Sealey


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 10 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: No registered users and 81 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
PowerDeveloper.org: Copyright © 2004-2012, Genesi USA, Inc. The Power Architecture and Power.org wordmarks and the Power and Power.org logos and related marks are trademarks and service marks licensed by Power.org.
All other names and trademarks used are property of their respective owners. Privacy Policy
Powered by phpBB® Forum Software © phpBB Group