public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers:lcd: fix unaligned access on lcd
@ 2013-05-24  7:46 Piotr Wilczek
  2013-05-24 18:33 ` Wolfgang Denk
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Piotr Wilczek @ 2013-05-24  7:46 UTC (permalink / raw)
  To: u-boot

This patch replace 'le32_to_cpu' function with 'get_unaligend_le32' to
avoid unaligned access exception on some ARM platforms (ex Trats2).

Signed-off-by: Piotr Wilczek <p.wilczek@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
CC: Minkyu Kang <mk7.kang@samsung.com>
CC: Anatolij Gustschin <agust@denx.de>
---
 common/lcd.c |   12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/common/lcd.c b/common/lcd.c
index edae835..577a452 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -42,6 +42,7 @@
 #endif
 #include <lcd.h>
 #include <watchdog.h>
+#include <asm/unaligned.h>
 
 #if defined(CONFIG_CPU_PXA25X) || defined(CONFIG_CPU_PXA27X) || \
 	defined(CONFIG_CPU_MONAHANS)
@@ -907,9 +908,9 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 		return 1;
 	}
 
-	width = le32_to_cpu(bmp->header.width);
-	height = le32_to_cpu(bmp->header.height);
-	bmp_bpix = le16_to_cpu(bmp->header.bit_count);
+	width = get_unaligned_le32(&bmp->header.width);
+	height = get_unaligned_le32(&bmp->header.height);
+	bmp_bpix = get_unaligned_le32(&bmp->header.bit_count);
 	colors = 1 << bmp_bpix;
 
 	bpix = NBITS(panel_info.vl_bpix);
@@ -994,7 +995,7 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	if ((y + height) > panel_info.vl_row)
 		height = panel_info.vl_row - y;
 
-	bmap = (uchar *) bmp + le32_to_cpu(bmp->header.data_offset);
+	bmap = (uchar *)bmp + get_unaligned_le32(&bmp->header.data_offset);
 	fb   = (uchar *) (lcd_base +
 		(y + height - 1) * lcd_line_length + x * bpix / 8);
 
@@ -1002,7 +1003,8 @@ int lcd_display_bitmap(ulong bmp_image, int x, int y)
 	case 1: /* pass through */
 	case 8:
 #ifdef CONFIG_LCD_BMP_RLE8
-		if (le32_to_cpu(bmp->header.compression) == BMP_BI_RLE8) {
+		if (get_unaligned_le32(&bmp->header.compression) ==
+		    BMP_BI_RLE8) {
 			if (bpix != 16) {
 				/* TODO implement render code for bpix != 16 */
 				printf("Error: only support 16 bpix");
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-07-01 18:51 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24  7:46 [U-Boot] [PATCH] drivers:lcd: fix unaligned access on lcd Piotr Wilczek
2013-05-24 18:33 ` Wolfgang Denk
2013-05-27 11:35   ` Piotr Wilczek
2013-05-28  6:10     ` Nikita Kiryanov
2013-05-24 18:41 ` Jeroen Hofstee
2013-05-31 11:26 ` [U-Boot] [PATCH] lcd: align bmp header when uncopmressing image Piotr Wilczek
2013-05-31 14:22   ` Wolfgang Denk
2013-06-03  6:17     ` Piotr Wilczek
2013-06-03 11:15       ` Wolfgang Denk
2013-06-03 14:14         ` Piotr Wilczek
2013-06-03 18:45           ` Wolfgang Denk
2013-06-02 11:05   ` Nikita Kiryanov
2013-06-03  6:39     ` Piotr Wilczek
2013-06-03 11:18       ` Wolfgang Denk
2013-06-03 13:59   ` [U-Boot] [PATCH V2] " Piotr Wilczek
2013-06-03 18:44     ` Wolfgang Denk
2013-06-04 11:00     ` [U-Boot] [PATCH V3] " Piotr Wilczek
2013-06-04 15:05       ` Wolfgang Denk
2013-06-05  6:14       ` [U-Boot] [PATCH V4] " Piotr Wilczek
2013-07-01 18:51         ` Anatolij Gustschin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox