[ARM] 5602/1: Add sub clock api for w90p910 platform

Add sub clock api for w90p910 platform.

Signed-off-by: Wan ZongShun <mcuos.com@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
wanzongshun 2009-07-14 15:10:43 +01:00 committed by Russell King
parent d2c2419550
commit db58e90fdb
3 changed files with 32 additions and 0 deletions

View File

@ -25,6 +25,8 @@
#include "clock.h"
#define SUBCLK 0x24
static DEFINE_SPINLOCK(clocks_lock);
int clk_enable(struct clk *clk)
@ -68,6 +70,22 @@ void w90x900_clk_enable(struct clk *clk, int enable)
__raw_writel(clken, W90X900_VA_CLKPWR);
}
void w90x900_subclk_enable(struct clk *clk, int enable)
{
unsigned int clocks = clk->cken;
unsigned long clken;
clken = __raw_readl(W90X900_VA_CLKPWR + SUBCLK);
if (enable)
clken |= clocks;
else
clken &= ~clocks;
__raw_writel(clken, W90X900_VA_CLKPWR + SUBCLK);
}
void clks_register(struct clk_lookup *clks, size_t num)
{
int i;

View File

@ -13,6 +13,7 @@
#include <asm/clkdev.h>
void w90x900_clk_enable(struct clk *clk, int enable);
void w90x900_subclk_enable(struct clk *clk, int enable);
void clks_register(struct clk_lookup *clks, size_t num);
struct clk {
@ -27,6 +28,13 @@ struct clk clk_##_name = { \
.cken = (1 << _ctrlbit), \
}
#define DEFINE_SUBCLK(_name, _ctrlbit) \
struct clk clk_##_name = { \
.enable = w90x900_subclk_enable, \
.cken = (1 << _ctrlbit), \
}
#define DEF_CLKLOOK(_clk, _devname, _conname) \
{ \
.clk = _clk, \

View File

@ -57,9 +57,12 @@ static struct map_desc w90p910_iodesc[] __initdata = {
static DEFINE_CLK(lcd, 0);
static DEFINE_CLK(audio, 1);
static DEFINE_CLK(fmi, 4);
static DEFINE_SUBCLK(ms, 0);
static DEFINE_SUBCLK(sd, 1);
static DEFINE_CLK(dmac, 5);
static DEFINE_CLK(atapi, 6);
static DEFINE_CLK(emc, 7);
static DEFINE_SUBCLK(rmii, 2);
static DEFINE_CLK(usbd, 8);
static DEFINE_CLK(usbh, 9);
static DEFINE_CLK(g2d, 10);;
@ -75,9 +78,12 @@ static struct clk_lookup w90p910_clkregs[] = {
DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL),
DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL),
DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", NULL),
DEF_CLKLOOK(&clk_ms, "w90p910-fmi", "MS"),
DEF_CLKLOOK(&clk_sd, "w90p910-fmi", "SD"),
DEF_CLKLOOK(&clk_dmac, "w90p910-dmac", NULL),
DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL),
DEF_CLKLOOK(&clk_emc, "w90p910-emc", NULL),
DEF_CLKLOOK(&clk_rmii, "w90p910-emc", "RMII"),
DEF_CLKLOOK(&clk_usbd, "w90p910-usbd", NULL),
DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL),
DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL),