diff options
author | Lucas Stach <l.stach@pengutronix.de> | 2017-11-17 19:14:26 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2017-11-21 08:17:49 +0100 |
commit | f19930887a222e4bbf12c1481f9fe542a057aebf (patch) | |
tree | 3c90e24ae3f0f72ab4f09e5cc802966870055bcf /common | |
parent | e066ea014b70d45d82d8ae1b51f3cf339bc4c7f2 (diff) | |
download | barebox-f19930887a222e4bbf12c1481f9fe542a057aebf.tar.gz barebox-f19930887a222e4bbf12c1481f9fe542a057aebf.tar.xz |
imx-bbu-nand-fcb: fix build on MX28 only
This code may be compiled without ARCH_IMX6 present, so it must not
depend on any functions provided by the architecture support.
Fixes: a2618c215bff (imx-bbu-nand-fcb: add support for imx6ul)
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r-- | common/imx-bbu-nand-fcb.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/common/imx-bbu-nand-fcb.c b/common/imx-bbu-nand-fcb.c index 89b404884a..2c8ca97926 100644 --- a/common/imx-bbu-nand-fcb.c +++ b/common/imx-bbu-nand-fcb.c @@ -38,9 +38,21 @@ #include <io.h> #include <crc.h> #include <mach/generic.h> -#include <mach/imx6.h> #include <mtd/mtd-peb.h> +#ifdef CONFIG_ARCH_IMX6 +#include <mach/imx6.h> +static inline int fcb_is_bch_encoded(void) +{ + return cpu_is_mx6ul() || cpu_is_mx6ull(); +} +#else +static inline int fcb_is_bch_encoded(void) +{ + return 0; +} +#endif + struct dbbt_block { uint32_t Checksum; uint32_t FingerPrint; @@ -441,7 +453,7 @@ static int read_fcb(struct mtd_info *mtd, int num, struct fcb_block **retfcb) goto err; } - if (cpu_is_mx6ul() || cpu_is_mx6ull()) + if (fcb_is_bch_encoded()) fcb = read_fcb_bch(rawpage, 40); else fcb = read_fcb_hamming_13_8(rawpage); @@ -899,7 +911,7 @@ static int imx_bbu_write_fcbs_dbbts(struct mtd_info *mtd, struct fcb_block *fcb) fcb_raw_page = xzalloc(mtd->writesize + mtd->oobsize); - if (cpu_is_mx6ul() || cpu_is_mx6ull()) { + if (fcb_is_bch_encoded()) { /* 40 bit BCH, for i.MX6UL(L) */ encode_bch_ecc(fcb_raw_page + 32, fcb, 40); } else { |