diff options
author | Cyril Bur <cyril.bur@au1.ibm.com> | 2015-08-26 16:02:33 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-08-28 15:24:04 +1000 |
commit | aa0f5f4cb904faeff3ae53e35d16e5e12191de4e (patch) | |
tree | 1105c46990c0bf85833023ae9d1d073698f83665 /libflash/libflash.c | |
parent | 315acaa5d6a271d2dd6516a358a38c51c10667fa (diff) | |
download | skiboot-aa0f5f4cb904faeff3ae53e35d16e5e12191de4e.zip skiboot-aa0f5f4cb904faeff3ae53e35d16e5e12191de4e.tar.gz skiboot-aa0f5f4cb904faeff3ae53e35d16e5e12191de4e.tar.bz2 |
external/common: Create common code for initialising libflash components
In order to access the flash on ARM (presumably code running on a BMC), the
hardware is involved. In order to access the flash on POWER (presumably
code running on a host), opal calls through the Linux MTD driver are
involved. In order to access the flash on x86 (presumably on a
developer/admin system), you can't but it would be nice to be able to
manipulate data which has come from the flash or will go onto the flash.
The pflash and the gard tool both can read and write to the 'flash' and
with the introduction of the blocklevel interface the details of how the
flash is read from and written to is sufficiently abstracted that these
tools don't need to know what they're running on.
What does differ is the setup, and not by too much either. This common code
pulls out the setup of the flash hardware on ARM, the searching for the
appropriate MTD device on power and generic blocklevel device init for all
three architectures.
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash/libflash.c')
-rw-r--r-- | libflash/libflash.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libflash/libflash.c b/libflash/libflash.c index 831bdd4..4b9948b 100644 --- a/libflash/libflash.c +++ b/libflash/libflash.c @@ -856,3 +856,11 @@ void flash_exit(struct blocklevel_device *bl) free(container_of(bl, struct flash_chip, bl)); } +void flash_exit_close(struct blocklevel_device *bl, void (*close)(struct spi_flash_ctrl *ctrl)) +{ + if (bl) { + struct flash_chip *c = container_of(bl, struct flash_chip, bl); + close(c->ctrl); + free(c); + } +} |