diff options
author | Sergei Shtylylov <sshtylyov@ru.mvista.com> | 2006-02-04 07:11:14 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2006-02-07 08:30:26 -0500 |
commit | f09678af51caf93cbbb253b298be995e1145a577 (patch) | |
tree | 62ae8ee7154fa82b1ed756030728009c1fcddeec /arch/mips/tx4927 | |
parent | c226f2601f55010936f0f3c77ae167a02339f566 (diff) |
[MIPS] TX49x7: Fix reporting of the CPU name and PCI clock
I've noticed that PCI clock was incorrectly reported as 66 MHz while being
mere 33 MHz on RBTX4937 board -- this was due to the different encoding of
the PCI divisor field in CCFG register between TX4927 and TX4937 chips...
Also, RBTX49x7 was printed out as a CPU name (e.g., "CPU is RBTX4937");
and some debug printk() were duplicating each other...
Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/tx4927')
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c | 10 | ||||
-rw-r--r-- | arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | 136 |
2 files changed, 97 insertions, 49 deletions
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c index e4d095d3e192..e19e2be70f76 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c | |||
@@ -60,7 +60,6 @@ void __init prom_init_cmdline(void) | |||
60 | 60 | ||
61 | void __init prom_init(void) | 61 | void __init prom_init(void) |
62 | { | 62 | { |
63 | const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES; | ||
64 | extern int tx4927_get_mem_size(void); | 63 | extern int tx4927_get_mem_size(void); |
65 | extern char* toshiba_name; | 64 | extern char* toshiba_name; |
66 | int msize; | 65 | int msize; |
@@ -69,12 +68,13 @@ void __init prom_init(void) | |||
69 | 68 | ||
70 | mips_machgroup = MACH_GROUP_TOSHIBA; | 69 | mips_machgroup = MACH_GROUP_TOSHIBA; |
71 | 70 | ||
72 | if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) | 71 | if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) { |
73 | mips_machtype = MACH_TOSHIBA_RBTX4927; | 72 | mips_machtype = MACH_TOSHIBA_RBTX4927; |
74 | else | 73 | toshiba_name = "TX4927"; |
74 | } else { | ||
75 | mips_machtype = MACH_TOSHIBA_RBTX4937; | 75 | mips_machtype = MACH_TOSHIBA_RBTX4937; |
76 | 76 | toshiba_name = "TX4937"; | |
77 | toshiba_name = toshiba_name_list[mips_machtype]; | 77 | } |
78 | 78 | ||
79 | msize = tx4927_get_mem_size(); | 79 | msize = tx4927_get_mem_size(); |
80 | add_memory_region(0, msize << 20, BOOT_MEM_RAM); | 80 | add_memory_region(0, msize << 20, BOOT_MEM_RAM); |
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c index 098132916cc8..2ad6401d2af4 100644 --- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c +++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c | |||
@@ -539,19 +539,10 @@ void tx4927_pci_setup(void) | |||
539 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, | 539 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, |
540 | "0x%08lx=mips_io_port_base", | 540 | "0x%08lx=mips_io_port_base", |
541 | mips_io_port_base); | 541 | mips_io_port_base); |
542 | |||
543 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, | ||
544 | "setup pci_io_resource to 0x%08lx 0x%08lx\n", | ||
545 | pci_io_resource.start, | ||
546 | pci_io_resource.end); | ||
547 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, | ||
548 | "setup pci_mem_resource to 0x%08lx 0x%08lx\n", | ||
549 | pci_mem_resource.start, | ||
550 | pci_mem_resource.end); | ||
551 | |||
552 | if (!called) { | 542 | if (!called) { |
553 | printk | 543 | printk |
554 | ("TX4927 PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", | 544 | ("%s PCIC -- DID:%04x VID:%04x RID:%02x Arbiter:%s\n", |
545 | toshiba_name, | ||
555 | (unsigned short) (tx4927_pcicptr->pciid >> 16), | 546 | (unsigned short) (tx4927_pcicptr->pciid >> 16), |
556 | (unsigned short) (tx4927_pcicptr->pciid & 0xffff), | 547 | (unsigned short) (tx4927_pcicptr->pciid & 0xffff), |
557 | (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), | 548 | (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), |
@@ -564,21 +555,52 @@ void tx4927_pci_setup(void) | |||
564 | (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); | 555 | (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); |
565 | if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { | 556 | if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { |
566 | int pciclk = 0; | 557 | int pciclk = 0; |
567 | switch ((unsigned long) tx4927_ccfgptr-> | 558 | if (mips_machtype == MACH_TOSHIBA_RBTX4937) |
568 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | 559 | switch ((unsigned long) tx4927_ccfgptr-> |
569 | case TX4927_CCFG_PCIDIVMODE_2_5: | 560 | ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { |
570 | pciclk = tx4927_cpu_clock * 2 / 5; | 561 | case TX4937_CCFG_PCIDIVMODE_4: |
571 | break; | 562 | pciclk = tx4927_cpu_clock / 4; |
572 | case TX4927_CCFG_PCIDIVMODE_3: | 563 | break; |
573 | pciclk = tx4927_cpu_clock / 3; | 564 | case TX4937_CCFG_PCIDIVMODE_4_5: |
574 | break; | 565 | pciclk = tx4927_cpu_clock * 2 / 9; |
575 | case TX4927_CCFG_PCIDIVMODE_5: | 566 | break; |
576 | pciclk = tx4927_cpu_clock / 5; | 567 | case TX4937_CCFG_PCIDIVMODE_5: |
577 | break; | 568 | pciclk = tx4927_cpu_clock / 5; |
578 | case TX4927_CCFG_PCIDIVMODE_6: | 569 | break; |
579 | pciclk = tx4927_cpu_clock / 6; | 570 | case TX4937_CCFG_PCIDIVMODE_5_5: |
580 | break; | 571 | pciclk = tx4927_cpu_clock * 2 / 11; |
581 | } | 572 | break; |
573 | case TX4937_CCFG_PCIDIVMODE_8: | ||
574 | pciclk = tx4927_cpu_clock / 8; | ||
575 | break; | ||
576 | case TX4937_CCFG_PCIDIVMODE_9: | ||
577 | pciclk = tx4927_cpu_clock / 9; | ||
578 | break; | ||
579 | case TX4937_CCFG_PCIDIVMODE_10: | ||
580 | pciclk = tx4927_cpu_clock / 10; | ||
581 | break; | ||
582 | case TX4937_CCFG_PCIDIVMODE_11: | ||
583 | pciclk = tx4927_cpu_clock / 11; | ||
584 | break; | ||
585 | } | ||
586 | |||
587 | else | ||
588 | switch ((unsigned long) tx4927_ccfgptr-> | ||
589 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | ||
590 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
591 | pciclk = tx4927_cpu_clock * 2 / 5; | ||
592 | break; | ||
593 | case TX4927_CCFG_PCIDIVMODE_3: | ||
594 | pciclk = tx4927_cpu_clock / 3; | ||
595 | break; | ||
596 | case TX4927_CCFG_PCIDIVMODE_5: | ||
597 | pciclk = tx4927_cpu_clock / 5; | ||
598 | break; | ||
599 | case TX4927_CCFG_PCIDIVMODE_6: | ||
600 | pciclk = tx4927_cpu_clock / 6; | ||
601 | break; | ||
602 | } | ||
603 | |||
582 | printk("Internal(%dMHz)", pciclk / 1000000); | 604 | printk("Internal(%dMHz)", pciclk / 1000000); |
583 | } else { | 605 | } else { |
584 | int pciclk = 0; | 606 | int pciclk = 0; |
@@ -823,17 +845,33 @@ void __init toshiba_rbtx4927_setup(void) | |||
823 | /* PCIC */ | 845 | /* PCIC */ |
824 | /* | 846 | /* |
825 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. | 847 | * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. |
826 | * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1). | 848 | * |
849 | * For TX4927: | ||
850 | * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). | ||
827 | * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) | 851 | * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) |
828 | * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) | 852 | * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) |
829 | * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) | 853 | * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) |
830 | * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) | 854 | * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) |
831 | * i.e. S9[3]: ON (83MHz), OFF (100MHz) | 855 | * i.e. S9[3]: ON (83MHz), OFF (100MHz) |
856 | * | ||
857 | * For TX4937: | ||
858 | * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) | ||
859 | * PCIDIVMODE[10] is 0. | ||
860 | * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) | ||
861 | * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) | ||
862 | * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) | ||
863 | * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) | ||
864 | * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) | ||
865 | * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) | ||
866 | * | ||
832 | */ | 867 | */ |
833 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, | 868 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, |
834 | "ccfg is %lx, DIV is %x\n", | 869 | "ccfg is %lx, PCIDIVMODE is %x\n", |
835 | (unsigned long) tx4927_ccfgptr-> | 870 | (unsigned long) tx4927_ccfgptr->ccfg, |
836 | ccfg, TX4927_CCFG_PCIDIVMODE_MASK); | 871 | (unsigned long) tx4927_ccfgptr->ccfg & |
872 | (mips_machtype == MACH_TOSHIBA_RBTX4937 ? | ||
873 | TX4937_CCFG_PCIDIVMODE_MASK : | ||
874 | TX4927_CCFG_PCIDIVMODE_MASK)); | ||
837 | 875 | ||
838 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, | 876 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, |
839 | "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", | 877 | "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", |
@@ -844,20 +882,30 @@ void __init toshiba_rbtx4927_setup(void) | |||
844 | (unsigned long) tx4927_ccfgptr-> | 882 | (unsigned long) tx4927_ccfgptr-> |
845 | ccfg & TX4927_CCFG_PCIXARB); | 883 | ccfg & TX4927_CCFG_PCIXARB); |
846 | 884 | ||
847 | TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, | 885 | if (mips_machtype == MACH_TOSHIBA_RBTX4937) |
848 | "PCIDIVMODE is %lx\n", | 886 | switch ((unsigned long)tx4927_ccfgptr-> |
849 | (unsigned long) tx4927_ccfgptr-> | 887 | ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { |
850 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK); | 888 | case TX4937_CCFG_PCIDIVMODE_8: |
851 | 889 | case TX4937_CCFG_PCIDIVMODE_4: | |
852 | switch ((unsigned long) tx4927_ccfgptr-> | 890 | tx4927_cpu_clock = 266666666; /* 266MHz */ |
853 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | 891 | break; |
854 | case TX4927_CCFG_PCIDIVMODE_2_5: | 892 | case TX4937_CCFG_PCIDIVMODE_9: |
855 | case TX4927_CCFG_PCIDIVMODE_5: | 893 | case TX4937_CCFG_PCIDIVMODE_4_5: |
856 | tx4927_cpu_clock = 166000000; /* 166MHz */ | 894 | tx4927_cpu_clock = 300000000; /* 300MHz */ |
857 | break; | 895 | break; |
858 | default: | 896 | default: |
859 | tx4927_cpu_clock = 200000000; /* 200MHz */ | 897 | tx4927_cpu_clock = 333333333; /* 333MHz */ |
860 | } | 898 | } |
899 | else | ||
900 | switch ((unsigned long)tx4927_ccfgptr-> | ||
901 | ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { | ||
902 | case TX4927_CCFG_PCIDIVMODE_2_5: | ||
903 | case TX4927_CCFG_PCIDIVMODE_5: | ||
904 | tx4927_cpu_clock = 166666666; /* 166MHz */ | ||
905 | break; | ||
906 | default: | ||
907 | tx4927_cpu_clock = 200000000; /* 200MHz */ | ||
908 | } | ||
861 | 909 | ||
862 | /* CCFG */ | 910 | /* CCFG */ |
863 | /* enable Timeout BusError */ | 911 | /* enable Timeout BusError */ |