NOR/CFI: identify memory accesses not using "bus_width".
authorAntonio Borneo <borneo.antonio@gmail.com>
Tue, 20 Apr 2010 04:15:49 +0000 (12:15 +0800)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Sun, 16 May 2010 11:39:47 +0000 (13:39 +0200)
Since NOR flash devices does not handle "byte enable lanes",
each read/write access involves the whole "chip_width".
When multiple devices are in parallel, usually all chips are
enabled during each access.
All such cases are compatible with flash accesses at
"bus_width" size.

Access at "bus_width" size is mandatory for write access to
avoid transferring of garbage values to flash.
During read access the flash controller should take care,
and discard unneeded bytes. Anyway, it is good practice to
use "bus_width" size also for read.

Every memory access that does not respect "bus_width" size
is marked with a "FIXME" comment.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
src/flash/nor/cfi.c

index f2ea947ad3d61b32ae610c8d722650f6c5a57acd..ca2fb0bb8df717c4a5fed746e9d14a41e57b0f4e 100644 (file)
@@ -1871,6 +1871,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset,
                for (i = 0; i < align; ++i, ++copy_p)
                {
                        uint8_t byte;
+                       /* FIXME: access flash at bus_width size */
                        if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
                        {
                                return retval;
@@ -1890,6 +1891,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset,
                for (; (count == 0) && (i < bank->bus_width); ++i, ++copy_p)
                {
                        uint8_t byte;
+                       /* FIXME: access flash at bus_width size */
                        if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
                        {
                                return retval;
@@ -2005,6 +2007,7 @@ static int cfi_write(struct flash_bank *bank, uint8_t *buffer, uint32_t offset,
                for (; i < bank->bus_width; ++i, ++copy_p)
                {
                        uint8_t byte;
+                       /* FIXME: access flash at bus_width size */
                        if ((retval = target_read_memory(target, copy_p, 1, 1, &byte)) != ERROR_OK)
                        {
                                return retval;
@@ -2137,10 +2140,12 @@ static int cfi_probe(struct flash_bank *bank)
        if (bank->chip_width == 1)
        {
                uint8_t manufacturer, device_id;
+               /* FIXME: access flash at bus_width size */
                if ((retval = target_read_u8(target, flash_address(bank, 0, 0x00), &manufacturer)) != ERROR_OK)
                {
                        return retval;
                }
+               /* FIXME: access flash at bus_width size */
                if ((retval = target_read_u8(target, flash_address(bank, 0, 0x01), &device_id)) != ERROR_OK)
                {
                        return retval;
@@ -2150,10 +2155,12 @@ static int cfi_probe(struct flash_bank *bank)
        }
        else if (bank->chip_width == 2)
        {
+               /* FIXME: access flash at bus_width size */
                if ((retval = target_read_u16(target, flash_address(bank, 0, 0x00), &cfi_info->manufacturer)) != ERROR_OK)
                {
                        return retval;
                }
+               /* FIXME: access flash at bus_width size */
                if ((retval = target_read_u16(target, flash_address(bank, 0, 0x01), &cfi_info->device_id)) != ERROR_OK)
                {
                        return retval;
@@ -2543,6 +2550,7 @@ struct flash_driver cfi_flash = {
        .write = cfi_write,
        .probe = cfi_probe,
        .auto_probe = cfi_auto_probe,
+       /* FIXME: access flash at bus_width size */
        .erase_check = default_flash_blank_check,
        .protect_check = cfi_protect_check,
        .info = cfi_info,

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)