1 /* src/flash/s3c2410_nand.c
3 * S3C2410 OpenOCD NAND Flash controller support.
5 * Copyright 2007,2008 Ben Dooks <ben@fluff.org>
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.
12 * Many thanks to Simtec Electronics for sponsoring this work.
19 #include "replacements.h"
26 #include "s3c24xx_nand.h"
29 int s3c2410_nand_device_command(struct command_context_s
*cmd_ctx
, char *cmd
, char **args
, int argc
, struct nand_device_s
*device
);
30 int s3c2410_init(struct nand_device_s
*device
);
31 int s3c2410_read_data(struct nand_device_s
*device
, void *data
);
32 int s3c2410_write_data(struct nand_device_s
*device
, u16 data
);
33 int s3c2410_nand_ready(struct nand_device_s
*device
, int timeout
);
35 nand_flash_controller_t s3c2410_nand_controller
=
38 .nand_device_command
= s3c2410_nand_device_command
,
39 .register_commands
= s3c24xx_register_commands
,
41 .reset
= s3c24xx_reset
,
42 .command
= s3c24xx_command
,
43 .address
= s3c24xx_address
,
44 .write_data
= s3c2410_write_data
,
45 .read_data
= s3c2410_read_data
,
46 .write_page
= s3c24xx_write_page
,
47 .read_page
= s3c24xx_read_page
,
48 .controller_ready
= s3c24xx_controller_ready
,
49 .nand_ready
= s3c2410_nand_ready
,
52 int s3c2410_nand_device_command(struct command_context_s
*cmd_ctx
, char *cmd
,
53 char **args
, int argc
,
54 struct nand_device_s
*device
)
56 s3c24xx_nand_controller_t
*info
;
58 info
= s3c24xx_nand_device_command(cmd_ctx
, cmd
, args
, argc
, device
);
60 return ERROR_NAND_DEVICE_INVALID
;
63 /* fill in the address fields for the core device */
64 info
->cmd
= S3C2410_NFCMD
;
65 info
->addr
= S3C2410_NFADDR
;
66 info
->data
= S3C2410_NFDATA
;
67 info
->nfstat
= S3C2410_NFSTAT
;
72 int s3c2410_init(struct nand_device_s
*device
)
74 s3c24xx_nand_controller_t
*s3c24xx_info
= device
->controller_priv
;
75 target_t
*target
= s3c24xx_info
->target
;
77 target_write_u32(target
, S3C2410_NFCONF
,
78 S3C2410_NFCONF_EN
| S3C2410_NFCONF_TACLS(3) |
79 S3C2410_NFCONF_TWRPH0(5) | S3C2410_NFCONF_TWRPH1(3));
84 int s3c2410_write_data(struct nand_device_s
*device
, u16 data
)
86 s3c24xx_nand_controller_t
*s3c24xx_info
= device
->controller_priv
;
87 target_t
*target
= s3c24xx_info
->target
;
89 if (target
->state
!= TARGET_HALTED
) {
90 ERROR("target must be halted to use S3C24XX NAND flash controller");
91 return ERROR_NAND_OPERATION_FAILED
;
94 target_write_u32(target
, S3C2410_NFDATA
, data
);
98 int s3c2410_read_data(struct nand_device_s
*device
, void *data
)
100 s3c24xx_nand_controller_t
*s3c24xx_info
= device
->controller_priv
;
101 target_t
*target
= s3c24xx_info
->target
;
103 if (target
->state
!= TARGET_HALTED
) {
104 ERROR("target must be halted to use S3C24XX NAND flash controller");
105 return ERROR_NAND_OPERATION_FAILED
;
108 target_read_u8(target
, S3C2410_NFDATA
, data
);
112 int s3c2410_nand_ready(struct nand_device_s
*device
, int timeout
)
114 s3c24xx_nand_controller_t
*s3c24xx_info
= device
->controller_priv
;
115 target_t
*target
= s3c24xx_info
->target
;
118 if (target
->state
!= TARGET_HALTED
) {
119 ERROR("target must be halted to use S3C24XX NAND flash controller");
120 return ERROR_NAND_OPERATION_FAILED
;
124 target_read_u8(target
, S3C2410_NFSTAT
, &status
);
126 if (status
& S3C2410_NFSTAT_BUSY
)
130 } while (timeout
-- > 0);
Linking to existing account procedure
If you already have an account and want to add another login method
you
MUST first sign in with your existing account and
then change URL to read
https://review.openocd.org/login/?link
to get to this page again but this time it'll work for linking. Thank you.
SSH host keys fingerprints
1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=.. |
|+o.. . |
|*.o . . |
|+B . . . |
|Bo. = o S |
|Oo.+ + = |
|oB=.* = . o |
| =+=.+ + E |
|. .=o . o |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)