This is an automated email from Gerrit.

Jens Bauer ([email protected]) just uploaded a new patch set to Gerrit, which you 
can find at http://openocd.zylin.com/1728

-- gerrit

commit f8c24d14ce8bdc4c99389e37d460ef66c96b0a26
Author: Jens Bauer <[email protected]>
Date:   Thu Oct 24 04:19:38 2013 +0200

    lpc43xx/lpc1773: SPIFI can now be flash-programmed from Big Endian 
platforms.
    
    On Big Endian architectures, such as PowerMac (PPC-based), the flash ID was 
byte-reversed.
    This resulted in that parts could not be flash-programmed.
    The fix avoids byte-access into 32-bit integers.
    
    Change-Id: Ie946ed58c1566a0ea1f595ab659971a7d4e35246
    Signed-off-by: Jens Bauer <[email protected]>

diff --git a/src/flash/nor/lpcspifi.c b/src/flash/nor/lpcspifi.c
index 0c12e64..b2882e4 100644
--- a/src/flash/nor/lpcspifi.c
+++ b/src/flash/nor/lpcspifi.c
@@ -774,8 +774,11 @@ static int lpcspifi_read_flash_id(struct flash_bank *bank, 
uint32_t *id)
        uint32_t ssp_base = lpcspifi_info->ssp_base;
        uint32_t io_base = lpcspifi_info->io_base;
        uint32_t value;
+       uint32_t id_val;
        int retval;
 
+       id_val = *id & 0xff000000;
+
        if (target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
                return ERROR_TARGET_NOT_HALTED;
@@ -808,7 +811,7 @@ static int lpcspifi_read_flash_id(struct flash_bank *bank, 
uint32_t *id)
        if (retval == ERROR_OK)
                retval = ssp_read_reg(target, ssp_base, SSP_DATA, &value);
        if (retval == ERROR_OK)
-               ((uint8_t *)id)[0] = value;
+               id_val |= value;
 
        /* Dummy write to clock in data */
        if (retval == ERROR_OK)
@@ -818,7 +821,7 @@ static int lpcspifi_read_flash_id(struct flash_bank *bank, 
uint32_t *id)
        if (retval == ERROR_OK)
                retval = ssp_read_reg(target, ssp_base, SSP_DATA, &value);
        if (retval == ERROR_OK)
-               ((uint8_t *)id)[1] = value;
+               id_val |= value << 8;
 
        /* Dummy write to clock in data */
        if (retval == ERROR_OK)
@@ -828,7 +831,9 @@ static int lpcspifi_read_flash_id(struct flash_bank *bank, 
uint32_t *id)
        if (retval == ERROR_OK)
                retval = ssp_read_reg(target, ssp_base, SSP_DATA, &value);
        if (retval == ERROR_OK)
-               ((uint8_t *)id)[2] = value;
+               id_val |= value << 16;
+
+       *id = id_val;
 
        if (retval == ERROR_OK)
                retval = ssp_setcs(target, io_base, 1);

-- 

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135991&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to