aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2012-11-20 16:29:43 +0000
committerGabor Juhos <juhosg@openwrt.org>2012-11-20 16:29:43 +0000
commit188908e8858c46c0245efa12be87c021d71ff53c (patch)
treec82af8246d73dada3914ab2ec3696b0a846b80c1 /target
parent819423778947e01613bfe8f8664639f34e5750b6 (diff)
downloadupstream-188908e8858c46c0245efa12be87c021d71ff53c.tar.gz
upstream-188908e8858c46c0245efa12be87c021d71ff53c.tar.bz2
upstream-188908e8858c46c0245efa12be87c021d71ff53c.zip
ar71xx: make rb750_nand driver compatible with 3.7
Also add compatibility patches for the currently supported kernels. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 34279
Diffstat (limited to 'target')
-rw-r--r--target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c20
-rw-r--r--target/linux/ar71xx/patches-3.3/a04-rb750_nand-add-NO_AUTOINCR-flag.patch2
-rw-r--r--target/linux/ar71xx/patches-3.3/a06-rb750_nand-add-buffer-verification.patch63
-rw-r--r--target/linux/ar71xx/patches-3.6/a06-rb750_nand-add-buffer-verification.patch63
4 files changed, 131 insertions, 17 deletions
diff --git a/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c
index 9a0eadb93d..94dedd8e44 100644
--- a/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c
+++ b/target/linux/ar71xx/files/drivers/mtd/nand/rb750_nand.c
@@ -110,8 +110,7 @@ static void rb750_nand_write(const u8 *buf, unsigned len)
__raw_readl(base + AR71XX_GPIO_REG_OE);
}
-static int rb750_nand_read_verify(u8 *read_buf, unsigned len,
- const u8 *verify_buf)
+static void rb750_nand_read(u8 *read_buf, unsigned len)
{
void __iomem *base = ath79_gpio_base;
unsigned i;
@@ -131,13 +130,8 @@ static int rb750_nand_read_verify(u8 *read_buf, unsigned len,
/* deactivate RE line */
__raw_writel(RB750_NAND_NRE, base + AR71XX_GPIO_REG_SET);
- if (read_buf)
- read_buf[i] = data;
- else if (verify_buf && verify_buf[i] != data)
- return -EFAULT;
+ read_buf[i] = data;
}
-
- return 0;
}
static void rb750_nand_select_chip(struct mtd_info *mtd, int chip)
@@ -212,13 +206,13 @@ static void rb750_nand_cmd_ctrl(struct mtd_info *mtd, int cmd,
static u8 rb750_nand_read_byte(struct mtd_info *mtd)
{
u8 data = 0;
- rb750_nand_read_verify(&data, 1, NULL);
+ rb750_nand_read(&data, 1);
return data;
}
static void rb750_nand_read_buf(struct mtd_info *mtd, u8 *buf, int len)
{
- rb750_nand_read_verify(buf, len, NULL);
+ rb750_nand_read(buf, len);
}
static void rb750_nand_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
@@ -226,11 +220,6 @@ static void rb750_nand_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
rb750_nand_write(buf, len);
}
-static int rb750_nand_verify_buf(struct mtd_info *mtd, const u8 *buf, int len)
-{
- return rb750_nand_read_verify(NULL, len, buf);
-}
-
static void __init rb750_nand_gpio_init(struct rb750_nand_info *info)
{
void __iomem *base = ath79_gpio_base;
@@ -285,7 +274,6 @@ static int __devinit rb750_nand_probe(struct platform_device *pdev)
info->chip.read_byte = rb750_nand_read_byte;
info->chip.write_buf = rb750_nand_write_buf;
info->chip.read_buf = rb750_nand_read_buf;
- info->chip.verify_buf = rb750_nand_verify_buf;
info->chip.chip_delay = 25;
info->chip.ecc.mode = NAND_ECC_SOFT;
diff --git a/target/linux/ar71xx/patches-3.3/a04-rb750_nand-add-NO_AUTOINCR-flag.patch b/target/linux/ar71xx/patches-3.3/a04-rb750_nand-add-NO_AUTOINCR-flag.patch
index 0b0dfe6c89..4082df2ead 100644
--- a/target/linux/ar71xx/patches-3.3/a04-rb750_nand-add-NO_AUTOINCR-flag.patch
+++ b/target/linux/ar71xx/patches-3.3/a04-rb750_nand-add-NO_AUTOINCR-flag.patch
@@ -1,7 +1,7 @@
reverted:
--- a/drivers/mtd/nand/rb750_nand.c
+++ b/drivers/mtd/nand/rb750_nand.c
-@@ -289,6 +289,7 @@ static int __devinit rb750_nand_probe(st
+@@ -277,6 +277,7 @@ static int __devinit rb750_nand_probe(st
info->chip.chip_delay = 25;
info->chip.ecc.mode = NAND_ECC_SOFT;
diff --git a/target/linux/ar71xx/patches-3.3/a06-rb750_nand-add-buffer-verification.patch b/target/linux/ar71xx/patches-3.3/a06-rb750_nand-add-buffer-verification.patch
new file mode 100644
index 0000000000..fb27194d86
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.3/a06-rb750_nand-add-buffer-verification.patch
@@ -0,0 +1,63 @@
+--- a/drivers/mtd/nand/rb750_nand.c
++++ b/drivers/mtd/nand/rb750_nand.c
+@@ -110,7 +110,8 @@ static void rb750_nand_write(const u8 *b
+ __raw_readl(base + AR71XX_GPIO_REG_OE);
+ }
+
+-static void rb750_nand_read(u8 *read_buf, unsigned len)
++static int rb750_nand_read_verify(u8 *read_buf, unsigned len,
++ const u8 *verify_buf)
+ {
+ void __iomem *base = ath79_gpio_base;
+ unsigned i;
+@@ -130,8 +131,13 @@ static void rb750_nand_read(u8 *read_buf
+ /* deactivate RE line */
+ __raw_writel(RB750_NAND_NRE, base + AR71XX_GPIO_REG_SET);
+
+- read_buf[i] = data;
++ if (read_buf)
++ read_buf[i] = data;
++ else if (verify_buf && verify_buf[i] != data)
++ return -EFAULT;
+ }
++
++ return 0;
+ }
+
+ static void rb750_nand_select_chip(struct mtd_info *mtd, int chip)
+@@ -206,13 +212,13 @@ static void rb750_nand_cmd_ctrl(struct m
+ static u8 rb750_nand_read_byte(struct mtd_info *mtd)
+ {
+ u8 data = 0;
+- rb750_nand_read(&data, 1);
++ rb750_nand_read_verify(&data, 1, NULL);
+ return data;
+ }
+
+ static void rb750_nand_read_buf(struct mtd_info *mtd, u8 *buf, int len)
+ {
+- rb750_nand_read(buf, len);
++ rb750_nand_read_verify(buf, len, NULL);
+ }
+
+ static void rb750_nand_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
+@@ -220,6 +226,11 @@ static void rb750_nand_write_buf(struct
+ rb750_nand_write(buf, len);
+ }
+
++static int rb750_nand_verify_buf(struct mtd_info *mtd, const u8 *buf, int len)
++{
++ return rb750_nand_read_verify(NULL, len, buf);
++}
++
+ static void __init rb750_nand_gpio_init(struct rb750_nand_info *info)
+ {
+ void __iomem *base = ath79_gpio_base;
+@@ -274,6 +285,7 @@ static int __devinit rb750_nand_probe(st
+ info->chip.read_byte = rb750_nand_read_byte;
+ info->chip.write_buf = rb750_nand_write_buf;
+ info->chip.read_buf = rb750_nand_read_buf;
++ info->chip.verify_buf = rb750_nand_verify_buf;
+
+ info->chip.chip_delay = 25;
+ info->chip.ecc.mode = NAND_ECC_SOFT;
diff --git a/target/linux/ar71xx/patches-3.6/a06-rb750_nand-add-buffer-verification.patch b/target/linux/ar71xx/patches-3.6/a06-rb750_nand-add-buffer-verification.patch
new file mode 100644
index 0000000000..fb27194d86
--- /dev/null
+++ b/target/linux/ar71xx/patches-3.6/a06-rb750_nand-add-buffer-verification.patch
@@ -0,0 +1,63 @@
+--- a/drivers/mtd/nand/rb750_nand.c
++++ b/drivers/mtd/nand/rb750_nand.c
+@@ -110,7 +110,8 @@ static void rb750_nand_write(const u8 *b
+ __raw_readl(base + AR71XX_GPIO_REG_OE);
+ }
+
+-static void rb750_nand_read(u8 *read_buf, unsigned len)
++static int rb750_nand_read_verify(u8 *read_buf, unsigned len,
++ const u8 *verify_buf)
+ {
+ void __iomem *base = ath79_gpio_base;
+ unsigned i;
+@@ -130,8 +131,13 @@ static void rb750_nand_read(u8 *read_buf
+ /* deactivate RE line */
+ __raw_writel(RB750_NAND_NRE, base + AR71XX_GPIO_REG_SET);
+
+- read_buf[i] = data;
++ if (read_buf)
++ read_buf[i] = data;
++ else if (verify_buf && verify_buf[i] != data)
++ return -EFAULT;
+ }
++
++ return 0;
+ }
+
+ static void rb750_nand_select_chip(struct mtd_info *mtd, int chip)
+@@ -206,13 +212,13 @@ static void rb750_nand_cmd_ctrl(struct m
+ static u8 rb750_nand_read_byte(struct mtd_info *mtd)
+ {
+ u8 data = 0;
+- rb750_nand_read(&data, 1);
++ rb750_nand_read_verify(&data, 1, NULL);
+ return data;
+ }
+
+ static void rb750_nand_read_buf(struct mtd_info *mtd, u8 *buf, int len)
+ {
+- rb750_nand_read(buf, len);
++ rb750_nand_read_verify(buf, len, NULL);
+ }
+
+ static void rb750_nand_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
+@@ -220,6 +226,11 @@ static void rb750_nand_write_buf(struct
+ rb750_nand_write(buf, len);
+ }
+
++static int rb750_nand_verify_buf(struct mtd_info *mtd, const u8 *buf, int len)
++{
++ return rb750_nand_read_verify(NULL, len, buf);
++}
++
+ static void __init rb750_nand_gpio_init(struct rb750_nand_info *info)
+ {
+ void __iomem *base = ath79_gpio_base;
+@@ -274,6 +285,7 @@ static int __devinit rb750_nand_probe(st
+ info->chip.read_byte = rb750_nand_read_byte;
+ info->chip.write_buf = rb750_nand_write_buf;
+ info->chip.read_buf = rb750_nand_read_buf;
++ info->chip.verify_buf = rb750_nand_verify_buf;
+
+ info->chip.chip_delay = 25;
+ info->chip.ecc.mode = NAND_ECC_SOFT;