Add support for K3 BIST
Subsystems (3)
v4 cover Add support for K3 BIST
This series implements a driver for the BIST (Built-In Self Test) module for K3 devices. The BIST driver must ideally support triggering of BIST tests, both PBIST (Memory BIST) and LBIST (Logic BIST) on a core. Both tests are destructive in nature. Please see links [1] and [2] for further information regarding the two.
At boot up, BIST is executed by hardware for the MCU domain automatically as part of HW POST. So BIST has been checked only for the MCU domain when U-Boot comes up in the usual U-Boot to Linux boot flow. To facilitate the use-case where some safe firmware is intended to be run on a safe core, it is best to have triggered the BIST tests on that core. As an example, we take triggering the BIST tests on the MAIN R52_x cores. The triggering patch is kept as DONOTMERGE.
The general procedure for triggering BIST on a core is:
1. Power on the core under test following a sequence
2. Trigger the BIST test
3. Reset the core under test following a sequence
BIST tests are triggered from A72 SPL where the DM (Device Manager firmware that handles power management) is already up and can perform these power sequences for us.
dt-binding review in Kernel:
https://lore.kernel.org/all/[email protected]/
Boot logs (with LOG_DEBUG and CONFIG_K3_BIST enabled):
https://gist.github.com/nehamalcom/96b94d9b36f3a00e88a1442c55573331
Changes since v3:
-----------------
https://lore.kernel.org/all/[email protected]/
- Krzysztof (from dt-binding mailing list)
- use existing common definition (ti,sci-dev-id) from grabbing the device ID instead of a new property
- Udit
- add support for J742S2
- changes from v2 as well since v3 was kept on hold for ack on dt-binding first
- modified small code of LBIST MISR check to grab expected value of MISR from the appropriate register instead of hard coding the value
Changes since v2:
-----------------
https://lore.kernel.org/all/[email protected]/
- Udit
- code cleanup and minor optimizations
- reorder patch with DONOTMERGE at the end
- Manorit
- move MCU4_O BIST code into a separate function
Changes since v1:
-----------------
https://lore.kernel.org/all/[email protected]/
- Udit
- alignment and macro naming corrections
- move debug prints to printf for errors
- split to separate SoC BIST header file
- drop enabling CONFIG_K3_BIST by default (patch 3/4)
- unmark triggering of BIST as a DONOTMERGE patch
RFC:
----
https://lore.kernel.org/all/[email protected]/
[1] https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/sdl/sdl_docs/userguide/j721e/modules/pbist.html#introduction
[2] https://software-dl.ti.com/jacinto7/esd/processor-sdk-rtos-jacinto7/latest/exports/docs/sdl/sdl_docs/userguide/j721e/modules/lbist.html#introduction
Neha Malcom Francis (3):
drivers: misc: k3_bist: Add K3 BIST driver
arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
DONOTMERGE: arm: dts: k3-j784s4-j742s2-main-common: Add PBIST_14 node
arch/arm/mach-k3/j784s4/j784s4_init.c | 52 ++ drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/k3_bist.c | 807 ++++++++++++++++++ drivers/misc/k3_bist_static_data.h | 673 +++++++++++++++ drivers/misc/k3_j784s4_bist_static_data.h | 370 ++++++++ .../ti/k3-j784s4-j742s2-main-common.dtsi | 11 + include/k3_bist.h | 44 + 8 files changed, 1966 insertions(+) create mode 100644 drivers/misc/k3_bist.c create mode 100644 drivers/misc/k3_bist_static_data.h create mode 100644 drivers/misc/k3_j784s4_bist_static_data.h create mode 100644 include/k3_bist.h
Signature · 1 line
2.34.1
PATCH v4 1/3 drivers: misc: k3_bist: Add K3 BIST driver
Add a driver for the BIST module that support triggering of both PBIST (Memory BIST) and LBIST (Logic BIST) tests. Also expose the relevant operations and functions that would be required for an end user to trigger the tests.
---
Changes since v2 and v3:
- code cleanup and minor optimizations
- LBIST MISR calculation modified to pick up expected value for comparison in POST LBIST check instead of hard coding the value
- moved from using ti,sci-dev-id instead of ti,bist-under-test
drivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/k3_bist.c | 807 ++++++++++++++++++++++ drivers/misc/k3_bist_static_data.h | 673 ++++++++++++++++++ drivers/misc/k3_j784s4_bist_static_data.h | 370 ++++++++++ include/k3_bist.h | 44 ++ 6 files changed, 1903 insertions(+) create mode 100644 drivers/misc/k3_bist.c create mode 100644 drivers/misc/k3_bist_static_data.h create mode 100644 drivers/misc/k3_j784s4_bist_static_data.h create mode 100644 include/k3_bist.h
drivers/misc/Kconfig +8 -0
@@ -676,6 +676,14 @@ config ESM_K3 help Support ESM (Error Signaling Module) on TI K3 SoCs. +config K3_BIST + bool "Enable K3 BIST driver" + depends on ARCH_K3 + help + Support BIST (Built-In Self Test) module on TI K3 SoCs. This driver + supports running both PBIST (Memory BIST) and LBIST (Logic BIST) on + a region or IP in the SoC. + config MICROCHIP_FLEXCOM bool "Enable Microchip Flexcom driver" depends on MISC
drivers/misc/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_JZ4780_EFUSE) += jz4780_efuse.o obj-$(CONFIG_MICROCHIP_FLEXCOM) += microchip_flexcom.o obj-$(CONFIG_K3_AVS0) += k3_avs.o obj-$(CONFIG_ESM_K3) += k3_esm.o +obj-$(CONFIG_K3_BIST) += k3_bist.o obj-$(CONFIG_ESM_PMIC) += esm_pmic.o obj-$(CONFIG_SL28CPLD) += sl28cpld.o obj-$(CONFIG_SPL_SOCFPGA_DT_REG) += socfpga_dtreg.o
drivers/misc/k3_bist.c new file +807 -0
807 lines not on this page · raw message
drivers/misc/k3_bist_static_data.h new file +673 -0
673 lines not on this page · raw message
drivers/misc/k3_j784s4_bist_static_data.h new file +370 -0
370 lines not on this page · raw message
include/k3_bist.h new file +44 -0
44 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v4 1/3] drivers: misc: k3_bist: Add K3 BIST driver
Hi Neha,
Quoted 30 lines · Neha Malcom Francis
Add a driver for the BIST module that support triggering of both PBIST (Memory BIST) and LBIST (Logic BIST) tests. Also expose the relevant operations and functions that would be required for an end user to trigger the tests.
Signed-off-by Neha Malcom Francis <[email protected]>---
Changes since v2 and v3:
- code cleanup and minor optimizations
- LBIST MISR calculation modified to pick up expected value for comparison in POST LBIST check instead of hard coding the value
- moved from using ti,sci-dev-id instead of ti,bist-under-testdrivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/k3_bist.c | 807 ++++++++++++++++++++++ drivers/misc/k3_bist_static_data.h | 673 ++++++++++++++++++ drivers/misc/k3_j784s4_bist_static_data.h | 370 ++++++++++ include/k3_bist.h | 44 ++ 6 files changed, 1903 insertions(+) create mode 100644 drivers/misc/k3_bist.c create mode 100644 drivers/misc/k3_bist_static_data.h create mode 100644 drivers/misc/k3_j784s4_bist_static_data.h create mode 100644 include/k3_bist.hdrivers/misc/k3_bist.c new file +0
-0
[..]
Quoted 10 lines
drivers/misc/k3_bist.c new file +10
-0+/** +* pbist_neg_self_test() - Run PBIST_negTEST on specified cores +* @config: pbist_config_neg structure for PBIST negative test +* +* Function to run PBIST failure insertion test +* +* Return: 0 if all went fine, else corresponding error. +*/ +static int pbist_neg_self_test (struct pbist_config_neg *config) +{
[..]
drivers/misc/k3_bist.c line 225
Quoted 3 lines
drivers/misc/k3_bist.c new file +3
-0+/* Set Registers*/ +writel (0x00000001 , base +PBIST_RF0L ); +writel (0x00003123 , base +PBIST_RF0U );
Do these have some meaning or are they supposed to be hardcoded? Wondering if each bit corresponds to something then maybe we should make some FLAGS like PBIST_RF0U_XYZ | PBIST_RF0L_ABC to make it more readable but wondering if that'd be too much as well given soo many registers.. Don't have much idea about the IP but looking at this seems like way too much magic to me..
Quoted 23 lines
drivers/misc/k3_bist.c new file +23
-0+writel (0x0513FC02 , base +PBIST_RF1L ); +writel (0x00000002 , base +PBIST_RF1U ); +writel (0x00000003 , base +PBIST_RF2L ); +writel (0x00000000 , base +PBIST_RF2U ); +writel (0x00000004 , base +PBIST_RF3L ); +writel (0x00000028 , base +PBIST_RF3U ); +writel (0x64000044 , base +PBIST_RF4L ); +writel (0x00000000 , base +PBIST_RF4U ); +writel (0x0006A006 , base +PBIST_RF5L ); +writel (0x00000000 , base +PBIST_RF5U ); +writel (0x00000007 , base +PBIST_RF6L ); +writel (0x0000A0A0 , base +PBIST_RF6U ); +writel (0x00000008 , base +PBIST_RF7L ); +writel (0x00000064 , base +PBIST_RF7U ); +writel (0x00000009 , base +PBIST_RF8L ); +writel (0x0000A5A5 , base +PBIST_RF8U ); +writel (0x0000000A , base +PBIST_RF9L ); +writel (0x00000079 , base +PBIST_RF9U ); +writel (0x00000000 , base +PBIST_RF10L ); +writel (0x00000001 , base +PBIST_RF10U ); +writel (0xAAAAAAAA , base +PBIST_D ); +writel (0xAAAAAAAA , base +PBIST_E ); +
[..]
Quoted 10 lines
drivers/misc/k3_bist.c new file +10
-0+/** +* pbist_rom_self_test() - Run PBIST_ROM_TEST on specified cores +* @config: pbist_config_rom structure for PBIST negative test +* +* Function to run PBIST test of ROM +* +* Return: 0 if all went fine, else corresponding error. +*/ +static int pbist_rom_self_test (struct pbist_config_rom *config) +{
[..]
drivers/misc/k3_bist.c line 225
Quoted 4 lines
drivers/misc/k3_bist.c new file +4
-0+ +/* Set Registers*/ +writel (0x00000001 , base +PBIST_RF0L ); +writel (0x00003123 , base +PBIST_RF0U );
Same..
Quoted 9 lines
drivers/misc/k3_bist.c new file +9
-0+writel (0x7A400183 , base +PBIST_RF1L ); +writel (0x00000060 , base +PBIST_RF1U ); +writel (0x00000184 , base +PBIST_RF2L ); +writel (0x00000000 , base +PBIST_RF2U ); +writel (0x7B600181 , base +PBIST_RF3L ); +writel (0x00000061 , base +PBIST_RF3U ); +writel (0x00000000 , base +PBIST_RF4L ); +writel (0x00000000 , base +PBIST_RF4U ); +
[..]
drivers/misc/k3_bist.c line 565
Quoted 13 lines
drivers/misc/k3_bist.c new file +13
-0+int prepare_pbist (struct ti_sci_handle *handle) +{ +struct ti_sci_proc_ops *proc_ops = &handle->ops.proc_ops; +struct ti_sci_dev_ops *dev_ops = &handle->ops.dev_ops; +struct pbist_inst_info *info_pbist = k3_bist_priv->pbist_info; +struct core_under_test *cut = info_pbist->cut; + +if (proc_ops->proc_request (handle, cut[0 ].proc_id)) { +printf ("%s: requesting primary core failed\n" , __func__); +return -EINVAL ; + } + +if (proc_ops->proc_request (handle, cut[1 ].proc_id)) {
Do we get any return code from these? If yes, then ig better to do ret = proc_ops->proc_request(handle, cut[1].proc_id))
and maybe print that value in printf as well which might help in debugging
Quoted 32 lines
drivers/misc/k3_bist.c new file +32
-0+printf ("%s: requesting secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->set_device_resets (handle, cut[0 ].dev_id,0x1 )) { +printf ("%s: local reset primary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->set_device_resets (handle, cut[1 ].dev_id,0x1 )) { +printf ("%s: local reset secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, cut[0 ].dev_id)) { +printf ("%s: power on primary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, cut[1 ].dev_id)) { +printf ("%s: power on secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, info_pbist->dev_id)) { +printf ("%s: power on PBIST failed\n" , __func__); +return -EINVAL ; + } + +return 0 ; +} +
[..]
Quoted 9 lines
drivers/misc/k3_j784s4_bist_static_data.h new file +3
-0@@ -0,0 +1,370 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Static Data for Texas Instruments' BIST logic for J784S4
drivers/misc/k3_j784s4_bist_static_data.h line 13
Quoted 10 lines
drivers/misc/k3_j784s4_bist_static_data.h new file +10
-0+* +* Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ +* +*/ + +/* Device IDs of IPs that can be tested under BIST */ +#define TISCI_DEV_MCU_R5FSS2_CORE0 343 +#define TISCI_DEV_MCU_R5FSS2_CORE1 344 +#define TISCI_DEV_RTI32 365 +#define TISCI_DEV_RTI33 366
Unused?
[..]
Quoted 9 lines
include/k3_bist.h new file +3
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Texas Instruments' BIST (Built-In Self-Test) driver
include/k3_bist.h line 13
Quoted 10 lines
include/k3_bist.h new file +10
-0+* +* Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ +* Neha Malcom Francis <[email protected]> +* +*/ + +#ifndef _INCLUDE_BIST_H_ +#define _INCLUDE_BIST_H_ + +#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001
Unused?
include/k3_bist.h line 16
Quoted 4 lines
include/k3_bist.h new file +3
-0+#define PROC_ID_MCU_R5FSS2_CORE0 0x0A +#define PROC_ID_MCU_R5FSS2_CORE1 0x0B +#define PROC_BOOT_CTRL_FLAG_R5_LPSC 0x00000002
Unused?
include/k3_bist.h line 26
Quoted 11 lines
include/k3_bist.h new file +10
-0+ +#define TISCI_DEV_PBIST14 237 +#define TISCI_DEV_R5FSS2_CORE0 343 +#define TISCI_DEV_R5FSS2_CORE1 344 + +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_AUTO_OFF 0 +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_RETENTION 1 +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_ON 2 + +#define TISCI_BIT (n) ((1) << (n))
Unused? Also wondering that maybe these shouldn't even be here.. they are tisci related..
Quoted 21 lines
include/k3_bist.h new file +18
-0+ +struct bist_ops { +int (*run_lbist)(void ); +int (*run_lbist_post)(void ); +int (*run_pbist_post)(void ); +int (*run_pbist_neg)(void ); +int (*run_pbist_rom)(void ); +int (*run_pbist)(void ); +}; + +void lbist_enable_isolation (void ); +void lbist_disable_isolation (void ); +int prepare_pbist (struct ti_sci_handle *handle); +int deprepare_pbist (struct ti_sci_handle *handle); +int prepare_lbist (struct ti_sci_handle *handle); +int deprepare_lbist (struct ti_sci_handle *handle); + +#endif /* _INCLUDE_BIST_H_ */ Signature · 1 line
2.34.1
Regards,
Manorit
Re: [PATCH v4 1/3] drivers: misc: k3_bist: Add K3 BIST driver
Hi Manorit
Quoted 45 lines · Manorit Chawdhry
Hi Neha,
Quoted 30 lines · Neha Malcom Francis
Add a driver for the BIST module that support triggering of both PBIST (Memory BIST) and LBIST (Logic BIST) tests. Also expose the relevant operations and functions that would be required for an end user to trigger the tests.
Signed-off-by Neha Malcom Francis <[email protected]>---
Changes since v2 and v3:
- code cleanup and minor optimizations
- LBIST MISR calculation modified to pick up expected value for comparison in POST LBIST check instead of hard coding the value
- moved from using ti,sci-dev-id instead of ti,bist-under-testdrivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/k3_bist.c | 807 ++++++++++++++++++++++ drivers/misc/k3_bist_static_data.h | 673 ++++++++++++++++++ drivers/misc/k3_j784s4_bist_static_data.h | 370 ++++++++++ include/k3_bist.h | 44 ++ 6 files changed, 1903 insertions(+) create mode 100644 drivers/misc/k3_bist.c create mode 100644 drivers/misc/k3_bist_static_data.h create mode 100644 drivers/misc/k3_j784s4_bist_static_data.h create mode 100644 include/k3_bist.hdrivers/misc/k3_bist.c new file +0
-0[..]
Quoted 10 lines
drivers/misc/k3_bist.c new file +10
-0+/** +* pbist_neg_self_test() - Run PBIST_negTEST on specified cores +* @config: pbist_config_neg structure for PBIST negative test +* +* Function to run PBIST failure insertion test +* +* Return: 0 if all went fine, else corresponding error. +*/ +static int pbist_neg_self_test (struct pbist_config_neg *config) +{[..]
Quoted 10 lines
drivers/misc/k3_bist.c line 225
Quoted 3 lines
drivers/misc/k3_bist.c new file +3
-0+/* Set Registers*/ +writel (0x00000001 , base +PBIST_RF0L ); +writel (0x00003123 , base +PBIST_RF0U );Do these have some meaning or are they supposed to be hardcoded? Wondering if each bit corresponds to something then maybe we should make some FLAGS like
PBIST_RF0U_XYZ|PBIST_RF0L_ABCto make it more readable but wondering if that'd be too much as well given soo many registers.. Don't have much idea about the IP but looking at this seems like way too much magic to me..
This is an entirely hardware driven sequence with no publicly known bitwise meaning as I had mentioned in an earlier review as well [0]. Values that do have a meaning have been put into macros, however for these sequences other than creating new generic macro names I am not sure what else to do.
Quoted 62 lines
Quoted 24 lines
drivers/misc/k3_bist.c new file +23
-0+writel (0x0513FC02 , base +PBIST_RF1L ); +writel (0x00000002 , base +PBIST_RF1U ); +writel (0x00000003 , base +PBIST_RF2L ); +writel (0x00000000 , base +PBIST_RF2U ); +writel (0x00000004 , base +PBIST_RF3L ); +writel (0x00000028 , base +PBIST_RF3U ); +writel (0x64000044 , base +PBIST_RF4L ); +writel (0x00000000 , base +PBIST_RF4U ); +writel (0x0006A006 , base +PBIST_RF5L ); +writel (0x00000000 , base +PBIST_RF5U ); +writel (0x00000007 , base +PBIST_RF6L ); +writel (0x0000A0A0 , base +PBIST_RF6U ); +writel (0x00000008 , base +PBIST_RF7L ); +writel (0x00000064 , base +PBIST_RF7U ); +writel (0x00000009 , base +PBIST_RF8L ); +writel (0x0000A5A5 , base +PBIST_RF8U ); +writel (0x0000000A , base +PBIST_RF9L ); +writel (0x00000079 , base +PBIST_RF9U ); +writel (0x00000000 , base +PBIST_RF10L ); +writel (0x00000001 , base +PBIST_RF10U ); +writel (0xAAAAAAAA , base +PBIST_D ); +writel (0xAAAAAAAA , base +PBIST_E ); +[..]
Quoted 10 lines
drivers/misc/k3_bist.c new file +10
-0+/** +* pbist_rom_self_test() - Run PBIST_ROM_TEST on specified cores +* @config: pbist_config_rom structure for PBIST negative test +* +* Function to run PBIST test of ROM +* +* Return: 0 if all went fine, else corresponding error. +*/ +static int pbist_rom_self_test (struct pbist_config_rom *config) +{[..]
drivers/misc/k3_bist.c line 225
Quoted 4 lines
drivers/misc/k3_bist.c new file +4
-0+ +/* Set Registers*/ +writel (0x00000001 , base +PBIST_RF0L ); +writel (0x00003123 , base +PBIST_RF0U );Same..
Quoted 9 lines
drivers/misc/k3_bist.c new file +9
-0+writel (0x7A400183 , base +PBIST_RF1L ); +writel (0x00000060 , base +PBIST_RF1U ); +writel (0x00000184 , base +PBIST_RF2L ); +writel (0x00000000 , base +PBIST_RF2U ); +writel (0x7B600181 , base +PBIST_RF3L ); +writel (0x00000061 , base +PBIST_RF3U ); +writel (0x00000000 , base +PBIST_RF4L ); +writel (0x00000000 , base +PBIST_RF4U ); +[..]
Quoted 9 lines
drivers/misc/k3_bist.c new file +9
-0+int prepare_pbist (struct ti_sci_handle *handle) +{ +struct ti_sci_proc_ops *proc_ops = &handle->ops.proc_ops; +struct ti_sci_dev_ops *dev_ops = &handle->ops.dev_ops; +struct pbist_inst_info *info_pbist = k3_bist_priv->pbist_info; +struct core_under_test *cut = info_pbist->cut; + +if (proc_ops->proc_request (handle, cut[0 ].proc_id)) { +printf ("%s: requesting primary core failed\n" , __func__);
Quoted 8 lines
drivers/misc/k3_bist.c line 565
Quoted 4 lines
drivers/misc/k3_bist.c new file +4
-0+return -EINVAL ; + } + +if (proc_ops->proc_request (handle, cut[1 ].proc_id)) {Do we get any return code from these? If yes, then ig better to do ret =
proc_ops->proc_request(handle, cut[1].proc_id))
and maybe print that value in printf as well which might help in debugging
I was doing that in an earlier revision [1] but moved to optimizing the code ignoring this ret value.
Quoted 47 lines
Quoted 33 lines
drivers/misc/k3_bist.c new file +32
-0+printf ("%s: requesting secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->set_device_resets (handle, cut[0 ].dev_id,0x1 )) { +printf ("%s: local reset primary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->set_device_resets (handle, cut[1 ].dev_id,0x1 )) { +printf ("%s: local reset secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, cut[0 ].dev_id)) { +printf ("%s: power on primary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, cut[1 ].dev_id)) { +printf ("%s: power on secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, info_pbist->dev_id)) { +printf ("%s: power on PBIST failed\n" , __func__); +return -EINVAL ; + } + +return 0 ; +} +[..]
Quoted 13 lines
drivers/misc/k3_j784s4_bist_static_data.h new file +7
-0@@ -0,0 +1,370 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Static Data for Texas Instruments' BIST logic for J784S4 +* +* Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ +* +*/
Quoted 8 lines
drivers/misc/k3_j784s4_bist_static_data.h line 13
Quoted 6 lines
drivers/misc/k3_j784s4_bist_static_data.h new file +6
-0+ +/* Device IDs of IPs that can be tested under BIST */ +#define TISCI_DEV_MCU_R5FSS2_CORE0 343 +#define TISCI_DEV_MCU_R5FSS2_CORE1 344 +#define TISCI_DEV_RTI32 365 +#define TISCI_DEV_RTI33 366Unused?
Will clean up the unused macros thanks for catching these.
Quoted 37 lines
[..]
Quoted 9 lines
include/k3_bist.h new file +3
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Texas Instruments' BIST (Built-In Self-Test) driver include/k3_bist.h line 13
Quoted 10 lines
include/k3_bist.h new file +10
-0+* +* Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ +* Neha Malcom Francis <[email protected]> +* +*/ + +#ifndef _INCLUDE_BIST_H_ +#define _INCLUDE_BIST_H_ + +#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001Unused?
include/k3_bist.h line 16
Quoted 4 lines
include/k3_bist.h new file +3
-0+#define PROC_ID_MCU_R5FSS2_CORE0 0x0A +#define PROC_ID_MCU_R5FSS2_CORE1 0x0B +#define PROC_BOOT_CTRL_FLAG_R5_LPSC 0x00000002Unused?
Quoted 4 lines
include/k3_bist.h new file +4
-0+ +#define TISCI_DEV_PBIST14 237 +#define TISCI_DEV_R5FSS2_CORE0 343 +#define TISCI_DEV_R5FSS2_CORE1 344
Quoted 9 lines
include/k3_bist.h line 26
Quoted 6 lines
include/k3_bist.h new file +6
-0+ +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_AUTO_OFF 0 +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_RETENTION 1 +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_ON 2 + +#define TISCI_BIT (n) ((1) << (n))Unused? Also wondering that maybe these shouldn't even be here.. they are tisci related..
Sorry for these, missed cleaning them out after moving to using ti_sci_proc_ops (see prepare_pbist() and prepare_lbist())
Will clean up these stray macros.
Quoted 17 lines
Quoted 17 lines
include/k3_bist.h new file +16
-0+ +struct bist_ops { +int (*run_lbist)(void ); +int (*run_lbist_post)(void ); +int (*run_pbist_post)(void ); +int (*run_pbist_neg)(void ); +int (*run_pbist_rom)(void ); +int (*run_pbist)(void ); +}; + +void lbist_enable_isolation (void ); +void lbist_disable_isolation (void ); +int prepare_pbist (struct ti_sci_handle *handle); +int deprepare_pbist (struct ti_sci_handle *handle); +int prepare_lbist (struct ti_sci_handle *handle); +int deprepare_lbist (struct ti_sci_handle *handle);
Quoted 8 lines
Quoted 5 lines
include/k3_bist.h new file +2
-0+ +#endif /* _INCLUDE_BIST_H_ */ Signature · 1 line
2.34.1Regards,
Manorit
[0] https://lore.kernel.org/all/[email protected]/
[1] https://lore.kernel.org/all/[email protected]/
Signature · 2 lines
Thanking You Neha Malcom Francis
Re: [PATCH v4 1/3] drivers: misc: k3_bist: Add K3 BIST driver
Hi Neha,
Quoted 59 lines · Neha Malcom Francis
Hi Manorit
Quoted 45 lines · Manorit Chawdhry
Hi Neha,
Quoted 30 lines · Neha Malcom Francis
Add a driver for the BIST module that support triggering of both PBIST (Memory BIST) and LBIST (Logic BIST) tests. Also expose the relevant operations and functions that would be required for an end user to trigger the tests.
Signed-off-by Neha Malcom Francis <[email protected]>---
Changes since v2 and v3:
- code cleanup and minor optimizations
- LBIST MISR calculation modified to pick up expected value for comparison in POST LBIST check instead of hard coding the value
- moved from using ti,sci-dev-id instead of ti,bist-under-testdrivers/misc/Kconfig | 8 + drivers/misc/Makefile | 1 + drivers/misc/k3_bist.c | 807 ++++++++++++++++++++++ drivers/misc/k3_bist_static_data.h | 673 ++++++++++++++++++ drivers/misc/k3_j784s4_bist_static_data.h | 370 ++++++++++ include/k3_bist.h | 44 ++ 6 files changed, 1903 insertions(+) create mode 100644 drivers/misc/k3_bist.c create mode 100644 drivers/misc/k3_bist_static_data.h create mode 100644 drivers/misc/k3_j784s4_bist_static_data.h create mode 100644 include/k3_bist.hdrivers/misc/k3_bist.c new file +0
-0[..]
Quoted 10 lines
drivers/misc/k3_bist.c new file +10
-0+/** +* pbist_neg_self_test() - Run PBIST_negTEST on specified cores +* @config: pbist_config_neg structure for PBIST negative test +* +* Function to run PBIST failure insertion test +* +* Return: 0 if all went fine, else corresponding error. +*/ +static int pbist_neg_self_test (struct pbist_config_neg *config) +{[..]
Quoted 10 lines
drivers/misc/k3_bist.c line 225
Quoted 3 lines
drivers/misc/k3_bist.c new file +3
-0+/* Set Registers*/ +writel (0x00000001 , base +PBIST_RF0L ); +writel (0x00003123 , base +PBIST_RF0U );Do these have some meaning or are they supposed to be hardcoded? Wondering if each bit corresponds to something then maybe we should make some FLAGS like
PBIST_RF0U_XYZ|PBIST_RF0L_ABCto make it more readable but wondering if that'd be too much as well given soo many registers.. Don't have much idea about the IP but looking at this seems like way too much magic to me..
Quoted 6 lines
This is an entirely hardware driven sequence with no publicly known bitwise meaning as I had mentioned in an earlier review as well [0]. Values that do have a meaning have been put into macros, however for these sequences other than creating new generic macro names I am not sure what else to do.
Apologies for missing out in previous reviews, thanks for sharing!
Quoted 71 lines
Quoted 62 lines
Quoted 24 lines
drivers/misc/k3_bist.c new file +23
-0+writel (0x0513FC02 , base +PBIST_RF1L ); +writel (0x00000002 , base +PBIST_RF1U ); +writel (0x00000003 , base +PBIST_RF2L ); +writel (0x00000000 , base +PBIST_RF2U ); +writel (0x00000004 , base +PBIST_RF3L ); +writel (0x00000028 , base +PBIST_RF3U ); +writel (0x64000044 , base +PBIST_RF4L ); +writel (0x00000000 , base +PBIST_RF4U ); +writel (0x0006A006 , base +PBIST_RF5L ); +writel (0x00000000 , base +PBIST_RF5U ); +writel (0x00000007 , base +PBIST_RF6L ); +writel (0x0000A0A0 , base +PBIST_RF6U ); +writel (0x00000008 , base +PBIST_RF7L ); +writel (0x00000064 , base +PBIST_RF7U ); +writel (0x00000009 , base +PBIST_RF8L ); +writel (0x0000A5A5 , base +PBIST_RF8U ); +writel (0x0000000A , base +PBIST_RF9L ); +writel (0x00000079 , base +PBIST_RF9U ); +writel (0x00000000 , base +PBIST_RF10L ); +writel (0x00000001 , base +PBIST_RF10U ); +writel (0xAAAAAAAA , base +PBIST_D ); +writel (0xAAAAAAAA , base +PBIST_E ); +[..]
Quoted 10 lines
drivers/misc/k3_bist.c new file +10
-0+/** +* pbist_rom_self_test() - Run PBIST_ROM_TEST on specified cores +* @config: pbist_config_rom structure for PBIST negative test +* +* Function to run PBIST test of ROM +* +* Return: 0 if all went fine, else corresponding error. +*/ +static int pbist_rom_self_test (struct pbist_config_rom *config) +{[..]
drivers/misc/k3_bist.c line 225
Quoted 4 lines
drivers/misc/k3_bist.c new file +4
-0+ +/* Set Registers*/ +writel (0x00000001 , base +PBIST_RF0L ); +writel (0x00003123 , base +PBIST_RF0U );Same..
Quoted 9 lines
drivers/misc/k3_bist.c new file +9
-0+writel (0x7A400183 , base +PBIST_RF1L ); +writel (0x00000060 , base +PBIST_RF1U ); +writel (0x00000184 , base +PBIST_RF2L ); +writel (0x00000000 , base +PBIST_RF2U ); +writel (0x7B600181 , base +PBIST_RF3L ); +writel (0x00000061 , base +PBIST_RF3U ); +writel (0x00000000 , base +PBIST_RF4L ); +writel (0x00000000 , base +PBIST_RF4U ); +[..]
Quoted 9 lines
drivers/misc/k3_bist.c new file +9
-0+int prepare_pbist (struct ti_sci_handle *handle) +{ +struct ti_sci_proc_ops *proc_ops = &handle->ops.proc_ops; +struct ti_sci_dev_ops *dev_ops = &handle->ops.dev_ops; +struct pbist_inst_info *info_pbist = k3_bist_priv->pbist_info; +struct core_under_test *cut = info_pbist->cut; + +if (proc_ops->proc_request (handle, cut[0 ].proc_id)) { +printf ("%s: requesting primary core failed\n" , __func__);Quoted 8 lines
drivers/misc/k3_bist.c line 565
Quoted 4 lines
drivers/misc/k3_bist.c new file +4
-0+return -EINVAL ; + } + +if (proc_ops->proc_request (handle, cut[1 ].proc_id)) {Do we get any return code from these? If yes, then ig better to do ret =
proc_ops->proc_request(handle, cut[1].proc_id))
and maybe print that value in printf as well which might help in debugging
Quoted 2 lines
I was doing that in an earlier revision [1] but moved to optimizing the code ignoring this ret value.
Ahh, that is bad.
Though just looked at the TI-SCI code, most of it also returns EINVAL only so maybe it might still be okay but I think next time onwards, it might be better to keep the ret behaviour. Incase something changes in other layers to give different error codes, then that would get propagated here as well and it would be helpful during failure cases but okay for now.
Missed looking at this comment in Udit's reviews that time unfortunately.
Quoted 136 lines
Quoted 48 lines
Quoted 34 lines
drivers/misc/k3_bist.c new file +32
-0+printf ("%s: requesting secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->set_device_resets (handle, cut[0 ].dev_id,0x1 )) { +printf ("%s: local reset primary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->set_device_resets (handle, cut[1 ].dev_id,0x1 )) { +printf ("%s: local reset secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, cut[0 ].dev_id)) { +printf ("%s: power on primary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, cut[1 ].dev_id)) { +printf ("%s: power on secondary core failed\n" , __func__); +return -EINVAL ; + } + +if (dev_ops->get_device (handle, info_pbist->dev_id)) { +printf ("%s: power on PBIST failed\n" , __func__); +return -EINVAL ; + } + +return 0 ; +} +[..]
Quoted 13 lines
drivers/misc/k3_j784s4_bist_static_data.h new file +7
-0@@ -0,0 +1,370 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Static Data for Texas Instruments' BIST logic for J784S4 +* +* Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ +* +*/ Quoted 8 lines
drivers/misc/k3_j784s4_bist_static_data.h line 13
Quoted 6 lines
drivers/misc/k3_j784s4_bist_static_data.h new file +6
-0+ +/* Device IDs of IPs that can be tested under BIST */ +#define TISCI_DEV_MCU_R5FSS2_CORE0 343 +#define TISCI_DEV_MCU_R5FSS2_CORE1 344 +#define TISCI_DEV_RTI32 365 +#define TISCI_DEV_RTI33 366Unused?
Will clean up the unused macros thanks for catching these.
Quoted 37 lines
[..]
Quoted 9 lines
include/k3_bist.h new file +3
-0@@ -0,0 +1,44 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Texas Instruments' BIST (Built-In Self-Test) driver include/k3_bist.h line 13
Quoted 10 lines
include/k3_bist.h new file +10
-0+* +* Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/ +* Neha Malcom Francis <[email protected]> +* +*/ + +#ifndef _INCLUDE_BIST_H_ +#define _INCLUDE_BIST_H_ + +#define PROC_BOOT_CTRL_FLAG_R5_CORE_HALT 0x00000001Unused?
include/k3_bist.h line 16
Quoted 4 lines
include/k3_bist.h new file +3
-0+#define PROC_ID_MCU_R5FSS2_CORE0 0x0A +#define PROC_ID_MCU_R5FSS2_CORE1 0x0B +#define PROC_BOOT_CTRL_FLAG_R5_LPSC 0x00000002Unused?
Quoted 4 lines
include/k3_bist.h new file +4
-0+ +#define TISCI_DEV_PBIST14 237 +#define TISCI_DEV_R5FSS2_CORE0 343 +#define TISCI_DEV_R5FSS2_CORE1 344Quoted 9 lines
include/k3_bist.h line 26
Quoted 6 lines
include/k3_bist.h new file +6
-0+ +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_AUTO_OFF 0 +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_RETENTION 1 +#define TISCI_MSG_VALUE_DEVICE_SW_STATE_ON 2 + +#define TISCI_BIT (n) ((1) << (n))Unused? Also wondering that maybe these shouldn't even be here.. they are tisci related..
Sorry for these, missed cleaning them out after moving to using
ti_sci_proc_ops(seeprepare_pbist()andprepare_lbist())Will clean up these stray macros.
Quoted 17 lines
Quoted 17 lines
include/k3_bist.h new file +16
-0+ +struct bist_ops { +int (*run_lbist)(void ); +int (*run_lbist_post)(void ); +int (*run_pbist_post)(void ); +int (*run_pbist_neg)(void ); +int (*run_pbist_rom)(void ); +int (*run_pbist)(void ); +}; + +void lbist_enable_isolation (void ); +void lbist_disable_isolation (void ); +int prepare_pbist (struct ti_sci_handle *handle); +int deprepare_pbist (struct ti_sci_handle *handle); +int prepare_lbist (struct ti_sci_handle *handle); +int deprepare_lbist (struct ti_sci_handle *handle);Quoted 8 lines
Quoted 5 lines
include/k3_bist.h new file +2
-0+ +#endif /* _INCLUDE_BIST_H_ */ Signature · 1 line
2.34.1Regards,
Manorit
Quoted 6 lines
[0] https://lore.kernel.org/all/[email protected]/
[1] https://lore.kernel.org/all/[email protected]/Signature · 2 lines
Thanking You Neha Malcom Francis
Regards,
Manorit
PATCH v4 2/3 arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
In reply to Neha Malcom FrancisTrigger all tests of PBIST and LBIST using appropriate calls to set the core under test (MAIN R5 2_0) to it's required state.
---
No change since v3
arch/arm/mach-k3/j784s4/j784s4_init.c | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
arch/arm/mach-k3/j784s4/j784s4_init.c +52 -0
@@ -17,6 +17,7 @@#include <dm/pinctrl.h> #include <mmc.h> #include <remoteproc.h> +#include <k3_bist.h> #include "../sysfw-loader.h" #include "../common.h"
@@ -122,6 +123,48 @@ static void setup_navss_nb(void)writel (NB_THREADMAP_BIT2 , (uintptr_t )NAVSS0_NBSS_NB1_CFG_NB_THREADMAP ); } +/* Execute and check results of BIST executed on MCU1_x and MCU4_O */ +static void run_bist_j784s4 (struct udevice *dev) +{ +struct bist_ops *ops; +struct ti_sci_handle *handle; +int ret; + + ops = (struct bist_ops *)device_get_ops (dev); + handle =get_ti_sci_handle (); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_pbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger PBIST tests on MCU4_0 */ + ret =prepare_pbist (handle); + ret |= ops->run_pbist_neg (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist_rom (); + ret |=deprepare_pbist (handle); + +if (ret) +panic ("PBIST on MCU4_0 failed: %d\n" , ret); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_lbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger LBIST tests on MCU1_x */ + ret =prepare_lbist (handle); + ret |= ops->run_lbist (); + ret |=deprepare_lbist (handle); +if (ret) +panic ("LBIST on MCU4_0 failed: %d\n" , ret); +} +/* * This uninitialized global variable would normal end up in the .bss section, * but the .bss is cleared between writing and reading this variable, so move
@@ -251,6 +294,15 @@ void board_init_f(ulong dummy)printf ("AVS init failed: %d\n" , ret); } +if (!IS_ENABLED (CONFIG_CPU_V7R ) &&IS_ENABLED (CONFIG_K3_BIST )) { + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (k3_bist), + &dev); +if (ret) +panic ("Failed to get BIST device: %d\n" , ret); +run_bist_j784s4 (dev); + } +if (IS_ENABLED (CONFIG_CPU_V7R ))setup_navss_nb ();
Signature · 1 line
2.34.1
Re: [PATCH v4 2/3] arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
Hi Neha,
Quoted 72 lines · Neha Malcom Francis
Trigger all tests of PBIST and LBIST using appropriate calls to set the core under test (MAIN R5 2_0) to it's required state.
Signed-off-by Neha Malcom Francis <[email protected]>---
No change since v3arch/arm/mach-k3/j784s4/j784s4_init.c | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)arch/arm/mach-k3/j784s4/j784s4_init.c +43
-0@@ -17,6 +17,7 @@#include <dm/pinctrl.h> #include <mmc.h> #include <remoteproc.h> +#include <k3_bist.h> #include "../sysfw-loader.h" #include "../common.h" @@ -122,6 +123,48 @@ static void setup_navss_nb(void)writel (NB_THREADMAP_BIT2 , (uintptr_t )NAVSS0_NBSS_NB1_CFG_NB_THREADMAP ); } +/* Execute and check results of BIST executed on MCU1_x and MCU4_O */ +static void run_bist_j784s4 (struct udevice *dev) +{ +struct bist_ops *ops; +struct ti_sci_handle *handle; +int ret; + + ops = (struct bist_ops *)device_get_ops (dev); + handle =get_ti_sci_handle (); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_pbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger PBIST tests on MCU4_0 */ + ret =prepare_pbist (handle); + ret |= ops->run_pbist_neg (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist_rom (); + ret |=deprepare_pbist (handle); + +if (ret) +panic ("PBIST on MCU4_0 failed: %d\n" , ret); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_lbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger LBIST tests on MCU1_x */ + ret =prepare_lbist (handle); + ret |= ops->run_lbist (); + ret |=deprepare_lbist (handle); +if (ret) +panic ("LBIST on MCU4_0 failed: %d\n" , ret); +} +/* * This uninitialized global variable would normal end up in the .bss section, * but the .bss is cleared between writing and reading this variable, so move
arch/arm/mach-k3/j784s4/j784s4_init.c void board_init_f(ulong dummy) · line 302
Quoted 9 lines
arch/arm/mach-k3/j784s4/j784s4_init.c +6
-0@@ -251,6 +294,15 @@ void board_init_f(ulong dummy)printf ("AVS init failed: %d\n" , ret); } +if (!IS_ENABLED (CONFIG_CPU_V7R ) &&IS_ENABLED (CONFIG_K3_BIST )) { + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (k3_bist), + &dev); +if (ret) +panic ("Failed to get BIST device: %d\n" , ret);
nit: Add "\n" here
Quoted 9 lines
arch/arm/mach-k3/j784s4/j784s4_init.c +3
-0+run_bist_j784s4 (dev); + } +if (IS_ENABLED (CONFIG_CPU_V7R ))setup_navss_nb ();Signature · 1 line
2.34.1
Regards,
Manorit
Re: [PATCH v4 2/3] arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
Quoted 78 lines · Manorit Chawdhry
Hi Neha,
Quoted 75 lines · Neha Malcom Francis
Trigger all tests of PBIST and LBIST using appropriate calls to set the core under test (MAIN R5 2_0) to it's required state.
Signed-off-by Neha Malcom Francis <[email protected]>---
No change since v3arch/arm/mach-k3/j784s4/j784s4_init.c | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)arch/arm/mach-k3/j784s4/j784s4_init.c +43
-0@@ -17,6 +17,7 @@#include <dm/pinctrl.h> #include <mmc.h> #include <remoteproc.h> +#include <k3_bist.h> #include "../sysfw-loader.h" #include "../common.h" @@ -122,6 +123,48 @@ static void setup_navss_nb(void)writel (NB_THREADMAP_BIT2 , (uintptr_t )NAVSS0_NBSS_NB1_CFG_NB_THREADMAP ); } +/* Execute and check results of BIST executed on MCU1_x and MCU4_O */ +static void run_bist_j784s4 (struct udevice *dev) +{ +struct bist_ops *ops; +struct ti_sci_handle *handle; +int ret; + + ops = (struct bist_ops *)device_get_ops (dev); + handle =get_ti_sci_handle (); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_pbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger PBIST tests on MCU4_0 */ + ret =prepare_pbist (handle); + ret |= ops->run_pbist_neg (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist_rom (); + ret |=deprepare_pbist (handle); + +if (ret) +panic ("PBIST on MCU4_0 failed: %d\n" , ret); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_lbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger LBIST tests on MCU1_x */ + ret =prepare_lbist (handle); + ret |= ops->run_lbist (); + ret |=deprepare_lbist (handle); +if (ret) +panic ("LBIST on MCU4_0 failed: %d\n" , ret); +} +/* * This uninitialized global variable would normal end up in the .bss section, * but the .bss is cleared between writing and reading this variable, so move @@ -251,6 +294,15 @@ void board_init_f(ulong dummy)printf ("AVS init failed: %d\n" , ret); }
Quoted 8 lines
arch/arm/mach-k3/j784s4/j784s4_init.c void board_init_f(ulong dummy) · line 302
Quoted 6 lines
arch/arm/mach-k3/j784s4/j784s4_init.c +6
-0+if (!IS_ENABLED (CONFIG_CPU_V7R ) &&IS_ENABLED (CONFIG_K3_BIST )) { + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (k3_bist), + &dev); +if (ret) +panic ("Failed to get BIST device: %d\n" , ret);nit: Add "\n" here
Didn't get you, there is already a "\n" here?
Quoted 13 lines
Quoted 10 lines
arch/arm/mach-k3/j784s4/j784s4_init.c +3
-0+run_bist_j784s4 (dev); + } +if (IS_ENABLED (CONFIG_CPU_V7R ))setup_navss_nb ();Signature · 1 line
2.34.1Regards,
Manorit
Signature · 2 lines
Thanking You Neha Malcom Francis
Re: [PATCH v4 2/3] arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
Hi Neha,
Quoted 88 lines · Neha Malcom Francis
Quoted 78 lines · Manorit Chawdhry
Hi Neha,
Quoted 75 lines · Neha Malcom Francis
Trigger all tests of PBIST and LBIST using appropriate calls to set the core under test (MAIN R5 2_0) to it's required state.
Signed-off-by Neha Malcom Francis <[email protected]>---
No change since v3arch/arm/mach-k3/j784s4/j784s4_init.c | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)arch/arm/mach-k3/j784s4/j784s4_init.c +43
-0@@ -17,6 +17,7 @@#include <dm/pinctrl.h> #include <mmc.h> #include <remoteproc.h> +#include <k3_bist.h> #include "../sysfw-loader.h" #include "../common.h" @@ -122,6 +123,48 @@ static void setup_navss_nb(void)writel (NB_THREADMAP_BIT2 , (uintptr_t )NAVSS0_NBSS_NB1_CFG_NB_THREADMAP ); } +/* Execute and check results of BIST executed on MCU1_x and MCU4_O */ +static void run_bist_j784s4 (struct udevice *dev) +{ +struct bist_ops *ops; +struct ti_sci_handle *handle; +int ret; + + ops = (struct bist_ops *)device_get_ops (dev); + handle =get_ti_sci_handle (); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_pbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger PBIST tests on MCU4_0 */ + ret =prepare_pbist (handle); + ret |= ops->run_pbist_neg (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist (); + ret |=deprepare_pbist (handle); + + ret |=prepare_pbist (handle); + ret |= ops->run_pbist_rom (); + ret |=deprepare_pbist (handle); + +if (ret) +panic ("PBIST on MCU4_0 failed: %d\n" , ret); + +/* get status of HW POST PBIST on MCU1_x */ +if (ops->run_lbist_post ()) +panic ("HW POST LBIST on MCU1_x failed\n" ); + +/* trigger LBIST tests on MCU1_x */ + ret =prepare_lbist (handle); + ret |= ops->run_lbist (); + ret |=deprepare_lbist (handle); +if (ret) +panic ("LBIST on MCU4_0 failed: %d\n" , ret); +} +/* * This uninitialized global variable would normal end up in the .bss section, * but the .bss is cleared between writing and reading this variable, so move @@ -251,6 +294,15 @@ void board_init_f(ulong dummy)printf ("AVS init failed: %d\n" , ret); }Quoted 8 lines
arch/arm/mach-k3/j784s4/j784s4_init.c void board_init_f(ulong dummy) · line 302
Quoted 6 lines
arch/arm/mach-k3/j784s4/j784s4_init.c +6
-0+if (!IS_ENABLED (CONFIG_CPU_V7R ) &&IS_ENABLED (CONFIG_K3_BIST )) { + ret =uclass_get_device_by_driver (UCLASS_MISC , +DM_DRIVER_GET (k3_bist), + &dev); +if (ret) +panic ("Failed to get BIST device: %d\n" , ret);nit: Add "\n" here
Quoted 2 lines
Didn't get you, there is already a "\n" here?
I meant an additional newline.
Before:
```
if (ret)
panic("Failed to get BIST device: %d\n", ret);
run_bist_j784s4(dev);
```After:
```
if (ret)
panic("Failed to get BIST device: %d\n", ret);
<additional newline here>
run_bist_j784s4(dev);
```Mostly after conditional statements I have seen newline and I feel it make the code much more readable as well, wondering if it's an unsaid convention or written somewhere else but noticed this off so commented.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
arch/arm/mach-k3/j784s4/j784s4_init.c +3
-0+run_bist_j784s4 (dev); + } +if (IS_ENABLED (CONFIG_CPU_V7R ))setup_navss_nb ();
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
Signature · 1 line
2.34.1Regards,
ManoritSignature · 2 lines
Thanking You Neha Malcom Francis
Regards,
Manorit
PATCH v4 3/3 DONOTMERGE: arm: dts: k3-j784s4-j742s2-main-common: Add PBIST_14 node
In reply to Neha Malcom FrancisAdd DT node for PBIST_14 that is responsible for triggering the PBIST self-tests for the MAIN_R5_2_x cores.
---
Changes since v3:
- move from ti,bist-under-test to ti,sci-dev-id
.../src/arm64/ti/k3-j784s4-j742s2-main-common.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
dts/upstream/src/arm64/ti/k3-j784s4-j742s2-main-common.dtsi +11 -0
@@ -2668,4 +2668,15 @@ power-domains = <&k3_pds 269 TI_SCI_PD_EXCLUSIVE>; status = "disabled"; }; + + bist_main14: bist@33c0000 { + compatible = "ti,j784s4-bist"; + reg = <0x00 0x033c0000 0x00 0x400>, + <0x00 0x0010c1a0 0x00 0x01c>; + reg-names = "cfg", "ctrl_mmr"; + clocks = <&k3_clks 237 7>; + power-domains = <&k3_pds 237 TI_SCI_PD_EXCLUSIVE>; + bootph-pre-ram; + ti,sci-dev-id = <234>; + }; };
Signature · 1 line
2.34.1
Re: (subset) [PATCH v4 0/3] Add support for K3 BIST
In reply to Neha Malcom FrancisQuoted 14 lines · Neha Malcom Francis
This series implements a driver for the BIST (Built-In Self Test) module for K3 devices. The BIST driver must ideally support triggering of BIST tests, both PBIST (Memory BIST) and LBIST (Logic BIST) on a core. Both tests are destructive in nature. Please see links [1] and [2] for further information regarding the two.
At boot up, BIST is executed by hardware for the MCU domain automatically as part of HW POST. So BIST has been checked only for the MCU domain when U-Boot comes up in the usual U-Boot to Linux boot flow. To facilitate the use-case where some safe firmware is intended to be run on a safe core, it is best to have triggered the BIST tests on that core. As an example, we take triggering the BIST tests on the MAIN
R52_xcores. The triggering patch is kept as DONOTMERGE.
Quoted 1 line
[...]
Applied to u-boot/next, thanks!
[1/3] drivers: misc: k3_bist: Add K3 BIST driver
(no commit info)
[2/3] arm: mach-k3: j784s4_init: Trigger LBIST and PBIST on MAIN R5 2_0
(no commit info)
Signature · 1 line
Tom