- add support for the majority of the Samsung ARM SoC family, S3C2410, S3C2412, S3C24...
[fw/openocd] / src / flash / s3c24xx_nand.h
1 /* src/flash/s3c24xx_nand.h
2  *
3  * S3C24XX Series OpenOCD NAND Flash controller support.
4  *
5  * Copyright 2007,2008 Ben Dooks <ben@fluff.org>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * Many thanks to Simtec Electronics for sponsoring this work.
13  */
14
15 #include "target.h"
16 #include "s3c24xx_regs_nand.h"
17
18 typedef struct s3c24xx_nand_controller_s
19 {
20         struct target_s *target;
21         
22         /* register addresses */
23         u32              cmd;
24         u32              addr;
25         u32              data;
26         u32              nfstat; 
27 } s3c24xx_nand_controller_t;
28
29 /* Default to using the un-translated NAND register based address */
30 #undef S3C2410_NFREG
31 #define S3C2410_NFREG(x) ((x) + 0x4e000000)
32
33 extern s3c24xx_nand_controller_t *s3c24xx_nand_device_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc, struct nand_device_s *device);
34
35 extern int s3c24xx_register_commands(struct command_context_s *cmd_ctx);
36 extern int s3c24xx_reset(struct nand_device_s *device);
37 extern int s3c24xx_command(struct nand_device_s *device, u8 command);
38 extern int s3c24xx_address(struct nand_device_s *device, u8 address);
39 extern int s3c24xx_write_data(struct nand_device_s *device, u16 data);
40 extern int s3c24xx_read_data(struct nand_device_s *device, void *data);
41 extern int s3c24xx_controller_ready(struct nand_device_s *device, int tout);
42
43 #define s3c24xx_write_page NULL
44 #define s3c24xx_read_page NULL
45
46 /* code shared between different controllers */
47
48 extern int s3c2440_nand_ready(struct nand_device_s *device, int timeout);
49
50 extern int s3c2440_read_block_data(struct nand_device_s *, u8 *data, int data_size);
51 extern int s3c2440_write_block_data(struct nand_device_s *, u8 *data, int data_size);