Skip to content

Commit

Permalink
[ARM] 5602/1: Add sub clock api for w90p910 platform
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
wanzongshun authored and Russell King committed Jul 17, 2009
1 parent d2c2419 commit db58e90
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
18 changes: 18 additions & 0 deletions arch/arm/mach-w90x900/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include "clock.h"

#define SUBCLK 0x24

static DEFINE_SPINLOCK(clocks_lock);

int clk_enable(struct clk *clk)
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/mach-w90x900/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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, \
Expand Down
6 changes: 6 additions & 0 deletions arch/arm/mach-w90x900/w90p910.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);;
Expand All @@ -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),
Expand Down

0 comments on commit db58e90

Please sign in to comment.