diff options
author | David Daney <ddaney@caviumnetworks.com> | 2010-10-07 19:03:49 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2010-10-29 14:08:40 -0400 |
commit | e195aa3039c5c4eeb60c415a7a0f3006d5cdcd3b (patch) | |
tree | 62817e61ddac8e1212f04cbdbbcf542849fdd8e6 /arch/mips | |
parent | 3b29dadff98887ecdc5db458c2961777016b7b86 (diff) |
MIPS: Octeon: Add octeon_get_io_clock_rate() for cn63xx
Starting with cn63xx Octeon I/O blocks are clocked at a different rate
than the CPU. Add a new function octeon_get_io_clock_rate() that
yields the I/O clock rate.
Also rearrange octeon_get_clock_rate() to get the value from the saved
sysinfo structure.
Signed-off-by: David Daney <ddaney@caviumnetworks.com>
Patchwork: http://patchwork.linux-mips.org/patch/1671/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/cavium-octeon/setup.c | 76 | ||||
-rw-r--r-- | arch/mips/include/asm/octeon/octeon.h | 1 |
2 files changed, 49 insertions, 28 deletions
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c index fc151bebed74..c072b24f4853 100644 --- a/arch/mips/cavium-octeon/setup.c +++ b/arch/mips/cavium-octeon/setup.c | |||
@@ -33,6 +33,7 @@ | |||
33 | 33 | ||
34 | #include <asm/octeon/octeon.h> | 34 | #include <asm/octeon/octeon.h> |
35 | #include <asm/octeon/pci-octeon.h> | 35 | #include <asm/octeon/pci-octeon.h> |
36 | #include <asm/octeon/cvmx-mio-defs.h> | ||
36 | 37 | ||
37 | #ifdef CONFIG_CAVIUM_DECODE_RSL | 38 | #ifdef CONFIG_CAVIUM_DECODE_RSL |
38 | extern void cvmx_interrupt_rsl_decode(void); | 39 | extern void cvmx_interrupt_rsl_decode(void); |
@@ -96,10 +97,21 @@ int octeon_is_pci_host(void) | |||
96 | */ | 97 | */ |
97 | uint64_t octeon_get_clock_rate(void) | 98 | uint64_t octeon_get_clock_rate(void) |
98 | { | 99 | { |
99 | return octeon_bootinfo->eclock_hz; | 100 | struct cvmx_sysinfo *sysinfo = cvmx_sysinfo_get(); |
101 | |||
102 | return sysinfo->cpu_clock_hz; | ||
100 | } | 103 | } |
101 | EXPORT_SYMBOL(octeon_get_clock_rate); | 104 | EXPORT_SYMBOL(octeon_get_clock_rate); |
102 | 105 | ||
106 | static u64 octeon_io_clock_rate; | ||
107 | |||
108 | u64 octeon_get_io_clock_rate(void) | ||
109 | { | ||
110 | return octeon_io_clock_rate; | ||
111 | } | ||
112 | EXPORT_SYMBOL(octeon_get_io_clock_rate); | ||
113 | |||
114 | |||
103 | /** | 115 | /** |
104 | * Write to the LCD display connected to the bootbus. This display | 116 | * Write to the LCD display connected to the bootbus. This display |
105 | * exists on most Cavium evaluation boards. If it doesn't exist, then | 117 | * exists on most Cavium evaluation boards. If it doesn't exist, then |
@@ -414,6 +426,41 @@ void __init prom_init(void) | |||
414 | cvmx_phys_to_ptr(octeon_boot_desc_ptr->cvmx_desc_vaddr); | 426 | cvmx_phys_to_ptr(octeon_boot_desc_ptr->cvmx_desc_vaddr); |
415 | cvmx_bootmem_init(cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr)); | 427 | cvmx_bootmem_init(cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr)); |
416 | 428 | ||
429 | sysinfo = cvmx_sysinfo_get(); | ||
430 | memset(sysinfo, 0, sizeof(*sysinfo)); | ||
431 | sysinfo->system_dram_size = octeon_bootinfo->dram_size << 20; | ||
432 | sysinfo->phy_mem_desc_ptr = | ||
433 | cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr); | ||
434 | sysinfo->core_mask = octeon_bootinfo->core_mask; | ||
435 | sysinfo->exception_base_addr = octeon_bootinfo->exception_base_addr; | ||
436 | sysinfo->cpu_clock_hz = octeon_bootinfo->eclock_hz; | ||
437 | sysinfo->dram_data_rate_hz = octeon_bootinfo->dclock_hz * 2; | ||
438 | sysinfo->board_type = octeon_bootinfo->board_type; | ||
439 | sysinfo->board_rev_major = octeon_bootinfo->board_rev_major; | ||
440 | sysinfo->board_rev_minor = octeon_bootinfo->board_rev_minor; | ||
441 | memcpy(sysinfo->mac_addr_base, octeon_bootinfo->mac_addr_base, | ||
442 | sizeof(sysinfo->mac_addr_base)); | ||
443 | sysinfo->mac_addr_count = octeon_bootinfo->mac_addr_count; | ||
444 | memcpy(sysinfo->board_serial_number, | ||
445 | octeon_bootinfo->board_serial_number, | ||
446 | sizeof(sysinfo->board_serial_number)); | ||
447 | sysinfo->compact_flash_common_base_addr = | ||
448 | octeon_bootinfo->compact_flash_common_base_addr; | ||
449 | sysinfo->compact_flash_attribute_base_addr = | ||
450 | octeon_bootinfo->compact_flash_attribute_base_addr; | ||
451 | sysinfo->led_display_base_addr = octeon_bootinfo->led_display_base_addr; | ||
452 | sysinfo->dfa_ref_clock_hz = octeon_bootinfo->dfa_ref_clock_hz; | ||
453 | sysinfo->bootloader_config_flags = octeon_bootinfo->config_flags; | ||
454 | |||
455 | if (OCTEON_IS_MODEL(OCTEON_CN6XXX)) { | ||
456 | /* I/O clock runs at a different rate than the CPU. */ | ||
457 | union cvmx_mio_rst_boot rst_boot; | ||
458 | rst_boot.u64 = cvmx_read_csr(CVMX_MIO_RST_BOOT); | ||
459 | octeon_io_clock_rate = 50000000 * rst_boot.s.pnr_mul; | ||
460 | } else { | ||
461 | octeon_io_clock_rate = sysinfo->cpu_clock_hz; | ||
462 | } | ||
463 | |||
417 | /* | 464 | /* |
418 | * Only enable the LED controller if we're running on a CN38XX, CN58XX, | 465 | * Only enable the LED controller if we're running on a CN38XX, CN58XX, |
419 | * or CN56XX. The CN30XX and CN31XX don't have an LED controller. | 466 | * or CN56XX. The CN30XX and CN31XX don't have an LED controller. |
@@ -477,33 +524,6 @@ void __init prom_init(void) | |||
477 | } | 524 | } |
478 | #endif | 525 | #endif |
479 | 526 | ||
480 | sysinfo = cvmx_sysinfo_get(); | ||
481 | memset(sysinfo, 0, sizeof(*sysinfo)); | ||
482 | sysinfo->system_dram_size = octeon_bootinfo->dram_size << 20; | ||
483 | sysinfo->phy_mem_desc_ptr = | ||
484 | cvmx_phys_to_ptr(octeon_bootinfo->phy_mem_desc_addr); | ||
485 | sysinfo->core_mask = octeon_bootinfo->core_mask; | ||
486 | sysinfo->exception_base_addr = octeon_bootinfo->exception_base_addr; | ||
487 | sysinfo->cpu_clock_hz = octeon_bootinfo->eclock_hz; | ||
488 | sysinfo->dram_data_rate_hz = octeon_bootinfo->dclock_hz * 2; | ||
489 | sysinfo->board_type = octeon_bootinfo->board_type; | ||
490 | sysinfo->board_rev_major = octeon_bootinfo->board_rev_major; | ||
491 | sysinfo->board_rev_minor = octeon_bootinfo->board_rev_minor; | ||
492 | memcpy(sysinfo->mac_addr_base, octeon_bootinfo->mac_addr_base, | ||
493 | sizeof(sysinfo->mac_addr_base)); | ||
494 | sysinfo->mac_addr_count = octeon_bootinfo->mac_addr_count; | ||
495 | memcpy(sysinfo->board_serial_number, | ||
496 | octeon_bootinfo->board_serial_number, | ||
497 | sizeof(sysinfo->board_serial_number)); | ||
498 | sysinfo->compact_flash_common_base_addr = | ||
499 | octeon_bootinfo->compact_flash_common_base_addr; | ||
500 | sysinfo->compact_flash_attribute_base_addr = | ||
501 | octeon_bootinfo->compact_flash_attribute_base_addr; | ||
502 | sysinfo->led_display_base_addr = octeon_bootinfo->led_display_base_addr; | ||
503 | sysinfo->dfa_ref_clock_hz = octeon_bootinfo->dfa_ref_clock_hz; | ||
504 | sysinfo->bootloader_config_flags = octeon_bootinfo->config_flags; | ||
505 | |||
506 | |||
507 | octeon_check_cpu_bist(); | 527 | octeon_check_cpu_bist(); |
508 | 528 | ||
509 | octeon_uart = octeon_get_boot_uart(); | 529 | octeon_uart = octeon_get_boot_uart(); |
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h index 917a6c413b1a..6b34afd0d4e7 100644 --- a/arch/mips/include/asm/octeon/octeon.h +++ b/arch/mips/include/asm/octeon/octeon.h | |||
@@ -35,6 +35,7 @@ extern int octeon_is_simulation(void); | |||
35 | extern int octeon_is_pci_host(void); | 35 | extern int octeon_is_pci_host(void); |
36 | extern int octeon_usb_is_ref_clk(void); | 36 | extern int octeon_usb_is_ref_clk(void); |
37 | extern uint64_t octeon_get_clock_rate(void); | 37 | extern uint64_t octeon_get_clock_rate(void); |
38 | extern u64 octeon_get_io_clock_rate(void); | ||
38 | extern const char *octeon_board_type_string(void); | 39 | extern const char *octeon_board_type_string(void); |
39 | extern const char *octeon_get_pci_interrupts(void); | 40 | extern const char *octeon_get_pci_interrupts(void); |
40 | extern int octeon_get_southbridge_interrupt(void); | 41 | extern int octeon_get_southbridge_interrupt(void); |