Commit whole Creative Zen Vision:M target tree + all related firmware/
[Rockbox.git] / firmware / target / arm / tms320dm320 / creative-zvm / ata-creativezvm.c
blob5cbcd724159e694c33a9c50cb2d8f86f43acfb4c
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Maurus Cuelenaere
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 ****************************************************************************/
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"
29 void ide_power_enable(bool on){
30 #if 0
31 IO_INTC_EINT1 &= ~INTR_EINT1_EXT2;
32 if(on)
34 IO_GIO_BITSET0 = (1 << 14);
35 ata_reset();
37 else
38 IO_GIO_BITCLR0 = (1 << 14);
39 IO_INTC_EINT1 |= INTR_EINT1_EXT2;
40 return;
41 #endif
44 inline bool ide_powered(){
45 #if 0
46 return (IO_GIO_BITSET0 & (1 << 14));
47 #else
48 return true;
49 #endif
52 void ata_reset(void)
54 /* Disabled until figured out what's wrong */
55 IO_INTC_EINT1 &= ~INTR_EINT1_EXT2; //disable GIO2 interrupt
56 if(!ide_powered())
58 ide_power_enable(true);
59 sleep(150);
61 else
63 IO_GIO_BITSET0 = (1 << 5);
64 IO_GIO_BITCLR0 = (1 << 3);
65 sleep(1);
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;
76 void ata_enable(bool on)
78 (void)on;
79 return;
82 bool ata_is_coldstart(void)
84 return true;
87 void ata_device_init(void)
89 IO_INTC_EINT1 |= INTR_EINT1_EXT2; //enable GIO2 interrupt
90 //TODO: mimic OF inits...
91 return;
94 void GIO2(void)
96 #ifdef DEBUG
97 //printf("GIO2 interrupt...");
98 #endif
99 IO_INTC_IRQ1 = INTR_IRQ1_EXT2; //Mask GIO2 interrupt
100 return;