* [PATCH 1/7] [MTD] Blackfin NFC Driver: fix bug - do not clobber the status from the first 256 bytes if operating on 512 pages
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
2008-07-27 6:27 ` [PATCH 2/7] [MTD] Blackfin NFC Driver: fix bug - hw ecc calc by making sure we extract 11 bits from each register instead of 10 Bryan Wu
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier.adi@gmail.com>
Singed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/bf5xx_nand.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index e87a572..3254348 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -273,7 +273,7 @@ static int bf5xx_nand_correct_data(struct mtd_info *mtd, u_char *dat,
dat += 256;
read_ecc += 8;
calc_ecc += 8;
- ret = bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc);
+ ret |= bf5xx_nand_correct_data_256(mtd, dat, read_ecc, calc_ecc);
}
return ret;
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/7] [MTD] Blackfin NFC Driver: fix bug - hw ecc calc by making sure we extract 11 bits from each register instead of 10
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
2008-07-27 6:27 ` [PATCH 1/7] [MTD] Blackfin NFC Driver: fix bug - do not clobber the status from the first 256 bytes if operating on 512 pages Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
2008-07-27 6:27 ` [PATCH 3/7] [MTD] Blackfin NFC Driver: add support for the ECC layout the Blackfin bootrom uses Bryan Wu
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/bf5xx_nand.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 3254348..fc58afe 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -298,7 +298,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
ecc0 = bfin_read_NFC_ECC0();
ecc1 = bfin_read_NFC_ECC1();
- code[0] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11);
+ code[0] = (ecc0 & 0x7ff) | ((ecc1 & 0x7ff) << 11);
dev_dbg(info->device, "returning ecc 0x%08x\n", code[0]);
@@ -310,7 +310,7 @@ static int bf5xx_nand_calculate_ecc(struct mtd_info *mtd,
if (page_size == 512) {
ecc0 = bfin_read_NFC_ECC2();
ecc1 = bfin_read_NFC_ECC3();
- code[1] = (ecc0 & 0x3FF) | ((ecc1 & 0x3FF) << 11);
+ code[1] = (ecc0 & 0x7ff) | ((ecc1 & 0x7ff) << 11);
/* second 3 bytes in ecc_code for second 256
* bytes of 512 page size
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/7] [MTD] Blackfin NFC Driver: add support for the ECC layout the Blackfin bootrom uses
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
2008-07-27 6:27 ` [PATCH 1/7] [MTD] Blackfin NFC Driver: fix bug - do not clobber the status from the first 256 bytes if operating on 512 pages Bryan Wu
2008-07-27 6:27 ` [PATCH 2/7] [MTD] Blackfin NFC Driver: fix bug - hw ecc calc by making sure we extract 11 bits from each register instead of 10 Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
2008-07-27 6:27 ` [PATCH 4/7] [MTD] Blackfin NFC Driver: add proper devinit/devexit markings to probe/remove functions Bryan Wu
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/Kconfig | 12 ++++++++++++
drivers/mtd/nand/bf5xx_nand.c | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 5076faf..6ca1ec0 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -110,6 +110,18 @@ config MTD_NAND_BF5XX_HWECC
Enable the use of the BF5XX's internal ECC generator when
using NAND.
+config MTD_NAND_BF5XX_BOOTROM_ECC
+ bool "Use Blackfin BootROM ECC Layout"
+ default n
+ depends on MTD_NAND_BF5XX_HWECC
+ help
+ If you wish to modify NAND pages and allow the Blackfin on-chip
+ BootROM to boot from them, say Y here. This is only necessary
+ if you are booting U-Boot out of NAND and you wish to update
+ U-Boot from Linux' userspace. Otherwise, you should say N here.
+
+ If unsure, say N.
+
config MTD_NAND_RTC_FROM4
tristate "Renesas Flash ROM 4-slot interface board (FROM_BOARD4)"
depends on SH_SOLUTION_ENGINE
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index fc58afe..3555f6b 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -91,6 +91,41 @@ static const unsigned short bfin_nfc_pin_req[] =
P_NAND_ALE,
0};
+#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
+static uint8_t bbt_pattern[] = { 0xff };
+
+static struct nand_bbt_descr bootrom_bbt = {
+ .options = 0,
+ .offs = 63,
+ .len = 1,
+ .pattern = bbt_pattern,
+};
+
+static struct nand_ecclayout bootrom_ecclayout = {
+ .eccbytes = 24,
+ .eccpos = {
+ 0x8 * 0, 0x8 * 0 + 1, 0x8 * 0 + 2,
+ 0x8 * 1, 0x8 * 1 + 1, 0x8 * 1 + 2,
+ 0x8 * 2, 0x8 * 2 + 1, 0x8 * 2 + 2,
+ 0x8 * 3, 0x8 * 3 + 1, 0x8 * 3 + 2,
+ 0x8 * 4, 0x8 * 4 + 1, 0x8 * 4 + 2,
+ 0x8 * 5, 0x8 * 5 + 1, 0x8 * 5 + 2,
+ 0x8 * 6, 0x8 * 6 + 1, 0x8 * 6 + 2,
+ 0x8 * 7, 0x8 * 7 + 1, 0x8 * 7 + 2
+ },
+ .oobfree = {
+ { 0x8 * 0 + 3, 5 },
+ { 0x8 * 1 + 3, 5 },
+ { 0x8 * 2 + 3, 5 },
+ { 0x8 * 3 + 3, 5 },
+ { 0x8 * 4 + 3, 5 },
+ { 0x8 * 5 + 3, 5 },
+ { 0x8 * 6 + 3, 5 },
+ { 0x8 * 7 + 3, 5 },
+ }
+};
+#endif
+
/*
* Data structures for bf5xx nand flash controller driver
*/
@@ -712,6 +747,11 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
/* setup hardware ECC data struct */
if (hardware_ecc) {
+#ifdef CONFIG_MTD_NAND_BF5XX_BOOTROM_ECC
+ chip->badblock_pattern = &bootrom_bbt;
+ chip->ecc.layout = &bootrom_ecclayout;
+#endif
+
if (plat->page_size == NFC_PG_SIZE_256) {
chip->ecc.bytes = 3;
chip->ecc.size = 256;
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/7] [MTD] Blackfin NFC Driver: add proper devinit/devexit markings to probe/remove functions
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
` (2 preceding siblings ...)
2008-07-27 6:27 ` [PATCH 3/7] [MTD] Blackfin NFC Driver: add support for the ECC layout the Blackfin bootrom uses Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
2008-07-27 6:27 ` [PATCH 5/7] [MTD] Blackfin NFC Driver: enable Blackfin nand HWECC support by default Bryan Wu
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/bf5xx_nand.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 3555f6b..e259a7b 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -640,7 +640,7 @@ static int bf5xx_nand_add_partition(struct bf5xx_nand_info *info)
#endif
}
-static int bf5xx_nand_remove(struct platform_device *pdev)
+static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
{
struct bf5xx_nand_info *info = to_nand_info(pdev);
struct mtd_info *mtd = NULL;
@@ -673,7 +673,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
* it can allocate all necessary resources then calls the
* nand layer to look for devices
*/
-static int bf5xx_nand_probe(struct platform_device *pdev)
+static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
{
struct bf5xx_nand_platform *plat = to_nand_plat(pdev);
struct bf5xx_nand_info *info = NULL;
@@ -815,7 +815,7 @@ static int bf5xx_nand_resume(struct platform_device *dev)
/* driver device registration */
static struct platform_driver bf5xx_nand_driver = {
.probe = bf5xx_nand_probe,
- .remove = bf5xx_nand_remove,
+ .remove = __devexit_p(bf5xx_nand_remove),
.suspend = bf5xx_nand_suspend,
.resume = bf5xx_nand_resume,
.driver = {
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 5/7] [MTD] Blackfin NFC Driver: enable Blackfin nand HWECC support by default
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
` (3 preceding siblings ...)
2008-07-27 6:27 ` [PATCH 4/7] [MTD] Blackfin NFC Driver: add proper devinit/devexit markings to probe/remove functions Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
2008-07-27 6:27 ` [PATCH 6/7] [MTD] Blackfin NFC Driver: use standard dev_err() rather than printk() Bryan Wu
2008-07-27 6:27 ` [PATCH 7/7] [MTD] Blackfin NFC Driver: Cleanup the error exit path of bf5xx_nand_probe function Bryan Wu
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 6ca1ec0..582942d 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -105,6 +105,7 @@ config MTD_NAND_BF5XX
config MTD_NAND_BF5XX_HWECC
bool "BF5XX NAND Hardware ECC"
+ default y
depends on MTD_NAND_BF5XX
help
Enable the use of the BF5XX's internal ECC generator when
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 6/7] [MTD] Blackfin NFC Driver: use standard dev_err() rather than printk()
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
` (4 preceding siblings ...)
2008-07-27 6:27 ` [PATCH 5/7] [MTD] Blackfin NFC Driver: enable Blackfin nand HWECC support by default Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
2008-07-27 6:27 ` [PATCH 7/7] [MTD] Blackfin NFC Driver: Cleanup the error exit path of bf5xx_nand_probe function Bryan Wu
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel, Mike Frysinger
From: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/bf5xx_nand.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index e259a7b..6cf7fb8 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -684,8 +684,7 @@ static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "(%p)\n", pdev);
if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
- printk(KERN_ERR DRV_NAME
- ": Requesting Peripherals failed\n");
+ dev_err(&pdev->dev, "requesting Peripherals failed\n");
return -EFAULT;
}
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 7/7] [MTD] Blackfin NFC Driver: Cleanup the error exit path of bf5xx_nand_probe function
2008-07-27 6:27 [PATCH 0/7] Blackfin on-chip NAND Flash Controller driver updates for 2.6.27 Bryan Wu
` (5 preceding siblings ...)
2008-07-27 6:27 ` [PATCH 6/7] [MTD] Blackfin NFC Driver: use standard dev_err() rather than printk() Bryan Wu
@ 2008-07-27 6:27 ` Bryan Wu
6 siblings, 0 replies; 8+ messages in thread
From: Bryan Wu @ 2008-07-27 6:27 UTC (permalink / raw)
To: dwmw2, akpm; +Cc: Bryan Wu, linux-mtd, linux-kernel
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
drivers/mtd/nand/bf5xx_nand.c | 38 ++++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 6cf7fb8..9af2a2c 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -549,7 +549,6 @@ static void bf5xx_nand_dma_write_buf(struct mtd_info *mtd,
/*
* System initialization functions
*/
-
static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
{
int ret;
@@ -582,6 +581,13 @@ static int bf5xx_nand_dma_init(struct bf5xx_nand_info *info)
return 0;
}
+static void bf5xx_nand_dma_remove(struct bf5xx_nand_info *info)
+{
+ /* Free NFC DMA channel */
+ if (hardware_ecc)
+ free_dma(CH_NFC);
+}
+
/*
* BF5XX NFC hardware initialization
* - pin mux setup
@@ -658,6 +664,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev)
}
peripheral_free_list(bfin_nfc_pin_req);
+ bf5xx_nand_dma_remove(info);
/* free the common resources */
kfree(info);
@@ -683,21 +690,21 @@ static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "(%p)\n", pdev);
+ if (!plat) {
+ dev_err(&pdev->dev, "no platform specific information\n");
+ return -EINVAL;
+ }
+
if (peripheral_request_list(bfin_nfc_pin_req, DRV_NAME)) {
dev_err(&pdev->dev, "requesting Peripherals failed\n");
return -EFAULT;
}
- if (!plat) {
- dev_err(&pdev->dev, "no platform specific information\n");
- goto exit_error;
- }
-
info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL) {
dev_err(&pdev->dev, "no memory for flash info\n");
err = -ENOMEM;
- goto exit_error;
+ goto out_err_kzalloc;
}
platform_set_drvdata(pdev, info);
@@ -741,8 +748,8 @@ static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
/* initialise the hardware */
err = bf5xx_nand_hw_init(info);
- if (err != 0)
- goto exit_error;
+ if (err)
+ goto out_err_hw_init;
/* setup hardware ECC data struct */
if (hardware_ecc) {
@@ -772,7 +779,7 @@ static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
/* scan hardware nand chip and setup mtd info data struct */
if (nand_scan(mtd, 1)) {
err = -ENXIO;
- goto exit_error;
+ goto out_err_nand_scan;
}
/* add NAND partition */
@@ -781,11 +788,14 @@ static int __devinit bf5xx_nand_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "initialised ok\n");
return 0;
-exit_error:
- bf5xx_nand_remove(pdev);
+out_err_nand_scan:
+ bf5xx_nand_dma_remove(info);
+out_err_hw_init:
+ platform_set_drvdata(pdev, NULL);
+ kfree(info);
+out_err_kzalloc:
+ peripheral_free_list(bfin_nfc_pin_req);
- if (err == 0)
- err = -EINVAL;
return err;
}
--
1.5.6
^ permalink raw reply related [flat|nested] 8+ messages in thread