aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@stericsson.com>2010-11-29 07:52:06 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-12-03 11:35:10 -0500
commit4ad916bca7c372110815e77c2db95fb2eb2f8ab3 (patch)
tree4322fe7f4bfa4fd0ff42c249809637fad339a3bd
parent6b2995b62eba81df0f7d0b4be5b782be623c13eb (diff)
mtd: FSMC NAND remove PARTITION macro and fix compile noise
This removes the PARTITION macro that David didn't like and also removes a local variable that was dangling unused in some #ifdefs by being a bit more clever. Signed-off-by: Linus Walleij <linus.walleij@stericsson.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/nand/fsmc_nand.c66
1 files changed, 48 insertions, 18 deletions
diff --git a/drivers/mtd/nand/fsmc_nand.c b/drivers/mtd/nand/fsmc_nand.c
index 02edfba25b0c..5af4b3c122f5 100644
--- a/drivers/mtd/nand/fsmc_nand.c
+++ b/drivers/mtd/nand/fsmc_nand.c
@@ -119,21 +119,36 @@ static struct fsmc_eccplace fsmc_ecc4_sp_place = {
119 } 119 }
120}; 120};
121 121
122/*
123 * Default partition tables to be used if the partition information not
124 * provided through platform data
125 */
126#define PARTITION(n, off, sz) {.name = n, .offset = off, .size = sz}
127 122
123#ifdef CONFIG_MTD_PARTITIONS
128/* 124/*
125 * Default partition tables to be used if the partition information not
126 * provided through platform data.
127 *
129 * Default partition layout for small page(= 512 bytes) devices 128 * Default partition layout for small page(= 512 bytes) devices
130 * Size for "Root file system" is updated in driver based on actual device size 129 * Size for "Root file system" is updated in driver based on actual device size
131 */ 130 */
132static struct mtd_partition partition_info_16KB_blk[] = { 131static struct mtd_partition partition_info_16KB_blk[] = {
133 PARTITION("X-loader", 0, 4 * 0x4000), 132 {
134 PARTITION("U-Boot", 0x10000, 20 * 0x4000), 133 .name = "X-loader",
135 PARTITION("Kernel", 0x60000, 256 * 0x4000), 134 .offset = 0,
136 PARTITION("Root File System", 0x460000, 0), 135 .size = 4*0x4000,
136 },
137 {
138 .name = "U-Boot",
139 .offset = 0x10000,
140 .size = 20*0x4000,
141 },
142 {
143 .name = "Kernel",
144 .offset = 0x60000,
145 .size = 256*0x4000,
146 },
147 {
148 .name = "Root File System",
149 .offset = 0x460000,
150 .size = 0,
151 },
137}; 152};
138 153
139/* 154/*
@@ -141,15 +156,32 @@ static struct mtd_partition partition_info_16KB_blk[] = {
141 * Size for "Root file system" is updated in driver based on actual device size 156 * Size for "Root file system" is updated in driver based on actual device size
142 */ 157 */
143static struct mtd_partition partition_info_128KB_blk[] = { 158static struct mtd_partition partition_info_128KB_blk[] = {
144 PARTITION("X-loader", 0, 4 * 0x20000), 159 {
145 PARTITION("U-Boot", 0x80000, 12 * 0x20000), 160 .name = "X-loader",
146 PARTITION("Kernel", 0x200000, 48 * 0x20000), 161 .offset = 0,
147 PARTITION("Root File System", 0x800000, 0), 162 .size = 4*0x20000,
163 },
164 {
165 .name = "U-Boot",
166 .offset = 0x80000,
167 .size = 12*0x20000,
168 },
169 {
170 .name = "Kernel",
171 .offset = 0x200000,
172 .size = 48*0x20000,
173 },
174 {
175 .name = "Root File System",
176 .offset = 0x800000,
177 .size = 0,
178 },
148}; 179};
149 180
150#ifdef CONFIG_MTD_CMDLINE_PARTS 181#ifdef CONFIG_MTD_CMDLINE_PARTS
151const char *part_probes[] = { "cmdlinepart", NULL }; 182const char *part_probes[] = { "cmdlinepart", NULL };
152#endif 183#endif
184#endif
153 185
154/** 186/**
155 * struct fsmc_nand_data - atructure for FSMC NAND device state 187 * struct fsmc_nand_data - atructure for FSMC NAND device state
@@ -508,7 +540,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
508 struct nand_chip *nand; 540 struct nand_chip *nand;
509 struct fsmc_regs *regs; 541 struct fsmc_regs *regs;
510 struct resource *res; 542 struct resource *res;
511 int nr_parts, ret = 0; 543 int ret = 0;
512 544
513 if (!pdata) { 545 if (!pdata) {
514 dev_err(&pdev->dev, "platform data is NULL\n"); 546 dev_err(&pdev->dev, "platform data is NULL\n");
@@ -676,11 +708,9 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
676 * Check if partition info passed via command line 708 * Check if partition info passed via command line
677 */ 709 */
678 host->mtd.name = "nand"; 710 host->mtd.name = "nand";
679 nr_parts = parse_mtd_partitions(&host->mtd, part_probes, 711 host->nr_partitions = parse_mtd_partitions(&host->mtd, part_probes,
680 &host->partitions, 0); 712 &host->partitions, 0);
681 if (nr_parts > 0) { 713 if (host->nr_partitions <= 0) {
682 host->nr_partitions = nr_parts;
683 } else {
684#endif 714#endif
685 /* 715 /*
686 * Check if partition info passed via command line 716 * Check if partition info passed via command line