Commit 409b16d3e09da3c738b925311e3e59068558618d

Authored by Jagan Teki
Committed by Stefano Babic
1 parent f086812acd

i.MX6: engicam: Move set_fdt_file to common

setenv_fdt_file to common code and set dtb based on
CONFIG_DEFAULT_DEVICE_TREE and cpu_type.

Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Showing 6 changed files with 24 additions and 34 deletions Side-by-side Diff

board/engicam/common/board.c
... ... @@ -32,6 +32,30 @@
32 32 }
33 33 #endif
34 34  
  35 +static void setenv_fdt_file(void)
  36 +{
  37 + const char *cmp_dtb = CONFIG_DEFAULT_DEVICE_TREE;
  38 +
  39 + if (!strcmp(cmp_dtb, "imx6q-icore")) {
  40 + if (is_mx6dq())
  41 + env_set("fdt_file", "imx6q-icore.dtb");
  42 + else if(is_mx6dl() || is_mx6solo())
  43 + env_set("fdt_file", "imx6dl-icore.dtb");
  44 + } else if (!strcmp(cmp_dtb, "imx6q-icore-rqs")) {
  45 + if (is_mx6dq())
  46 + env_set("fdt_file", "imx6q-icore-rqs.dtb");
  47 + else if(is_mx6dl() || is_mx6solo())
  48 + env_set("fdt_file", "imx6dl-icore-rqs.dtb");
  49 + } else if (!strcmp(cmp_dtb, "imx6ul-geam-kit"))
  50 + env_set("fdt_file", "imx6ul-geam-kit.dtb");
  51 + else if (!strcmp(cmp_dtb, "imx6ul-isiot-mmc"))
  52 + env_set("fdt_file", "imx6ul-isiot-mmc.dtb");
  53 + else if (!strcmp(cmp_dtb, "imx6ul-isiot-emmc"))
  54 + env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
  55 + else if (!strcmp(cmp_dtb, "imx6ul-isiot-nand"))
  56 + env_set("fdt_file", "imx6ul-isiot-nand.dtb");
  57 +}
  58 +
35 59 int board_late_init(void)
36 60 {
37 61 switch ((imx6_src_get_boot_mode() & IMX6_BMODE_MASK) >>
board/engicam/common/board.h
... ... @@ -6,7 +6,6 @@
6 6  
7 7 #ifndef _BOARD_H_
8 8 #define _BOARD_H_
9   -void setenv_fdt_file(void);
10 9 void setup_gpmi_nand(void);
11 10 void setup_display(void);
12 11 #endif /* _BOARD_H_ */
board/engicam/geam6ul/geam6ul.c
... ... @@ -90,12 +90,6 @@
90 90 }
91 91 #endif /* CONFIG_NAND_MXS */
92 92  
93   -void setenv_fdt_file(void)
94   -{
95   - if (is_mx6ul())
96   - env_set("fdt_file", "imx6ul-geam-kit.dtb");
97   -}
98   -
99 93 #ifdef CONFIG_SPL_BUILD
100 94 /* MMC board initialization is needed till adding DM support in SPL */
101 95 #if defined(CONFIG_FSL_ESDHC) && !defined(CONFIG_DM_MMC)
board/engicam/icorem6/icorem6.c
... ... @@ -192,14 +192,6 @@
192 192 }
193 193 #endif /* CONFIG_VIDEO_IPUV3 */
194 194  
195   -void setenv_fdt_file(void)
196   -{
197   - if (is_mx6dq())
198   - env_set("fdt_file", "imx6q-icore.dtb");
199   - else if(is_mx6dl() || is_mx6solo())
200   - env_set("fdt_file", "imx6dl-icore.dtb");
201   -}
202   -
203 195 #ifdef CONFIG_SPL_BUILD
204 196 /* MMC board initialization is needed till adding DM support in SPL */
205 197 #if defined(CONFIG_FSL_ESDHC) && !defined(CONFIG_DM_MMC)
board/engicam/icorem6_rqs/icorem6_rqs.c
... ... @@ -31,14 +31,6 @@
31 31 }
32 32 #endif
33 33  
34   -void setenv_fdt_file(void)
35   -{
36   - if (is_mx6dq())
37   - env_set("fdt_file", "imx6q-icore-rqs.dtb");
38   - else if(is_mx6dl() || is_mx6solo())
39   - env_set("fdt_file", "imx6dl-icore-rqs.dtb");
40   -}
41   -
42 34 #ifdef CONFIG_SPL_BUILD
43 35 #include <spl.h>
44 36  
board/engicam/isiotmx6ul/isiotmx6ul.c
... ... @@ -98,17 +98,6 @@
98 98 }
99 99 #endif
100 100  
101   -void setenv_fdt_file(void)
102   -{
103   - if (is_mx6ul()) {
104   -#ifdef CONFIG_ENV_IS_IN_MMC
105   - env_set("fdt_file", "imx6ul-isiot-emmc.dtb");
106   -#else
107   - env_set("fdt_file", "imx6ul-isiot-nand.dtb");
108   -#endif
109   - }
110   -}
111   -
112 101 #ifdef CONFIG_SPL_BUILD
113 102 #include <spl.h>
114 103