diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2017-11-13 17:36:39 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2017-11-13 17:36:39 +0000 |
| commit | d58fa4fc7f031021fc3dcd659e8ef2cb042f7be3 (patch) | |
| tree | cfee2b8820f427558d1edd9218c188f8277da788 /sys/dev/nand | |
| parent | f614ae2aa1a5f5c69b92f6631f187d9e289c22aa (diff) | |
Add support for dynamic flash partitions
Diffstat (limited to 'sys/dev/nand')
| -rw-r--r-- | sys/dev/nand/nand.c | 18 | ||||
| -rw-r--r-- | sys/dev/nand/nand.h | 3 |
2 files changed, 18 insertions, 3 deletions
diff --git a/sys/dev/nand/nand.c b/sys/dev/nand/nand.c index 6e320d330d4..d1e1c2e5eb1 100644 --- a/sys/dev/nand/nand.c +++ b/sys/dev/nand/nand.c @@ -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, const int *ldesc, void *aux) 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, const int *ldesc, void *aux) 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 --git a/sys/dev/nand/nand.h b/sys/dev/nand/nand.h index a90175c11c3..1a8f626a59d 100644 --- a/sys/dev/nand/nand.h +++ b/sys/dev/nand/nand.h @@ -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, uint8_t *); 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 *); |
