diff options
Diffstat (limited to 'firmware/target/coldfire/iriver/ata-iriver.c')
-rw-r--r-- | firmware/target/coldfire/iriver/ata-iriver.c | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iriver/ata-iriver.c b/firmware/target/coldfire/iriver/ata-iriver.c new file mode 100644 index 0000000000..82dae32a97 --- /dev/null +++ b/firmware/target/coldfire/iriver/ata-iriver.c | |||
@@ -0,0 +1,66 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
11 | * | ||
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. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include <stdbool.h> | ||
22 | #include "kernel.h" | ||
23 | #include "system.h" | ||
24 | #include "power.h" | ||
25 | #include "pcf50606.h" | ||
26 | |||
27 | void ata_reset(void) | ||
28 | { | ||
29 | and_l(~0x00080000, &GPIO_OUT); | ||
30 | sleep(1); /* > 25us */ | ||
31 | |||
32 | or_l(0x00080000, &GPIO_OUT); | ||
33 | sleep(1); /* > 25us */ | ||
34 | } | ||
35 | |||
36 | void ata_enable(bool on) | ||
37 | { | ||
38 | if(on) | ||
39 | and_l(~0x0040000, &GPIO_OUT); | ||
40 | else | ||
41 | or_l(0x0040000, &GPIO_OUT); | ||
42 | |||
43 | or_l(0x00040000, &GPIO_ENABLE); | ||
44 | or_l(0x00040000, &GPIO_FUNCTION); | ||
45 | } | ||
46 | |||
47 | bool ata_is_coldstart(void) | ||
48 | { | ||
49 | return (GPIO_FUNCTION & 0x00080000) == 0; | ||
50 | } | ||
51 | |||
52 | void ata_device_init(void) | ||
53 | { | ||
54 | #ifdef HAVE_ATA_LED_CTRL | ||
55 | /* Enable disk LED & ISD chip power control */ | ||
56 | and_l(~0x0000240, &GPIO_OUT); | ||
57 | or_l(0x00000240, &GPIO_ENABLE); | ||
58 | or_l(0x00000200, &GPIO_FUNCTION); | ||
59 | #endif | ||
60 | |||
61 | /* ATA reset */ | ||
62 | or_l(0x00080000, &GPIO_OUT); | ||
63 | or_l(0x00080000, &GPIO_ENABLE); | ||
64 | or_l(0x00080000, &GPIO_FUNCTION); | ||
65 | |||
66 | } | ||