dm: test: usb: rework keyboard test
[platform/kernel/u-boot.git] / test / py / u_boot_utils.py
index de9ee26..bf2a0fc 100644 (file)
@@ -1,6 +1,5 @@
-# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
-#
 # SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
 
 # Utility code shared across multiple tests.
 
@@ -121,7 +120,7 @@ def wait_until_open_succeeds(fn):
         An open file handle to the file.
     """
 
-    for i in xrange(100):
+    for i in range(100):
         fh = attempt_to_open_file(fn)
         if fh:
             return fh
@@ -144,7 +143,7 @@ def wait_until_file_open_fails(fn, ignore_errors):
         Nothing.
     """
 
-    for i in xrange(100):
+    for i in range(100):
         fh = attempt_to_open_file(fn)
         if not fh:
             return
@@ -237,6 +236,12 @@ def find_ram_base(u_boot_console):
             ram_base = -1
             raise Exception('Failed to find RAM bank start in `bdinfo`')
 
+    # We don't want ram_base to be zero as some functions test if the given
+    # address is NULL (0). Let's add 2MiB then (size of an ARM LPAE/v8 section).
+
+    if ram_base == 0:
+        ram_base += 1024 * 1024 * 2
+
     return ram_base
 
 class PersistentFileHelperCtxMgr(object):