summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/ata-target.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/imx233/ata-target.h')
-rw-r--r--firmware/target/arm/imx233/ata-target.h78
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
36uint8_t imx233_ata_inb(unsigned reg);
37uint16_t imx233_ata_inw(unsigned reg);
38void imx233_ata_outb(unsigned reg, uint8_t v);
39void 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
65void ata_set_pio_timings(int mode);
66void ata_reset(void);
67void ata_enable(bool on);
68bool ata_is_coldstart(void);
69#ifdef HAVE_ATA_DMA
70void ata_dma_set_mode(unsigned char mode);
71bool ata_dma_setup(void *addr, unsigned long bytes, bool write);
72bool ata_dma_finish(void);
73#endif
74int ata_wait_for_bsy(void);
75int ata_wait_for_rdy(void);
76void ata_device_init(void);
77
78#endif /* ATA_TARGET_H */