summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire/iaudio/ata-iaudio.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire/iaudio/ata-iaudio.c')
-rw-r--r--firmware/target/coldfire/iaudio/ata-iaudio.c64
1 files changed, 64 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iaudio/ata-iaudio.c b/firmware/target/coldfire/iaudio/ata-iaudio.c
new file mode 100644
index 0000000000..21c088288a
--- /dev/null
+++ b/firmware/target/coldfire/iaudio/ata-iaudio.c
@@ -0,0 +1,64 @@
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
27void ata_reset(void)
28{
29 and_l(~0x40000000, &GPIO_OUT);
30 sleep(1); /* > 25us */
31 or_l(0x40000000, &GPIO_OUT);
32 sleep(1); /* > 2ms */
33}
34
35void ata_enable(bool on)
36{
37 if(on)
38 and_l(~0x00000800, &GPIO1_OUT);
39 else
40 or_l(0x00000800, &GPIO1_OUT);
41}
42
43bool ata_is_coldstart(void)
44{
45 return true; /* TODO */
46}
47
48void ata_device_init(void)
49{
50 /* ATA reset */
51 or_l(0x40000000, &GPIO_OUT);
52 or_l(0x40000000, &GPIO_ENABLE);
53 or_l(0x40000000, &GPIO_FUNCTION);
54
55 /* ATA enable */
56 or_l(0x00000800, &GPIO1_OUT);
57 or_l(0x00000800, &GPIO1_ENABLE);
58 or_l(0x00000800, &GPIO1_FUNCTION);
59
60 /* USB enable */
61 and_l(~0x00000008, &GPIO1_OUT);
62 or_l(0x00000008, &GPIO1_ENABLE);
63 or_l(0x00000008, &GPIO1_FUNCTION);
64}