rockchip: mkimage: rewrite padding calculation for SD/MMC and SPI images
authorPhilipp Tomsich <philipp.tomsich@theobroma-systems.com>
Mon, 17 Apr 2017 15:48:01 +0000 (17:48 +0200)
committerSimon Glass <sjg@chromium.org>
Wed, 10 May 2017 19:37:21 +0000 (13:37 -0600)
commit366aad4d97846d02f32e8a6a824c4d6e9e5345c6
tree5cb0dcf63f812beb830c14ccda98859ee18c807d
parent798c93faf3b86f0eee542fbe8698618e05b48a09
rockchip: mkimage: rewrite padding calculation for SD/MMC and SPI images

In (first) breaking and (then) fixing the rkspi tool, I realised that
the calculation of the required padding (for the header-size and the
2K-in-every-4K SPI layout) was not as self-explainatory as it could
have been.  This change rewrites the code (using new, common functions
in rkcommon.c) and adds verbose in-line comments to ensure that we
won't fall into the same pit in the future...

Tested on the RK3399 (with has a boot0-style payload) with SD/MMC and SPI.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Acked-by: Simon Glass <sjg@chromium.org>
tools/rkcommon.c
tools/rkcommon.h
tools/rksd.c
tools/rkspi.c