Module Name:    src
Committed By:   jmcneill
Date:           Mon Nov 13 17:36:39 UTC 2017

Modified Files:
        src/sys/dev/nand: nand.c nand.h

Log Message:
Add support for dynamic flash partitions


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/nand/nand.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/nand/nand.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/nand/nand.c
diff -u src/sys/dev/nand/nand.c:1.26 src/sys/dev/nand/nand.c:1.27
--- src/sys/dev/nand/nand.c:1.26	Thu Nov  9 21:50:15 2017
+++ src/sys/dev/nand/nand.c	Mon Nov 13 17:36:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nand.c,v 1.26 2017/11/09 21:50:15 jmcneill Exp $	*/
+/*	$NetBSD: nand.c,v 1.27 2017/11/13 17:36:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -34,7 +34,7 @@
 /* Common driver for NAND chips implementing the ONFI 2.2 specification */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.26 2017/11/09 21:50:15 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nand.c,v 1.27 2017/11/13 17:36:39 jmcneill Exp $");
 
 #include "locators.h"
 
@@ -188,8 +188,12 @@ nand_search(device_t parent, cfdata_t cf
 	struct nand_chip *chip = &sc->sc_chip;
 	struct flash_attach_args faa;
 
+	if (cf->cf_loc[FLASHBUSCF_DYNAMIC] != 0)
+		return 0;
+
 	faa.flash_if = &nand_flash_if;
 
+	faa.partinfo.part_name = NULL;
 	faa.partinfo.part_offset = cf->cf_loc[FLASHBUSCF_OFFSET];
 
 	if (cf->cf_loc[FLASHBUSCF_SIZE] == 0) {
@@ -215,6 +219,16 @@ nand_search(device_t parent, cfdata_t cf
 	return 1;
 }
 
+void
+nand_attach_mtdparts(device_t parent, const char *mtd_id, const char *cmdline)
+{
+	struct nand_softc *sc = device_private(parent);
+	struct nand_chip *chip = &sc->sc_chip;
+
+	flash_attach_mtdparts(&nand_flash_if, parent, chip->nc_size,
+	    mtd_id, cmdline);
+}
+
 int
 nand_detach(device_t self, int flags)
 {

Index: src/sys/dev/nand/nand.h
diff -u src/sys/dev/nand/nand.h:1.17 src/sys/dev/nand/nand.h:1.18
--- src/sys/dev/nand/nand.h:1.17	Thu Nov  9 21:50:15 2017
+++ src/sys/dev/nand/nand.h	Mon Nov 13 17:36:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: nand.h,v 1.17 2017/11/09 21:50:15 jmcneill Exp $	*/
+/*	$NetBSD: nand.h,v 1.18 2017/11/13 17:36:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -468,6 +468,7 @@ int nand_read_oob(device_t, size_t, uint
 
 device_t nand_attach_mi(struct nand_interface *, device_t);
 void nand_init_interface(struct nand_interface *);
+void nand_attach_mtdparts(device_t, const char *, const char *);
 
 /* controller drivers may use these functions to get info about the chip */
 void nand_read_id(device_t, uint8_t *, uint8_t *);

Reply via email to