aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorSang-Jun Park <sj2202.park@samsung.com>2010-08-20 15:55:14 -0700
committerArve Hjønnevåg <arve@android.com>2011-11-17 17:43:38 -0800
commit35be5e8db95323c6b093e58d4560603412366f33 (patch)
tree4ba399fadcc332377224e2a2183ef5385de902eb /drivers/mtd/onenand
parent543282981b23488b7bf7b42084e0076fa3faf796 (diff)
downloadkernel_samsung_aries-35be5e8db95323c6b093e58d4560603412366f33.zip
kernel_samsung_aries-35be5e8db95323c6b093e58d4560603412366f33.tar.gz
kernel_samsung_aries-35be5e8db95323c6b093e58d4560603412366f33.tar.bz2
S5PC11X: Partition: modified to get partition info from bootloader
Bootloader send partition info to kernel via ATAG. Otherwise default partition which kernel has can be used. Change-Id: I47bc5e12e9e9e44e27ddbe871ea1a5799f755360
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r--drivers/mtd/onenand/samsung.c55
1 files changed, 53 insertions, 2 deletions
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
index 26bafde..3bd5988 100644
--- a/drivers/mtd/onenand/samsung.c
+++ b/drivers/mtd/onenand/samsung.c
@@ -29,6 +29,9 @@
#include <linux/io.h>
+#include <asm/setup.h>
+#include <linux/string.h>
+
enum soc_type {
TYPE_S3C6400,
TYPE_S3C6410,
@@ -232,6 +235,56 @@ static void s3c_dump_reg(void)
}
#endif
+struct slsi_ptbl_entry {
+ char name[16];
+ __u32 offset;
+ __u32 size;
+ __u32 flags;
+};
+
+struct mtd_partition *partitions;
+int num_partitions;
+
+#define MAX_PARTITIONS 12
+#define ATAG_SLSI_PARTITION 0x28247574
+struct mtd_partition slsi_nand_partitions[MAX_PARTITIONS];
+char slsi_nand_names[MAX_PARTITIONS * 16];
+
+static int __init parse_tag_partition(const struct tag *tag)
+{
+ struct mtd_partition *ptn = slsi_nand_partitions;
+ char *name = slsi_nand_names;
+ struct slsi_ptbl_entry *entry = (void *) &tag->u;
+ unsigned count, n;
+
+ count = (tag->hdr.size - 2) /
+ (sizeof(struct slsi_ptbl_entry) / sizeof(__u32));
+
+ if (count > MAX_PARTITIONS)
+ count = MAX_PARTITIONS;
+
+ for (n = 0; n < count; n++) {
+ memcpy(name, entry->name, 15);
+ name[15] = 0;
+ ptn->name = name;
+ ptn->offset = entry->offset;
+ ptn->size = entry->size;
+
+ printk(KERN_INFO "Partition (from atag) %15s -- Offset:0x%08x Size:0x%08x\n",
+ entry->name, entry->offset, entry->size);
+
+ name += 16;
+ entry++;
+ ptn++;
+ }
+
+ num_partitions = count;
+ partitions = slsi_nand_partitions;
+
+ return 0;
+}
+__tagtable(ATAG_SLSI_PARTITION, parse_tag_partition);
+
static unsigned int s3c64xx_cmd_map(unsigned type, unsigned val)
{
return (type << S3C64XX_CMD_MAP_SHIFT) | val;
@@ -908,8 +961,6 @@ static int s3c_onenand_probe(struct platform_device *pdev)
struct mtd_info *mtd;
struct resource *r;
int size, err;
- struct mtd_partition *partitions = NULL;
- int num_partitions = 0;
pdata = pdev->dev.platform_data;
/* No need to check pdata. the platform data is optional */