From ac682a0749c3e007956e510e13f3ae10eac88297 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E9=BB=84=E6=B6=9B?= Date: Thu, 12 May 2011 19:12:58 +0800 Subject: [PATCH] rk29: pl330: avoid unaligned accesses --- arch/arm/common/pl330.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c index 27098b722da2..8bc5c6a89138 100644 --- a/arch/arm/common/pl330.c +++ b/arch/arm/common/pl330.c @@ -28,6 +28,7 @@ #include #include +#include #include /* Register and Bit field Definitions */ @@ -394,7 +395,7 @@ static inline u32 _emit_ADDH(unsigned dry_run, u8 buf[], buf[0] = CMD_DMAADDH; buf[0] |= (da << 1); - *((u16 *)&buf[1]) = val; + put_unaligned(val, (u16 *)&buf[1]); //*((u16 *)&buf[1]) = val; PL330_DBGCMD_DUMP(SZ_DMAADDH, "\tDMAADDH %s %u\n", da == 1 ? "DA" : "SA", val); @@ -548,7 +549,7 @@ static inline u32 _emit_MOV(unsigned dry_run, u8 buf[], buf[0] = CMD_DMAMOV; buf[1] = dst; - *((u32 *)&buf[2]) = val; + put_unaligned(val, (u32 *)&buf[2]); //*((u32 *)&buf[2]) = val; PL330_DBGCMD_DUMP(SZ_DMAMOV, "\tDMAMOV %s 0x%x\n", dst == SAR ? "SAR" : (dst == DAR ? "DAR" : "CCR"), val); @@ -726,7 +727,7 @@ static inline u32 _emit_GO(unsigned dry_run, u8 buf[], buf[1] = chan & 0x7; - *((u32 *)&buf[2]) = addr; + put_unaligned(addr, (u32 *)&buf[2]); //*((u32 *)&buf[2]) = addr; return SZ_DMAGO; } -- 2.34.1