[ar71xx] preliminary support for the Ubiquiti RouterStation Pro
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1002-gta01-no_nand_partitions.patch.patch
1 From 219a4d34b71c37a2a23739718924b0915790f44f Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Fri, 4 Apr 2008 11:29:16 +0100
4 Subject: [PATCH] gta01-no_nand_partitions.patch
5 [PATCH] support mtd NAND commandline partitions for S3C2410
6
7 This patch adds support for the mtd NAND core standard method of passing
8 partition table information from the bootloader into the kernel by using
9 the kernel commandline.
10
11 The board specific code can still manually override and provide a fixed
12 partition table, so this patch will behave backwards compatible.
13
14 Signed-off-by: Harald Welte <laforge@openmoko.org>
15 Acked-byt: Ben Dooks <ben-linux@fluff.org>
16 ---
17 drivers/mtd/nand/s3c2410.c | 18 ++++++++++++++++--
18 1 files changed, 16 insertions(+), 2 deletions(-)
19
20 diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
21 index 66f76e9..355de78 100644
22 --- a/drivers/mtd/nand/s3c2410.c
23 +++ b/drivers/mtd/nand/s3c2410.c
24 @@ -559,17 +559,31 @@ static int s3c2410_nand_remove(struct platform_device *pdev)
25 }
26
27 #ifdef CONFIG_MTD_PARTITIONS
28 +const char *part_probes[] = { "cmdlinepart", NULL };
29 static int s3c2410_nand_add_partition(struct s3c2410_nand_info *info,
30 struct s3c2410_nand_mtd *mtd,
31 struct s3c2410_nand_set *set)
32 {
33 + struct mtd_partition *part_info;
34 + int nr_part = 0;
35 +
36 if (set == NULL)
37 return add_mtd_device(&mtd->mtd);
38
39 - if (set->nr_partitions > 0 && set->partitions != NULL) {
40 - return add_mtd_partitions(&mtd->mtd, set->partitions, set->nr_partitions);
41 + if (set->nr_partitions == 0) {
42 + mtd->mtd.name = set->name;
43 + nr_part = parse_mtd_partitions(&mtd->mtd, part_probes,
44 + &part_info, 0);
45 + } else {
46 + if (set->nr_partitions > 0 && set->partitions != NULL) {
47 + nr_part = set->nr_partitions;
48 + part_info = set->partitions;
49 + }
50 }
51
52 + if (nr_part > 0 && part_info)
53 + return add_mtd_partitions(&mtd->mtd, part_info, nr_part);
54 +
55 return add_mtd_device(&mtd->mtd);
56 }
57 #else
58 --
59 1.5.6.5
60
This page took 0.045939 seconds and 5 git commands to generate.