Re: [U-Boot] [PATCH] imx: imx6: Move gpr_init() function to soc.c

2017-08-24 Thread Fabio Estevam
Hi Breno,

On Thu, Aug 24, 2017 at 10:00 AM, Breno Lima  wrote:
> Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
> MX6Q and MX6QP processors move it to the soc.c file.
>
> Signed-off-by: Breno Lima 
> ---
>  arch/arm/include/asm/mach-imx/sys_proto.h   |  2 ++
>  arch/arm/mach-imx/mx6/soc.c | 17 +
>  board/bachmann/ot1200/ot1200.c  | 11 ---
>  board/barco/platinum/platinum.h | 11 ---
>  board/congatec/cgtqmx6eval/cgtqmx6eval.c| 11 ---
>  board/el/el6x/el6x.c| 11 ---
>  board/engicam/common/spl.c  | 11 ---
>  board/freescale/mx6sabreauto/mx6sabreauto.c | 17 -
>  board/freescale/mx6sabresd/mx6sabresd.c | 17 -
>  board/gateworks/gw_ventana/gw_ventana_spl.c | 11 ---
>  board/kosagi/novena/novena_spl.c| 11 ---
>  board/liebherr/mccmon6/spl.c| 11 ---
>  board/phytec/pcm058/pcm058.c| 12 
>  board/phytec/pfla02/pfla02.c| 11 ---
>  board/solidrun/mx6cuboxi/mx6cuboxi.c| 11 ---
>  board/toradex/apalis_imx6/apalis_imx6.c | 11 ---
>  board/toradex/colibri_imx6/colibri_imx6.c   | 11 ---
>  board/udoo/udoo_spl.c   | 11 ---
>  board/wandboard/spl.c   | 11 ---
>  19 files changed, 19 insertions(+), 200 deletions(-)

Nice statistics :-) Thanks for the cleanup:

Reviewed-by: Fabio Estevam 
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH] imx: imx6: Move gpr_init() function to soc.c

2017-08-24 Thread Ɓukasz Majewski

On 08/24/2017 03:02 PM, Stefano Babic wrote:

Hi Breno,

On 24/08/2017 15:00, Breno Lima wrote:

Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.



Fully agree !

I took a loog a couple of days ago and I saw how much cut code is
in board/. Thanks, that you did it !


Signed-off-by: Breno Lima 
---
 arch/arm/include/asm/mach-imx/sys_proto.h   |  2 ++
 arch/arm/mach-imx/mx6/soc.c | 17 +
 board/bachmann/ot1200/ot1200.c  | 11 ---
 board/barco/platinum/platinum.h | 11 ---
 board/congatec/cgtqmx6eval/cgtqmx6eval.c| 11 ---
 board/el/el6x/el6x.c| 11 ---
 board/engicam/common/spl.c  | 11 ---
 board/freescale/mx6sabreauto/mx6sabreauto.c | 17 -
 board/freescale/mx6sabresd/mx6sabresd.c | 17 -
 board/gateworks/gw_ventana/gw_ventana_spl.c | 11 ---
 board/kosagi/novena/novena_spl.c| 11 ---
 board/liebherr/mccmon6/spl.c| 11 ---
 board/phytec/pcm058/pcm058.c| 12 
 board/phytec/pfla02/pfla02.c| 11 ---
 board/solidrun/mx6cuboxi/mx6cuboxi.c| 11 ---
 board/toradex/apalis_imx6/apalis_imx6.c | 11 ---
 board/toradex/colibri_imx6/colibri_imx6.c   | 11 ---
 board/udoo/udoo_spl.c   | 11 ---
 board/wandboard/spl.c   | 11 ---
 19 files changed, 19 insertions(+), 200 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h 
b/arch/arm/include/asm/mach-imx/sys_proto.h
index 046df62..436ba9a 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -85,6 +85,8 @@ static inline u8 imx6_is_bmode_from_gpr9(void)
 }

 u32 imx6_src_get_boot_mode(void);
+void gpr_init(void);
+
 #endif /* CONFIG_MX6 */

 u32 get_nr_cpus(void);
diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index 9ede1f5..f8bc05e 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -681,6 +681,23 @@ void imx_setup_hdmi(void)
 }
 #endif

+void gpr_init(void)
+{
+   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+   /* enable AXI cache for VDOA/VPU/IPU */
+   writel(0xF0CF, >gpr[4]);
+   if (is_mx6dqp()) {
+   /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
+   writel(0x77177717, >gpr[6]);
+   writel(0x77177717, >gpr[7]);
+   } else {
+   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
+   writel(0x007F007F, >gpr[6]);
+   writel(0x007F007F, >gpr[7]);
+   }
+}
+
 #ifdef CONFIG_IMX_BOOTAUX
 int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
 {
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index df10d6a..9465cea 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -169,17 +169,6 @@ static void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }

-static void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, >gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, >gpr[6]);
-   writel(0x007F007F, >gpr[7]);
-}
-
 int board_early_init_f(void)
 {
ccgr_init();
diff --git a/board/barco/platinum/platinum.h b/board/barco/platinum/platinum.h
index d3ea8bd..3013ed9 100644
--- a/board/barco/platinum/platinum.h
+++ b/board/barco/platinum/platinum.h
@@ -75,15 +75,4 @@ static inline void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }

-static inline void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, >gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, >gpr[6]);
-   writel(0x007F007F, >gpr[7]);
-}
-
 #endif /* _PLATINUM_H_ */
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 8cd0090..2ed66d3 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -955,17 +955,6 @@ static void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }

-static void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, >gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, >gpr[6]);
-   writel(0x007F007F, >gpr[7]);
-}
-
 /* Define a minimal structure so that the part number can be read via SPL */
 struct mfgdata {
unsigned char tsize;
diff --git 

Re: [U-Boot] [PATCH] imx: imx6: Move gpr_init() function to soc.c

2017-08-24 Thread Stefano Babic
Hi Breno,

On 24/08/2017 15:00, Breno Lima wrote:
> Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
> MX6Q and MX6QP processors move it to the soc.c file.
> 

Fully agree !

I took a loog a couple of days ago and I saw how much cut code is
in board/. Thanks, that you did it !

> Signed-off-by: Breno Lima 
> ---
>  arch/arm/include/asm/mach-imx/sys_proto.h   |  2 ++
>  arch/arm/mach-imx/mx6/soc.c | 17 +
>  board/bachmann/ot1200/ot1200.c  | 11 ---
>  board/barco/platinum/platinum.h | 11 ---
>  board/congatec/cgtqmx6eval/cgtqmx6eval.c| 11 ---
>  board/el/el6x/el6x.c| 11 ---
>  board/engicam/common/spl.c  | 11 ---
>  board/freescale/mx6sabreauto/mx6sabreauto.c | 17 -
>  board/freescale/mx6sabresd/mx6sabresd.c | 17 -
>  board/gateworks/gw_ventana/gw_ventana_spl.c | 11 ---
>  board/kosagi/novena/novena_spl.c| 11 ---
>  board/liebherr/mccmon6/spl.c| 11 ---
>  board/phytec/pcm058/pcm058.c| 12 
>  board/phytec/pfla02/pfla02.c| 11 ---
>  board/solidrun/mx6cuboxi/mx6cuboxi.c| 11 ---
>  board/toradex/apalis_imx6/apalis_imx6.c | 11 ---
>  board/toradex/colibri_imx6/colibri_imx6.c   | 11 ---
>  board/udoo/udoo_spl.c   | 11 ---
>  board/wandboard/spl.c   | 11 ---
>  19 files changed, 19 insertions(+), 200 deletions(-)
> 
> diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h 
> b/arch/arm/include/asm/mach-imx/sys_proto.h
> index 046df62..436ba9a 100644
> --- a/arch/arm/include/asm/mach-imx/sys_proto.h
> +++ b/arch/arm/include/asm/mach-imx/sys_proto.h
> @@ -85,6 +85,8 @@ static inline u8 imx6_is_bmode_from_gpr9(void)
>  }
>  
>  u32 imx6_src_get_boot_mode(void);
> +void gpr_init(void);
> +
>  #endif /* CONFIG_MX6 */
>  
>  u32 get_nr_cpus(void);
> diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
> index 9ede1f5..f8bc05e 100644
> --- a/arch/arm/mach-imx/mx6/soc.c
> +++ b/arch/arm/mach-imx/mx6/soc.c
> @@ -681,6 +681,23 @@ void imx_setup_hdmi(void)
>  }
>  #endif
>  
> +void gpr_init(void)
> +{
> + struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
> +
> + /* enable AXI cache for VDOA/VPU/IPU */
> + writel(0xF0CF, >gpr[4]);
> + if (is_mx6dqp()) {
> + /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
> + writel(0x77177717, >gpr[6]);
> + writel(0x77177717, >gpr[7]);
> + } else {
> + /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
> + writel(0x007F007F, >gpr[6]);
> + writel(0x007F007F, >gpr[7]);
> + }
> +}
> +
>  #ifdef CONFIG_IMX_BOOTAUX
>  int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
>  {
> diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
> index df10d6a..9465cea 100644
> --- a/board/bachmann/ot1200/ot1200.c
> +++ b/board/bachmann/ot1200/ot1200.c
> @@ -169,17 +169,6 @@ static void ccgr_init(void)
>   writel(0x03FF, >CCGR6);
>  }
>  
> -static void gpr_init(void)
> -{
> - struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
> -
> - /* enable AXI cache for VDOA/VPU/IPU */
> - writel(0xF0CF, >gpr[4]);
> - /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
> - writel(0x007F007F, >gpr[6]);
> - writel(0x007F007F, >gpr[7]);
> -}
> -
>  int board_early_init_f(void)
>  {
>   ccgr_init();
> diff --git a/board/barco/platinum/platinum.h b/board/barco/platinum/platinum.h
> index d3ea8bd..3013ed9 100644
> --- a/board/barco/platinum/platinum.h
> +++ b/board/barco/platinum/platinum.h
> @@ -75,15 +75,4 @@ static inline void ccgr_init(void)
>   writel(0x03FF, >CCGR6);
>  }
>  
> -static inline void gpr_init(void)
> -{
> - struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
> -
> - /* enable AXI cache for VDOA/VPU/IPU */
> - writel(0xF0CF, >gpr[4]);
> - /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
> - writel(0x007F007F, >gpr[6]);
> - writel(0x007F007F, >gpr[7]);
> -}
> -
>  #endif /* _PLATINUM_H_ */
> diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
> b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> index 8cd0090..2ed66d3 100644
> --- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> +++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
> @@ -955,17 +955,6 @@ static void ccgr_init(void)
>   writel(0x03FF, >CCGR6);
>  }
>  
> -static void gpr_init(void)
> -{
> - struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
> -
> - /* enable AXI cache for VDOA/VPU/IPU */
> - writel(0xF0CF, >gpr[4]);
> - /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
> - writel(0x007F007F, >gpr[6]);
> - writel(0x007F007F, >gpr[7]);
> -}
> -
>  /* 

[U-Boot] [PATCH] imx: imx6: Move gpr_init() function to soc.c

2017-08-24 Thread Breno Lima
Since the gpr_init() function is common for boards using MX6S, MX6DL, MX6D,
MX6Q and MX6QP processors move it to the soc.c file.

Signed-off-by: Breno Lima 
---
 arch/arm/include/asm/mach-imx/sys_proto.h   |  2 ++
 arch/arm/mach-imx/mx6/soc.c | 17 +
 board/bachmann/ot1200/ot1200.c  | 11 ---
 board/barco/platinum/platinum.h | 11 ---
 board/congatec/cgtqmx6eval/cgtqmx6eval.c| 11 ---
 board/el/el6x/el6x.c| 11 ---
 board/engicam/common/spl.c  | 11 ---
 board/freescale/mx6sabreauto/mx6sabreauto.c | 17 -
 board/freescale/mx6sabresd/mx6sabresd.c | 17 -
 board/gateworks/gw_ventana/gw_ventana_spl.c | 11 ---
 board/kosagi/novena/novena_spl.c| 11 ---
 board/liebherr/mccmon6/spl.c| 11 ---
 board/phytec/pcm058/pcm058.c| 12 
 board/phytec/pfla02/pfla02.c| 11 ---
 board/solidrun/mx6cuboxi/mx6cuboxi.c| 11 ---
 board/toradex/apalis_imx6/apalis_imx6.c | 11 ---
 board/toradex/colibri_imx6/colibri_imx6.c   | 11 ---
 board/udoo/udoo_spl.c   | 11 ---
 board/wandboard/spl.c   | 11 ---
 19 files changed, 19 insertions(+), 200 deletions(-)

diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h 
b/arch/arm/include/asm/mach-imx/sys_proto.h
index 046df62..436ba9a 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -85,6 +85,8 @@ static inline u8 imx6_is_bmode_from_gpr9(void)
 }
 
 u32 imx6_src_get_boot_mode(void);
+void gpr_init(void);
+
 #endif /* CONFIG_MX6 */
 
 u32 get_nr_cpus(void);
diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index 9ede1f5..f8bc05e 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -681,6 +681,23 @@ void imx_setup_hdmi(void)
 }
 #endif
 
+void gpr_init(void)
+{
+   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
+
+   /* enable AXI cache for VDOA/VPU/IPU */
+   writel(0xF0CF, >gpr[4]);
+   if (is_mx6dqp()) {
+   /* set IPU AXI-id1 Qos=0x1 AXI-id0/2/3 Qos=0x7 */
+   writel(0x77177717, >gpr[6]);
+   writel(0x77177717, >gpr[7]);
+   } else {
+   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
+   writel(0x007F007F, >gpr[6]);
+   writel(0x007F007F, >gpr[7]);
+   }
+}
+
 #ifdef CONFIG_IMX_BOOTAUX
 int arch_auxiliary_core_up(u32 core_id, u32 boot_private_data)
 {
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index df10d6a..9465cea 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -169,17 +169,6 @@ static void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }
 
-static void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, >gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, >gpr[6]);
-   writel(0x007F007F, >gpr[7]);
-}
-
 int board_early_init_f(void)
 {
ccgr_init();
diff --git a/board/barco/platinum/platinum.h b/board/barco/platinum/platinum.h
index d3ea8bd..3013ed9 100644
--- a/board/barco/platinum/platinum.h
+++ b/board/barco/platinum/platinum.h
@@ -75,15 +75,4 @@ static inline void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }
 
-static inline void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, >gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, >gpr[6]);
-   writel(0x007F007F, >gpr[7]);
-}
-
 #endif /* _PLATINUM_H_ */
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c 
b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 8cd0090..2ed66d3 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -955,17 +955,6 @@ static void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }
 
-static void gpr_init(void)
-{
-   struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
-
-   /* enable AXI cache for VDOA/VPU/IPU */
-   writel(0xF0CF, >gpr[4]);
-   /* set IPU AXI-id0 Qos=0xf(bypass) AXI-id1 Qos=0x7 */
-   writel(0x007F007F, >gpr[6]);
-   writel(0x007F007F, >gpr[7]);
-}
-
 /* Define a minimal structure so that the part number can be read via SPL */
 struct mfgdata {
unsigned char tsize;
diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c
index 6b98b5c..fb128f5 100644
--- a/board/el/el6x/el6x.c
+++ b/board/el/el6x/el6x.c
@@ -570,17 +570,6 @@ static void ccgr_init(void)
writel(0x03FF, >CCGR6);
 }
 
-static