summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/flagadm/flash.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/board/flagadm/flash.c b/board/flagadm/flash.c
index bbefbacea9..a69b1a4e97 100644
--- a/board/flagadm/flash.c
+++ b/board/flagadm/flash.c
@@ -528,11 +528,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 +550,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)