NUC900: Add platform support for nuc900 i2c driver
Subsystems (3)
PATCH 2/2 NUC900: Add platform support for nuc900 i2c driver
This patch is to add platform support for i2c driver. For get i2c work clock, I implemented the 'nuc900_get_cpuclock' api for getting cpu,apb,ahb clock.
Signed-off-by Wan ZongShun <[email protected]>
--- arch/arm/mach-w90x900/cpu.c | 43 +++++++++++++++++++++++++++++++++ arch/arm/mach-w90x900/cpu.h | 3 +- arch/arm/mach-w90x900/dev.c | 56 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 1 deletions(-)
arch/arm/mach-w90x900/cpu.c +43 -0
@@ -195,6 +195,49 @@ static int __init nuc900_set_cpufreq(char *str)__setup ("cpufreq=" , nuc900_set_cpufreq); +void nuc900_get_cpuclock (unsigned int *cpuclk_khz, +unsigned int *ahbclk_khz,unsigned int *apbclk_khz) { + +int ahbspeed =0 , apbspeed =0 , cpuspeed =0 ; + +if (cpuclk_khz) { + cpuspeed =__raw_readl (REG_PLLCON0 ); +if (cpuspeed ==PLL_200MHZ ) + cpuspeed =200 *1000 ; +else if (cpuspeed ==PLL_166MHZ ) + cpuspeed =166 *1000 ; +else if (cpuspeed ==PLL_120MHZ ) + cpuspeed =120 *1000 ; +else if (cpuspeed ==PLL_100MHZ ) + cpuspeed =100 *1000 ; +else if (cpuspeed ==PLL_66MHZ ) + cpuspeed =66 *1000 ; +else +printk (KERN_ERR "Can not read true cpuspeed!\n" ); + *cpuclk_khz = cpuspeed; + } + +if (ahbclk_khz) { + ahbspeed = (__raw_readl (REG_CLKDIV ) >>24 ) &0x03 ; +if (ahbspeed ==AHB_CPUCLK_1_1 ) + ahbspeed = cpuspeed; +else if (ahbspeed ==AHB_CPUCLK_1_2 ) + ahbspeed = cpuspeed /2 ; +else +printk (KERN_ERR "Can not read true ahbspeed!\n" ); + *ahbclk_khz = ahbspeed; + } + +if (apbclk_khz) { + apbspeed = (__raw_readl (REG_CLKDIV ) >>26 ) &0x03 ; +if (apbspeed ==APB_AHB_1_2 ) + apbspeed = ahbspeed /2 ; +else +printk (KERN_ERR "Can not read true apbspeed!\n" ); + *apbclk_khz = apbspeed; + } +} +/*Init NUC900 evb io*/ void __init nuc900_map_io (struct map_desc *mach_desc,int mach_size)
arch/arm/mach-w90x900/cpu.h +2 -1
@@ -49,7 +49,8 @@ extern void nuc900_clock_source(struct device *dev, unsigned char *src);extern void nuc900_init_clocks (void );extern void nuc900_map_io (struct map_desc *mach_desc,int mach_size);extern void nuc900_board_init (struct platform_device **device,int size); - +extern void nuc900_get_cpuclock (unsigned int *cpuclk_khz, +unsigned int *ahbclk_khz,unsigned int *apbclk_khz);/* for either public between 910 and 920, or between 920 and 950 */ extern struct platform_device nuc900_serial_device;
arch/arm/mach-w90x900/dev.c +56 -0
80 lines not on this page · raw message
Signature · 1 line
1.6.3.3