aboutsummaryrefslogtreecommitdiff
path: root/libflash/test/test-flash.c
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2015-06-02 10:51:02 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-06-09 16:37:33 +1000
commit39d9e14cdeef9a20e3da05d527b136de65e39904 (patch)
tree13246271b2b9fba1dbfc0a6729ca84223668e6cf /libflash/test/test-flash.c
parent1fd9d5afc6aff3870695110c74a4a9daa88e5c81 (diff)
downloadskiboot-39d9e14cdeef9a20e3da05d527b136de65e39904.zip
skiboot-39d9e14cdeef9a20e3da05d527b136de65e39904.tar.gz
skiboot-39d9e14cdeef9a20e3da05d527b136de65e39904.tar.bz2
libflash: start using the blocklevel interface.
Converted all the libflash calls to use the blocklevel interface, modified all callers to libflash to use the blocklevel interface. This patch should introduce next to no functional change. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash/test/test-flash.c')
-rw-r--r--libflash/test/test-flash.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/libflash/test/test-flash.c b/libflash/test/test-flash.c
index 4479b5a..cf2b3a5 100644
--- a/libflash/test/test-flash.c
+++ b/libflash/test/test-flash.c
@@ -366,7 +366,7 @@ struct spi_flash_ctrl sim_ctrl = {
int main(void)
{
- struct flash_chip *fl;
+ struct blocklevel_device *bl;
uint32_t total_size, erase_granule;
const char *name;
uint16_t *test;
@@ -378,12 +378,12 @@ int main(void)
memset(sim_image, 0xff, sim_image_sz);
test = malloc(0x10000 * 2);
- rc = flash_init(&sim_ctrl, &fl);
+ rc = flash_init(&sim_ctrl, &bl);
if (rc) {
ERR("flash_init failed with err %d\n", rc);
exit(1);
}
- rc = flash_get_info(fl, &name, &total_size, &erase_granule);
+ rc = flash_get_info(bl, &name, &total_size, &erase_granule);
if (rc) {
ERR("flash_get_info failed with err %d\n", rc);
exit(1);
@@ -395,13 +395,13 @@ int main(void)
/* Write 64k of stuff at 0 and at 128k */
printf("Writing test patterns...\n");
- flash_smart_write(fl, 0, test, 0x10000);
- flash_smart_write(fl, 0x20000, test, 0x10000);
+ flash_smart_write(bl, 0, test, 0x10000);
+ flash_smart_write(bl, 0x20000, test, 0x10000);
/* Write "Hello world" straddling the 64k boundary */
#define HW "Hello World"
printf("Writing test string...\n");
- flash_smart_write(fl, 0xfffc, HW, sizeof(HW));
+ flash_smart_write(bl, 0xfffc, HW, sizeof(HW));
/* Check result */
if (memcmp(sim_image + 0xfffc, HW, sizeof(HW))) {
@@ -416,7 +416,7 @@ int main(void)
printf("Test pattern pass\n");
printf("Test ECC interfaces\n");
- flash_smart_write_corrected(fl, 0, test, 0x10000, 1);
+ flash_smart_write_corrected(bl, 0, test, 0x10000, 1);
ecc_test = (struct ecc64 *)sim_image;
test64 = (uint64_t *)test;
for (i = 0; i < 0x10000 / sizeof(*ecc_test); i++) {
@@ -433,7 +433,7 @@ int main(void)
printf("Test ECC interface pass\n");
printf("Test ECC erase\n");
- if (flash_erase(fl, 0, 0x10000) != 0) {
+ if (flash_erase(bl, 0, 0x10000) != 0) {
ERR("flash_erase didn't return 0\n");
exit(1);
}
@@ -444,7 +444,7 @@ int main(void)
ERR("Data not properly cleared at %d\n", i);
exit(1);
}
- rc = flash_write(fl, i * sizeof(*ecc_test) + 8, &zero, 1, 0);
+ rc = flash_write(bl, i * sizeof(*ecc_test) + 8, &zero, 1, 0);
if (rc || ecc_test[i].ecc != 0) {
ERR("Cleared data not correctly ECCed: 0x%02x (0x%016lx) expecting 0 at %d\n", ecc_test[i].ecc, ecc_test[i].data, i);
exit(1);
@@ -452,7 +452,7 @@ int main(void)
}
printf("Test ECC erase pass\n");
- flash_exit(fl);
+ flash_exit(bl);
return 0;
}