]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/flagadm/flash.c
boards.cfg: move boards with invalid emails to Orphan
[karo-tx-uboot.git] / board / flagadm / flash.c
index bbefbacea95fed867b3e0f01b79ac75ad649d73a..46a2c9a2667e0f3cbfd3e2ac30bac390fa2512b9 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2001
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -528,11 +512,17 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
        ulong start;
        char csr;
        int flag;
-       ushort * d = (ushort*)&da;
        int i;
+       union {
+               u32 data32;
+               u16 data16[2];
+       } data;
+
+       data.data32 = da;
 
        /* Check if Flash is (sufficiently) erased */
-       if (((*addr & d[0]) != d[0]) || ((*(addr+1) & d[1]) != d[1])) {
+       if (((*addr & data.data16[0]) != data.data16[0]) ||
+           ((*(addr+1) & data.data16[1]) != data.data16[1])) {
                return (2);
        }
        /* Disable interrupts which might cause a timeout here */
@@ -544,7 +534,7 @@ int write_word (flash_info_t *info, ulong dest, ulong da)
                *addr = 0x0010;
 
                /* Write Data */
-               *addr = d[i];
+               *addr = data.data16[i];
 
                /* re-enable interrupts if necessary */
                if (flag)