diff --git a/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c
index f2c3e79799616ea4cb6c7be67490ae235c14e80e..4ead5336c65350a94d226a8017b9d3bf9a14de3b 100644
--- a/board/atmel/atngw100/atngw100.c
+++ b/board/atmel/atngw100/atngw100.c
@@ -81,7 +81,7 @@ phys_size_t initdram(int board_type)
 	unmap_physmem(sdram_base, EBI_SDRAM_SIZE);
 
 	if (expected_size != actual_size)
-		printf("Warning: Only %u of %u MiB SDRAM is working\n",
+		printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
 				actual_size >> 20, expected_size >> 20);
 
 	return actual_size;
diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c
index 6371e2d4e3acb1f13ecb481d1d88d5eb1bba0bcf..d284fc1438adb9531d1c28222252ef905176d30d 100644
--- a/board/atmel/atstk1000/atstk1000.c
+++ b/board/atmel/atstk1000/atstk1000.c
@@ -104,7 +104,7 @@ phys_size_t initdram(int board_type)
 	unmap_physmem(sdram_base, EBI_SDRAM_SIZE);
 
 	if (expected_size != actual_size)
-		printf("Warning: Only %u of %u MiB SDRAM is working\n",
+		printf("Warning: Only %lu of %lu MiB SDRAM is working\n",
 				actual_size >> 20, expected_size >> 20);
 
 	return actual_size;
diff --git a/board/atmel/atstk1000/flash.c b/board/atmel/atstk1000/flash.c
index 12537f3142ec4e1d655401c838fb5d8331cd9a52..e2bfd4aff27f79e322206b8d922bfe442497dbef 100644
--- a/board/atmel/atstk1000/flash.c
+++ b/board/atmel/atstk1000/flash.c
@@ -70,7 +70,7 @@ unsigned long flash_init(void)
 
 void flash_print_info(flash_info_t *info)
 {
-	printf("Flash: Vendor ID: 0x%02x, Product ID: 0x%02x\n",
+	printf("Flash: Vendor ID: 0x%02lx, Product ID: 0x%02lx\n",
 	       info->flash_id >> 16, info->flash_id & 0xffff);
 	printf("Size: %ld MB in %d sectors\n",
 	       info->size >> 10, info->sector_count);
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
index 72ad49e5e2d8d266f986f3b17bb1b52441a130a1..4f6970448b83a220f0e8fa31e623fd629cd96359 100644
--- a/include/asm-avr32/sysreg.h
+++ b/include/asm-avr32/sysreg.h
@@ -273,7 +273,9 @@
 	 | SYSREG_BF(name,value))
 
 /* Register access macros */
-#define sysreg_read(reg)		__builtin_mfsr(SYSREG_##reg)
-#define sysreg_write(reg, value)	__builtin_mtsr(SYSREG_##reg, value)
+#define sysreg_read(reg)				\
+	((unsigned long)__builtin_mfsr(SYSREG_##reg))
+#define sysreg_write(reg, value)			\
+	__builtin_mtsr(SYSREG_##reg, value)
 
 #endif /* __ASM_AVR32_SYSREG_H__ */