sunxi: video: Add simplefb support
Subsystems (3)
v4 cover sunxi: video: Add simplefb support
Hi All,
Here is v4 of my sunxi simplefb support set.
Changes since v3:
-Added a fdt_setup_simplefb_node() helper function (new patch) -Changed how u-boot finds the pre-populated simplefb node to use a
compatible string
Changes since v2:
-Detect and handle address and size #cells
Changes since v1:
-Use fdt_setprop_string for strings
Simon, can you review and ack the fdt_setup_simplefb_node() helper function patch please ? Since it is a dep. for sunxi patches I would like to take it upstream through the sunxi tree, but for obvious reasons I would also like your ack on this.
Ian, I hope the sunxi specific patch is now more to your liking, please re-review. Also can you please review v2 of:
-"sunxi: video: Add cfb console driver for sunxi"
You've already reviewed and acked v1, v2 only has some Kconfig changes
-"sunxi: Add usb keyboard Kconfig option"
Kconfig changes / fixes as discussed
You should have these in your mailbox, if not see patchwork.
Thanks & Regards,
Hans
PATCH v4 1/2 fdt_support: Add a fdt_setup_simplefb_node helper function
Add a generic helper to fill and enable simplefb nodes.
The first user of this will be the sunxi display code.
lcd_dt_simplefb_configure_node is also a good candidate to be converted to use this, but that requires someone to run some tests first, as lcd_dt_simplefb_configure_node does not honor #address-cells and #size-cells, but simply assumes 1 and 1 for both.
--- common/fdt_support.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 3 +++ 2 files changed, 68 insertions(+)
common/fdt_support.c +65 -0
@@ -1523,3 +1523,68 @@ int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr,return 0 ; } + +/** +* fdt_setup_simplefb_node - Fill and enable a simplefb node +* +* @fdt: ptr to device tree +* @node: offset of the simplefb node +* @base_address: framebuffer base address +* @width: width in pixels +* @height: height in pixels +* @stride: bytes per line +* @format: pixel format string +* +* Convenience function to fill and enable a simplefb node. +*/ +int fdt_setup_simplefb_node (void *fdt,int node,u64 base_address,u32 width, +u32 height,u32 stride,const char *format) +{ +char name[32 ]; +fdt32_t cells[4 ]; +int i, addrc, sizec, ret; + +of_bus_default_count_cells (fdt,fdt_parent_offset (fdt, node), + &addrc, &sizec); + i =0 ; +if (addrc ==2 ) + cells[i++] =cpu_to_fdt32 (base_address >>32 ); + cells[i++] =cpu_to_fdt32 (base_address); +if (sizec ==2 ) + cells[i++] =0 ; + cells[i++] =cpu_to_fdt32 (height * stride); + + ret =fdt_setprop (fdt, node,"reg" , cells,sizeof (cells[0 ]) * i); +if (ret <0 ) +return ret; + +snprintf (name,sizeof (name),"framebuffer@%llx" , base_address); + ret =fdt_set_name (fdt, node, name); +if (ret <0 ) +return ret; + + cells[0 ] =cpu_to_fdt32 (width); + ret =fdt_setprop (fdt, node,"width" , cells,sizeof (cells[0 ])); +if (ret <0 ) +return ret; + + cells[0 ] =cpu_to_fdt32 (height); + ret =fdt_setprop (fdt, node,"height" , cells,sizeof (cells[0 ])); +if (ret <0 ) +return ret; + + cells[0 ] =cpu_to_fdt32 (stride); + ret =fdt_setprop (fdt, node,"stride" , cells,sizeof (cells[0 ])); +if (ret <0 ) +return ret; + + ret =fdt_setprop_string (fdt, node,"format" , format); +if (ret <0 ) +return ret; + + ret =fdt_setprop_string (fdt, node,"status" ,"okay" ); +if (ret <0 ) +return ret; + +return 0 ; +}
include/fdt_support.h +3 -0
@@ -147,6 +147,9 @@ void of_bus_default_count_cells(void *blob, int parentoffset,int ft_verify_fdt (void *fdt);int arch_fixup_memory_node (void *blob); +int fdt_setup_simplefb_node (void *fdt,int node,u64 base_address,u32 width, +u32 height,u32 stride,const char *format); +#endif /* ifdef CONFIG_OF_LIBFDT */ #ifdef USE_HOSTCC
Signature · 1 line
2.1.0
PATCH v4 1/2 fdt_support: Add a fdt_setup_simplefb_node helper function
Hi Hans,
Quoted 29 lines · Hans de Goede
Add a generic helper to fill and enable simplefb nodes.
The first user of this will be the sunxi display code.
lcd_dt_simplefb_configure_nodeis also a good candidate to be converted to use this, but that requires someone to run some tests first, aslcd_dt_simplefb_configure_nodedoes not honor #address-cells and #size-cells, but simply assumes 1 and 1 for both.Signed-off-by Hans de Goede <[email protected]>--- common/fdt_support.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 3 +++ 2 files changed, 68 insertions(+)common/fdt_support.c +6
-0@@ -1523,3 +1523,68 @@ int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr,return 0 ; } + +/** +* fdt_setup_simplefb_node - Fill and enable a simplefb node +* +* @fdt: ptr to device tree +* @node: offset of the simplefb node
common/fdt_support.c int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr, · line 1541
Quoted 10 lines
common/fdt_support.c +10
-0+* @base_address: framebuffer base address +* @width: width in pixels +* @height: height in pixels +* @stride: bytes per line +* @format: pixel format string +* +* Convenience function to fill and enable a simplefb node. +*/ +int fdt_setup_simplefb_node (void *fdt,int node,u64 base_address,u32 width, +u32 height,u32 stride,const char *format)
Please see lcd_dt_simplefb_configure_node() which seems similar.
Regards,
Simon
PATCH v4 1/2 fdt_support: Add a fdt_setup_simplefb_node helper function
Hi Simon,
Quoted 36 lines · Simon Glass
Hi Hans,
Quoted 33 lines · Hans de Goede
Add a generic helper to fill and enable simplefb nodes.
The first user of this will be the sunxi display code.
lcd_dt_simplefb_configure_nodeis also a good candidate to be converted to use this, but that requires someone to run some tests first, aslcd_dt_simplefb_configure_nodedoes not honor #address-cells and #size-cells, but simply assumes 1 and 1 for both.Signed-off-by Hans de Goede <[email protected]>--- common/fdt_support.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 3 +++ 2 files changed, 68 insertions(+)common/fdt_support.c +10
-0@@ -1523,3 +1523,68 @@ int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr,return 0 ; } + +/** +* fdt_setup_simplefb_node - Fill and enable a simplefb node +* +* @fdt: ptr to device tree +* @node: offset of the simplefb node +* @base_address: framebuffer base address +* @width: width in pixels +* @height: height in pixels +* @stride: bytes per line
Quoted 8 lines
common/fdt_support.c int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr, · line 1541
Quoted 6 lines
common/fdt_support.c +6
-0+* @format: pixel format string +* +* Convenience function to fill and enable a simplefb node. +*/ +int fdt_setup_simplefb_node (void *fdt,int node,u64 base_address,u32 width, +u32 height,u32 stride,const char *format)Please see
lcd_dt_simplefb_configure_node()which seems similar.
As mentioned in the commit message already :) lcd_dt_simplefb_configure_node() should be made to use this new helper function eventually.
There are several reasons why lcd_dt_simplefb_configure_node() is not usable as a generic helper, and this new function is necessary:
1) It is lcd specific, only available if CONFIG_LCD is set
2) It does not take width / height / stride parameters, instead it reads global variables from lcd.c which are only set if the other common/lcd.c functions are used.
3) It hardcodes the format
4) It does not properly handle #address-cells and #size-cells
4) Is the main reason why I've not included a patch in my patch-set to move lcd_dt_simplefb_configure_node() over to use this new helper, as I'm afraid that may break things. of_bus_default_count_cells() will return different values then the 1/1 the current lcd code assumes when no #address-cells or #size-cells are present in the parent.
So my plan is to add this new helper, use it for sunxi, and ask someone who has a board which is using lcd.c + simplefb to test moving lcd.c over to the new helper.
Regards,
Hans
PATCH v4 1/2 fdt_support: Add a fdt_setup_simplefb_node helper function
Hi Hans,
Quoted 49 lines · Hans de Goede
Hi Simon,
Quoted 36 lines · Simon Glass
Hi Hans,
Quoted 33 lines · Hans de Goede
Add a generic helper to fill and enable simplefb nodes.
The first user of this will be the sunxi display code.
lcd_dt_simplefb_configure_nodeis also a good candidate to be converted to use this, but that requires someone to run some tests first, aslcd_dt_simplefb_configure_nodedoes not honor #address-cells and #size-cells, but simply assumes 1 and 1 for both.Signed-off-by Hans de Goede <[email protected]>--- common/fdt_support.c | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++ include/fdt_support.h | 3 +++ 2 files changed, 68 insertions(+)common/fdt_support.c +10
-0@@ -1523,3 +1523,68 @@ int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr,return 0 ; } + +/** +* fdt_setup_simplefb_node - Fill and enable a simplefb node +* +* @fdt: ptr to device tree +* @node: offset of the simplefb node +* @base_address: framebuffer base address +* @width: width in pixels +* @height: height in pixels +* @stride: bytes per line Quoted 8 lines
common/fdt_support.c int fdt_read_range(void *fdt, int node, int n, uint64_t *child_addr, · line 1541
Quoted 6 lines
common/fdt_support.c +6
-0+* @format: pixel format string +* +* Convenience function to fill and enable a simplefb node. +*/ +int fdt_setup_simplefb_node (void *fdt,int node,u64 base_address,u32 width, +u32 height,u32 stride,const char *format)Please see
lcd_dt_simplefb_configure_node()which seems similar.
Quoted 2 lines
As mentioned in the commit message already :)
lcd_dt_simplefb_configure_node()should be made to use this new helper function eventually.
OK I think we have established that I can't read :-)
Quoted 17 lines
There are several reasons why
lcd_dt_simplefb_configure_node()is not usable as a generic helper, and this new function is necessary:1) It is lcd specific, only available if
CONFIG_LCDis set
2) It does not take width / height / stride parameters, instead it reads global variables fromlcd.cwhich are only set if the othercommon/lcd.cfunctions are used.
3) It hardcodes the format
4) It does not properly handle #address-cells and #size-cells4) Is the main reason why I've not included a patch in my patch-set to move
lcd_dt_simplefb_configure_node()over to use this new helper, as I'm afraid that may break things.of_bus_default_count_cells()will return different values then the 1/1 the current lcd code assumes when no #address-cells or #size-cells are present in the parent.
Quoted 3 lines
So my plan is to add this new helper, use it for sunxi, and ask someone who has a board which is using
lcd.c+ simplefb to test movinglcd.cover to the new helper.
I think it's only used by Raspberry Pi. If you send the patch I can test it next week. But we really shouldn't have two such similar functions.
Regards,
Simon
PATCH v4 2/2 sunxi: video: Add simplefb support
In reply to Hans de GoedeFrom: 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 | 39 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 +++++++ 4 files changed, 62 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 +39 -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,40 @@ 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; +int offset, ret; + +if (!sunxi_display.enabled) +return ; + +/* Find a framebuffer node, with pipeline == "de_be0-lcd0-hdmi" */ + offset =fdt_node_offset_by_compatible (blob,-1 ,"sunxi,framebuffer" ); +while (offset >=0 ) { + ret =fdt_find_string (blob, offset,"sunxi,pipeline" , +"de_be0-lcd0-hdmi" ); +if (ret ==0 ) +break ; + offset =fdt_node_offset_by_compatible (blob, offset, +"sunxi,framebuffer" ); + } +if (offset <0 ) { +eprintf ("Cannot setup simplefb: node not found\n" ); +return ; + } + + ret =fdt_setup_simplefb_node (blob, offset, gd->fb_base, + graphic_device->winSizeX, graphic_device->winSizeY, + graphic_device->winSizeX * graphic_device->gdfBytesPP, +"x8r8g8b8" ); +if (ret <0 ) +eprintf ("Cannot setup simplefb: Error setting properties\n" ); +} +#endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */
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 v4 2/2 sunxi: video: Add simplefb support
Hi Hans,
Quoted 76 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]>--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++++ board/sunxi/board.c | 11 +++++++++ drivers/video/sunxi_display.c | 39 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 +++++++ 4 files changed, 62 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 +5
-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,40 @@ video_hw_init(void)return graphic_device; } + +/* +* Simplefb support.
drivers/video/sunxi_display.c video_hw_init(void) · line 433
Quoted 10 lines
drivers/video/sunxi_display.c +10
-0+*/ +#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; +int offset, ret; + +if (!sunxi_display.enabled) +return ;
return -ENOENT?
drivers/video/sunxi_display.c video_hw_init(void) · line 436
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ +/* Find a framebuffer node, with pipeline == "de_be0-lcd0-hdmi" */ + offset =fdt_node_offset_by_compatible (blob,-1 ,"sunxi,framebuffer" );
These should convert to DM at some point. To make sure we don't forget any, you should add this compatible string to fdtdec.c and use the enum from fdtdec.h and also fdtdec_next_compatible().
drivers/video/sunxi_display.c video_hw_init(void) · line 447
Quoted 11 lines
drivers/video/sunxi_display.c +11
-0+while (offset >=0 ) { + ret =fdt_find_string (blob, offset,"sunxi,pipeline" , +"de_be0-lcd0-hdmi" ); +if (ret ==0 ) +break ; + offset =fdt_node_offset_by_compatible (blob, offset, +"sunxi,framebuffer" ); + } +if (offset <0 ) { +eprintf ("Cannot setup simplefb: node not found\n" ); +return ;
return -ENODEV?
drivers/video/sunxi_display.c video_hw_init(void) · line 455
Quoted 8 lines
drivers/video/sunxi_display.c +8
-0+ } + + ret =fdt_setup_simplefb_node (blob, offset, gd->fb_base, + graphic_device->winSizeX, graphic_device->winSizeY, + graphic_device->winSizeX * graphic_device->gdfBytesPP, +"x8r8g8b8" ); +if (ret <0 ) +eprintf ("Cannot setup simplefb: Error setting properties\n" );
Can we return the error here? Maybe -EPERM or something like that.
Quoted 29 lines
drivers/video/sunxi_display.c +2
-0+} +#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 */ --
Quoted 2 lines
2.1.0
Regards,
Simon
PATCH v4 2/2 sunxi: video: Add simplefb support
Hi,
Quoted 83 lines · Simon Glass
Hi Hans,
Quoted 80 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]>--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++++ board/sunxi/board.c | 11 +++++++++ drivers/video/sunxi_display.c | 39 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 +++++++ 4 files changed, 62 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 +9
-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,40 @@ 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)
Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 433
Quoted 6 lines
drivers/video/sunxi_display.c +6
-0+{ +static GraphicDevice *graphic_device = &sunxi_display.graphic_device; +int offset, ret; + +if (!sunxi_display.enabled) +return ;return
-ENOENT?
If people want this, I can change the proto to an int and make sunxi_simplefb_setup return error codes as you suggest, but this function gets called from ft_board_setup which is void itself, so there is no where to propagate the error, and more-over we do not want simplefb setup errors to be treated as fatal, so I see little use in having it return error codes.
Quoted 7 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 436
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ +/* Find a framebuffer node, with pipeline == "de_be0-lcd0-hdmi" */ + offset =fdt_node_offset_by_compatible (blob,-1 ,"sunxi,framebuffer" );These should convert to DM at some point. To make sure we don't forget any, you should add this compatible string to
fdtdec.cand use the enum fromfdtdec.hand alsofdtdec_next_compatible().
Most sunxi boards do not set CONFIG_OF_CONTROL, so the ftddec functions are not available.
Quoted 45 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 447
Quoted 11 lines
drivers/video/sunxi_display.c +11
-0+while (offset >=0 ) { + ret =fdt_find_string (blob, offset,"sunxi,pipeline" , +"de_be0-lcd0-hdmi" ); +if (ret ==0 ) +break ; + offset =fdt_node_offset_by_compatible (blob, offset, +"sunxi,framebuffer" ); + } +if (offset <0 ) { +eprintf ("Cannot setup simplefb: node not found\n" ); +return ;return
-ENODEV?drivers/video/sunxi_display.c video_hw_init(void) · line 455
Quoted 8 lines
drivers/video/sunxi_display.c +8
-0+ } + + ret =fdt_setup_simplefb_node (blob, offset, gd->fb_base, + graphic_device->winSizeX, graphic_device->winSizeY, + graphic_device->winSizeX * graphic_device->gdfBytesPP, +"x8r8g8b8" ); +if (ret <0 ) +eprintf ("Cannot setup simplefb: Error setting properties\n" );Can we return the error here? Maybe
-EPERMor something like that.Quoted 20 lines
drivers/video/sunxi_display.c +2
-0+} +#endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */ include/configs/sunxi-common.h +3
-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)
Quoted 8 lines
include/configs/sunxi-common.h line 230
Quoted 8 lines
include/configs/sunxi-common.h +5
-0+/* To be able to hook simplefb into dt */ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_OF_BOARD_SETUP +#endif +#endif /* CONFIG_VIDEO */ /* Ethernet support */
Regards,
Hans
PATCH v4 2/2 sunxi: video: Add simplefb support
Hi Hans,
Quoted 95 lines · Hans de Goede
Hi,
Quoted 83 lines · Simon Glass
Hi Hans,
Quoted 80 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]>--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++++ board/sunxi/board.c | 11 +++++++++ drivers/video/sunxi_display.c | 39 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 +++++++ 4 files changed, 62 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 +9
-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,40 @@ 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)Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 433
Quoted 6 lines
drivers/video/sunxi_display.c +6
-0+{ +static GraphicDevice *graphic_device = &sunxi_display.graphic_device; +int offset, ret; + +if (!sunxi_display.enabled) +return ;return
-ENOENT?
Quoted 5 lines
If people want this, I can change the proto to an int and make
sunxi_simplefb_setupreturn error codes as you suggest, but this function gets called fromft_board_setupwhich is void itself, so there is no where to propagate the error, and more-over we do not want simplefb setup errors to be treated as fatal, so I see little use in having it return error codes.
ft_board_setup() will soon change to return an error. Will likely merge those patches next week.
Quoted 11 lines
Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 436
Quoted 4 lines
drivers/video/sunxi_display.c +3
-0+ +/* Find a framebuffer node, with pipeline == "de_be0-lcd0-hdmi" */ + offset =fdt_node_offset_by_compatible (blob,-1 ,"sunxi,framebuffer" );These should convert to DM at some point. To make sure we don't forget any, you should add this compatible string to
fdtdec.cand use the enum fromfdtdec.hand alsofdtdec_next_compatible().Most sunxi boards do not set
CONFIG_OF_CONTROL, so the ftddec functions are not available.
Actually I was wrong - this is adjust the kernel FDT so ignore my comment.
Quoted 46 lines
Quoted 46 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 447
Quoted 12 lines
drivers/video/sunxi_display.c +11
-0+while (offset >=0 ) { + ret =fdt_find_string (blob, offset,"sunxi,pipeline" , +"de_be0-lcd0-hdmi" ); +if (ret ==0 ) +break ; + offset =fdt_node_offset_by_compatible (blob, offset, +"sunxi,framebuffer" ); + } +if (offset <0 ) { +eprintf ("Cannot setup simplefb: node not found\n" ); +return ;return
-ENODEV?drivers/video/sunxi_display.c video_hw_init(void) · line 455
Quoted 8 lines
drivers/video/sunxi_display.c +8
-0+ } + + ret =fdt_setup_simplefb_node (blob, offset, gd->fb_base, + graphic_device->winSizeX, graphic_device->winSizeY, + graphic_device->winSizeX * graphic_device->gdfBytesPP, +"x8r8g8b8" ); +if (ret <0 ) +eprintf ("Cannot setup simplefb: Error setting properties\n" );Can we return the error here? Maybe
-EPERMor something like that.Quoted 20 lines
drivers/video/sunxi_display.c +2
-0+} +#endif /* CONFIG_OF_BOARD_SETUP && CONFIG_VIDEO_DT_SIMPLEFB */ include/configs/sunxi-common.h +3
-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)
Quoted 8 lines
Quoted 8 lines
include/configs/sunxi-common.h line 230
Quoted 8 lines
include/configs/sunxi-common.h +5
-0+/* To be able to hook simplefb into dt */ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_OF_BOARD_SETUP +#endif +#endif /* CONFIG_VIDEO */ /* Ethernet support */
Regards,
Simon
PATCH v4 2/2 sunxi: video: Add simplefb support
Hi,
Quoted 99 lines · Simon Glass
Hi Hans,
Quoted 95 lines · Hans de Goede
Hi,
Quoted 91 lines · Simon Glass
Hi Hans,
Quoted 76 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]>--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++++ board/sunxi/board.c | 11 +++++++++ drivers/video/sunxi_display.c | 39 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 +++++++ 4 files changed, 62 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 +5
-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,40 @@ video_hw_init(void)return graphic_device; } + +/* +* Simplefb support. drivers/video/sunxi_display.c video_hw_init(void) · line 433
Quoted 10 lines
drivers/video/sunxi_display.c +10
-0+*/ +#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; +int offset, ret; + +if (!sunxi_display.enabled) +return ;return
-ENOENT?
Quoted 8 lines
Quoted 5 lines
If people want this, I can change the proto to an int and make
sunxi_simplefb_setupreturn error codes as you suggest, but this function gets called fromft_board_setupwhich is void itself, so there is no where to propagate the error, and more-over we do not want simplefb setup errors to be treated as fatal, so I see little use in having it return error codes.
ft_board_setup()will soon change to return an error. Will likely merge those patches next week.
That is good to hear, but not relevant in this case, as said:
"more-over we do not want simplefb setup errors to be treated as fatal"
Main reason for this is that older dtb-s do not have the pre-populated simplefb node. I guess it could be argued that not having the node should be a warning (and return 0), and the other errors should be real errors. I can be convinced to make that change, let me know either way.
Regards,
Hans
PATCH v4 2/2 sunxi: video: Add simplefb support
Hi Hans,
Quoted 113 lines · Hans de Goede
Hi,
Quoted 99 lines · Simon Glass
Hi Hans,
Quoted 95 lines · Hans de Goede
Hi,
Quoted 91 lines · Simon Glass
Hi Hans,
Quoted 76 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]>--- arch/arm/include/asm/arch-sunxi/display.h | 4 ++++ board/sunxi/board.c | 11 +++++++++ drivers/video/sunxi_display.c | 39 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 +++++++ 4 files changed, 62 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 +5
-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,40 @@ video_hw_init(void)return graphic_device; } + +/* +* Simplefb support. drivers/video/sunxi_display.c video_hw_init(void) · line 433
Quoted 10 lines
drivers/video/sunxi_display.c +10
-0+*/ +#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; +int offset, ret; + +if (!sunxi_display.enabled) +return ;return
-ENOENT?Quoted 8 lines
Quoted 5 lines
If people want this, I can change the proto to an int and make
sunxi_simplefb_setupreturn error codes as you suggest, but this function gets called fromft_board_setupwhich is void itself, so there is no where to propagate the error, and more-over we do not want simplefb setup errors to be treated as fatal, so I see little use in having it return error codes.
ft_board_setup()will soon change to return an error. Will likely merge those patches next week.That is good to hear, but not relevant in this case, as said:
Quoted 7 lines
"more-over we do not want simplefb setup errors to be treated as fatal"
Main reason for this is that older dtb-s do not have the pre-populated simplefb node. I guess it could be argued that not having the node should be a warning (and return 0), and the other errors should be real errors. I can be convinced to make that change, let me know either way.
Yes that sounds right to me.
Regards,
Simon
PATCH v4 2/2 sunxi: video: Add simplefb support
In reply to Hans de GoedeQuoted 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've no comments over and above what Simon said.
Ian.