Bug 58150 - AT91 flash driver inconsistencies
AT91 flash driver inconsistencies
Status: CLOSED WONTFIX
Product: eCos
Classification: Retired
Component: Flash driver (Show other bugs)
CVS
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: eCos bugs internal list
eCos bugs internal list
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-01-10 01:52 EST by Jesper Skov
Modified: 2007-04-18 12:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-06-20 12:10:46 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jesper Skov 2002-01-10 01:53:00 EST
Gary,

Thanks for doing the Atmel AT91/EB40 work in Ecos.  I've noticed some
inconsistencies in flash_program_buf.c

Below is a copy of devs/flash/arm/at91/current/src/flash_program_buf.c
with some notes.

-Tim


int
flash_program_buf(volatile unsigned short *addr, unsigned short *data, int len)
{
    volatile unsigned short *PAGE, *ROM;
    int timeout = 50000;
    int cache_on;
    int i, offset;
    unsigned short hold[FLASH_PAGE_SIZE/2];

    HAL_DCACHE_IS_ENABLED(cache_on);
    if (cache_on) {
        HAL_DCACHE_SYNC();
        HAL_DCACHE_DISABLE();
    }

#
# If len must == FLASH_PAGE_SIZE, then you can't do "partial updates."
#
    if (len != FLASH_PAGE_SIZE) {
        return FLASH_LENGTH_ERROR;
    }

    ROM = (volatile unsigned short *)((unsigned long)addr & 0xFFFF0000);
    PAGE = (volatile unsigned short *)((unsigned long)addr & FLASH_PAGE_MASK);

#
# Seems to want to allow "partial updates."
#
    // Copy current contents (allows for partial updates)
    for (i = 0;  i < FLASH_PAGE_SIZE/2;  i++) {
        hold[i] = PAGE[i];
    }

#
# For the merge, a partial update where offset != 0, will
# cause the coping will run off the end of both arrays. :-(
# Unless len < FLASH_PAGE_SIZE - offset.  Maybe this test on len should
# replace the one above????
#
    // Merge data into holding buffer
    offset = (unsigned long)addr & FLASH_PAGE_OFFSET;
    for (i = 0;  i < (len/2);  i++) {
        hold[offset+i] = data[i];
    }

    // Now write the data

    // Send lead-in sequence
    ROM[FLASH_Key_Addr0] = FLASH_Key0;
    ROM[FLASH_Key_Addr1] = FLASH_Key1;

etc
Comment 1 Alex Schuilenburg 2003-06-20 12:10:46 EDT
This bug has moved to http://bugs.ecos.sourceware.org/show_bug.cgi?id=58150

Note You need to log in before you can comment on or make changes to this bug.