mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-17 01:26:57 +07:00
7c74c220e9
Before this commit sunxi_factors_register uses of_iomap(node, 0) to get the clk registers. The sun6i prcm has factor clocks, for which we want to use sunxi_factors_register, but of_iomap(node, 0) does not work for the prcm factor clocks, because the prcm uses the mfd framework, so the registers are not part of the dt-node, instead they are added to the platform_device, as platform_device resources. This commit makes getting the registers the callers duty, so that sunxi_factors_register can be used with mfd instantiated platform device too. While at it also add error checking to the of_iomap calls. This commit also drops the __init function from sunxi_factors_register since platform driver probe functions are not __init. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
45 lines
886 B
C
45 lines
886 B
C
#ifndef __MACH_SUNXI_CLK_FACTORS_H
|
|
#define __MACH_SUNXI_CLK_FACTORS_H
|
|
|
|
#include <linux/clk-provider.h>
|
|
#include <linux/clkdev.h>
|
|
#include <linux/spinlock.h>
|
|
|
|
#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;
|
|
u8 n_start;
|
|
};
|
|
|
|
struct factors_data {
|
|
int enable;
|
|
int mux;
|
|
int muxmask;
|
|
struct clk_factors_config *table;
|
|
void (*getter) (u32 *rate, u32 parent_rate, u8 *n, u8 *k, u8 *m, u8 *p);
|
|
const char *name;
|
|
};
|
|
|
|
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;
|
|
};
|
|
|
|
struct clk *sunxi_factors_register(struct device_node *node,
|
|
const struct factors_data *data,
|
|
spinlock_t *lock,
|
|
void __iomem *reg);
|
|
|
|
#endif
|