diff options
Diffstat (limited to 'platforms/astbmc')
-rw-r--r-- | platforms/astbmc/pnor.c | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/platforms/astbmc/pnor.c b/platforms/astbmc/pnor.c index e5bc269a..c64f41e8 100644 --- a/platforms/astbmc/pnor.c +++ b/platforms/astbmc/pnor.c @@ -24,16 +24,13 @@ #include "astbmc.h" -static struct spi_flash_ctrl *pnor_ctrl; -static struct flash_chip *pnor_chip; -static struct ffs_handle *pnor_ffs; - int pnor_init(void) { - uint32_t nv_part, nv_start, nv_size; + struct spi_flash_ctrl *pnor_ctrl; + struct flash_chip *pnor_chip; int rc; - /* Open controller, flash and ffs */ + /* Open controller and flash */ rc = ast_sf_open(AST_SF_TYPE_PNOR, &pnor_ctrl); if (rc) { prerror("PLAT: Failed to open PNOR flash controller\n"); @@ -44,42 +41,16 @@ int pnor_init(void) prerror("PLAT: Failed to open init PNOR driver\n"); goto fail; } - rc = ffs_open_flash(pnor_chip, 0, 0, &pnor_ffs); - if (rc) { - prerror("PLAT: Failed to parse FFS partition map\n"); - goto fail; - } - /* - * Grab NVRAM and initialize the flash_nvram module - * - * Note: Ignore actual size for now ... some images have - * it setup incorrectly. - */ - rc = ffs_lookup_part(pnor_ffs, "NVRAM", &nv_part); - if (rc) { - prerror("PLAT: No NVRAM partition in PNOR\n"); - return OPAL_HARDWARE; - } - rc = ffs_part_info(pnor_ffs, nv_part, NULL, - &nv_start, &nv_size, NULL); - if (rc) { - prerror("PLAT: Failed to get NVRAM partition info\n"); - return OPAL_HARDWARE; - } - flash_nvram_init(pnor_chip, nv_start, nv_size); + rc = flash_register(pnor_chip, true); + if (!rc) + return 0; - return 0; fail: - if (pnor_ffs) - ffs_close(pnor_ffs); - pnor_ffs = NULL; if (pnor_chip) flash_exit(pnor_chip); - pnor_chip = NULL; if (pnor_ctrl) ast_sf_close(pnor_ctrl); - pnor_ctrl = NULL; return rc; } |