Skip to content

Commit

Permalink
mtd: nand: ecc-bch: Move BCH code to the generic NAND layer
Browse files Browse the repository at this point in the history
BCH ECC code might be later re-used by the SPI NAND layer.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20200929230124.31491-3-miquel.raynal@bootlin.com
  • Loading branch information
Miquel Raynal committed Nov 30, 2020
1 parent 51e7bf4 commit cdbe8df
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 18 deletions.
11 changes: 11 additions & 0 deletions drivers/mtd/nand/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ config MTD_NAND_ECC
bool
depends on MTD_NAND_CORE

config MTD_NAND_ECC_SW_BCH
bool "Software BCH ECC engine"
select BCH
select MTD_NAND_ECC
default n
help
This enables support for software BCH error correction. Binary BCH
codes are more powerful and cpu intensive than traditional Hamming
ECC codes. They are used with NAND devices requiring more than 1 bit
of error correction.

endmenu

endmenu
1 change: 1 addition & 0 deletions drivers/mtd/nand/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ obj-y += raw/
obj-y += spi/

nandcore-$(CONFIG_MTD_NAND_ECC) += ecc.o
nandcore-$(CONFIG_MTD_NAND_ECC_SW_BCH) += ecc-sw-bch.o
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/bitops.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/nand_bch.h>
#include <linux/mtd/nand-ecc-sw-bch.h>
#include <linux/bch.h>

/**
Expand Down
10 changes: 0 additions & 10 deletions drivers/mtd/nand/raw/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ menuconfig MTD_RAW_NAND

if MTD_RAW_NAND

config MTD_NAND_ECC_SW_BCH
bool "Support software BCH ECC"
select BCH
default n
help
This enables support for software BCH error correction. Binary BCH
codes are more powerful and cpu intensive than traditional Hamming
ECC codes. They are used with NAND devices requiring more than 1 bit
of error correction.

comment "Raw/parallel NAND flash controllers"

config MTD_NAND_DENALI
Expand Down
1 change: 0 additions & 1 deletion drivers/mtd/nand/raw/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

obj-$(CONFIG_MTD_RAW_NAND) += nand.o
obj-$(CONFIG_MTD_NAND_ECC_SW_HAMMING) += nand_ecc.o
nand-$(CONFIG_MTD_NAND_ECC_SW_BCH) += nand_bch.o
obj-$(CONFIG_MTD_SM_COMMON) += sm_common.o

obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/nand_ecc.h>
#include <linux/mtd/nand_bch.h>
#include <linux/mtd/nand-ecc-sw-bch.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/io.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/nandsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <linux/string.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/nand_bch.h>
#include <linux/mtd/nand-ecc-sw-bch.h>
#include <linux/mtd/partitions.h>
#include <linux/delay.h>
#include <linux/list.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <linux/of.h>
#include <linux/of_device.h>

#include <linux/mtd/nand_bch.h>
#include <linux/mtd/nand-ecc-sw-bch.h>
#include <linux/platform_data/elm.h>

#include <linux/omap-gpmc.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* This file is the header for the NAND BCH ECC implementation.
*/

#ifndef __MTD_NAND_BCH_H__
#define __MTD_NAND_BCH_H__
#ifndef __MTD_NAND_ECC_SW_BCH_H__
#define __MTD_NAND_ECC_SW_BCH_H__

struct mtd_info;
struct nand_chip;
Expand Down Expand Up @@ -63,4 +63,4 @@ static inline void nand_bch_free(struct nand_bch_control *nbc) {}

#endif /* CONFIG_MTD_NAND_ECC_SW_BCH */

#endif /* __MTD_NAND_BCH_H__ */
#endif /* __MTD_NAND_ECC_SW_BCH_H__ */

0 comments on commit cdbe8df

Please sign in to comment.