Re: [PATCH 3/4] tests/qtest: aspeed_smc: Add Dual Output Read (DOR) test coverage

2026-07-08 Thread Bin Meng
On Thu, Jul 9, 2026 at 12:43 AM Cédric Le Goater  wrote:
>
> On 7/8/26 17:32, Bin Meng wrote:
> > On Wed, Jul 8, 2026 at 7:17 PM Cédric Le Goater  wrote:
> >>
> >> Add read_page_mem_dor (CTRL_FREADMODE with DOR command and dual data
> >> IO mode) and write_page_dor (user-mode DOR) tests.
> >>
> >> Signed-off-by: Cédric Le Goater 
> >> ---
> >>   tests/qtest/aspeed-smc-utils.h |  4 +++
> >>   tests/qtest/aspeed-smc-utils.c | 50 ++
> >>   tests/qtest/aspeed_smc-test.c  | 16 +++
> >>   tests/qtest/ast2700-smc-test.c |  4 +++
> >>   4 files changed, 74 insertions(+)
> >>
> >> diff --git a/tests/qtest/aspeed-smc-utils.h 
> >> b/tests/qtest/aspeed-smc-utils.h
> >> index 5a86514caf35..fbfb94e831d8 100644
> >> --- a/tests/qtest/aspeed-smc-utils.h
> >> +++ b/tests/qtest/aspeed-smc-utils.h
> >> @@ -44,6 +44,7 @@
> >>   #define   CTRL_FREADMODE   0x1
> >>   #define   CTRL_WRITEMODE   0x2
> >>   #define   CTRL_USERMODE0x3
> >> +#define   CTRL_IO_DUAL_DATA BIT(29)
> >
> > This macro is already defined in aspeed-smc-utils.h:43
>
> I am confused. I only see this CTRL_IO_DUAL_DATA define in
> hw/ssi/aspeed_smc.c.
>

Sorry, my fault. I had a local tree that modified some of these qtests before.

Regards,
Bin



Re: [PATCH 3/4] tests/qtest: aspeed_smc: Add Dual Output Read (DOR) test coverage

2026-07-08 Thread Cédric Le Goater

On 7/8/26 17:32, Bin Meng wrote:

On Wed, Jul 8, 2026 at 7:17 PM Cédric Le Goater  wrote:


Add read_page_mem_dor (CTRL_FREADMODE with DOR command and dual data
IO mode) and write_page_dor (user-mode DOR) tests.

Signed-off-by: Cédric Le Goater 
---
  tests/qtest/aspeed-smc-utils.h |  4 +++
  tests/qtest/aspeed-smc-utils.c | 50 ++
  tests/qtest/aspeed_smc-test.c  | 16 +++
  tests/qtest/ast2700-smc-test.c |  4 +++
  4 files changed, 74 insertions(+)

diff --git a/tests/qtest/aspeed-smc-utils.h b/tests/qtest/aspeed-smc-utils.h
index 5a86514caf35..fbfb94e831d8 100644
--- a/tests/qtest/aspeed-smc-utils.h
+++ b/tests/qtest/aspeed-smc-utils.h
@@ -44,6 +44,7 @@
  #define   CTRL_FREADMODE   0x1
  #define   CTRL_WRITEMODE   0x2
  #define   CTRL_USERMODE0x3
+#define   CTRL_IO_DUAL_DATA BIT(29)


This macro is already defined in aspeed-smc-utils.h:43


I am confused. I only see this CTRL_IO_DUAL_DATA define in
hw/ssi/aspeed_smc.c.

Thanks,

C.




Re: [PATCH 3/4] tests/qtest: aspeed_smc: Add Dual Output Read (DOR) test coverage

2026-07-08 Thread Bin Meng
On Wed, Jul 8, 2026 at 7:17 PM Cédric Le Goater  wrote:
>
> Add read_page_mem_dor (CTRL_FREADMODE with DOR command and dual data
> IO mode) and write_page_dor (user-mode DOR) tests.
>
> Signed-off-by: Cédric Le Goater 
> ---
>  tests/qtest/aspeed-smc-utils.h |  4 +++
>  tests/qtest/aspeed-smc-utils.c | 50 ++
>  tests/qtest/aspeed_smc-test.c  | 16 +++
>  tests/qtest/ast2700-smc-test.c |  4 +++
>  4 files changed, 74 insertions(+)
>
> diff --git a/tests/qtest/aspeed-smc-utils.h b/tests/qtest/aspeed-smc-utils.h
> index 5a86514caf35..fbfb94e831d8 100644
> --- a/tests/qtest/aspeed-smc-utils.h
> +++ b/tests/qtest/aspeed-smc-utils.h
> @@ -44,6 +44,7 @@
>  #define   CTRL_FREADMODE   0x1
>  #define   CTRL_WRITEMODE   0x2
>  #define   CTRL_USERMODE0x3
> +#define   CTRL_IO_DUAL_DATA BIT(29)

This macro is already defined in aspeed-smc-utils.h:43

>  #define   CTRL_DUMMY_LOW_SHIFT   6
>  #define   CTRL_DUMMY_HIGH_SHIFT  14
>  #define SR_WEL BIT(1)
> @@ -58,6 +59,7 @@ enum {
>  BULK_ERASE = 0xc7,
>  READ = 0x03,
>  FAST_READ = 0x0b,
> +DOR = 0x3b,
>  PP = 0x02,
>  WRSR = 0x1,
>  WREN = 0x6,
> @@ -95,5 +97,7 @@ void aspeed_smc_test_write_block_protect_bottom_bit(const 
> void *data);
>  void aspeed_smc_test_write_page_qpi(const void *data);
>  void aspeed_smc_test_read_page_mem_fast_read(const void *data);
>  void aspeed_smc_test_write_page_fast_read(const void *data);
> +void aspeed_smc_test_read_page_mem_dor(const void *data);
> +void aspeed_smc_test_write_page_dor(const void *data);
>
>  #endif /* TESTS_ASPEED_SMC_UTILS_H */
> diff --git a/tests/qtest/aspeed-smc-utils.c b/tests/qtest/aspeed-smc-utils.c
> index 9883ade0815c..25e3d28ec646 100644
> --- a/tests/qtest/aspeed-smc-utils.c
> +++ b/tests/qtest/aspeed-smc-utils.c
> @@ -746,3 +746,53 @@ void aspeed_smc_test_write_page_fast_read(const void 
> *data)
>  {
>  test_write_page(data, read_page_fast_read);
>  }
> +
> +static void read_page_mem_dor(const AspeedSMCTestData *data,
> +  uint32_t addr, uint32_t *page)
> +{
> +uint32_t ctrl_reg = R_CTRL0 + data->cs * 4;
> +uint32_t ctrl = spi_readl(data, ctrl_reg);
> +int i;
> +
> +ctrl &= ~(CTRL_USERMODE | (0xff << 16) |
> +  (0x3 << CTRL_DUMMY_LOW_SHIFT) |
> +  (0x1 << CTRL_DUMMY_HIGH_SHIFT) |
> +  CTRL_IO_MODE_MASK);
> +ctrl |= CTRL_FREADMODE | (DOR << 16) |
> +(1 << CTRL_DUMMY_LOW_SHIFT) |
> +CTRL_IO_DUAL_DATA;
> +spi_writel(data, ctrl_reg, ctrl);
> +
> +for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> +page[i] = make_be32(flash_readl(data, addr + i * 4));
> +}
> +}
> +
> +void aspeed_smc_test_read_page_mem_dor(const void *data)
> +{
> +test_read_page_mem(data, read_page_mem_dor);
> +}
> +
> +static void read_page_dor(const AspeedSMCTestData *data,
> +  uint32_t addr, uint32_t *page)
> +{
> +int i;
> +
> +spi_ctrl_start_user(data);
> +
> +flash_writeb(data, 0, EN_4BYTE_ADDR);
> +flash_writeb(data, 0, DOR);
> +flash_writel(data, 0, make_be32(addr));
> +/* 1 dummy byte for standard SPI DOR */
> +flash_writeb(data, 0, 0x00);
> +
> +for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
> +page[i] = make_be32(flash_readl(data, 0));
> +}
> +spi_ctrl_stop_user(data);
> +}
> +
> +void aspeed_smc_test_write_page_dor(const void *data)
> +{
> +test_write_page(data, read_page_dor);
> +}
> diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c
> index bbda15ad17ea..6d48444fd71b 100644
> --- a/tests/qtest/aspeed_smc-test.c
> +++ b/tests/qtest/aspeed_smc-test.c
> @@ -72,6 +72,10 @@ static void test_palmetto_bmc(AspeedSMCTestData *data)
>  data, aspeed_smc_test_read_page_mem_fast_read);
>  qtest_add_data_func("/ast2400/smc/write_page_fast_read",
>  data, aspeed_smc_test_write_page_fast_read);
> +qtest_add_data_func("/ast2400/smc/read_page_mem_dor",
> +data, aspeed_smc_test_read_page_mem_dor);
> +qtest_add_data_func("/ast2400/smc/write_page_dor",
> +data, aspeed_smc_test_write_page_dor);
>  /*
>   * Block protect tests must be run last because the block protect
>   * state is not cleared by reset_memory() and silently prevents
> @@ -128,6 +132,10 @@ static void test_ast2500_evb(AspeedSMCTestData *data)
>  data, aspeed_smc_test_read_page_mem_fast_read);
>  qtest_add_data_func("/ast2500/smc/write_page_fast_read",
>  data, aspeed_smc_test_write_page_fast_read);
> +qtest_add_data_func("/ast2500/smc/read_page_mem_dor",
> +data, aspeed_smc_test_read_page_mem_dor);
> +qtest_add_data_func("/ast2500/smc/write_page_dor",
> +data, aspeed_smc_test_write_page_dor);
>  }
>
>  static void test_ast2600_evb(AspeedSMCTestData *da

[PATCH 3/4] tests/qtest: aspeed_smc: Add Dual Output Read (DOR) test coverage

2026-07-08 Thread Cédric Le Goater
Add read_page_mem_dor (CTRL_FREADMODE with DOR command and dual data
IO mode) and write_page_dor (user-mode DOR) tests.

Signed-off-by: Cédric Le Goater 
---
 tests/qtest/aspeed-smc-utils.h |  4 +++
 tests/qtest/aspeed-smc-utils.c | 50 ++
 tests/qtest/aspeed_smc-test.c  | 16 +++
 tests/qtest/ast2700-smc-test.c |  4 +++
 4 files changed, 74 insertions(+)

diff --git a/tests/qtest/aspeed-smc-utils.h b/tests/qtest/aspeed-smc-utils.h
index 5a86514caf35..fbfb94e831d8 100644
--- a/tests/qtest/aspeed-smc-utils.h
+++ b/tests/qtest/aspeed-smc-utils.h
@@ -44,6 +44,7 @@
 #define   CTRL_FREADMODE   0x1
 #define   CTRL_WRITEMODE   0x2
 #define   CTRL_USERMODE0x3
+#define   CTRL_IO_DUAL_DATA BIT(29)
 #define   CTRL_DUMMY_LOW_SHIFT   6
 #define   CTRL_DUMMY_HIGH_SHIFT  14
 #define SR_WEL BIT(1)
@@ -58,6 +59,7 @@ enum {
 BULK_ERASE = 0xc7,
 READ = 0x03,
 FAST_READ = 0x0b,
+DOR = 0x3b,
 PP = 0x02,
 WRSR = 0x1,
 WREN = 0x6,
@@ -95,5 +97,7 @@ void aspeed_smc_test_write_block_protect_bottom_bit(const 
void *data);
 void aspeed_smc_test_write_page_qpi(const void *data);
 void aspeed_smc_test_read_page_mem_fast_read(const void *data);
 void aspeed_smc_test_write_page_fast_read(const void *data);
+void aspeed_smc_test_read_page_mem_dor(const void *data);
+void aspeed_smc_test_write_page_dor(const void *data);
 
 #endif /* TESTS_ASPEED_SMC_UTILS_H */
diff --git a/tests/qtest/aspeed-smc-utils.c b/tests/qtest/aspeed-smc-utils.c
index 9883ade0815c..25e3d28ec646 100644
--- a/tests/qtest/aspeed-smc-utils.c
+++ b/tests/qtest/aspeed-smc-utils.c
@@ -746,3 +746,53 @@ void aspeed_smc_test_write_page_fast_read(const void *data)
 {
 test_write_page(data, read_page_fast_read);
 }
+
+static void read_page_mem_dor(const AspeedSMCTestData *data,
+  uint32_t addr, uint32_t *page)
+{
+uint32_t ctrl_reg = R_CTRL0 + data->cs * 4;
+uint32_t ctrl = spi_readl(data, ctrl_reg);
+int i;
+
+ctrl &= ~(CTRL_USERMODE | (0xff << 16) |
+  (0x3 << CTRL_DUMMY_LOW_SHIFT) |
+  (0x1 << CTRL_DUMMY_HIGH_SHIFT) |
+  CTRL_IO_MODE_MASK);
+ctrl |= CTRL_FREADMODE | (DOR << 16) |
+(1 << CTRL_DUMMY_LOW_SHIFT) |
+CTRL_IO_DUAL_DATA;
+spi_writel(data, ctrl_reg, ctrl);
+
+for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
+page[i] = make_be32(flash_readl(data, addr + i * 4));
+}
+}
+
+void aspeed_smc_test_read_page_mem_dor(const void *data)
+{
+test_read_page_mem(data, read_page_mem_dor);
+}
+
+static void read_page_dor(const AspeedSMCTestData *data,
+  uint32_t addr, uint32_t *page)
+{
+int i;
+
+spi_ctrl_start_user(data);
+
+flash_writeb(data, 0, EN_4BYTE_ADDR);
+flash_writeb(data, 0, DOR);
+flash_writel(data, 0, make_be32(addr));
+/* 1 dummy byte for standard SPI DOR */
+flash_writeb(data, 0, 0x00);
+
+for (i = 0; i < FLASH_PAGE_SIZE / 4; i++) {
+page[i] = make_be32(flash_readl(data, 0));
+}
+spi_ctrl_stop_user(data);
+}
+
+void aspeed_smc_test_write_page_dor(const void *data)
+{
+test_write_page(data, read_page_dor);
+}
diff --git a/tests/qtest/aspeed_smc-test.c b/tests/qtest/aspeed_smc-test.c
index bbda15ad17ea..6d48444fd71b 100644
--- a/tests/qtest/aspeed_smc-test.c
+++ b/tests/qtest/aspeed_smc-test.c
@@ -72,6 +72,10 @@ static void test_palmetto_bmc(AspeedSMCTestData *data)
 data, aspeed_smc_test_read_page_mem_fast_read);
 qtest_add_data_func("/ast2400/smc/write_page_fast_read",
 data, aspeed_smc_test_write_page_fast_read);
+qtest_add_data_func("/ast2400/smc/read_page_mem_dor",
+data, aspeed_smc_test_read_page_mem_dor);
+qtest_add_data_func("/ast2400/smc/write_page_dor",
+data, aspeed_smc_test_write_page_dor);
 /*
  * Block protect tests must be run last because the block protect
  * state is not cleared by reset_memory() and silently prevents
@@ -128,6 +132,10 @@ static void test_ast2500_evb(AspeedSMCTestData *data)
 data, aspeed_smc_test_read_page_mem_fast_read);
 qtest_add_data_func("/ast2500/smc/write_page_fast_read",
 data, aspeed_smc_test_write_page_fast_read);
+qtest_add_data_func("/ast2500/smc/read_page_mem_dor",
+data, aspeed_smc_test_read_page_mem_dor);
+qtest_add_data_func("/ast2500/smc/write_page_dor",
+data, aspeed_smc_test_write_page_dor);
 }
 
 static void test_ast2600_evb(AspeedSMCTestData *data)
@@ -175,6 +183,10 @@ static void test_ast2600_evb(AspeedSMCTestData *data)
 data, aspeed_smc_test_read_page_mem_fast_read);
 qtest_add_data_func("/ast2600/smc/write_page_fast_read",
 data, aspeed_smc_test_write_page_fast_read);
+qtest_add_data_func("/ast2600/smc/read_page_mem_dor",
+