sunxi: HDMI (cfb) console support
Subsystems (3)
cover sunxi: HDMI (cfb) console support
Hi all,
Now that the simplefb devicetree binding stuff has finally been sorted out, I would like to move forward with this patch-set.
Ian, can you please review the entire set, from the sunxi pov ?
Anatolij, can you please review the "sunxi: video: Add cfb console driver for sunxi" patch from a video subsys pov, it uses the cfb stuff as is, without making any changes, so there should not be any problems, but still I would like your acked by for this.
If the review goes smoothly I would still like to get this series into v2015.01, the initial version of these patches have been posted before the previous merge window, so this patch-set has been long enough in the making already. It has been in my personal tree and used when ever I have been doing sunxi work for months now, without any issues.
Regards,
Hans
PATCH 1/6 sun4i: Rename dram_clk_cfg to dram_clk_gate
The data sheet just calls it DRAM_CLK_REG, and on sun6i we've both a dram_clk_cfg and dram_clk_gate, and the sun4i reg matches dram_clk_gate on sun6i, so name it the same on sun4i.
--- arch/arm/cpu/armv7/sunxi/dram_sun4i.c | 4 ++-- arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/sunxi/dram_sun4i.c +2 -2
@@ -428,9 +428,9 @@ static void dramc_clock_output_en(u32 on)#ifdef CONFIG_MACH_SUN4I struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ;if (on) -setbits_le32 (&ccm->dram_clk_cfg,CCM_DRAM_CTRL_DCLK_OUT ); +setbits_le32 (&ccm->dram_clk_gate,CCM_DRAM_CTRL_DCLK_OUT );else -clrbits_le32 (&ccm->dram_clk_cfg,CCM_DRAM_CTRL_DCLK_OUT ); +clrbits_le32 (&ccm->dram_clk_gate,CCM_DRAM_CTRL_DCLK_OUT );#endif }
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +1 -1
@@ -62,7 +62,7 @@ struct sunxi_ccm_reg {u32 gps_clk_cfg;/* 0xd0 */ u32 spi3_clk_cfg;/* 0xd4 */ u8 res5[0x28 ]; -u32 dram_clk_cfg;/* 0x100 */ +u32 dram_clk_gate;/* 0x100 */ u32 be0_clk_cfg;/* 0x104 */ u32 be1_clk_cfg;/* 0x108 */ u32 fe0_clk_cfg;/* 0x10c */
Signature · 1 line
2.1.0
PATCH 1/6 sun4i: Rename dram_clk_cfg to dram_clk_gate
Quoted 5 lines · Hans de Goede
The data sheet just calls it
DRAM_CLK_REG, and on sun6i we've both adram_clk_cfganddram_clk_gate, and the sun4i reg matchesdram_clk_gateon sun6i, so name it the same on sun4i.Signed-off-by Hans de Goede <[email protected]>
Quoted 34 lines
--- arch/arm/cpu/armv7/sunxi/dram_sun4i.c | 4 ++-- arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)arch/arm/cpu/armv7/sunxi/dram_sun4i.c +2
-2@@ -428,9 +428,9 @@ static void dramc_clock_output_en(u32 on)#ifdef CONFIG_MACH_SUN4I struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ;if (on) -setbits_le32 (&ccm->dram_clk_cfg,CCM_DRAM_CTRL_DCLK_OUT ); +setbits_le32 (&ccm->dram_clk_gate,CCM_DRAM_CTRL_DCLK_OUT );else -clrbits_le32 (&ccm->dram_clk_cfg,CCM_DRAM_CTRL_DCLK_OUT ); +clrbits_le32 (&ccm->dram_clk_gate,CCM_DRAM_CTRL_DCLK_OUT );#endif }arch/arm/include/asm/arch-sunxi/clock_sun4i.h +1
-1@@ -62,7 +62,7 @@ struct sunxi_ccm_reg {u32 gps_clk_cfg;/* 0xd0 */ u32 spi3_clk_cfg;/* 0xd4 */ u8 res5[0x28 ]; -u32 dram_clk_cfg;/* 0x100 */ +u32 dram_clk_gate;/* 0x100 */ u32 be0_clk_cfg;/* 0x104 */ u32 be1_clk_cfg;/* 0x108 */ u32 fe0_clk_cfg;/* 0x10c */
PATCH 2/6 sunxi: Add video pll clock functions
In reply to Hans de GoedeThis is a preparation patch for adding support for HDMI out.
--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 27 ++++++++++++ arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 29 +++++++++++++ arch/arm/include/asm/arch-sunxi/clock.h | 2 + arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 45 ++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 59 ++++++++++++++++++++++++++- 5 files changed, 161 insertions(+), 1 deletion(-)
arch/arm/cpu/armv7/sunxi/clock_sun4i.c +27 -0
@@ -180,6 +180,21 @@ void clock_set_pll1(unsigned int hz) }#endif +void clock_set_pll3 (unsigned int clk) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +if (clk ==0 ) { +clrbits_le32 (&ccm->pll3_cfg,CCM_PLL3_CTRL_EN ); +return ; + } + +/* PLL3 rate = 3000000 * m */ +writel (CCM_PLL3_CTRL_EN |CCM_PLL3_CTRL_INTEGER_MODE | +CCM_PLL3_CTRL_M (clk /3000000 ), &ccm->pll3_cfg); +} +unsigned int clock_get_pll5p (void ) { struct sunxi_ccm_reg *const ccm =
@@ -200,3 +215,15 @@ unsigned int clock_get_pll6(void)int k = ((rval &CCM_PLL6_CTRL_K_MASK ) >>CCM_PLL6_CTRL_K_SHIFT ) +1 ;return 24000000 * n * k /2 ; } + +void clock_set_de_mod_clock (u32 *clk_cfg,unsigned int hz) +{ +int pll =clock_get_pll5p (); +int div =1 ; + +while ((pll / div) > hz) + div++; + +writel (CCM_DE_CTRL_GATE |CCM_DE_CTRL_RST |CCM_DE_CTRL_PLL5P | +CCM_DE_CTRL_M (div), clk_cfg); +}
arch/arm/cpu/armv7/sunxi/clock_sun6i.c +29 -0
@@ -127,6 +127,23 @@ void clock_set_pll1(unsigned int clk) }#endif +void clock_set_pll3 (unsigned int clk) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +const int m =8 ;/* 3 MHz steps just like sun4i, sun5i and sun7i */ + +if (clk ==0 ) { +clrbits_le32 (&ccm->pll3_cfg,CCM_PLL3_CTRL_EN ); +return ; + } + +/* PLL3 rate = 24000000 * n / m */ +writel (CCM_PLL3_CTRL_EN |CCM_PLL3_CTRL_INTEGER_MODE | +CCM_PLL3_CTRL_N (clk / (24000000 / m)) |CCM_PLL3_CTRL_M (m), + &ccm->pll3_cfg); +} +void clock_set_pll5 (unsigned int clk) { struct sunxi_ccm_reg * const ccm =
@@ -151,3 +168,15 @@ unsigned int clock_get_pll6(void)int k = ((rval &CCM_PLL6_CTRL_K_MASK ) >>CCM_PLL6_CTRL_K_SHIFT ) +1 ;return 24000000 * n * k /2 ; } + +void clock_set_de_mod_clock (u32 *clk_cfg,unsigned int hz) +{ +int pll =clock_get_pll6 () *2 ; +int div =1 ; + +while ((pll / div) > hz) + div++; + +writel (CCM_DE_CTRL_GATE |CCM_DE_CTRL_PLL6_2X |CCM_DE_CTRL_M (div), + clk_cfg); +}
arch/arm/include/asm/arch-sunxi/clock.h +2 -0
@@ -25,9 +25,11 @@int clock_init (void );int clock_twi_onoff (int port,int state);void clock_set_pll1 (unsigned int hz); +void clock_set_pll3 (unsigned int hz);void clock_set_pll5 (unsigned int hz);unsigned int clock_get_pll5p (void );unsigned int clock_get_pll6 (void ); +void clock_set_de_mod_clock (u32 *clk_cfg,unsigned int hz);void clock_init_safe (void );void clock_init_uart (void );#endif
arch/arm/include/asm/arch-sunxi/clock_sun4i.h +45 -0
67 lines not on this page · raw message
arch/arm/include/asm/arch-sunxi/clock_sun6i.h +58 -1
101 lines not on this page · raw message
Signature · 1 line
2.1.0
PATCH 2/6 sunxi: Add video pll clock functions
Quoted 3 lines · Hans de Goede
This is a preparation patch for adding support for HDMI out.
Signed-off-by Hans de Goede <[email protected]>
Quoted 294 lines
--- arch/arm/cpu/armv7/sunxi/clock_sun4i.c | 27 ++++++++++++ arch/arm/cpu/armv7/sunxi/clock_sun6i.c | 29 +++++++++++++ arch/arm/include/asm/arch-sunxi/clock.h | 2 + arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 45 ++++++++++++++++++++ arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 59 ++++++++++++++++++++++++++- 5 files changed, 161 insertions(+), 1 deletion(-)arch/arm/cpu/armv7/sunxi/clock_sun4i.c +27
-0@@ -180,6 +180,21 @@ void clock_set_pll1(unsigned int hz) }#endif +void clock_set_pll3 (unsigned int clk) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +if (clk ==0 ) { +clrbits_le32 (&ccm->pll3_cfg,CCM_PLL3_CTRL_EN ); +return ; + } + +/* PLL3 rate = 3000000 * m */ +writel (CCM_PLL3_CTRL_EN |CCM_PLL3_CTRL_INTEGER_MODE | +CCM_PLL3_CTRL_M (clk /3000000 ), &ccm->pll3_cfg); +} +unsigned int clock_get_pll5p (void ) { struct sunxi_ccm_reg *const ccm =@@ -200,3 +215,15 @@ unsigned int clock_get_pll6(void)int k = ((rval &CCM_PLL6_CTRL_K_MASK ) >>CCM_PLL6_CTRL_K_SHIFT ) +1 ;return 24000000 * n * k /2 ; } + +void clock_set_de_mod_clock (u32 *clk_cfg,unsigned int hz) +{ +int pll =clock_get_pll5p (); +int div =1 ; + +while ((pll / div) > hz) + div++; + +writel (CCM_DE_CTRL_GATE |CCM_DE_CTRL_RST |CCM_DE_CTRL_PLL5P | +CCM_DE_CTRL_M (div), clk_cfg); +}arch/arm/cpu/armv7/sunxi/clock_sun6i.c +29
-0@@ -127,6 +127,23 @@ void clock_set_pll1(unsigned int clk) }#endif +void clock_set_pll3 (unsigned int clk) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; +const int m =8 ;/* 3 MHz steps just like sun4i, sun5i and sun7i */ + +if (clk ==0 ) { +clrbits_le32 (&ccm->pll3_cfg,CCM_PLL3_CTRL_EN ); +return ; + } + +/* PLL3 rate = 24000000 * n / m */ +writel (CCM_PLL3_CTRL_EN |CCM_PLL3_CTRL_INTEGER_MODE | +CCM_PLL3_CTRL_N (clk / (24000000 / m)) |CCM_PLL3_CTRL_M (m), + &ccm->pll3_cfg); +} +void clock_set_pll5 (unsigned int clk) { struct sunxi_ccm_reg * const ccm =@@ -151,3 +168,15 @@ unsigned int clock_get_pll6(void)int k = ((rval &CCM_PLL6_CTRL_K_MASK ) >>CCM_PLL6_CTRL_K_SHIFT ) +1 ;return 24000000 * n * k /2 ; } + +void clock_set_de_mod_clock (u32 *clk_cfg,unsigned int hz) +{ +int pll =clock_get_pll6 () *2 ; +int div =1 ; + +while ((pll / div) > hz) + div++; + +writel (CCM_DE_CTRL_GATE |CCM_DE_CTRL_PLL6_2X |CCM_DE_CTRL_M (div), + clk_cfg); +}arch/arm/include/asm/arch-sunxi/clock.h +2
-0@@ -25,9 +25,11 @@int clock_init (void );int clock_twi_onoff (int port,int state);void clock_set_pll1 (unsigned int hz); +void clock_set_pll3 (unsigned int hz);void clock_set_pll5 (unsigned int hz);unsigned int clock_get_pll5p (void );unsigned int clock_get_pll6 (void ); +void clock_set_de_mod_clock (u32 *clk_cfg,unsigned int hz);void clock_init_safe (void );void clock_init_uart (void );#endif arch/arm/include/asm/arch-sunxi/clock_sun4i.h +45
-0@@ -186,12 +186,20 @@ struct sunxi_ccm_reg {/* ahb clock gate bit offset (second register) */ #define AHB_GATE_OFFSET_GMAC 17 +#define AHB_GATE_OFFSET_DE_BE0 12 +#define AHB_GATE_OFFSET_HDMI 11 +#define AHB_GATE_OFFSET_LCD1 5 +#define AHB_GATE_OFFSET_LCD0 4#define CCM_AHB_GATE_GPS (0x1 << 26)#define CCM_AHB_GATE_SDRAM (0x1 << 14)#define CCM_AHB_GATE_DLL (0x1 << 15)#define CCM_AHB_GATE_ACE (0x1 << 16) +#define CCM_PLL3_CTRL_M (n) (((n) & 0x7f) << 0) +#define CCM_PLL3_CTRL_INTEGER_MODE (0x1 << 15) +#define CCM_PLL3_CTRL_EN (0x1 << 31) +#define CCM_PLL5_CTRL_M (n) (((n) & 0x3) << 0)#define CCM_PLL5_CTRL_M_MASK CCM_PLL5_CTRL_M(0x3)#define CCM_PLL5_CTRL_M_X (n) ((n) - 1)@@ -253,6 +261,34 @@ struct sunxi_ccm_reg {#define CCM_MMC_CTRL_ENABLE (0x1 << 31) +#define CCM_DRAM_GATE_OFFSET_DE_BE0 26 + +#define CCM_LCD_CH0_CTRL_PLL3 (0 << 24) +#define CCM_LCD_CH0_CTRL_PLL7 (1 << 24) +#define CCM_LCD_CH0_CTRL_PLL3_2X (2 << 24) +#define CCM_LCD_CH0_CTRL_PLL7_2X (3 << 24) +#define CCM_LCD_CH0_CTRL_RST (0x1 << 30) +#define CCM_LCD_CH0_CTRL_GATE (0x1 << 31) + +#define CCM_LCD_CH1_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +/* We leave bit 11 set to 0, so sclk1 == sclk2 */ +#define CCM_LCD_CH1_CTRL_PLL3 (0 << 24) +#define CCM_LCD_CH1_CTRL_PLL7 (1 << 24) +#define CCM_LCD_CH1_CTRL_PLL3_2X (2 << 24) +#define CCM_LCD_CH1_CTRL_PLL7_2X (3 << 24) +/* Enable / disable both ch1 sclk1 and sclk2 at the same time */ +#define CCM_LCD_CH1_CTRL_GATE (0x1 << 31 | 0x1 << 15) + +#define CCM_HDMI_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +#define CCM_HDMI_CTRL_PLL_MASK (3 << 24) +#define CCM_HDMI_CTRL_PLL3 (0 << 24) +#define CCM_HDMI_CTRL_PLL7 (1 << 24) +#define CCM_HDMI_CTRL_PLL3_2X (2 << 24) +#define CCM_HDMI_CTRL_PLL7_2X (3 << 24) +/* No separate ddc gate on sun4i, sun5i and sun7i */ +#define CCM_HDMI_CTRL_DDC_GATE 0 +#define CCM_HDMI_CTRL_GATE (0x1 << 31) +#define CCM_GMAC_CTRL_TX_CLK_SRC_MII 0x0#define CCM_GMAC_CTRL_TX_CLK_SRC_EXT_RGMII 0x1#define CCM_GMAC_CTRL_TX_CLK_SRC_INT_RGMII 0x2@@ -266,4 +302,13 @@ struct sunxi_ccm_reg {#define CCM_USB_CTRL_PHY1_CLK 0#define CCM_USB_CTRL_PHY2_CLK 0 +/* CCM bits common to all Display Engine (and IEP) clock ctrl regs */ +#define CCM_DE_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +#define CCM_DE_CTRL_PLL_MASK (3 << 24) +#define CCM_DE_CTRL_PLL3 (0 << 24) +#define CCM_DE_CTRL_PLL7 (1 << 24) +#define CCM_DE_CTRL_PLL5P (2 << 24) +#define CCM_DE_CTRL_RST (1 << 30) +#define CCM_DE_CTRL_GATE (1 << 31) +#endif /* _SUNXI_CLOCK_SUN4I_H */ arch/arm/include/asm/arch-sunxi/clock_sun6i.h +58
-1@@ -176,13 +176,18 @@ struct sunxi_ccm_reg {#define CCM_PLL1_CTRL_MAGIC (0x1 << 16)#define CCM_PLL1_CTRL_EN (0x1 << 31) +#define CCM_PLL3_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +#define CCM_PLL3_CTRL_N (n) ((((n) - 1) & 0x7f) << 8) +#define CCM_PLL3_CTRL_INTEGER_MODE (0x1 << 24) +#define CCM_PLL3_CTRL_EN (0x1 << 31) +#define CCM_PLL5_CTRL_M (n) ((((n) - 1) & 0x3) << 0)#define CCM_PLL5_CTRL_K (n) ((((n) - 1) & 0x3) << 4)#define CCM_PLL5_CTRL_N (n) ((((n) - 1) & 0x1f) << 8)#define CCM_PLL5_CTRL_UPD (0x1 << 20)#define CCM_PLL5_CTRL_EN (0x1 << 31) -#define PLL6_CFG_DEFAULT 0x90041811 +#define PLL6_CFG_DEFAULT 0x90041811/* 600 MHz */ #define CCM_PLL6_CTRL_N_SHIFT 8#define CCM_PLL6_CTRL_N_MASK (0x1f << CCM_PLL6_CTRL_N_SHIFT)@@ -193,6 +198,7 @@ struct sunxi_ccm_reg {#define AXI_GATE_OFFSET_DRAM 0 +/* ahb_gate0 offsets */ #define AHB_GATE_OFFSET_USB_OHCI1 30#define AHB_GATE_OFFSET_USB_OHCI0 29#define AHB_GATE_OFFSET_USB_EHCI1 27@@ -204,6 +210,13 @@ struct sunxi_ccm_reg {#define AHB_GATE_OFFSET_MMC0 8#define AHB_GATE_OFFSET_MMC (n) (AHB_GATE_OFFSET_MMC0 + (n)) +/* ahb_gate1 offsets */ +#define AHB_GATE_OFFSET_DRC0 25 +#define AHB_GATE_OFFSET_DE_BE0 12 +#define AHB_GATE_OFFSET_HDMI 11 +#define AHB_GATE_OFFSET_LCD1 5 +#define AHB_GATE_OFFSET_LCD0 4 +#define CCM_MMC_CTRL_OSCM24 (0x0 << 24)#define CCM_MMC_CTRL_PLL6 (0x1 << 24)@@ -223,8 +236,34 @@ struct sunxi_ccm_reg {#define CCM_DRAMCLK_CFG_UPD (0x1 << 16)#define CCM_DRAMCLK_CFG_RST (0x1 << 31) +#define CCM_DRAM_GATE_OFFSET_DE_BE0 26 + +#define CCM_LCD_CH0_CTRL_PLL3 (0 << 24) +#define CCM_LCD_CH0_CTRL_PLL7 (1 << 24) +#define CCM_LCD_CH0_CTRL_PLL3_2X (2 << 24) +#define CCM_LCD_CH0_CTRL_PLL7_2X (3 << 24) +#define CCM_LCD_CH0_CTRL_MIPI_PLL (4 << 24) +#define CCM_LCD_CH0_CTRL_GATE (0x1 << 31) + +#define CCM_LCD_CH1_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +#define CCM_LCD_CH1_CTRL_PLL3 (0 << 24) +#define CCM_LCD_CH1_CTRL_PLL7 (1 << 24) +#define CCM_LCD_CH1_CTRL_PLL3_2X (2 << 24) +#define CCM_LCD_CH1_CTRL_PLL7_2X (3 << 24) +#define CCM_LCD_CH1_CTRL_GATE (0x1 << 31) + +#define CCM_HDMI_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +#define CCM_HDMI_CTRL_PLL_MASK (3 << 24) +#define CCM_HDMI_CTRL_PLL3 (0 << 24) +#define CCM_HDMI_CTRL_PLL7 (1 << 24) +#define CCM_HDMI_CTRL_PLL3_2X (2 << 24) +#define CCM_HDMI_CTRL_PLL7_2X (3 << 24) +#define CCM_HDMI_CTRL_DDC_GATE (0x1 << 30) +#define CCM_HDMI_CTRL_GATE (0x1 << 31) +#define MBUS_CLK_DEFAULT 0x81000001/* PLL6 / 2 */ +/* ahb_reset0 offsets */ #define AHB_RESET_OFFSET_MCTL 14#define AHB_RESET_OFFSET_MMC3 11#define AHB_RESET_OFFSET_MMC2 10@@ -232,10 +271,28 @@ struct sunxi_ccm_reg {#define AHB_RESET_OFFSET_MMC0 8#define AHB_RESET_OFFSET_MMC (n) (AHB_RESET_OFFSET_MMC0 + (n)) +/* ahb_reset0 offsets */ +#define AHB_RESET_OFFSET_DRC0 25 +#define AHB_RESET_OFFSET_DE_BE0 12 +#define AHB_RESET_OFFSET_HDMI 11 +#define AHB_RESET_OFFSET_LCD1 5 +#define AHB_RESET_OFFSET_LCD0 4 +/* apb2 reset */ #define APB2_RESET_UART_SHIFT (16)#define APB2_RESET_UART_MASK (0xff << APB2_RESET_UART_SHIFT)#define APB2_RESET_TWI_SHIFT (0)#define APB2_RESET_TWI_MASK (0xf << APB2_RESET_TWI_SHIFT) +/* CCM bits common to all Display Engine (and IEP) clock ctrl regs */ +#define CCM_DE_CTRL_M (n) ((((n) - 1) & 0xf) << 0) +#define CCM_DE_CTRL_PLL_MASK (0xf << 24) +#define CCM_DE_CTRL_PLL3 (0 << 24) +#define CCM_DE_CTRL_PLL7 (1 << 24) +#define CCM_DE_CTRL_PLL6_2X (2 << 24) +#define CCM_DE_CTRL_PLL8 (3 << 24) +#define CCM_DE_CTRL_PLL9 (4 << 24) +#define CCM_DE_CTRL_PLL10 (5 << 24) +#define CCM_DE_CTRL_GATE (1 << 31) +#endif /* _SUNXI_CLOCK_SUN6I_H */
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
In reply to Hans de GoedeFrom: Luc Verhaegen <[email protected]>
This adds a fixed mode hdmi driver for the sunxi platform. The fixed mode is a relatively safe 1024x768, more complete EDID handling is currently not provided. Only HDMI is supported today.
This code is enabled when HPD detects an attached monitor.
Current config is such that 8MB is shaved off at the top of the RAM. This avoids several memory handling issues, most significant is the fact that on linux on ARM you are not allowed to remap known RAM as IO. A clued in display driver will be able to recycle this reserved RAM in future though.
cfbconsole was chosen as it provides the most important functionality: a working u-boot console, allowing for the debugging of certain issues without the need for a UART.
--- arch/arm/include/asm/arch-sunxi/display.h | 198 +++++++++++++++ board/sunxi/Kconfig | 7 + configs/Ippo_q8h_v5_defconfig | 1 + drivers/video/Makefile | 1 + drivers/video/sunxi_display.c | 387 ++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 34 +++ 6 files changed, 628 insertions(+) create mode 100644 arch/arm/include/asm/arch-sunxi/display.h create mode 100644 drivers/video/sunxi_display.c
arch/arm/include/asm/arch-sunxi/display.h new file +198 -0
@@ -0,0 +1,198 @@ +/* +* Sunxi platform display cntroller register and constant defines +* +* (C) Copyright 2014 Hans de Goede <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#ifndef _SUNXI_DISPLAY_H +#define _SUNXI_DISPLAY_H + +struct sunxi_de_be_reg { +u8 res0[0x800 ];/* 0x000 */ +u32 mode;/* 0x800 */ +u32 backcolor;/* 0x804 */ +u32 disp_size;/* 0x808 */ +u8 res1[0x4 ];/* 0x80c */ +u32 layer0_size;/* 0x810 */ +u32 layer1_size;/* 0x814 */ +u32 layer2_size;/* 0x818 */ +u32 layer3_size;/* 0x81c */ +u32 layer0_pos;/* 0x820 */ +u32 layer1_pos;/* 0x824 */ +u32 layer2_pos;/* 0x828 */ +u32 layer3_pos;/* 0x82c */ +u8 res2[0x10 ];/* 0x830 */ +u32 layer0_stride;/* 0x840 */ +u32 layer1_stride;/* 0x844 */ +u32 layer2_stride;/* 0x848 */ +u32 layer3_stride;/* 0x84c */ +u32 layer0_addr_low32b;/* 0x850 */ +u32 layer1_addr_low32b;/* 0x854 */ +u32 layer2_addr_low32b;/* 0x858 */ +u32 layer3_addr_low32b;/* 0x85c */ +u32 layer0_addr_high4b;/* 0x860 */ +u32 layer1_addr_high4b;/* 0x864 */ +u32 layer2_addr_high4b;/* 0x868 */ +u32 layer3_addr_high4b;/* 0x86c */ +u32 reg_ctrl;/* 0x870 */ +u8 res3[0xc ];/* 0x874 */ +u32 color_key_max;/* 0x880 */ +u32 color_key_min;/* 0x884 */ +u32 color_key_config;/* 0x888 */ +u8 res4[0x4 ];/* 0x88c */ +u32 layer0_attr0_ctrl;/* 0x890 */ +u32 layer1_attr0_ctrl;/* 0x894 */ +u32 layer2_attr0_ctrl;/* 0x898 */ +u32 layer3_attr0_ctrl;/* 0x89c */ +u32 layer0_attr1_ctrl;/* 0x8a0 */ +u32 layer1_attr1_ctrl;/* 0x8a4 */ +u32 layer2_attr1_ctrl;/* 0x8a8 */ +u32 layer3_attr1_ctrl;/* 0x8ac */ +}; + +struct sunxi_lcdc_reg { +u32 ctrl;/* 0x00 */ +u32 int0;/* 0x04 */ +u32 int1;/* 0x08 */ +u8 res0[0x04 ];/* 0x0c */ +u32 frame_ctrl;/* 0x10 */ +u8 res1[0x2c ];/* 0x14 */ +u32 tcon0_ctrl;/* 0x40 */ +u32 tcon0_dclk;/* 0x44 */ +u32 tcon0_basic_timing0;/* 0x48 */ +u32 tcon0_basic_timing1;/* 0x4c */ +u32 tcon0_basic_timing2;/* 0x50 */ +u32 tcon0_basic_timing3;/* 0x54 */ +u32 tcon0_hv_intf;/* 0x58 */ +u8 res2[0x04 ];/* 0x5c */ +u32 tcon0_cpu_intf;/* 0x60 */ +u32 tcon0_cpu_wr_dat;/* 0x64 */ +u32 tcon0_cpu_rd_dat0;/* 0x68 */ +u32 tcon0_cpu_rd_dat1;/* 0x6c */ +u32 tcon0_ttl_timing0;/* 0x70 */ +u32 tcon0_ttl_timing1;/* 0x74 */ +u32 tcon0_ttl_timing2;/* 0x78 */ +u32 tcon0_ttl_timing3;/* 0x7c */ +u32 tcon0_ttl_timing4;/* 0x80 */ +u32 tcon0_lvds_intf;/* 0x84 */ +u32 tcon0_io_polarity;/* 0x88 */ +u32 tcon0_io_tristate;/* 0x8c */ +u32 tcon1_ctrl;/* 0x90 */ +u32 tcon1_timing_source;/* 0x94 */ +u32 tcon1_timing_scale;/* 0x98 */ +u32 tcon1_timing_out;/* 0x9c */ +u32 tcon1_timing_h;/* 0xa0 */ +u32 tcon1_timing_v;/* 0xa4 */ +u32 tcon1_timing_sync;/* 0xa8 */ +u8 res3[0x44 ];/* 0xac */ +u32 tcon1_io_polarity;/* 0xf0 */ +u32 tcon1_io_tristate;/* 0xf4 */ +}; + +#define SUNXI_HDMI_CTRL 0x004 +#define SUNXI_HDMI_INT_CTRL 0x008 +#define SUNXI_HDMI_HPD 0x00c +#define SUNXI_HDMI_VIDEO_CTRL 0x010 +#define SUNXI_HDMI_VIDEO_SIZE 0x014 +#define SUNXI_HDMI_VIDEO_BP 0x018 +#define SUNXI_HDMI_VIDEO_FP 0x01c +#define SUNXI_HDMI_VIDEO_SPW 0x020 +#define SUNXI_HDMI_VIDEO_POLARITY 0x024 +#define SUNXI_HDMI_TX_DRIVER0 0x200 +#define SUNXI_HDMI_TX_DRIVER1 0x204 +#define SUNXI_HDMI_TX_DRIVER2 0x208 +#define SUNXI_HDMI_TX_DRIVER3 0x20C +struct sunxi_hdmi_reg { +u32 version_id;/* 0x000 */ +u32 ctrl;/* 0x004 */ +u32 irq;/* 0x008 */ +u32 hpd;/* 0x00c */ +u32 video_ctrl;/* 0x010 */ +u32 video_size;/* 0x014 */ +u32 video_bp;/* 0x018 */ +u32 video_fp;/* 0x01c */ +u32 video_spw;/* 0x020 */ +u32 video_polarity;/* 0x024 */ +u8 res0[0x1d8 ];/* 0x028 */ +u32 pad_ctrl0;/* 0x200 */ +u32 pad_ctrl1;/* 0x204 */ +u32 pll_ctrl;/* 0x208 */ +u32 pll_dbg0;/* 0x20c */ +}; + +/* +* DE-BE register constants. +*/ +#define SUNXI_DE_BE_WIDTH (x) (((x) - 1) << 0) +#define SUNXI_DE_BE_HEIGHT (y) (((y) - 1) << 16) +#define SUNXI_DE_BE_MODE_ENABLE (1 << 0) +#define SUNXI_DE_BE_MODE_START (1 << 1) +#define SUNXI_DE_BE_MODE_LAYER0_ENABLE (1 << 8) +#define SUNXI_DE_BE_LAYER_STRIDE (x) ((x) << 5) +#define SUNXI_DE_BE_REG_CTRL_LOAD_REGS (1 << 0) +#define SUNXI_DE_BE_LAYER_ATTR1_FMT_XRGB8888 (0x09 << 8) + +/* +* LCDC register constants. +*/ +#define SUNXI_LCDC_X (x) (((x) - 1) << 16) +#define SUNXI_LCDC_Y (y) (((y) - 1) << 0) +#define SUNXI_LCDC_CTRL_IO_MAP_MASK (1 << 0) +#define SUNXI_LCDC_CTRL_IO_MAP_TCON0 (0 << 0) +#define SUNXI_LCDC_CTRL_IO_MAP_TCON1 (1 << 0) +#define SUNXI_LCDC_CTRL_TCON_ENABLE (1 << 31) +#define SUNXI_LCDC_TCON0_DCLK_ENABLE (0xf << 28) +#define SUNXI_LCDC_TCON1_CTRL_CLK_DELAY (n) (((n) & 0x1f) << 4) +#define SUNXI_LCDC_TCON1_CTRL_ENABLE (1 << 31) +#define SUNXI_LCDC_TCON1_TIMING_H_BP (n) (((n) - 1) << 0) +#define SUNXI_LCDC_TCON1_TIMING_H_TOTAL (n) (((n) - 1) << 16) +#define SUNXI_LCDC_TCON1_TIMING_V_BP (n) (((n) - 1) << 0) +#define SUNXI_LCDC_TCON1_TIMING_V_TOTAL (n) (((n) * 2) << 16) + +/* +* HDMI register constants. +*/ +#define SUNXI_HDMI_X (x) (((x) - 1) << 0) +#define SUNXI_HDMI_Y (y) (((y) - 1) << 16) +#define SUNXI_HDMI_CTRL_ENABLE (1 << 31) +#define SUNXI_HDMI_IRQ_STATUS_FIFO_UF (1 << 0) +#define SUNXI_HDMI_IRQ_STATUS_FIFO_OF (1 << 1) +#define SUNXI_HDMI_IRQ_STATUS_BITS 0x73 +#define SUNXI_HDMI_HPD_DETECT (1 << 0) +#define SUNXI_HDMI_VIDEO_CTRL_ENABLE (1 << 31) +#define SUNXI_HDMI_VIDEO_POL_HOR (1 << 0) +#define SUNXI_HDMI_VIDEO_POL_VER (1 << 1) +#define SUNXI_HDMI_VIDEO_POL_TX_CLK (0x3e0 << 16) + +#ifdef CONFIG_MACH_SUN6I +#define SUNXI_HDMI_PAD_CTRL0_HDP 0x7e80000f +#define SUNXI_HDMI_PAD_CTRL0_RUN 0x7e8000ff +#else +#define SUNXI_HDMI_PAD_CTRL0_HDP 0xfe800000 +#define SUNXI_HDMI_PAD_CTRL0_RUN 0xfe800000 +#endif + +#ifdef CONFIG_MACH_SUN4I +#define SUNXI_HDMI_PAD_CTRL1 0x00d8c820 +#elif definedCONFIG_MACH_SUN6I +#define SUNXI_HDMI_PAD_CTRL1 0x01ded030 +#else +#define SUNXI_HDMI_PAD_CTRL1 0x00d8c830 +#endif +#define SUNXI_HDMI_PAD_CTRL1_HALVE (1 << 6) + +#ifdef CONFIG_MACH_SUN6I +#define SUNXI_HDMI_PLL_CTRL 0xba48a308 +#define SUNXI_HDMI_PLL_CTRL_DIV (n) (((n) - 1) << 4) +#else +#define SUNXI_HDMI_PLL_CTRL 0xfa4ef708 +#define SUNXI_HDMI_PLL_CTRL_DIV (n) ((n) << 4) +#endif +#define SUNXI_HDMI_PLL_CTRL_DIV_MASK (0xf << 4) + +#define SUNXI_HDMI_PLL_DBG0_PLL3 (0 << 21) +#define SUNXI_HDMI_PLL_DBG0_PLL7 (1 << 21) + +#endif /* _SUNXI_DISPLAY_H */
board/sunxi/Kconfig +7 -0
@@ -216,4 +216,11 @@ config USB2_VBUS_PIN ---help--- See USB1_VBUS_PIN help text. +config VIDEO + boolean "Enable graphical uboot console on HDMI" + default y + ---help--- + Say Y here to add support for using a cfb console on the HDMI output + found on most sunxi devices. + endif
configs/Ippo_q8h_v5_defconfig +1 -0
@@ -4,3 +4,4 @@ CONFIG_ARCH_SUNXI=y CONFIG_MACH_SUN8I=y CONFIG_TARGET_IPPO_Q8H_V5=y CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" +CONFIG_VIDEO=n
drivers/video/Makefile +1 -0
@@ -39,6 +39,7 @@ obj-$(CONFIG_VIDEO_SANDBOX_SDL) += sandbox_sdl.o obj-$(CONFIG_VIDEO_SED13806) += sed13806.o obj-$(CONFIG_VIDEO_SM501) += sm501.o obj-$(CONFIG_VIDEO_SMI_LYNXEM) += smiLynxEM.o videomodes.o +obj-$(CONFIG_VIDEO_SUNXI) += sunxi_display.o obj-$(CONFIG_VIDEO_TEGRA) += tegra.o obj-$(CONFIG_VIDEO_VCXK) += bus_vcxk.o obj-$(CONFIG_FORMIKE) += formike.o
drivers/video/sunxi_display.c new file +387 -0
387 lines not on this page · raw message
include/configs/sunxi-common.h +34 -0
@@ -197,6 +197,30 @@#define CONFIG_SPL_GPIO_SUPPORT #define CONFIG_CMD_GPIO +#ifdef CONFIG_VIDEO +/* +* The amount of RAM that is reserved for the FB. This will not show up as +* RAM to the kernel, but will be reclaimed by a KMS driver in future. +*/ +#define CONFIG_SUNXI_FB_SIZE (8 << 20) + +#define CONFIG_VIDEO_SUNXI + +#define CONFIG_CFB_CONSOLE +#define CONFIG_VIDEO_SW_CURSOR +#define CONFIG_VIDEO_LOGO + +/* allow both serial and cfb console. */ +#define CONFIG_CONSOLE_MUX +/* this is needed so the above will actually do something */ +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +/* stop x86 thinking in cfbconsole from trying to init a pc keyboard */ +#define CONFIG_VGA_AS_SINGLE_DEVICE + +#define CONFIG_SYS_MEM_TOP_HIDE ((CONFIG_SUNXI_FB_SIZE + 0xFFF) & ~0xFFF) + +#endif /* CONFIG_VIDEO */ +/* Ethernet support */ #ifdef CONFIG_SUNXI_EMAC #define CONFIG_MII /* MII PHY management */
@@ -266,7 +290,17 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_VIDEO +#define CONSOLE_ENV_SETTINGS \ + "stdin=serial\0" \ + "stdout=serial,vga\0" \ + "stderr=serial,vga\0" +#else +#define CONSOLE_ENV_SETTINGS +#endif +#define CONFIG_EXTRA_ENV_SETTINGS \ + CONSOLE_ENV_SETTINGS \ MEM_LAYOUT_ENV_SETTINGS \ "fdtfile=" CONFIG_FDTFILE "\0" \ "console=ttyS0,115200\0" \
Signature · 1 line
2.1.0
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
Hi Hans,
this patch looks good, only a few minor comments below.
On Fri, 14 Nov 2014 17:54:45 +0100
Hans de Goede <[email protected]> wrote:
...
arch/arm/include/asm/arch-sunxi/display.h line 2
Quoted 8 lines
arch/arm/include/asm/arch-sunxi/display.h new file +2
-0@@ -0,0 +1,198 @@ +/* +* Sunxi platform display cntroller register and constant defines
s/cntroller/controller/
not need to resubmit the patch, this can be fixed when applying.
...
arch/arm/include/asm/arch-sunxi/display.h line 7
Quoted 5 lines
arch/arm/include/asm/arch-sunxi/display.h new file +5
-0+#if 1 +printf ("dotclock: %dkHz = %dkHz: (%d * 3MHz * %d) / %d\n" , + dotclock, (best_double +1 ) *3000 * best_n / best_m, + best_double +1 , best_n, best_m); +#endif
please drop #if 1 / #endif when applying the patch. here, printf() could be replaced by debug() maybe ?
...
arch/arm/include/asm/arch-sunxi/display.h line 11
Quoted 4 lines
arch/arm/include/asm/arch-sunxi/display.h new file +4
-0+udelay (1000000 / mode->refresh +500 ); + +/* Sometimes the display pipeline does not sync up properly, if +this happens the hdmi fifo underrun or overrun bits are set */
we use
/*
* multi-line
* comment
*/
style.
Thanks,
Anatolij
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
On Fri, 14 Nov 2014 21:17:39 +0100
Anatolij Gustschin <[email protected]> wrote:
...
Quoted 1 line
this patch looks good, only a few minor comments below.
I forgot to mention that with these comments addressed, you can add
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
Hi,
Quoted 7 lines · Anatolij Gustschin
On Fri, 14 Nov 2014 21:17:39 +0100
Anatolij Gustschin <[email protected]> wrote:
...Quoted 1 line
this patch looks good, only a few minor comments below.
I forgot to mention that with these comments addressed, you can add
Thanks for the review!
I'll go and address your comments in my local tree.
Quoted 1 line
And then add your acked-by.
Regards,
Hans
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
In reply to Hans de Goedeinclude/configs/sunxi-common.h line 299
Quoted 10 lines · Hans de Goede
include/configs/sunxi-common.h +9
-0+/* this is needed so the above will actually do something */ +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#ifdef CONFIG_VIDEO +#define CONSOLE_ENV_SETTINGS \ + "stdin=serial\0" \ + "stdout=serial,vga\0" \ + "stderr=serial,vga\0" +#else +#define CONSOLE_ENV_SETTINGS
Now that CONFIG_SYS_CONSOLE_IS_IN_ENV is set do we need to either say something here and/or provide the overwrite_console() hook?
Perhaps something along the lines of:
#ifdef CONFIG_VIDEO
#define CONSOLE_ENV_VGA_SETTINGS ",vga"
#endif
#define CONSOLE_ENV_SETTINGS \
"stdin=serial\0" \
"stdout=serial" CONSOLE_ENV_VGA_SETTINGS "\0" \
"stderr=serial" CONSOLE_ENV_VGA_SETTINGS "\0"Has this been tested on a serial-only board?
Ian.
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
Quoted 25 lines · Ian Campbell
include/configs/sunxi-common.h line 299
Quoted 10 lines · Hans de Goede
include/configs/sunxi-common.h +9
-0+/* this is needed so the above will actually do something */ +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#ifdef CONFIG_VIDEO +#define CONSOLE_ENV_SETTINGS \ + "stdin=serial\0" \ + "stdout=serial,vga\0" \ + "stderr=serial,vga\0" +#else +#define CONSOLE_ENV_SETTINGS Now that
CONFIG_SYS_CONSOLE_IS_IN_ENVis set do we need to either say something here and/or provide theoverwrite_console()hook?Perhaps something along the lines of:
#ifdef CONFIG_VIDEO #define CONSOLE_ENV_VGA_SETTINGS ",vga" #endif #define CONSOLE_ENV_SETTINGS \ "stdin=serial\0" \ "stdout=serial" CONSOLE_ENV_VGA_SETTINGS "\0" \ "stderr=serial" CONSOLE_ENV_VGA_SETTINGS "\0"
Quoted 1 line
Has this been tested on a serial-only board?
Forgot to say: all the rest looks fine to me and/or I'm satisfied if Anatolij is.
Ian
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
In reply to Ian CampbellHi,
Thanks for the reviews!
Quoted 14 lines · Ian Campbell
include/configs/sunxi-common.h line 299
Quoted 10 lines · Hans de Goede
include/configs/sunxi-common.h +9
-0+/* this is needed so the above will actually do something */ +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#ifdef CONFIG_VIDEO +#define CONSOLE_ENV_SETTINGS \ + "stdin=serial\0" \ + "stdout=serial,vga\0" \ + "stderr=serial,vga\0" +#else +#define CONSOLE_ENV_SETTINGS Now that
CONFIG_SYS_CONSOLE_IS_IN_ENVis set do we need to either say something here and/or provide theoverwrite_console()hook?
No, if we have a need for a overwrite_console() hook, we need to also define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE, see common/console.c:
#ifdef CONFIG_SYS_CONSOLE_IS_IN_ENV
/*
* if overwrite_console returns 1, the stdin, stderr and stdout
* are switched to the serial port, else the settings in the
* environment are used
*/
#ifdef CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE
extern int overwrite_console(void);
#define OVERWRITE_CONSOLE overwrite_console()
#else
#define OVERWRITE_CONSOLE 0
#endif /* CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE */
#endif /* CONFIG_SYS_CONSOLE_IS_IN_ENV */
Quoted 9 lines
Perhaps something along the lines of:
#ifdef CONFIG_VIDEO #define CONSOLE_ENV_VGA_SETTINGS ",vga" #endif #define CONSOLE_ENV_SETTINGS \ "stdin=serial\0" \ "stdout=serial" CONSOLE_ENV_VGA_SETTINGS "\0" \ "stderr=serial" CONSOLE_ENV_VGA_SETTINGS "\0"
There is no need to set these when CONFIG_VIDEO is not defined since CONFIG_SYS_CONSOLE_IS_IN_ENV only gets set when CONFIG_VIDEO is set, at least in this point in the patch set.
Once we add usb-keyboard support I want to support usb-keyb. support, without having it depend on CONFIG_VIDEO (even though it makes the most sense with CONFIG_VIDEO).
But even then I prefer this style:
#ifdef CONFIG_VIDEO
#define CONSOLE_OUT_SETTINGS \
"stdout=serial,vga\0" \
"stderr=serial,vga\0"
#else
#define CONSOLE_OUT_SETTINGS \
"stdout=serial\0" \
"stderr=serial\0"#endif
Over the pre-processor magic you're suggesting, as it is more readable IMHO, also it matches what we're do for #ifdef CONFIG_MMC, #ifdef CONFIG_AHCI, etc.
Quoted 1 line
Has this been tested on a serial-only board?
Erm, good question.
So the A13 olinuxino boards do not have hdmi, which means I should add CONFIG_VIDEO=n to their defconfigs, fixed in my local tree.
After that I've just ran some tests on an A13 board, which work fine (as expected, but you're right this ought to be tested).
Regards,
Hans
PATCH 3/6 sunxi: video: Add cfb console driver for sunxi
Quoted 21 lines · Hans de Goede
Hi,
Thanks for the reviews!
Quoted 14 lines · Ian Campbell
include/configs/sunxi-common.h line 299
Quoted 10 lines · Hans de Goede
include/configs/sunxi-common.h +9
-0+/* this is needed so the above will actually do something */ +#define CONFIG_SYS_CONSOLE_IS_IN_ENV +#ifdef CONFIG_VIDEO +#define CONSOLE_ENV_SETTINGS \ + "stdin=serial\0" \ + "stdout=serial,vga\0" \ + "stderr=serial,vga\0" +#else +#define CONSOLE_ENV_SETTINGS Now that
CONFIG_SYS_CONSOLE_IS_IN_ENVis set do we need to either say something here and/or provide theoverwrite_console()hook?
Quoted 2 lines
No, if we have a need for a
overwrite_console()hook, we need to also defineCONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE, seecommon/console.c:
Ah, README didn't mention this under CONSOLE_IS_IN_ENV, only under OVERWRITE_ROUTINE which I didn't know to look for.
Quoted 10 lines
But even then I prefer this style:
#ifdef
CONFIG_VIDEO#define CONSOLE_OUT_SETTINGS \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" #else #define CONSOLE_OUT_SETTINGS \ "stdout=serial\0" \ "stderr=serial\0"
Quoted 5 lines
#endif
Over the pre-processor magic you're suggesting, as it is more readable IMHO, also it matches what we're do for #ifdef
CONFIG_MMC, #ifdefCONFIG_AHCI, etc.
OK.
Quoted 10 lines
Quoted 2 lines
Has this been tested on a serial-only board?
Erm, good question.
So the A13 olinuxino boards do not have hdmi, which means I should add
CONFIG_VIDEO=nto their defconfigs, fixed in my local tree.After that I've just ran some tests on an A13 board, which work fine (as expected, but you're right this ought to be tested).
Great, thanks,
PATCH 4/6 sunxi: video: Add sun6i support
In reply to Hans de Goede--- drivers/video/sunxi_display.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/video/sunxi_display.c +31 -0
@@ -39,6 +39,9 @@ sunxi_hdmi_hpd_detect(void) CCM_HDMI_CTRL_PLL3);/* Set ahb gating to pass */ +#ifdef CONFIG_MACH_SUN6I +setbits_le32 (&ccm->ahb_reset1_cfg,1 <<AHB_RESET_OFFSET_HDMI ); +#endif setbits_le32 (&ccm->ahb_gate1,1 <<AHB_GATE_OFFSET_HDMI );/* Clock on */
@@ -56,6 +59,9 @@ sunxi_hdmi_hpd_detect(void)clrbits_le32 (&hdmi->ctrl,SUNXI_HDMI_CTRL_ENABLE );clrbits_le32 (&ccm->hdmi_clk_cfg,CCM_HDMI_CTRL_GATE );clrbits_le32 (&ccm->ahb_gate1,1 <<AHB_GATE_OFFSET_HDMI ); +#ifdef CONFIG_MACH_SUN6I +clrbits_le32 (&ccm->ahb_reset1_cfg,1 <<AHB_RESET_OFFSET_HDMI ); +#endif clock_set_pll3 (0 );return 0 ;
@@ -74,6 +80,11 @@ sunxi_composer_init(void) (struct sunxi_de_be_reg *)SUNXI_DE_BE0_BASE ;int i; +#ifdef CONFIG_MACH_SUN6I +/* Reset off */ +setbits_le32 (&ccm->ahb_reset1_cfg,1 <<AHB_RESET_OFFSET_DE_BE0 ); +#endif +/* Clocks on */ setbits_le32 (&ccm->ahb_gate1,1 <<AHB_GATE_OFFSET_DE_BE0 );setbits_le32 (&ccm->dram_clk_gate,1 <<CCM_DRAM_GATE_OFFSET_DE_BE0 );
@@ -177,7 +188,11 @@ sunxi_lcdc_init(void) (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE ;/* Reset off */ +#ifdef CONFIG_MACH_SUN6I +setbits_le32 (&ccm->ahb_reset1_cfg,1 <<AHB_RESET_OFFSET_LCD0 ); +#else setbits_le32 (&ccm->lcd0_ch0_clk_cfg,CCM_LCD_CH0_CTRL_RST ); +#endif /* Clock on */ setbits_le32 (&ccm->ahb_gate1,1 <<AHB_GATE_OFFSET_LCD0 );
@@ -232,6 +247,19 @@ sunxi_lcdc_mode_set(struct fb_videomode *mode, int *clk_div, int *clk_double)sunxi_lcdc_pll_set (mode->pixclock, clk_div, clk_double); } +#ifdef CONFIG_MACH_SUN6I +static void +sunxi_drc_init (void ) +{ +struct sunxi_ccm_reg *const ccm = + (struct sunxi_ccm_reg *)SUNXI_CCM_BASE ; + +/* On sun6i the drc must be clocked even when in pass-through mode */ +setbits_le32 (&ccm->ahb_reset1_cfg,1 <<AHB_RESET_OFFSET_DRC0 ); +clock_set_de_mod_clock (&ccm->iep_drc0_clk_cfg,300000000 ); +} +#endif +static void sunxi_hdmi_mode_set (struct fb_videomode *mode,int clk_div,int clk_double) {
@@ -283,6 +311,9 @@ sunxi_engines_init(void) {sunxi_composer_init ();sunxi_lcdc_init (); +#ifdef CONFIG_MACH_SUN6I +sunxi_drc_init (); +#endif } static void
Signature · 1 line
2.1.0
PATCH 4/6 sunxi: video: Add sun6i support
Quoted 4 lines · On Fri, 14 Nov 2014 17:54:46 +0100 Hans de Goede <[email protected]> wrote:
Signed-off-by Hans de Goede <[email protected]>--- drivers/video/sunxi_display.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
Thanks,
Anatolij
PATCH 4/6 sunxi: video: Add sun6i support
In reply to Hans de Goededrivers/video/sunxi_display.c sunxi_lcdc_init(void) · line 195
Quoted 9 lines · Hans de Goede
drivers/video/sunxi_display.c +4
-0@@ -177,7 +188,11 @@ sunxi_lcdc_init(void) (struct sunxi_lcdc_reg *)SUNXI_LCD0_BASE ;/* Reset off */ +#ifdef CONFIG_MACH_SUN6I +setbits_le32 (&ccm->ahb_reset1_cfg,1 <<AHB_RESET_OFFSET_LCD0 ); +#else setbits_le32 (&ccm->lcd0_ch0_clk_cfg,CCM_LCD_CH0_CTRL_RST ); +#endif
If you are sure it is correct to no longer frob the lcd clk for sun6i here (which seems a little odd, might be worth mentioning in the commit log if it is right) then:
Ian.
PATCH 5/6 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 | 66 +++++++++++++++++++++++++++++++ include/configs/sunxi-common.h | 8 ++++ 4 files changed, 89 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 +66 -0
75 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
@@ -219,6 +222,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 5/6 sunxi: video: Add simplefb support
On Fri, 14 Nov 2014 17:54:47 +0100
Hans de Goede <[email protected]> wrote:
...
Quoted 15 lines
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
include/configs/sunxi-common.h line 228
Quoted 7 lines
include/configs/sunxi-common.h +4
-0@@ -219,6 +222,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
defining CONFIG_OF_BOARD_SETUP should be independent of defining CONFIG_VIDEO or CONFIG_VIDEO_DT_SIMPLEFB. DT fixup by board setup code is often done i.e. for auto-detected memory size, adjusting different node properties or adding/deleting whole nodes. If someone defines CONFIG_OF_BOARD_SETUP for these purposes and also defines CONFIG_VIDEO_DT_SIMPLEFB, the "already defined" warnings will appear. This can be left as is for now, but should be addressed in the long term.
Thanks,
Anatolij
PATCH 5/6 sunxi: video: Add simplefb support
Hi,
Quoted 21 lines · Anatolij Gustschin
On Fri, 14 Nov 2014 17:54:47 +0100
Hans de Goede <[email protected]> wrote:
...Quoted 18 lines
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 @@ -219,6 +222,11 @@#define CONFIG_SYS_MEM_TOP_HIDE ((CONFIG_SUNXI_FB_SIZE + 0xFFF) & ~0xFFF)
Quoted 13 lines
include/configs/sunxi-common.h line 228
Quoted 4 lines
include/configs/sunxi-common.h +4
-0+/* To be able to hook simplefb into dt */ +#ifdef CONFIG_VIDEO_DT_SIMPLEFB +#define CONFIG_OF_BOARD_SETUP +#endif defining
CONFIG_OF_BOARD_SETUPshould be independent of definingCONFIG_VIDEOorCONFIG_VIDEO_DT_SIMPLEFB. DT fixup by board setup code is often done i.e. for auto-detected memory size, adjusting different node properties or adding/deleting whole nodes. If someone definesCONFIG_OF_BOARD_SETUPfor these purposes and also definesCONFIG_VIDEO_DT_SIMPLEFB, the "already defined" warnings will appear. This can be left as is for now, but should be addressed in the long term.
Currently the only thing we need CONFIG_OF_BOARD_SETUP for on sunxi is CONFIG_VIDEO_DT_SIMPLEFB, so for now this makes sense, but your 100% right that long term we probably want to do this differently.
Regards,
Hans
PATCH 5/6 sunxi: video: Add simplefb support
In reply to Hans de GoedeQuoted 5 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.
Link please, Linus's tree[0] doesn't seem to have it yet, I suppose it is in some maintainer tree at the moment? It's not even in linux-next yet though[1]. Maybe simple-framebuffer.txt isn't the right place to look?
[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txt
[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txt
drivers/video/sunxi_display.c video_hw_init(void) · line 430
Quoted 7 lines
drivers/video/sunxi_display.c +7
-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; +const char *node ="/chosen/framebuffer0-hdmi" ; +const char *format ="x8r8g8b8" ;
The bindings doc currently says:
- format: The format of the framebuffer surface. Valid values are:
- r5g6b5 (16-bit pixels, d[15:11]=r, d[10:5]=g, d[4:0]=b).
- a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r).
Perhaps x8r8g8b8 is defined in the updated version?
drivers/video/sunxi_display.c video_hw_init(void) · line 439
Quoted 9 lines
drivers/video/sunxi_display.c +9
-0+const char *okay ="okay" ; +char name[32 ]; +fdt32_t cells[2 ]; +int offset, stride, ret; + +if (!sunxi_display.enabled) +return ; + + offset =fdt_path_offset (blob, node);
I think you should use fdt_node_offset_by_compatible here instead of hardcoding a path. common/lcd.c does it this way too, it also doesn't appear to use a node under /chosen. Perhaps this is changed in the more uptodate binding which I've not seen yet.
drivers/video/sunxi_display.c video_hw_init(void) · line 452
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ cells[0 ] =cpu_to_fdt32 (gd->fb_base); + cells[1 ] =cpu_to_fdt32 (CONFIG_SUNXI_FB_SIZE ); + ret =fdt_setprop (blob, offset,"reg" , cells,sizeof (cells[0 ]) *2 );
What arranges that #address-cells and #size-cells are both 1 at this point? Does u-boot not have a helper to setup a cells array including looking those up?
Also the bindings doc seems to imply that size should be the actual configured size of the video ram region ("(1600 * 1200 * 2)") rather than the size of the reserved memory region. Maybe it's not important.
drivers/video/sunxi_display.c video_hw_init(void) · line 476
Quoted 5 lines
drivers/video/sunxi_display.c +5
-0+ ret =fdt_setprop (blob, offset,"format" , format,strlen (format) +1 ); +if (ret <0 ) + goto error; + + ret =fdt_setprop (blob, offset,"status" , okay,strlen (okay) +1 );
You can use fdt_setprop_string for these two, I think.
Ian.
PATCH 5/6 sunxi: video: Add simplefb support
Hi,
Quoted 11 lines · Ian Campbell
Quoted 5 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.
Link please, Linus's tree[0] doesn't seem to have it yet, I suppose it is in some maintainer tree at the moment? It's not even in linux-next yet though[1]. Maybe simple-framebuffer.txt isn't the right place to look?
Right now it is sitting here, which is the fbdev maintainers official tree:
https://git.kernel.org/cgit/linux/kernel/git/tomba/linux.git/log/?h=for-next
Quoted 14 lines
[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txt
[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txtdrivers/video/sunxi_display.c video_hw_init(void) · line 430
Quoted 7 lines
drivers/video/sunxi_display.c +7
-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; +const char *node ="/chosen/framebuffer0-hdmi" ; +const char *format ="x8r8g8b8" ;The bindings doc currently says:
Quoted 5 lines
- format: The format of the framebuffer surface. Valid values are:
- r5g6b5 (16-bit pixels, d[15:11]=r, d[10:5]=g, d[4:0]=b).
- a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r).Perhaps x8r8g8b8 is defined in the updated version?
Erm, no, I don't think anyone has actually bothered to keep the list in the binding up2date with what the kernel actually supports, x8r8g8b8 has been supported in the kernel before sunxi + simplefb every became a topic.
Quoted 13 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 439
Quoted 10 lines
drivers/video/sunxi_display.c +9
-0+const char *okay ="okay" ; +char name[32 ]; +fdt32_t cells[2 ]; +int offset, stride, ret; + +if (!sunxi_display.enabled) +return ; + + offset =fdt_path_offset (blob, node);I think you should use
fdt_node_offset_by_compatiblehere instead of hardcoding a path.
Hardcoding a path is deliberate. I don't know if you've read the previous u-boot code for this, but it did a lot of dt parsing to find clocks and add phandles to them, the way we eventually settled on when discussing this is for the dts to contain pre-populated simplefb nodes which u-boot just needs to fill with the mode info and enable, this way as we add support for more clocks (like the module clocks for the various display pipeline blocks), we don't need to update u-boot in lock-step, we just add the clocks to the simplefb node in the dts file when they get added to the dts file in the first place. See the updated bindings.
Quoted 3 lines
common/lcd.cdoes it this way too, it also doesn't
appear to use a node under /chosen. Perhaps this is changed in the more uptodate binding which I've not seen yet.
The use of /chosen is part of the updated bindings, which were discussed in length on various lists, and then eventually I spend 2 days online with Grant Likely in #devicetree to hash things out.
Quoted 6 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 452
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ cells[0 ] =cpu_to_fdt32 (gd->fb_base); + cells[1 ] =cpu_to_fdt32 (CONFIG_SUNXI_FB_SIZE ); + ret =fdt_setprop (blob, offset,"reg" , cells,sizeof (cells[0 ]) *2 );What arranges that #address-cells and #size-cells are both 1 at this point?
The pre-filled simplefb node.
Quoted 2 lines
Does u-boot not have a helper to setup a cells array including looking those up?
Good question.
/me looks
Doesn't look like it, what we've available basically is a bare libfdt, and it does not look like that can do this.
Quoted 3 lines
Also the bindings doc seems to imply that size should be the actual configured size of the video ram region ("(1600 * 1200 * 2)") rather than the size of the reserved memory region. Maybe it's not important.
Heh, it is not important really / does not matter either way.
I actually tried fixing the example, in the bindings but people found it more clear as it is.
Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 476
Quoted 6 lines
drivers/video/sunxi_display.c +5
-0+ ret =fdt_setprop (blob, offset,"format" , format,strlen (format) +1 ); +if (ret <0 ) + goto error; + + ret =fdt_setprop (blob, offset,"status" , okay,strlen (okay) +1 );You can use
fdt_setprop_stringfor these two, I think.
Yes, good one, will fix in my local tree.
Regards,
Hans
Re: [PATCH 5/6] sunxi: video: Add simplefb support
devicetree@, comments on the requirement that a node have a specific path welcomed.
Quoted 36 lines · Hans de Goede
Hi,
Quoted 11 lines · Ian Campbell
Quoted 5 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.
Link please, Linus's tree[0] doesn't seem to have it yet, I suppose it is in some maintainer tree at the moment? It's not even in linux-next yet though[1]. Maybe simple-framebuffer.txt isn't the right place to look?
Right now it is sitting here, which is the fbdev maintainers official tree:
https://git.kernel.org/cgit/linux/kernel/git/tomba/linux.git/log/?h=for-nextQuoted 18 lines
[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txt
[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txtdrivers/video/sunxi_display.c video_hw_init(void) · line 430
Quoted 7 lines
drivers/video/sunxi_display.c +7
-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; +const char *node ="/chosen/framebuffer0-hdmi" ; +const char *format ="x8r8g8b8" ;The bindings doc currently says:
- format: The format of the framebuffer surface. Valid values are:
- r5g6b5 (16-bit pixels, d[15:11]=r, d[10:5]=g, d[4:0]=b).
- a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r).
Quoted 5 lines
Quoted 1 line
Perhaps x8r8g8b8 is defined in the updated version?
Erm, no, I don't think anyone has actually bothered to keep the list in the binding up2date with what the kernel actually supports, x8r8g8b8 has been supported in the kernel before sunxi + simplefb every became a topic.
That's a shame, OS authors shouldn't really be expected to scrobble about in Linux source to figure out what a binding is.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/video/sunxi_display.c +4
-0+const char *okay ="okay" ; +char name[32 ]; +fdt32_t cells[2 ]; +int offset, stride, ret;Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 439
Quoted 5 lines
drivers/video/sunxi_display.c +5
-0+ +if (!sunxi_display.enabled) +return ; + + offset =fdt_path_offset (blob, node);I think you should use
fdt_node_offset_by_compatiblehere instead of hardcoding a path.
Quoted 9 lines
Hardcoding a path is deliberate. I don't know if you've read the previous u-boot code for this, but it did a lot of dt parsing to find clocks and add phandles to them, the way we eventually settled on when discussing this is for the dts to contain pre-populated simplefb nodes which u-boot just needs to fill with the mode info and enable, this way as we add support for more clocks (like the module clocks for the various display pipeline blocks), we don't need to update u-boot in lock-step, we just add the clocks to the simplefb node in the dts file when they get added to the dts file in the first place. See the updated bindings.
AFAICT this in no way invalidates what I suggested. There's no reason why the need to populate/tweak a pre-existing node should have anything to do with where the node is in the device-tree.
My suggestion literally amounts to:
- offset = fdt_path_offset(blob, node);
+ offset = fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");
Nothing else in the code changes. You can still add the required details to the prepopulated node, no matter where it lives.
I notice that v1 of these bindings was posted mid last week and were still being discussed (at v5) on Friday, where there was active discussion by DT maintainers (Grant, who hasn't yet acked it AFAICT). So why is this in the fb tree already?
It seems to me that this binding is not yet at the point where u-boot should be basing implementation on it. I'm sorry if this means this feature misses the current u-boot merge window, but there will be another soon. (didn't this one close on the 8th anyway?)
Quoted 8 lines
Quoted 3 lines
common/lcd.cdoes it this way too, it also doesn't
appear to use a node under /chosen. Perhaps this is changed in the more uptodate binding which I've not seen yet.The use of /chosen is part of the updated bindings, which were discussed in length on various lists, and then eventually I spend 2 days online with Grant Likely in #devicetree to hash things out.
Quoted 8 lines
Quoted 6 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 452
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ cells[0 ] =cpu_to_fdt32 (gd->fb_base); + cells[1 ] =cpu_to_fdt32 (CONFIG_SUNXI_FB_SIZE ); + ret =fdt_setprop (blob, offset,"reg" , cells,sizeof (cells[0 ]) *2 );What arranges that #address-cells and #size-cells are both 1 at this point?
The pre-filled simplefb node.
I think you should use fdt_address_cells and fdt_size_cells to ensure that it really is the case that they are as you expect. Or even better use them to just DTRT regardless of what the pre-filled node's parent says.
I'm not really happy with the implication that the DT has to be the exact one provided in the Linux source tree, and with the level of coupling which is implied by this patch.
I should be able to write my own DT for a device so long as it follows the bindings. e.g. if *BSD supports a board (they often seem to have their own DT files) then I should be able to boot that from u-boot too, so long as all three follow the bindings.
If the u-boot code is going to put additional constraints on things over and above the bindings (e.g. requiring that node to be under a particular #{address/size}-cells regimen and IMHO the specific path comes under this too despite what recent bindings updates attempt to say) then that needs to be clearly documented somewhere, and even that would make me slightly sad given how easy it would be to just make it work following the bindings in the normal way.
Ian.
Re: [PATCH 5/6] sunxi: video: Add simplefb support
Hi,
Quoted 72 lines · Ian Campbell
devicetree@, comments on the requirement that a node have a specific path welcomed.
Quoted 36 lines · Hans de Goede
Hi,
Quoted 11 lines · Ian Campbell
Quoted 5 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.
Link please, Linus's tree[0] doesn't seem to have it yet, I suppose it is in some maintainer tree at the moment? It's not even in linux-next yet though[1]. Maybe simple-framebuffer.txt isn't the right place to look?
Right now it is sitting here, which is the fbdev maintainers official tree:
https://git.kernel.org/cgit/linux/kernel/git/tomba/linux.git/log/?h=for-nextQuoted 18 lines
[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txt
[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txtdrivers/video/sunxi_display.c video_hw_init(void) · line 430
Quoted 7 lines
drivers/video/sunxi_display.c +7
-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; +const char *node ="/chosen/framebuffer0-hdmi" ; +const char *format ="x8r8g8b8" ;The bindings doc currently says:
- format: The format of the framebuffer surface. Valid values are:
- r5g6b5 (16-bit pixels, d[15:11]=r, d[10:5]=g, d[4:0]=b).
- a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r).Quoted 5 lines
Quoted 1 line
Perhaps x8r8g8b8 is defined in the updated version?
Erm, no, I don't think anyone has actually bothered to keep the list in the binding up2date with what the kernel actually supports, x8r8g8b8 has been supported in the kernel before sunxi + simplefb every became a topic.
That's a shame, OS authors shouldn't really be expected to scrobble about in Linux source to figure out what a binding is.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/video/sunxi_display.c +4
-0+const char *okay ="okay" ; +char name[32 ]; +fdt32_t cells[2 ]; +int offset, stride, ret;Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 439
Quoted 5 lines
drivers/video/sunxi_display.c +5
-0+ +if (!sunxi_display.enabled) +return ; + + offset =fdt_path_offset (blob, node);I think you should use
fdt_node_offset_by_compatiblehere instead of hardcoding a path.Quoted 9 lines
Hardcoding a path is deliberate. I don't know if you've read the previous u-boot code for this, but it did a lot of dt parsing to find clocks and add phandles to them, the way we eventually settled on when discussing this is for the dts to contain pre-populated simplefb nodes which u-boot just needs to fill with the mode info and enable, this way as we add support for more clocks (like the module clocks for the various display pipeline blocks), we don't need to update u-boot in lock-step, we just add the clocks to the simplefb node in the dts file when they get added to the dts file in the first place. See the updated bindings.
Quoted 3 lines
AFAICT this in no way invalidates what I suggested. There's no reason why the need to populate/tweak a pre-existing node should have anything to do with where the node is in the device-tree.
Right, I forgot to add one important bit to my explanation, sorry, if you look at the binding then it says that the name should be suffixed with the output type, so currently the sunxi u-boot code will look for /chosen/framebuffer0-hdmi. Which will e.g. also happen on any A10 based tablets which typically have both hdmi out and an lcd screen, in the future I hope we will also get lcd support in u-boot, and then logically on tablets the lcd screen would take precedence, so then unless overriden through some config mechanism u-boot will chose to use the lcd, and will look for /chosen/framebuffer0-lcd which has a different set of clocks then /chosen/framebuffer0-hdmi.
Quoted 7 lines
My suggestion literally amounts to:
- offset =fdt_path_offset(blob, node);
+ offset =fdt_node_offset_by_compatible(blob, -1, "simple-framebuffer");Nothing else in the code changes. You can still add the required details to the prepopulated node, no matter where it lives.
See above, we need to pick the right pre-populated node for the output type, this esp. becomes important on boxes like the mele a1000 and friends where there are 3 outputs to divide over 2 display pipelines (so we can only lit up 2 of the outputs).
Quoted 4 lines
I notice that v1 of these bindings was posted mid last week and were still being discussed (at v5) on Friday, where there was active discussion by DT maintainers (Grant, who hasn't yet acked it AFAICT). So why is this in the fb tree already?
Grant only had some minor tweaks for v4, so Tomi has merged it based on that, with a request to do any fixups as follow up patches.
As for the timeline, even though some of the new binding stuff was only finalized last week, the whole discussion about this has been going one for months.
Quoted 4 lines
It seems to me that this binding is not yet at the point where u-boot should be basing implementation on it. I'm sorry if this means this feature misses the current u-boot merge window, but there will be another soon. (didn't this one close on the 8th anyway?)
The devicetree bindings have been going on for so long, that this would be the 2nd merge window this feature misses, Luc's original version was posted before the v2014.10 merge window.
AFAIK Grant agrees with v5 as merged by Timo, and it would be really nice to move forward with this rather then to start yet another round of never ending discussions on this.
Quoted 15 lines
Quoted 15 lines
Quoted 3 lines
common/lcd.cdoes it this way too, it also doesn't
appear to use a node under /chosen. Perhaps this is changed in the more uptodate binding which I've not seen yet.The use of /chosen is part of the updated bindings, which were discussed in length on various lists, and then eventually I spend 2 days online with Grant Likely in #devicetree to hash things out.
Quoted 6 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 452
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ cells[0 ] =cpu_to_fdt32 (gd->fb_base); + cells[1 ] =cpu_to_fdt32 (CONFIG_SUNXI_FB_SIZE ); + ret =fdt_setprop (blob, offset,"reg" , cells,sizeof (cells[0 ]) *2 );What arranges that #address-cells and #size-cells are both 1 at this point?
Quoted 6 lines
Quoted 1 line
The pre-filled simplefb node.
I think you should use
fdt_address_cellsandfdt_size_cellsto ensure that it really is the case that they are as you expect. Or even better use them to just DTRT regardless of what the pre-filled node's parent says.
Verifying things to be as expected seem sensible, DTRT regardless seems impossible, since u-boot will have no idea what needs to be in there if either size-cells or address-cells != 1.
Quoted 3 lines
I'm not really happy with the implication that the DT has to be the exact one provided in the Linux source tree, and with the level of coupling which is implied by this patch.
Some level of coupling is always needed that is what the bindings docs are for. Specifying how the bindings should look like from a firmware pov is no different then specifying how they should look like from an os pov.
Quoted 4 lines
I should be able to write my own DT for a device so long as it follows the bindings. e.g. if *BSD supports a board (they often seem to have their own DT files) then I should be able to boot that from u-boot too, so long as all three follow the bindings.
Ack, and I don't see how what we're doing here breaks that.
Quoted 3 lines
If the u-boot code is going to put additional constraints on things over and above the bindings (e.g. requiring that node to be under a particular #{address/size}-cells regimen
Bindings always specify a particular address / size cells regimen, otherwise it is not well defined how to interpret them. If there are extra address / size fields those need to have a defined meaning, so an #{address/size}-cells regimen is always implied by the bindings.
In this case the address / size cells comes from how we specify any memory address on sunxi which is 1 / 1.
Quoted 5 lines
and IMHO the specific path
comes under this too despite what recent bindings updates attempt to say) then that needs to be clearly documented somewhere, and even that would make me slightly sad given how easy it would be to just make it work following the bindings in the normal way.
The path requirement comes from 2 things:
1) u-boot needs to be able to find which node belongs to which display pipeline
2) u-boot needs to be able to find the right node for the output chosen, were there may be multiple output options u-boot can chose for a single display pipeline
So just searching for the node by compatible will not work.
Regards,
Hans
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH 5/6] sunxi: video: Add simplefb support
Quoted 79 lines · Hans de Goede
Hi,
Quoted 72 lines · Ian Campbell
devicetree@, comments on the requirement that a node have a specific path welcomed.
Quoted 36 lines · Hans de Goede
Hi,
Quoted 11 lines · Ian Campbell
Quoted 5 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.
Link please, Linus's tree[0] doesn't seem to have it yet, I suppose it is in some maintainer tree at the moment? It's not even in linux-next yet though[1]. Maybe simple-framebuffer.txt isn't the right place to look?
Right now it is sitting here, which is the fbdev maintainers official tree:
https://git.kernel.org/cgit/linux/kernel/git/tomba/linux.git/log/?h=for-nextQuoted 18 lines
[0] https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txt
[1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/Documentation/devicetree/bindings/video/simple-framebuffer.txtdrivers/video/sunxi_display.c video_hw_init(void) · line 430
Quoted 7 lines
drivers/video/sunxi_display.c +7
-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; +const char *node ="/chosen/framebuffer0-hdmi" ; +const char *format ="x8r8g8b8" ;The bindings doc currently says:
- format: The format of the framebuffer surface. Valid values are:
- r5g6b5 (16-bit pixels, d[15:11]=r, d[10:5]=g, d[4:0]=b).
- a8b8g8r8 (32-bit pixels, d[31:24]=a, d[23:16]=b, d[15:8]=g, d[7:0]=r).Quoted 5 lines
Quoted 1 line
Perhaps x8r8g8b8 is defined in the updated version?
Erm, no, I don't think anyone has actually bothered to keep the list in the binding up2date with what the kernel actually supports, x8r8g8b8 has been supported in the kernel before sunxi + simplefb every became a topic.
That's a shame, OS authors shouldn't really be expected to scrobble about in Linux source to figure out what a binding is.
Quoted 13 lines
Quoted 4 lines
Quoted 4 lines
drivers/video/sunxi_display.c +4
-0+const char *okay ="okay" ; +char name[32 ]; +fdt32_t cells[2 ]; +int offset, stride, ret;Quoted 8 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 439
Quoted 5 lines
drivers/video/sunxi_display.c +5
-0+ +if (!sunxi_display.enabled) +return ; + + offset =fdt_path_offset (blob, node);I think you should use
fdt_node_offset_by_compatiblehere instead of hardcoding a path.Quoted 9 lines
Hardcoding a path is deliberate. I don't know if you've read the previous u-boot code for this, but it did a lot of dt parsing to find clocks and add phandles to them, the way we eventually settled on when discussing this is for the dts to contain pre-populated simplefb nodes which u-boot just needs to fill with the mode info and enable, this way as we add support for more clocks (like the module clocks for the various display pipeline blocks), we don't need to update u-boot in lock-step, we just add the clocks to the simplefb node in the dts file when they get added to the dts file in the first place. See the updated bindings.
Quoted 3 lines
AFAICT this in no way invalidates what I suggested. There's no reason why the need to populate/tweak a pre-existing node should have anything to do with where the node is in the device-tree.
Quoted 10 lines
Right, I forgot to add one important bit to my explanation, sorry, if you look at the binding then it says that the name should be suffixed with the output type, so currently the sunxi u-boot code will look for /chosen/framebuffer0-hdmi. Which will e.g. also happen on any A10 based tablets which typically have both hdmi out and an lcd screen, in the future I hope we will also get lcd support in u-boot, and then logically on tablets the lcd screen would take precedence, so then unless overriden through some config mechanism u-boot will chose to use the lcd, and will look for /chosen/framebuffer0-lcd which has a different set of clocks then /chosen/framebuffer0-hdmi.
This sounds like a use for:
compatible = "simple-framebuffer,hdmi", "simple-framebuffer"
or some such, that's almost exactly what multiople compatible strings are for. Relying on specific naming and/or path is rather unconventional.
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 3 lines
common/lcd.cdoes it this way too, it also doesn't
appear to use a node under /chosen. Perhaps this is changed in the more uptodate binding which I've not seen yet.The use of /chosen is part of the updated bindings, which were discussed in length on various lists, and then eventually I spend 2 days online with Grant Likely in #devicetree to hash things out.
Quoted 6 lines
drivers/video/sunxi_display.c video_hw_init(void) · line 452
Quoted 3 lines
drivers/video/sunxi_display.c +3
-0+ cells[0 ] =cpu_to_fdt32 (gd->fb_base); + cells[1 ] =cpu_to_fdt32 (CONFIG_SUNXI_FB_SIZE ); + ret =fdt_setprop (blob, offset,"reg" , cells,sizeof (cells[0 ]) *2 );What arranges that #address-cells and #size-cells are both 1 at this point?
The pre-filled simplefb node.
Quoted 8 lines
Quoted 4 lines
I think you should use
fdt_address_cellsandfdt_size_cellsto ensure that it really is the case that they are as you expect. Or even better use them to just DTRT regardless of what the pre-filled node's parent says.Verifying things to be as expected seem sensible, DTRT regardless seems impossible, since u-boot will have no idea what needs to be in there if either size-cells or address-cells != 1.
I think you have misunderstood what #size-cells / #address-cells are. They tell you the number of cells which each address/size entry uses, they do not tell you anything about the number of address/size combinations in the reg property (i.e. the number of registers, which is indeed a property of the binding).
IOW for a single region at 0xabcdef12 size 0x00003456 then:
#address-cells=1,#size-cells=1 => regs = <0xabcdef12 0x00003456> #address-cells=2,#size-cells=1 => regs = <0 0xabcdef12 0x00003456> #address-cells=1,#size-cells=2 => regs = <0xabcdef12 0 0x00003456> #address-cells=2,#size-cells=1 => regs = <0 0xabcdef12 0 0x00003456>
The difference is between between storing the number as a u32 or a u64 (encoded as two cells), it doesn't change the meaning of anything.
Quoted 7 lines
Quoted 3 lines
I'm not really happy with the implication that the DT has to be the exact one provided in the Linux source tree, and with the level of coupling which is implied by this patch.
Some level of coupling is always needed that is what the bindings docs are for. Specifying how the bindings should look like from a firmware pov is no different then specifying how they should look like from an os pov.
This code is making assumptions over and above the bindings, and the bindings themselves do not seem to be fully agreed upon yet (and contain some unconventional constructs).
Quoted 3 lines
The devicetree bindings have been going on for so long, that this would be the 2nd merge window this feature misses, Luc's original version was posted before the v2014.10 merge window.
I'm afraid I don't agree that just because it has taken a long time to get something right we should commit to it before it is ready, especially when it is an ABI, which is what a DT binding is.
If this scheme was acked by a DT maintainer then I'd be fine with it, but so far it hasn't been, at least not publicly in the threads I've looked at.
Quoted 1 line
AFAIK Grant agrees with v5
AFAIK Grant hasn't actually said that. If he does ack it (or if someone points me to the correct mail) then I have no further objections.
Quoted 6 lines
Quoted 4 lines
I should be able to write my own DT for a device so long as it follows the bindings. e.g. if *BSD supports a board (they often seem to have their own DT files) then I should be able to boot that from u-boot too, so long as all three follow the bindings.
Ack, and I don't see how what we're doing here breaks that.
An author would need to know this out of band requirement that #*-cells are required to be 1, which is an unusual requirement to start with.
Quoted 6 lines
Quoted 3 lines
If the u-boot code is going to put additional constraints on things over and above the bindings (e.g. requiring that node to be under a particular #{address/size}-cells regimen
Bindings always specify a particular address / size cells regimen, otherwise it is not well defined how to interpret them.
No so. Almost no bindings specify these, they are a common device-tree concept and for a given node are defined by that node's parent (or grandparent, etc), not by the node's bindings. This is all part of the way buses are represented in DT.
In fact it's a bit odd to have a reg property under /chosen at all, since it doesn't really fit in with the bus structure. I've done something similar in some bindings I've authored[0], but AIUI I got that wrong and really should have used a set of non-reg properties with a single value so there was no need to parse using #*-cells (cf the initrd-start + initrd-end properties under /chosen). Sadly DT is an ABI, so for my bindings I'm kind of stuck with it for the foreseeable future.
Quoted 6 lines
If there are extra address /
size fields those need to have a defined meaning, so an #{address/size}-cells regimen is always implied by the bindings.In this case the address / size cells comes from how we specify any memory address on sunxi which is 1 / 1.
That just happens to be what the dt's in the Linux source have written into them, there is nothing fundamental which requires this and you could perfectly validly author a sunxi DT which uses 2/2 or 2/1 etc.
Quoted 6 lines
Quoted 5 lines
and IMHO the specific path
comes under this too despite what recent bindings updates attempt to say) then that needs to be clearly documented somewhere, and even that would make me slightly sad given how easy it would be to just make it work following the bindings in the normal way.
Quoted 8 lines
The path requirement comes from 2 things:
1) u-boot needs to be able to find which node belongs to which display pipeline
2) u-boot needs to be able to find the right node for the output chosen, were there may be multiple output options u-boot can chose for a single display pipelineSo just searching for the node by compatible will not work.
It would work if you used compatible how it was intended to be used.
Ian.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1416154297.25454.24.camel-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org
Re: [U-Boot] [PATCH 5/6] sunxi: video: Add simplefb support
Quoted 6 lines · Ian Campbell
Quoted 2 lines
AFAIK Grant agrees with v5
AFAIK Grant hasn't actually said that. If he does ack it (or if someone
points me to the correct mail) then I have no further objections.
I finally found <CACxGe6ssdeOnQnem1012h_jFK1wWOD_WwosjFgiAcgBoqyDt9A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> which for some reason isn't in my devicetree@ folder nor in any of the archives online I looked at earlier (I could only find it by message-id
now I know it), but it was in my sunxi folder.
So with Grant and Rob having accepted them you can consider my concerns with the bindings alleviated.
Ian.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] sunxi: video: Add simplefb support
Hi,
Quoted 8 lines · Ian Campbell
Quoted 6 lines · Ian Campbell
Quoted 2 lines
AFAIK Grant agrees with v5
AFAIK Grant hasn't actually said that. If he does ack it (or if someone
points me to the correct mail) then I have no further objections.
Quoted 8 lines
I finally found <CACxGe6ssdeOnQnem1012h_jFK1wWOD_WwosjFgiAcgBoqyDt9A@mail.gmail.com> which for some reason isn't in my devicetree@ folder nor in any of the archives online I looked at earlier (I could only find it by message-id now I know it), but it was in my sunxi folder.
So with Grant and Rob having accepted them you can consider my concerns with the bindings alleviated.
Thanks! I was about to reply to your earlier mail with lets wait for Grant to get online, and see what he has to say, but this works too.
And thanks for explaining the address and size cells thing better, I did know that for address and size #cells determines u32 vs u64, I'm used to gpio-s / clock-s where extra cells are an extra parameter, hence my confusion.
I'll do a v3 of the simplefb patch which takes the address and size #cells into account.
Regards,
Hans
Re: [U-Boot] [PATCH 5/6] sunxi: video: Add simplefb support
In reply to a message not in the archiveQuoted 28 lines · Ian Campbell
Quoted 16 lines · Hans de Goede
Quoted 11 lines · Ian Campbell
Quoted 9 lines · Hans de Goede
Hardcoding a path is deliberate. I don't know if you've read the previous u-boot code for this, but it did a lot of dt parsing to find clocks and add phandles to them, the way we eventually settled on when discussing this is for the dts to contain pre-populated simplefb nodes which u-boot just needs to fill with the mode info and enable, this way as we add support for more clocks (like the module clocks for the various display pipeline blocks), we don't need to update u-boot in lock-step, we just add the clocks to the simplefb node in the dts file when they get added to the dts file in the first place. See the updated bindings.
Quoted 3 lines
AFAICT this in no way invalidates what I suggested. There's no reason why the need to populate/tweak a pre-existing node should have anything to do with where the node is in the device-tree.
Quoted 10 lines
Right, I forgot to add one important bit to my explanation, sorry, if you look at the binding then it says that the name should be suffixed with the output type, so currently the sunxi u-boot code will look for /chosen/framebuffer0-hdmi. Which will e.g. also happen on any A10 based tablets which typically have both hdmi out and an lcd screen, in the future I hope we will also get lcd support in u-boot, and then logically on tablets the lcd screen would take precedence, so then unless overriden through some config mechanism u-boot will chose to use the lcd, and will look for /chosen/framebuffer0-lcd which has a different set of clocks then /chosen/framebuffer0-hdmi.
Quoted 5 lines
This sounds like a use for:
compatible = "simple-framebuffer,hdmi", "simple-framebuffer"
or some such, that's almost exactly what multiople compatible strings are for. Relying on specific naming and/or path is rather unconventional.
Indeed, for a long time now finding nodes by path has been strongly discouraged. It makes it hard to move nodes around when needed. I'm not going to make a big deal about it because it doesn't affect the OS interface, but Ian's suggestion is sane. simple-framebuffer is enough to identify the binding, but you can use additional strings to identify the specific hardware interface that U-Boot can use to locate the node. ie. sunxi,framebuffer-hdml or some such. You can never be sure when someone will produce a board that messes with your naming assumptions. What if is suddenly needs to be named "framebuffer1-hdmi" because they added and FPGA that they want as framebuffer0? (Yes, I'm making stuff up, but I have to think about the corner cases)
Quoted 11 lines
Quoted 3 lines
The devicetree bindings have been going on for so long, that this would be the 2nd merge window this feature misses, Luc's original version was posted before the v2014.10 merge window.
I'm afraid I don't agree that just because it has taken a long time to get something right we should commit to it before it is ready, especially when it is an ABI, which is what a DT binding is.
If this scheme was acked by a DT maintainer then I'd be fine with it, but so far it hasn't been, at least not publicly in the threads I've looked at.
I /DO/ want comments though. Putting the node in /chosen is unconventional. I want to hear if anyone has a good reason why the framebuffers shouldn't be placed into /chosen.
Quoted 4 lines
Quoted 1 line
AFAIK Grant agrees with v5
AFAIK Grant hasn't actually said that. If he does ack it (or if someone points me to the correct mail) then I have no further objections.
My word also isn't gospel. On controversial stuff I want to have consensus. For the clock patches and had a long conversation with Rob to make sure we were both in agreement before giving my final ack.
Quoted 10 lines
In fact it's a bit odd to have a reg property under /chosen at all, since it doesn't really fit in with the bus structure. I've done something similar in some bindings I've authored[0], but AIUI I got that wrong and really should have used a set of non-reg properties with a single value so there was no need to parse using #*-cells (cf the initrd-start + initrd-end properties under /chosen). Sadly DT is an ABI, so for my bindings I'm kind of stuck with it for the foreseeable future.
Ironic isn't it that I though of that as precedence when I suggested /chosen! :-)
I actually don't have a problem with it. We do need a way to specify runtime memory usage, and /chosen is as good a place as any, particularly when it represents things that won't necessarily be relevant on kexec or dom0 boot.
The other options are under either the /memory or the /reserved-memory tree. Rob and I talked about /reserved-memory quite a lot. We could put all the framebuffer details into the memory node that reserves the framebuffer. However, I don't like that idea because it kind of makes assumptions about how the framebuffer will be located inside the memory region and doesn't allow for multiple framebuffers within a single region.
g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 5/6] sunxi: video: Add simplefb support
Hi,
Quoted 2 lines · Grant Likely
Quoted 1 line · Ian Campbell
On Sun, 2014-11-16 at 16:11 +0100, Hans de Goede wrote:
<snip>
Quoted 17 lines
Quoted 11 lines
Quoted 10 lines
Right, I forgot to add one important bit to my explanation, sorry, if you look at the binding then it says that the name should be suffixed with the output type, so currently the sunxi u-boot code will look for /chosen/framebuffer0-hdmi. Which will e.g. also happen on any A10 based tablets which typically have both hdmi out and an lcd screen, in the future I hope we will also get lcd support in u-boot, and then logically on tablets the lcd screen would take precedence, so then unless overriden through some config mechanism u-boot will chose to use the lcd, and will look for /chosen/framebuffer0-lcd which has a different set of clocks then /chosen/framebuffer0-hdmi.
Quoted 5 lines
This sounds like a use for:
compatible = "simple-framebuffer,hdmi", "simple-framebuffer"
or some such, that's almost exactly what multiople compatible strings are for. Relying on specific naming and/or path is rather unconventional.
Quoted 11 lines
Indeed, for a long time now finding nodes by path has been strongly discouraged. It makes it hard to move nodes around when needed. I'm not going to make a big deal about it because it doesn't affect the OS interface, but Ian's suggestion is sane. simple-framebuffer is enough to identify the binding, but you can use additional strings to identify the specific hardware interface that U-Boot can use to locate the node. ie. sunxi,framebuffer-hdml or some such. You can never be sure when someone will produce a board that messes with your naming assumptions. What if is suddenly needs to be named "framebuffer1-hdmi" because they added and FPGA that they want as framebuffer0? (Yes, I'm making stuff up, but I have to think about the corner cases)
I like the suggestion of using a compatible of : "sunxi,framebuffer-hdmi" although it will need to be : "sunxi,framebuffer0-hdmi" as u-boot needs to know which simplefb node to use for which display pipeline (so that the node has the right clocks and whats not).
And I think it makes sense to put simple in there as it is a pre-populated simplefb node , so then we get:
"sunxi,simple-framebuffer0-hdmi"
And we can drop the unconventional lookup by path.
I'll go on irc now, and join #devicetree, Ian, maybe you can join us there to and we can hash out something we can all agree on ?
And then I'll do yet another set of patches (to apply on top on the kernel side, and a new version of the u-boot patch), and we'll hopefully end up with something which makes us all happy
<snip>
Quoted 19 lines
Quoted 10 lines
In fact it's a bit odd to have a reg property under /chosen at all, since it doesn't really fit in with the bus structure. I've done something similar in some bindings I've authored[0], but AIUI I got that wrong and really should have used a set of non-reg properties with a single value so there was no need to parse using #*-cells (cf the initrd-start + initrd-end properties under /chosen). Sadly DT is an ABI, so for my bindings I'm kind of stuck with it for the foreseeable future.
Ironic isn't it that I though of that as precedence when I suggested /chosen! :-)
I actually don't have a problem with it. We do need a way to specify runtime memory usage, and /chosen is as good a place as any, particularly when it represents things that won't necessarily be relevant on kexec or dom0 boot.
Quoted 7 lines
The other options are under either the /memory or the /reserved-memory tree. Rob and I talked about /reserved-memory quite a lot. We could put all the framebuffer details into the memory node that reserves the framebuffer. However, I don't like that idea because it kind of makes assumptions about how the framebuffer will be located inside the memory region and doesn't allow for multiple framebuffers within a single region.
I'm not a devicetree expert, but /chosen already came to my mind even before Grant suggested it, /chosen seems the right place for this to me.
Note that once we drop the path based lookup the location can always be changed later (to some degree, it still needs to be in a place where the kernel will bind to it).
Regards,
Hans
Re: [PATCH 5/6] sunxi: video: Add simplefb support
In reply to Grant LikelyQuoted 3 lines · Grant Likely
I /DO/ want comments though. Putting the node in /chosen is unconventional. I want to hear if anyone has a good reason why the framebuffers shouldn't be placed into /chosen.
I don't think putting it under /chosen is a problem at all. THe semantics of some of hte convention properties are a bit odd under there, but that's not insurmountable.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
AFAIK Grant agrees with v5
AFAIK Grant hasn't actually said that. If he does ack it (or if someone points me to the correct mail) then I have no further objections.
My word also isn't gospel.
I suppose I should have said something like "I trust Grant's judgement more than my own on things relating to DT" ;-).
Quoted 12 lines
On controversial stuff I want to have
consensus. For the clock patches and had a long conversation with Rob to make sure we were both in agreement before giving my final ack.Quoted 8 lines
In fact it's a bit odd to have a reg property under /chosen at all, since it doesn't really fit in with the bus structure. I've done something similar in some bindings I've authored[0], but AIUI I got that wrong and really should have used a set of non-reg properties with a single value so there was no need to parse using #*-cells (cf the initrd-start + initrd-end properties under /chosen). Sadly DT is an ABI, so for my bindings I'm kind of stuck with it for the foreseeable future.
Quoted 5 lines
Quoted 2 lines
Ironic isn't it that I though of that as precedence when I suggested /chosen! :-)
:-)
Quoted 4 lines
I actually don't have a problem with it. We do need a way to specify runtime memory usage, and /chosen is as good a place as any, particularly when it represents things that won't necessarily be relevant on kexec or dom0 boot.
The main issue which was explained to me with my Xen bindings was that reg = <> isn't all that meaningful under /chosen because it doesn't fit into the bus structure, so the #address-/size-cells stuff gets a bit strange. It's probably tolerable for things which are strictly physical RAM addresses (as opposed to mmio) since RAM isn't typically behind a visible bus.
The scheme used for initrds sidesteps all those issues by using separate (multicellular) properties for the start and end regions and not using reg=<> and therefore naturally breaking the expected semantic link with bus topology which reg implies etc.
Quoted 7 lines
The other options are under either the /memory or the /reserved-memory tree. Rob and I talked about /reserved-memory quite a lot. We could put all the framebuffer details into the memory node that reserves the framebuffer. However, I don't like that idea because it kind of makes assumptions about how the framebuffer will be located inside the memory region and doesn't allow for multiple framebuffers within a single region.
Yes, that sounds strictly worse than the current solution to me.
Ian.
A message that is not in the archive (sent off-list or not yet received): 1416219254.27385.15.camel-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org
Re: [U-Boot] [PATCH 5/6] sunxi: video: Add simplefb support
Quoted 51 lines · Ian Campbell
Quoted 3 lines · Grant Likely
I /DO/ want comments though. Putting the node in /chosen is unconventional. I want to hear if anyone has a good reason why the framebuffers shouldn't be placed into /chosen.
I don't think putting it under /chosen is a problem at all. THe semantics of some of hte convention properties are a bit odd under there, but that's not insurmountable.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
AFAIK Grant agrees with v5
AFAIK Grant hasn't actually said that. If he does ack it (or if someone points me to the correct mail) then I have no further objections.
My word also isn't gospel.
I suppose I should have said something like "I trust Grant's judgement more than my own on things relating to DT" ;-).
Quoted 12 lines
On controversial stuff I want to have
consensus. For the clock patches and had a long conversation with Rob to make sure we were both in agreement before giving my final ack.Quoted 8 lines
In fact it's a bit odd to have a reg property under /chosen at all, since it doesn't really fit in with the bus structure. I've done something similar in some bindings I've authored[0], but AIUI I got that wrong and really should have used a set of non-reg properties with a single value so there was no need to parse using #*-cells (cf the initrd-start + initrd-end properties under /chosen). Sadly DT is an ABI, so for my bindings I'm kind of stuck with it for the foreseeable future.
Quoted 5 lines
Quoted 2 lines
Ironic isn't it that I though of that as precedence when I suggested /chosen! :-)
:-)
Quoted 4 lines
I actually don't have a problem with it. We do need a way to specify runtime memory usage, and /chosen is as good a place as any, particularly when it represents things that won't necessarily be relevant on kexec or dom0 boot.
The main issue which was explained to me with my Xen bindings was that reg = <> isn't all that meaningful under /chosen because it doesn't fit into the bus structure, so the #address-/size-cells stuff gets a bit strange. It's probably tolerable for things which are strictly physical RAM addresses (as opposed to mmio) since RAM isn't typically behind a visible bus.
Quoted 4 lines
The scheme used for initrds sidesteps all those issues by using separate (multicellular) properties for the start and end regions and not using reg=<> and therefore naturally breaking the expected semantic link with bus topology which reg implies etc.
I quite dislike the initrd multi-property approach. It has to be parsed in a completely separate way.
Quoted 9 lines
Quoted 7 lines
The other options are under either the /memory or the /reserved-memory tree. Rob and I talked about /reserved-memory quite a lot. We could put all the framebuffer details into the memory node that reserves the framebuffer. However, I don't like that idea because it kind of makes assumptions about how the framebuffer will be located inside the memory region and doesn't allow for multiple framebuffers within a single region.
Yes, that sounds strictly worse than the current solution to me.
Besides, the simple-framebuffer binding could easily be extended to allow a reserved-memory reference instead of a reg property if/when that becomes a better option for a specific platform.
g.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 6/6 sunxi: Add usb keyboard Kconfig option
In reply to Hans de GoedeFor use together with the hdmi console.
--- board/sunxi/Kconfig | 7 +++++++ configs/Ippo_q8h_v5_defconfig | 1 + include/configs/sunxi-common.h | 25 +++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-)
board/sunxi/Kconfig +7 -0
@@ -223,4 +223,11 @@ config VIDEO Say Y here to add support for using a cfb console on the HDMI output found on most sunxi devices. +config USB_KEYBOARD + boolean "Enable USB keyboard support" + default y + ---help--- + Say Y here to add support for using a USB keyboard (typically used + in combination with a graphical console on HDMI). + endif
configs/Ippo_q8h_v5_defconfig +1 -0
@@ -5,3 +5,4 @@ CONFIG_MACH_SUN8I=y CONFIG_TARGET_IPPO_Q8H_V5=y CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" CONFIG_VIDEO=n +CONFIG_USB_KEYBOARD=n
include/configs/sunxi-common.h +21 -4
@@ -249,6 +249,12 @@#define CONFIG_USB_STORAGE #endif +#ifdef CONFIG_USB_KEYBOARD +#define CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE +#define CONFIG_PREBOOT +#define CONFIG_SYS_STDIO_DEREGISTER +#endif + #if !defined CONFIG_ENV_IS_IN_MMC && \ !defined CONFIG_ENV_IS_IN_NAND && \ !defined CONFIG_ENV_IS_IN_FAT && \
@@ -298,17 +304,28 @@#include <config_distro_bootcmd.h> +#ifdef CONFIG_USB_KEYBOARD +#define CONSOLE_IN_SETTINGS \ + "preboot=usb start\0" \ + "stdin=serial,usbkbd\0" +#else +#define CONSOLE_IN_SETTINGS \ + "stdin=serial\0" +#endif +#ifdef CONFIG_VIDEO -#define CONSOLE_ENV_SETTINGS \ - "stdin=serial\0" \ +#define CONSOLE_OUT_SETTINGS \ "stdout=serial,vga\0" \ "stderr=serial,vga\0"#else -#define CONSOLE_ENV_SETTINGS +#define CONSOLE_OUT_SETTINGS \ + "stdout=serial\0" \ + "stderr=serial\0"#endif #define CONFIG_EXTRA_ENV_SETTINGS \ - CONSOLE_ENV_SETTINGS \ + CONSOLE_IN_SETTINGS \ + CONSOLE_OUT_SETTINGS \ MEM_LAYOUT_ENV_SETTINGS \ "fdtfile=" CONFIG_FDTFILE "\0" \ "console=ttyS0,115200\0" \
Signature · 1 line
2.1.0
PATCH 6/6 sunxi: Add usb keyboard Kconfig option
Quoted 14 lines · Hans de Goede
For use together with the hdmi console.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 7 +++++++ configs/Ippo_q8h_v5_defconfig | 1 + include/configs/sunxi-common.h | 25 +++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-)board/sunxi/Kconfig +0
-0
board/sunxi/Kconfig config VIDEO · line 226
Quoted 4 lines
board/sunxi/Kconfig +1
-0@@ -223,4 +223,11 @@ config VIDEO Say Y here to add support for using a cfb console on the HDMI output found on most sunxi devices. +config USB_KEYBOARD
This seems like it ought to be under drivers/ somewhere, either drivers/usb/Kconfig or drivers/input/Kconfig perhaps.
Quoted 12 lines
board/sunxi/Kconfig +6
-0+ boolean "Enable USB keyboard support" + default y + ---help--- + Say Y here to add support for using a USB keyboard (typically used + in combination with a graphical console on HDMI). + endifconfigs/Ippo_q8h_v5_defconfig +0
-0
configs/Ippo_q8h_v5_defconfig CONFIG_MACH_SUN8I=y · line 8
Quoted 4 lines
configs/Ippo_q8h_v5_defconfig +1
-0@@ -5,3 +5,4 @@ CONFIG_MACH_SUN8I=y CONFIG_TARGET_IPPO_Q8H_V5=y CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" CONFIG_VIDEO=n +CONFIG_USB_KEYBOARD=n
Is this the only platform with video+usb which you have? What about e.g. cubie*, bananapi etc?
Quoted 14 lines
configs/Ippo_q8h_v5_defconfig +9
-0@@ -298,17 +304,28 @@ #include <config_distro_bootcmd.h> +#ifdef CONFIG_USB_KEYBOARD +#define CONSOLE_IN_SETTINGS \ + "preboot=usb start\0" \ + "stdin=serial,usbkbd\0" +#else +#define CONSOLE_IN_SETTINGS \ + "stdin=serial\0" +#endif + #ifdef CONFIG_VIDEO
configs/Ippo_q8h_v5_defconfig line 323
Quoted 10 lines
configs/Ippo_q8h_v5_defconfig +4
-3-#define CONSOLE_ENV_SETTINGS \ - "stdin=serial\0" \ +#define CONSOLE_OUT_SETTINGS \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" #else -#define CONSOLE_ENV_SETTINGS +#define CONSOLE_OUT_SETTINGS \ + "stdout=serial\0" \ + "stderr=serial\0"
Ah, here are the settings I asked about earlier. Are these in the wrong patch or did something change in this patch which makes them needed only now?
I'm not sure but I wonder if the cpp string pasting thing I suggested earlier would reduce the amount of #else and duplication around here?
configs/Ippo_q8h_v5_defconfig line 328
Quoted 6 lines
configs/Ippo_q8h_v5_defconfig +2
-1#endif #define CONFIG_EXTRA_ENV_SETTINGS \ - CONSOLE_ENV_SETTINGS \ + CONSOLE_IN_SETTINGS \ + CONSOLE_OUT_SETTINGS \
I suggest to #define CONSOLE_ENV_SETTINGS as the other two, and add STD to their names.
Quoted 3 lines
configs/Ippo_q8h_v5_defconfig +0
-0MEM_LAYOUT_ENV_SETTINGS \ "fdtfile=" CONFIG_FDTFILE "\0" \ "console=ttyS0,115200\0" \
PATCH 6/6 sunxi: Add usb keyboard Kconfig option
Hi,
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Hans de Goede
For use together with the hdmi console.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 7 +++++++ configs/Ippo_q8h_v5_defconfig | 1 + include/configs/sunxi-common.h | 25 +++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-)board/sunxi/Kconfig +0
-0@@ -223,4 +223,11 @@ config VIDEO Say Y here to add support for using a cfb console on the HDMI output found on most sunxi devices.
Quoted 4 lines
board/sunxi/Kconfig config VIDEO · line 226
Quoted 1 line
board/sunxi/Kconfig +1
-0+config USB_KEYBOARDThis seems like it ought to be under
drivers/somewhere, eitherdrivers/usb/Kconfigordrivers/input/Kconfigperhaps.
You're right the problem with that is, that what we really need is to Kconfig-ify the entire USB stuff (eg also CONFIG_USB_EHCI), but that is a bit more then I was planning on working on atm, esp. since that touches many many boards. So this seems best for now.
Quoted 12 lines
Quoted 12 lines
board/sunxi/Kconfig +6
-0+ boolean "Enable USB keyboard support" + default y + ---help--- + Say Y here to add support for using a USB keyboard (typically used + in combination with a graphical console on HDMI). + endifconfigs/Ippo_q8h_v5_defconfig +0
-0
Quoted 8 lines
configs/Ippo_q8h_v5_defconfig CONFIG_MACH_SUN8I=y · line 8
Quoted 5 lines
configs/Ippo_q8h_v5_defconfig +1
-0@@ -5,3 +5,4 @@ CONFIG_MACH_SUN8I=y CONFIG_TARGET_IPPO_Q8H_V5=y CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" CONFIG_VIDEO=n +CONFIG_USB_KEYBOARD=nIs this the only platform with video+usb which you have? What about e.g. cubie*, bananapi etc?
You mean without video + usb, since the default is y, and it is being forced to n here. No this is not the only board we support without HDMI, I has forgotten about the A13 boards (fixed locally now), this is the only board without a host usb connector (it is a tablet), it does support otg, but we do not support that yet.
I've also made a local change to disable CONFIG_USB_KEYBOARD by default in the A13 boards since although it does work there it makes little sense to have it when their is no video out support.
Quoted 20 lines
Quoted 20 lines
configs/Ippo_q8h_v5_defconfig +10
-2@@ -298,17 +304,28 @@ #include <config_distro_bootcmd.h> +#ifdef CONFIG_USB_KEYBOARD +#define CONSOLE_IN_SETTINGS \ + "preboot=usb start\0" \ + "stdin=serial,usbkbd\0" +#else +#define CONSOLE_IN_SETTINGS \ + "stdin=serial\0" +#endif + #ifdef CONFIG_VIDEO -#define CONSOLE_ENV_SETTINGS \ - "stdin=serial\0" \ +#define CONSOLE_OUT_SETTINGS \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" #else
Quoted 8 lines
configs/Ippo_q8h_v5_defconfig line 323
Quoted 4 lines
configs/Ippo_q8h_v5_defconfig +3
-1-#define CONSOLE_ENV_SETTINGS +#define CONSOLE_OUT_SETTINGS \ + "stdout=serial\0" \ + "stderr=serial\0"Ah, here are the settings I asked about earlier. Are these in the wrong patch or did something change in this patch which makes them needed only now?
These are only necessary when CONFIG_SYS_CONSOLE_IS_IN_ENV is set, which sofar was only happening when CONFIG_VIDEO is set. In this patch I'm setting them always to also support just CONFIG_USB_KEYBOARD without CONFIG_VIDEO, which is a bit weird, but I do not want to disallow it.
This does mean that we should also unconditionally enable CONFIG_SYS_CONSOLE_IS_IN_ENV with this patch (moving it out of the #ifdef CONFIG_VIDEO) block, which I've not done, I'll fix this locally.
Quoted 2 lines
I'm not sure but I wonder if the cpp string pasting thing I suggested earlier would reduce the amount of #else and duplication around here?
See my previous mail (I would like to keep this as is).
Quoted 10 lines
configs/Ippo_q8h_v5_defconfig line 328
Quoted 7 lines
configs/Ippo_q8h_v5_defconfig +2
-1#endif #define CONFIG_EXTRA_ENV_SETTINGS \ - CONSOLE_ENV_SETTINGS \ + CONSOLE_IN_SETTINGS \ + CONSOLE_OUT_SETTINGS \I suggest to #define
CONSOLE_ENV_SETTINGSas the other two, and add STD to their names.
Fixed in my local tree.
Regards,
Hans
PATCH 6/6 sunxi: Add usb keyboard Kconfig option
Quoted 26 lines · Hans de Goede
Hi,
Quoted 18 lines · Ian Campbell
Quoted 17 lines · Hans de Goede
For use together with the hdmi console.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 7 +++++++ configs/Ippo_q8h_v5_defconfig | 1 + include/configs/sunxi-common.h | 25 +++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-)board/sunxi/Kconfig +0
-0@@ -223,4 +223,11 @@ config VIDEO Say Y here to add support for using a cfb console on the HDMI output found on most sunxi devices.Quoted 4 lines
board/sunxi/Kconfig config VIDEO · line 226
Quoted 1 line
board/sunxi/Kconfig +1
-0+config USB_KEYBOARDThis seems like it ought to be under
drivers/somewhere, eitherdrivers/usb/Kconfigordrivers/input/Kconfigperhaps.
Quoted 4 lines
You're right the problem with that is, that what we really need is to Kconfig-ify the entire USB stuff (eg also
CONFIG_USB_EHCI), but that is a bit more then I was planning on working on atm, esp. since that touches many many boards. So this seems best for now.
OK, is the USB custodian OK with this plan?
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
board/sunxi/Kconfig +6
-0+ boolean "Enable USB keyboard support" + default y + ---help--- + Say Y here to add support for using a USB keyboard (typically used + in combination with a graphical console on HDMI). + endifconfigs/Ippo_q8h_v5_defconfig +0
-0Quoted 8 lines
configs/Ippo_q8h_v5_defconfig CONFIG_MACH_SUN8I=y · line 8
Quoted 5 lines
configs/Ippo_q8h_v5_defconfig +1
-0@@ -5,3 +5,4 @@ CONFIG_MACH_SUN8I=y CONFIG_TARGET_IPPO_Q8H_V5=y CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" CONFIG_VIDEO=n +CONFIG_USB_KEYBOARD=nIs this the only platform with video+usb which you have? What about e.g. cubie*, bananapi etc?
Quoted 2 lines
You mean without video + usb, since the default is y, and it is being forced to n here.
Sorry, I read this backwards somehow!
Quoted 8 lines
No this is not the only board we support without HDMI,
I has forgotten about the A13 boards (fixed locally now), this is the only board without a host usb connector (it is a tablet), it does support otg, but we do not support that yet.I've also made a local change to disable
CONFIG_USB_KEYBOARDby default in the A13 boards since although it does work there it makes little sense to have it when their is no video out support.
Sounds good.
Quoted 29 lines
Quoted 20 lines
Quoted 20 lines
configs/Ippo_q8h_v5_defconfig +10
-2@@ -298,17 +304,28 @@ #include <config_distro_bootcmd.h> +#ifdef CONFIG_USB_KEYBOARD +#define CONSOLE_IN_SETTINGS \ + "preboot=usb start\0" \ + "stdin=serial,usbkbd\0" +#else +#define CONSOLE_IN_SETTINGS \ + "stdin=serial\0" +#endif + #ifdef CONFIG_VIDEO -#define CONSOLE_ENV_SETTINGS \ - "stdin=serial\0" \ +#define CONSOLE_OUT_SETTINGS \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" #elseQuoted 8 lines
configs/Ippo_q8h_v5_defconfig line 323
Quoted 4 lines
configs/Ippo_q8h_v5_defconfig +3
-1-#define CONSOLE_ENV_SETTINGS +#define CONSOLE_OUT_SETTINGS \ + "stdout=serial\0" \ + "stderr=serial\0"Ah, here are the settings I asked about earlier. Are these in the wrong patch or did something change in this patch which makes them needed only now?
Quoted 8 lines
These are only necessary when
CONFIG_SYS_CONSOLE_IS_IN_ENVis set, which sofar was only happening whenCONFIG_VIDEOis set. In this patch I'm setting them always to also support justCONFIG_USB_KEYBOARDwithoutCONFIG_VIDEO, which is a bit weird, but I do not want to disallow it.This does mean that we should also unconditionally enable
CONFIG_SYS_CONSOLE_IS_IN_ENVwith this patch (moving it out of the #ifdefCONFIG_VIDEO) block, which I've not done, I'll fix this locally.
OK. Not sure what you were planning but it may makes sense to fold some portion of that change into the earlier patch.
Quoted 4 lines
Quoted 2 lines
I'm not sure but I wonder if the cpp string pasting thing I suggested earlier would reduce the amount of #else and duplication around here?
See my previous mail (I would like to keep this as is).
Sure.
The changes you proposed here all sound fine, I'll defer a formal ack till I've seen them though.
Ian.
PATCH 6/6 sunxi: Add usb keyboard Kconfig option
Hi,
Quoted 27 lines · Ian Campbell
Quoted 26 lines · Hans de Goede
Hi,
Quoted 22 lines · Ian Campbell
Quoted 14 lines · Hans de Goede
For use together with the hdmi console.
Signed-off-by Hans de Goede <[email protected]>--- board/sunxi/Kconfig | 7 +++++++ configs/Ippo_q8h_v5_defconfig | 1 + include/configs/sunxi-common.h | 25 +++++++++++++++++++++---- 3 files changed, 29 insertions(+), 4 deletions(-)board/sunxi/Kconfig +0
-0board/sunxi/Kconfig config VIDEO · line 226
Quoted 4 lines
board/sunxi/Kconfig +1
-0@@ -223,4 +223,11 @@ config VIDEO Say Y here to add support for using a cfb console on the HDMI output found on most sunxi devices. +config USB_KEYBOARDThis seems like it ought to be under
drivers/somewhere, eitherdrivers/usb/Kconfigordrivers/input/Kconfigperhaps.
Quoted 6 lines
Quoted 4 lines
You're right the problem with that is, that what we really need is to Kconfig-ify the entire USB stuff (eg also
CONFIG_USB_EHCI), but that is a bit more then I was planning on working on atm, esp. since that touches many many boards. So this seems best for now.OK, is the USB custodian OK with this plan?
Good question, I've just dropped Marek a mail on this with you in the CC.
Quoted 30 lines
Quoted 20 lines
Quoted 11 lines
Quoted 11 lines
board/sunxi/Kconfig +6
-0+ boolean "Enable USB keyboard support" + default y + ---help--- + Say Y here to add support for using a USB keyboard (typically used + in combination with a graphical console on HDMI). + endifconfigs/Ippo_q8h_v5_defconfig +0
-0Quoted 8 lines
configs/Ippo_q8h_v5_defconfig CONFIG_MACH_SUN8I=y · line 8
Quoted 5 lines
configs/Ippo_q8h_v5_defconfig +1
-0@@ -5,3 +5,4 @@ CONFIG_MACH_SUN8I=y CONFIG_TARGET_IPPO_Q8H_V5=y CONFIG_DEFAULT_DEVICE_TREE="sun8i-a23-ippo-q8h-v5.dtb" CONFIG_VIDEO=n +CONFIG_USB_KEYBOARD=nIs this the only platform with video+usb which you have? What about e.g. cubie*, bananapi etc?
Quoted 2 lines
You mean without video + usb, since the default is y, and it is being forced to n here.
Sorry, I read this backwards somehow!
Quoted 5 lines
No this is not the only board we support without HDMI,
I has forgotten about the A13 boards (fixed locally now), this is the only board without a host usb connector (it is a tablet), it does support otg, but we do not support that yet.
Quoted 5 lines
Quoted 3 lines
I've also made a local change to disable
CONFIG_USB_KEYBOARDby default in the A13 boards since although it does work there it makes little sense to have it when their is no video out support.Sounds good.
Ok.
Quoted 34 lines
Quoted 34 lines
Quoted 20 lines
Quoted 20 lines
configs/Ippo_q8h_v5_defconfig +10
-2@@ -298,17 +304,28 @@ #include <config_distro_bootcmd.h> +#ifdef CONFIG_USB_KEYBOARD +#define CONSOLE_IN_SETTINGS \ + "preboot=usb start\0" \ + "stdin=serial,usbkbd\0" +#else +#define CONSOLE_IN_SETTINGS \ + "stdin=serial\0" +#endif + #ifdef CONFIG_VIDEO -#define CONSOLE_ENV_SETTINGS \ - "stdin=serial\0" \ +#define CONSOLE_OUT_SETTINGS \ "stdout=serial,vga\0" \ "stderr=serial,vga\0" #elseQuoted 8 lines
configs/Ippo_q8h_v5_defconfig line 323
Quoted 4 lines
configs/Ippo_q8h_v5_defconfig +3
-1-#define CONSOLE_ENV_SETTINGS +#define CONSOLE_OUT_SETTINGS \ + "stdout=serial\0" \ + "stderr=serial\0"Ah, here are the settings I asked about earlier. Are these in the wrong patch or did something change in this patch which makes them needed only now?
These are only necessary when
CONFIG_SYS_CONSOLE_IS_IN_ENVis set, which sofar was only happening whenCONFIG_VIDEOis set. In this patch I'm setting them always to also support justCONFIG_USB_KEYBOARDwithoutCONFIG_VIDEO, which is a bit weird, but I do not want to disallow it.
Quoted 6 lines
Quoted 3 lines
This does mean that we should also unconditionally enable
CONFIG_SYS_CONSOLE_IS_IN_ENVwith this patch (moving it out of the #ifdefCONFIG_VIDEO) block, which I've not done, I'll fix this locally.OK. Not sure what you were planning but it may makes sense to fold some portion of that change into the earlier patch.
Yeah, I'll go move things around a bit then post a v2 of the last 4 patches of this set.
Regards,
Hans