@@ -72,6 +72,7 @@ typedef struct TestData {
char *tmp_path;
uint8_t cs;
const char *node;
+ uint32_t page_addr;
} TestData;
/*
@@ -256,7 +257,7 @@ static void assert_page_mem(const TestData *data, uint32_t addr,
static void test_erase_sector(const void *data)
{
const TestData *test_data = (const TestData *)data;
- uint32_t some_page_addr = 0x600 * FLASH_PAGE_SIZE;
+ uint32_t some_page_addr = test_data->page_addr;
uint32_t page[FLASH_PAGE_SIZE / 4];
int i;
@@ -308,7 +309,7 @@ static void test_erase_sector(const void *data)
static void test_erase_all(const void *data)
{
const TestData *test_data = (const TestData *)data;
- uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE;
+ uint32_t some_page_addr = test_data->page_addr;
uint32_t page[FLASH_PAGE_SIZE / 4];
int i;
@@ -358,8 +359,8 @@ static void test_erase_all(const void *data)
static void test_write_page(const void *data)
{
const TestData *test_data = (const TestData *)data;
- uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond 16MB */
- uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE;
+ uint32_t my_page_addr = test_data->page_addr;
+ uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE;
uint32_t page[FLASH_PAGE_SIZE / 4];
int i;
@@ -395,8 +396,8 @@ static void test_write_page(const void *data)
static void test_read_page_mem(const void *data)
{
const TestData *test_data = (const TestData *)data;
- uint32_t my_page_addr = 0x14000 * FLASH_PAGE_SIZE; /* beyond 16MB */
- uint32_t some_page_addr = 0x15000 * FLASH_PAGE_SIZE;
+ uint32_t my_page_addr = test_data->page_addr;
+ uint32_t some_page_addr = my_page_addr + FLASH_PAGE_SIZE;
uint32_t page[FLASH_PAGE_SIZE / 4];
int i;
@@ -438,7 +439,7 @@ static void test_read_page_mem(const void *data)
static void test_write_page_mem(const void *data)
{
const TestData *test_data = (const TestData *)data;
- uint32_t my_page_addr = 0x15000 * FLASH_PAGE_SIZE;
+ uint32_t my_page_addr = test_data->page_addr;
uint32_t page[FLASH_PAGE_SIZE / 4];
int i;
@@ -679,6 +680,8 @@ static void test_palmetto_bmc(TestData *data)
data->jedec_id = 0x20ba19;
data->cs = 0;
data->node = "/machine/soc/fmc/ssi.0/child[0]";
+ /* beyond 16MB */
+ data->page_addr = 0x14000 * FLASH_PAGE_SIZE;
qtest_add_data_func("/ast2400/smc/read_jedec", data, test_read_jedec);
qtest_add_data_func("/ast2400/smc/erase_sector", data, test_erase_sector);