diff options
Diffstat (limited to 'arch/mips/alchemy/devboards/db1000.c')
-rw-r--r-- | arch/mips/alchemy/devboards/db1000.c | 120 |
1 files changed, 92 insertions, 28 deletions
diff --git a/arch/mips/alchemy/devboards/db1000.c b/arch/mips/alchemy/devboards/db1000.c index 1b81dbf6b804..8187845650f7 100644 --- a/arch/mips/alchemy/devboards/db1000.c +++ b/arch/mips/alchemy/devboards/db1000.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * DBAu1000/1500/1100 board support | 2 | * DBAu1000/1500/1100 PBAu1100/1500 board support |
3 | * | 3 | * |
4 | * Copyright 2000, 2008 MontaVista Software Inc. | 4 | * Copyright 2000, 2008 MontaVista Software Inc. |
5 | * Author: MontaVista Software, Inc. <source@mvista.com> | 5 | * Author: MontaVista Software, Inc. <source@mvista.com> |
@@ -52,6 +52,11 @@ static const char *board_type_str(void) | |||
52 | return "DB1500"; | 52 | return "DB1500"; |
53 | case BCSR_WHOAMI_DB1100: | 53 | case BCSR_WHOAMI_DB1100: |
54 | return "DB1100"; | 54 | return "DB1100"; |
55 | case BCSR_WHOAMI_PB1500: | ||
56 | case BCSR_WHOAMI_PB1500R2: | ||
57 | return "PB1500"; | ||
58 | case BCSR_WHOAMI_PB1100: | ||
59 | return "PB1100"; | ||
55 | default: | 60 | default: |
56 | return "(unknown)"; | 61 | return "(unknown)"; |
57 | } | 62 | } |
@@ -111,7 +116,9 @@ static struct platform_device db1500_pci_host_dev = { | |||
111 | 116 | ||
112 | static int __init db1500_pci_init(void) | 117 | static int __init db1500_pci_init(void) |
113 | { | 118 | { |
114 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1500) | 119 | int id = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); |
120 | if ((id == BCSR_WHOAMI_DB1500) || (id == BCSR_WHOAMI_PB1500) || | ||
121 | (id == BCSR_WHOAMI_PB1500R2)) | ||
115 | return platform_device_register(&db1500_pci_host_dev); | 122 | return platform_device_register(&db1500_pci_host_dev); |
116 | return 0; | 123 | return 0; |
117 | } | 124 | } |
@@ -199,27 +206,37 @@ static irqreturn_t db1100_mmc_cd(int irq, void *ptr) | |||
199 | 206 | ||
200 | static int db1100_mmc_cd_setup(void *mmc_host, int en) | 207 | static int db1100_mmc_cd_setup(void *mmc_host, int en) |
201 | { | 208 | { |
202 | int ret = 0; | 209 | int ret = 0, irq; |
210 | |||
211 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100) | ||
212 | irq = AU1100_GPIO19_INT; | ||
213 | else | ||
214 | irq = AU1100_GPIO14_INT; /* PB1100 SD0 CD# */ | ||
203 | 215 | ||
204 | if (en) { | 216 | if (en) { |
205 | irq_set_irq_type(AU1100_GPIO19_INT, IRQ_TYPE_EDGE_BOTH); | 217 | irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); |
206 | ret = request_irq(AU1100_GPIO19_INT, db1100_mmc_cd, 0, | 218 | ret = request_irq(irq, db1100_mmc_cd, 0, |
207 | "sd0_cd", mmc_host); | 219 | "sd0_cd", mmc_host); |
208 | } else | 220 | } else |
209 | free_irq(AU1100_GPIO19_INT, mmc_host); | 221 | free_irq(irq, mmc_host); |
210 | return ret; | 222 | return ret; |
211 | } | 223 | } |
212 | 224 | ||
213 | static int db1100_mmc1_cd_setup(void *mmc_host, int en) | 225 | static int db1100_mmc1_cd_setup(void *mmc_host, int en) |
214 | { | 226 | { |
215 | int ret = 0; | 227 | int ret = 0, irq; |
228 | |||
229 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100) | ||
230 | irq = AU1100_GPIO20_INT; | ||
231 | else | ||
232 | irq = AU1100_GPIO15_INT; /* PB1100 SD1 CD# */ | ||
216 | 233 | ||
217 | if (en) { | 234 | if (en) { |
218 | irq_set_irq_type(AU1100_GPIO20_INT, IRQ_TYPE_EDGE_BOTH); | 235 | irq_set_irq_type(irq, IRQ_TYPE_EDGE_BOTH); |
219 | ret = request_irq(AU1100_GPIO20_INT, db1100_mmc_cd, 0, | 236 | ret = request_irq(irq, db1100_mmc_cd, 0, |
220 | "sd1_cd", mmc_host); | 237 | "sd1_cd", mmc_host); |
221 | } else | 238 | } else |
222 | free_irq(AU1100_GPIO20_INT, mmc_host); | 239 | free_irq(irq, mmc_host); |
223 | return ret; | 240 | return ret; |
224 | } | 241 | } |
225 | 242 | ||
@@ -236,11 +253,18 @@ static int db1100_mmc_card_inserted(void *mmc_host) | |||
236 | 253 | ||
237 | static void db1100_mmc_set_power(void *mmc_host, int state) | 254 | static void db1100_mmc_set_power(void *mmc_host, int state) |
238 | { | 255 | { |
256 | int bit; | ||
257 | |||
258 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100) | ||
259 | bit = BCSR_BOARD_SD0PWR; | ||
260 | else | ||
261 | bit = BCSR_BOARD_PB1100_SD0PWR; | ||
262 | |||
239 | if (state) { | 263 | if (state) { |
240 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD0PWR); | 264 | bcsr_mod(BCSR_BOARD, 0, bit); |
241 | msleep(400); /* stabilization time */ | 265 | msleep(400); /* stabilization time */ |
242 | } else | 266 | } else |
243 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD0PWR, 0); | 267 | bcsr_mod(BCSR_BOARD, bit, 0); |
244 | } | 268 | } |
245 | 269 | ||
246 | static void db1100_mmcled_set(struct led_classdev *led, enum led_brightness b) | 270 | static void db1100_mmcled_set(struct led_classdev *led, enum led_brightness b) |
@@ -267,11 +291,18 @@ static int db1100_mmc1_card_inserted(void *mmc_host) | |||
267 | 291 | ||
268 | static void db1100_mmc1_set_power(void *mmc_host, int state) | 292 | static void db1100_mmc1_set_power(void *mmc_host, int state) |
269 | { | 293 | { |
294 | int bit; | ||
295 | |||
296 | if (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)) == BCSR_WHOAMI_DB1100) | ||
297 | bit = BCSR_BOARD_SD1PWR; | ||
298 | else | ||
299 | bit = BCSR_BOARD_PB1100_SD1PWR; | ||
300 | |||
270 | if (state) { | 301 | if (state) { |
271 | bcsr_mod(BCSR_BOARD, 0, BCSR_BOARD_SD1PWR); | 302 | bcsr_mod(BCSR_BOARD, 0, bit); |
272 | msleep(400); /* stabilization time */ | 303 | msleep(400); /* stabilization time */ |
273 | } else | 304 | } else |
274 | bcsr_mod(BCSR_BOARD, BCSR_BOARD_SD1PWR, 0); | 305 | bcsr_mod(BCSR_BOARD, bit, 0); |
275 | } | 306 | } |
276 | 307 | ||
277 | static void db1100_mmc1led_set(struct led_classdev *led, enum led_brightness b) | 308 | static void db1100_mmc1led_set(struct led_classdev *led, enum led_brightness b) |
@@ -480,13 +511,12 @@ static struct platform_device *db1100_devs[] = { | |||
480 | &db1100_mmc0_dev, | 511 | &db1100_mmc0_dev, |
481 | &db1100_mmc1_dev, | 512 | &db1100_mmc1_dev, |
482 | &db1000_irda_dev, | 513 | &db1000_irda_dev, |
483 | &db1100_spi_dev, | ||
484 | }; | 514 | }; |
485 | 515 | ||
486 | static int __init db1000_dev_init(void) | 516 | static int __init db1000_dev_init(void) |
487 | { | 517 | { |
488 | int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); | 518 | int board = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI)); |
489 | int c0, c1, d0, d1, s0, s1; | 519 | int c0, c1, d0, d1, s0, s1, flashsize = 32, twosocks = 1; |
490 | unsigned long pfc; | 520 | unsigned long pfc; |
491 | 521 | ||
492 | if (board == BCSR_WHOAMI_DB1500) { | 522 | if (board == BCSR_WHOAMI_DB1500) { |
@@ -522,6 +552,7 @@ static int __init db1000_dev_init(void) | |||
522 | ARRAY_SIZE(db1100_spi_info)); | 552 | ARRAY_SIZE(db1100_spi_info)); |
523 | 553 | ||
524 | platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); | 554 | platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); |
555 | platform_device_register(&db1100_spi_dev); | ||
525 | } else if (board == BCSR_WHOAMI_DB1000) { | 556 | } else if (board == BCSR_WHOAMI_DB1000) { |
526 | c0 = AU1000_GPIO2_INT; | 557 | c0 = AU1000_GPIO2_INT; |
527 | c1 = AU1000_GPIO5_INT; | 558 | c1 = AU1000_GPIO5_INT; |
@@ -530,15 +561,42 @@ static int __init db1000_dev_init(void) | |||
530 | s0 = AU1000_GPIO1_INT; | 561 | s0 = AU1000_GPIO1_INT; |
531 | s1 = AU1000_GPIO4_INT; | 562 | s1 = AU1000_GPIO4_INT; |
532 | platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs)); | 563 | platform_add_devices(db1000_devs, ARRAY_SIZE(db1000_devs)); |
564 | } else if ((board == BCSR_WHOAMI_PB1500) || | ||
565 | (board == BCSR_WHOAMI_PB1500R2)) { | ||
566 | c0 = AU1500_GPIO203_INT; | ||
567 | d0 = AU1500_GPIO201_INT; | ||
568 | s0 = AU1500_GPIO202_INT; | ||
569 | twosocks = 0; | ||
570 | flashsize = 64; | ||
571 | /* RTC and daughtercard irqs */ | ||
572 | irq_set_irq_type(AU1500_GPIO204_INT, IRQ_TYPE_LEVEL_LOW); | ||
573 | irq_set_irq_type(AU1500_GPIO205_INT, IRQ_TYPE_LEVEL_LOW); | ||
574 | /* EPSON S1D13806 0x1b000000 | ||
575 | * SRAM 1MB/2MB 0x1a000000 | ||
576 | * DS1693 RTC 0x0c000000 | ||
577 | */ | ||
578 | } else if (board == BCSR_WHOAMI_PB1100) { | ||
579 | c0 = AU1100_GPIO11_INT; | ||
580 | d0 = AU1100_GPIO9_INT; | ||
581 | s0 = AU1100_GPIO10_INT; | ||
582 | twosocks = 0; | ||
583 | flashsize = 64; | ||
584 | /* pendown, rtc, daughtercard irqs */ | ||
585 | irq_set_irq_type(AU1100_GPIO8_INT, IRQ_TYPE_LEVEL_LOW); | ||
586 | irq_set_irq_type(AU1100_GPIO12_INT, IRQ_TYPE_LEVEL_LOW); | ||
587 | irq_set_irq_type(AU1100_GPIO13_INT, IRQ_TYPE_LEVEL_LOW); | ||
588 | /* EPSON S1D13806 0x1b000000 | ||
589 | * SRAM 1MB/2MB 0x1a000000 | ||
590 | * DiskOnChip 0x0d000000 | ||
591 | * DS1693 RTC 0x0c000000 | ||
592 | */ | ||
593 | platform_add_devices(db1100_devs, ARRAY_SIZE(db1100_devs)); | ||
533 | } else | 594 | } else |
534 | return 0; /* unknown board, no further dev setup to do */ | 595 | return 0; /* unknown board, no further dev setup to do */ |
535 | 596 | ||
536 | irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH); | 597 | irq_set_irq_type(d0, IRQ_TYPE_EDGE_BOTH); |
537 | irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH); | ||
538 | irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW); | 598 | irq_set_irq_type(c0, IRQ_TYPE_LEVEL_LOW); |
539 | irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW); | ||
540 | irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW); | 599 | irq_set_irq_type(s0, IRQ_TYPE_LEVEL_LOW); |
541 | irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW); | ||
542 | 600 | ||
543 | db1x_register_pcmcia_socket( | 601 | db1x_register_pcmcia_socket( |
544 | AU1000_PCMCIA_ATTR_PHYS_ADDR, | 602 | AU1000_PCMCIA_ATTR_PHYS_ADDR, |
@@ -549,17 +607,23 @@ static int __init db1000_dev_init(void) | |||
549 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, | 607 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x000010000 - 1, |
550 | c0, d0, /*s0*/0, 0, 0); | 608 | c0, d0, /*s0*/0, 0, 0); |
551 | 609 | ||
552 | db1x_register_pcmcia_socket( | 610 | if (twosocks) { |
553 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, | 611 | irq_set_irq_type(d1, IRQ_TYPE_EDGE_BOTH); |
554 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, | 612 | irq_set_irq_type(c1, IRQ_TYPE_LEVEL_LOW); |
555 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, | 613 | irq_set_irq_type(s1, IRQ_TYPE_LEVEL_LOW); |
556 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, | 614 | |
557 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, | 615 | db1x_register_pcmcia_socket( |
558 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, | 616 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004000000, |
559 | c1, d1, /*s1*/0, 0, 1); | 617 | AU1000_PCMCIA_ATTR_PHYS_ADDR + 0x004400000 - 1, |
618 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004000000, | ||
619 | AU1000_PCMCIA_MEM_PHYS_ADDR + 0x004400000 - 1, | ||
620 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004000000, | ||
621 | AU1000_PCMCIA_IO_PHYS_ADDR + 0x004010000 - 1, | ||
622 | c1, d1, /*s1*/0, 0, 1); | ||
623 | } | ||
560 | 624 | ||
561 | platform_add_devices(db1x00_devs, ARRAY_SIZE(db1x00_devs)); | 625 | platform_add_devices(db1x00_devs, ARRAY_SIZE(db1x00_devs)); |
562 | db1x_register_norflash(32 << 20, 4 /* 32bit */, F_SWAPPED); | 626 | db1x_register_norflash(flashsize << 20, 4 /* 32bit */, F_SWAPPED); |
563 | return 0; | 627 | return 0; |
564 | } | 628 | } |
565 | device_initcall(db1000_dev_init); | 629 | device_initcall(db1000_dev_init); |