Fix a bunch of boot.lds files so that they build with newer ld. The stack/bss section...
[kugel-rb.git] / firmware / target / arm / philips / power-hdd.c
blobc348567529119e72acdc7f920695ef452112ebda
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Mark Arigo
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #include "config.h"
23 #include "cpu.h"
24 #include <stdbool.h>
25 #include "kernel.h"
26 #include "system.h"
27 #include "power.h"
28 #include "logf.h"
29 #include "usb.h"
30 #include "synaptics-mep.h"
32 void power_init(void)
34 /* power off bit */
35 GPIOB_ENABLE |= 0x80;
36 GPIOB_OUTPUT_VAL |= 0x80;
37 GPIOB_OUTPUT_EN |= 0x80;
39 /* charger inserted bit */
40 GPIOE_ENABLE |= 0x20;
41 GPIOE_INPUT_VAL |= 0x20;
43 #if CONFIG_TUNER
44 /* fm antenna? */
45 GPIOE_ENABLE |= 0x40;
46 GPIOE_OUTPUT_EN |= 0x40;
47 GPIOE_OUTPUT_VAL &= ~0x40; /* off */
48 #endif
50 #ifndef BOOTLOADER
51 /* enable touchpad here because we need it for
52 both buttons and button lights */
53 GPO32_ENABLE |= 0x80;
54 GPO32_VAL &= ~0x80;
55 udelay(1000);
57 GPIOD_ENABLE |= 0x80; /* enable ACK */
58 GPIOA_ENABLE |= (0x10 | 0x20); /* enable DATA, CLK */
60 GPIOD_OUTPUT_EN |= 0x80; /* set ACK */
61 GPIOD_OUTPUT_VAL |= 0x80; /* high */
63 GPIOA_OUTPUT_EN &= ~0x20; /* CLK */
65 GPIOA_OUTPUT_EN |= 0x10; /* set DATA */
66 GPIOA_OUTPUT_VAL |= 0x10; /* high */
68 if (!touchpad_init())
70 logf("touchpad not ready");
72 #endif
75 unsigned int power_input_status(void)
77 unsigned int status = POWER_INPUT_NONE;
79 /* AC charger */
80 if (GPIOE_INPUT_VAL & 0x20)
81 status |= POWER_INPUT_MAIN_CHARGER;
83 /* Do nothing with USB for now
84 if (GPIOE_INPUT_VAL & 0x4)
85 status |= POWER_INPUT_USB_CHARGER;
88 return status;
91 void ide_power_enable(bool on)
93 (void)on;
94 /* We do nothing */
97 bool ide_powered(void)
99 /* pretend we are always powered - we don't turn it off */
100 return true;
103 void power_off(void)
105 /* power off bit */
106 GPIOB_ENABLE |= 0x80;
107 GPIOB_OUTPUT_VAL &= ~0x80;
108 GPIOB_OUTPUT_EN |= 0x80;
111 #if CONFIG_TUNER
112 bool tuner_power(bool status)
114 if (status)
115 GPIOE_OUTPUT_VAL |= 0x40;
116 else
117 GPIOE_OUTPUT_VAL &= ~0x40;
119 return status;
121 #endif