blob: de5686343b999f45d589b4499f7f0542820017a9 [file] [log] [blame]
Sean Anderson430e4aa2023-10-14 16:48:04 -04001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2023 Sean Anderson <seanga2@gmail.com>
4 */
5
Tom Riniabb9a042024-05-18 20:20:43 -06006#include <common.h>
Sean Anderson430e4aa2023-10-14 16:48:04 -04007#include <dm.h>
8#include <spl.h>
9#include <asm/io.h>
10#include <test/spl.h>
11#include <test/ut.h>
12
13static void *spl_test_nor_base;
14
15unsigned long spl_nor_get_uboot_base(void)
16{
17 return virt_to_phys(spl_test_nor_base);
18}
19
20static int spl_test_nor_write_image(struct unit_test_state *uts, void *img,
21 size_t img_size)
22{
23 spl_test_nor_base = img;
24 return 0;
25}
26
27static int spl_test_nor(struct unit_test_state *uts, const char *test_name,
28 enum spl_test_image type)
29{
30 return do_spl_test_load(uts, test_name, type,
31 SPL_LOAD_IMAGE_GET(0, BOOT_DEVICE_NOR,
32 spl_nor_load_image),
33 spl_test_nor_write_image);
34}
35SPL_IMG_TEST(spl_test_nor, LEGACY, 0);
36SPL_IMG_TEST(spl_test_nor, LEGACY_LZMA, 0);
37SPL_IMG_TEST(spl_test_nor, IMX8, 0);
38SPL_IMG_TEST(spl_test_nor, FIT_INTERNAL, 0);
Sean Anderson2a5d23f2023-11-08 11:48:53 -050039#if !IS_ENABLED(CONFIG_SPL_LOAD_FIT_FULL)
Sean Anderson430e4aa2023-10-14 16:48:04 -040040SPL_IMG_TEST(spl_test_nor, FIT_EXTERNAL, 0);
Sean Anderson2a5d23f2023-11-08 11:48:53 -050041#endif