summaryrefslogtreecommitdiff
path: root/board/esd/common/lcd.c
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2008-01-13 15:04:37 +0100
committerStefan Roese <sr@denx.de>2008-01-13 15:04:37 +0100
commit8d79953d03e6c5b24215609997dafe4daa623cd6 (patch)
treecb9a4246cde2d32fa600461da008c7d59b57cf4b /board/esd/common/lcd.c
parent47cc23cbe9a669c510183f4f049bf703ef445f3b (diff)
parent2b2f43ed6a30ece77f76191c845ac95267daa31a (diff)
downloadu-boot-imx-8d79953d03e6c5b24215609997dafe4daa623cd6.zip
u-boot-imx-8d79953d03e6c5b24215609997dafe4daa623cd6.tar.gz
u-boot-imx-8d79953d03e6c5b24215609997dafe4daa623cd6.tar.bz2
Merge branch 'master' of /home/stefan/git/u-boot/u-boot
Diffstat (limited to 'board/esd/common/lcd.c')
-rw-r--r--board/esd/common/lcd.c73
1 files changed, 33 insertions, 40 deletions
diff --git a/board/esd/common/lcd.c b/board/esd/common/lcd.c
index 196171c..ed50def 100644
--- a/board/esd/common/lcd.c
+++ b/board/esd/common/lcd.c
@@ -24,6 +24,7 @@
* MA 02111-1307 USA
*/
+#include "asm/io.h"
#include "lcd.h"
@@ -36,43 +37,41 @@ int lcd_depth;
unsigned char *glob_lcd_reg;
unsigned char *glob_lcd_mem;
-#ifdef CFG_LCD_ENDIAN
+#if defined(CFG_LCD_ENDIAN)
void lcd_setup(int lcd, int config)
{
if (lcd == 0) {
/*
* Set endianess and reset lcd controller 0 (small)
*/
- out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_LCD0_RST); /* set reset to low */
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) & ~CFG_LCD0_RST); /* set reset to low */
udelay(10); /* wait 10us */
- if (config == 1) {
- out32(GPIO0_OR, in32(GPIO0_OR) | CFG_LCD_ENDIAN); /* big-endian */
- } else {
- out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_LCD_ENDIAN); /* little-endian */
- }
+ if (config == 1)
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) | CFG_LCD_ENDIAN); /* big-endian */
+ else
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) & ~CFG_LCD_ENDIAN); /* little-endian */
udelay(10); /* wait 10us */
- out32(GPIO0_OR, in32(GPIO0_OR) | CFG_LCD0_RST); /* set reset to high */
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) | CFG_LCD0_RST); /* set reset to high */
} else {
/*
* Set endianess and reset lcd controller 1 (big)
*/
- out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_LCD1_RST); /* set reset to low */
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) & ~CFG_LCD1_RST); /* set reset to low */
udelay(10); /* wait 10us */
- if (config == 1) {
- out32(GPIO0_OR, in32(GPIO0_OR) | CFG_LCD_ENDIAN); /* big-endian */
- } else {
- out32(GPIO0_OR, in32(GPIO0_OR) & ~CFG_LCD_ENDIAN); /* little-endian */
- }
+ if (config == 1)
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) | CFG_LCD_ENDIAN); /* big-endian */
+ else
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) & ~CFG_LCD_ENDIAN); /* little-endian */
udelay(10); /* wait 10us */
- out32(GPIO0_OR, in32(GPIO0_OR) | CFG_LCD1_RST); /* set reset to high */
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) | CFG_LCD1_RST); /* set reset to high */
}
/*
* CFG_LCD_ENDIAN may also be FPGA_RESET, so set inactive
*/
- out32(GPIO0_OR, in32(GPIO0_OR) | CFG_LCD_ENDIAN); /* set reset high again */
+ out_be32((void*)GPIO0_OR, in_be32((void*)GPIO0_OR) | CFG_LCD_ENDIAN); /* set reset high again */
}
-#endif /* #ifdef CFG_LCD_ENDIAN */
+#endif /* CFG_LCD_ENDIAN */
void lcd_bmp(uchar *logo_bmp)
@@ -94,7 +93,6 @@ void lcd_bmp(uchar *logo_bmp)
* Check for bmp mark 'BM'
*/
if (*(ushort *)logo_bmp != 0x424d) {
-
/*
* Decompress bmp image
*/
@@ -104,12 +102,10 @@ void lcd_bmp(uchar *logo_bmp)
printf("Error: malloc in gunzip failed!\n");
return;
}
- if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0) {
+ if (gunzip(dst, CFG_VIDEO_LOGO_MAX_SIZE, (uchar *)logo_bmp, &len) != 0)
return;
- }
- if (len == CFG_VIDEO_LOGO_MAX_SIZE) {
+ if (len == CFG_VIDEO_LOGO_MAX_SIZE)
printf("Image could be truncated (increase CFG_VIDEO_LOGO_MAX_SIZE)!\n");
- }
/*
* Check for bmp mark 'BM'
@@ -152,9 +148,8 @@ void lcd_bmp(uchar *logo_bmp)
break;
default:
printf("LCD: Unknown bpp (%d) im image!\n", bpp);
- if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
+ if ((dst != NULL) && (dst != (uchar *)logo_bmp))
free(dst);
- }
return;
}
printf(" (%d*%d, %dbpp)\n", width, height, bpp);
@@ -164,7 +159,7 @@ void lcd_bmp(uchar *logo_bmp)
*/
if ((colors <= 256) && (lcd_depth <= 8)) {
ptr = (unsigned char *)(dst + 14 + 40);
- for (i=0; i<colors; i++) {
+ for (i = 0; i < colors; i++) {
b = *ptr++;
g = *ptr++;
r = *ptr++;
@@ -179,11 +174,11 @@ void lcd_bmp(uchar *logo_bmp)
ptr = glob_lcd_mem;
ptr2 = (ushort *)glob_lcd_mem;
header_size = 14 + 40 + 4*colors; /* skip bmp header */
- for (y=0; y<height; y++) {
+ for (y = 0; y < height; y++) {
bmp = &dst[(height-1-y)*line_size + header_size];
if (lcd_depth == 16) {
if (bpp == 24) {
- for (x=0; x<width; x++) {
+ for (x = 0; x < width; x++) {
/*
* Generate epson 16bpp fb-format from 24bpp image
*/
@@ -194,7 +189,7 @@ void lcd_bmp(uchar *logo_bmp)
*ptr2++ = val;
}
} else if (bpp == 8) {
- for (x=0; x<line_size; x++) {
+ for (x = 0; x < line_size; x++) {
/* query rgb value from palette */
ptr = (unsigned char *)(dst + 14 + 40) ;
ptr += (*bmp++) << 2;
@@ -206,15 +201,13 @@ void lcd_bmp(uchar *logo_bmp)
}
}
} else {
- for (x=0; x<line_size; x++) {
+ for (x = 0; x < line_size; x++)
*ptr++ = *bmp++;
- }
}
}
- if ((dst != NULL) && (dst != (uchar *)logo_bmp)) {
+ if ((dst != NULL) && (dst != (uchar *)logo_bmp))
free(dst);
- }
}
@@ -229,10 +222,10 @@ void lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
/*
* Detect epson
*/
- lcd_reg[0] = 0x00;
- lcd_reg[1] = 0x00;
+ out_8(&lcd_reg[0], 0x00);
+ out_8(&lcd_reg[1], 0x00);
- if (lcd_reg[0] == 0x1c) {
+ if (in_8(&lcd_reg[0]) == 0x1c) {
/*
* Big epson detected
*/
@@ -241,7 +234,7 @@ void lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
palette_value = 0x1e4;
lcd_depth = 16;
puts("LCD: S1D13806");
- } else if (lcd_reg[1] == 0x1c) {
+ } else if (in_8(&lcd_reg[1]) == 0x1c) {
/*
* Big epson detected (with register swap bug)
*/
@@ -250,7 +243,7 @@ void lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
palette_value = 0x1e5;
lcd_depth = 16;
puts("LCD: S1D13806S");
- } else if (lcd_reg[0] == 0x18) {
+ } else if (in_8(&lcd_reg[0]) == 0x18) {
/*
* Small epson detected (704)
*/
@@ -259,7 +252,7 @@ void lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
palette_value = 0x17;
lcd_depth = 8;
puts("LCD: S1D13704");
- } else if (lcd_reg[0x10000] == 0x24) {
+ } else if (in_8(&lcd_reg[0x10000]) == 0x24) {
/*
* Small epson detected (705)
*/
@@ -277,7 +270,7 @@ void lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
/*
* Setup lcd controller regs
*/
- for (i = 0; i<reg_count; i++) {
+ for (i = 0; i < reg_count; i++) {
s1dReg = regs[i].Index;
if (reg_byte_swap) {
if ((s1dReg & 0x0001) == 0)
@@ -301,7 +294,7 @@ void lcd_init(uchar *lcd_reg, uchar *lcd_mem, S1D_REGS *regs, int reg_count,
lcd_bmp(logo_bmp);
}
-#ifdef CONFIG_VIDEO_SM501
+#if defined(CONFIG_VIDEO_SM501)
int do_esdbmp(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
{
ulong addr;