imx: imx8mp: detect i.MX8MP UltraLite when get cpu rev
Subsystems (3)
PATCH 1/4 imx: imx8mp: detect i.MX8MP UltraLite when get cpu rev
From: Peng Fan <[email protected]>
Detect i.MX8MP UltraLite in get_cpu_variant_type
--- arch/arm/mach-imx/imx8m/soc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +16 -2
@@ -407,13 +407,27 @@ static u32 get_cpu_variant_type(u32 type)/* npu disabled*/ if ((value &0x8 ) ==0x8 ) - flag |= (1 <<1 ); + flag |=BIT (1 );/* isp disabled */ if ((value &0x3 ) ==0x3 ) - flag |= (1 <<2 ); + flag |=BIT (2 ); + +/* gpu disabled */ +if ((value &0xc0 ) ==0xc0 ) + flag |=BIT (3 ); + +/* lvds disabled */ +if ((value &0x180000 ) ==0x180000 ) + flag |=BIT (4 ); + +/* mipi dsi disabled */ +if ((value &0x60000 ) ==0x60000 ) + flag |=BIT (5 );switch (flag) { +case 0x3f : +return MXC_CPU_IMX8MPUL ;case 7 :return MXC_CPU_IMX8MPL ;case 2 :
Signature · 1 line
2.30.0
PATCH 2/4 imx: imx8mp: disable fused IP for UltraLite
From: Peng Fan <[email protected]>
Beside the fused modules on iMX8MP Lite, this part has also fused GPU3D/2D, LVDS and MIPI DSI.
So we have to disable them for kernel and also disable MIPI DSI in u-boot DTS for splash screen at runtime.
--- arch/arm/mach-imx/imx8m/soc.c | 147 ++++++++++++++++++++++++++++++++-- 1 file changed, 142 insertions(+), 5 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +142 -5
@@ -905,6 +905,90 @@ static int low_drive_gpu_freq(void *blob) }#endif +static bool check_remote_endpoint (void *blob,const char *ep1,const char *ep2) +{ +int lookup_node; +int nodeoff; + + nodeoff =fdt_path_offset (blob, ep1); +if (nodeoff) { + lookup_node =fdtdec_lookup_phandle (blob, nodeoff,"remote-endpoint" ); + nodeoff =fdt_path_offset (blob, ep2); + +if (nodeoff >0 && nodeoff == lookup_node) +return true; + } + +return false; +} + +int disable_dsi_lcdif_nodes (void *blob) +{ +int ret; + +static const char *const dsi_path_8mp[] = { +"/soc@0/bus@32c00000/mipi_dsi@32e60000" + }; + +static const char *const lcdif_path_8mp[] = { +"/soc@0/bus@32c00000/lcd-controller@32e80000" + }; + +static const char *const lcdif_ep_path_8mp[] = { +"/soc@0/bus@32c00000/lcd-controller@32e80000/port@0/endpoint" + }; +static const char *const dsi_ep_path_8mp[] = { +"/soc@0/bus@32c00000/mipi_dsi@32e60000/port@0/endpoint" + }; + + ret =disable_fdt_nodes (blob, dsi_path_8mp,ARRAY_SIZE (dsi_path_8mp)); +if (ret) +return ret; + +if (check_remote_endpoint (blob, dsi_ep_path_8mp[0 ], lcdif_ep_path_8mp[0 ])) { +/* Disable lcdif node */ +return disable_fdt_nodes (blob, lcdif_path_8mp,ARRAY_SIZE (lcdif_path_8mp)); + } + +return 0 ; +} + +int disable_lvds_lcdif_nodes (void *blob) +{ +int ret, i; + +static const char *const ldb_path_8mp[] = { +"/soc@0/bus@32c00000/ldb@32ec005c" , +"/soc@0/bus@32c00000/phy@32ec0128" + }; + +static const char *const lcdif_path_8mp[] = { +"/soc@0/bus@32c00000/lcd-controller@32e90000" + }; + +static const char *const lcdif_ep_path_8mp[] = { +"/soc@0/bus@32c00000/lcd-controller@32e90000/port@0/endpoint@0" , +"/soc@0/bus@32c00000/lcd-controller@32e90000/port@0/endpoint@1" + }; +static const char *const ldb_ep_path_8mp[] = { +"/soc@0/bus@32c00000/ldb@32ec005c/lvds-channel@0/port@0/endpoint" , +"/soc@0/bus@32c00000/ldb@32ec005c/lvds-channel@1/port@0/endpoint" + }; + + ret =disable_fdt_nodes (blob, ldb_path_8mp,ARRAY_SIZE (ldb_path_8mp)); +if (ret) +return ret; + +for (i =0 ; i <ARRAY_SIZE (ldb_ep_path_8mp); i++) { +if (check_remote_endpoint (blob, ldb_ep_path_8mp[i], lcdif_ep_path_8mp[i])) { +/* Disable lcdif node */ +return disable_fdt_nodes (blob, lcdif_path_8mp,ARRAY_SIZE (lcdif_path_8mp)); + } + } + +return 0 ; +} +int disable_gpu_nodes (void *blob) {static const char *const nodes_path_8mn[] = {
@@ -912,7 +996,15 @@ int disable_gpu_nodes(void *blob) "/soc@/gpu@38000000" }; -return disable_fdt_nodes (blob, nodes_path_8mn,ARRAY_SIZE (nodes_path_8mn)); +static const char *const nodes_path_8mp[] = { +"/gpu3d@38000000" , +"/gpu2d@38008000" + }; + +if (is_imx8mp ()) +return disable_fdt_nodes (blob, nodes_path_8mp,ARRAY_SIZE (nodes_path_8mp)); +else +return disable_fdt_nodes (blob, nodes_path_8mn,ARRAY_SIZE (nodes_path_8mn)); }int disable_npu_nodes (void *blob)
@@ -1168,16 +1260,27 @@ usb_modify_speed:disable_cpu_nodes (blob,3 );#elif defined(CONFIG_IMX8MP ) -if (is_imx8mpl ()) +if (is_imx8mpul ()) { +/* Disable GPU */ +disable_gpu_nodes (blob); + +/* Disable DSI */ +disable_dsi_lcdif_nodes (blob); + +/* Disable LVDS */ +disable_lvds_lcdif_nodes (blob); + } + +if (is_imx8mpul () ||is_imx8mpl ())disable_vpu_nodes (blob); -if (is_imx8mpl () ||is_imx8mp6 ()) +if (is_imx8mpul () ||is_imx8mpl () ||is_imx8mp6 ())disable_npu_nodes (blob); -if (is_imx8mpl ()) +if (is_imx8mpul () ||is_imx8mpl ())disable_isp_nodes (blob); -if (is_imx8mpl () ||is_imx8mp6 ()) +if (is_imx8mpul () ||is_imx8mpl () ||is_imx8mp6 ())disable_dsp_nodes (blob);if (is_imx8mpd ())
@@ -1188,6 +1291,40 @@ usb_modify_speed: }#endif +#ifdef CONFIG_OF_BOARD_FIXUP +#ifndef CONFIG_SPL_BUILD +int board_fix_fdt (void *fdt) +{ +if (is_imx8mpul ()) { +int i =0 ; +int nodeoff, ret; +const char *status ="disabled" ; +static const char *const dsi_nodes[] = { +"/soc@0/bus@32c00000/mipi_dsi@32e60000" , +"/soc@0/bus@32c00000/lcd-controller@32e80000" , +"/dsi-host" + }; + +for (i =0 ; i <ARRAY_SIZE (dsi_nodes); i++) { + nodeoff =fdt_path_offset (fdt, dsi_nodes[i]); +if (nodeoff >0 ) { +set_status: + ret =fdt_setprop (fdt, nodeoff,"status" , status, +strlen (status) +1 ); +if (ret == -FDT_ERR_NOSPACE ) { + ret =fdt_increase_size (fdt,512 ); +if (!ret) + goto set_status; + } + } + } + } + +return 0 ; +} +#endif +#endif +#if !CONFIG_IS_ENABLED (SYSRESET )void reset_cpu (void ) {
Signature · 1 line
2.30.0
Re: [PATCH 2/4] imx: imx8mp: disable fused IP for UltraLite
Hello Peng,
Am Montag, dem 14.02.2022 um 20:55 +0800 schrieb Peng Fan (OSS):
Quoted 24 lines
From: Peng Fan <[email protected]>
Beside the fused modules on iMX8MP Lite, this part has also fused GPU3D/2D, LVDS and MIPI DSI.
So we have to disable them for kernel and also disable MIPI DSI in u-boot DTS for splash screen at runtime.Signed-off-by Ye Li <[email protected]>Signed-off-by Peng Fan <[email protected]>--- arch/arm/mach-imx/imx8m/soc.c | 147 ++++++++++++++++++++++++++++++++-- 1 file changed, 142 insertions(+), 5 deletions(-)arch/arm/mach- renamed from arch/arm/mach-imx/imx8m/soc.c +0
-0
imx/imx8m/soc.c
indexe2d21bf6b8..91ff7eca59100644arch/arm/mach-imx/imx8m/soc.c +0
-0@@ -905,6 +905,90 @@ static int low_drive_gpu_freq(void *blob) }#endif
[...]
arch/arm/mach-imx/imx8m/soc.c usb_modify_speed: · line 1296
Quoted 4 lines
arch/arm/mach-imx/imx8m/soc.c +3
-0+#ifdef CONFIG_OF_BOARD_FIXUP +#ifndef CONFIG_SPL_BUILD +int board_fix_fdt (void *fdt)
I stumbled over this already in the NXP U-Boot. We implemented there on top our own board_fix_fdt() callback on board level. So this caused a conflict. This will be a issue for upstream also when a imx8m* board tries to use it.
Is there not any other way to solve this than implementing board callbacks on soc level?
Regards,
Teresa
Quoted 36 lines
arch/arm/mach-imx/imx8m/soc.c +16
-0+{ +if (is_imx8mpul ()) { +int i =0 ; +int nodeoff, ret; +const char *status ="disabled" ; +static const char *const dsi_nodes[] = { +"/soc@0/bus@32c00000/mipi_dsi@32e60000" , +"/soc@0/bus@32c00000/lcd-controller@32e80000" , +"/dsi-host" + }; + +for (i =0 ; i <ARRAY_SIZE (dsi_nodes); i++) { + nodeoff =fdt_path_offset (fdt, dsi_nodes[i]); +if (nodeoff >0 ) { +set_status: + ret = fdt_setprop(fdt, nodeoff,"status", status,
arch/arm/mach-imx/imx8m/soc.c +3
-0+ strlen(status) + 1); +if (ret == -FDT_ERR_NOSPACE ) { + ret = fdt_increase_size(fdt,512);
arch/arm/mach-imx/imx8m/soc.c +12
-0+if (!ret) + goto set_status; + } + } + } + } + +return 0 ; +} +#endif +#endif +#if !CONFIG_IS_ENABLED (SYSRESET )void reset_cpu (void ) {
Signature · 5 lines
PHYTEC Messtechnik GmbH | Robert-Koch-Str. 39 | 55129 Mainz, Germany Geschäftsführer: Dipl.-Ing. Michael Mitezki, Dipl.-Ing. Bodo Huber | Handelsregister Mainz HRB 4656 | Finanzamt Mainz | St.Nr. 266500608, DE 149059855
PATCH 3/4 imx: imx8m: soc: runtime drop extcon property from usbotg node
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
The extcon is an decrepted property and not used by upstream Linux and NXP 5.10 kernel, so we remove it before kicking linux in case it is in dts. Otherwise distro kernel will not able to have usb function.
--- arch/arm/mach-imx/imx8m/soc.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
arch/arm/mach-imx/imx8m/soc.c +33 -0
@@ -1146,6 +1146,37 @@ static int disable_cpu_nodes(void *blob, u32 disabled_cores)return 0 ; } +#if defined(CONFIG_IMX8MM ) +static int cleanup_nodes_for_efi (void *blob) +{ +static const char *const usbotg_path[] = { +"/soc@0/bus@32c00000/usb@32e40000" , +"/soc@0/bus@32c00000/usb@32e50000" + }; +int nodeoff, i, rc; + +for (i =0 ; i <ARRAY_SIZE (usbotg_path); i++) { + nodeoff =fdt_path_offset (blob, usbotg_path[i]); +if (nodeoff <0 ) +continue ;/* Not found, skip it */ +debug ("Found %s node\n" , usbotg_path[i]); + + rc =fdt_delprop (blob, nodeoff,"extcon" ); +if (rc == -FDT_ERR_NOTFOUND ) +continue ; +if (rc) { +printf ("Unable to update property %s:%s, err=%s\n" , + usbotg_path[i],"extcon" ,fdt_strerror (rc)); +return rc; + } + +printf ("Remove %s:%s\n" , usbotg_path[i],"extcon" ); + } + +return 0 ; +} +#endif +int ft_system_setup (void *blob,struct bd_info *bd) {#ifdef CONFIG_IMX8MQ
@@ -1240,6 +1271,8 @@ usb_modify_speed: else if (is_imx8mms() || is_imx8mmsl()) disable_cpu_nodes(blob, 3); +cleanup_nodes_for_efi (blob ); +#elif defined(CONFIG_IMX8MN )if (is_imx8mnl () ||is_imx8mndl () ||is_imx8mnsl ())disable_gpu_nodes (blob);
Signature · 1 line
2.30.0
PATCH 4/4 imx8m: soc: drop phy-reset-gpios for fec
In reply to Peng Fan (OSS)From: Peng Fan <[email protected]>
Need to drop phy-reset-gpios before booting linux, this property is legacy property and replaced with reset-gpios.
If provide both, kernel would failed to request the same gpio twice and cause fec not work.
--- arch/arm/mach-imx/imx8m/soc.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
arch/arm/mach-imx/imx8m/soc.c +13 -12
@@ -1149,28 +1149,30 @@ static int disable_cpu_nodes(void *blob, u32 disabled_cores)#if defined(CONFIG_IMX8MM )static int cleanup_nodes_for_efi (void *blob) { -static const char *const usbotg_path[] = { -"/soc@0/bus@32c00000/usb@32e40000" , -"/soc@0/bus@32c00000/usb@32e50000" - }; +static const char *const path[][2 ] = { + {"/soc@0/bus@32c00000/usb@32e40000" ,"extcon" }, + {"/soc@0/bus@32c00000/usb@32e50000" ,"extcon" }, + {"/soc@0/bus@30800000/ethernet@30be0000" ,"phy-reset-gpios" }, + {"/soc@0/bus@30800000/ethernet@30bf0000" ,"phy-reset-gpios" } + };int nodeoff, i, rc; -for (i =0 ; i <ARRAY_SIZE (usbotg_path); i++) { - nodeoff =fdt_path_offset (blob, usbotg_path[i]); +for (i =0 ; i <ARRAY_SIZE (path); i++) { + nodeoff =fdt_path_offset (blob, path[i][0 ]);if (nodeoff <0 )continue ;/* Not found, skip it */ -debug ("Found %s node\n" , usbotg_path[i]); +debug ("Found %s node\n" , path[i][0 ]); - rc =fdt_delprop (blob, nodeoff,"extcon" ); + rc =fdt_delprop (blob, nodeoff, path[i][1 ]);if (rc == -FDT_ERR_NOTFOUND )continue ;if (rc) {printf ("Unable to update property %s:%s, err=%s\n" , - usbotg_path[i],"extcon" ,fdt_strerror (rc)); + path[i][0 ], path[i][1 ],fdt_strerror (rc));return rc; } -printf ("Remove %s:%s\n" , usbotg_path[i],"extcon" ); +printf ("Remove %s:%s\n" , path[i][0 ], path[i][1 ]); }return 0 ;
@@ -1271,8 +1273,6 @@ usb_modify_speed: else if (is_imx8mms() || is_imx8mmsl()) disable_cpu_nodes(blob, 3); -cleanup_nodes_for_efi (blob ); -#elif defined(CONFIG_IMX8MN )if (is_imx8mnl () ||is_imx8mndl () ||is_imx8mnsl ())disable_gpu_nodes (blob);
@@ -1320,6 +1320,7 @@ usb_modify_speed:disable_cpu_nodes (blob,2 );#endif +cleanup_nodes_for_efi (blob); return 0; }#endif
Signature · 1 line
2.30.0