sunxi: video: Add simplefb support
Subsystems (3)
v3 cover sunxi: video: Add simplefb support
Hi,
Here is a v3 of just the simplefb patch, addressing the address and size cells issue.
Changes since v2:
-Detect and handle address and size #cells
Changes since v1:
-Use fdt_setprop_string for strings
Regards,
Hans
PATCH v3 1/1 sunxi: video: Add simplefb support
From: Luc Verhaegen <[email protected]>
Add simplefb support, note this depends on the kernel having support for the clocks property which has recently been added to the simplefb devicetree binding.
[hdegoede at redhat.com: Use pre-populated simplefb node under /chosen as
disussed on the devicetree list]
--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++ board/sunxi/board.c | 11 +++++ drivers/video/sunxi_display.c | 73 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 ++++ 4 files changed, 96 insertions(+)
arch/arm/include/asm/arch-sunxi/display.h +4 -0
@@ -195,4 +195,8 @@ struct sunxi_hdmi_reg {#define SUNXI_HDMI_PLL_DBG0_PLL3 (0 << 21)#define SUNXI_HDMI_PLL_DBG0_PLL7 (1 << 21) +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +void sunxi_simplefb_setup (void *blob); +#endif +#endif /* _SUNXI_DISPLAY_H */
board/sunxi/board.c +11 -0
@@ -24,6 +24,7 @@#endif #include <asm/arch/clock.h> #include <asm/arch/cpu.h> +#include <asm/arch/display.h> #include <asm/arch/dram.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h>
@@ -237,3 +238,13 @@ int misc_init_r(void) return 0; }#endif + +#ifdef CONFIG_OF_BOARD_SETUP +void +ft_board_setup (void *blob,bd_t *bd) +{ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +sunxi_simplefb_setup (blob); +#endif +} +#endif /* CONFIG_OF_BOARD_SETUP */
drivers/video/sunxi_display.c +73 -0
82 lines not on this page · raw message
include/configs/sunxi-common.h +8 -0
@@ -204,6 +204,9 @@*/ #define CONFIG_SUNXI_FB_SIZE (8 << 20) +/* Do we want to initialize a simple FB? */ +#define CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_VIDEO_SUNXI #define CONFIG_CFB_CONSOLE
@@ -217,6 +220,11 @@#define CONFIG_SYS_MEM_TOP_HIDE ((CONFIG_SUNXI_FB_SIZE + 0xFFF) & ~0xFFF) +/* To be able to hook simplefb into dt */ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_OF_BOARD_SETUP +#endif +#endif /* CONFIG_VIDEO */ /* Ethernet support */
Signature · 1 line
2.1.0
PATCH v3 1/1 sunxi: video: Add simplefb support
Quoted 10 lines · Hans de Goede
From: Luc Verhaegen <[email protected]>
Add simplefb support, note this depends on the kernel having support for the clocks property which has recently been added to the simplefb devicetree binding.
Signed-off-by Luc Verhaegen <[email protected]>[hdegoede at redhat.com: Use pre-populated simplefb node under /chosen as
disussed on the devicetree list]Signed-off-by Hans de Goede <[email protected]>
I'm not a U-Boot maintainer, so take my comments with a grain of salt...
This patch seems quite short sighted. The code that calculates and updates the simple framebuffer node addresses is pretty much going to be identical for all platforms. Why is sunxi open coding it? Particularly when there could be fiddly bits around dealing with #address-cells/#size-cells.
I would think the code to update a simplefb node would be a common library function.
g.
Quoted 167 lines
--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++ board/sunxi/board.c | 11 +++++ drivers/video/sunxi_display.c | 73 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 ++++ 4 files changed, 96 insertions(+)arch/arm/include/asm/arch-sunxi/display.h +4
-0@@ -195,4 +195,8 @@ struct sunxi_hdmi_reg {#define SUNXI_HDMI_PLL_DBG0_PLL3 (0 << 21)#define SUNXI_HDMI_PLL_DBG0_PLL7 (1 << 21) +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +void sunxi_simplefb_setup (void *blob); +#endif +#endif /* _SUNXI_DISPLAY_H */ board/sunxi/board.c +11
-0@@ -24,6 +24,7 @@#endif #include <asm/arch/clock.h> #include <asm/arch/cpu.h> +#include <asm/arch/display.h> #include <asm/arch/dram.h> #include <asm/arch/gpio.h> #include <asm/arch/mmc.h> @@ -237,3 +238,13 @@ int misc_init_r(void) return 0; }#endif + +#ifdef CONFIG_OF_BOARD_SETUP +void +ft_board_setup (void *blob,bd_t *bd) +{ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +sunxi_simplefb_setup (blob); +#endif +} +#endif /* CONFIG_OF_BOARD_SETUP */ drivers/video/sunxi_display.c +73
-0@@ -13,6 +13,8 @@#include <asm/arch/display.h> #include <asm/global_data.h> #include <asm/io.h> +#include <fdtdec.h> +#include <fdt_support.h> #include <linux/fb.h> #include <video_fb.h> @@ -416,3 +418,74 @@ video_hw_init(void)return graphic_device; } + +/* +* Simplefb support. +*/ +#if defined(CONFIG_OF_BOARD_SETUP ) && defined(CONFIG_VIDEO_DT_SIMPLEFB ) +void +sunxi_simplefb_setup (void *blob) +{ +static GraphicDevice *graphic_device = &sunxi_display.graphic_device; +const char *node ="/chosen/framebuffer0-hdmi" ; +char name[32 ]; +fdt32_t cells[4 ]; +int i, offset, addrc, sizec, ret, stride; + +if (!sunxi_display.enabled) +return ; + + offset =fdt_path_offset (blob, node); +if (offset <0 ) { +eprintf ("Cannot setup simplefb: %s node not found\n" , node); +return ; + } + +snprintf (name,sizeof (name),"framebuffer@%08lx" , gd->fb_base); + ret =fdt_set_name (blob, offset, name); +if (ret <0 ) + goto error; + +of_bus_default_count_cells (blob,fdt_parent_offset (blob, offset), + &addrc, &sizec); + i =0 ; +if (addrc ==2 ) + cells[i++] =0 ; + cells[i++] =cpu_to_fdt32 (gd->fb_base); +if (sizec ==2 ) + cells[i++] =0 ; + cells[i++] =cpu_to_fdt32 (CONFIG_SUNXI_FB_SIZE ); + + ret =fdt_setprop (blob, offset,"reg" , cells,sizeof (cells[0 ]) * i); +if (ret <0 ) + goto error; + + cells[0 ] =cpu_to_fdt32 (graphic_device->winSizeX); + ret =fdt_setprop (blob, offset,"width" , cells,sizeof (cells[0 ])); +if (ret <0 ) + goto error; + + cells[0 ] =cpu_to_fdt32 (graphic_device->winSizeY); + ret =fdt_setprop (blob, offset,"height" , cells,sizeof (cells[0 ])); +if (ret <0 ) + goto error; + + stride = graphic_device->winSizeX * graphic_device->gdfBytesPP; + cells[0 ] =cpu_to_fdt32 (stride); + ret =fdt_setprop (blob, offset,"stride" , cells,sizeof (cells[0 ])); +if (ret <0 ) + goto error; + + ret =fdt_setprop_string (blob, offset,"format" ,"x8r8g8b8" ); +if (ret <0 ) + goto error; + + ret =fdt_setprop_string (blob, offset,"status" ,"okay" ); +if (ret <0 ) + goto error; + +return ; +error: +eprintf ("Cannot setup simplefb: Error setting properties\n" ); +} +#endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */ include/configs/sunxi-common.h +8
-1@@ -204,6 +204,9 @@*/ #define CONFIG_SUNXI_FB_SIZE (8 << 20) +/* Do we want to initialize a simple FB? */ +#define CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_VIDEO_SUNXI #define CONFIG_CFB_CONSOLE @@ -217,6 +220,11 @@#define CONFIG_SYS_MEM_TOP_HIDE ((CONFIG_SUNXI_FB_SIZE + 0xFFF) & ~0xFFF) +/* To be able to hook simplefb into dt */ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_OF_BOARD_SETUP +#endif +#endif /* CONFIG_VIDEO */ /* Ethernet support */ --2.1.0
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH v3 1/1 sunxi: video: Add simplefb support
Hi,
Quoted 14 lines · Grant Likely
Quoted 10 lines · Hans de Goede
From: Luc Verhaegen <[email protected]>
Add simplefb support, note this depends on the kernel having support for the clocks property which has recently been added to the simplefb devicetree binding.
Signed-off-by Luc Verhaegen <[email protected]>[hdegoede at redhat.com: Use pre-populated simplefb node under /chosen as
disussed on the devicetree list]Signed-off-by Hans de Goede <[email protected]>I'm not a U-Boot maintainer, so take my comments with a grain of salt...
Quoted 8 lines
This patch seems quite short sighted. The code that calculates and updates the simple framebuffer node addresses is pretty much going to be identical for all platforms. Why is sunxi open coding it? Particularly when there could be fiddly bits around dealing with #address-cells/#size-cells.
I would think the code to update a simplefb node would be a common library function.
You're right I've spun it out into a generic helper function for the next version of this patch-set.
Regards,
Hans