diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-06-18 16:39:11 +0200 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-06-18 16:41:13 +0200 |
commit | 0b6198f8a859700e3816254222e31466014ea553 (patch) | |
tree | 5b7cd61707943f0b4146881cfacf37451b65c8c3 /firmware/target/arm/imx233/ata-target.h | |
parent | bbb789120ce4c2eb470233920e602e5f79c62430 (diff) | |
download | rockbox-0b6198f8a859700e3816254222e31466014ea553.tar.gz rockbox-0b6198f8a859700e3816254222e31466014ea553.zip |
imx233: add basic ATA driver
The current driver only works in PIO mode.
Change-Id: I1cf2eaedcce0172a254c3bab0e1257886226d3a0
Diffstat (limited to 'firmware/target/arm/imx233/ata-target.h')
-rw-r--r-- | firmware/target/arm/imx233/ata-target.h | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/ata-target.h b/firmware/target/arm/imx233/ata-target.h new file mode 100644 index 0000000000..a95ea03247 --- /dev/null +++ b/firmware/target/arm/imx233/ata-target.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 Amaury Pouly | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef ATA_TARGET_H | ||
22 | #define ATA_TARGET_H | ||
23 | |||
24 | #include "config.h" | ||
25 | |||
26 | #ifdef BOOTLOADER | ||
27 | #define ATA_DRIVER_CLOSE | ||
28 | #endif | ||
29 | |||
30 | #ifdef HAVE_ATA_DMA | ||
31 | /* FIXME does this chips does MWDMA ? */ | ||
32 | #define ATA_MAX_MWDMA 2 | ||
33 | #define ATA_MAX_UDMA 4 | ||
34 | #endif | ||
35 | |||
36 | uint8_t imx233_ata_inb(unsigned reg); | ||
37 | uint16_t imx233_ata_inw(unsigned reg); | ||
38 | void imx233_ata_outb(unsigned reg, uint8_t v); | ||
39 | void imx233_ata_outw(unsigned reg, uint16_t v); | ||
40 | |||
41 | #define IMX233_ATA_REG(cs,addr) ((cs) << 3 | (addr)) | ||
42 | #define IMX233_ATA_REG_CS(reg) ((reg) >> 3) | ||
43 | #define IMX233_ATA_REG_ADDR(reg) ((reg) & 0x7) | ||
44 | /* use register address (see ATA spec) */ | ||
45 | #define ATA_DATA IMX233_ATA_REG(0, 0) | ||
46 | #define ATA_ERROR IMX233_ATA_REG(0, 1) | ||
47 | #define ATA_NSECTOR IMX233_ATA_REG(0, 2) | ||
48 | #define ATA_SECTOR IMX233_ATA_REG(0, 3) | ||
49 | #define ATA_LCYL IMX233_ATA_REG(0, 4) | ||
50 | #define ATA_HCYL IMX233_ATA_REG(0, 5) | ||
51 | #define ATA_SELECT IMX233_ATA_REG(0, 6) | ||
52 | #define ATA_COMMAND IMX233_ATA_REG(0, 7) | ||
53 | #define ATA_CONTROL IMX233_ATA_REG(1, 6) | ||
54 | |||
55 | /* keep consistent with definition of IMX233_ATA_REG */ | ||
56 | #define ATA_OUT8(reg, data) imx233_ata_outb(reg, data) | ||
57 | #define ATA_OUT16(reg, data) imx233_ata_outw(reg, data) | ||
58 | #define ATA_IN8(reg) imx233_ata_inb(reg) | ||
59 | #define ATA_IN16(reg) imx233_ata_inw(reg) | ||
60 | |||
61 | #define ATA_SET_PIO_TIMING | ||
62 | |||
63 | #define ATA_TARGET_POLLING | ||
64 | |||
65 | void ata_set_pio_timings(int mode); | ||
66 | void ata_reset(void); | ||
67 | void ata_enable(bool on); | ||
68 | bool ata_is_coldstart(void); | ||
69 | #ifdef HAVE_ATA_DMA | ||
70 | void ata_dma_set_mode(unsigned char mode); | ||
71 | bool ata_dma_setup(void *addr, unsigned long bytes, bool write); | ||
72 | bool ata_dma_finish(void); | ||
73 | #endif | ||
74 | int ata_wait_for_bsy(void); | ||
75 | int ata_wait_for_rdy(void); | ||
76 | void ata_device_init(void); | ||
77 | |||
78 | #endif /* ATA_TARGET_H */ | ||