aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9/generic
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/txx9/generic')
-rw-r--r--arch/mips/txx9/generic/setup.c41
-rw-r--r--arch/mips/txx9/generic/setup_tx3927.c14
-rw-r--r--arch/mips/txx9/generic/setup_tx4927.c14
-rw-r--r--arch/mips/txx9/generic/setup_tx4938.c14
4 files changed, 83 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)
593unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none; 594unsigned long (*__swizzle_addr_b)(unsigned long port) = __swizzle_addr_none;
594EXPORT_SYMBOL(__swizzle_addr_b); 595EXPORT_SYMBOL(__swizzle_addr_b);
595#endif 596#endif
597
598void __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}
diff --git a/arch/mips/txx9/generic/setup_tx3927.c b/arch/mips/txx9/generic/setup_tx3927.c
index 06c492576078..9505d58454c8 100644
--- a/arch/mips/txx9/generic/setup_tx3927.c
+++ b/arch/mips/txx9/generic/setup_tx3927.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/mtd/physmap.h>
18#include <asm/mipsregs.h> 19#include <asm/mipsregs.h>
19#include <asm/txx9irq.h> 20#include <asm/txx9irq.h>
20#include <asm/txx9tmr.h> 21#include <asm/txx9tmr.h>
@@ -121,3 +122,16 @@ void __init tx3927_sio_init(unsigned int sclk, unsigned int cts_mask)
121 TXX9_IRQ_BASE + TX3927_IR_SIO(i), 122 TXX9_IRQ_BASE + TX3927_IR_SIO(i),
122 i, sclk, (1 << i) & cts_mask); 123 i, sclk, (1 << i) & cts_mask);
123} 124}
125
126void __init tx3927_mtd_init(int ch)
127{
128 struct physmap_flash_data pdata = {
129 .width = TX3927_ROMC_WIDTH(ch) / 8,
130 };
131 unsigned long start = txx9_ce_res[ch].start;
132 unsigned long size = txx9_ce_res[ch].end - start + 1;
133
134 if (!(tx3927_romcptr->cr[ch] & 0x8))
135 return; /* disabled */
136 txx9_physmap_flash_init(ch, start, size, &pdata);
137}
diff --git a/arch/mips/txx9/generic/setup_tx4927.c b/arch/mips/txx9/generic/setup_tx4927.c
index e679c79a4b0f..0840ef930e40 100644
--- a/arch/mips/txx9/generic/setup_tx4927.c
+++ b/arch/mips/txx9/generic/setup_tx4927.c
@@ -14,6 +14,7 @@
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/mtd/physmap.h>
17#include <asm/txx9irq.h> 18#include <asm/txx9irq.h>
18#include <asm/txx9tmr.h> 19#include <asm/txx9tmr.h>
19#include <asm/txx9pio.h> 20#include <asm/txx9pio.h>
@@ -187,3 +188,16 @@ void __init tx4927_sio_init(unsigned int sclk, unsigned int cts_mask)
187 TXX9_IRQ_BASE + TX4927_IR_SIO(i), 188 TXX9_IRQ_BASE + TX4927_IR_SIO(i),
188 i, sclk, (1 << i) & cts_mask); 189 i, sclk, (1 << i) & cts_mask);
189} 190}
191
192void __init tx4927_mtd_init(int ch)
193{
194 struct physmap_flash_data pdata = {
195 .width = TX4927_EBUSC_WIDTH(ch) / 8,
196 };
197 unsigned long start = txx9_ce_res[ch].start;
198 unsigned long size = txx9_ce_res[ch].end - start + 1;
199
200 if (!(TX4927_EBUSC_CR(ch) & 0x8))
201 return; /* disabled */
202 txx9_physmap_flash_init(ch, start, size, &pdata);
203}
diff --git a/arch/mips/txx9/generic/setup_tx4938.c b/arch/mips/txx9/generic/setup_tx4938.c
index 95c058f0a96c..630a7aac61f6 100644
--- a/arch/mips/txx9/generic/setup_tx4938.c
+++ b/arch/mips/txx9/generic/setup_tx4938.c
@@ -14,6 +14,7 @@
14#include <linux/ioport.h> 14#include <linux/ioport.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/param.h> 16#include <linux/param.h>
17#include <linux/mtd/physmap.h>
17#include <asm/txx9irq.h> 18#include <asm/txx9irq.h>
18#include <asm/txx9tmr.h> 19#include <asm/txx9tmr.h>
19#include <asm/txx9pio.h> 20#include <asm/txx9pio.h>
@@ -269,3 +270,16 @@ void __init tx4938_ethaddr_init(unsigned char *addr0, unsigned char *addr1)
269 if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL)) 270 if (addr1 && (pcfg & TX4938_PCFG_ETH1_SEL))
270 txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1); 271 txx9_ethaddr_init(TXX9_IRQ_BASE + TX4938_IR_ETH1, addr1);
271} 272}
273
274void __init tx4938_mtd_init(int ch)
275{
276 struct physmap_flash_data pdata = {
277 .width = TX4938_EBUSC_WIDTH(ch) / 8,
278 };
279 unsigned long start = txx9_ce_res[ch].start;
280 unsigned long size = txx9_ce_res[ch].end - start + 1;
281
282 if (!(TX4938_EBUSC_CR(ch) & 0x8))
283 return; /* disabled */
284 txx9_physmap_flash_init(ch, start, size, &pdata);
285}