[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 24/24] test/qtest/ast2700-smc-test: Support to test AST2700
From: |
Cédric Le Goater |
Subject: |
[PULL 24/24] test/qtest/ast2700-smc-test: Support to test AST2700 |
Date: |
Wed, 11 Dec 2024 07:30:58 +0100 |
From: Jamin Lin <jamin_lin@aspeedtech.com>
Add test_ast2700_evb function and reused testcases which are from
aspeed_smc-test.c for AST2700 testing. The base address, flash base address
and ce index of fmc_cs0 are 0x14000000, 0x100000000 and 0, respectively.
The default flash model of fmc_cs0 is "w25q01jvq" whose size is 128MB,
so set jedec_id 0xef4021.
Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link:
https://lore.kernel.org/r/20241127091543.1243114-11-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
tests/qtest/ast2700-smc-test.c | 71 ++++++++++++++++++++++++++++++++++
tests/qtest/meson.build | 4 +-
2 files changed, 74 insertions(+), 1 deletion(-)
create mode 100644 tests/qtest/ast2700-smc-test.c
diff --git a/tests/qtest/ast2700-smc-test.c b/tests/qtest/ast2700-smc-test.c
new file mode 100644
index 000000000000..d1c485630744
--- /dev/null
+++ b/tests/qtest/ast2700-smc-test.c
@@ -0,0 +1,71 @@
+/*
+ * QTest testcase for the M25P80 Flash using the ASPEED SPI Controller since
+ * AST2700.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * Copyright (C) 2024 ASPEED Technology Inc.
+ */
+
+#include "qemu/osdep.h"
+#include "qemu/bswap.h"
+#include "libqtest-single.h"
+#include "qemu/bitops.h"
+#include "aspeed-smc-utils.h"
+
+static void test_ast2700_evb(AspeedSMCTestData *data)
+{
+ int ret;
+ int fd;
+
+ fd = g_file_open_tmp("qtest.m25p80.w25q01jvq.XXXXXX",
+ &data->tmp_path, NULL);
+ g_assert(fd >= 0);
+ ret = ftruncate(fd, 128 * 1024 * 1024);
+ g_assert(ret == 0);
+ close(fd);
+
+ data->s = qtest_initf("-machine ast2700-evb "
+ "-drive file=%s,format=raw,if=mtd",
+ data->tmp_path);
+
+ /* fmc cs0 with w25q01jvq flash */
+ data->flash_base = 0x100000000;
+ data->spi_base = 0x14000000;
+ data->jedec_id = 0xef4021;
+ data->cs = 0;
+ data->node = "/machine/soc/fmc/ssi.0/child[0]";
+ /* beyond 64MB */
+ data->page_addr = 0x40000 * FLASH_PAGE_SIZE;
+
+ qtest_add_data_func("/ast2700/smc/read_jedec",
+ data, aspeed_smc_test_read_jedec);
+ qtest_add_data_func("/ast2700/smc/erase_sector",
+ data, aspeed_smc_test_erase_sector);
+ qtest_add_data_func("/ast2700/smc/erase_all",
+ data, aspeed_smc_test_erase_all);
+ qtest_add_data_func("/ast2700/smc/write_page",
+ data, aspeed_smc_test_write_page);
+ qtest_add_data_func("/ast2700/smc/read_page_mem",
+ data, aspeed_smc_test_read_page_mem);
+ qtest_add_data_func("/ast2700/smc/write_page_mem",
+ data, aspeed_smc_test_write_page_mem);
+ qtest_add_data_func("/ast2700/smc/read_status_reg",
+ data, aspeed_smc_test_read_status_reg);
+ qtest_add_data_func("/ast2700/smc/write_page_qpi",
+ data, aspeed_smc_test_write_page_qpi);
+}
+
+int main(int argc, char **argv)
+{
+ AspeedSMCTestData ast2700_evb_data;
+ int ret;
+
+ g_test_init(&argc, &argv, NULL);
+
+ test_ast2700_evb(&ast2700_evb_data);
+ ret = g_test_run();
+
+ qtest_quit(ast2700_evb_data.s);
+ unlink(ast2700_evb_data.tmp_path);
+ return ret;
+}
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index f8b3907e370d..89db3ecf2ff7 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -214,7 +214,8 @@ qtests_aspeed = \
'aspeed_smc-test',
'aspeed_gpio-test']
qtests_aspeed64 = \
- ['ast2700-gpio-test']
+ ['ast2700-gpio-test',
+ 'ast2700-smc-test']
qtests_stm32l4x5 = \
['stm32l4x5_exti-test',
@@ -361,6 +362,7 @@ qtests = {
'vmgenid-test': files('boot-sector.c', 'acpi-utils.c'),
'netdev-socket': files('netdev-socket.c', '../unit/socket-helpers.c'),
'aspeed_smc-test': files('aspeed-smc-utils.c', 'aspeed_smc-test.c'),
+ 'ast2700-smc-test': files('aspeed-smc-utils.c', 'ast2700-smc-test.c'),
}
if vnc.found()
--
2.47.1
- [PULL 21/24] test/qtest/aspeed_smc-test: Support to test AST1030, (continued)
- [PULL 21/24] test/qtest/aspeed_smc-test: Support to test AST1030, Cédric Le Goater, 2024/12/11
- [PULL 06/24] aspeed/soc: Support SDHCI for AST2700, Cédric Le Goater, 2024/12/11
- [PULL 15/24] test/qtest/aspeed_smc-test: Move testcases to test_palmetto_bmc function, Cédric Le Goater, 2024/12/11
- [PULL 19/24] test/qtest/aspeed_smc-test: Support to test AST2500, Cédric Le Goater, 2024/12/11
- [PULL 18/24] test/qtest/aspeed_smc-test: Introducing a "page_addr" data field, Cédric Le Goater, 2024/12/11
- [PULL 08/24] tests/functional: Introduce a specific test for ast1030 SoC, Cédric Le Goater, 2024/12/11
- [PULL 11/24] tests/functional: Introduce a specific test for ast2500 SoC, Cédric Le Goater, 2024/12/11
- [PULL 23/24] test/qtest: Introduce a new aspeed-smc-utils.c to place common testcases, Cédric Le Goater, 2024/12/11
- [PULL 20/24] test/qtest/aspeed_smc-test: Support to test AST2600, Cédric Le Goater, 2024/12/11
- [PULL 22/24] test/qtest/aspeed_smc-test: Support write page command with QPI mode, Cédric Le Goater, 2024/12/11
- [PULL 24/24] test/qtest/ast2700-smc-test: Support to test AST2700,
Cédric Le Goater <=
- Re: [PULL 00/24] aspeed queue, Peter Maydell, 2024/12/11