summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-04-09 16:03:52 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-04-28 11:45:09 +0200
commit1a8800458bd12febff981fadc86b2cdf0abaf827 (patch)
tree964f019eefa5349b414b3ec0d7307637ffc9e586
parent33d4f7cb3da852420693e2a4f3782fb9a09a3861 (diff)
downloadbarebox-1a8800458bd12febff981fadc86b2cdf0abaf827.tar.gz
mtd: nand: create bb devices automatically
When a mtd device can have bad blocks we want to create a bb device, so do this automatically. This allows us to drop bb device creation from the environment. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--arch/arm/boards/a9m2410/env/bin/hush_hack1
-rw-r--r--arch/arm/boards/a9m2410/env/bin/init4
-rw-r--r--arch/arm/boards/a9m2440/env/bin/hush_hack1
-rw-r--r--arch/arm/boards/a9m2440/env/bin/init4
-rw-r--r--arch/arm/boards/eukrea_cpuimx27/env/bin/hush_hack1
-rw-r--r--arch/arm/boards/eukrea_cpuimx27/env/bin/init4
-rw-r--r--arch/arm/boards/freescale-mx25-3ds/env/bin/hush_hack1
-rw-r--r--arch/arm/boards/freescale-mx25-3ds/env/bin/init4
-rw-r--r--arch/arm/boards/mmccpu/env/bin/hush_hack1
-rw-r--r--arch/arm/boards/mmccpu/env/bin/init4
-rw-r--r--arch/arm/boards/pm9263/env/bin/hush_hack1
-rw-r--r--arch/arm/boards/pm9263/env/bin/init4
-rw-r--r--defaultenv/defaultenv-1/bin/init1
-rw-r--r--defaultenv/defaultenv-2-base/bin/mtdparts-add4
-rw-r--r--drivers/mtd/core.c3
-rw-r--r--drivers/of/partition.c3
-rw-r--r--include/linux/mtd/mtd.h2
17 files changed, 5 insertions, 38 deletions
diff --git a/arch/arm/boards/a9m2410/env/bin/hush_hack b/arch/arm/boards/a9m2410/env/bin/hush_hack
deleted file mode 100644
index 5fffa92..0000000
--- a/arch/arm/boards/a9m2410/env/bin/hush_hack
+++ /dev/null
@@ -1 +0,0 @@
-nand -a /dev/nand0.*
diff --git a/arch/arm/boards/a9m2410/env/bin/init b/arch/arm/boards/a9m2410/env/bin/init
index 5ae44dd..dd94ef6 100644
--- a/arch/arm/boards/a9m2410/env/bin/init
+++ b/arch/arm/boards/a9m2410/env/bin/init
@@ -7,10 +7,6 @@ export PATH
if [ -e /dev/nand0 ]; then
addpart /dev/nand0 $nand_parts
-
- # Uh, oh, hush first expands wildcards and then starts executing
- # commands. What a bug!
- source /env/bin/hush_hack
fi
if [ -z $eth0.ethaddr ]; then
diff --git a/arch/arm/boards/a9m2440/env/bin/hush_hack b/arch/arm/boards/a9m2440/env/bin/hush_hack
deleted file mode 100644
index 5fffa92..0000000
--- a/arch/arm/boards/a9m2440/env/bin/hush_hack
+++ /dev/null
@@ -1 +0,0 @@
-nand -a /dev/nand0.*
diff --git a/arch/arm/boards/a9m2440/env/bin/init b/arch/arm/boards/a9m2440/env/bin/init
index 5ae44dd..dd94ef6 100644
--- a/arch/arm/boards/a9m2440/env/bin/init
+++ b/arch/arm/boards/a9m2440/env/bin/init
@@ -7,10 +7,6 @@ export PATH
if [ -e /dev/nand0 ]; then
addpart /dev/nand0 $nand_parts
-
- # Uh, oh, hush first expands wildcards and then starts executing
- # commands. What a bug!
- source /env/bin/hush_hack
fi
if [ -z $eth0.ethaddr ]; then
diff --git a/arch/arm/boards/eukrea_cpuimx27/env/bin/hush_hack b/arch/arm/boards/eukrea_cpuimx27/env/bin/hush_hack
deleted file mode 100644
index 5fffa92..0000000
--- a/arch/arm/boards/eukrea_cpuimx27/env/bin/hush_hack
+++ /dev/null
@@ -1 +0,0 @@
-nand -a /dev/nand0.*
diff --git a/arch/arm/boards/eukrea_cpuimx27/env/bin/init b/arch/arm/boards/eukrea_cpuimx27/env/bin/init
index cd74974..e3c1091 100644
--- a/arch/arm/boards/eukrea_cpuimx27/env/bin/init
+++ b/arch/arm/boards/eukrea_cpuimx27/env/bin/init
@@ -10,10 +10,6 @@ fi
if [ -e /dev/nand0 ]; then
addpart /dev/nand0 $nand_parts
-
- # Uh, oh, hush first expands wildcards and then starts executing
- # commands. What a bug!
- source /env/bin/hush_hack
fi
if [ -f /env/logo.bmp ]; then
diff --git a/arch/arm/boards/freescale-mx25-3ds/env/bin/hush_hack b/arch/arm/boards/freescale-mx25-3ds/env/bin/hush_hack
deleted file mode 100644
index 5fffa92..0000000
--- a/arch/arm/boards/freescale-mx25-3ds/env/bin/hush_hack
+++ /dev/null
@@ -1 +0,0 @@
-nand -a /dev/nand0.*
diff --git a/arch/arm/boards/freescale-mx25-3ds/env/bin/init b/arch/arm/boards/freescale-mx25-3ds/env/bin/init
index 0600b9e..8eafa34 100644
--- a/arch/arm/boards/freescale-mx25-3ds/env/bin/init
+++ b/arch/arm/boards/freescale-mx25-3ds/env/bin/init
@@ -10,10 +10,6 @@ fi
if [ -e /dev/nand0 ]; then
addpart /dev/nand0 $nand_parts
-
- # Uh, oh, hush first expands wildcards and then starts executing
- # commands. What a bug!
- source /env/bin/hush_hack
fi
echo
diff --git a/arch/arm/boards/mmccpu/env/bin/hush_hack b/arch/arm/boards/mmccpu/env/bin/hush_hack
deleted file mode 100644
index 5fffa92..0000000
--- a/arch/arm/boards/mmccpu/env/bin/hush_hack
+++ /dev/null
@@ -1 +0,0 @@
-nand -a /dev/nand0.*
diff --git a/arch/arm/boards/mmccpu/env/bin/init b/arch/arm/boards/mmccpu/env/bin/init
index ac84bd5..ad9b65a 100644
--- a/arch/arm/boards/mmccpu/env/bin/init
+++ b/arch/arm/boards/mmccpu/env/bin/init
@@ -10,10 +10,6 @@ fi
if [ -e /dev/nand0 ]; then
addpart /dev/nand0 $nand_parts
-
- # Uh, oh, hush first expands wildcards and then starts executing
- # commands. What a bug!
- source /env/bin/hush_hack
fi
if [ -z $eth0.ethaddr ]; then
diff --git a/arch/arm/boards/pm9263/env/bin/hush_hack b/arch/arm/boards/pm9263/env/bin/hush_hack
deleted file mode 100644
index 5fffa92..0000000
--- a/arch/arm/boards/pm9263/env/bin/hush_hack
+++ /dev/null
@@ -1 +0,0 @@
-nand -a /dev/nand0.*
diff --git a/arch/arm/boards/pm9263/env/bin/init b/arch/arm/boards/pm9263/env/bin/init
index 02f5cd4..ad9b65a 100644
--- a/arch/arm/boards/pm9263/env/bin/init
+++ b/arch/arm/boards/pm9263/env/bin/init
@@ -10,10 +10,6 @@ fi
if [ -e /dev/nand0 ]; then
addpart /dev/nand0 $nand_parts
-
- # Uh, oh, hush first expands wildcards and then starts executing
- # commands. What a bug!
- source /env/bin/hush_hack
fi
if [ -z $eth0.ethaddr ]; then
diff --git a/defaultenv/defaultenv-1/bin/init b/defaultenv/defaultenv-1/bin/init
index adb3c43..4781b5a 100644
--- a/defaultenv/defaultenv-1/bin/init
+++ b/defaultenv/defaultenv-1/bin/init
@@ -16,7 +16,6 @@ fi
if [ -e /dev/nand0 -a -n "$nand_parts" ]; then
addpart /dev/nand0 $nand_parts
- nand -a /dev/nand0.*
fi
if [ -f /env/bin/init_board ]; then
diff --git a/defaultenv/defaultenv-2-base/bin/mtdparts-add b/defaultenv/defaultenv-2-base/bin/mtdparts-add
index 58c9fa7..05ab638 100644
--- a/defaultenv/defaultenv-2-base/bin/mtdparts-add
+++ b/defaultenv/defaultenv-2-base/bin/mtdparts-add
@@ -39,10 +39,6 @@ fi
addpart -n /dev/${device} "$parts" || exit
mkdir -p /tmp/mtdparts/${device}
-if [ -n "${bbdev}" ]; then
- nand -a /dev/${device}.*
-fi
-
if [ -n ${kernelname} ]; then
global linux.mtdparts.${device}
global.linux.mtdparts.${device}="${kernelname}:${parts}"
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index c97c8c1..d954f72 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -409,6 +409,9 @@ int add_mtd_device(struct mtd_info *mtd, char *devname, int device_id)
devfs_create(&mtd->cdev);
+ if (mtd_can_have_bb(mtd))
+ mtd->cdev_bb = mtd_add_bb(mtd, NULL);
+
if (mtd->parent && !mtd->master)
of_parse_partitions(&mtd->cdev, mtd->parent->device_node);
diff --git a/drivers/of/partition.c b/drivers/of/partition.c
index 5ed44a8..074be09 100644
--- a/drivers/of/partition.c
+++ b/drivers/of/partition.c
@@ -61,9 +61,6 @@ struct cdev *of_parse_partition(struct cdev *cdev, struct device_node *node)
new = devfs_add_partition(cdev->name, offset, size, flags, filename);
- if (cdev->mtd && cdev->mtd->type == MTD_NANDFLASH)
- dev_add_bb_dev(filename, NULL);
-
free(filename);
return new;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index c63b514..5f02aee 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -211,6 +211,8 @@ struct mtd_info {
struct device_d *parent;
struct cdev cdev;
+ struct cdev *cdev_bb;
+
struct param_d param_size;
char *size_str;