Skip to contentSkip to conversation

LCD output from decompressor

PATCH andrzej zaborowski 1 participant 1 message Sep 22, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi, thought I would share this.

If you care about the first impression your kernel makes :-) , or your device has no serial ports, you might want to have the decompressor output its messages through LCD, like on a VGA. In this case, use the attached patch. The code is borrowed from the Acorn RiscPC decompressor (rmk) and the other part changes the 8x8 font to a 8x16 one (you can dump half of the patch if 8x8 is ok).

In addition to the patch you will need to make your bootloader prepare the LCDC and add a special ATAG to the boot tags. The tag contains seven 32-bit numbers following the tag header:
framebuffer address in memory (can be any free piece of memory), number of text columns (i.e. LCD width in px / 8)
number of text rows (i.e. LCD height in px / 16)
current cursor position column,
current cursor position row,
character width in px (8),
character height in px (16).

On Palm Tungsten E (320x320 LCD) the bootloader part looks somethine like the following (fb_base is the framebuffer address and fb_end is fb_base + 102910), the whole sequence can be figured out looking at the Linux LCD driver.

   omap_writew(0x0000, 0xfffedb00);
   omap_writew(fb_base >> 16, 0xfffedb04);
   omap_writew(fb_base & 0xffff, 0xfffedb02);
   omap_writew(fb_end >> 16, 0xfffedb08);
   omap_writew(fb_end & 0xffff, 0xfffedb06);
   omap_writel(0x00000000, 0xfffec014);
   omap_writel(0xff300000, 0xfffec00c);
   omap_writel(0x1b070d3f, 0xfffec004);
   omap_writel(0x0708013f, 0xfffec008);
   omap_writel(0x03300004, 0xfffec00c);
   omap_writel(0xfe810c81, 0xfffec000);

Greetings

arch/arm/boot/compressed/Makefile +6 -0
index 1a0ea5d..c8abd44 100644
@@ -9,6 +9,7 @@ OBJS	= misc.o
 FONTC	= drivers/video/console/font_acorn_8x8.c
 
 FONT = $(addprefix ../../../../drivers/video/console/, font_acorn_8x8.o)
+FONT16 = $(addprefix ../../../../drivers/video/console/, font_8x16.o)
 
 #
 # Architecture dependencies
@@ -54,6 +55,10 @@ ifeq ($(CONFIG_MACH_OMAP_PERSEUS2),y)
 OBJS		+= head-omap.o
 endif
 
+ifeq ($(CONFIG_ARCH_OMAP1)$(CONFIG_OMAP_LL_DEBUG_LCD),yy)
+OBJS		+= ll_char_wr.o $(FONT16)
+endif
+
 ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
 OBJS		+= big-endian.o
 endif
@@ -106,6 +111,7 @@ CFLAGS_misc.o := -Dstatic=
 $(obj)/piggy.o:  $(obj)/piggy.gz FORCE
 
 CFLAGS_font_acorn_8x8.o := -Dstatic=
+CFLAGS_font_8x16.o := -Dstatic=
 
 $(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in arch/arm/boot/Makefile .config
 	@sed "$(SEDFLAGS)" < $< > $@
arch/arm/boot/compressed/ll_char_wr.S +5 -5
index 8517c86..1c59377 100644
@@ -24,7 +24,7 @@ #include <asm/assembler.h>
 LC0:	.word	LC0
 	.word	bytes_per_char_h
 	.word	video_size_row
-	.word	acorndata_8x8
+	.word	fontdata_8x16
 	.word	con_charconvtable
 
 /*
@@ -40,7 +40,7 @@ ENTRY(ll_write_char)
 	/*
 	 * calculate offset into character table
 	 */
-	mov	r1, r1, lsl #3
+	mov	r1, r1, lsl #4
 	/*
 	 * calculate offset required for each row.
 	 */
@@ -56,8 +56,8 @@ ENTRY(ll_write_char)
 	 */
 	cmp	r4, #4
 	blt	Lrow1bpp
-	add	r0, r0, r5, lsl #3		@ Move to bottom of character
-	orr	r1, r1, #7
+	add	r0, r0, r5, lsl #4		@ Move to bottom of character
+	orr	r1, r1, #15
 	ldrb	r7, [r6, r1]
 	teq	r4, #8
 	beq	Lrow8bpplp
@@ -99,7 +99,7 @@ Lrow8bpplp:
 	and	ip, r7, #15			@ avoid r4
 	ldr	ip, [lr, ip, lsl #2]		@ avoid r4
 	mul	ip, r2, ip			@ avoid r4
-	tst	r1, #7				@ avoid ip
+	tst	r1, #15				@ avoid ip
 	sub	r0, r0, r5			@ avoid ip
 	stmia	r0, {r4, ip}
 	subne	r1, r1, #1
arch/arm/plat-omap/Kconfig +3 -0
index 75f1494..6ca71ff 100644
@@ -161,6 +161,9 @@ config OMAP_LL_DEBUG_UART2
 config OMAP_LL_DEBUG_UART3
 	bool "UART3"
 
+config OMAP_LL_DEBUG_LCD
+	bool "LCD"
+
 endchoice
 
 config OMAP_SERIAL_WAKE
include/asm-arm/arch-omap/uncompress.h +86 -3

119 lines not on this page · raw message

include/asm-arm/setup.h +15 -2
index b0d181e..17fa698 100644
@@ -135,7 +135,7 @@ struct tag_acorn {
 };
 
 /* TI OMAP specific information */
-#define ATAG_BOARD       0x414f4d50
+#define ATAG_BOARD	0x414f4d50
 
 struct tag_omap {
 	u8 data[0];
@@ -148,6 +148,18 @@ struct tag_memclk {
 	u32 fmemclk;
 };
 
+#define ATAG_FB		0xfbfbfbfb
+
+struct tag_fb {
+	u8 *fb_address;
+	unsigned long video_num_cols;
+	unsigned long video_num_rows;
+	unsigned long video_x;
+	unsigned long video_y;
+	unsigned long bytes_per_char_h;
+	unsigned long bytes_per_char_v;
+};
+
 struct tag {
 	struct tag_header hdr;
 	union {
@@ -169,7 +181,8 @@ struct tag {
 		/*
 		 * OMAP specific
                  */
-                struct tag_omap         omap;
+                struct tag_omap		omap;
+                struct tag_fb		fb;
 
 		/*
 		 * DC21285 specific