D2: Implement power-off by putting the PCF50606 to sleep (and reduce timeout to 10...
[kugel-rb.git] / firmware / target / arm / tcc780x / cowond2 / power-cowond2.c
blob92969de203f27414e5093136752cf812a961859d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 Dave Chapman
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
19 #include "cpu.h"
20 #include "kernel.h"
21 #include "system.h"
22 #include "power.h"
23 #include "pcf50606.h"
24 #include "cpu.h"
26 #ifndef SIMULATOR
28 void power_init(void)
30 /* Set outputs as per OF - further investigation required. */
31 pcf50606_write(PCF5060X_DCDEC1, 0xe4);
32 pcf50606_write(PCF5060X_IOREGC, 0xf5);
33 pcf50606_write(PCF5060X_D1REGC1, 0xf5);
34 pcf50606_write(PCF5060X_D2REGC1, 0xe9);
35 pcf50606_write(PCF5060X_D3REGC1, 0xf8); /* WM8985 3.3v */
36 pcf50606_write(PCF5060X_DCUDC1, 0xe7);
37 pcf50606_write(PCF5060X_LPREGC1, 0x0);
38 pcf50606_write(PCF5060X_LPREGC2, 0x2);
41 void ide_power_enable(bool on)
43 (void)on;
46 bool ide_powered(void)
48 return true;
51 void power_off(void)
53 /* Forcibly cut power to SoC & peripherals by putting the PCF to sleep */
54 pcf50606_write(PCF5060X_OOCC1, GOSTDBY | CHGWAK | EXTONWAK);
57 #else /* SIMULATOR */
59 bool charger_inserted(void)
61 return false;
64 void charger_enable(bool on)
66 (void)on;
69 void power_off(void)
73 void ide_power_enable(bool on)
75 (void)on;
78 #endif /* SIMULATOR */