diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-03 08:37:29 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-07-03 08:37:29 +0200 |
commit | 13830db360f66b206ed1983f71bdfc2d25c03805 (patch) | |
tree | e8baac458613657734239a2dc8b3eb5e309766dc /arch | |
parent | 910306c89142014afc6a02c5c85d75c808701548 (diff) | |
parent | a280a92f46c6bea8cafab5c2672ff938ddff7847 (diff) | |
download | barebox-13830db360f66b206ed1983f71bdfc2d25c03805.tar.gz barebox-13830db360f66b206ed1983f71bdfc2d25c03805.tar.xz |
Merge branch 'for-next/bbu'
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/boards/beagle/board.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-omap/am33xx_bbu_spi_mlo.c | 56 | ||||
-rw-r--r-- | arch/arm/mach-omap/include/mach/bbu.h | 5 |
3 files changed, 9 insertions, 59 deletions
diff --git a/arch/arm/boards/beagle/board.c b/arch/arm/boards/beagle/board.c index 775621069c..c56205e05c 100644 --- a/arch/arm/boards/beagle/board.c +++ b/arch/arm/boards/beagle/board.c @@ -21,6 +21,8 @@ #include <driver.h> #include <linux/sizes.h> #include <io.h> +#include <bbu.h> +#include <filetype.h> #include <ns16550.h> #include <asm/armlinux.h> #include <generated/mach-types.h> @@ -107,6 +109,11 @@ static int beagle_devices_init(void) armlinux_set_architecture(MACH_TYPE_OMAP3_BEAGLE); + bbu_register_std_file_update("nand-xload", 0, + "/dev/nand0.xload.bb", filetype_ch_image); + bbu_register_std_file_update("nand", 0, + "/dev/nand0.barebox.bb", filetype_arm_barebox); + return 0; } device_initcall(beagle_devices_init); diff --git a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c index 97dc54ee10..702bb9af59 100644 --- a/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c +++ b/arch/arm/mach-omap/am33xx_bbu_spi_mlo.c @@ -97,41 +97,6 @@ out: return ret; } -static int spi_nor_handler(struct bbu_handler *handler, - struct bbu_data *data) -{ - int fd, ret; - - if (file_detect_type(data->image, data->len) != filetype_arm_barebox) { - if (!bbu_force(data, "Not an ARM barebox image")) - return -EINVAL; - } - - fd = open(data->devicefile, O_RDWR | O_CREAT); - if (fd < 0) - return fd; - - debug("%s: eraseing %s from 0 to 0x%08x\n", __func__, - data->devicefile, data->len); - ret = erase(fd, data->len, 0); - if (ret) { - printf("erasing %s failed with %s\n", data->devicefile, - strerror(-ret)); - goto err_close; - } - - ret = write(fd, data->image, data->len); - if (ret < 0) - goto err_close; - - ret = 0; - -err_close: - close(fd); - - return ret; -} - /* * Register a am33xx MLO update handler for SPI NOR */ @@ -152,24 +117,3 @@ int am33xx_bbu_spi_nor_mlo_register_handler(const char *name, char *devicefile) return ret; } - -/* - * Register a am33xx update handler for SPI NOR - */ -int am33xx_bbu_spi_nor_register_handler(const char *name, char *devicefile) -{ - struct bbu_handler *handler; - int ret; - - handler = xzalloc(sizeof(*handler)); - handler->devicefile = devicefile; - handler->name = name; - handler->handler = spi_nor_handler; - - ret = bbu_register_handler(handler); - - if (ret) - free(handler); - - return ret; -} diff --git a/arch/arm/mach-omap/include/mach/bbu.h b/arch/arm/mach-omap/include/mach/bbu.h index 36d87e1a00..da5c214d3a 100644 --- a/arch/arm/mach-omap/include/mach/bbu.h +++ b/arch/arm/mach-omap/include/mach/bbu.h @@ -5,18 +5,17 @@ #ifdef CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO int am33xx_bbu_spi_nor_mlo_register_handler(const char *name, char *devicefile); -int am33xx_bbu_spi_nor_register_handler(const char *name, char *devicefile); #else static inline int am33xx_bbu_spi_nor_mlo_register_handler(const char *name, char *devicefile) { return 0; } +#endif static inline int am33xx_bbu_spi_nor_register_handler(const char *name, char *devicefile) { - return 0; + return bbu_register_std_file_update(name, 0, devicefile, filetype_arm_barebox); } -#endif #ifdef CONFIG_BAREBOX_UPDATE_AM33XX_NAND int am33xx_bbu_nand_xloadslots_register_handler(const char *name, |