General NAS-Central Forums

Welcome to the NAS community
It is currently Wed Jun 28, 2017 10:41 am

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: EDmini v2 power down?
PostPosted: Mon Aug 30, 2010 11:50 am 
Offline

Joined: Sat Aug 28, 2010 4:24 pm
Posts: 9
I just upgraded my edmini_v2 by adding a new 2TB HD and installing Debian on it combined with a self-compiled 2.6.35.4 kernel (vanilla).

Most stuff seems to work right, however, after shutting down, the fan keeps spinning, suggesting that the system is still powered somehow.
I guess the notice given by the kernel about "poweroff not supported" has to do with it.

Does someone know what's going on here?
If the system isn't powered of properly, what's the cause exactly (is there a patch some patch, or do I need to pull the plug? :D)

Thanks


(PS, I flashed my uboot with the version found via this forum)


Top
 Profile  
 
PostPosted: Mon Aug 30, 2010 8:38 pm 
Offline

Joined: Mon Jun 16, 2008 10:45 am
Posts: 6004
ruben wrote:
If the system isn't powered of properly, what's the cause exactly

The cause is that the vanilla kernel doesn't know how to switch off an EDmini v2. (And maybe doesn't even know that it's running on that box). I suppose some GPIO pin has to be set or reset to poweroff the box, but that is not normalized, and can differ for each platform this CPU is used for.
So to solve this you'll have to study the GPL sources of the stock kernel to find out how that kernel switches off the box, and port that to your new kernel.


Top
 Profile  
 
PostPosted: Tue Aug 31, 2010 4:28 am 
Offline

Joined: Thu May 08, 2008 11:23 am
Posts: 112
Location: near Toulouse, France
ruben wrote:
If the system isn't powered of properly, what's the cause exactly (is there a patch some patch, or do I need to pull the plug? :D)
Actually the EDmini V2 *never* fully powers off unless you pull the plug, not even with the stock kernel :(
To get it to "power off" you have to write to a flag in the I2C EEPROM and reboot.
When U-Boot gets control during the reboot it will see the flag and sit there (very) patiently waiting for you to press the power button ;-)

I am pretty sure that I have already written about all this in another topic :(
EDIT: It was here.

Unfortunately my mainline kernel setup code doesn't support the I2C EEPROM.
(To do so is fairly trivial.)
Ages ago I wrote code supporting this and also adding limited support for the button.
Before submitting it I had some discussions with LaCie and apparently there *is* a way to power off a bit more using a GPIO.
However this other method is not persistent across a power outage and we didn't reach agreement on the best method to put into the mainline kernel :(
(Even the stock LaCie kernel doesn't use the GPIO method.)

In brief: I have been intending to clean up the code and send a kernel update patch for ages but unfortunately but I haven't got round to it :(


Top
 Profile  
 
PostPosted: Tue Aug 31, 2010 8:26 am 
Offline

Joined: Sat Aug 28, 2010 4:24 pm
Posts: 9
Thanks for the feedback!

So maybe it might be more interesting to just reboot it and have it waiting for wake-on-lan or so.

Then all I need is to spin down the HD before rebooting (hoping that it's persistent across the reboot) and to turn of the LED via GPIO, which seems to be possible by bashing some registers in uboot(?).

http://devkit8000.wikispaces.com/Uboot + marvell CPU docs

I've read on the board the the fan isn't controllable, so that one might keep on spinning :(.
I'm also a bit concerned about power consumption, as the Marvell CPU probably doesn't enter a sleep state when uboot waits for a wake-up call?


Top
 Profile  
 
PostPosted: Tue Aug 31, 2010 4:18 pm 
Offline

Joined: Sat May 29, 2010 6:37 pm
Posts: 160
Good question, i compiled my own 2.6.34 kernel for this box and i have no led support, it won't shut down, fan keeps spinning. I also noticed that when giving a halt results in a reboot (restart of uboot). It Will not shutdown on my version :). Even holding the power button won't do shit, but thats due to not being configured so i guess ;).


Top
 Profile  
 
PostPosted: Wed Sep 01, 2010 4:04 am 
Offline

Joined: Thu May 08, 2008 11:23 am
Posts: 112
Location: near Toulouse, France
langerak wrote:
Good question, i compiled my own 2.6.34 kernel for this box and i have no led support, it won't shut down, fan keeps spinning. I also noticed that when giving a halt results in a reboot (restart of uboot). It Will not shutdown on my version :). Even holding the power button won't do shit, but thats due to not being configured so i guess ;).
Yes, as I wrote above and also in the source code, with my current mainline setup code it will not shut down (or halt).
You have to write a one (IIRC) to the seventh byte of the I2C EEPROM as well to make it shut down.
EDIT: Actually you have to write a zero to power off. Thanks to ruben for correcting me.
But the I2C EEPROM is not supported by the current mainline setup code :(
EDIT: ruben found a way to get round this using i2cset. See his post below.


Last edited by rosbif on Sat Sep 04, 2010 4:23 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Sep 01, 2010 9:17 am 
Offline

Joined: Sat Aug 28, 2010 4:24 pm
Posts: 9
I scanned the i²c bus using i2cdetect
Code:
# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n]
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- UU -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

Now I don't know which address maps to which device.
Is it possible to write directly to the eeprom using i2cset (as a workaround)?


Top
 Profile  
 
PostPosted: Thu Sep 02, 2010 4:16 am 
Offline

Joined: Thu May 08, 2008 11:23 am
Posts: 112
Location: near Toulouse, France
ruben wrote:
Now I don't know which address maps to which device.
Is it possible to write directly to the eeprom using i2cset (as a workaround)?
All the addresses 0x50 to 0x53 would seem to be the EEPROM.
It is seen as four 256-byte devices.
First try reading the first 16 bytes of the device at 0x50.
You should see:
    6 bytes which are your MAC address
    1 byte which is the reboot/power off flag
    EDIT (thanks to ruben): 1 byte which is the WOL flag but DON'T MESS WITH THIS as it seems that WOL doesn't work correctly and your edmini won't boot :(
    AFAIK all other bytes in the four devices are unused and will probably read as 0xFF (or perhaps 0x00 - I don't remember).

If this corresponds to what you get then it confirms that you have the correct device and you can try modifying the seventh byte.
IIRC it needs a one to power off (but if there is already a one then try a zero ;-) )
EDIT: You have to write a zero to power off. Thanks to ruben for correcting me.

Make sure that you can read the byte back correctly.
Then if you do a "reboot (or halt or poweroff)" command and cross your fingers, it should power off ;-)

HTH

Cheers,
Chris


Last edited by rosbif on Sat Sep 11, 2010 6:26 am, edited 3 times in total.

Top
 Profile  
 
PostPosted: Thu Sep 02, 2010 9:11 am 
Offline

Joined: Sat Aug 28, 2010 4:24 pm
Posts: 9
Niiice :) thanks!!

Writing 0 seems to halt it properly, so I need to push the button to power it back up.
Code:
i2cset 0 0x50 6 0

The readback from i2cset fails, but if I checked it manually, the byte was written correctly :)
Code:
i2cget 0 0x50 6


However I need to reboot instead of halt, as halting keeps it somewhere in limbo, requiring me to pull the plug.
Now, it makes sense as the serial terminal shows uboot starting back up, after which it blocks waiting for an innocent user to touch its button :D

Code:
<snip>
Net:   egiga0 [PRIME]
Power Button Released
WOL not enabled. System Power off
Hit any key to stop autoboot:  3


Now, it seems that I could enable WOL too 8-) , but that's for during the weekend :)

A small question: why didn't something as (seemingly) simple as this didn't make it into the mainline kernel without the agreement of Lacie? :?


Top
 Profile  
 
PostPosted: Fri Sep 03, 2010 4:13 am 
Offline

Joined: Thu May 08, 2008 11:23 am
Posts: 112
Location: near Toulouse, France
ruben wrote:
A small question: why didn't something as (seemingly) simple as this didn't make it into the mainline kernel without the agreement of Lacie? :?
Mainly due to my laziness and my indecisiveness :(

I intended to put several, slightly related, improvements into my patch:
    Setup of I2C EEPROM
    Handling power off
    Handling button presses
I held off as there was some doubt as to how best to handle the two last points.
Of course it would have been better to submit separate patches, at least for the first point.

I did not need LaCie's agreement but I wanted to find the "best" solution.
Open points were:
    Should the EEPROM power off flag be written from user space or from the kernel? I favour the kernel but my solution was somewhat messy and may not have been accepted.
    Should one also use a GPIO to perform a slightly more complete power off? (This method has drawbacks as, in particular, it is not persistent across a power outage without U-Boot support.)
    Should there be a choice of power off method?
    If so, which should be the default?
    The exact details of the (multi-purpose) button handling.


Top
 Profile  
 
PostPosted: Sat Sep 04, 2010 9:43 am 
Offline

Joined: Sat Aug 28, 2010 4:24 pm
Posts: 9
Ok thanks for the info!
You don't have published this patch somewhere, don't you?
In the meantime I'll workaround the problem with a little shell script overriding the default halt executable.

Wouldn't it be better to make a simple patch to override "halt" inside the kernel to properly set eeprom and reboot.
Maybe that would get accepted in the kernel and already make support for the edmini much better.
(disclaimer: I'm no expert on the kernel's internals :) )

I'll give Wake-on-Lan a try first :)


Top
 Profile  
 
PostPosted: Sat Sep 04, 2010 5:57 pm 
Offline

Joined: Thu May 08, 2008 11:23 am
Posts: 112
Location: near Toulouse, France
ruben wrote:
You don't have published this patch somewhere, don't you?
If you e-mail me privately I'll send you my code in the state it was when I stopped working on it.
I'm not even certain that the button stuff is working well and there is lots of debug code you'll want to disactivate.
You'll find my e-mail address in the kernel source code (edmini_v2-setup.c) ;-)
ruben wrote:
Wouldn't it be better to make a simple patch to override "halt" inside the kernel to properly set eeprom and reboot.
Maybe that would get accepted in the kernel and already make support for the edmini much better.
My version does this but the way I access the EEPROM from the kernel is pretty messy :(
I am sure there must be an easier way ;-)

Cheers,
Chris


Top
 Profile  
 
PostPosted: Sun Sep 05, 2010 12:44 pm 
Offline

Joined: Sat Aug 28, 2010 4:24 pm
Posts: 9
Thanks for the info, when (and if? :? ) I get my box back, I'll check it out :)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group