-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[POWERPC] clk.h interface for platforms
This provides an implementation of the <linux/clk.h> interface for arch/powerpc using a set of function pointers in clk_functions. Platforms that want to support this interface should fill clk_functions and select CONFIG_PPC_CLOCK in Kconfig. Signed-off-by: Domen Puncer <domen.puncer@telargo.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
- Loading branch information
Domen Puncer
authored and
Paul Mackerras
committed
Oct 2, 2007
1 parent
21ccdd3
commit 6f66828
Showing
5 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -663,3 +663,7 @@ config KEYS_COMPAT | |
default y | ||
|
||
source "crypto/Kconfig" | ||
|
||
config PPC_CLOCK | ||
bool | ||
default n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Dummy clk implementations for powerpc. | ||
* These need to be overridden in platform code. | ||
*/ | ||
|
||
#include <linux/clk.h> | ||
#include <linux/err.h> | ||
#include <linux/errno.h> | ||
#include <linux/module.h> | ||
#include <asm/clk_interface.h> | ||
|
||
struct clk_interface clk_functions; | ||
|
||
struct clk *clk_get(struct device *dev, const char *id) | ||
{ | ||
if (clk_functions.clk_get) | ||
return clk_functions.clk_get(dev, id); | ||
return ERR_PTR(-ENOSYS); | ||
} | ||
EXPORT_SYMBOL(clk_get); | ||
|
||
void clk_put(struct clk *clk) | ||
{ | ||
if (clk_functions.clk_put) | ||
clk_functions.clk_put(clk); | ||
} | ||
EXPORT_SYMBOL(clk_put); | ||
|
||
int clk_enable(struct clk *clk) | ||
{ | ||
if (clk_functions.clk_enable) | ||
return clk_functions.clk_enable(clk); | ||
return -ENOSYS; | ||
} | ||
EXPORT_SYMBOL(clk_enable); | ||
|
||
void clk_disable(struct clk *clk) | ||
{ | ||
if (clk_functions.clk_disable) | ||
clk_functions.clk_disable(clk); | ||
} | ||
EXPORT_SYMBOL(clk_disable); | ||
|
||
unsigned long clk_get_rate(struct clk *clk) | ||
{ | ||
if (clk_functions.clk_get_rate) | ||
return clk_functions.clk_get_rate(clk); | ||
return 0; | ||
} | ||
EXPORT_SYMBOL(clk_get_rate); | ||
|
||
long clk_round_rate(struct clk *clk, unsigned long rate) | ||
{ | ||
if (clk_functions.clk_round_rate) | ||
return clk_functions.clk_round_rate(clk, rate); | ||
return -ENOSYS; | ||
} | ||
EXPORT_SYMBOL(clk_round_rate); | ||
|
||
int clk_set_rate(struct clk *clk, unsigned long rate) | ||
{ | ||
if (clk_functions.clk_set_rate) | ||
return clk_functions.clk_set_rate(clk, rate); | ||
return -ENOSYS; | ||
} | ||
EXPORT_SYMBOL(clk_set_rate); | ||
|
||
struct clk *clk_get_parent(struct clk *clk) | ||
{ | ||
if (clk_functions.clk_get_parent) | ||
return clk_functions.clk_get_parent(clk); | ||
return ERR_PTR(-ENOSYS); | ||
} | ||
EXPORT_SYMBOL(clk_get_parent); | ||
|
||
int clk_set_parent(struct clk *clk, struct clk *parent) | ||
{ | ||
if (clk_functions.clk_set_parent) | ||
return clk_functions.clk_set_parent(clk, parent); | ||
return -ENOSYS; | ||
} | ||
EXPORT_SYMBOL(clk_set_parent); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
config PPC_MPC52xx | ||
bool | ||
select FSL_SOC | ||
select PPC_CLOCK | ||
default n | ||
|
||
config PPC_MPC5200 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef __ASM_POWERPC_CLK_INTERFACE_H | ||
#define __ASM_POWERPC_CLK_INTERFACE_H | ||
|
||
#include <linux/clk.h> | ||
|
||
struct clk_interface { | ||
struct clk* (*clk_get) (struct device *dev, const char *id); | ||
int (*clk_enable) (struct clk *clk); | ||
void (*clk_disable) (struct clk *clk); | ||
unsigned long (*clk_get_rate) (struct clk *clk); | ||
void (*clk_put) (struct clk *clk); | ||
long (*clk_round_rate) (struct clk *clk, unsigned long rate); | ||
int (*clk_set_rate) (struct clk *clk, unsigned long rate); | ||
int (*clk_set_parent) (struct clk *clk, struct clk *parent); | ||
struct clk* (*clk_get_parent) (struct clk *clk); | ||
}; | ||
|
||
extern struct clk_interface clk_functions; | ||
|
||
#endif /* __ASM_POWERPC_CLK_INTERFACE_H */ |