[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH 6/6] xen/arm: introduce a driver for the ARM HDLCD controller
At 18:19 +0000 on 05 Dec (1354731588), Stefano Stabellini wrote: > For the moment the resolution is hardcoded to 1280x1024@60. > Use the generic framebuffer functions to print on the screen. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > --- > xen/arch/arm/Rules.mk | 1 + > xen/drivers/video/Makefile | 1 + > xen/drivers/video/arm_hdlcd.c | 165 > +++++++++++++++++++++++++++++++++++++++++ > xen/include/asm-arm/config.h | 3 + > 4 files changed, 170 insertions(+), 0 deletions(-) > create mode 100644 xen/drivers/video/arm_hdlcd.c > > diff --git a/xen/arch/arm/Rules.mk b/xen/arch/arm/Rules.mk > index fa9f9c1..9580e6b 100644 > --- a/xen/arch/arm/Rules.mk > +++ b/xen/arch/arm/Rules.mk > @@ -8,6 +8,7 @@ > > HAS_DEVICE_TREE := y > HAS_VIDEO := y > +HAS_ARM_HDLCD := y > > CFLAGS += -fno-builtin -fno-common -Wredundant-decls > CFLAGS += -iwithprefix include -Werror -Wno-pointer-arith -pipe > diff --git a/xen/drivers/video/Makefile b/xen/drivers/video/Makefile > index 3b3eb43..8a6f5da 100644 > --- a/xen/drivers/video/Makefile > +++ b/xen/drivers/video/Makefile > @@ -4,3 +4,4 @@ obj-$(HAS_VIDEO) += font_8x16.o > obj-$(HAS_VIDEO) += font_8x8.o > obj-$(HAS_VIDEO) += fb.o > obj-$(HAS_VGA) += vesa.o > +obj-$(HAS_ARM_HDLCD) += arm_hdlcd.o > diff --git a/xen/drivers/video/arm_hdlcd.c b/xen/drivers/video/arm_hdlcd.c > new file mode 100644 > index 0000000..68f588c > --- /dev/null > +++ b/xen/drivers/video/arm_hdlcd.c > @@ -0,0 +1,165 @@ > +/* > + * xen/drivers/video/arm_hdlcd.c > + * > + * Driver for ARM HDLCD Controller > + * > + * Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > + * Copyright (c) 2012 Citrix Systems. > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License as published by > + * the Free Software Foundation; either version 2 of the License, or > + * (at your option) any later version. > + * > + * This program is distributed in the hope that it will be useful, > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + * GNU General Public License for more details. > + */ > + > +#include <asm/delay.h> > +#include <asm/types.h> > +#include <xen/config.h> > +#include <xen/device_tree.h> > +#include <xen/libfdt/libfdt.h> > +#include <xen/init.h> > +#include <xen/mm.h> > +#include "font.h" > +#include "fb.h" > + > +#define HDLCD ((volatile uint32_t *) FIXMAP_ADDR(FIXMAP_MISC)) > + > +#define HDLCD_INTMASK (0x18/4) > +#define HDLCD_FBBASE (0x100/4) > +#define HDLCD_LINELENGTH (0x104/4) > +#define HDLCD_LINECOUNT (0x108/4) > +#define HDLCD_LINEPITCH (0x10C/4) > +#define HDLCD_BUS (0x110/4) > +#define HDLCD_VSYNC (0x200/4) > +#define HDLCD_VBACK (0x204/4) > +#define HDLCD_VDATA (0x208/4) > +#define HDLCD_VFRONT (0x20C/4) > +#define HDLCD_HSYNC (0x210/4) > +#define HDLCD_HBACK (0x214/4) > +#define HDLCD_HDATA (0x218/4) > +#define HDLCD_HFRONT (0x21C/4) > +#define HDLCD_POLARITIES (0x220/4) > +#define HDLCD_COMMAND (0x230/4) > +#define HDLCD_PF (0x240/4) > +#define HDLCD_RED (0x244/4) > +#define HDLCD_GREEN (0x248/4) > +#define HDLCD_BLUE (0x24C/4) > + > +#define BPP 4 > +#define XRES 1280 > +#define YRES 1024 > +#define refresh 60 > +#define pixclock 108 /* in Mhz, needs to be set in the board config > for OSC5 */ > +#define left_margin 80 > +#define hback left_margin > +#define right_margin 48 > +#define hfront right_margin > +#define upper_margin 21 > +#define vback upper_margin > +#define lower_margin 3 > +#define vfront lower_margin > +#define hsync_len 32 > +#define vsync_len 6 > + > +#define HDLCD_SIZE (XRES*YRES*BPP) > + > +static void vga_noop_puts(const char *s) {} > +void (*video_puts)(const char *) = vga_noop_puts; > + > +static void hdlcd_flush(void) > +{ > + dsb(); > +} > + > +void __init video_init(void) > +{ > + int node, depth; > + u32 address_cells, size_cells; > + struct fb_prop fbp; > + unsigned char *lfb = (unsigned char *) VRAM_VIRT_START; > + paddr_t hdlcd_start, hdlcd_size; > + paddr_t framebuffer_start, framebuffer_size; > + const struct fdt_property *prop; > + const u32 *cell; > + > + if ( find_compatible_node("arm,hdlcd", &node, &depth, > + &address_cells, &size_cells) <= 0 ) > + return; > + > + prop = fdt_get_property(device_tree_flattened, node, "reg", NULL); > + if ( !prop ) > + return; > + > + cell = (const u32 *)prop->data; > + device_tree_get_reg(&cell, address_cells, size_cells, > + &hdlcd_start, &hdlcd_size); > + > + prop = fdt_get_property(device_tree_flattened, node, "framebuffer", > NULL); > + if ( !prop ) > + return; > + > + cell = (const u32 *)prop->data; > + device_tree_get_reg(&cell, address_cells, size_cells, > + &framebuffer_start, &framebuffer_size); > + > + if ( !hdlcd_start || !framebuffer_start ) > + return; > + > + printk("Initializing HDLCD driver\n"); > + > + map_phys_range(framebuffer_start, > + framebuffer_start + framebuffer_size, > + VRAM_VIRT_START, DEV_WC); > + memset(lfb, 0x00, HDLCD_SIZE); This needs some checks that framebuffer_size >= HDLCD_SIZE, and that framebuffer_size <= XENHEAP_VIRT_START - VRAM_VIRT_START. > + set_fixmap(FIXMAP_MISC, hdlcd_start >> PAGE_SHIFT, DEV_SHARED); > + HDLCD[HDLCD_COMMAND] = 0; > + > + HDLCD[HDLCD_LINELENGTH] = XRES * BPP; > + HDLCD[HDLCD_LINECOUNT] = YRES - 1; > + HDLCD[HDLCD_LINEPITCH] = XRES * BPP; > + HDLCD[HDLCD_PF] = ((BPP - 1) << 3); > + HDLCD[HDLCD_INTMASK] = 0; > + HDLCD[HDLCD_FBBASE] = framebuffer_start; > + HDLCD[HDLCD_BUS] = 0xf00|(1<<4); > + HDLCD[HDLCD_VBACK] = upper_margin - 1; > + HDLCD[HDLCD_VSYNC] = vsync_len - 1; > + HDLCD[HDLCD_VDATA] = YRES - 1; > + HDLCD[HDLCD_VFRONT] = lower_margin - 1; > + HDLCD[HDLCD_HBACK] = left_margin - 1; > + HDLCD[HDLCD_HSYNC] = hsync_len - 1; > + HDLCD[HDLCD_HDATA] = XRES - 1; > + HDLCD[HDLCD_HFRONT] = right_margin - 1; > + HDLCD[HDLCD_POLARITIES] = (1<<2)|(1<<3); > + HDLCD[HDLCD_RED] = (8<<8)|0; > + HDLCD[HDLCD_GREEN] = (8<<8)|8; > + HDLCD[HDLCD_BLUE] = (8<<8)|16; > + > + HDLCD[HDLCD_COMMAND] = 1; > + clear_fixmap(FIXMAP_MISC); > + > + fbp.lfb = lfb; > + fbp.font = &font_vga_8x16; > + fbp.pixel_on = 0xffffff; > + fbp.bits_per_pixel = BPP*8; > + fbp.bytes_per_line = BPP*XRES; > + fbp.width = XRES; > + fbp.height = YRES; > + fbp.flush = hdlcd_flush; > + fbp.text_columns = XRES / 8; > + fbp.text_rows = YRES / 16; > + if ( fb_init(fbp) < 0 ) > + return; > + video_puts = fb_scroll_puts; > +} > + > +void video_endboot(void) > +{ > + if ( video_puts != vga_noop_puts ) > + fb_alloc(); > +} > diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h > index 2a05539..9727562 100644 > --- a/xen/include/asm-arm/config.h > +++ b/xen/include/asm-arm/config.h > @@ -19,6 +19,8 @@ > > #define CONFIG_DOMAIN_PAGE 1 > > +#define CONFIG_VIDEO 1 > + > #define OPT_CONSOLE_STR "com1" > > #ifdef MAX_PHYS_CPUS > @@ -73,6 +75,7 @@ > #define FIXMAP_ADDR(n) (mk_unsigned_long(0x00400000) + (n) * > PAGE_SIZE) > #define BOOT_MISC_VIRT_START mk_unsigned_long(0x00600000) > #define FRAMETABLE_VIRT_START mk_unsigned_long(0x02000000) > +#define VRAM_VIRT_START mk_unsigned_long(0x10000000) Please update the comments above to reflect this change. Cheers, Tim. > #define XENHEAP_VIRT_START mk_unsigned_long(0x40000000) > #define DOMHEAP_VIRT_START mk_unsigned_long(0x80000000) > > -- > 1.7.2.5 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > http://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |