Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Sergei Shtylylov and committed by
Ralf Baechle
f09678af c226f260

+107 -49
+5 -5
arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_prom.c
··· 60 60 61 61 void __init prom_init(void) 62 62 { 63 - const char* toshiba_name_list[] = GROUP_TOSHIBA_NAMES; 64 63 extern int tx4927_get_mem_size(void); 65 64 extern char* toshiba_name; 66 65 int msize; ··· 68 69 69 70 mips_machgroup = MACH_GROUP_TOSHIBA; 70 71 71 - if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) 72 + if ((read_c0_prid() & 0xff) == PRID_REV_TX4927) { 72 73 mips_machtype = MACH_TOSHIBA_RBTX4927; 73 - else 74 + toshiba_name = "TX4927"; 75 + } else { 74 76 mips_machtype = MACH_TOSHIBA_RBTX4937; 75 - 76 - toshiba_name = toshiba_name_list[mips_machtype]; 77 + toshiba_name = "TX4937"; 78 + } 77 79 78 80 msize = tx4927_get_mem_size(); 79 81 add_memory_region(0, msize << 20, BOOT_MEM_RAM);
+92 -44
arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
··· 539 539 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI2, 540 540 "0x%08lx=mips_io_port_base", 541 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 542 if (!called) { 553 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 546 (unsigned short) (tx4927_pcicptr->pciid >> 16), 556 547 (unsigned short) (tx4927_pcicptr->pciid & 0xffff), 557 548 (unsigned short) (tx4927_pcicptr->pciccrev & 0xff), ··· 555 564 (tx4927_ccfgptr->ccfg & TX4927_CCFG_PCI66) ? " PCI66" : ""); 556 565 if (tx4927_ccfgptr->pcfg & TX4927_PCFG_PCICLKEN_ALL) { 557 566 int pciclk = 0; 558 - switch ((unsigned long) tx4927_ccfgptr-> 559 - ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 560 - case TX4927_CCFG_PCIDIVMODE_2_5: 561 - pciclk = tx4927_cpu_clock * 2 / 5; 562 - break; 563 - case TX4927_CCFG_PCIDIVMODE_3: 564 - pciclk = tx4927_cpu_clock / 3; 565 - break; 566 - case TX4927_CCFG_PCIDIVMODE_5: 567 - pciclk = tx4927_cpu_clock / 5; 568 - break; 569 - case TX4927_CCFG_PCIDIVMODE_6: 570 - pciclk = tx4927_cpu_clock / 6; 571 - break; 572 - } 567 + if (mips_machtype == MACH_TOSHIBA_RBTX4937) 568 + switch ((unsigned long) tx4927_ccfgptr-> 569 + ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { 570 + case TX4937_CCFG_PCIDIVMODE_4: 571 + pciclk = tx4927_cpu_clock / 4; 572 + break; 573 + case TX4937_CCFG_PCIDIVMODE_4_5: 574 + pciclk = tx4927_cpu_clock * 2 / 9; 575 + break; 576 + case TX4937_CCFG_PCIDIVMODE_5: 577 + pciclk = tx4927_cpu_clock / 5; 578 + break; 579 + case TX4937_CCFG_PCIDIVMODE_5_5: 580 + pciclk = tx4927_cpu_clock * 2 / 11; 581 + break; 582 + case TX4937_CCFG_PCIDIVMODE_8: 583 + pciclk = tx4927_cpu_clock / 8; 584 + break; 585 + case TX4937_CCFG_PCIDIVMODE_9: 586 + pciclk = tx4927_cpu_clock / 9; 587 + break; 588 + case TX4937_CCFG_PCIDIVMODE_10: 589 + pciclk = tx4927_cpu_clock / 10; 590 + break; 591 + case TX4937_CCFG_PCIDIVMODE_11: 592 + pciclk = tx4927_cpu_clock / 11; 593 + break; 594 + } 595 + 596 + else 597 + switch ((unsigned long) tx4927_ccfgptr-> 598 + ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 599 + case TX4927_CCFG_PCIDIVMODE_2_5: 600 + pciclk = tx4927_cpu_clock * 2 / 5; 601 + break; 602 + case TX4927_CCFG_PCIDIVMODE_3: 603 + pciclk = tx4927_cpu_clock / 3; 604 + break; 605 + case TX4927_CCFG_PCIDIVMODE_5: 606 + pciclk = tx4927_cpu_clock / 5; 607 + break; 608 + case TX4927_CCFG_PCIDIVMODE_6: 609 + pciclk = tx4927_cpu_clock / 6; 610 + break; 611 + } 612 + 573 613 printk("Internal(%dMHz)", pciclk / 1000000); 574 614 } else { 575 615 int pciclk = 0; ··· 845 823 /* PCIC */ 846 824 /* 847 825 * ASSUMPTION: PCIDIVMODE is configured for PCI 33MHz or 66MHz. 848 - * PCIDIVMODE[12:11]'s initial value are given by S9[4:3] (ON:0, OFF:1). 826 + * 827 + * For TX4927: 828 + * PCIDIVMODE[12:11]'s initial value is given by S9[4:3] (ON:0, OFF:1). 849 829 * CPU 166MHz: PCI 66MHz : PCIDIVMODE: 00 (1/2.5) 850 830 * CPU 200MHz: PCI 66MHz : PCIDIVMODE: 01 (1/3) 851 831 * CPU 166MHz: PCI 33MHz : PCIDIVMODE: 10 (1/5) 852 832 * CPU 200MHz: PCI 33MHz : PCIDIVMODE: 11 (1/6) 853 833 * i.e. S9[3]: ON (83MHz), OFF (100MHz) 834 + * 835 + * For TX4937: 836 + * PCIDIVMODE[12:11]'s initial value is given by S1[5:4] (ON:0, OFF:1) 837 + * PCIDIVMODE[10] is 0. 838 + * CPU 266MHz: PCI 33MHz : PCIDIVMODE: 000 (1/8) 839 + * CPU 266MHz: PCI 66MHz : PCIDIVMODE: 001 (1/4) 840 + * CPU 300MHz: PCI 33MHz : PCIDIVMODE: 010 (1/9) 841 + * CPU 300MHz: PCI 66MHz : PCIDIVMODE: 011 (1/4.5) 842 + * CPU 333MHz: PCI 33MHz : PCIDIVMODE: 100 (1/10) 843 + * CPU 333MHz: PCI 66MHz : PCIDIVMODE: 101 (1/5) 844 + * 854 845 */ 855 846 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 856 - "ccfg is %lx, DIV is %x\n", 857 - (unsigned long) tx4927_ccfgptr-> 858 - ccfg, TX4927_CCFG_PCIDIVMODE_MASK); 847 + "ccfg is %lx, PCIDIVMODE is %x\n", 848 + (unsigned long) tx4927_ccfgptr->ccfg, 849 + (unsigned long) tx4927_ccfgptr->ccfg & 850 + (mips_machtype == MACH_TOSHIBA_RBTX4937 ? 851 + TX4937_CCFG_PCIDIVMODE_MASK : 852 + TX4927_CCFG_PCIDIVMODE_MASK)); 859 853 860 854 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 861 855 "PCI66 mode is %lx, PCI mode is %lx, pci arb is %lx\n", ··· 882 844 (unsigned long) tx4927_ccfgptr-> 883 845 ccfg & TX4927_CCFG_PCIXARB); 884 846 885 - TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_PCI1, 886 - "PCIDIVMODE is %lx\n", 887 - (unsigned long) tx4927_ccfgptr-> 888 - ccfg & TX4927_CCFG_PCIDIVMODE_MASK); 889 - 890 - switch ((unsigned long) tx4927_ccfgptr-> 891 - ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 892 - case TX4927_CCFG_PCIDIVMODE_2_5: 893 - case TX4927_CCFG_PCIDIVMODE_5: 894 - tx4927_cpu_clock = 166000000; /* 166MHz */ 895 - break; 896 - default: 897 - tx4927_cpu_clock = 200000000; /* 200MHz */ 898 - } 847 + if (mips_machtype == MACH_TOSHIBA_RBTX4937) 848 + switch ((unsigned long)tx4927_ccfgptr-> 849 + ccfg & TX4937_CCFG_PCIDIVMODE_MASK) { 850 + case TX4937_CCFG_PCIDIVMODE_8: 851 + case TX4937_CCFG_PCIDIVMODE_4: 852 + tx4927_cpu_clock = 266666666; /* 266MHz */ 853 + break; 854 + case TX4937_CCFG_PCIDIVMODE_9: 855 + case TX4937_CCFG_PCIDIVMODE_4_5: 856 + tx4927_cpu_clock = 300000000; /* 300MHz */ 857 + break; 858 + default: 859 + tx4927_cpu_clock = 333333333; /* 333MHz */ 860 + } 861 + else 862 + switch ((unsigned long)tx4927_ccfgptr-> 863 + ccfg & TX4927_CCFG_PCIDIVMODE_MASK) { 864 + case TX4927_CCFG_PCIDIVMODE_2_5: 865 + case TX4927_CCFG_PCIDIVMODE_5: 866 + tx4927_cpu_clock = 166666666; /* 166MHz */ 867 + break; 868 + default: 869 + tx4927_cpu_clock = 200000000; /* 200MHz */ 870 + } 899 871 900 872 /* CCFG */ 901 873 /* enable Timeout BusError */
+10
include/asm-mips/tx4927/tx4927_pci.h
··· 253 253 #define TX4927_CCFG_PCIDIVMODE_5 0x00001000 254 254 #define TX4927_CCFG_PCIDIVMODE_6 0x00001800 255 255 256 + #define TX4937_CCFG_PCIDIVMODE_MASK 0x00001c00 257 + #define TX4937_CCFG_PCIDIVMODE_8 0x00000000 258 + #define TX4937_CCFG_PCIDIVMODE_4 0x00000400 259 + #define TX4937_CCFG_PCIDIVMODE_9 0x00000800 260 + #define TX4937_CCFG_PCIDIVMODE_4_5 0x00000c00 261 + #define TX4937_CCFG_PCIDIVMODE_10 0x00001000 262 + #define TX4937_CCFG_PCIDIVMODE_5 0x00001400 263 + #define TX4937_CCFG_PCIDIVMODE_11 0x00001800 264 + #define TX4937_CCFG_PCIDIVMODE_5_5 0x00001c00 265 + 256 266 /* PCFG : Pin Configuration */ 257 267 #define TX4927_PCFG_PCICLKEN_ALL 0x003f0000 258 268 #define TX4927_PCFG_PCICLKEN(ch) (0x00010000<<(ch))