2013-02-25 22:44:26 +08:00
|
|
|
#ifndef __MACH_SUNXI_CLK_FACTORS_H
|
|
|
|
#define __MACH_SUNXI_CLK_FACTORS_H
|
|
|
|
|
|
|
|
#include <linux/clk-provider.h>
|
|
|
|
#include <linux/clkdev.h>
|
2014-07-05 04:24:52 +08:00
|
|
|
#include <linux/spinlock.h>
|
2013-02-25 22:44:26 +08:00
|
|
|
|
|
|
|
#define SUNXI_FACTORS_NOT_APPLICABLE (0)
|
|
|
|
|
|
|
|
struct clk_factors_config {
|
|
|
|
u8 nshift;
|
|
|
|
u8 nwidth;
|
|
|
|
u8 kshift;
|
|
|
|
u8 kwidth;
|
|
|
|
u8 mshift;
|
|
|
|
u8 mwidth;
|
|
|
|
u8 pshift;
|
|
|
|
u8 pwidth;
|
2014-06-26 23:55:41 +08:00
|
|
|
u8 n_start;
|
2013-02-25 22:44:26 +08:00
|
|
|
};
|
|
|
|
|
2014-07-05 04:24:52 +08:00
|
|
|
struct factors_data {
|
|
|
|
int enable;
|
|
|
|
int mux;
|
2014-10-20 22:10:26 +08:00
|
|
|
int muxmask;
|
2014-07-05 04:24:52 +08:00
|
|
|
struct clk_factors_config *table;
|
|
|
|
void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
|
|
|
|
const char *name;
|
|
|
|
};
|
|
|
|
|
2013-12-23 11:32:32 +08:00
|
|
|
struct clk_factors {
|
|
|
|
struct clk_hw hw;
|
|
|
|
void __iomem *reg;
|
|
|
|
struct clk_factors_config *config;
|
|
|
|
void (*get_factors) (u32 *rate, u32 parent, u8 *n, u8 *k, u8 *m, u8 *p);
|
|
|
|
spinlock_t *lock;
|
|
|
|
};
|
|
|
|
|
2014-11-23 21:38:07 +08:00
|
|
|
struct clk *sunxi_factors_register(struct device_node *node,
|
|
|
|
const struct factors_data *data,
|
|
|
|
spinlock_t *lock,
|
|
|
|
void __iomem *reg);
|
2014-07-05 04:24:52 +08:00
|
|
|
|
2013-02-25 22:44:26 +08:00
|
|
|
#endif
|