scripts: twister: New find_v2_boards() function

Current find_v2_boards() has a lot of unnecessarry fluff.
We can make a new version of that function without it
given its use in TestPlan.add_configurations().

Signed-off-by: Lukasz Mrugala <lukaszx.mrugala@intel.com>
diff --git a/scripts/list_boards.py b/scripts/list_boards.py
index 597ecf9..b768dd6 100755
--- a/scripts/list_boards.py
+++ b/scripts/list_boards.py
@@ -231,6 +231,17 @@
     return boards
 
 
+# Note that this does not share the args.board functionality of find_v2_boards
+def find_v2_board_dirs(args):
+    dirs = []
+    board_files = []
+    for root in unique_paths(args.board_roots):
+        board_files.extend((root / 'boards').rglob(BOARD_YML))
+
+    dirs = [board_yml.parent for board_yml in board_files if board_yml.is_file()]
+    return dirs
+
+
 def find_v2_boards(args):
     root_args = argparse.Namespace(**{'soc_roots': args.soc_roots})
     systems = list_hardware.find_v2_systems(root_args)
diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py
index 8b63ba2..442f2f4 100755
--- a/scripts/pylib/twister/twisterlib/testplan.py
+++ b/scripts/pylib/twister/twisterlib/testplan.py
@@ -407,11 +407,10 @@
                             Path(ZEPHYR_BASE) / 'subsys' / 'testsuite'],
                             board_roots=board_roots, board=None, board_dir=None)
         v1_boards = list_boards.find_boards(lb_args)
-        v2_boards = list_boards.find_v2_boards(lb_args)
+        v2_dirs = list_boards.find_v2_board_dirs(lb_args)
         for b in v1_boards:
             board_dirs.add(b.dir)
-        for b in v2_boards:
-            board_dirs.add(b.dir)
+        board_dirs.update(v2_dirs)
         logger.debug("Reading platform configuration files under %s..." % self.env.board_roots)
 
         platform_config = self.test_config.get('platforms', {})