* [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO
@ 2019-06-10 11:47 Igor Opaniuk
2019-06-10 11:47 ` [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions Igor Opaniuk
` (5 more replies)
0 siblings, 6 replies; 15+ messages in thread
From: Igor Opaniuk @ 2019-06-10 11:47 UTC (permalink / raw)
To: u-boot
From: Igor Opaniuk <igor.opaniuk@toradex.com>
This series of patches refactors and extends NXP DCU video driver to
be built with DM_VIDEO enabled. DTS files must additionally include
'u-boot,dm-pre-reloc' property in soc and child nodes to enable driver
binding to fsl_dcu_fb device.
Current limitations: configuration (display timings etc.) isn't fetched
from the DT node. I plan to add this in the next series.
Also enables DM_VIDEO by default for Colibri VF.
Igor Opaniuk (4):
video: fsl_dcu_fb: refactor init functions
video: fsl_dcu_fb: add DM_VIDEO support
ARM: dts: colibri_vf: Add dcu0 node
colibri_vf: enable DM_VIDEO
arch/arm/dts/vf-colibri-u-boot.dtsi | 4 +
arch/arm/dts/vf-colibri.dtsi | 5 +
arch/arm/dts/vf.dtsi | 6 +
board/freescale/ls1021aqds/dcu.c | 6 +-
board/toradex/colibri_vf/colibri_vf.c | 4 +-
board/toradex/colibri_vf/dcu.c | 6 +-
configs/colibri_vf_defconfig | 2 +-
drivers/video/Kconfig | 2 +-
drivers/video/fsl_dcu_fb.c | 213 ++++++++++++++++++--------
include/fsl_dcu_fb.h | 12 +-
10 files changed, 187 insertions(+), 73 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 15+ messages in thread* [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk @ 2019-06-10 11:47 ` Igor Opaniuk 2019-07-11 14:25 ` Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support Igor Opaniuk ` (4 subsequent siblings) 5 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-06-10 11:47 UTC (permalink / raw) To: u-boot From: Igor Opaniuk <igor.opaniuk@toradex.com> Move dcu-related code to fsl_dcu_probe_common, keep in video_hw_init() only legacy video stack (filling GraphicPanel struct etc.). Add wrappers for all init functions, that will let to provide struct fb_info as an additional param (needed for further moving it from the global scope to driver private data struct in DM converted driver). Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> --- board/freescale/ls1021aqds/dcu.c | 6 +- board/toradex/colibri_vf/dcu.c | 6 +- drivers/video/fsl_dcu_fb.c | 107 +++++++++++++++++-------------- include/fsl_dcu_fb.h | 12 +++- 4 files changed, 77 insertions(+), 54 deletions(-) diff --git a/board/freescale/ls1021aqds/dcu.c b/board/freescale/ls1021aqds/dcu.c index 14855ea1d9..c4eac5e302 100644 --- a/board/freescale/ls1021aqds/dcu.c +++ b/board/freescale/ls1021aqds/dcu.c @@ -39,7 +39,9 @@ unsigned int dcu_set_pixel_clock(unsigned int pixclock) return div; } -int platform_dcu_init(unsigned int xres, unsigned int yres, +int platform_dcu_init(struct fb_info *fbinfo, + unsigned int xres, + unsigned int yres, const char *port, struct fb_videomode *dcu_fb_videomode) { @@ -85,7 +87,7 @@ int platform_dcu_init(unsigned int xres, unsigned int yres, printf("DCU: Switching to %s monitor @ %ux%u\n", name, xres, yres); pixel_format = 32; - fsl_dcu_init(xres, yres, pixel_format); + fsl_dcu_init(fbinfo, xres, yres, pixel_format); return 0; } diff --git a/board/toradex/colibri_vf/dcu.c b/board/toradex/colibri_vf/dcu.c index c36e90cd22..c688ed79ff 100644 --- a/board/toradex/colibri_vf/dcu.c +++ b/board/toradex/colibri_vf/dcu.c @@ -26,11 +26,13 @@ unsigned int dcu_set_pixel_clock(unsigned int pixclock) return div; } -int platform_dcu_init(unsigned int xres, unsigned int yres, +int platform_dcu_init(struct fb_info *fbinfo, + unsigned int xres, + unsigned int yres, const char *port, struct fb_videomode *dcu_fb_videomode) { - fsl_dcu_init(xres, yres, 32); + fsl_dcu_init(fbinfo, xres, yres, 32); return 0; } diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c index 9f6e7f83b0..f789ec597d 100644 --- a/drivers/video/fsl_dcu_fb.c +++ b/drivers/video/fsl_dcu_fb.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0+ /* * Copyright 2014 Freescale Semiconductor, Inc. + * Copyright 2019 Toradex AG * * FSL DCU Framebuffer driver */ @@ -240,20 +241,22 @@ static void reset_total_layers(void) } } -static int layer_ctrldesc_init(int index, u32 pixel_format) +static int layer_ctrldesc_init(struct fb_info fbinfo, + int index, u32 pixel_format) { struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; unsigned int bpp = BPP_24_RGB888; dcu_write32(®s->ctrldescl[index][0], - DCU_CTRLDESCLN_1_HEIGHT(info.var.yres) | - DCU_CTRLDESCLN_1_WIDTH(info.var.xres)); + DCU_CTRLDESCLN_1_HEIGHT(fbinfo.var.yres) | + DCU_CTRLDESCLN_1_WIDTH(fbinfo.var.xres)); dcu_write32(®s->ctrldescl[index][1], DCU_CTRLDESCLN_2_POSY(0) | DCU_CTRLDESCLN_2_POSX(0)); - dcu_write32(®s->ctrldescl[index][2], (unsigned int)info.screen_base); + dcu_write32(®s->ctrldescl[index][2], + (unsigned int)fbinfo.screen_base); switch (pixel_format) { case 16: @@ -294,42 +297,42 @@ static int layer_ctrldesc_init(int index, u32 pixel_format) return 0; } -int fsl_dcu_init(unsigned int xres, unsigned int yres, - unsigned int pixel_format) +int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, + unsigned int yres, unsigned int pixel_format) { struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; unsigned int div, mode; - info.screen_size = - info.var.xres * info.var.yres * (info.var.bits_per_pixel / 8); + fbinfo->screen_size = fbinfo->var.xres * fbinfo->var.yres * + (fbinfo->var.bits_per_pixel / 8); - if (info.screen_size > CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB) { - info.screen_size = 0; + if (fbinfo->screen_size > CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB) { + fbinfo->screen_size = 0; return -ENOMEM; } /* Reserve framebuffer at the end of memory */ gd->fb_base = gd->bd->bi_dram[0].start + - gd->bd->bi_dram[0].size - info.screen_size; - info.screen_base = (char *)gd->fb_base; + gd->bd->bi_dram[0].size - fbinfo->screen_size; + fbinfo->screen_base = (char *)gd->fb_base; - memset(info.screen_base, 0, info.screen_size); + memset(fbinfo->screen_base, 0, fbinfo->screen_size); reset_total_layers(); dcu_write32(®s->disp_size, - DCU_DISP_SIZE_DELTA_Y(info.var.yres) | - DCU_DISP_SIZE_DELTA_X(info.var.xres / 16)); + DCU_DISP_SIZE_DELTA_Y(fbinfo->var.yres) | + DCU_DISP_SIZE_DELTA_X(fbinfo->var.xres / 16)); dcu_write32(®s->hsyn_para, - DCU_HSYN_PARA_BP(info.var.left_margin) | - DCU_HSYN_PARA_PW(info.var.hsync_len) | - DCU_HSYN_PARA_FP(info.var.right_margin)); + DCU_HSYN_PARA_BP(fbinfo->var.left_margin) | + DCU_HSYN_PARA_PW(fbinfo->var.hsync_len) | + DCU_HSYN_PARA_FP(fbinfo->var.right_margin)); dcu_write32(®s->vsyn_para, - DCU_VSYN_PARA_BP(info.var.upper_margin) | - DCU_VSYN_PARA_PW(info.var.vsync_len) | - DCU_VSYN_PARA_FP(info.var.lower_margin)); + DCU_VSYN_PARA_BP(fbinfo->var.upper_margin) | + DCU_VSYN_PARA_PW(fbinfo->var.vsync_len) | + DCU_VSYN_PARA_FP(fbinfo->var.lower_margin)); dcu_write32(®s->synpol, DCU_SYN_POL_INV_PXCK_FALL | @@ -352,9 +355,9 @@ int fsl_dcu_init(unsigned int xres, unsigned int yres, mode = dcu_read32(®s->mode); dcu_write32(®s->mode, mode | DCU_MODE_NORMAL); - layer_ctrldesc_init(0, pixel_format); + layer_ctrldesc_init(*fbinfo, 0, pixel_format); - div = dcu_set_pixel_clock(info.var.pixclock); + div = dcu_set_pixel_clock(fbinfo->var.pixclock); dcu_write32(®s->div_ratio, (div - 1)); dcu_write32(®s->update_mode, DCU_UPDATE_MODE_READREG); @@ -367,24 +370,26 @@ ulong board_get_usable_ram_top(ulong total_size) return gd->ram_top - CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB; } -void *video_hw_init(void) +int fsl_probe_common(struct fb_info *fbinfo, unsigned int *win_x, + unsigned int *win_y) { - static GraphicDevice ctfb; const char *options; unsigned int depth = 0, freq = 0; + struct fb_videomode *fsl_dcu_mode_db = &fsl_dcu_mode_480_272; - if (!video_get_video_mode(&ctfb.winSizeX, &ctfb.winSizeY, &depth, &freq, + if (!video_get_video_mode(win_x, win_y, &depth, &freq, &options)) - return NULL; + return -EINVAL; /* Find the monitor port, which is a required option */ if (!options) - return NULL; + return -EINVAL; + if (strncmp(options, "monitor=", 8) != 0) - return NULL; + return -EINVAL; - switch (RESOLUTION(ctfb.winSizeX, ctfb.winSizeY)) { + switch (RESOLUTION(*win_x, *win_y)) { case RESOLUTION(480, 272): fsl_dcu_mode_db = &fsl_dcu_mode_480_272; break; @@ -402,25 +407,33 @@ void *video_hw_init(void) break; default: printf("unsupported resolution %ux%u\n", - ctfb.winSizeX, ctfb.winSizeY); + *win_x, *win_y); } - info.var.xres = fsl_dcu_mode_db->xres; - info.var.yres = fsl_dcu_mode_db->yres; - info.var.bits_per_pixel = 32; - info.var.pixclock = fsl_dcu_mode_db->pixclock; - info.var.left_margin = fsl_dcu_mode_db->left_margin; - info.var.right_margin = fsl_dcu_mode_db->right_margin; - info.var.upper_margin = fsl_dcu_mode_db->upper_margin; - info.var.lower_margin = fsl_dcu_mode_db->lower_margin; - info.var.hsync_len = fsl_dcu_mode_db->hsync_len; - info.var.vsync_len = fsl_dcu_mode_db->vsync_len; - info.var.sync = fsl_dcu_mode_db->sync; - info.var.vmode = fsl_dcu_mode_db->vmode; - info.fix.line_length = info.var.xres * info.var.bits_per_pixel / 8; - - if (platform_dcu_init(ctfb.winSizeX, ctfb.winSizeY, - options + 8, fsl_dcu_mode_db) < 0) + fbinfo->var.xres = fsl_dcu_mode_db->xres; + fbinfo->var.yres = fsl_dcu_mode_db->yres; + fbinfo->var.bits_per_pixel = 32; + fbinfo->var.pixclock = fsl_dcu_mode_db->pixclock; + fbinfo->var.left_margin = fsl_dcu_mode_db->left_margin; + fbinfo->var.right_margin = fsl_dcu_mode_db->right_margin; + fbinfo->var.upper_margin = fsl_dcu_mode_db->upper_margin; + fbinfo->var.lower_margin = fsl_dcu_mode_db->lower_margin; + fbinfo->var.hsync_len = fsl_dcu_mode_db->hsync_len; + fbinfo->var.vsync_len = fsl_dcu_mode_db->vsync_len; + fbinfo->var.sync = fsl_dcu_mode_db->sync; + fbinfo->var.vmode = fsl_dcu_mode_db->vmode; + fbinfo->fix.line_length = fbinfo->var.xres * + fbinfo->var.bits_per_pixel / 8; + + return platform_dcu_init(fbinfo, *win_x, *win_y, + options + 8, fsl_dcu_mode_db); +} + +void *video_hw_init(void) +{ + static GraphicDevice ctfb; + + if (fsl_probe_common(&info, &ctfb.winSizeX, &ctfb.winSizeY) < 0) return NULL; ctfb.frameAdrs = (unsigned int)info.screen_base; diff --git a/include/fsl_dcu_fb.h b/include/fsl_dcu_fb.h index 2dd5f54c3e..7a5347a924 100644 --- a/include/fsl_dcu_fb.h +++ b/include/fsl_dcu_fb.h @@ -6,11 +6,17 @@ */ #include <linux/fb.h> -int fsl_dcu_init(unsigned int xres, unsigned int yres, +int fsl_dcu_init(struct fb_info *fbinfo, + unsigned int xres, + unsigned int yres, unsigned int pixel_format); + int fsl_dcu_fixedfb_setup(void *blob); /* Prototypes for external board-specific functions */ -int platform_dcu_init(unsigned int xres, unsigned int yres, - const char *port, struct fb_videomode *dcu_fb_videomode); +int platform_dcu_init(struct fb_info *fbinfo, + unsigned int xres, + unsigned int yres, + const char *port, + struct fb_videomode *dcu_fb_videomode); unsigned int dcu_set_pixel_clock(unsigned int pixclock); -- 2.17.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions 2019-06-10 11:47 ` [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions Igor Opaniuk @ 2019-07-11 14:25 ` Igor Opaniuk 2019-07-11 15:16 ` Oleksandr Suvorov 0 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-07-11 14:25 UTC (permalink / raw) To: u-boot + Oleksandr, Philippe On Mon, Jun 10, 2019 at 2:47 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > Move dcu-related code to fsl_dcu_probe_common, keep in video_hw_init() > only legacy video stack (filling GraphicPanel struct etc.). > > Add wrappers for all init functions, that will let to provide > struct fb_info as an additional param (needed for further moving it from > the global scope to driver private data struct in DM converted driver). > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> > --- > board/freescale/ls1021aqds/dcu.c | 6 +- > board/toradex/colibri_vf/dcu.c | 6 +- > drivers/video/fsl_dcu_fb.c | 107 +++++++++++++++++-------------- > include/fsl_dcu_fb.h | 12 +++- > 4 files changed, 77 insertions(+), 54 deletions(-) > > diff --git a/board/freescale/ls1021aqds/dcu.c b/board/freescale/ls1021aqds/dcu.c > index 14855ea1d9..c4eac5e302 100644 > --- a/board/freescale/ls1021aqds/dcu.c > +++ b/board/freescale/ls1021aqds/dcu.c > @@ -39,7 +39,9 @@ unsigned int dcu_set_pixel_clock(unsigned int pixclock) > return div; > } > > -int platform_dcu_init(unsigned int xres, unsigned int yres, > +int platform_dcu_init(struct fb_info *fbinfo, > + unsigned int xres, > + unsigned int yres, > const char *port, > struct fb_videomode *dcu_fb_videomode) > { > @@ -85,7 +87,7 @@ int platform_dcu_init(unsigned int xres, unsigned int yres, > printf("DCU: Switching to %s monitor @ %ux%u\n", name, xres, yres); > > pixel_format = 32; > - fsl_dcu_init(xres, yres, pixel_format); > + fsl_dcu_init(fbinfo, xres, yres, pixel_format); > > return 0; > } > diff --git a/board/toradex/colibri_vf/dcu.c b/board/toradex/colibri_vf/dcu.c > index c36e90cd22..c688ed79ff 100644 > --- a/board/toradex/colibri_vf/dcu.c > +++ b/board/toradex/colibri_vf/dcu.c > @@ -26,11 +26,13 @@ unsigned int dcu_set_pixel_clock(unsigned int pixclock) > return div; > } > > -int platform_dcu_init(unsigned int xres, unsigned int yres, > +int platform_dcu_init(struct fb_info *fbinfo, > + unsigned int xres, > + unsigned int yres, > const char *port, > struct fb_videomode *dcu_fb_videomode) > { > - fsl_dcu_init(xres, yres, 32); > + fsl_dcu_init(fbinfo, xres, yres, 32); > > return 0; > } > diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c > index 9f6e7f83b0..f789ec597d 100644 > --- a/drivers/video/fsl_dcu_fb.c > +++ b/drivers/video/fsl_dcu_fb.c > @@ -1,6 +1,7 @@ > // SPDX-License-Identifier: GPL-2.0+ > /* > * Copyright 2014 Freescale Semiconductor, Inc. > + * Copyright 2019 Toradex AG > * > * FSL DCU Framebuffer driver > */ > @@ -240,20 +241,22 @@ static void reset_total_layers(void) > } > } > > -static int layer_ctrldesc_init(int index, u32 pixel_format) > +static int layer_ctrldesc_init(struct fb_info fbinfo, > + int index, u32 pixel_format) > { > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > unsigned int bpp = BPP_24_RGB888; > > dcu_write32(®s->ctrldescl[index][0], > - DCU_CTRLDESCLN_1_HEIGHT(info.var.yres) | > - DCU_CTRLDESCLN_1_WIDTH(info.var.xres)); > + DCU_CTRLDESCLN_1_HEIGHT(fbinfo.var.yres) | > + DCU_CTRLDESCLN_1_WIDTH(fbinfo.var.xres)); > > dcu_write32(®s->ctrldescl[index][1], > DCU_CTRLDESCLN_2_POSY(0) | > DCU_CTRLDESCLN_2_POSX(0)); > > - dcu_write32(®s->ctrldescl[index][2], (unsigned int)info.screen_base); > + dcu_write32(®s->ctrldescl[index][2], > + (unsigned int)fbinfo.screen_base); > > switch (pixel_format) { > case 16: > @@ -294,42 +297,42 @@ static int layer_ctrldesc_init(int index, u32 pixel_format) > return 0; > } > > -int fsl_dcu_init(unsigned int xres, unsigned int yres, > - unsigned int pixel_format) > +int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, > + unsigned int yres, unsigned int pixel_format) > { > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > unsigned int div, mode; > > - info.screen_size = > - info.var.xres * info.var.yres * (info.var.bits_per_pixel / 8); > + fbinfo->screen_size = fbinfo->var.xres * fbinfo->var.yres * > + (fbinfo->var.bits_per_pixel / 8); > > - if (info.screen_size > CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB) { > - info.screen_size = 0; > + if (fbinfo->screen_size > CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB) { > + fbinfo->screen_size = 0; > return -ENOMEM; > } > > /* Reserve framebuffer at the end of memory */ > gd->fb_base = gd->bd->bi_dram[0].start + > - gd->bd->bi_dram[0].size - info.screen_size; > - info.screen_base = (char *)gd->fb_base; > + gd->bd->bi_dram[0].size - fbinfo->screen_size; > + fbinfo->screen_base = (char *)gd->fb_base; > > - memset(info.screen_base, 0, info.screen_size); > + memset(fbinfo->screen_base, 0, fbinfo->screen_size); > > reset_total_layers(); > > dcu_write32(®s->disp_size, > - DCU_DISP_SIZE_DELTA_Y(info.var.yres) | > - DCU_DISP_SIZE_DELTA_X(info.var.xres / 16)); > + DCU_DISP_SIZE_DELTA_Y(fbinfo->var.yres) | > + DCU_DISP_SIZE_DELTA_X(fbinfo->var.xres / 16)); > > dcu_write32(®s->hsyn_para, > - DCU_HSYN_PARA_BP(info.var.left_margin) | > - DCU_HSYN_PARA_PW(info.var.hsync_len) | > - DCU_HSYN_PARA_FP(info.var.right_margin)); > + DCU_HSYN_PARA_BP(fbinfo->var.left_margin) | > + DCU_HSYN_PARA_PW(fbinfo->var.hsync_len) | > + DCU_HSYN_PARA_FP(fbinfo->var.right_margin)); > > dcu_write32(®s->vsyn_para, > - DCU_VSYN_PARA_BP(info.var.upper_margin) | > - DCU_VSYN_PARA_PW(info.var.vsync_len) | > - DCU_VSYN_PARA_FP(info.var.lower_margin)); > + DCU_VSYN_PARA_BP(fbinfo->var.upper_margin) | > + DCU_VSYN_PARA_PW(fbinfo->var.vsync_len) | > + DCU_VSYN_PARA_FP(fbinfo->var.lower_margin)); > > dcu_write32(®s->synpol, > DCU_SYN_POL_INV_PXCK_FALL | > @@ -352,9 +355,9 @@ int fsl_dcu_init(unsigned int xres, unsigned int yres, > mode = dcu_read32(®s->mode); > dcu_write32(®s->mode, mode | DCU_MODE_NORMAL); > > - layer_ctrldesc_init(0, pixel_format); > + layer_ctrldesc_init(*fbinfo, 0, pixel_format); > > - div = dcu_set_pixel_clock(info.var.pixclock); > + div = dcu_set_pixel_clock(fbinfo->var.pixclock); > dcu_write32(®s->div_ratio, (div - 1)); > > dcu_write32(®s->update_mode, DCU_UPDATE_MODE_READREG); > @@ -367,24 +370,26 @@ ulong board_get_usable_ram_top(ulong total_size) > return gd->ram_top - CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB; > } > > -void *video_hw_init(void) > +int fsl_probe_common(struct fb_info *fbinfo, unsigned int *win_x, > + unsigned int *win_y) > { > - static GraphicDevice ctfb; > const char *options; > unsigned int depth = 0, freq = 0; > + > struct fb_videomode *fsl_dcu_mode_db = &fsl_dcu_mode_480_272; > > - if (!video_get_video_mode(&ctfb.winSizeX, &ctfb.winSizeY, &depth, &freq, > + if (!video_get_video_mode(win_x, win_y, &depth, &freq, > &options)) > - return NULL; > + return -EINVAL; > > /* Find the monitor port, which is a required option */ > if (!options) > - return NULL; > + return -EINVAL; > + > if (strncmp(options, "monitor=", 8) != 0) > - return NULL; > + return -EINVAL; > > - switch (RESOLUTION(ctfb.winSizeX, ctfb.winSizeY)) { > + switch (RESOLUTION(*win_x, *win_y)) { > case RESOLUTION(480, 272): > fsl_dcu_mode_db = &fsl_dcu_mode_480_272; > break; > @@ -402,25 +407,33 @@ void *video_hw_init(void) > break; > default: > printf("unsupported resolution %ux%u\n", > - ctfb.winSizeX, ctfb.winSizeY); > + *win_x, *win_y); > } > > - info.var.xres = fsl_dcu_mode_db->xres; > - info.var.yres = fsl_dcu_mode_db->yres; > - info.var.bits_per_pixel = 32; > - info.var.pixclock = fsl_dcu_mode_db->pixclock; > - info.var.left_margin = fsl_dcu_mode_db->left_margin; > - info.var.right_margin = fsl_dcu_mode_db->right_margin; > - info.var.upper_margin = fsl_dcu_mode_db->upper_margin; > - info.var.lower_margin = fsl_dcu_mode_db->lower_margin; > - info.var.hsync_len = fsl_dcu_mode_db->hsync_len; > - info.var.vsync_len = fsl_dcu_mode_db->vsync_len; > - info.var.sync = fsl_dcu_mode_db->sync; > - info.var.vmode = fsl_dcu_mode_db->vmode; > - info.fix.line_length = info.var.xres * info.var.bits_per_pixel / 8; > - > - if (platform_dcu_init(ctfb.winSizeX, ctfb.winSizeY, > - options + 8, fsl_dcu_mode_db) < 0) > + fbinfo->var.xres = fsl_dcu_mode_db->xres; > + fbinfo->var.yres = fsl_dcu_mode_db->yres; > + fbinfo->var.bits_per_pixel = 32; > + fbinfo->var.pixclock = fsl_dcu_mode_db->pixclock; > + fbinfo->var.left_margin = fsl_dcu_mode_db->left_margin; > + fbinfo->var.right_margin = fsl_dcu_mode_db->right_margin; > + fbinfo->var.upper_margin = fsl_dcu_mode_db->upper_margin; > + fbinfo->var.lower_margin = fsl_dcu_mode_db->lower_margin; > + fbinfo->var.hsync_len = fsl_dcu_mode_db->hsync_len; > + fbinfo->var.vsync_len = fsl_dcu_mode_db->vsync_len; > + fbinfo->var.sync = fsl_dcu_mode_db->sync; > + fbinfo->var.vmode = fsl_dcu_mode_db->vmode; > + fbinfo->fix.line_length = fbinfo->var.xres * > + fbinfo->var.bits_per_pixel / 8; > + > + return platform_dcu_init(fbinfo, *win_x, *win_y, > + options + 8, fsl_dcu_mode_db); > +} > + > +void *video_hw_init(void) > +{ > + static GraphicDevice ctfb; > + > + if (fsl_probe_common(&info, &ctfb.winSizeX, &ctfb.winSizeY) < 0) > return NULL; > > ctfb.frameAdrs = (unsigned int)info.screen_base; > diff --git a/include/fsl_dcu_fb.h b/include/fsl_dcu_fb.h > index 2dd5f54c3e..7a5347a924 100644 > --- a/include/fsl_dcu_fb.h > +++ b/include/fsl_dcu_fb.h > @@ -6,11 +6,17 @@ > */ > #include <linux/fb.h> > > -int fsl_dcu_init(unsigned int xres, unsigned int yres, > +int fsl_dcu_init(struct fb_info *fbinfo, > + unsigned int xres, > + unsigned int yres, > unsigned int pixel_format); > + > int fsl_dcu_fixedfb_setup(void *blob); > > /* Prototypes for external board-specific functions */ > -int platform_dcu_init(unsigned int xres, unsigned int yres, > - const char *port, struct fb_videomode *dcu_fb_videomode); > +int platform_dcu_init(struct fb_info *fbinfo, > + unsigned int xres, > + unsigned int yres, > + const char *port, > + struct fb_videomode *dcu_fb_videomode); > unsigned int dcu_set_pixel_clock(unsigned int pixclock); > -- > 2.17.1 > -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk mailto: igor.opaniuk at gmail.com skype: igor.opanyuk +380 (93) 836 40 67 http://ua.linkedin.com/in/iopaniuk ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions 2019-07-11 14:25 ` Igor Opaniuk @ 2019-07-11 15:16 ` Oleksandr Suvorov 0 siblings, 0 replies; 15+ messages in thread From: Oleksandr Suvorov @ 2019-07-11 15:16 UTC (permalink / raw) To: u-boot On Thu, 11 Jul 2019 at 17:26, Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > + Oleksandr, Philippe > > On Mon, Jun 10, 2019 at 2:47 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > > > Move dcu-related code to fsl_dcu_probe_common, keep in video_hw_init() > > only legacy video stack (filling GraphicPanel struct etc.). > > > > Add wrappers for all init functions, that will let to provide > > struct fb_info as an additional param (needed for further moving it from > > the global scope to driver private data struct in DM converted driver). > > > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> > > --- > > board/freescale/ls1021aqds/dcu.c | 6 +- > > board/toradex/colibri_vf/dcu.c | 6 +- > > drivers/video/fsl_dcu_fb.c | 107 +++++++++++++++++-------------- > > include/fsl_dcu_fb.h | 12 +++- > > 4 files changed, 77 insertions(+), 54 deletions(-) > > > > diff --git a/board/freescale/ls1021aqds/dcu.c b/board/freescale/ls1021aqds/dcu.c > > index 14855ea1d9..c4eac5e302 100644 > > --- a/board/freescale/ls1021aqds/dcu.c > > +++ b/board/freescale/ls1021aqds/dcu.c > > @@ -39,7 +39,9 @@ unsigned int dcu_set_pixel_clock(unsigned int pixclock) > > return div; > > } > > > > -int platform_dcu_init(unsigned int xres, unsigned int yres, > > +int platform_dcu_init(struct fb_info *fbinfo, > > + unsigned int xres, > > + unsigned int yres, > > const char *port, > > struct fb_videomode *dcu_fb_videomode) > > { > > @@ -85,7 +87,7 @@ int platform_dcu_init(unsigned int xres, unsigned int yres, > > printf("DCU: Switching to %s monitor @ %ux%u\n", name, xres, yres); > > > > pixel_format = 32; > > - fsl_dcu_init(xres, yres, pixel_format); > > + fsl_dcu_init(fbinfo, xres, yres, pixel_format); > > > > return 0; > > } > > diff --git a/board/toradex/colibri_vf/dcu.c b/board/toradex/colibri_vf/dcu.c > > index c36e90cd22..c688ed79ff 100644 > > --- a/board/toradex/colibri_vf/dcu.c > > +++ b/board/toradex/colibri_vf/dcu.c > > @@ -26,11 +26,13 @@ unsigned int dcu_set_pixel_clock(unsigned int pixclock) > > return div; > > } > > > > -int platform_dcu_init(unsigned int xres, unsigned int yres, > > +int platform_dcu_init(struct fb_info *fbinfo, > > + unsigned int xres, > > + unsigned int yres, > > const char *port, > > struct fb_videomode *dcu_fb_videomode) > > { > > - fsl_dcu_init(xres, yres, 32); > > + fsl_dcu_init(fbinfo, xres, yres, 32); > > > > return 0; > > } > > diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c > > index 9f6e7f83b0..f789ec597d 100644 > > --- a/drivers/video/fsl_dcu_fb.c > > +++ b/drivers/video/fsl_dcu_fb.c > > @@ -1,6 +1,7 @@ > > // SPDX-License-Identifier: GPL-2.0+ > > /* > > * Copyright 2014 Freescale Semiconductor, Inc. > > + * Copyright 2019 Toradex AG > > * > > * FSL DCU Framebuffer driver > > */ > > @@ -240,20 +241,22 @@ static void reset_total_layers(void) > > } > > } > > > > -static int layer_ctrldesc_init(int index, u32 pixel_format) > > +static int layer_ctrldesc_init(struct fb_info fbinfo, > > + int index, u32 pixel_format) > > { > > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > > unsigned int bpp = BPP_24_RGB888; > > > > dcu_write32(®s->ctrldescl[index][0], > > - DCU_CTRLDESCLN_1_HEIGHT(info.var.yres) | > > - DCU_CTRLDESCLN_1_WIDTH(info.var.xres)); > > + DCU_CTRLDESCLN_1_HEIGHT(fbinfo.var.yres) | > > + DCU_CTRLDESCLN_1_WIDTH(fbinfo.var.xres)); > > > > dcu_write32(®s->ctrldescl[index][1], > > DCU_CTRLDESCLN_2_POSY(0) | > > DCU_CTRLDESCLN_2_POSX(0)); > > > > - dcu_write32(®s->ctrldescl[index][2], (unsigned int)info.screen_base); > > + dcu_write32(®s->ctrldescl[index][2], > > + (unsigned int)fbinfo.screen_base); > > > > switch (pixel_format) { > > case 16: > > @@ -294,42 +297,42 @@ static int layer_ctrldesc_init(int index, u32 pixel_format) > > return 0; > > } > > > > -int fsl_dcu_init(unsigned int xres, unsigned int yres, > > - unsigned int pixel_format) > > +int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, > > + unsigned int yres, unsigned int pixel_format) > > { > > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > > unsigned int div, mode; > > > > - info.screen_size = > > - info.var.xres * info.var.yres * (info.var.bits_per_pixel / 8); > > + fbinfo->screen_size = fbinfo->var.xres * fbinfo->var.yres * > > + (fbinfo->var.bits_per_pixel / 8); > > > > - if (info.screen_size > CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB) { > > - info.screen_size = 0; > > + if (fbinfo->screen_size > CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB) { > > + fbinfo->screen_size = 0; > > return -ENOMEM; > > } > > > > /* Reserve framebuffer at the end of memory */ > > gd->fb_base = gd->bd->bi_dram[0].start + > > - gd->bd->bi_dram[0].size - info.screen_size; > > - info.screen_base = (char *)gd->fb_base; > > + gd->bd->bi_dram[0].size - fbinfo->screen_size; > > + fbinfo->screen_base = (char *)gd->fb_base; > > > > - memset(info.screen_base, 0, info.screen_size); > > + memset(fbinfo->screen_base, 0, fbinfo->screen_size); > > > > reset_total_layers(); > > > > dcu_write32(®s->disp_size, > > - DCU_DISP_SIZE_DELTA_Y(info.var.yres) | > > - DCU_DISP_SIZE_DELTA_X(info.var.xres / 16)); > > + DCU_DISP_SIZE_DELTA_Y(fbinfo->var.yres) | > > + DCU_DISP_SIZE_DELTA_X(fbinfo->var.xres / 16)); > > > > dcu_write32(®s->hsyn_para, > > - DCU_HSYN_PARA_BP(info.var.left_margin) | > > - DCU_HSYN_PARA_PW(info.var.hsync_len) | > > - DCU_HSYN_PARA_FP(info.var.right_margin)); > > + DCU_HSYN_PARA_BP(fbinfo->var.left_margin) | > > + DCU_HSYN_PARA_PW(fbinfo->var.hsync_len) | > > + DCU_HSYN_PARA_FP(fbinfo->var.right_margin)); > > > > dcu_write32(®s->vsyn_para, > > - DCU_VSYN_PARA_BP(info.var.upper_margin) | > > - DCU_VSYN_PARA_PW(info.var.vsync_len) | > > - DCU_VSYN_PARA_FP(info.var.lower_margin)); > > + DCU_VSYN_PARA_BP(fbinfo->var.upper_margin) | > > + DCU_VSYN_PARA_PW(fbinfo->var.vsync_len) | > > + DCU_VSYN_PARA_FP(fbinfo->var.lower_margin)); > > > > dcu_write32(®s->synpol, > > DCU_SYN_POL_INV_PXCK_FALL | > > @@ -352,9 +355,9 @@ int fsl_dcu_init(unsigned int xres, unsigned int yres, > > mode = dcu_read32(®s->mode); > > dcu_write32(®s->mode, mode | DCU_MODE_NORMAL); > > > > - layer_ctrldesc_init(0, pixel_format); > > + layer_ctrldesc_init(*fbinfo, 0, pixel_format); > > > > - div = dcu_set_pixel_clock(info.var.pixclock); > > + div = dcu_set_pixel_clock(fbinfo->var.pixclock); > > dcu_write32(®s->div_ratio, (div - 1)); > > > > dcu_write32(®s->update_mode, DCU_UPDATE_MODE_READREG); > > @@ -367,24 +370,26 @@ ulong board_get_usable_ram_top(ulong total_size) > > return gd->ram_top - CONFIG_VIDEO_FSL_DCU_MAX_FB_SIZE_MB; > > } > > > > -void *video_hw_init(void) > > +int fsl_probe_common(struct fb_info *fbinfo, unsigned int *win_x, > > + unsigned int *win_y) > > { > > - static GraphicDevice ctfb; > > const char *options; > > unsigned int depth = 0, freq = 0; > > + > > struct fb_videomode *fsl_dcu_mode_db = &fsl_dcu_mode_480_272; > > > > - if (!video_get_video_mode(&ctfb.winSizeX, &ctfb.winSizeY, &depth, &freq, > > + if (!video_get_video_mode(win_x, win_y, &depth, &freq, > > &options)) > > - return NULL; > > + return -EINVAL; > > > > /* Find the monitor port, which is a required option */ > > if (!options) > > - return NULL; > > + return -EINVAL; > > + > > if (strncmp(options, "monitor=", 8) != 0) > > - return NULL; > > + return -EINVAL; > > > > - switch (RESOLUTION(ctfb.winSizeX, ctfb.winSizeY)) { > > + switch (RESOLUTION(*win_x, *win_y)) { > > case RESOLUTION(480, 272): > > fsl_dcu_mode_db = &fsl_dcu_mode_480_272; > > break; > > @@ -402,25 +407,33 @@ void *video_hw_init(void) > > break; > > default: > > printf("unsupported resolution %ux%u\n", > > - ctfb.winSizeX, ctfb.winSizeY); > > + *win_x, *win_y); > > } > > > > - info.var.xres = fsl_dcu_mode_db->xres; > > - info.var.yres = fsl_dcu_mode_db->yres; > > - info.var.bits_per_pixel = 32; > > - info.var.pixclock = fsl_dcu_mode_db->pixclock; > > - info.var.left_margin = fsl_dcu_mode_db->left_margin; > > - info.var.right_margin = fsl_dcu_mode_db->right_margin; > > - info.var.upper_margin = fsl_dcu_mode_db->upper_margin; > > - info.var.lower_margin = fsl_dcu_mode_db->lower_margin; > > - info.var.hsync_len = fsl_dcu_mode_db->hsync_len; > > - info.var.vsync_len = fsl_dcu_mode_db->vsync_len; > > - info.var.sync = fsl_dcu_mode_db->sync; > > - info.var.vmode = fsl_dcu_mode_db->vmode; > > - info.fix.line_length = info.var.xres * info.var.bits_per_pixel / 8; > > - > > - if (platform_dcu_init(ctfb.winSizeX, ctfb.winSizeY, > > - options + 8, fsl_dcu_mode_db) < 0) > > + fbinfo->var.xres = fsl_dcu_mode_db->xres; > > + fbinfo->var.yres = fsl_dcu_mode_db->yres; > > + fbinfo->var.bits_per_pixel = 32; > > + fbinfo->var.pixclock = fsl_dcu_mode_db->pixclock; > > + fbinfo->var.left_margin = fsl_dcu_mode_db->left_margin; > > + fbinfo->var.right_margin = fsl_dcu_mode_db->right_margin; > > + fbinfo->var.upper_margin = fsl_dcu_mode_db->upper_margin; > > + fbinfo->var.lower_margin = fsl_dcu_mode_db->lower_margin; > > + fbinfo->var.hsync_len = fsl_dcu_mode_db->hsync_len; > > + fbinfo->var.vsync_len = fsl_dcu_mode_db->vsync_len; > > + fbinfo->var.sync = fsl_dcu_mode_db->sync; > > + fbinfo->var.vmode = fsl_dcu_mode_db->vmode; > > + fbinfo->fix.line_length = fbinfo->var.xres * > > + fbinfo->var.bits_per_pixel / 8; > > + > > + return platform_dcu_init(fbinfo, *win_x, *win_y, > > + options + 8, fsl_dcu_mode_db); > > +} > > + > > +void *video_hw_init(void) > > +{ > > + static GraphicDevice ctfb; > > + > > + if (fsl_probe_common(&info, &ctfb.winSizeX, &ctfb.winSizeY) < 0) > > return NULL; > > > > ctfb.frameAdrs = (unsigned int)info.screen_base; > > diff --git a/include/fsl_dcu_fb.h b/include/fsl_dcu_fb.h > > index 2dd5f54c3e..7a5347a924 100644 > > --- a/include/fsl_dcu_fb.h > > +++ b/include/fsl_dcu_fb.h > > @@ -6,11 +6,17 @@ > > */ > > #include <linux/fb.h> > > > > -int fsl_dcu_init(unsigned int xres, unsigned int yres, > > +int fsl_dcu_init(struct fb_info *fbinfo, > > + unsigned int xres, > > + unsigned int yres, > > unsigned int pixel_format); > > + > > int fsl_dcu_fixedfb_setup(void *blob); > > > > /* Prototypes for external board-specific functions */ > > -int platform_dcu_init(unsigned int xres, unsigned int yres, > > - const char *port, struct fb_videomode *dcu_fb_videomode); > > +int platform_dcu_init(struct fb_info *fbinfo, > > + unsigned int xres, > > + unsigned int yres, > > + const char *port, > > + struct fb_videomode *dcu_fb_videomode); > > unsigned int dcu_set_pixel_clock(unsigned int pixclock); > > -- > > 2.17.1 > > > > > -- > Best regards - Freundliche Grüsse - Meilleures salutations > > Igor Opaniuk > > mailto: igor.opaniuk at gmail.com > skype: igor.opanyuk > +380 (93) 836 40 67 > http://ua.linkedin.com/in/iopaniuk > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Best regards Oleksandr Suvorov Toradex AG Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 4800 (main line) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions Igor Opaniuk @ 2019-06-10 11:47 ` Igor Opaniuk 2019-07-11 14:26 ` Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node Igor Opaniuk ` (3 subsequent siblings) 5 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-06-10 11:47 UTC (permalink / raw) To: u-boot From: Igor Opaniuk <igor.opaniuk@toradex.com> Extend the driver to build with DM_VIDEO enabled. DTS files must additionally include 'u-boot,dm-pre-reloc' property in soc and child nodes to enable driver binding to fsl_dcu_fb device. Currently display timings aren't obtained from DT. Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> --- board/toradex/colibri_vf/colibri_vf.c | 4 +- drivers/video/Kconfig | 2 +- drivers/video/fsl_dcu_fb.c | 112 +++++++++++++++++++++----- 3 files changed, 97 insertions(+), 21 deletions(-) diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c index 9d63fbf3bd..dad754b31f 100644 --- a/board/toradex/colibri_vf/colibri_vf.c +++ b/board/toradex/colibri_vf/colibri_vf.c @@ -430,7 +430,9 @@ int checkboard(void) #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) int ft_board_setup(void *blob, bd_t *bd) { +#ifndef CONFIG_DM_VIDEO int ret = 0; +#endif #ifdef CONFIG_FDT_FIXUP_PARTITIONS static const struct node_info nodes[] = { { "fsl,vf610-nfc", MTD_DEV_TYPE_NAND, }, /* NAND flash */ @@ -440,7 +442,7 @@ int ft_board_setup(void *blob, bd_t *bd) puts(" Updating MTD partitions...\n"); fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); #endif -#ifdef CONFIG_VIDEO_FSL_DCU_FB +#if defined(CONFIG_VIDEO_FSL_DCU_FB) && !defined(CONFIG_DM_VIDEO) ret = fsl_dcu_fixedfb_setup(blob); if (ret) return ret; diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index c3781b160d..261fa98517 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -484,7 +484,7 @@ config VIDEO_IVYBRIDGE_IGD config VIDEO_FSL_DCU_FB bool "Enable Freescale Display Control Unit" - depends on VIDEO + depends on VIDEO || DM_VIDEO help This enables support for Freescale Display Control Unit (DCU4) module found on Freescale Vybrid and QorIQ family of SoCs. diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c index f789ec597d..add64b85b5 100644 --- a/drivers/video/fsl_dcu_fb.c +++ b/drivers/video/fsl_dcu_fb.c @@ -8,10 +8,12 @@ #include <asm/io.h> #include <common.h> +#include <dm.h> #include <fdt_support.h> #include <fsl_dcu_fb.h> #include <linux/fb.h> #include <malloc.h> +#include <video.h> #include <video_fb.h> #include "videomodes.h" @@ -219,8 +221,6 @@ struct dcu_reg { u32 ctrldescl[DCU_LAYER_MAX_NUM][16]; }; -static struct fb_info info; - static void reset_total_layers(void) { struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; @@ -302,7 +302,11 @@ int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, { struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; unsigned int div, mode; - +/* + * When DM_VIDEO is enabled reservation of framebuffer is done + * in advance during bind() call. + */ +#if !CONFIG_IS_ENABLED(DM_VIDEO) fbinfo->screen_size = fbinfo->var.xres * fbinfo->var.yres * (fbinfo->var.bits_per_pixel / 8); @@ -310,13 +314,13 @@ int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, fbinfo->screen_size = 0; return -ENOMEM; } - /* Reserve framebuffer at the end of memory */ gd->fb_base = gd->bd->bi_dram[0].start + gd->bd->bi_dram[0].size - fbinfo->screen_size; fbinfo->screen_base = (char *)gd->fb_base; memset(fbinfo->screen_base, 0, fbinfo->screen_size); +#endif reset_total_layers(); @@ -429,6 +433,32 @@ int fsl_probe_common(struct fb_info *fbinfo, unsigned int *win_x, options + 8, fsl_dcu_mode_db); } +#ifndef CONFIG_DM_VIDEO +static struct fb_info info; + +#if defined(CONFIG_OF_BOARD_SETUP) +int fsl_dcu_fixedfb_setup(void *blob) +{ + u64 start, size; + int ret; + + start = gd->bd->bi_dram[0].start; + size = gd->bd->bi_dram[0].size - info.screen_size; + + /* + * Align size on section size (1 MiB). + */ + size &= 0xfff00000; + ret = fdt_fixup_memory_banks(blob, &start, &size, 1); + if (ret) { + eprintf("Cannot setup fb: Error reserving memory\n"); + return ret; + } + + return 0; +} +#endif + void *video_hw_init(void) { static GraphicDevice ctfb; @@ -448,25 +478,69 @@ void *video_hw_init(void) return &ctfb; } -#if defined(CONFIG_OF_BOARD_SETUP) -int fsl_dcu_fixedfb_setup(void *blob) +#else /* ifndef CONFIG_DM_VIDEO */ + +static int fsl_dcu_video_probe(struct udevice *dev) { - u64 start, size; - int ret; + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + struct video_priv *uc_priv = dev_get_uclass_priv(dev); + struct fb_info fbinfo = { 0 }; + unsigned int win_x; + unsigned int win_y; + u32 fb_start, fb_end; + int ret = 0; + + fb_start = plat->base & ~(MMU_SECTION_SIZE - 1); + fb_end = plat->base + plat->size; + fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT); + + fbinfo.screen_base = (char *)fb_start; + fbinfo.screen_size = plat->size; + + ret = fsl_probe_common(&fbinfo, &win_x, &win_y); + if (ret < 0) + return ret; - start = gd->bd->bi_dram[0].start; - size = gd->bd->bi_dram[0].size - info.screen_size; + uc_priv->bpix = VIDEO_BPP32; + uc_priv->xsize = win_x; + uc_priv->ysize = win_y; - /* - * Align size on section size (1 MiB). - */ - size &= 0xfff00000; - ret = fdt_fixup_memory_banks(blob, &start, &size, 1); - if (ret) { - eprintf("Cannot setup fb: Error reserving memory\n"); + /* Enable dcache for the frame buffer */ + mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start, + DCACHE_WRITEBACK); + video_set_flush_dcache(dev, true); + return ret; +} + +static int fsl_dcu_video_bind(struct udevice *dev) +{ + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); + unsigned int win_x; + unsigned int win_y; + unsigned int depth = 0, freq = 0; + const char *options; + int ret = 0; + + ret = video_get_video_mode(&win_x, &win_y, &depth, &freq, &options); + if (ret < 0) return ret; - } + + plat->size = win_x * win_y * 32; return 0; } -#endif + +static const struct udevice_id fsl_dcu_video_ids[] = { + { .compatible = "fsl,vf610-dcu" }, + { /* sentinel */ } +}; + +U_BOOT_DRIVER(fsl_dcu_video) = { + .name = "fsl_dcu_video", + .id = UCLASS_VIDEO, + .of_match = fsl_dcu_video_ids, + .bind = fsl_dcu_video_bind, + .probe = fsl_dcu_video_probe, + .flags = DM_FLAG_PRE_RELOC, +}; +#endif /* ifndef CONFIG_DM_VIDEO */ -- 2.17.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support 2019-06-10 11:47 ` [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support Igor Opaniuk @ 2019-07-11 14:26 ` Igor Opaniuk 2019-07-12 13:32 ` Oleksandr Suvorov 0 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-07-11 14:26 UTC (permalink / raw) To: u-boot + Oleksandr, Philippe On Mon, Jun 10, 2019 at 2:47 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > Extend the driver to build with DM_VIDEO enabled. DTS files > must additionally include 'u-boot,dm-pre-reloc' property in > soc and child nodes to enable driver binding to fsl_dcu_fb device. > > Currently display timings aren't obtained from DT. > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> > --- > board/toradex/colibri_vf/colibri_vf.c | 4 +- > drivers/video/Kconfig | 2 +- > drivers/video/fsl_dcu_fb.c | 112 +++++++++++++++++++++----- > 3 files changed, 97 insertions(+), 21 deletions(-) > > diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c > index 9d63fbf3bd..dad754b31f 100644 > --- a/board/toradex/colibri_vf/colibri_vf.c > +++ b/board/toradex/colibri_vf/colibri_vf.c > @@ -430,7 +430,9 @@ int checkboard(void) > #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) > int ft_board_setup(void *blob, bd_t *bd) > { > +#ifndef CONFIG_DM_VIDEO > int ret = 0; > +#endif > #ifdef CONFIG_FDT_FIXUP_PARTITIONS > static const struct node_info nodes[] = { > { "fsl,vf610-nfc", MTD_DEV_TYPE_NAND, }, /* NAND flash */ > @@ -440,7 +442,7 @@ int ft_board_setup(void *blob, bd_t *bd) > puts(" Updating MTD partitions...\n"); > fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); > #endif > -#ifdef CONFIG_VIDEO_FSL_DCU_FB > +#if defined(CONFIG_VIDEO_FSL_DCU_FB) && !defined(CONFIG_DM_VIDEO) > ret = fsl_dcu_fixedfb_setup(blob); > if (ret) > return ret; > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > index c3781b160d..261fa98517 100644 > --- a/drivers/video/Kconfig > +++ b/drivers/video/Kconfig > @@ -484,7 +484,7 @@ config VIDEO_IVYBRIDGE_IGD > > config VIDEO_FSL_DCU_FB > bool "Enable Freescale Display Control Unit" > - depends on VIDEO > + depends on VIDEO || DM_VIDEO > help > This enables support for Freescale Display Control Unit (DCU4) > module found on Freescale Vybrid and QorIQ family of SoCs. > diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c > index f789ec597d..add64b85b5 100644 > --- a/drivers/video/fsl_dcu_fb.c > +++ b/drivers/video/fsl_dcu_fb.c > @@ -8,10 +8,12 @@ > > #include <asm/io.h> > #include <common.h> > +#include <dm.h> > #include <fdt_support.h> > #include <fsl_dcu_fb.h> > #include <linux/fb.h> > #include <malloc.h> > +#include <video.h> > #include <video_fb.h> > #include "videomodes.h" > > @@ -219,8 +221,6 @@ struct dcu_reg { > u32 ctrldescl[DCU_LAYER_MAX_NUM][16]; > }; > > -static struct fb_info info; > - > static void reset_total_layers(void) > { > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > @@ -302,7 +302,11 @@ int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, > { > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > unsigned int div, mode; > - > +/* > + * When DM_VIDEO is enabled reservation of framebuffer is done > + * in advance during bind() call. > + */ > +#if !CONFIG_IS_ENABLED(DM_VIDEO) > fbinfo->screen_size = fbinfo->var.xres * fbinfo->var.yres * > (fbinfo->var.bits_per_pixel / 8); > > @@ -310,13 +314,13 @@ int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, > fbinfo->screen_size = 0; > return -ENOMEM; > } > - > /* Reserve framebuffer at the end of memory */ > gd->fb_base = gd->bd->bi_dram[0].start + > gd->bd->bi_dram[0].size - fbinfo->screen_size; > fbinfo->screen_base = (char *)gd->fb_base; > > memset(fbinfo->screen_base, 0, fbinfo->screen_size); > +#endif > > reset_total_layers(); > > @@ -429,6 +433,32 @@ int fsl_probe_common(struct fb_info *fbinfo, unsigned int *win_x, > options + 8, fsl_dcu_mode_db); > } > > +#ifndef CONFIG_DM_VIDEO > +static struct fb_info info; > + > +#if defined(CONFIG_OF_BOARD_SETUP) > +int fsl_dcu_fixedfb_setup(void *blob) > +{ > + u64 start, size; > + int ret; > + > + start = gd->bd->bi_dram[0].start; > + size = gd->bd->bi_dram[0].size - info.screen_size; > + > + /* > + * Align size on section size (1 MiB). > + */ > + size &= 0xfff00000; > + ret = fdt_fixup_memory_banks(blob, &start, &size, 1); > + if (ret) { > + eprintf("Cannot setup fb: Error reserving memory\n"); > + return ret; > + } > + > + return 0; > +} > +#endif > + > void *video_hw_init(void) > { > static GraphicDevice ctfb; > @@ -448,25 +478,69 @@ void *video_hw_init(void) > return &ctfb; > } > > -#if defined(CONFIG_OF_BOARD_SETUP) > -int fsl_dcu_fixedfb_setup(void *blob) > +#else /* ifndef CONFIG_DM_VIDEO */ > + > +static int fsl_dcu_video_probe(struct udevice *dev) > { > - u64 start, size; > - int ret; > + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); > + struct video_priv *uc_priv = dev_get_uclass_priv(dev); > + struct fb_info fbinfo = { 0 }; > + unsigned int win_x; > + unsigned int win_y; > + u32 fb_start, fb_end; > + int ret = 0; > + > + fb_start = plat->base & ~(MMU_SECTION_SIZE - 1); > + fb_end = plat->base + plat->size; > + fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT); > + > + fbinfo.screen_base = (char *)fb_start; > + fbinfo.screen_size = plat->size; > + > + ret = fsl_probe_common(&fbinfo, &win_x, &win_y); > + if (ret < 0) > + return ret; > > - start = gd->bd->bi_dram[0].start; > - size = gd->bd->bi_dram[0].size - info.screen_size; > + uc_priv->bpix = VIDEO_BPP32; > + uc_priv->xsize = win_x; > + uc_priv->ysize = win_y; > > - /* > - * Align size on section size (1 MiB). > - */ > - size &= 0xfff00000; > - ret = fdt_fixup_memory_banks(blob, &start, &size, 1); > - if (ret) { > - eprintf("Cannot setup fb: Error reserving memory\n"); > + /* Enable dcache for the frame buffer */ > + mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start, > + DCACHE_WRITEBACK); > + video_set_flush_dcache(dev, true); > + return ret; > +} > + > +static int fsl_dcu_video_bind(struct udevice *dev) > +{ > + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); > + unsigned int win_x; > + unsigned int win_y; > + unsigned int depth = 0, freq = 0; > + const char *options; > + int ret = 0; > + > + ret = video_get_video_mode(&win_x, &win_y, &depth, &freq, &options); > + if (ret < 0) > return ret; > - } > + > + plat->size = win_x * win_y * 32; > > return 0; > } > -#endif > + > +static const struct udevice_id fsl_dcu_video_ids[] = { > + { .compatible = "fsl,vf610-dcu" }, > + { /* sentinel */ } > +}; > + > +U_BOOT_DRIVER(fsl_dcu_video) = { > + .name = "fsl_dcu_video", > + .id = UCLASS_VIDEO, > + .of_match = fsl_dcu_video_ids, > + .bind = fsl_dcu_video_bind, > + .probe = fsl_dcu_video_probe, > + .flags = DM_FLAG_PRE_RELOC, > +}; > +#endif /* ifndef CONFIG_DM_VIDEO */ > -- > 2.17.1 > -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk mailto: igor.opaniuk at gmail.com skype: igor.opanyuk +380 (93) 836 40 67 http://ua.linkedin.com/in/iopaniuk ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support 2019-07-11 14:26 ` Igor Opaniuk @ 2019-07-12 13:32 ` Oleksandr Suvorov 0 siblings, 0 replies; 15+ messages in thread From: Oleksandr Suvorov @ 2019-07-12 13:32 UTC (permalink / raw) To: u-boot On Thu, 11 Jul 2019 at 17:27, Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > + Oleksandr, Philippe > > On Mon, Jun 10, 2019 at 2:47 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > > > Extend the driver to build with DM_VIDEO enabled. DTS files > > must additionally include 'u-boot,dm-pre-reloc' property in > > soc and child nodes to enable driver binding to fsl_dcu_fb device. > > > > Currently display timings aren't obtained from DT. > > > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> > > --- > > board/toradex/colibri_vf/colibri_vf.c | 4 +- > > drivers/video/Kconfig | 2 +- > > drivers/video/fsl_dcu_fb.c | 112 +++++++++++++++++++++----- > > 3 files changed, 97 insertions(+), 21 deletions(-) > > > > diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c > > index 9d63fbf3bd..dad754b31f 100644 > > --- a/board/toradex/colibri_vf/colibri_vf.c > > +++ b/board/toradex/colibri_vf/colibri_vf.c > > @@ -430,7 +430,9 @@ int checkboard(void) > > #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) > > int ft_board_setup(void *blob, bd_t *bd) > > { > > +#ifndef CONFIG_DM_VIDEO > > int ret = 0; > > +#endif > > #ifdef CONFIG_FDT_FIXUP_PARTITIONS > > static const struct node_info nodes[] = { > > { "fsl,vf610-nfc", MTD_DEV_TYPE_NAND, }, /* NAND flash */ > > @@ -440,7 +442,7 @@ int ft_board_setup(void *blob, bd_t *bd) > > puts(" Updating MTD partitions...\n"); > > fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes)); > > #endif > > -#ifdef CONFIG_VIDEO_FSL_DCU_FB > > +#if defined(CONFIG_VIDEO_FSL_DCU_FB) && !defined(CONFIG_DM_VIDEO) > > ret = fsl_dcu_fixedfb_setup(blob); > > if (ret) > > return ret; > > diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig > > index c3781b160d..261fa98517 100644 > > --- a/drivers/video/Kconfig > > +++ b/drivers/video/Kconfig > > @@ -484,7 +484,7 @@ config VIDEO_IVYBRIDGE_IGD > > > > config VIDEO_FSL_DCU_FB > > bool "Enable Freescale Display Control Unit" > > - depends on VIDEO > > + depends on VIDEO || DM_VIDEO > > help > > This enables support for Freescale Display Control Unit (DCU4) > > module found on Freescale Vybrid and QorIQ family of SoCs. > > diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c > > index f789ec597d..add64b85b5 100644 > > --- a/drivers/video/fsl_dcu_fb.c > > +++ b/drivers/video/fsl_dcu_fb.c > > @@ -8,10 +8,12 @@ > > > > #include <asm/io.h> > > #include <common.h> > > +#include <dm.h> > > #include <fdt_support.h> > > #include <fsl_dcu_fb.h> > > #include <linux/fb.h> > > #include <malloc.h> > > +#include <video.h> > > #include <video_fb.h> > > #include "videomodes.h" > > > > @@ -219,8 +221,6 @@ struct dcu_reg { > > u32 ctrldescl[DCU_LAYER_MAX_NUM][16]; > > }; > > > > -static struct fb_info info; > > - > > static void reset_total_layers(void) > > { > > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > > @@ -302,7 +302,11 @@ int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, > > { > > struct dcu_reg *regs = (struct dcu_reg *)CONFIG_SYS_DCU_ADDR; > > unsigned int div, mode; > > - > > +/* > > + * When DM_VIDEO is enabled reservation of framebuffer is done > > + * in advance during bind() call. > > + */ > > +#if !CONFIG_IS_ENABLED(DM_VIDEO) > > fbinfo->screen_size = fbinfo->var.xres * fbinfo->var.yres * > > (fbinfo->var.bits_per_pixel / 8); > > > > @@ -310,13 +314,13 @@ int fsl_dcu_init(struct fb_info *fbinfo, unsigned int xres, > > fbinfo->screen_size = 0; > > return -ENOMEM; > > } > > - > > /* Reserve framebuffer at the end of memory */ > > gd->fb_base = gd->bd->bi_dram[0].start + > > gd->bd->bi_dram[0].size - fbinfo->screen_size; > > fbinfo->screen_base = (char *)gd->fb_base; > > > > memset(fbinfo->screen_base, 0, fbinfo->screen_size); > > +#endif > > > > reset_total_layers(); > > > > @@ -429,6 +433,32 @@ int fsl_probe_common(struct fb_info *fbinfo, unsigned int *win_x, > > options + 8, fsl_dcu_mode_db); > > } > > > > +#ifndef CONFIG_DM_VIDEO > > +static struct fb_info info; > > + > > +#if defined(CONFIG_OF_BOARD_SETUP) > > +int fsl_dcu_fixedfb_setup(void *blob) > > +{ > > + u64 start, size; > > + int ret; > > + > > + start = gd->bd->bi_dram[0].start; > > + size = gd->bd->bi_dram[0].size - info.screen_size; > > + > > + /* > > + * Align size on section size (1 MiB). > > + */ > > + size &= 0xfff00000; > > + ret = fdt_fixup_memory_banks(blob, &start, &size, 1); > > + if (ret) { > > + eprintf("Cannot setup fb: Error reserving memory\n"); > > + return ret; > > + } > > + > > + return 0; > > +} > > +#endif > > + > > void *video_hw_init(void) > > { > > static GraphicDevice ctfb; > > @@ -448,25 +478,69 @@ void *video_hw_init(void) > > return &ctfb; > > } > > > > -#if defined(CONFIG_OF_BOARD_SETUP) > > -int fsl_dcu_fixedfb_setup(void *blob) > > +#else /* ifndef CONFIG_DM_VIDEO */ > > + > > +static int fsl_dcu_video_probe(struct udevice *dev) > > { > > - u64 start, size; > > - int ret; > > + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); > > + struct video_priv *uc_priv = dev_get_uclass_priv(dev); > > + struct fb_info fbinfo = { 0 }; > > + unsigned int win_x; > > + unsigned int win_y; > > + u32 fb_start, fb_end; > > + int ret = 0; > > + > > + fb_start = plat->base & ~(MMU_SECTION_SIZE - 1); > > + fb_end = plat->base + plat->size; > > + fb_end = ALIGN(fb_end, 1 << MMU_SECTION_SHIFT); > > + > > + fbinfo.screen_base = (char *)fb_start; > > + fbinfo.screen_size = plat->size; > > + > > + ret = fsl_probe_common(&fbinfo, &win_x, &win_y); > > + if (ret < 0) > > + return ret; > > > > - start = gd->bd->bi_dram[0].start; > > - size = gd->bd->bi_dram[0].size - info.screen_size; > > + uc_priv->bpix = VIDEO_BPP32; > > + uc_priv->xsize = win_x; > > + uc_priv->ysize = win_y; > > > > - /* > > - * Align size on section size (1 MiB). > > - */ > > - size &= 0xfff00000; > > - ret = fdt_fixup_memory_banks(blob, &start, &size, 1); > > - if (ret) { > > - eprintf("Cannot setup fb: Error reserving memory\n"); > > + /* Enable dcache for the frame buffer */ > > + mmu_set_region_dcache_behaviour(fb_start, fb_end - fb_start, > > + DCACHE_WRITEBACK); > > + video_set_flush_dcache(dev, true); > > + return ret; > > +} > > + > > +static int fsl_dcu_video_bind(struct udevice *dev) > > +{ > > + struct video_uc_platdata *plat = dev_get_uclass_platdata(dev); > > + unsigned int win_x; > > + unsigned int win_y; > > + unsigned int depth = 0, freq = 0; > > + const char *options; > > + int ret = 0; > > + > > + ret = video_get_video_mode(&win_x, &win_y, &depth, &freq, &options); > > + if (ret < 0) > > return ret; > > - } > > + > > + plat->size = win_x * win_y * 32; > > > > return 0; > > } > > -#endif > > + > > +static const struct udevice_id fsl_dcu_video_ids[] = { > > + { .compatible = "fsl,vf610-dcu" }, > > + { /* sentinel */ } > > +}; > > + > > +U_BOOT_DRIVER(fsl_dcu_video) = { > > + .name = "fsl_dcu_video", > > + .id = UCLASS_VIDEO, > > + .of_match = fsl_dcu_video_ids, > > + .bind = fsl_dcu_video_bind, > > + .probe = fsl_dcu_video_probe, > > + .flags = DM_FLAG_PRE_RELOC, > > +}; > > +#endif /* ifndef CONFIG_DM_VIDEO */ > > -- > > 2.17.1 > > > > > -- > Best regards - Freundliche Grüsse - Meilleures salutations > > Igor Opaniuk > > mailto: igor.opaniuk at gmail.com > skype: igor.opanyuk > +380 (93) 836 40 67 > http://ua.linkedin.com/in/iopaniuk > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Best regards Oleksandr Suvorov Toradex AG Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 4800 (main line) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support Igor Opaniuk @ 2019-06-10 11:47 ` Igor Opaniuk 2019-07-11 14:26 ` Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO Igor Opaniuk ` (2 subsequent siblings) 5 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-06-10 11:47 UTC (permalink / raw) To: u-boot From: Igor Opaniuk <igor.opaniuk@toradex.com> Add dumb node for NXP Display Control Unit0(DCU), which permits DM_ENABLED converted driver to be probed. Currently no display timings are provided in this node. Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> --- arch/arm/dts/vf-colibri-u-boot.dtsi | 4 ++++ arch/arm/dts/vf-colibri.dtsi | 5 +++++ arch/arm/dts/vf.dtsi | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/arch/arm/dts/vf-colibri-u-boot.dtsi b/arch/arm/dts/vf-colibri-u-boot.dtsi index db86739805..2294ee9551 100644 --- a/arch/arm/dts/vf-colibri-u-boot.dtsi +++ b/arch/arm/dts/vf-colibri-u-boot.dtsi @@ -21,3 +21,7 @@ &uart0 { u-boot,dm-pre-reloc; }; + +&dcu0 { + u-boot,dm-pre-reloc; +}; diff --git a/arch/arm/dts/vf-colibri.dtsi b/arch/arm/dts/vf-colibri.dtsi index 91ca4e4ddd..9de4b28e87 100644 --- a/arch/arm/dts/vf-colibri.dtsi +++ b/arch/arm/dts/vf-colibri.dtsi @@ -14,6 +14,7 @@ aliases { usb0 = &ehci0; /* required for ums */ + display1 = &dcu0; }; reg_usbh_vbus: regulator-usbh-vbus { @@ -241,3 +242,7 @@ pinctrl-0 = <&pinctrl_uart0>; status = "okay"; }; + +&dcu0 { + status = "okay"; +}; diff --git a/arch/arm/dts/vf.dtsi b/arch/arm/dts/vf.dtsi index 5e3b2c5b9d..5f69d0fd6e 100644 --- a/arch/arm/dts/vf.dtsi +++ b/arch/arm/dts/vf.dtsi @@ -145,6 +145,12 @@ #gpio-cells = <2>; }; + dcu0: dcu at 40058000 { + compatible = "fsl,vf610-dcu"; + reg = <0x40058000 0x1200>; + status = "disabled"; + }; + ehci0: ehci at 40034000 { compatible = "fsl,vf610-usb"; reg = <0x40034000 0x800>; -- 2.17.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node 2019-06-10 11:47 ` [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node Igor Opaniuk @ 2019-07-11 14:26 ` Igor Opaniuk 2019-07-12 13:33 ` Oleksandr Suvorov 0 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-07-11 14:26 UTC (permalink / raw) To: u-boot + Oleksandr, Philippe On Mon, Jun 10, 2019 at 2:48 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > Add dumb node for NXP Display Control Unit0(DCU), which permits DM_ENABLED > converted driver to be probed. Currently no display timings are provided > in this node. > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> > --- > arch/arm/dts/vf-colibri-u-boot.dtsi | 4 ++++ > arch/arm/dts/vf-colibri.dtsi | 5 +++++ > arch/arm/dts/vf.dtsi | 6 ++++++ > 3 files changed, 15 insertions(+) > > diff --git a/arch/arm/dts/vf-colibri-u-boot.dtsi b/arch/arm/dts/vf-colibri-u-boot.dtsi > index db86739805..2294ee9551 100644 > --- a/arch/arm/dts/vf-colibri-u-boot.dtsi > +++ b/arch/arm/dts/vf-colibri-u-boot.dtsi > @@ -21,3 +21,7 @@ > &uart0 { > u-boot,dm-pre-reloc; > }; > + > +&dcu0 { > + u-boot,dm-pre-reloc; > +}; > diff --git a/arch/arm/dts/vf-colibri.dtsi b/arch/arm/dts/vf-colibri.dtsi > index 91ca4e4ddd..9de4b28e87 100644 > --- a/arch/arm/dts/vf-colibri.dtsi > +++ b/arch/arm/dts/vf-colibri.dtsi > @@ -14,6 +14,7 @@ > > aliases { > usb0 = &ehci0; /* required for ums */ > + display1 = &dcu0; > }; > > reg_usbh_vbus: regulator-usbh-vbus { > @@ -241,3 +242,7 @@ > pinctrl-0 = <&pinctrl_uart0>; > status = "okay"; > }; > + > +&dcu0 { > + status = "okay"; > +}; > diff --git a/arch/arm/dts/vf.dtsi b/arch/arm/dts/vf.dtsi > index 5e3b2c5b9d..5f69d0fd6e 100644 > --- a/arch/arm/dts/vf.dtsi > +++ b/arch/arm/dts/vf.dtsi > @@ -145,6 +145,12 @@ > #gpio-cells = <2>; > }; > > + dcu0: dcu at 40058000 { > + compatible = "fsl,vf610-dcu"; > + reg = <0x40058000 0x1200>; > + status = "disabled"; > + }; > + > ehci0: ehci at 40034000 { > compatible = "fsl,vf610-usb"; > reg = <0x40034000 0x800>; > -- > 2.17.1 > -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk mailto: igor.opaniuk at gmail.com skype: igor.opanyuk +380 (93) 836 40 67 http://ua.linkedin.com/in/iopaniuk ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node 2019-07-11 14:26 ` Igor Opaniuk @ 2019-07-12 13:33 ` Oleksandr Suvorov 0 siblings, 0 replies; 15+ messages in thread From: Oleksandr Suvorov @ 2019-07-12 13:33 UTC (permalink / raw) To: u-boot On Thu, 11 Jul 2019 at 17:27, Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > + Oleksandr, Philippe > > On Mon, Jun 10, 2019 at 2:48 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > > > Add dumb node for NXP Display Control Unit0(DCU), which permits DM_ENABLED > > converted driver to be probed. Currently no display timings are provided > > in this node. > > > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> > > --- > > arch/arm/dts/vf-colibri-u-boot.dtsi | 4 ++++ > > arch/arm/dts/vf-colibri.dtsi | 5 +++++ > > arch/arm/dts/vf.dtsi | 6 ++++++ > > 3 files changed, 15 insertions(+) > > > > diff --git a/arch/arm/dts/vf-colibri-u-boot.dtsi b/arch/arm/dts/vf-colibri-u-boot.dtsi > > index db86739805..2294ee9551 100644 > > --- a/arch/arm/dts/vf-colibri-u-boot.dtsi > > +++ b/arch/arm/dts/vf-colibri-u-boot.dtsi > > @@ -21,3 +21,7 @@ > > &uart0 { > > u-boot,dm-pre-reloc; > > }; > > + > > +&dcu0 { > > + u-boot,dm-pre-reloc; > > +}; > > diff --git a/arch/arm/dts/vf-colibri.dtsi b/arch/arm/dts/vf-colibri.dtsi > > index 91ca4e4ddd..9de4b28e87 100644 > > --- a/arch/arm/dts/vf-colibri.dtsi > > +++ b/arch/arm/dts/vf-colibri.dtsi > > @@ -14,6 +14,7 @@ > > > > aliases { > > usb0 = &ehci0; /* required for ums */ > > + display1 = &dcu0; > > }; > > > > reg_usbh_vbus: regulator-usbh-vbus { > > @@ -241,3 +242,7 @@ > > pinctrl-0 = <&pinctrl_uart0>; > > status = "okay"; > > }; > > + > > +&dcu0 { > > + status = "okay"; > > +}; > > diff --git a/arch/arm/dts/vf.dtsi b/arch/arm/dts/vf.dtsi > > index 5e3b2c5b9d..5f69d0fd6e 100644 > > --- a/arch/arm/dts/vf.dtsi > > +++ b/arch/arm/dts/vf.dtsi > > @@ -145,6 +145,12 @@ > > #gpio-cells = <2>; > > }; > > > > + dcu0: dcu at 40058000 { > > + compatible = "fsl,vf610-dcu"; > > + reg = <0x40058000 0x1200>; > > + status = "disabled"; > > + }; > > + > > ehci0: ehci at 40034000 { > > compatible = "fsl,vf610-usb"; > > reg = <0x40034000 0x800>; > > -- > > 2.17.1 > > > > > -- > Best regards - Freundliche Grüsse - Meilleures salutations > > Igor Opaniuk > > mailto: igor.opaniuk at gmail.com > skype: igor.opanyuk > +380 (93) 836 40 67 > http://ua.linkedin.com/in/iopaniuk > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Best regards Oleksandr Suvorov Toradex AG Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 4800 (main line) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk ` (2 preceding siblings ...) 2019-06-10 11:47 ` [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node Igor Opaniuk @ 2019-06-10 11:47 ` Igor Opaniuk 2019-07-11 14:26 ` Igor Opaniuk 2019-07-11 14:25 ` [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk 2019-07-29 9:19 ` Anatolij Gustschin 5 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-06-10 11:47 UTC (permalink / raw) To: u-boot From: Igor Opaniuk <igor.opaniuk@toradex.com> Enable DM_VIDEO for Colibri VF. Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> --- configs/colibri_vf_defconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig index 3a267bdbc6..445176aa64 100644 --- a/configs/colibri_vf_defconfig +++ b/configs/colibri_vf_defconfig @@ -88,7 +88,7 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x4000 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_VIDEO_FSL_DCU_FB=y -CONFIG_VIDEO=y +CONFIG_DM_VIDEO=y CONFIG_SYS_CONSOLE_FG_COL=0x00 CONFIG_OF_LIBFDT_OVERLAY=y CONFIG_FDT_FIXUP_PARTITIONS=y -- 2.17.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO 2019-06-10 11:47 ` [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO Igor Opaniuk @ 2019-07-11 14:26 ` Igor Opaniuk 2019-07-12 13:34 ` Oleksandr Suvorov 0 siblings, 1 reply; 15+ messages in thread From: Igor Opaniuk @ 2019-07-11 14:26 UTC (permalink / raw) To: u-boot + Oleksandr, Philippe On Mon, Jun 10, 2019 at 2:48 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > Enable DM_VIDEO for Colibri VF. > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> > --- > configs/colibri_vf_defconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig > index 3a267bdbc6..445176aa64 100644 > --- a/configs/colibri_vf_defconfig > +++ b/configs/colibri_vf_defconfig > @@ -88,7 +88,7 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x4000 > CONFIG_CI_UDC=y > CONFIG_USB_GADGET_DOWNLOAD=y > CONFIG_VIDEO_FSL_DCU_FB=y > -CONFIG_VIDEO=y > +CONFIG_DM_VIDEO=y > CONFIG_SYS_CONSOLE_FG_COL=0x00 > CONFIG_OF_LIBFDT_OVERLAY=y > CONFIG_FDT_FIXUP_PARTITIONS=y > -- > 2.17.1 > -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk mailto: igor.opaniuk at gmail.com skype: igor.opanyuk +380 (93) 836 40 67 http://ua.linkedin.com/in/iopaniuk ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO 2019-07-11 14:26 ` Igor Opaniuk @ 2019-07-12 13:34 ` Oleksandr Suvorov 0 siblings, 0 replies; 15+ messages in thread From: Oleksandr Suvorov @ 2019-07-12 13:34 UTC (permalink / raw) To: u-boot On Thu, 11 Jul 2019 at 17:28, Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > + Oleksandr, Philippe > > On Mon, Jun 10, 2019 at 2:48 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > > > Enable DM_VIDEO for Colibri VF. > > > > Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com> Reviewed-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com> > > --- > > configs/colibri_vf_defconfig | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/configs/colibri_vf_defconfig b/configs/colibri_vf_defconfig > > index 3a267bdbc6..445176aa64 100644 > > --- a/configs/colibri_vf_defconfig > > +++ b/configs/colibri_vf_defconfig > > @@ -88,7 +88,7 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x4000 > > CONFIG_CI_UDC=y > > CONFIG_USB_GADGET_DOWNLOAD=y > > CONFIG_VIDEO_FSL_DCU_FB=y > > -CONFIG_VIDEO=y > > +CONFIG_DM_VIDEO=y > > CONFIG_SYS_CONSOLE_FG_COL=0x00 > > CONFIG_OF_LIBFDT_OVERLAY=y > > CONFIG_FDT_FIXUP_PARTITIONS=y > > -- > > 2.17.1 > > > > > -- > Best regards - Freundliche Grüsse - Meilleures salutations > > Igor Opaniuk > > mailto: igor.opaniuk at gmail.com > skype: igor.opanyuk > +380 (93) 836 40 67 > http://ua.linkedin.com/in/iopaniuk > _______________________________________________ > U-Boot mailing list > U-Boot at lists.denx.de > https://lists.denx.de/listinfo/u-boot -- Best regards Oleksandr Suvorov Toradex AG Altsagenstrasse 5 | 6048 Horw/Luzern | Switzerland | T: +41 41 500 4800 (main line) ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk ` (3 preceding siblings ...) 2019-06-10 11:47 ` [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO Igor Opaniuk @ 2019-07-11 14:25 ` Igor Opaniuk 2019-07-29 9:19 ` Anatolij Gustschin 5 siblings, 0 replies; 15+ messages in thread From: Igor Opaniuk @ 2019-07-11 14:25 UTC (permalink / raw) To: u-boot + Oleksandr, Philippe On Mon, Jun 10, 2019 at 2:47 PM Igor Opaniuk <igor.opaniuk@gmail.com> wrote: > > From: Igor Opaniuk <igor.opaniuk@toradex.com> > > This series of patches refactors and extends NXP DCU video driver to > be built with DM_VIDEO enabled. DTS files must additionally include > 'u-boot,dm-pre-reloc' property in soc and child nodes to enable driver > binding to fsl_dcu_fb device. > > Current limitations: configuration (display timings etc.) isn't fetched > from the DT node. I plan to add this in the next series. > > Also enables DM_VIDEO by default for Colibri VF. > > > Igor Opaniuk (4): > video: fsl_dcu_fb: refactor init functions > video: fsl_dcu_fb: add DM_VIDEO support > ARM: dts: colibri_vf: Add dcu0 node > colibri_vf: enable DM_VIDEO > > arch/arm/dts/vf-colibri-u-boot.dtsi | 4 + > arch/arm/dts/vf-colibri.dtsi | 5 + > arch/arm/dts/vf.dtsi | 6 + > board/freescale/ls1021aqds/dcu.c | 6 +- > board/toradex/colibri_vf/colibri_vf.c | 4 +- > board/toradex/colibri_vf/dcu.c | 6 +- > configs/colibri_vf_defconfig | 2 +- > drivers/video/Kconfig | 2 +- > drivers/video/fsl_dcu_fb.c | 213 ++++++++++++++++++-------- > include/fsl_dcu_fb.h | 12 +- > 10 files changed, 187 insertions(+), 73 deletions(-) > > -- > 2.17.1 > -- Best regards - Freundliche Grüsse - Meilleures salutations Igor Opaniuk mailto: igor.opaniuk at gmail.com skype: igor.opanyuk +380 (93) 836 40 67 http://ua.linkedin.com/in/iopaniuk ^ permalink raw reply [flat|nested] 15+ messages in thread
* [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk ` (4 preceding siblings ...) 2019-07-11 14:25 ` [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk @ 2019-07-29 9:19 ` Anatolij Gustschin 5 siblings, 0 replies; 15+ messages in thread From: Anatolij Gustschin @ 2019-07-29 9:19 UTC (permalink / raw) To: u-boot On Mon, 10 Jun 2019 14:47:48 +0300 Igor Opaniuk igor.opaniuk at gmail.com wrote: ... > Also enables DM_VIDEO by default for Colibri VF. > > > Igor Opaniuk (4): > video: fsl_dcu_fb: refactor init functions > video: fsl_dcu_fb: add DM_VIDEO support > ARM: dts: colibri_vf: Add dcu0 node > colibri_vf: enable DM_VIDEO > > arch/arm/dts/vf-colibri-u-boot.dtsi | 4 + > arch/arm/dts/vf-colibri.dtsi | 5 + > arch/arm/dts/vf.dtsi | 6 + > board/freescale/ls1021aqds/dcu.c | 6 +- > board/toradex/colibri_vf/colibri_vf.c | 4 +- > board/toradex/colibri_vf/dcu.c | 6 +- > configs/colibri_vf_defconfig | 2 +- > drivers/video/Kconfig | 2 +- > drivers/video/fsl_dcu_fb.c | 213 ++++++++++++++++++-------- > include/fsl_dcu_fb.h | 12 +- > 10 files changed, 187 insertions(+), 73 deletions(-) Series applied to u-boot-video/master, thanks! Patch 1/4 replaced by [1]. [1] http://patchwork.ozlabs.org/patch/1136894 -- Anatolij ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-07-29 9:19 UTC | newest] Thread overview: 15+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-06-10 11:47 [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk 2019-06-10 11:47 ` [U-Boot] [RFC 1/4] video: fsl_dcu_fb: refactor init functions Igor Opaniuk 2019-07-11 14:25 ` Igor Opaniuk 2019-07-11 15:16 ` Oleksandr Suvorov 2019-06-10 11:47 ` [U-Boot] [RFC 2/4] video: fsl_dcu_fb: add DM_VIDEO support Igor Opaniuk 2019-07-11 14:26 ` Igor Opaniuk 2019-07-12 13:32 ` Oleksandr Suvorov 2019-06-10 11:47 ` [U-Boot] [RFC 3/4] ARM: dts: colibri_vf: Add dcu0 node Igor Opaniuk 2019-07-11 14:26 ` Igor Opaniuk 2019-07-12 13:33 ` Oleksandr Suvorov 2019-06-10 11:47 ` [U-Boot] [RFC 4/4] colibri_vf: enable DM_VIDEO Igor Opaniuk 2019-07-11 14:26 ` Igor Opaniuk 2019-07-12 13:34 ` Oleksandr Suvorov 2019-07-11 14:25 ` [U-Boot] [RFC 0/4] Convert fsl_dcu_fb to DM_VIDEO Igor Opaniuk 2019-07-29 9:19 ` Anatolij Gustschin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox