diff options
author | Stefan Christ <s.christ@phytec.de> | 2015-01-28 11:11:15 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-01-29 07:58:00 +0100 |
commit | a114e9b00c6c3f73be8f9de4c4722a6320399252 (patch) | |
tree | 615e7d0fc0ca00b98bb0410ebfc61d0766c7b442 /include | |
parent | 41e3d1c92a17e4a5c76c2c6ddfed5bdbe0603529 (diff) | |
download | barebox-a114e9b00c6c3f73be8f9de4c4722a6320399252.tar.gz barebox-a114e9b00c6c3f73be8f9de4c4722a6320399252.tar.xz |
ARM: i.MX6: use generic calculation in nand bbu handler
The parameters ECC Strength, BadBlockMarkerByte and BadBlockMarkerStartBit in
the FCB structure depends on the nand chip's pagesize and oobsize. Instead of
hardcoding these values into the imx6 bbu handler calculate these values on the
fly. Therefore we export the necessary functions from the nand_mxs driver to
use them in the bbu handler.
Signed-off-by: Stefan Christ <s.christ@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mtd/nand_mxs.h | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/include/linux/mtd/nand_mxs.h b/include/linux/mtd/nand_mxs.h new file mode 100644 index 0000000000..eca31777f5 --- /dev/null +++ b/include/linux/mtd/nand_mxs.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2015 PHYTEC Messtechnik GmbH, + * Author: Stefan Christ <s.christ@phytec.de> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __NAND_MXS_H +#define __NAND_MXS_H + +/* + * Functions are definied in drivers/mtd/nand/nand_mxs.c. They are used to + * calculate the ECC Strength, BadBlockMarkerByte and BadBlockMarkerStartBit + * which are placed into the FCB structure. The i.MX6 ROM needs these + * parameters to read the firmware from NAND. + * + * The parameters depends on the pagesize and oobsize of NAND chips and are + * different for each combination. To avoid placing hardcoded values in the bbu + * update handler code, the generic calculation from the driver code is used. + */ + +uint32_t mxs_nand_get_ecc_strength(uint32_t page_data_size, + uint32_t page_oob_size); + +uint32_t mxs_nand_mark_byte_offset(struct mtd_info *mtd); + +uint32_t mxs_nand_mark_bit_offset(struct mtd_info *mtd); + +#endif /* __NAND_MXS_H */ |