diff options
Diffstat (limited to 'arch/mips/txx9/generic/setup.c')
-rw-r--r-- | arch/mips/txx9/generic/setup.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c index fa45f174b0ee..cfa3ccf493bb 100644 --- a/arch/mips/txx9/generic/setup.c +++ b/arch/mips/txx9/generic/setup.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/gpio.h> | 22 | #include <linux/gpio.h> |
23 | #include <linux/platform_device.h> | 23 | #include <linux/platform_device.h> |
24 | #include <linux/serial_core.h> | 24 | #include <linux/serial_core.h> |
25 | #include <linux/mtd/physmap.h> | ||
25 | #include <asm/bootinfo.h> | 26 | #include <asm/bootinfo.h> |
26 | #include <asm/time.h> | 27 | #include <asm/time.h> |
27 | #include <asm/reboot.h> | 28 | #include <asm/reboot.h> |
@@ -593,3 +594,43 @@ static unsigned long __swizzle_addr_none(unsigned long port) | |||
593 | unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; | 594 | unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; |
594 | EXPORT_SYMBOL(__swizzle_addr_b); | 595 | EXPORT_SYMBOL(__swizzle_addr_b); |
595 | #endif | 596 | #endif |
597 | |||
598 | void __init txx9_physmap_flash_init(int no, unsigned long addr, | ||
599 | unsigned long size, | ||
600 | const struct physmap_flash_data *pdata) | ||
601 | { | ||
602 | #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE) | ||
603 | struct resource res = { | ||
604 | .start = addr, | ||
605 | .end = addr + size - 1, | ||
606 | .flags = IORESOURCE_MEM, | ||
607 | }; | ||
608 | struct platform_device *pdev; | ||
609 | #ifdef CONFIG_MTD_PARTITIONS | ||
610 | static struct mtd_partition parts[2]; | ||
611 | struct physmap_flash_data pdata_part; | ||
612 | |||
613 | /* If this area contained boot area, make separate partition */ | ||
614 | if (pdata->nr_parts == 0 && !pdata->parts && | ||
615 | addr < 0x1fc00000 && addr + size > 0x1fc00000 && | ||
616 | !parts[0].name) { | ||
617 | parts[0].name = "boot"; | ||
618 | parts[0].offset = 0x1fc00000 - addr; | ||
619 | parts[0].size = addr + size - 0x1fc00000; | ||
620 | parts[1].name = "user"; | ||
621 | parts[1].offset = 0; | ||
622 | parts[1].size = 0x1fc00000 - addr; | ||
623 | pdata_part = *pdata; | ||
624 | pdata_part.nr_parts = ARRAY_SIZE(parts); | ||
625 | pdata_part.parts = parts; | ||
626 | pdata = &pdata_part; | ||
627 | } | ||
628 | #endif | ||
629 | pdev = platform_device_alloc("physmap-flash", no); | ||
630 | if (!pdev || | ||
631 | platform_device_add_resources(pdev, &res, 1) || | ||
632 | platform_device_add_data(pdev, pdata, sizeof(*pdata)) || | ||
633 | platform_device_add(pdev)) | ||
634 | platform_device_put(pdev); | ||
635 | #endif | ||
636 | } | ||