]> git.sur5r.net Git - openocd/blob - src/flash/nand/s3c24xx.h
Remove FSF address from GPL notices
[openocd] / src / flash / nand / s3c24xx.h
1 /***************************************************************************
2  *   Copyright (C) 2007, 2008 by Ben Dooks                                 *
3  *   ben@fluff.org                                                         *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
17  ***************************************************************************/
18
19 #ifndef S3C24xx_NAND_H
20 #define S3C24xx_NAND_H
21
22 /*
23  * S3C24XX Series OpenOCD NAND Flash controller support.
24  *
25  * Many thanks to Simtec Electronics for sponsoring this work.
26  */
27
28 #include "imp.h"
29 #include "s3c24xx_regs.h"
30 #include <target/target.h>
31
32 struct s3c24xx_nand_controller {
33         /* register addresses */
34         uint32_t                 cmd;
35         uint32_t                 addr;
36         uint32_t                 data;
37         uint32_t                 nfstat;
38 };
39
40 /* Default to using the un-translated NAND register based address */
41 #undef S3C2410_NFREG
42 #define S3C2410_NFREG(x) ((x) + 0x4e000000)
43
44 #define S3C24XX_DEVICE_COMMAND() \
45                 COMMAND_HELPER(s3c24xx_nand_device_command, \
46                                 struct nand_device *nand, \
47                                 struct s3c24xx_nand_controller **info)
48
49 S3C24XX_DEVICE_COMMAND();
50
51 #define CALL_S3C24XX_DEVICE_COMMAND(d, i) \
52         do { \
53                 int retval = CALL_COMMAND_HANDLER(s3c24xx_nand_device_command, d, i); \
54                 if (ERROR_OK != retval) \
55                         return retval; \
56         } while (0)
57
58 int s3c24xx_reset(struct nand_device *nand);
59
60 int s3c24xx_command(struct nand_device *nand, uint8_t command);
61 int s3c24xx_address(struct nand_device *nand, uint8_t address);
62
63 int s3c24xx_write_data(struct nand_device *nand, uint16_t data);
64 int s3c24xx_read_data(struct nand_device *nand, void *data);
65
66 #define s3c24xx_write_page NULL
67 #define s3c24xx_read_page NULL
68
69 /* code shared between different controllers */
70
71 int s3c2440_nand_ready(struct nand_device *nand, int timeout);
72
73 int s3c2440_read_block_data(struct nand_device *nand,
74                 uint8_t *data, int data_size);
75 int s3c2440_write_block_data(struct nand_device *nand,
76                 uint8_t *data, int data_size);
77
78 #endif /* S3C24xx_NAND_H */