summaryrefslogtreecommitdiff
path: root/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c')
-rw-r--r--firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c101
1 files changed, 101 insertions, 0 deletions
diff --git a/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
new file mode 100644
index 0000000000..5cbcd72415
--- /dev/null
+++ b/firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c
@@ -0,0 +1,101 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2008 by Maurus Cuelenaere
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
20#include "config.h"
21#include "cpu.h"
22#include "kernel.h"
23#include "thread.h"
24#include "system.h"
25#include "power.h"
26#include "panic.h"
27#include "ata-target.h"
28
29void ide_power_enable(bool on){
30#if 0
31 IO_INTC_EINT1 &= ~INTR_EINT1_EXT2;
32 if(on)
33 {
34 IO_GIO_BITSET0 = (1 << 14);
35 ata_reset();
36 }
37 else
38 IO_GIO_BITCLR0 = (1 << 14);
39 IO_INTC_EINT1 |= INTR_EINT1_EXT2;
40 return;
41#endif
42}
43
44inline bool ide_powered(){
45#if 0
46 return (IO_GIO_BITSET0 & (1 << 14));
47#else
48 return true;
49#endif
50}
51
52void ata_reset(void)
53{
54/* Disabled until figured out what's wrong */
55 IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; //disable GIO2 interrupt
56 if(!ide_powered())
57 {
58 ide_power_enable(true);
59 sleep(150);
60 }
61 else
62 {
63 IO_GIO_BITSET0 = (1 << 5);
64 IO_GIO_BITCLR0 = (1 << 3);
65 sleep(1);
66 }
67 IO_GIO_BITCLR0 = (1 << 5);
68 sleep(10);
69 IO_GIO_BITSET0 = (1 << 3);
70 while(!(ATA_COMMAND & STATUS_RDY))
71 sleep(10);
72 IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt
73 return;
74}
75
76void ata_enable(bool on)
77{
78 (void)on;
79 return;
80}
81
82bool ata_is_coldstart(void)
83{
84 return true;
85}
86
87void ata_device_init(void)
88{
89 IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt
90 //TODO: mimic OF inits...
91 return;
92}
93
94void GIO2(void)
95{
96#ifdef DEBUG
97 //printf("GIO2 interrupt...");
98#endif
99 IO_INTC_IRQ1 = INTR_IRQ1_EXT2; //Mask GIO2 interrupt
100 return;
101}