[U-Boot] persistent logo on LCD on imx6ull

Hi Peng
I'm working to make persistent the uboot logo on imx6ull platform but I have some problem with the framebuffer. Now this is the main idea
I use this to recalculate allocation
ubi part ubiblock; ubi read ${loadaddr} updater; run load_dtb; fdt addr ${fdt_addr} fdt set /reserved-memory/framebuffer reg "<0x$video_address 0x$video_memory_size>" fdt set /chosen/framebuffer reg "<0x$video_address 0x$video_memory_size>"
In linux I have
+ aliases { + display0 = &lcdif; + }; + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + display_reserved: framebuffer@86fa2000 { + reg = <0x86fa2000 0x80000>; + no-map; + }; + + }; + + chosen { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + stdout-path = "display0"; + framebuffer0: framebuffer@86fa2000 { + #clock-cells = <1>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_lcdif>; + compatible = "simple-framebuffer"; + reg = <0x86fa2000 (480 * 272 * 4)>; + width = <480>; + height = <272>; + stride = <(480 * 4)>; + format = "a8r8g8b8"; + clocks = <&clks IMX6UL_CLK_LCDIF_PIX>, + <&clks IMX6UL_CLK_LCDIF_APB>; + nshut-supply = <®_lcd_nshut>; + nreset-supply = <®_lcd_nreset>; + display = <&lcdif>; + }; + };
and this in uboot
index 4011066..beddd4a 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -69,6 +69,7 @@ #include <version.h> #include <malloc.h> #include <video.h> +#include <lcd.h> #include <linux/compiler.h>
#if defined(CONFIG_VIDEO_MXS) @@ -2107,6 +2108,9 @@ static int cfg_video_init(void) video_console_address = video_fb_address; #endif
+ env_set_hex("video_address", (unsigned long)VIDEO_FB_ADRS); + env_set_hex("video_memory_size", (unsigned long) roundup(VIDEO_SIZE, PAGE_SIZE)); + /* Initialize the console */ console_col = 0; console_row = 0; diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 4e3e3d7..e2a5c05 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -7,6 +7,7 @@ #include <common.h> #include <malloc.h> #include <video_fb.h> +#include <lcd.h>
#include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> @@ -214,8 +215,8 @@ void *video_hw_init(void) panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
/* Allocate framebuffer */ - fb = memalign(ARCH_DMA_MINALIGN, - roundup(panel.memSize, ARCH_DMA_MINALIGN)); + fb = memalign(PAGE_SIZE, + roundup(panel.memSize, PAGE_SIZE)); if (!fb) { printf("MXSFB: Error allocating framebuffer!\n"); return NULL;
I have two problems. (Using the latest uboot and linux)
1) I have a 50uS glitch on gpios so they get down and up again (nshut and nreset) even I don't touch them 2) Even clock tree is ok pixelclock seems that stops to go out
Do you have any suggestion?
Michael

Hi Peng
Ok I have fixed it :)
Michael
On Mon, Jul 2, 2018 at 4:26 PM, Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Hi Peng
I'm working to make persistent the uboot logo on imx6ull platform but I have some problem with the framebuffer. Now this is the main idea
I use this to recalculate allocation
ubi part ubiblock; ubi read ${loadaddr} updater; run load_dtb; fdt addr ${fdt_addr} fdt set /reserved-memory/framebuffer reg "<0x$video_address 0x$video_memory_size>" fdt set /chosen/framebuffer reg "<0x$video_address 0x$video_memory_size>"
In linux I have
aliases {
display0 = &lcdif;
};
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
display_reserved: framebuffer@86fa2000 {
reg = <0x86fa2000 0x80000>;
no-map;
};
};
chosen {
#address-cells = <1>;
#size-cells = <1>;
ranges;
stdout-path = "display0";
framebuffer0: framebuffer@86fa2000 {
#clock-cells = <1>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcdif>;
compatible = "simple-framebuffer";
reg = <0x86fa2000 (480 * 272 * 4)>;
width = <480>;
height = <272>;
stride = <(480 * 4)>;
format = "a8r8g8b8";
clocks = <&clks IMX6UL_CLK_LCDIF_PIX>,
<&clks IMX6UL_CLK_LCDIF_APB>;
nshut-supply = <®_lcd_nshut>;
nreset-supply = <®_lcd_nreset>;
display = <&lcdif>;
};
};
and this in uboot
index 4011066..beddd4a 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -69,6 +69,7 @@ #include <version.h> #include <malloc.h> #include <video.h> +#include <lcd.h> #include <linux/compiler.h>
#if defined(CONFIG_VIDEO_MXS) @@ -2107,6 +2108,9 @@ static int cfg_video_init(void) video_console_address = video_fb_address; #endif
env_set_hex("video_address", (unsigned long)VIDEO_FB_ADRS);
env_set_hex("video_memory_size", (unsigned long)
roundup(VIDEO_SIZE, PAGE_SIZE));
/* Initialize the console */ console_col = 0; console_row = 0;
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 4e3e3d7..e2a5c05 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -7,6 +7,7 @@ #include <common.h> #include <malloc.h> #include <video_fb.h> +#include <lcd.h>
#include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> @@ -214,8 +215,8 @@ void *video_hw_init(void) panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
/* Allocate framebuffer */
fb = memalign(ARCH_DMA_MINALIGN,
roundup(panel.memSize, ARCH_DMA_MINALIGN));
fb = memalign(PAGE_SIZE,
roundup(panel.memSize, PAGE_SIZE)); if (!fb) { printf("MXSFB: Error allocating framebuffer!\n"); return NULL;
I have two problems. (Using the latest uboot and linux)
- I have a 50uS glitch on gpios so they get down and up again (nshut
and nreset) even I don't touch them 2) Even clock tree is ok pixelclock seems that stops to go out
Do you have any suggestion?
Michael
-- | Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |

On Tue, Jul 3, 2018 at 6:20 AM, Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Ok I have fixed it :)
Mind to share how?

Hi
On Wed, Jul 4, 2018 at 6:45 PM, Otavio Salvador otavio.salvador@ossystems.com.br wrote:
On Tue, Jul 3, 2018 at 6:20 AM, Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Ok I have fixed it :)
Mind to share how?
commit 9c066153a6876b1ae57117d99ad228a07873eb75 Author: Michael Trimarchi michael@amarulasolutions.com Date: Wed Jul 4 15:50:41 2018 +0200
spl: Make the spl_nand_load_image static
Change-Id: I1c2f71e75fc052c54fc94b13d0942cb9e75ff1c6 Signed-off-by: Michael Trimarchi michael@amarulasolutions.com
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index b96fce2..527cfc0 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -12,7 +12,7 @@ #include <fdt.h>
#if defined(CONFIG_SPL_NAND_RAW_ONLY) -int spl_nand_load_image(struct spl_image_info *spl_image, +static int spl_nand_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { nand_init(); michael@panicking ~/work/amarula/w_and_h/dist/u-boot $ git show HEAD^^^ commit 110e91ee5a837684d99778d72a3c9aec5953baf6 Author: Michael Trimarchi michael@amarulasolutions.com Date: Wed Jul 4 13:03:23 2018 +0200
video: mxsfb: Allocate a memory align to the page
We want to allocate memory align at page size because we then need to reserve it to linux and simple frame buffer. The lcd should not be powerdown if simple frame buffer configuration is active
Change-Id: I1d139364d91686b12cd607821dcc1b84b0dc0b69 Signed-off-by: Michael Trimarchi michael@amarulasolutions.com
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 4011066..0aaf9f0 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -2107,6 +2107,12 @@ static int cfg_video_init(void) video_console_address = video_fb_address; #endif
+ env_set_hex("video_address", (unsigned long)VIDEO_FB_ADRS); + env_set_hex("video_memory_size", (unsigned long) roundup(VIDEO_SIZE, PAGE_SIZE)); + env_set_hex("video_stride", (unsigned long) VIDEO_LINE_LEN); + env_set_hex("video_width", (unsigned long) VIDEO_COLS); + env_set_hex("video_height", (unsigned long) VIDEO_ROWS); + /* Initialize the console */ console_col = 0; console_row = 0; diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 4e3e3d7..254f230 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -7,6 +7,7 @@ #include <common.h> #include <malloc.h> #include <video_fb.h> +#include <lcd.h>
#include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> @@ -145,6 +146,7 @@ static void mxs_lcd_init(GraphicDevice *panel, writel(LCDIF_CTRL_RUN, ®s->hw_lcdif_ctrl_set); }
+#ifndef CONFIG_VIDEO_DT_SIMPLEFB void lcdif_power_down(void) { struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; @@ -164,6 +166,9 @@ void lcdif_power_down(void) } mxs_reset_block((struct mxs_register_32 *)®s->hw_lcdif_ctrl_reg); } +#else +void lcdif_power_down(void) {}; +#endif
void *video_hw_init(void) { @@ -214,8 +219,8 @@ void *video_hw_init(void) panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
/* Allocate framebuffer */ - fb = memalign(ARCH_DMA_MINALIGN, - roundup(panel.memSize, ARCH_DMA_MINALIGN)); + fb = memalign(PAGE_SIZE, + roundup(panel.memSize, PAGE_SIZE)); if (!fb) { printf("MXSFB: Error allocating framebuffer!\n"); return NULL; (END) { struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; @@ -164,6 +166,9 @@ void lcdif_power_down(void) } mxs_reset_block((struct mxs_register_32 *)®s->hw_lcdif_ctrl_reg); } +#else +void lcdif_power_down(void) {}; +#endif
void *video_hw_init(void) { @@ -214,8 +219,8 @@ void *video_hw_init(void) panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
/* Allocate framebuffer */ - fb = memalign(ARCH_DMA_MINALIGN, - roundup(panel.memSize, ARCH_DMA_MINALIGN)); + fb = memalign(PAGE_SIZE, + roundup(panel.memSize, PAGE_SIZE)); if (!fb) { printf("MXSFB: Error allocating framebuffer!\n"); return NULL;
The I need to trick the dts ;)
This should be more then enough ;).
Michael
-- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9 9981-7854 Mobile: +1 (347) 903-9750

Hi otavio
On Wed., 4 Jul. 2018, 7:03 pm Michael Nazzareno Trimarchi, < michael@amarulasolutions.com> wrote:
Hi
On Wed, Jul 4, 2018 at 6:45 PM, Otavio Salvador otavio.salvador@ossystems.com.br wrote:
On Tue, Jul 3, 2018 at 6:20 AM, Michael Nazzareno Trimarchi michael@amarulasolutions.com wrote:
Ok I have fixed it :)
Mind to share how?
I will change those patches soon to share memory up to the kernel. I have already implement something there but not really happy.
Michael
commit 9c066153a6876b1ae57117d99ad228a07873eb75 Author: Michael Trimarchi michael@amarulasolutions.com Date: Wed Jul 4 15:50:41 2018 +0200
spl: Make the spl_nand_load_image static Change-Id: I1c2f71e75fc052c54fc94b13d0942cb9e75ff1c6 Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c index b96fce2..527cfc0 100644 --- a/common/spl/spl_nand.c +++ b/common/spl/spl_nand.c @@ -12,7 +12,7 @@ #include <fdt.h>
#if defined(CONFIG_SPL_NAND_RAW_ONLY) -int spl_nand_load_image(struct spl_image_info *spl_image, +static int spl_nand_load_image(struct spl_image_info *spl_image, struct spl_boot_device *bootdev) { nand_init(); michael@panicking ~/work/amarula/w_and_h/dist/u-boot $ git show HEAD^^^ commit 110e91ee5a837684d99778d72a3c9aec5953baf6 Author: Michael Trimarchi michael@amarulasolutions.com Date: Wed Jul 4 13:03:23 2018 +0200
video: mxsfb: Allocate a memory align to the page We want to allocate memory align at page size because we then need to reserve it to linux and simple frame buffer. The lcd should not be powerdown if simple frame buffer configuration is active Change-Id: I1d139364d91686b12cd607821dcc1b84b0dc0b69 Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c index 4011066..0aaf9f0 100644 --- a/drivers/video/cfb_console.c +++ b/drivers/video/cfb_console.c @@ -2107,6 +2107,12 @@ static int cfg_video_init(void) video_console_address = video_fb_address; #endif
env_set_hex("video_address", (unsigned long)VIDEO_FB_ADRS);
env_set_hex("video_memory_size", (unsigned long)
roundup(VIDEO_SIZE, PAGE_SIZE));
env_set_hex("video_stride", (unsigned long) VIDEO_LINE_LEN);
env_set_hex("video_width", (unsigned long) VIDEO_COLS);
env_set_hex("video_height", (unsigned long) VIDEO_ROWS);
/* Initialize the console */ console_col = 0; console_row = 0;
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index 4e3e3d7..254f230 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -7,6 +7,7 @@ #include <common.h> #include <malloc.h> #include <video_fb.h> +#include <lcd.h>
#include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> @@ -145,6 +146,7 @@ static void mxs_lcd_init(GraphicDevice *panel, writel(LCDIF_CTRL_RUN, ®s->hw_lcdif_ctrl_set); }
+#ifndef CONFIG_VIDEO_DT_SIMPLEFB void lcdif_power_down(void) { struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; @@ -164,6 +166,9 @@ void lcdif_power_down(void) } mxs_reset_block((struct mxs_register_32 *)®s->hw_lcdif_ctrl_reg); } +#else +void lcdif_power_down(void) {}; +#endif
void *video_hw_init(void) { @@ -214,8 +219,8 @@ void *video_hw_init(void) panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
/* Allocate framebuffer */
fb = memalign(ARCH_DMA_MINALIGN,
roundup(panel.memSize, ARCH_DMA_MINALIGN));
fb = memalign(PAGE_SIZE,
roundup(panel.memSize, PAGE_SIZE)); if (!fb) { printf("MXSFB: Error allocating framebuffer!\n"); return NULL;
(END) { struct mxs_lcdif_regs *regs = (struct mxs_lcdif_regs *)MXS_LCDIF_BASE; @@ -164,6 +166,9 @@ void lcdif_power_down(void) } mxs_reset_block((struct mxs_register_32 *)®s->hw_lcdif_ctrl_reg); } +#else +void lcdif_power_down(void) {}; +#endif
void *video_hw_init(void) { @@ -214,8 +219,8 @@ void *video_hw_init(void) panel.memSize = mode.xres * mode.yres * panel.gdfBytesPP;
/* Allocate framebuffer */
fb = memalign(ARCH_DMA_MINALIGN,
roundup(panel.memSize, ARCH_DMA_MINALIGN));
fb = memalign(PAGE_SIZE,
roundup(panel.memSize, PAGE_SIZE)); if (!fb) { printf("MXSFB: Error allocating framebuffer!\n"); return NULL;
The I need to trick the dts ;)
This should be more then enough ;).
Michael
-- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9 9981-7854 Mobile: +1 (347) 903-9750
-- | Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
participants (2)
-
Michael Nazzareno Trimarchi
-
Otavio Salvador