rpms/kernel/FC-6 kernel-2.6.spec, 1.2805, 1.2806 linux-2.6-cafe-nand.patch, 1.1, 1.2
fedora-cvs-commits at redhat.com
fedora-cvs-commits at redhat.com
Wed Oct 18 19:39:55 UTC 2006
Author: dwmw2
Update of /cvs/dist/rpms/kernel/FC-6
In directory cvs.devel.redhat.com:/tmp/cvs-serv1519
Modified Files:
kernel-2.6.spec linux-2.6-cafe-nand.patch
Log Message:
Split CAFÃ driver from MTD changes, keep OLPC patches separate
Index: kernel-2.6.spec
===================================================================
RCS file: /cvs/dist/rpms/kernel/FC-6/kernel-2.6.spec,v
retrieving revision 1.2805
retrieving revision 1.2806
diff -u -r1.2805 -r1.2806
--- kernel-2.6.spec 18 Oct 2006 06:10:05 -0000 1.2805
+++ kernel-2.6.spec 18 Oct 2006 19:39:53 -0000 1.2806
@@ -493,15 +493,10 @@
Patch1771: linux-2.6-silence-noise.patch
Patch1780: linux-2.6-ehea-ethernet-driver.patch
Patch1790: linux-2.6-drivers-add-qlogic-firmware.patch
-Patch1791: linux-2.6-libertas.diff
-Patch1792: linux-2.6-olpc-touchpad.diff
Patch1794: linux-2.6-asix-usbnet-update.patch
Patch1795: linux-2.6-bnep-compat.patch
Patch1796: linux-2.6-hidp-compat.patch
Patch1797: linux-2.6-cmtp-compat.patch
-Patch1798: linux-2.6-cafe-nand.patch
-Patch1799: linux-2.6-marvell-88alp01.patch
-Patch1800: linux-2.6-olpc-dcon.patch
# SELinux/audit patches.
Patch1801: linux-2.6-selinux-mprotect-checks.patch
@@ -550,6 +545,14 @@
Patch2800: linux-2.6-serial-resume-removed.patch
Patch2801: linux-2.6-serial_cs-resume.patch
+# OLPC drivers
+Patch5000: linux-2.6-mtd-update.patch
+Patch5001: linux-2.6-cafe-nand.patch
+Patch5010: linux-2.6-marvell-88alp01.patch
+Patch5020: linux-2.6-olpc-dcon.patch
+Patch5030: linux-2.6-libertas.diff
+Patch5040: linux-2.6-olpc-touchpad.diff
+
#
# 10000 to 20000 is for stuff that has to come last due to the
# amount of drivers they touch. But only these should go here.
@@ -1119,25 +1122,12 @@
# qlogic firmware
%patch1790 -p1
-# OLPC specific patches
-%if 0%{?olpc}
-# Marvell Libertas wireless driver
-%patch1791 -p1
-# OLPC touchpad
-%patch1792 -p1
-# Marvell 88ALP01 camera
-%patch1799 -p1
-# OLPC DCON fb driver
-%patch1800 -p1
-%endif
# Fixes for DUB-E100 vB1 usb ethernet
%patch1794 -p1
# Fix various Bluetooth compat ioctls
%patch1795 -p1
%patch1796 -p1
%patch1797 -p1
-# Add CaFe NAND driver
-%patch1798 -p1
# Fix the SELinux mprotect checks on executable mappings
@@ -1204,9 +1194,26 @@
#
# Patches 5000 to 6000 are reserved for new drivers that are about to
-# be merged upstream
+# be merged upstream, which includes OLPC work
#
+# OLPC specific patches
+%if 0%{?olpc}
+# MTD NAND driver core updates...
+%patch5000 -p1
+# ... needed for OLPC CAFÃ NAND driver
+%patch5001 -p1
+
+# Marvell 88ALP01 camera
+%patch5010 -p1
+# OLPC DCON fb driver
+%patch5020 -p1
+# Marvell Libertas wireless driver
+%patch5030 -p1
+# OLPC touchpad
+%patch5040 -p1
+%endif
+
#
# final stuff
#
@@ -2027,6 +2034,9 @@
%endif
%changelog
+* Tue Oct 18 2006 David Woodhouse <dwmw2 at redhat.com>
+- Split CAFÃ NAND driver from the MTD changes it needs
+
* Wed Oct 18 2006 Dave Jones <davej at redhat.com>
- Fix up aic7xxx SBLKCTL register handling (#211251)
linux-2.6-cafe-nand.patch:
Kconfig | 7
Makefile | 1
cafe_nand.c | 635 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 643 insertions(+)
Index: linux-2.6-cafe-nand.patch
===================================================================
RCS file: /cvs/dist/rpms/kernel/FC-6/linux-2.6-cafe-nand.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- linux-2.6-cafe-nand.patch 16 Oct 2006 01:41:08 -0000 1.1
+++ linux-2.6-cafe-nand.patch 18 Oct 2006 19:39:53 -0000 1.2
@@ -1,6 +1,46 @@
-diff -Nur linux-2.6.18.i586.orig/drivers/mtd/nand/cafe_nand.c linux-2.6.18.i586/drivers/mtd/nand/cafe_nand.c
---- linux-2.6.18.i586.orig/drivers/mtd/nand/cafe_nand.c 1969-12-31 19:00:00.000000000 -0500
-+++ linux-2.6.18.i586/drivers/mtd/nand/cafe_nand.c 2006-10-15 20:37:36.000000000 -0400
+commit 5467fb025537eb92313fd3a557b2051cb41ba5e8
+Author: David Woodhouse <dwmw2 at infradead.org>
+Date: Fri Oct 6 15:36:29 2006 +0100
+
+ [MTD NAND] Initial import of CAFÃ NAND driver.
+
+ Signed-off-by: David Woodhouse <dwmw2 at infradead.org>
+
+diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
+index c99302e..5e97e63 100644
+--- a/drivers/mtd/nand/Kconfig
++++ b/drivers/mtd/nand/Kconfig
+@@ -232,6 +232,13 @@ config MTD_NAND_CS553X
+
+ If you say "m", the module will be called "cs553x_nand.ko".
+
++config MTD_NAND_CAFE
++ tristate "NAND support for OLPC CAFÃ chip"
++ depends on PCI
++ help
++ Use NAND flash attached to the CAFÃ chip designed for the $100
++ laptop.
++
+ config MTD_NAND_NANDSIM
+ tristate "Support for NAND Flash Simulator"
+ depends on MTD_NAND && MTD_PARTITIONS
+diff --git a/drivers/mtd/nand/Makefile b/drivers/mtd/nand/Makefile
+index f747593..9346b83 100644
+--- a/drivers/mtd/nand/Makefile
++++ b/drivers/mtd/nand/Makefile
+@@ -6,6 +6,7 @@ # $Id: Makefile.common,v 1.15 2004/11/26
+ obj-$(CONFIG_MTD_NAND) += nand.o nand_ecc.o
+ obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o
+
++obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o
+ obj-$(CONFIG_MTD_NAND_SPIA) += spia.o
+ obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o
+ obj-$(CONFIG_MTD_NAND_TOTO) += toto.o
+diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
+new file mode 100644
+index 0000000..8d7a795
+--- /dev/null
++++ b/drivers/mtd/nand/cafe_nand.c
@@ -0,0 +1,635 @@
+/*
+ * cafe_nand.c
@@ -637,533 +677,3 @@
+
+/* Correct ECC for 2048 bytes of 0xff:
+ 41 a0 71 65 54 27 f3 93 ec a9 be ed 0b a1 */
-diff -Nur linux-2.6.18.i586.orig/drivers/mtd/nand/Kconfig linux-2.6.18.i586/drivers/mtd/nand/Kconfig
---- linux-2.6.18.i586.orig/drivers/mtd/nand/Kconfig 2006-10-15 20:20:33.000000000 -0400
-+++ linux-2.6.18.i586/drivers/mtd/nand/Kconfig 2006-10-15 20:37:36.000000000 -0400
-@@ -232,6 +232,13 @@
-
- If you say "m", the module will be called "cs553x_nand.ko".
-
-+config MTD_NAND_CAFE
-+ tristate "NAND support for OLPC CAFÃ chip"
-+ depends on PCI
-+ help
-+ Use NAND flash attached to the CAFÃ chip designed for the $100
-+ laptop.
-+
- config MTD_NAND_NANDSIM
- tristate "Support for NAND Flash Simulator"
- depends on MTD_NAND && MTD_PARTITIONS
-diff -Nur linux-2.6.18.i586.orig/drivers/mtd/nand/Makefile linux-2.6.18.i586/drivers/mtd/nand/Makefile
---- linux-2.6.18.i586.orig/drivers/mtd/nand/Makefile 2006-10-15 20:20:33.000000000 -0400
-+++ linux-2.6.18.i586/drivers/mtd/nand/Makefile 2006-10-15 20:37:36.000000000 -0400
-@@ -6,6 +6,7 @@
- obj-$(CONFIG_MTD_NAND) += nand.o nand_ecc.o
- obj-$(CONFIG_MTD_NAND_IDS) += nand_ids.o
-
-+obj-$(CONFIG_MTD_NAND_CAFE) += cafe_nand.o
- obj-$(CONFIG_MTD_NAND_SPIA) += spia.o
- obj-$(CONFIG_MTD_NAND_AMS_DELTA) += ams-delta.o
- obj-$(CONFIG_MTD_NAND_TOTO) += toto.o
-diff -Nur linux-2.6.18.i586.orig/drivers/mtd/nand/nand_base.c linux-2.6.18.i586/drivers/mtd/nand/nand_base.c
---- linux-2.6.18.i586.orig/drivers/mtd/nand/nand_base.c 2006-10-15 20:20:33.000000000 -0400
-+++ linux-2.6.18.i586/drivers/mtd/nand/nand_base.c 2006-10-15 20:37:32.000000000 -0400
-@@ -415,7 +415,7 @@
- * Wait for the ready pin, after a command
- * The timeout is catched later.
- */
--static void nand_wait_ready(struct mtd_info *mtd)
-+void nand_wait_ready(struct mtd_info *mtd)
- {
- struct nand_chip *chip = mtd->priv;
- unsigned long timeo = jiffies + 2;
-@@ -429,6 +429,7 @@
- } while (time_before(jiffies, timeo));
- led_trigger_event(nand_led_trigger, LED_OFF);
- }
-+EXPORT_SYMBOL_GPL(nand_wait_ready);
-
- /**
- * nand_command - [DEFAULT] Send command to NAND device
-@@ -766,8 +767,8 @@
- int eccbytes = chip->ecc.bytes;
- int eccsteps = chip->ecc.steps;
- uint8_t *p = buf;
-- uint8_t *ecc_calc = chip->buffers.ecccalc;
-- uint8_t *ecc_code = chip->buffers.ecccode;
-+ uint8_t *ecc_calc = chip->buffers->ecccalc;
-+ uint8_t *ecc_code = chip->buffers->ecccode;
- int *eccpos = chip->ecc.layout->eccpos;
-
- nand_read_page_raw(mtd, chip, buf);
-@@ -808,8 +809,8 @@
- int eccbytes = chip->ecc.bytes;
- int eccsteps = chip->ecc.steps;
- uint8_t *p = buf;
-- uint8_t *ecc_calc = chip->buffers.ecccalc;
-- uint8_t *ecc_code = chip->buffers.ecccode;
-+ uint8_t *ecc_calc = chip->buffers->ecccalc;
-+ uint8_t *ecc_code = chip->buffers->ecccode;
- int *eccpos = chip->ecc.layout->eccpos;
-
- for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
-@@ -970,7 +971,7 @@
- page = realpage & chip->pagemask;
-
- col = (int)(from & (mtd->writesize - 1));
-- chip->oob_poi = chip->buffers.oobrbuf;
-+ chip->oob_poi = chip->buffers->oobrbuf;
-
- buf = ops->datbuf;
- oob = ops->oobbuf;
-@@ -981,7 +982,7 @@
-
- /* Is the current page in the buffer ? */
- if (realpage != chip->pagebuf || oob) {
-- bufpoi = aligned ? buf : chip->buffers.databuf;
-+ bufpoi = aligned ? buf : chip->buffers->databuf;
-
- if (likely(sndcmd)) {
- chip->cmdfunc(mtd, NAND_CMD_READ0, 0x00, page);
-@@ -989,14 +990,17 @@
- }
-
- /* Now read the page into the buffer */
-- ret = chip->ecc.read_page(mtd, chip, bufpoi);
-+ if (unlikely(ops->mode == MTD_OOB_RAW))
-+ ret = chip->ecc.read_page_raw(mtd, chip, bufpoi);
-+ else
-+ ret = chip->ecc.read_page(mtd, chip, bufpoi);
- if (ret < 0)
- break;
-
- /* Transfer not aligned data */
- if (!aligned) {
- chip->pagebuf = realpage;
-- memcpy(buf, chip->buffers.databuf + col, bytes);
-+ memcpy(buf, chip->buffers->databuf + col, bytes);
- }
-
- buf += bytes;
-@@ -1023,7 +1027,7 @@
- nand_wait_ready(mtd);
- }
- } else {
-- memcpy(buf, chip->buffers.databuf + col, bytes);
-+ memcpy(buf, chip->buffers->databuf + col, bytes);
- buf += bytes;
- }
-
-@@ -1266,7 +1270,7 @@
- realpage = (int)(from >> chip->page_shift);
- page = realpage & chip->pagemask;
-
-- chip->oob_poi = chip->buffers.oobrbuf;
-+ chip->oob_poi = chip->buffers->oobrbuf;
-
- while(1) {
- sndcmd = chip->ecc.read_oob(mtd, chip, page, sndcmd);
-@@ -1322,8 +1326,6 @@
- static int nand_read_oob(struct mtd_info *mtd, loff_t from,
- struct mtd_oob_ops *ops)
- {
-- int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
-- uint8_t *buf) = NULL;
- struct nand_chip *chip = mtd->priv;
- int ret = -ENOTSUPP;
-
-@@ -1341,12 +1343,7 @@
- switch(ops->mode) {
- case MTD_OOB_PLACE:
- case MTD_OOB_AUTO:
-- break;
--
- case MTD_OOB_RAW:
-- /* Replace the read_page algorithm temporary */
-- read_page = chip->ecc.read_page;
-- chip->ecc.read_page = nand_read_page_raw;
- break;
-
- default:
-@@ -1358,8 +1355,6 @@
- else
- ret = nand_do_read_ops(mtd, from, ops);
-
-- if (unlikely(ops->mode == MTD_OOB_RAW))
-- chip->ecc.read_page = read_page;
- out:
- nand_release_device(mtd);
- return ret;
-@@ -1391,7 +1386,7 @@
- int i, eccsize = chip->ecc.size;
- int eccbytes = chip->ecc.bytes;
- int eccsteps = chip->ecc.steps;
-- uint8_t *ecc_calc = chip->buffers.ecccalc;
-+ uint8_t *ecc_calc = chip->buffers->ecccalc;
- const uint8_t *p = buf;
- int *eccpos = chip->ecc.layout->eccpos;
-
-@@ -1417,7 +1412,7 @@
- int i, eccsize = chip->ecc.size;
- int eccbytes = chip->ecc.bytes;
- int eccsteps = chip->ecc.steps;
-- uint8_t *ecc_calc = chip->buffers.ecccalc;
-+ uint8_t *ecc_calc = chip->buffers->ecccalc;
- const uint8_t *p = buf;
- int *eccpos = chip->ecc.layout->eccpos;
-
-@@ -1478,7 +1473,7 @@
- }
-
- /**
-- * nand_write_page - [INTERNAL] write one page
-+ * nand_write_page - [REPLACEABLE] write one page
- * @mtd: MTD device structure
- * @chip: NAND chip descriptor
- * @buf: the data to write
-@@ -1486,13 +1481,16 @@
- * @cached: cached programming
- */
- static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
-- const uint8_t *buf, int page, int cached)
-+ const uint8_t *buf, int page, int cached, int raw)
- {
- int status;
-
- chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
-
-- chip->ecc.write_page(mtd, chip, buf);
-+ if (unlikely(raw))
-+ chip->ecc.write_page_raw(mtd, chip, buf);
-+ else
-+ chip->ecc.write_page(mtd, chip, buf);
-
- /*
- * Cached progamming disabled for now, Not sure if its worth the
-@@ -1627,7 +1625,7 @@
- (chip->pagebuf << chip->page_shift) < (to + ops->len))
- chip->pagebuf = -1;
-
-- chip->oob_poi = chip->buffers.oobwbuf;
-+ chip->oob_poi = chip->buffers->oobwbuf;
-
- while(1) {
- int cached = writelen > bytes && page != blockmask;
-@@ -1635,7 +1633,8 @@
- if (unlikely(oob))
- oob = nand_fill_oob(chip, oob, ops);
-
-- ret = nand_write_page(mtd, chip, buf, page, cached);
-+ ret = chip->write_page(mtd, chip, buf, page, cached,
-+ (ops->mode == MTD_OOB_RAW));
- if (ret)
- break;
-
-@@ -1745,7 +1744,7 @@
- if (page == chip->pagebuf)
- chip->pagebuf = -1;
-
-- chip->oob_poi = chip->buffers.oobwbuf;
-+ chip->oob_poi = chip->buffers->oobwbuf;
- memset(chip->oob_poi, 0xff, mtd->oobsize);
- nand_fill_oob(chip, ops->oobbuf, ops);
- status = chip->ecc.write_oob(mtd, chip, page & chip->pagemask);
-@@ -1768,8 +1767,6 @@
- static int nand_write_oob(struct mtd_info *mtd, loff_t to,
- struct mtd_oob_ops *ops)
- {
-- void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
-- const uint8_t *buf) = NULL;
- struct nand_chip *chip = mtd->priv;
- int ret = -ENOTSUPP;
-
-@@ -1787,12 +1784,7 @@
- switch(ops->mode) {
- case MTD_OOB_PLACE:
- case MTD_OOB_AUTO:
-- break;
--
- case MTD_OOB_RAW:
-- /* Replace the write_page algorithm temporary */
-- write_page = chip->ecc.write_page;
-- chip->ecc.write_page = nand_write_page_raw;
- break;
-
- default:
-@@ -1804,8 +1796,6 @@
- else
- ret = nand_do_write_ops(mtd, to, ops);
-
-- if (unlikely(ops->mode == MTD_OOB_RAW))
-- chip->ecc.write_page = write_page;
- out:
- nand_release_device(mtd);
- return ret;
-@@ -2288,40 +2278,22 @@
- return type;
- }
-
--/* module_text_address() isn't exported, and it's mostly a pointless
-- test if this is a module _anyway_ -- they'd have to try _really_ hard
-- to call us from in-kernel code if the core NAND support is modular. */
--#ifdef MODULE
--#define caller_is_module() (1)
--#else
--#define caller_is_module() \
-- module_text_address((unsigned long)__builtin_return_address(0))
--#endif
--
- /**
-- * nand_scan - [NAND Interface] Scan for the NAND device
-- * @mtd: MTD device structure
-- * @maxchips: Number of chips to scan for
-+ * nand_scan_ident - [NAND Interface] Scan for the NAND device
-+ * @mtd: MTD device structure
-+ * @maxchips: Number of chips to scan for
- *
-- * This fills out all the uninitialized function pointers
-- * with the defaults.
-- * The flash ID is read and the mtd/chip structures are
-- * filled with the appropriate values.
-- * The mtd->owner field must be set to the module of the caller
-+ * This is the first phase of the normal nand_scan() function. It
-+ * reads the flash ID and sets up MTD fields accordingly.
- *
-+ * The mtd->owner field must be set to the module of the caller.
- */
--int nand_scan(struct mtd_info *mtd, int maxchips)
-+int nand_scan_ident(struct mtd_info *mtd, int maxchips)
- {
- int i, busw, nand_maf_id;
- struct nand_chip *chip = mtd->priv;
- struct nand_flash_dev *type;
-
-- /* Many callers got this wrong, so check for it for a while... */
-- if (!mtd->owner && caller_is_module()) {
-- printk(KERN_CRIT "nand_scan() called with NULL mtd->owner!\n");
-- BUG();
-- }
--
- /* Get buswidth to select the correct functions */
- busw = chip->options & NAND_BUSWIDTH_16;
- /* Set the default functions */
-@@ -2353,8 +2325,31 @@
- chip->numchips = i;
- mtd->size = i * chip->chipsize;
-
-+ return 0;
-+}
-+
-+
-+/**
-+ * nand_scan_tail - [NAND Interface] Scan for the NAND device
-+ * @mtd: MTD device structure
-+ * @maxchips: Number of chips to scan for
-+ *
-+ * This is the second phase of the normal nand_scan() function. It
-+ * fills out all the uninitialized function pointers with the defaults
-+ * and scans for a bad block table if appropriate.
-+ */
-+int nand_scan_tail(struct mtd_info *mtd)
-+{
-+ int i;
-+ struct nand_chip *chip = mtd->priv;
-+
-+ if (!(chip->options & NAND_OWN_BUFFERS))
-+ chip->buffers = kmalloc(sizeof(*chip->buffers), GFP_KERNEL);
-+ if (!chip->buffers)
-+ return -ENOMEM;
-+
- /* Preset the internal oob write buffer */
-- memset(chip->buffers.oobwbuf, 0xff, mtd->oobsize);
-+ memset(chip->buffers->oobwbuf, 0xff, mtd->oobsize);
-
- /*
- * If no default placement scheme is given, select an appropriate one
-@@ -2377,10 +2372,18 @@
- }
- }
-
-+ if (!chip->write_page)
-+ chip->write_page = nand_write_page;
-+
- /*
- * check ECC mode, default to software if 3byte/512byte hardware ECC is
- * selected and we have 256 byte pagesize fallback to software ECC
- */
-+ if (!chip->ecc.read_page_raw)
-+ chip->ecc.read_page_raw = nand_read_page_raw;
-+ if (!chip->ecc.write_page_raw)
-+ chip->ecc.write_page_raw = nand_write_page_raw;
-+
- switch (chip->ecc.mode) {
- case NAND_ECC_HW:
- /* Use standard hwecc read page function ? */
-@@ -2438,6 +2441,7 @@
- chip->ecc.size = mtd->writesize;
- chip->ecc.bytes = 0;
- break;
-+
- default:
- printk(KERN_WARNING "Invalid NAND_ECC_MODE %d\n",
- chip->ecc.mode);
-@@ -2503,6 +2507,44 @@
- return chip->scan_bbt(mtd);
- }
-
-+/* module_text_address() isn't exported, and it's mostly a pointless
-+ test if this is a module _anyway_ -- they'd have to try _really_ hard
-+ to call us from in-kernel code if the core NAND support is modular. */
-+#ifdef MODULE
-+#define caller_is_module() (1)
-+#else
-+#define caller_is_module() \
-+ module_text_address((unsigned long)__builtin_return_address(0))
-+#endif
-+
-+/**
-+ * nand_scan - [NAND Interface] Scan for the NAND device
-+ * @mtd: MTD device structure
-+ * @maxchips: Number of chips to scan for
-+ *
-+ * This fills out all the uninitialized function pointers
-+ * with the defaults.
-+ * The flash ID is read and the mtd/chip structures are
-+ * filled with the appropriate values.
-+ * The mtd->owner field must be set to the module of the caller
-+ *
-+ */
-+int nand_scan(struct mtd_info *mtd, int maxchips)
-+{
-+ int ret;
-+
-+ /* Many callers got this wrong, so check for it for a while... */
-+ if (!mtd->owner && caller_is_module()) {
-+ printk(KERN_CRIT "nand_scan() called with NULL mtd->owner!\n");
-+ BUG();
-+ }
-+
-+ ret = nand_scan_ident(mtd, maxchips);
-+ if (!ret)
-+ ret = nand_scan_tail(mtd);
-+ return ret;
-+}
-+
- /**
- * nand_release - [NAND Interface] Free resources held by the NAND device
- * @mtd: MTD device structure
-@@ -2520,9 +2562,13 @@
-
- /* Free bad block table memory */
- kfree(chip->bbt);
-+ if (!(chip->options & NAND_OWN_BUFFERS))
-+ kfree(chip->buffers);
- }
-
- EXPORT_SYMBOL_GPL(nand_scan);
-+EXPORT_SYMBOL_GPL(nand_scan_ident);
-+EXPORT_SYMBOL_GPL(nand_scan_tail);
- EXPORT_SYMBOL_GPL(nand_release);
-
- static int __init nand_base_init(void)
-diff -Nur linux-2.6.18.i586.orig/drivers/mtd/nand/nand_bbt.c linux-2.6.18.i586/drivers/mtd/nand/nand_bbt.c
---- linux-2.6.18.i586.orig/drivers/mtd/nand/nand_bbt.c 2006-10-15 20:20:33.000000000 -0400
-+++ linux-2.6.18.i586/drivers/mtd/nand/nand_bbt.c 2006-10-15 20:37:29.000000000 -0400
-@@ -759,7 +759,7 @@
- struct nand_chip *this = mtd->priv;
-
- bd->options &= ~NAND_BBT_SCANEMPTY;
-- return create_bbt(mtd, this->buffers.databuf, bd, -1);
-+ return create_bbt(mtd, this->buffers->databuf, bd, -1);
- }
-
- /**
-diff -Nur linux-2.6.18.i586.orig/include/linux/mtd/nand.h linux-2.6.18.i586/include/linux/mtd/nand.h
---- linux-2.6.18.i586.orig/include/linux/mtd/nand.h 2006-10-15 20:20:32.000000000 -0400
-+++ linux-2.6.18.i586/include/linux/mtd/nand.h 2006-10-15 20:37:32.000000000 -0400
-@@ -27,6 +27,11 @@
- struct mtd_info;
- /* Scan and identify a NAND device */
- extern int nand_scan (struct mtd_info *mtd, int max_chips);
-+/* Separate phases of nand_scan(), allowing board driver to intervene
-+ * and override command or ECC setup according to flash type */
-+extern int nand_scan_ident(struct mtd_info *mtd, int max_chips);
-+extern int nand_scan_tail(struct mtd_info *mtd);
-+
- /* Free resources held by the NAND device */
- extern void nand_release (struct mtd_info *mtd);
-
-@@ -178,7 +183,9 @@
- #define NAND_USE_FLASH_BBT 0x00010000
- /* This option skips the bbt scan during initialization. */
- #define NAND_SKIP_BBTSCAN 0x00020000
--
-+/* This option is defined if the board driver allocates its own buffers
-+ (e.g. because it needs them DMA-coherent */
-+#define NAND_OWN_BUFFERS 0x00040000
- /* Options set by nand scan */
- /* Nand scan has allocated controller struct */
- #define NAND_CONTROLLER_ALLOC 0x80000000
-@@ -228,6 +235,8 @@
- * be provided if an hardware ECC is available
- * @calculate: function for ecc calculation or readback from ecc hardware
- * @correct: function for ecc correction, matching to ecc generator (sw/hw)
-+ * @read_page_raw: function to read a raw page without ECC
-+ * @write_page_raw: function to write a raw page without ECC
- * @read_page: function to read a page according to the ecc generator requirements
- * @write_page: function to write a page according to the ecc generator requirements
- * @read_oob: function to read chip OOB data
-@@ -249,6 +258,12 @@
- int (*correct)(struct mtd_info *mtd, uint8_t *dat,
- uint8_t *read_ecc,
- uint8_t *calc_ecc);
-+ int (*read_page_raw)(struct mtd_info *mtd,
-+ struct nand_chip *chip,
-+ uint8_t *buf);
-+ void (*write_page_raw)(struct mtd_info *mtd,
-+ struct nand_chip *chip,
-+ const uint8_t *buf);
- int (*read_page)(struct mtd_info *mtd,
- struct nand_chip *chip,
- uint8_t *buf);
-@@ -337,6 +352,7 @@
- * @priv: [OPTIONAL] pointer to private chip date
- * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks
- * (determine if errors are correctable)
-+ * @write_page [REPLACEABLE] High-level page write function
- */
-
- struct nand_chip {
-@@ -359,6 +375,8 @@
- void (*erase_cmd)(struct mtd_info *mtd, int page);
- int (*scan_bbt)(struct mtd_info *mtd);
- int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page);
-+ int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
-+ const uint8_t *buf, int page, int cached, int raw);
-
- int chip_delay;
- unsigned int options;
-@@ -380,7 +398,7 @@
- struct nand_ecclayout *ecclayout;
-
- struct nand_ecc_ctrl ecc;
-- struct nand_buffers buffers;
-+ struct nand_buffers *buffers;
- struct nand_hw_control hwcontrol;
-
- struct mtd_oob_ops ops;
-b77d95c78fb0ec330cd53e0d297ffa4fd2975e32
-diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
-index 2bcbcc8..70420bb 100644
---- a/include/linux/mtd/nand.h
-+++ b/include/linux/mtd/nand.h
-@@ -35,6 +35,9 @@ extern int nand_scan_tail(struct mtd_inf
- /* Free resources held by the NAND device */
- extern void nand_release (struct mtd_info *mtd);
-
-+/* Internal helper for board drivers which need to override command function */
-+extern void nand_wait_ready(struct mtd_info *mtd);
-+
- /* The maximum number of NAND chips in an array */
- #define NAND_MAX_CHIPS 8
-
More information about the fedora-cvs-commits
mailing list