clk: Drop dm.h header file in clk-provider.h

This header file should not be included in other header files. Remove it
and use a forward declaration and un-inlining of dev_get_clk_ptr()
instead.

Fix up the kendryte header files to avoid build errors.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
Simon Glass 2020-07-19 10:15:56 -06:00 committed by Tom Rini
parent 161786259c
commit fb989e0c6c
5 changed files with 20 additions and 12 deletions

View File

@ -25,6 +25,11 @@ static inline const struct clk_ops *clk_dev_ops(struct udevice *dev)
return (const struct clk_ops *)dev->driver->ops; return (const struct clk_ops *)dev->driver->ops;
} }
struct clk *dev_get_clk_ptr(struct udevice *dev)
{
return (struct clk *)dev_get_uclass_priv(dev);
}
#if CONFIG_IS_ENABLED(OF_CONTROL) #if CONFIG_IS_ENABLED(OF_CONTROL)
# if CONFIG_IS_ENABLED(OF_PLATDATA) # if CONFIG_IS_ENABLED(OF_PLATDATA)
int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells, int clk_get_by_driver_info(struct udevice *dev, struct phandle_1_arg *cells,

View File

@ -4,12 +4,15 @@
*/ */
#define LOG_CATEGORY UCLASS_CLK #define LOG_CATEGORY UCLASS_CLK
#include <kendryte/bypass.h>
#include <common.h>
#include <clk.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <dm.h>
#include <log.h>
#include <kendryte/bypass.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/err.h> #include <linux/err.h>
#include <log.h>
#define CLK_K210_BYPASS "k210_clk_bypass" #define CLK_K210_BYPASS "k210_clk_bypass"

View File

@ -3,18 +3,20 @@
* Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com> * Copyright (C) 2019-20 Sean Anderson <seanga2@gmail.com>
*/ */
#define LOG_CATEGORY UCLASS_CLK #define LOG_CATEGORY UCLASS_CLK
#include <kendryte/pll.h>
#include <asm/io.h> #include <common.h>
#include <dm.h>
/* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */ /* For DIV_ROUND_DOWN_ULL, defined in linux/kernel.h */
#include <div64.h> #include <div64.h>
#include <log.h>
#include <serial.h>
#include <asm/io.h>
#include <dt-bindings/clock/k210-sysctl.h> #include <dt-bindings/clock/k210-sysctl.h>
#include <kendryte/pll.h>
#include <linux/bitfield.h> #include <linux/bitfield.h>
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <log.h>
#include <serial.h>
#define CLK_K210_PLL "k210_clk_pll" #define CLK_K210_PLL "k210_clk_pll"

View File

@ -5,7 +5,7 @@
#ifndef K210_BYPASS_H #ifndef K210_BYPASS_H
#define K210_BYPASS_H #define K210_BYPASS_H
#include <clk.h> struct clk;
struct k210_bypass { struct k210_bypass {
struct clk clk; struct clk clk;

View File

@ -9,12 +9,13 @@
#ifndef __LINUX_CLK_PROVIDER_H #ifndef __LINUX_CLK_PROVIDER_H
#define __LINUX_CLK_PROVIDER_H #define __LINUX_CLK_PROVIDER_H
#include <dm.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/err.h> #include <linux/err.h>
#include <clk-uclass.h> #include <clk-uclass.h>
#include <linux/err.h> #include <linux/err.h>
struct udevice;
static inline void clk_dm(ulong id, struct clk *clk) static inline void clk_dm(ulong id, struct clk *clk)
{ {
if (!IS_ERR(clk)) if (!IS_ERR(clk))
@ -188,8 +189,5 @@ struct clk *clk_register_mux(struct device *dev, const char *name,
const char *clk_hw_get_name(const struct clk *hw); const char *clk_hw_get_name(const struct clk *hw);
ulong clk_generic_get_rate(struct clk *clk); ulong clk_generic_get_rate(struct clk *clk);
static inline struct clk *dev_get_clk_ptr(struct udevice *dev) struct clk *dev_get_clk_ptr(struct udevice *dev);
{
return (struct clk *)dev_get_uclass_priv(dev);
}
#endif /* __LINUX_CLK_PROVIDER_H */ #endif /* __LINUX_CLK_PROVIDER_H */