[U-Boot] [PATCH] ipu_common: Let the MX6 IPU clock be calculated in run-time
Eric Nelson
eric at nelint.com
Wed Sep 6 17:56:45 UTC 2017
Thanks Fabio,
On 09/06/2017 09:49 AM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam at nxp.com>
>
> MX6Q/QP IPU operates at 264MHz and MX6DL IPU at 198MHz.
>
> When running a SPL target, which supports multiple MX6 variants we cannot
> properly setup the IPU clock frequency via CONFIG_IPUV3_CLK option as
> such decision is done in build-time currently.
>
> Remove the CONFIG_IPUV3_CLK option and let the IPU clock frequency be
> configured in run-time on mx6.
>
> Reported-by: Eric Nelson <eric at nelint.com>
> Signed-off-by: Fabio Estevam <fabio.estevam at nxp.com>
> ---
> Changes since v1:
> - Improve the mx6 detection logic (Troy)
>
> drivers/video/ipu_common.c | 14 +++++++++++++-
> include/configs/advantech_dms-ba16.h | 1 -
> include/configs/apalis_imx6.h | 1 -
> include/configs/aristainetos-common.h | 1 -
> include/configs/cgtqmx6eval.h | 4 ----
> include/configs/cm_fx6.h | 1 -
> include/configs/colibri_imx6.h | 1 -
> include/configs/embestmx6boards.h | 1 -
> include/configs/ge_bx50v3.h | 1 -
> include/configs/gw_ventana.h | 1 -
> include/configs/imx6-engicam.h | 1 -
> include/configs/m53evk.h | 1 -
> include/configs/mx51evk.h | 1 -
> include/configs/mx53cx9020.h | 1 -
> include/configs/mx53loco.h | 1 -
> include/configs/mx6cuboxi.h | 1 -
> include/configs/mx6sabre_common.h | 5 -----
> include/configs/nitrogen6x.h | 1 -
> include/configs/novena.h | 1 -
> include/configs/tbs2910.h | 1 -
> include/configs/wandboard.h | 1 -
> scripts/config_whitelist.txt | 1 -
> 22 files changed, 13 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/video/ipu_common.c b/drivers/video/ipu_common.c
> index f8d4488..a9584b8 100644
> --- a/drivers/video/ipu_common.c
> +++ b/drivers/video/ipu_common.c
> @@ -19,6 +19,7 @@
> #include <linux/errno.h>
> #include <asm/arch/imx-regs.h>
> #include <asm/arch/crm_regs.h>
> +#include <asm/arch/sys_proto.h>
> #include <div64.h>
> #include "ipu.h"
> #include "ipu_regs.h"
> @@ -81,6 +82,11 @@ struct ipu_ch_param {
>
> #define IPU_SW_RST_TOUT_USEC (10000)
>
> +#define IPUV3_CLK_MX51 133000000
> +#define IPUV3_CLK_MX53 200000000
> +#define IPUV3_CLK_MX6Q 264000000
> +#define IPUV3_CLK_MX6DL 198000000
> +
> void clk_enable(struct clk *clk)
> {
> if (clk) {
> @@ -196,7 +202,6 @@ static void clk_ipu_disable(struct clk *clk)
>
> static struct clk ipu_clk = {
> .name = "ipu_clk",
> - .rate = CONFIG_IPUV3_CLK,
> #if defined(CONFIG_MX51) || defined(CONFIG_MX53)
> .enable_reg = (u32 *)(CCM_BASE_ADDR +
> offsetof(struct mxc_ccm_reg, CCGR5)),
> @@ -476,6 +481,13 @@ int ipu_probe(void)
> g_pixel_clk[1] = &pixel_clk[1];
>
> g_ipu_clk = &ipu_clk;
> +#if defined(CONFIG_MX51)
> + g_ipu_clk->rate = IPUV3_CLK_MX51;
> +#elif defined(CONFIG_MX53)
> + g_ipu_clk->rate = IPUV3_CLK_MX53;
> +#else
> + g_ipu_clk->rate = is_mx6sdl() ? IPUV3_CLK_MX6DL : IPUV3_CLK_MX6Q;
> +#endif
> debug("ipu_clk = %u\n", clk_get_rate(g_ipu_clk));
> g_ldb_clk = &ldb_clk;
> debug("ldb_clk = %u\n", clk_get_rate(g_ldb_clk));
> diff --git a/include/configs/advantech_dms-ba16.h b/include/configs/advantech_dms-ba16.h
> index 6329bf6..6e380d0 100644
> --- a/include/configs/advantech_dms-ba16.h
> +++ b/include/configs/advantech_dms-ba16.h
> @@ -260,7 +260,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> #endif
> diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
> index 16af141..f10ce6d 100644
> --- a/include/configs/apalis_imx6.h
> +++ b/include/configs/apalis_imx6.h
> @@ -124,7 +124,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_CONSOLE_MUX
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> diff --git a/include/configs/aristainetos-common.h b/include/configs/aristainetos-common.h
> index 1c28fcf..3afc7a6 100644
> --- a/include/configs/aristainetos-common.h
> +++ b/include/configs/aristainetos-common.h
> @@ -217,7 +217,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 198000000
> #define CONFIG_IMX_VIDEO_SKIP
>
> #define CONFIG_PWM_IMX
> diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
> index 4996a89..6a6c063 100644
> --- a/include/configs/cgtqmx6eval.h
> +++ b/include/configs/cgtqmx6eval.h
> @@ -87,10 +87,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#ifdef CONFIG_MX6DL
> -#define CONFIG_IPUV3_CLK 198000000
> -#else
> -#define CONFIG_IPUV3_CLK 264000000
> #endif
> #define CONFIG_IMX_HDMI
>
> diff --git a/include/configs/cm_fx6.h b/include/configs/cm_fx6.h
> index 4f45be1..5d4b670 100644
> --- a/include/configs/cm_fx6.h
> +++ b/include/configs/cm_fx6.h
> @@ -240,7 +240,6 @@
>
> /* Display */
> #define CONFIG_VIDEO_IPUV3
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
>
> #define CONFIG_SPLASH_SCREEN
> diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
> index fca72f4..cb8a0e2 100644
> --- a/include/configs/colibri_imx6.h
> +++ b/include/configs/colibri_imx6.h
> @@ -110,7 +110,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_CONSOLE_MUX
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> diff --git a/include/configs/embestmx6boards.h b/include/configs/embestmx6boards.h
> index d1dec80..1400d66 100644
> --- a/include/configs/embestmx6boards.h
> +++ b/include/configs/embestmx6boards.h
> @@ -113,7 +113,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
>
> diff --git a/include/configs/ge_bx50v3.h b/include/configs/ge_bx50v3.h
> index d090cdd..9906241 100644
> --- a/include/configs/ge_bx50v3.h
> +++ b/include/configs/ge_bx50v3.h
> @@ -290,7 +290,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> #endif
> diff --git a/include/configs/gw_ventana.h b/include/configs/gw_ventana.h
> index aeacd46..b7a1e10 100644
> --- a/include/configs/gw_ventana.h
> +++ b/include/configs/gw_ventana.h
> @@ -160,7 +160,6 @@
> /* Framebuffer and LCD */
> #define CONFIG_VIDEO_IPUV3
> #define CONFIG_VIDEO_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> #define CONFIG_VIDEO_BMP_LOGO
> diff --git a/include/configs/imx6-engicam.h b/include/configs/imx6-engicam.h
> index a1b7036..c34dc30 100644
> --- a/include/configs/imx6-engicam.h
> +++ b/include/configs/imx6-engicam.h
> @@ -199,7 +199,6 @@
>
> /* Framebuffer */
> #ifdef CONFIG_VIDEO_IPUV3
> -# define CONFIG_IPUV3_CLK 260000000
> # define CONFIG_IMX_VIDEO_SKIP
>
> # define CONFIG_SPLASH_SCREEN
> diff --git a/include/configs/m53evk.h b/include/configs/m53evk.h
> index 4dc6e16..a0d74a0 100644
> --- a/include/configs/m53evk.h
> +++ b/include/configs/m53evk.h
> @@ -179,7 +179,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (2 << 20)
> -#define CONFIG_IPUV3_CLK 200000000
> #endif
>
> /*
> diff --git a/include/configs/mx51evk.h b/include/configs/mx51evk.h
> index 5daa50d..6677686 100644
> --- a/include/configs/mx51evk.h
> +++ b/include/configs/mx51evk.h
> @@ -87,7 +87,6 @@
> #define CONFIG_SPLASH_SCREEN
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> -#define CONFIG_IPUV3_CLK 133000000
>
> /* allow to overwrite serial and ethaddr */
> #define CONFIG_ENV_OVERWRITE
> diff --git a/include/configs/mx53cx9020.h b/include/configs/mx53cx9020.h
> index 4137592..04c3d09 100644
> --- a/include/configs/mx53cx9020.h
> +++ b/include/configs/mx53cx9020.h
> @@ -187,6 +187,5 @@
> #define CONFIG_SPLASH_SCREEN
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> -#define CONFIG_IPUV3_CLK 200000000
>
> #endif /* __CONFIG_H */
> diff --git a/include/configs/mx53loco.h b/include/configs/mx53loco.h
> index 3828b21..317ffab 100644
> --- a/include/configs/mx53loco.h
> +++ b/include/configs/mx53loco.h
> @@ -204,6 +204,5 @@
> #define CONFIG_SPLASH_SCREEN
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> -#define CONFIG_IPUV3_CLK 200000000
>
> #endif /* __CONFIG_H */
> diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
> index 5930f59..c9eec52 100644
> --- a/include/configs/mx6cuboxi.h
> +++ b/include/configs/mx6cuboxi.h
> @@ -41,7 +41,6 @@
>
> /* Framebuffer */
> #define CONFIG_VIDEO_IPUV3
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_VIDEO_BMP_RLE8
> #define CONFIG_SPLASH_SCREEN
> #define CONFIG_SPLASH_SCREEN_ALIGN
> diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h
> index b849eea..cb700e5 100644
> --- a/include/configs/mx6sabre_common.h
> +++ b/include/configs/mx6sabre_common.h
> @@ -205,11 +205,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#ifdef CONFIG_MX6DL
> -#define CONFIG_IPUV3_CLK 198000000
> -#else
> -#define CONFIG_IPUV3_CLK 264000000
> -#endif
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
>
> diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
> index bc17b51..f710a9c 100644
> --- a/include/configs/nitrogen6x.h
> +++ b/include/configs/nitrogen6x.h
> @@ -85,7 +85,6 @@
> #define CONFIG_VIDEO_BMP_GZIP
> #define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (6 * 1024 * 1024)
> #define CONFIG_BMP_16BPP
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
>
> diff --git a/include/configs/novena.h b/include/configs/novena.h
> index 7c5445d..d661aff 100644
> --- a/include/configs/novena.h
> +++ b/include/configs/novena.h
> @@ -145,7 +145,6 @@
> #define CONFIG_SPLASH_SCREEN
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> #endif
> diff --git a/include/configs/tbs2910.h b/include/configs/tbs2910.h
> index c3fc8a3..e70ebbf 100644
> --- a/include/configs/tbs2910.h
> +++ b/include/configs/tbs2910.h
> @@ -64,7 +64,6 @@
> /* Framebuffer */
> #ifdef CONFIG_VIDEO
> #define CONFIG_VIDEO_IPUV3
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_VIDEO_BMP_RLE8
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
> index d9237d7..3ba4c29 100644
> --- a/include/configs/wandboard.h
> +++ b/include/configs/wandboard.h
> @@ -71,7 +71,6 @@
> #define CONFIG_BMP_16BPP
> #define CONFIG_VIDEO_LOGO
> #define CONFIG_VIDEO_BMP_LOGO
> -#define CONFIG_IPUV3_CLK 260000000
> #define CONFIG_IMX_HDMI
> #define CONFIG_IMX_VIDEO_SKIP
> #endif
> diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt
> index 0a751e4..83c3d83 100644
> --- a/scripts/config_whitelist.txt
> +++ b/scripts/config_whitelist.txt
> @@ -1127,7 +1127,6 @@ CONFIG_IPAM390_GPIO_BOOTMODE
> CONFIG_IPAM390_GPIO_LED_GREEN
> CONFIG_IPAM390_GPIO_LED_RED
> CONFIG_IPROC
> -CONFIG_IPUV3_CLK
> CONFIG_IP_DEFRAG
> CONFIG_IRAM_BASE
> CONFIG_IRAM_END
>
Reviewed-by: Eric Nelson <eric at nelint.com>
More information about the U-Boot
mailing list