aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/txx9
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/txx9')
-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
-rw-r--r--arch/mips/txx9/jmr3927/setup.c9
-rw-r--r--arch/mips/txx9/rbtx4927/setup.c9
-rw-r--r--arch/mips/txx9/rbtx4938/setup.c38
7 files changed, 139 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}
diff --git a/arch/mips/txx9/jmr3927/setup.c b/arch/mips/txx9/jmr3927/setup.c
index 2e40a9268254..0f3843c92cf7 100644
--- a/arch/mips/txx9/jmr3927/setup.c
+++ b/arch/mips/txx9/jmr3927/setup.c
@@ -190,11 +190,20 @@ static void __init jmr3927_rtc_init(void)
190 platform_device_register_simple("rtc-ds1742", -1, &res, 1); 190 platform_device_register_simple("rtc-ds1742", -1, &res, 1);
191} 191}
192 192
193static void __init jmr3927_mtd_init(void)
194{
195 int i;
196
197 for (i = 0; i < 2; i++)
198 tx3927_mtd_init(i);
199}
200
193static void __init jmr3927_device_init(void) 201static void __init jmr3927_device_init(void)
194{ 202{
195 __swizzle_addr_b = jmr3927_swizzle_addr_b; 203 __swizzle_addr_b = jmr3927_swizzle_addr_b;
196 jmr3927_rtc_init(); 204 jmr3927_rtc_init();
197 tx3927_wdt_init(); 205 tx3927_wdt_init();
206 jmr3927_mtd_init();
198} 207}
199 208
200struct txx9_board_vec jmr3927_vec __initdata = { 209struct txx9_board_vec jmr3927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4927/setup.c b/arch/mips/txx9/rbtx4927/setup.c
index 0464a39b39ac..abe32c1a79dc 100644
--- a/arch/mips/txx9/rbtx4927/setup.c
+++ b/arch/mips/txx9/rbtx4927/setup.c
@@ -307,11 +307,20 @@ static void __init rbtx4927_ne_init(void)
307 platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res)); 307 platform_device_register_simple("ne", -1, res, ARRAY_SIZE(res));
308} 308}
309 309
310static void __init rbtx4927_mtd_init(void)
311{
312 int i;
313
314 for (i = 0; i < 2; i++)
315 tx4927_mtd_init(i);
316}
317
310static void __init rbtx4927_device_init(void) 318static void __init rbtx4927_device_init(void)
311{ 319{
312 toshiba_rbtx4927_rtc_init(); 320 toshiba_rbtx4927_rtc_init();
313 rbtx4927_ne_init(); 321 rbtx4927_ne_init();
314 tx4927_wdt_init(); 322 tx4927_wdt_init();
323 rbtx4927_mtd_init();
315} 324}
316 325
317struct txx9_board_vec rbtx4927_vec __initdata = { 326struct txx9_board_vec rbtx4927_vec __initdata = {
diff --git a/arch/mips/txx9/rbtx4938/setup.c b/arch/mips/txx9/rbtx4938/setup.c
index 9ab48dec0fe8..e7bc5b8c7db8 100644
--- a/arch/mips/txx9/rbtx4938/setup.c
+++ b/arch/mips/txx9/rbtx4938/setup.c
@@ -15,6 +15,7 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/mtd/physmap.h>
18 19
19#include <asm/reboot.h> 20#include <asm/reboot.h>
20#include <asm/io.h> 21#include <asm/io.h>
@@ -294,6 +295,42 @@ static int __init rbtx4938_spi_init(void)
294 return 0; 295 return 0;
295} 296}
296 297
298static void __init rbtx4938_mtd_init(void)
299{
300 struct physmap_flash_data pdata = {
301 .width = 4,
302 };
303
304 switch (readb(rbtx4938_bdipsw_addr) & 7) {
305 case 0:
306 /* Boot */
307 txx9_physmap_flash_init(0, 0x1fc00000, 0x400000, &pdata);
308 /* System */
309 txx9_physmap_flash_init(1, 0x1e000000, 0x1000000, &pdata);
310 break;
311 case 1:
312 /* System */
313 txx9_physmap_flash_init(0, 0x1f000000, 0x1000000, &pdata);
314 /* Boot */
315 txx9_physmap_flash_init(1, 0x1ec00000, 0x400000, &pdata);
316 break;
317 case 2:
318 /* Ext */
319 txx9_physmap_flash_init(0, 0x1f000000, 0x1000000, &pdata);
320 /* System */
321 txx9_physmap_flash_init(1, 0x1e000000, 0x1000000, &pdata);
322 /* Boot */
323 txx9_physmap_flash_init(2, 0x1dc00000, 0x400000, &pdata);
324 break;
325 case 3:
326 /* Boot */
327 txx9_physmap_flash_init(1, 0x1bc00000, 0x400000, &pdata);
328 /* System */
329 txx9_physmap_flash_init(2, 0x1a000000, 0x1000000, &pdata);
330 break;
331 }
332}
333
297static void __init rbtx4938_arch_init(void) 334static void __init rbtx4938_arch_init(void)
298{ 335{
299 gpiochip_add(&rbtx4938_spi_gpio_chip); 336 gpiochip_add(&rbtx4938_spi_gpio_chip);
@@ -306,6 +343,7 @@ static void __init rbtx4938_device_init(void)
306 rbtx4938_ethaddr_init(); 343 rbtx4938_ethaddr_init();
307 rbtx4938_ne_init(); 344 rbtx4938_ne_init();
308 tx4938_wdt_init(); 345 tx4938_wdt_init();
346 rbtx4938_mtd_init();
309} 347}
310 348
311struct txx9_board_vec rbtx4938_vec __initdata = { 349struct txx9_board_vec rbtx4938_vec __initdata = {