diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/Makefile | 2 | ||||
-rw-r--r-- | common/board_f.c | 71 | ||||
-rw-r--r-- | common/cmd_bmp.c | 37 | ||||
-rw-r--r-- | common/cmd_i2c.c | 6 | ||||
-rw-r--r-- | common/fdt_support.c | 16 | ||||
-rw-r--r-- | common/lcd.c | 11 | ||||
-rw-r--r-- | common/stdio.c | 19 | ||||
-rw-r--r-- | common/usb_storage.c | 1 |
8 files changed, 99 insertions, 64 deletions
diff --git a/common/Makefile b/common/Makefile index 2a1d9f8..2492275 100644 --- a/common/Makefile +++ b/common/Makefile @@ -205,7 +205,9 @@ obj-$(CONFIG_I2C_EDID) += edid.o obj-$(CONFIG_KALLSYMS) += kallsyms.o obj-y += splash.o obj-$(CONFIG_SPLASH_SOURCE) += splash_source.o +ifndef CONFIG_DM_VIDEO obj-$(CONFIG_LCD) += lcd.o lcd_console.o +endif obj-$(CONFIG_LCD_ROTATION) += lcd_console_rotation.o obj-$(CONFIG_LCD_DT_SIMPLEFB) += lcd_simplefb.o obj-$(CONFIG_LYNXKDI) += lynxkdi.o diff --git a/common/board_f.c b/common/board_f.c index 8094ac4..c470b59 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -46,6 +46,7 @@ #include <spi.h> #include <status_led.h> #include <trace.h> +#include <video.h> #include <watchdog.h> #include <asm/errno.h> #include <asm/io.h> @@ -437,36 +438,41 @@ static int reserve_mmu(void) } #endif -#ifdef CONFIG_LCD +#ifdef CONFIG_DM_VIDEO +static int reserve_video(void) +{ + ulong addr; + int ret; + + addr = gd->relocaddr; + ret = video_reserve(&addr); + if (ret) + return ret; + gd->relocaddr = addr; + + return 0; +} +#else + +# ifdef CONFIG_LCD static int reserve_lcd(void) { -#ifdef CONFIG_FB_ADDR +# ifdef CONFIG_FB_ADDR gd->fb_base = CONFIG_FB_ADDR; -#else +# else /* reserve memory for LCD display (always full pages) */ gd->relocaddr = lcd_setmem(gd->relocaddr); gd->fb_base = gd->relocaddr; -#endif /* CONFIG_FB_ADDR */ - return 0; -} -#endif /* CONFIG_LCD */ - -static int reserve_trace(void) -{ -#ifdef CONFIG_TRACE - gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE; - gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE); - debug("Reserving %dk for trace data at: %08lx\n", - CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr); -#endif +# endif /* CONFIG_FB_ADDR */ return 0; } +# endif /* CONFIG_LCD */ -#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ +# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K) -static int reserve_video(void) +static int reserve_legacy_video(void) { /* reserve memory for video display (always full pages) */ gd->relocaddr = video_setmem(gd->relocaddr); @@ -474,8 +480,21 @@ static int reserve_video(void) return 0; } +# endif +#endif /* !CONFIG_DM_VIDEO */ + +static int reserve_trace(void) +{ +#ifdef CONFIG_TRACE + gd->relocaddr -= CONFIG_TRACE_BUFFER_SIZE; + gd->trace_buff = map_sysmem(gd->relocaddr, CONFIG_TRACE_BUFFER_SIZE); + debug("Reserving %dk for trace data at: %08lx\n", + CONFIG_TRACE_BUFFER_SIZE >> 10, gd->relocaddr); #endif + return 0; +} + static int reserve_uboot(void) { /* @@ -957,16 +976,20 @@ static init_fnc_t init_sequence_f[] = { defined(CONFIG_ARM) reserve_mmu, #endif -#ifdef CONFIG_LCD +#ifdef CONFIG_DM_VIDEO + reserve_video, +#else +# ifdef CONFIG_LCD reserve_lcd, -#endif - reserve_trace, +# endif /* TODO: Why the dependency on CONFIG_8xx? */ -#if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ +# if defined(CONFIG_VIDEO) && (!defined(CONFIG_PPC) || defined(CONFIG_8xx)) && \ !defined(CONFIG_ARM) && !defined(CONFIG_X86) && \ !defined(CONFIG_BLACKFIN) && !defined(CONFIG_M68K) - reserve_video, -#endif + reserve_legacy_video, +# endif +#endif /* CONFIG_DM_VIDEO */ + reserve_trace, #if !defined(CONFIG_BLACKFIN) reserve_uboot, #endif diff --git a/common/cmd_bmp.c b/common/cmd_bmp.c index cb1f071..fd5b7db 100644 --- a/common/cmd_bmp.c +++ b/common/cmd_bmp.c @@ -10,11 +10,14 @@ */ #include <common.h> +#include <dm.h> #include <lcd.h> +#include <mapmem.h> #include <bmp_layout.h> #include <command.h> #include <asm/byteorder.h> #include <malloc.h> +#include <mapmem.h> #include <splash.h> #include <video.h> @@ -57,7 +60,8 @@ struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, /* align to 32-bit-aligned-address + 2 */ bmp = (struct bmp_image *)((((unsigned int)dst + 1) & ~3) + 2); - if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, (uchar *)addr, &len) != 0) { + if (gunzip(bmp, CONFIG_SYS_VIDEO_LOGO_MAX_SIZE, map_sysmem(addr, 0), + &len) != 0) { free(dst); return NULL; } @@ -187,7 +191,7 @@ U_BOOT_CMD( */ static int bmp_info(ulong addr) { - struct bmp_image *bmp = (struct bmp_image *)addr; + struct bmp_image *bmp = (struct bmp_image *)map_sysmem(addr, 0); void *bmp_alloc_addr = NULL; unsigned long len; @@ -223,8 +227,11 @@ static int bmp_info(ulong addr) */ int bmp_display(ulong addr, int x, int y) { +#ifdef CONFIG_DM_VIDEO + struct udevice *dev; +#endif int ret; - struct bmp_image *bmp = (struct bmp_image *)addr; + struct bmp_image *bmp = map_sysmem(addr, 0); void *bmp_alloc_addr = NULL; unsigned long len; @@ -236,11 +243,27 @@ int bmp_display(ulong addr, int x, int y) printf("There is no valid bmp file at the given address\n"); return 1; } - -#if defined(CONFIG_LCD) - ret = lcd_display_bitmap((ulong)bmp, x, y); + addr = map_to_sysmem(bmp); + +#ifdef CONFIG_DM_VIDEO + ret = uclass_first_device(UCLASS_VIDEO, &dev); + if (!ret) { + if (!dev) + ret = -ENODEV; + if (!ret) { + bool align = false; + +# ifdef CONFIG_SPLASH_SCREEN_ALIGN + align = true; +# endif /* CONFIG_SPLASH_SCREEN_ALIGN */ + ret = video_bmp_display(dev, addr, x, y, align); + } + } + return ret ? CMD_RET_FAILURE : 0; +#elif defined(CONFIG_LCD) + ret = lcd_display_bitmap(addr, x, y); #elif defined(CONFIG_VIDEO) - ret = video_display_bitmap((unsigned long)bmp, x, y); + ret = video_display_bitmap(addr, x, y); #else # error bmp_display() requires CONFIG_LCD or CONFIG_VIDEO #endif diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index 552c875..b3bb644 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -1809,7 +1809,8 @@ static int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc, if (ret) printf("Failure changing bus number (%d)\n", ret); } - return ret; + + return ret ? CMD_RET_FAILURE : 0; } #endif /* defined(CONFIG_SYS_I2C) */ @@ -1852,7 +1853,8 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const if (ret) printf("Failure changing bus speed (%d)\n", ret); } - return ret; + + return ret ? CMD_RET_FAILURE : 0; } /** diff --git a/common/fdt_support.c b/common/fdt_support.c index 09f9237..75d0858 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -131,18 +131,6 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff) OF_STDOUT_PATH, strlen(OF_STDOUT_PATH) + 1); } #elif defined(CONFIG_OF_STDOUT_VIA_ALIAS) && defined(CONFIG_CONS_INDEX) -static void fdt_fill_multisername(char *sername, size_t maxlen) -{ - const char *outname = stdio_devices[stdout]->name; - - if (strcmp(outname, "serial") > 0) - strncpy(sername, outname, maxlen); - - /* eserial? */ - if (strcmp(outname + 1, "serial") > 0) - strncpy(sername, outname + 1, maxlen); -} - static int fdt_fixup_stdout(void *fdt, int chosenoff) { int err; @@ -152,9 +140,7 @@ static int fdt_fixup_stdout(void *fdt, int chosenoff) int len; char tmp[256]; /* long enough */ - fdt_fill_multisername(sername, sizeof(sername) - 1); - if (!sername[0]) - sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1); + sprintf(sername, "serial%d", CONFIG_CONS_INDEX - 1); aliasoff = fdt_path_offset(fdt, "/aliases"); if (aliasoff < 0) { diff --git a/common/lcd.c b/common/lcd.c index d29308a..2f3594a 100644 --- a/common/lcd.c +++ b/common/lcd.c @@ -31,10 +31,6 @@ #endif #endif -#ifdef CONFIG_SANDBOX -#include <asm/sdl.h> -#endif - #ifndef CONFIG_LCD_ALIGNMENT #define CONFIG_LCD_ALIGNMENT PAGE_SIZE #endif @@ -72,13 +68,6 @@ void lcd_sync(void) if (lcd_flush_dcache) flush_dcache_range((u32)lcd_base, (u32)(lcd_base + lcd_get_size(&line_length))); -#elif defined(CONFIG_SANDBOX) && defined(CONFIG_VIDEO_SANDBOX_SDL) - static ulong last_sync; - - if (get_timer(last_sync) > 10) { - sandbox_sdl_sync(lcd_base); - last_sync = get_timer(0); - } #endif } diff --git a/common/stdio.c b/common/stdio.c index 8311ac7..7252bab 100644 --- a/common/stdio.c +++ b/common/stdio.c @@ -281,12 +281,23 @@ int stdio_add_devices(void) i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE); #endif #endif -#ifdef CONFIG_LCD +#ifdef CONFIG_DM_VIDEO + struct udevice *vdev; + + for (ret = uclass_first_device(UCLASS_VIDEO, &vdev); + vdev; + ret = uclass_next_device(&vdev)) + ; + if (ret) + printf("%s: Video device failed (ret=%d)\n", __func__, ret); +#else +# if defined(CONFIG_LCD) drv_lcd_init (); -#endif -#if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) +# endif +# if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) drv_video_init (); -#endif +# endif +#endif /* CONFIG_DM_VIDEO */ #if defined(CONFIG_KEYBOARD) && !defined(CONFIG_DM_KEYBOARD) drv_keyboard_init (); #endif diff --git a/common/usb_storage.c b/common/usb_storage.c index 4fdb55f..8737cf7 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -65,7 +65,6 @@ static const unsigned char us_direction[256/8] = { static ccb usb_ccb __attribute__((aligned(ARCH_DMA_MINALIGN))); static __u32 CBWTag; -#define USB_MAX_STOR_DEV 7 static int usb_max_devs; /* number of highest available usb device */ static block_dev_desc_t usb_dev_desc[USB_MAX_STOR_DEV]; |