From c8336975381d481829e3e6a81c38cd118826ca03 Mon Sep 17 00:00:00 2001 From: Mugunthan V N Date: Sat, 16 Jan 2016 21:33:58 +0530 Subject: dm: timer: uclass: add timer init in uclass driver to add timer device Adding timer init function in timer-uclass driver to create and initialize the timer device on platforms where u-boot,dm-pre-reloc is not used. Since there will be multiple timer devices in the system, adding a tick-timer node in chosen node to know which timer device to be used as tick timer in u-boot. Signed-off-by: Mugunthan V N --- include/timer.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/timer.h b/include/timer.h index 7fee17e..f14725c 100644 --- a/include/timer.h +++ b/include/timer.h @@ -8,6 +8,15 @@ #define _TIMER_H_ /* + * dm_timer_init - initialize a timer for time keeping. On success + * initializes gd->timer so that lib/timer can use it for future + * referrence. + * + * @return - 0 on success or error number + */ +int dm_timer_init(void); + +/* * timer_conv_64 - convert 32-bit counter value to 64-bit * * @count: 32-bit counter value -- cgit v1.1 From 1ce32ba7ae287ca6155876da7d662a4ea318db76 Mon Sep 17 00:00:00 2001 From: Mugunthan V N Date: Thu, 24 Dec 2015 16:08:08 +0530 Subject: am43xx_evm: timer: do not define CONFIG_TIMER for spl Since OMAP's spl doesn't support DM currently, do not define CONFIG_TIMER for spl build. Signed-off-by: Mugunthan V N Reviewed-by: Tom Rini --- include/configs/am43xx_evm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h index de7538f..c3867ef 100644 --- a/include/configs/am43xx_evm.h +++ b/include/configs/am43xx_evm.h @@ -144,6 +144,7 @@ #undef CONFIG_DM_MMC #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH +#undef CONFIG_TIMER #endif #ifndef CONFIG_SPL_BUILD -- cgit v1.1 From ac3507dc5063ce189830f725bf0149df22cf7910 Mon Sep 17 00:00:00 2001 From: Mugunthan V N Date: Thu, 24 Dec 2015 16:08:13 +0530 Subject: am335x_evm: timer: do not define CONFIG_TIMER for spl Since OMAP's spl doesn't support DM currently, do not define CONFIG_TIMER for spl build. Signed-off-by: Mugunthan V N Reviewed-by: Tom Rini --- include/configs/am335x_evm.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h index cf6a606..6ebe0b3 100644 --- a/include/configs/am335x_evm.h +++ b/include/configs/am335x_evm.h @@ -357,6 +357,7 @@ */ #ifdef CONFIG_SPL_BUILD #undef CONFIG_DM_MMC +#undef CONFIG_TIMER #endif #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT) -- cgit v1.1 From 30a0cdb65162cd9705f167b7efd9fbb087857f6a Mon Sep 17 00:00:00 2001 From: Mugunthan V N Date: Thu, 24 Dec 2015 16:08:18 +0530 Subject: ti_omap5_common: timer: do not define CONFIG_TIMER for spl Since OMAP's spl doesn't support DM currently, do not define CONFIG_TIMER for spl build. Signed-off-by: Mugunthan V N Reviewed-by: Tom Rini --- include/configs/ti_omap5_common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/configs/ti_omap5_common.h b/include/configs/ti_omap5_common.h index 2d492f8..d164e6a 100644 --- a/include/configs/ti_omap5_common.h +++ b/include/configs/ti_omap5_common.h @@ -164,6 +164,7 @@ */ #ifdef CONFIG_SPL_BUILD #undef CONFIG_DM_MMC +#undef CONFIG_TIMER #endif #endif /* __CONFIG_TI_OMAP5_COMMON_H */ -- cgit v1.1 From cf2045283284a3226889b66541c456eb7ca869e9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 5 Jan 2016 09:31:00 -0700 Subject: bzip2: Support compression for sandbox Add the missing code to allow bzip2 compression to be used. This is useful for sandbox tests. These files are taken from the bzip2 1.0.6 release. The license text is copied to the top of each file as is done with other bzip2 files in U-Boot. The only other change is to squash a compiler warning with nBytes. Signed-off-by: Simon Glass Reviewed-by: Tom Rini --- include/bzlib.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/bzlib.h b/include/bzlib.h index 2d864d5..19314f8 100644 --- a/include/bzlib.h +++ b/include/bzlib.h @@ -68,7 +68,10 @@ /* Configure for U-Boot environment */ #define BZ_NO_STDIO + +#ifndef CONFIG_SANDBOX #define BZ_NO_COMPRESS +#endif /* End of configuration for U-Boot environment */ #ifdef __cplusplus -- cgit v1.1 From 8bdf9cfda04896c3ff6d704f398395776b69cba8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 13 Jan 2016 13:16:08 +0900 Subject: clk: fix comments in include/clk.h The comment about get_periph_rate() is the same as that of set_periph_rate(). I am fixing typos here and there while I am in this file. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- include/clk.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/clk.h b/include/clk.h index 254ad2b..f244301 100644 --- a/include/clk.h +++ b/include/clk.h @@ -29,19 +29,19 @@ struct clk_ops { ulong (*set_rate)(struct udevice *dev, ulong rate); /** - * clk_set_periph_rate() - Set clock rate for a peripheral - * - * @dev: Device to adjust (UCLASS_CLK) - * @rate: New clock rate in Hz - * @return new clock rate in Hz, or -ve error code - */ + * get_periph_rate() - Get clock rate for a peripheral + * + * @dev: Device to check (UCLASS_CLK) + * @periph: Peripheral ID to check + * @return clock rate in Hz, or -ve error code + */ ulong (*get_periph_rate)(struct udevice *dev, int periph); /** - * clk_set_periph_rate() - Set current clock rate for a peripheral + * set_periph_rate() - Set current clock rate for a peripheral * * @dev: Device to update (UCLASS_CLK) - * @periph: Peripheral ID to cupdate + * @periph: Peripheral ID to update * @return new clock rate in Hz, or -ve error code */ ulong (*set_periph_rate)(struct udevice *dev, int periph, ulong rate); @@ -58,7 +58,7 @@ struct clk_ops { ulong clk_get_rate(struct udevice *dev); /** - * set_rate() - Set current clock rate + * clk_set_rate() - Set current clock rate * * @dev: Device to adjust * @rate: New clock rate in Hz @@ -78,7 +78,7 @@ ulong clk_get_periph_rate(struct udevice *dev, int periph); * clk_set_periph_rate() - Set current clock rate for a peripheral * * @dev: Device to update (UCLASS_CLK) - * @periph: Peripheral ID to cupdate + * @periph: Peripheral ID to update * @return new clock rate in Hz, or -ve error code */ ulong clk_set_periph_rate(struct udevice *dev, int periph, ulong rate); -- cgit v1.1 From ad1cf785853eef60e48053ead4fbb47dad840d55 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 13 Jan 2016 13:16:09 +0900 Subject: clk: add needed include and declaration to include/clk.h This header uses ulong, so it needs to include . Likewise, "struct udevice" must be declared before it is used. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- include/clk.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/clk.h b/include/clk.h index f244301..371784a 100644 --- a/include/clk.h +++ b/include/clk.h @@ -8,6 +8,10 @@ #ifndef _CLK_H_ #define _CLK_H_ +#include + +struct udevice; + int soc_clk_dump(void); struct clk_ops { -- cgit v1.1 From f0e075162f815f9cb769c7bb9003e0ad3b829811 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 13 Jan 2016 13:16:12 +0900 Subject: clk: add API to enable clock The most basic thing for clock is to enable it, but it is missing in this uclass. Signed-off-by: Masahiro Yamada Acked-by: Simon Glass --- include/clk.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include') diff --git a/include/clk.h b/include/clk.h index 371784a..941808a 100644 --- a/include/clk.h +++ b/include/clk.h @@ -33,6 +33,15 @@ struct clk_ops { ulong (*set_rate)(struct udevice *dev, ulong rate); /** + * enable() - Enable the clock for a peripheral + * + * @dev: clock provider + * @periph: Peripheral ID to enable + * @return zero on success, or -ve error code + */ + int (*enable)(struct udevice *dev, int periph); + + /** * get_periph_rate() - Get clock rate for a peripheral * * @dev: Device to check (UCLASS_CLK) @@ -71,6 +80,15 @@ ulong clk_get_rate(struct udevice *dev); ulong clk_set_rate(struct udevice *dev, ulong rate); /** + * clk_enable() - Enable the clock for a peripheral + * + * @dev: clock provider + * @periph: Peripheral ID to enable + * @return zero on success, or -ve error code + */ +int clk_enable(struct udevice *dev, int periph); + +/** * clk_get_periph_rate() - Get current clock rate for a peripheral * * @dev: Device to check (UCLASS_CLK) -- cgit v1.1 From f833cd6279666e1c2de6fc271bfd5d451003ed3b Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 13 Jan 2016 19:38:59 -0800 Subject: arm: ls1021atwr: Convert to driver model and enable serial support Convert ls1021atwr_nor to driver model support. As a start, enable ns16550 serial port driver. Signed-off-by: Bin Meng Acked-by: Simon Glass --- include/configs/ls1021atwr.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h index c12ba3a..bbef2a7 100644 --- a/include/configs/ls1021atwr.h +++ b/include/configs/ls1021atwr.h @@ -271,7 +271,9 @@ #else #define CONFIG_CONS_INDEX 1 #define CONFIG_SYS_NS16550_SERIAL +#ifndef CONFIG_DM_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE 1 +#endif #define CONFIG_SYS_NS16550_CLK get_serial_clock() #endif -- cgit v1.1 From 5ed07cf53ccd47be65b5bcfef7432a75bfbfa65e Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Wed, 13 Jan 2016 19:39:00 -0800 Subject: serial: lpuart: Move CONFIG_FSL_LPUART to Kconfig LPUART is seen on Freescale VF610 and QorIQ Layerscape devices. Create a Kconfig option and move it to defconfig for all boards that have this serial driver. Signed-off-by: Bin Meng Reviewed-by: Simon Glass Acked-by: Stefan Agner Acked-by: Simon Glass --- include/configs/colibri_vf.h | 1 - include/configs/ls1021aqds.h | 1 - include/configs/ls1021atwr.h | 1 - include/configs/pcm052.h | 1 - include/configs/vf610twr.h | 1 - 5 files changed, 5 deletions(-) (limited to 'include') diff --git a/include/configs/colibri_vf.h b/include/configs/colibri_vf.h index 708c79a..5aed3a5 100644 --- a/include/configs/colibri_vf.h +++ b/include/configs/colibri_vf.h @@ -36,7 +36,6 @@ #define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_FSL_LPUART #define LPUART_BASE UART0_BASE /* Allow to overwrite serial and ethaddr */ diff --git a/include/configs/ls1021aqds.h b/include/configs/ls1021aqds.h index 2e8dbc7..e8b1eca 100644 --- a/include/configs/ls1021aqds.h +++ b/include/configs/ls1021aqds.h @@ -371,7 +371,6 @@ unsigned long get_board_ddr_clk(void); * Serial Port */ #ifdef CONFIG_LPUART -#define CONFIG_FSL_LPUART #define CONFIG_LPUART_32B_REG #else #define CONFIG_CONS_INDEX 1 diff --git a/include/configs/ls1021atwr.h b/include/configs/ls1021atwr.h index bbef2a7..317ba62 100644 --- a/include/configs/ls1021atwr.h +++ b/include/configs/ls1021atwr.h @@ -266,7 +266,6 @@ * Serial Port */ #ifdef CONFIG_LPUART -#define CONFIG_FSL_LPUART #define CONFIG_LPUART_32B_REG #else #define CONFIG_CONS_INDEX 1 diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h index b851bba..891bdb0 100644 --- a/include/configs/pcm052.h +++ b/include/configs/pcm052.h @@ -27,7 +27,6 @@ #define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_FSL_LPUART #define LPUART_BASE UART1_BASE /* Allow to overwrite serial and ethaddr */ diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h index 34df6f0..dcfafaf 100644 --- a/include/configs/vf610twr.h +++ b/include/configs/vf610twr.h @@ -34,7 +34,6 @@ #define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_FSL_LPUART #define LPUART_BASE UART1_BASE /* Allow to overwrite serial and ethaddr */ -- cgit v1.1 From 1acafc73bfc7535c185f321012ac70821471b816 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:15 -0700 Subject: dm: video: Add a video uclass U-Boot has separate code for LCDs and 'video' devices. Both now use a very similar API thanks to earlier work by Nikita Kiryanov. With the driver- model conversion we should unify these into a single uclass. Unfortunately there are different features supported by each. This implementation provides for a common set of features which should serve most purposes. The intent is to support: - bitmap devices with 8, 16 and 32 bits per pixel - text console wih white on black or vice versa - rotated text console - bitmap display (BMP format) More can be added as additional boards are ported over to use driver model for video. The name 'video' is chosen for the uclass since it is more generic than LCD. Another option would be 'display' but that would introduce a third concept to U-Boot which seems like the wrong approach. The existing LCD and video init functions are not needed now, so this uclass makes no attempt to implement them. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/dm/uclass-id.h | 1 + include/video.h | 168 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 163 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 27fa0b6..3934375 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -66,6 +66,7 @@ enum uclass_id { UCLASS_USB, /* USB bus */ UCLASS_USB_DEV_GENERIC, /* USB generic device */ UCLASS_USB_HUB, /* USB hub */ + UCLASS_VIDEO, /* Video or LCD device */ UCLASS_VIDEO_BRIDGE, /* Video bridge, e.g. DisplayPort to LVDS */ UCLASS_COUNT, diff --git a/include/video.h b/include/video.h index 65e4ec1..b20f06f 100644 --- a/include/video.h +++ b/include/video.h @@ -1,14 +1,167 @@ /* -** MPC823 Video Controller -** ======================= -** (C) 2000 by Paolo Scaffardi (arsenio@tin.it) -** AIRVENT SAM s.p.a - RIMINI(ITALY) -** -*/ + * Video uclass and legacy implementation + * + * Copyright (c) 2015 Google, Inc + * + * MPC823 Video Controller + * ======================= + * (C) 2000 by Paolo Scaffardi (arsenio@tin.it) + * AIRVENT SAM s.p.a - RIMINI(ITALY) + * + */ #ifndef _VIDEO_H_ #define _VIDEO_H_ +#ifdef CONFIG_DM_VIDEO + +#include + +struct video_uc_platdata { + uint align; + uint size; + ulong base; +}; + +/* + * Bits per pixel selector. Each value n is such that the bits-per-pixel is + * 2 ^ n + */ +enum video_log2_bpp { + VIDEO_BPP1 = 0, + VIDEO_BPP2, + VIDEO_BPP4, + VIDEO_BPP8, + VIDEO_BPP16, + VIDEO_BPP32, +}; + +/* + * Convert enum video_log2_bpp to bytes and bits. Note we omit the outer + * brackets to allow multiplication by fractional pixels. + */ +#define VNBYTES(bpix) (1 << (bpix)) / 8 + +#define VNBITS(bpix) (1 << (bpix)) + +/** + * struct video_priv - Device information used by the video uclass + * + * @xsize: Number of pixel columns (e.g. 1366) + * @ysize: Number of pixels rows (e.g.. 768) + * @tor: Display rotation (0=none, 1=90 degrees clockwise, etc.) + * @bpix: Encoded bits per pixel + * @fb: Frame buffer + * @fb_size: Frame buffer size + * @line_length: Length of each frame buffer line, in bytes + * @colour_fg: Foreground colour (pixel value) + * @colour_bg: Background colour (pixel value) + * @flush_dcache: true to enable flushing of the data cache after + * the LCD is updated + * @cmap: Colour map for 8-bit-per-pixel displays + */ +struct video_priv { + /* Things set up by the driver: */ + ushort xsize; + ushort ysize; + ushort rot; + enum video_log2_bpp bpix; + + /* + * Things that are private to the uclass: don't use these in the + * driver + */ + void *fb; + int fb_size; + int line_length; + int colour_fg; + int colour_bg; + bool flush_dcache; + ushort *cmap; +}; + +/* Placeholder - there are no video operations at present */ +struct video_ops { +}; + +#define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops) + +/** + * video_reserve() - Reserve frame-buffer memory for video devices + * + * Note: This function is for internal use. + * + * This uses the uclass platdata's @size and @align members to figure out + * a size and position for each frame buffer as part of the pre-relocation + * process of determining the post-relocation memory layout. + * + * gd->video_top is set to the initial value of *@addrp and gd->video_bottom + * is set to the final value. + * + * @addrp: On entry, the top of available memory. On exit, the new top, + * after allocating the required memory. + * @return 0 + */ +int video_reserve(ulong *addrp); + +/** + * video_sync() - Sync a device's frame buffer with its hardware + * + * Some frame buffers are cached or have a secondary frame buffer. This + * function syncs these up so that the current contents of the U-Boot frame + * buffer are displayed to the user. + * + * @dev: Device to sync + */ +void video_sync(struct udevice *vid); + +/** + * video_sync_all() - Sync all devices' frame buffers with there hardware + * + * This calls video_sync() on all active video devices. + */ +void video_sync_all(void); + +/** + * video_bmp_display() - Display a BMP file + * + * @dev: Device to display the bitmap on + * @bmp_image: Address of bitmap image to display + * @x: X position in pixels from the left + * @y: Y position in pixels from the top + * @align: true to adjust the coordinates to centre the image. If false + * the coordinates are used as is. If true: + * + * - if a coordinate is 0x7fff then the image will be centred in + * that direction + * - if a coordinate is -ve then it will be offset to the + * left/top of the centre by that many pixels + * - if a coordinate is positive it will be used unchnaged. + * @return 0 if OK, -ve on error + */ +int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, + bool align); + +/** + * video_get_xsize() - Get the width of the display in pixels + * + * @dev: Device to check + * @return device frame buffer width in pixels + */ +int video_get_xsize(struct udevice *dev); + +/** + * video_get_ysize() - Get the height of the display in pixels + * + * @dev: Device to check + * @return device frame buffer height in pixels + */ +int video_get_ysize(struct udevice *dev); + +#endif /* CONFIG_DM_VIDEO */ + +#ifndef CONFIG_DM_VIDEO + /* Video functions */ struct stdio_dev; @@ -73,4 +226,7 @@ int kwh043st20_f01_spi_startup(unsigned int bus, unsigned int cs, int lg4573_spi_startup(unsigned int bus, unsigned int cs, unsigned int max_hz, unsigned int spi_mode); #endif + +#endif /* CONFIG_DM_VIDEO */ + #endif -- cgit v1.1 From 6cbf5de7082fdee0bdbc3dd5fe7ac4c84cbf9f7d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:16 -0700 Subject: dm: lcd: Avoid using the lcd.h header file with driver model The LCD functions and definitions are not used with the driver model video uclass. When all boards are converted over we can remove the file. For now, use #ifdef to omit the contents. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/lcd.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/lcd.h b/include/lcd.h index 59202b7..d7651a8 100644 --- a/include/lcd.h +++ b/include/lcd.h @@ -18,6 +18,12 @@ #include #endif +int bmp_display(ulong addr, int x, int y); +struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, + void **alloc_addr); + +#ifndef CONFIG_DM_VIDEO + extern char lcd_is_enabled; extern int lcd_line_length; extern struct vidinfo panel_info; @@ -26,10 +32,6 @@ void lcd_ctrl_init(void *lcdbase); void lcd_enable(void); void lcd_setcolreg(ushort regno, ushort red, ushort green, ushort blue); -struct bmp_image *gunzip_bmp(unsigned long addr, unsigned long *lenp, - void **alloc_addr); -int bmp_display(ulong addr, int x, int y); - /** * Set whether we need to flush the dcache when changing the LCD image. This * defaults to off. @@ -209,4 +211,6 @@ void lcd_sync(void); #define PAGE_SIZE 4096 #endif +#endif /* !CONFIG_DM_VIDEO */ + #endif /* _LCD_H_ */ -- cgit v1.1 From 83510766c90a52e58477267704fc5ca8f75c3dab Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:17 -0700 Subject: dm: video: Add a uclass for the text console The existing LCD/video interface suffers from conflating the bitmap display with text output on that display. As a result the implementation is more complex than it needs to me. We can support multiple text console drivers. Create a separate uclass to support this, with its own API. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/dm/uclass-id.h | 1 + include/video_console.h | 136 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 137 insertions(+) create mode 100644 include/video_console.h (limited to 'include') diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 3934375..a0a3a79 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -68,6 +68,7 @@ enum uclass_id { UCLASS_USB_HUB, /* USB hub */ UCLASS_VIDEO, /* Video or LCD device */ UCLASS_VIDEO_BRIDGE, /* Video bridge, e.g. DisplayPort to LVDS */ + UCLASS_VIDEO_CONSOLE, /* Text console driver for video device */ UCLASS_COUNT, UCLASS_INVALID = -1, diff --git a/include/video_console.h b/include/video_console.h new file mode 100644 index 0000000..c0fc792 --- /dev/null +++ b/include/video_console.h @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2015 Google, Inc + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __video_console_h +#define __video_console_h + +/** + * struct vidconsole_priv - uclass-private data about a console device + * + * @sdev: stdio device, acting as an output sink + * @curr_col: Current text column (0=left) + * @curr_row: Current row (0=top) + * @rows: Number of text rows + * @cols: Number of text columns + */ +struct vidconsole_priv { + struct stdio_dev sdev; + int curr_col; + int curr_row; + int rows; + int cols; +}; + +/** + * struct vidconsole_ops - Video console operations + * + * These operations work on either an absolute console position (measured + * in pixels) or a text row number (measured in rows, where each row consists + * of an entire line of text - typically 16 pixels). + */ +struct vidconsole_ops { + /** + * putc_xy() - write a single character to a position + * + * @dev: Device to write to + * @x: Pixel X position (0=left-most pixel) + * @y: Pixel Y position (0=top-most pixel) + * @ch: Character to write + * @return 0 if OK, -ve on error + */ + int (*putc_xy)(struct udevice *dev, uint x, uint y, char ch); + + /** + * move_rows() - Move text rows from one place to another + * + * @dev: Device to adjust + * @rowdst: Destination text row (0=top) + * @rowsrc: Source start text row + * @count: Number of text rows to move + * @return 0 if OK, -ve on error + */ + int (*move_rows)(struct udevice *dev, uint rowdst, uint rowsrc, + uint count); + + /** + * set_row() - Set the colour of a text row + * + * Every pixel contained within the text row is adjusted + * + * @dev: Device to adjust + * @row: Text row to adjust (0=top) + * @clr: Raw colour (pixel value) to write to each pixel + * @return 0 if OK, -ve on error + */ + int (*set_row)(struct udevice *dev, uint row, int clr); +}; + +/* Get a pointer to the driver operations for a video console device */ +#define vidconsole_get_ops(dev) ((struct vidconsole_ops *)(dev)->driver->ops) + +/** + * vidconsole_putc_xy() - write a single character to a position + * + * @dev: Device to write to + * @x: Pixel X position (0=left-most pixel) + * @y: Pixel Y position (0=top-most pixel) + * @ch: Character to write + * @return 0 if OK, -ve on error + */ +int vidconsole_putc_xy(struct udevice *dev, uint x, uint y, char ch); + +/** + * vidconsole_move_rows() - Move text rows from one place to another + * + * @dev: Device to adjust + * @rowdst: Destination text row (0=top) + * @rowsrc: Source start text row + * @count: Number of text rows to move + * @return 0 if OK, -ve on error + */ +int vidconsole_move_rows(struct udevice *dev, uint rowdst, uint rowsrc, + uint count); + +/** + * vidconsole_set_row() - Set the colour of a text row + * + * Every pixel contained within the text row is adjusted + * + * @dev: Device to adjust + * @row: Text row to adjust (0=top) + * @clr: Raw colour (pixel value) to write to each pixel + * @return 0 if OK, -ve on error + */ +int vidconsole_set_row(struct udevice *dev, uint row, int clr); + +/** + * vidconsole_put_char() - Output a character to the current console position + * + * Outputs a character to the console and advances the cursor. This function + * handles wrapping to new lines and scrolling the console. Special + * characters are handled also: \n, \r, \b and \t. + * + * The device always starts with the cursor at position 0,0 (top left). It + * can be adjusted manually using vidconsole_position_cursor(). + * + * @dev: Device to adjust + * @ch: Character to write + * @return 0 if OK, -ve on error + */ +int vidconsole_put_char(struct udevice *dev, char ch); + +/** + * vidconsole_position_cursor() - Move the text cursor + * + * @dev: Device to adjust + * @col: New cursor text column + * @row: New cursor text row + * @return 0 if OK, -ve on error + */ +void vidconsole_position_cursor(struct udevice *dev, unsigned col, + unsigned row); + +#endif -- cgit v1.1 From 5a54194515caa4f4183dc9086938456612749573 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:21 -0700 Subject: dm: common: Add memory reservation for the video uclass Before relocation we need to reserve memory for the video driver frame buffers so that they can use this memory when they start up (after relocation). Add a call to the uclass to permit this. The current top and bottom of the region is stored in global_data so that it can be checked post-relocation to ensure enough memory is available. No video device should be probed before relocation. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/asm-generic/global_data.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index 5d8b043..a587d3c 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -122,6 +122,10 @@ typedef struct global_data { struct membuff console_out; /* console output */ struct membuff console_in; /* console input */ #endif +#ifdef CONFIG_DM_VIDEO + ulong video_top; /* Top of video frame buffer area */ + ulong video_bottom; /* Bottom of video frame buffer area */ +#endif } gd_t; #endif -- cgit v1.1 From 1e69ad014c68bf375ba2113486c5c0095d3292d0 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:24 -0700 Subject: sandbox: Move CONFIG_VIDEO_SANDBOX_SDL to Kconfig Move this option to Kconfig. This is quite simple as only sandbox uses the driver. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/configs/sandbox.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index d3112e1..e1be603 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -159,7 +159,6 @@ /* LCD and keyboard require SDL support */ #ifdef CONFIG_SANDBOX_SDL #define CONFIG_LCD -#define CONFIG_VIDEO_SANDBOX_SDL #define CONFIG_CMD_BMP #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_CONSOLE_MUX -- cgit v1.1 From 3ade5bc4dc24edf5e1f13f3c43a9e8b7f8c2d853 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:25 -0700 Subject: dm: video: sandbox: Convert sandbox to use driver model for video Now that driver model support is available, convert sandbox over to use it. We can remove a few of the special hooks that sandbox currently has. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/configs/sandbox.h | 10 ++++------ include/fdtdec.h | 1 - 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index e1be603..23ae44c 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -158,9 +158,7 @@ /* LCD and keyboard require SDL support */ #ifdef CONFIG_SANDBOX_SDL -#define CONFIG_LCD #define CONFIG_CMD_BMP -#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_CONSOLE_MUX #define CONFIG_SYS_CONSOLE_IS_IN_ENV #define LCD_BPP LCD_COLOR16 @@ -169,12 +167,12 @@ #define CONFIG_KEYBOARD #define SANDBOX_SERIAL_SETTINGS "stdin=serial,cros-ec-keyb,usbkbd\0" \ - "stdout=serial,lcd\0" \ - "stderr=serial,lcd\0" + "stdout=serial,lcd.vidconsole\0" \ + "stderr=serial,lcd.vidconsole\0" #else #define SANDBOX_SERIAL_SETTINGS "stdin=serial\0" \ - "stdout=serial,lcd\0" \ - "stderr=serial,lcd\0" + "stdout=serial,lcd.vidconsole\0" \ + "stderr=serial,lcd.vidconsole\0" #endif #define SANDBOX_ETH_SETTINGS "ethaddr=00:00:11:22:33:44\0" \ diff --git a/include/fdtdec.h b/include/fdtdec.h index 27b350e..25e98c9 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -151,7 +151,6 @@ enum fdt_compat_id { COMPAT_GENERIC_SPI_FLASH, /* Generic SPI Flash chip */ COMPAT_MAXIM_98095_CODEC, /* MAX98095 Codec */ COMPAT_SAMSUNG_EXYNOS5_I2C, /* Exynos5 High Speed I2C Controller */ - COMPAT_SANDBOX_LCD_SDL, /* Sandbox LCD emulation with SDL */ COMPAT_SAMSUNG_EXYNOS_SYSMMU, /* Exynos sysmmu */ COMPAT_INTEL_MICROCODE, /* Intel microcode update */ COMPAT_MEMORY_SPD, /* Memory SPD information */ -- cgit v1.1 From 3c97c4fb52af9d4da4546cbb8a52bdb6f0d4b57f Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:26 -0700 Subject: dm: video: test: Add tests for the video uclass Add tests that check that the video console is working correcty. Also check that text output produces the expected result. Test coverage includes character output, wrapping and scrolling. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/dm/test.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/dm/test.h b/include/dm/test.h index a4bc5c8..ca924d9 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -155,6 +155,14 @@ enum { /* Declare a new driver model test */ #define DM_TEST(_name, _flags) UNIT_TEST(_name, _flags, dm_test) +/* This platform data is needed in tests, so declare it here */ +struct sandbox_sdl_plat { + int xres; + int yres; + int bpix; + int rot; +}; + /* Declare ping methods for the drivers */ int test_ping(struct udevice *dev, int pingval, int *pingret); int testfdt_ping(struct udevice *dev, int pingval, int *pingret); -- cgit v1.1 From 747440d0fa95f2205a8fcef49b6c7845700b6246 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Mon, 18 Jan 2016 19:52:28 -0700 Subject: dm: video: test: Test that bitmap display works correctly Add a test for the 'bmp' command. Test both the uncompressed and compressed versions of the file, since they use different code paths. Signed-off-by: Simon Glass Acked-by: Anatolij Gustschin --- include/configs/sandbox.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index 23ae44c..6498981 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -163,6 +163,8 @@ #define CONFIG_SYS_CONSOLE_IS_IN_ENV #define LCD_BPP LCD_COLOR16 #define CONFIG_LCD_BMP_RLE8 +#define CONFIG_VIDEO_BMP_RLE8 +#define CONFIG_SPLASH_SCREEN_ALIGN #define CONFIG_KEYBOARD -- cgit v1.1