From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 3/7] nand: add nand mtd concat support
Date: Tue, 7 Jun 2016 08:55:41 +0200 [thread overview]
Message-ID: <1465282545-2810-4-git-send-email-hs@denx.de> (raw)
In-Reply-To: <1465282545-2810-1-git-send-email-hs@denx.de>
add for nand devices mtd concat support. Generic MTD concat
support is already ported to mainline, and used in the cfi_mtd
driver. This patch adds it similiar for nand devices.
Signed-off-by: Heiko Schocher <hs@denx.de>
---
Changes in v2:
- add comments from Scott Wood:
- move c_mtd_name from file scope to local
- use nand_info instead mtd_nand_list
- use oss at buserror.net as email address for Scott
- rebase to current mainline commit id:
e4a94ce4ac77396b181663c0493c50bc2d5b9143
and the "mtd: nand Sync with Linux v4.6" patches:
[U-Boot,1/7] mtd: nand: Remove jz4740 driver
http://patchwork.ozlabs.org/patch/627922/
[U-Boot,2/7] mtd: nand: Remove docg4 driver and palmtreo680 flashing tool
http://patchwork.ozlabs.org/patch/627924/
[U-Boot,3/7] mtd: nand: Remove nand_info_t typedef
http://patchwork.ozlabs.org/patch/627923/
[U-Boot,4/7] nand: Embed mtd_info in struct nand_chip
http://patchwork.ozlabs.org/patch/627925/
[U-Boot,5/7] mtd: nand: Add+use mtd_to/from_nand and nand_get/set_controller_data
http://patchwork.ozlabs.org/patch/627926/
[U-Boot,6/7] mtd: nand: Add page argument to write_page() etc.
http://patchwork.ozlabs.org/patch/627927/
[U-Boot,7/7] mtd: nand: Sync with Linux v4.6
http://patchwork.ozlabs.org/patch/627928/
Series-changes: 3
- add comment from Scott Wood
build an array for none NULL-devices. While at it
move the nand mtd concat code into a seperate
function.
- rebase to "Prepare v2016.07-rc1"
b104b3dc1dd90cdbf67ccf3c51b06e4f1592fe91
drivers/mtd/nand/nand.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/mtd/nand/nand.c b/drivers/mtd/nand/nand.c
index f449316..0551241 100644
--- a/drivers/mtd/nand/nand.c
+++ b/drivers/mtd/nand/nand.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <nand.h>
#include <errno.h>
+#include <linux/mtd/concat.h>
#ifndef CONFIG_SYS_NAND_BASE_LIST
#define CONFIG_SYS_NAND_BASE_LIST { CONFIG_SYS_NAND_BASE }
@@ -92,6 +93,44 @@ static void nand_init_chip(int i)
}
#endif
+#ifdef CONFIG_MTD_CONCAT
+static void create_mtd_concat(void)
+{
+ struct mtd_info *nand_info_list[CONFIG_SYS_MAX_NAND_DEVICE];
+ int nand_devices_found = 0;
+ int i;
+
+ for (i = 0; i < CONFIG_SYS_MAX_NAND_DEVICE; i++) {
+ if (nand_info[i] != NULL) {
+ nand_info_list[nand_devices_found] = nand_info[i];
+ nand_devices_found++;
+ }
+ }
+ if (nand_devices_found > 1) {
+ struct mtd_info *mtd;
+ char c_mtd_name[16];
+
+ /*
+ * We detected multiple devices. Concatenate them together.
+ */
+ sprintf(c_mtd_name, "nand%d", nand_devices_found);
+ mtd = mtd_concat_create(nand_info_list, nand_devices_found,
+ c_mtd_name);
+
+ if (mtd == NULL)
+ return;
+
+ nand_register(nand_devices_found, mtd);
+ }
+
+ return;
+}
+#else
+static void create_mtd_concat(void)
+{
+}
+#endif
+
void nand_init(void)
{
#ifdef CONFIG_SYS_NAND_SELF_INIT
@@ -112,4 +151,6 @@ void nand_init(void)
board_nand_select_device(mtd_to_nand(nand_info[nand_curr_device]),
nand_curr_device);
#endif
+
+ create_mtd_concat();
}
--
2.5.5
next prev parent reply other threads:[~2016-06-07 6:55 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-07 6:55 [U-Boot] [PATCH v3 0/7] add support for the etamin draco board variant Heiko Schocher
2016-06-07 6:55 ` [U-Boot] [PATCH v3 1/7] siemens,am33x: add ubi fastmap support Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot, v3, 1/7] siemens, am33x: " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 2/7] ubi: add new ubi command "ubi detach" Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot,v3,2/7] " Tom Rini
2016-06-07 6:55 ` Heiko Schocher [this message]
2016-06-09 18:03 ` [U-Boot] [U-Boot,v3,3/7] nand: add nand mtd concat support Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 4/7] mtd: nand: omap: allow to switch to BCH16 Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 5/7] am335x, dxr2: get ECC sType from I2C eeprom Heiko Schocher
2016-06-09 18:03 ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-06-07 6:55 ` [U-Boot] [PATCH v3 6/7] dfu, nand, ubi: fix erasing after write finish Heiko Schocher
2016-06-09 18:04 ` [U-Boot] [U-Boot, v3, " Tom Rini
2016-06-23 15:00 ` [U-Boot] [PATCH v3 " Lukasz Majewski
2016-06-07 6:55 ` [U-Boot] [PATCH v3 7/7] siemens,am33x: add draco etamin board Heiko Schocher
2016-06-09 18:04 ` [U-Boot] [U-Boot,v3,7/7] " Tom Rini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1465282545-2810-4-git-send-email-hs@denx.de \
--to=hs@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox