Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/nand Add support for dynamic flash partitions
details: https://anonhg.NetBSD.org/src/rev/b3835fa6b548
branches: trunk
changeset: 357514:b3835fa6b548
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Nov 13 17:36:39 2017 +0000
description:
Add support for dynamic flash partitions
diffstat:
sys/dev/nand/nand.c | 18 ++++++++++++++++--
sys/dev/nand/nand.h | 3 ++-
2 files changed, 18 insertions(+), 3 deletions(-)
diffs (65 lines):
diff -r 162df335ed40 -r b3835fa6b548 sys/dev/nand/nand.c
--- a/sys/dev/nand/nand.c Mon Nov 13 17:35:58 2017 +0000
+++ b/sys/dev/nand/nand.c Mon Nov 13 17:36:39 2017 +0000
@@ -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 @@
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 @@
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)
{
diff -r 162df335ed40 -r b3835fa6b548 sys/dev/nand/nand.h
--- a/sys/dev/nand/nand.h Mon Nov 13 17:35:58 2017 +0000
+++ b/sys/dev/nand/nand.h Mon Nov 13 17:36:39 2017 +0000
@@ -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 @@
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 *);
Home |
Main Index |
Thread Index |
Old Index