Changeset 34550


Ignore:
Timestamp:
2012-12-06T23:39:52+01:00 (5 years ago)
Author:
florian
Message:

[adm8668] provide a system clock to be used by the MIPS timer

Signed-off-by: Florian Fainelli <florian@…>

Location:
trunk/target/linux/adm8668/files/arch/mips
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/adm8668/files/arch/mips/adm8668/Makefile

    r34548 r34550  
    44 
    55obj-y           := irq.o pci.o prom.o platform.o proc.o \ 
    6                    setup.o time.o early_printk.o clock.o \ 
     6                   setup.o clock.o time.o early_printk.o \ 
    77                   net_core.o net_intr.o 
  • trunk/target/linux/adm8668/files/arch/mips/adm8668/clock.c

    r34548 r34550  
    2323}; 
    2424 
     25static struct clk sys_clk; 
     26 
    2527struct clk *clk_get(struct device *dev, const char *id) 
    2628{ 
    27         const char *name = dev_name(dev); 
     29        const char *lookup = id; 
    2830 
    29         if (!strcmp(name, "apb:uart0")) 
     31        if (dev) 
     32                lookup = dev_name(dev); 
     33 
     34        if (!strcmp(lookup, "apb:uart0")) 
    3035                return &uart_clk; 
     36        if (!strcmp(lookup, "sys")) 
     37                return &sys_clk; 
    3138 
    3239        return ERR_PTR(-ENOENT); 
     
    5562} 
    5663EXPORT_SYMBOL(clk_put); 
     64 
     65void __init adm8668_init_clocks(void) 
     66{ 
     67        u32 adj; 
     68 
     69        /* adjustable clock selection 
     70         * CR3 bit 14~11, 0000 -> 175MHz, 0001 -> 180MHz, etc... 
     71         */ 
     72        adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf; 
     73        sys_clk.rate = SYS_CLOCK + adj * 5000000; 
     74 
     75        pr_info("ADM8668 CPU clock: %lu MHz\n", sys_clk.rate / 1000000); 
     76} 
  • trunk/target/linux/adm8668/files/arch/mips/adm8668/time.c

    r34544 r34550  
    11#include <linux/init.h> 
    22#include <linux/kernel.h> 
     3#include <linux/clk.h> 
    34 
    45#include <asm/time.h> 
     
    78void __init plat_time_init(void) 
    89{ 
    9         int adj = (ADM8668_CONFIG_REG(ADM8668_CR3) >> 11) & 0xf; 
     10        struct clk *sys_clk; 
    1011 
    11         /* adjustable clock selection 
    12            CR3 bit 14~11, 0000 -> 175MHz, 0001 -> 180MHz, etc... */ 
     12        adm8668_init_clocks(); 
    1313 
    14         mips_hpt_frequency = (SYS_CLOCK + adj * 5000000) / 2; 
    15         printk("ADM8668 CPU clock: %d MHz\n", 2*mips_hpt_frequency / 1000000); 
     14        sys_clk = clk_get(NULL, "sys"); 
     15        if (IS_ERR(sys_clk)) 
     16                panic("unable to get system clock\n"); 
     17 
     18        mips_hpt_frequency = clk_get_rate(sys_clk) / 2; 
    1619} 
    1720 
  • trunk/target/linux/adm8668/files/arch/mips/include/asm/mach-adm8668/adm8668.h

    r34549 r34550  
    110110        ADM8668_CONFIG_REG(CRGPIO_REG) ^= (1 << (6 + num)) 
    111111 
     112void adm8668_init_clocks(void); 
     113 
    112114#endif /* __ADM8668_H__ */ 
Note: See TracChangeset for help on using the changeset viewer.