mirror of
https://xff.cz/git/u-boot/
synced 2025-10-01 15:31:27 +02:00
clk: fixed-rate: Export driver parts for OF_PLATDATA_INST
We need to allow SoCs to create their own drivers for this so that they can use their own of-platdata structs. To minimise code duplication, export the driver operations and the ofdata_to_plat() setup function. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -25,18 +25,24 @@ const struct clk_ops clk_fixed_rate_ops = {
|
|||||||
.enable = dummy_enable,
|
.enable = dummy_enable,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int clk_fixed_rate_of_to_plat(struct udevice *dev)
|
void clk_fixed_rate_ofdata_to_plat_(struct udevice *dev,
|
||||||
|
struct clk_fixed_rate *plat)
|
||||||
{
|
{
|
||||||
struct clk *clk = &to_clk_fixed_rate(dev)->clk;
|
struct clk *clk = &plat->clk;
|
||||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||||
to_clk_fixed_rate(dev)->fixed_rate =
|
plat->fixed_rate = dev_read_u32_default(dev, "clock-frequency", 0);
|
||||||
dev_read_u32_default(dev, "clock-frequency", 0);
|
|
||||||
#endif
|
#endif
|
||||||
/* Make fixed rate clock accessible from higher level struct clk */
|
/* Make fixed rate clock accessible from higher level struct clk */
|
||||||
/* FIXME: This is not allowed */
|
/* FIXME: This is not allowed */
|
||||||
dev_set_uclass_priv(dev, clk);
|
dev_set_uclass_priv(dev, clk);
|
||||||
|
|
||||||
clk->dev = dev;
|
clk->dev = dev;
|
||||||
clk->enable_count = 0;
|
clk->enable_count = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int clk_fixed_rate_of_to_plat(struct udevice *dev)
|
||||||
|
{
|
||||||
|
clk_fixed_rate_ofdata_to_plat_(dev, to_clk_fixed_rate(dev));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -192,6 +192,8 @@ struct clk_fixed_factor {
|
|||||||
unsigned int div;
|
unsigned int div;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const struct clk_ops clk_fixed_rate_ops;
|
||||||
|
|
||||||
#define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\
|
#define to_clk_fixed_factor(_clk) container_of(_clk, struct clk_fixed_factor,\
|
||||||
clk)
|
clk)
|
||||||
|
|
||||||
@@ -202,6 +204,9 @@ struct clk_fixed_rate {
|
|||||||
|
|
||||||
#define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_plat(dev))
|
#define to_clk_fixed_rate(dev) ((struct clk_fixed_rate *)dev_get_plat(dev))
|
||||||
|
|
||||||
|
void clk_fixed_rate_ofdata_to_plat_(struct udevice *dev,
|
||||||
|
struct clk_fixed_rate *plat);
|
||||||
|
|
||||||
struct clk_composite {
|
struct clk_composite {
|
||||||
struct clk clk;
|
struct clk clk;
|
||||||
struct clk_ops ops;
|
struct clk_ops ops;
|
||||||
|
Reference in New Issue
Block a user