提交 db58e90f 编写于 作者: W wanzongshun 提交者: Russell King

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

Add sub clock api for w90p910 platform.
Signed-off-by: NWan ZongShun <mcuos.com@gmail.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 d2c24195
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
#include "clock.h" #include "clock.h"
#define SUBCLK 0x24
static DEFINE_SPINLOCK(clocks_lock); static DEFINE_SPINLOCK(clocks_lock);
int clk_enable(struct clk *clk) int clk_enable(struct clk *clk)
...@@ -68,6 +70,22 @@ void w90x900_clk_enable(struct clk *clk, int enable) ...@@ -68,6 +70,22 @@ void w90x900_clk_enable(struct clk *clk, int enable)
__raw_writel(clken, W90X900_VA_CLKPWR); __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) void clks_register(struct clk_lookup *clks, size_t num)
{ {
int i; int i;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <asm/clkdev.h> #include <asm/clkdev.h>
void w90x900_clk_enable(struct clk *clk, int enable); 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); void clks_register(struct clk_lookup *clks, size_t num);
struct clk { struct clk {
...@@ -27,6 +28,13 @@ struct clk clk_##_name = { \ ...@@ -27,6 +28,13 @@ struct clk clk_##_name = { \
.cken = (1 << _ctrlbit), \ .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) \ #define DEF_CLKLOOK(_clk, _devname, _conname) \
{ \ { \
.clk = _clk, \ .clk = _clk, \
......
...@@ -57,9 +57,12 @@ static struct map_desc w90p910_iodesc[] __initdata = { ...@@ -57,9 +57,12 @@ static struct map_desc w90p910_iodesc[] __initdata = {
static DEFINE_CLK(lcd, 0); static DEFINE_CLK(lcd, 0);
static DEFINE_CLK(audio, 1); static DEFINE_CLK(audio, 1);
static DEFINE_CLK(fmi, 4); static DEFINE_CLK(fmi, 4);
static DEFINE_SUBCLK(ms, 0);
static DEFINE_SUBCLK(sd, 1);
static DEFINE_CLK(dmac, 5); static DEFINE_CLK(dmac, 5);
static DEFINE_CLK(atapi, 6); static DEFINE_CLK(atapi, 6);
static DEFINE_CLK(emc, 7); static DEFINE_CLK(emc, 7);
static DEFINE_SUBCLK(rmii, 2);
static DEFINE_CLK(usbd, 8); static DEFINE_CLK(usbd, 8);
static DEFINE_CLK(usbh, 9); static DEFINE_CLK(usbh, 9);
static DEFINE_CLK(g2d, 10);; static DEFINE_CLK(g2d, 10);;
...@@ -75,9 +78,12 @@ static struct clk_lookup w90p910_clkregs[] = { ...@@ -75,9 +78,12 @@ static struct clk_lookup w90p910_clkregs[] = {
DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL), DEF_CLKLOOK(&clk_lcd, "w90p910-lcd", NULL),
DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL), DEF_CLKLOOK(&clk_audio, "w90p910-audio", NULL),
DEF_CLKLOOK(&clk_fmi, "w90p910-fmi", 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_dmac, "w90p910-dmac", NULL),
DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL), DEF_CLKLOOK(&clk_atapi, "w90p910-atapi", NULL),
DEF_CLKLOOK(&clk_emc, "w90p910-emc", 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_usbd, "w90p910-usbd", NULL),
DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL), DEF_CLKLOOK(&clk_usbh, "w90p910-usbh", NULL),
DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL), DEF_CLKLOOK(&clk_g2d, "w90p910-g2d", NULL),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册