Skip to content

Commit

Permalink
imx-bbu-nand-fcb: fix build on MX28 only
Browse files Browse the repository at this point in the history
This code may be compiled without ARCH_IMX6 present, so it must not
depend on any functions provided by the architecture support.

Fixes: a2618c2 (imx-bbu-nand-fcb: add support for imx6ul)
Signed-off-by: Lucas Stach <[email protected]>
Signed-off-by: Sascha Hauer <[email protected]>
  • Loading branch information
lynxeye-dev authored and saschahauer committed Nov 21, 2017
1 parent e066ea0 commit f199308
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions common/imx-bbu-nand-fcb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f199308

Please sign in to comment.