Skip to content
Snippets Groups Projects
Commit b108d8a0 authored by Patrice Chotard's avatar Patrice Chotard Committed by Marek Vasut
Browse files

clk: fix compilation errors for poplar platform


Move clk_release_all() prototype and definition inside
OF_CONTROL flag to avoid following compilation error for
poplar platform:

aarch64:  +   poplar
+drivers/usb/host/built-in.o: In function `ehci_usb_remove':
+drivers/usb/host/ehci-generic.c:159: undefined reference to `clk_release_all'
+drivers/usb/host/built-in.o: In function `ehci_usb_probe':
+drivers/usb/host/ehci-generic.c:133: undefined reference to `clk_release_all'
+make[1]: *** [u-boot] Error 139
+make: *** [sub-make] Error 2

Introduced by 4e542c4 clk: add clk_release_all()

Signed-off-by: default avatarPatrice Chotard <patrice.chotard@st.com>
parent d38a8ea1
No related branches found
No related tags found
No related merge requests found
...@@ -114,6 +114,30 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk) ...@@ -114,6 +114,30 @@ int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk)
return clk_get_by_index(dev, index, clk); return clk_get_by_index(dev, index, clk);
} }
int clk_release_all(struct clk *clk, int count)
{
int i, ret;
for (i = 0; i < count; i++) {
debug("%s(clk[%d]=%p)\n", __func__, i, &clk[i]);
/* check if clock has been previously requested */
if (!clk[i].dev)
continue;
ret = clk_disable(&clk[i]);
if (ret && ret != -ENOSYS)
return ret;
ret = clk_free(&clk[i]);
if (ret && ret != -ENOSYS)
return ret;
}
return 0;
}
#endif /* OF_CONTROL */ #endif /* OF_CONTROL */
int clk_request(struct udevice *dev, struct clk *clk) int clk_request(struct udevice *dev, struct clk *clk)
...@@ -190,29 +214,6 @@ int clk_disable(struct clk *clk) ...@@ -190,29 +214,6 @@ int clk_disable(struct clk *clk)
return ops->disable(clk); return ops->disable(clk);
} }
int clk_release_all(struct clk *clk, int count)
{
int i, ret;
for (i = 0; i < count; i++) {
debug("%s(clk[%d]=%p)\n", __func__, i, &clk[i]);
/* check if clock has been previously requested */
if (!clk[i].dev)
continue;
ret = clk_disable(&clk[i]);
if (ret && ret != -ENOSYS)
return ret;
ret = clk_free(&clk[i]);
if (ret && ret != -ENOSYS)
return ret;
}
return 0;
}
UCLASS_DRIVER(clk) = { UCLASS_DRIVER(clk) = {
.id = UCLASS_CLK, .id = UCLASS_CLK,
.name = "clk", .name = "clk",
......
...@@ -98,6 +98,21 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk); ...@@ -98,6 +98,21 @@ int clk_get_by_index(struct udevice *dev, int index, struct clk *clk);
* @return 0 if OK, or a negative error code. * @return 0 if OK, or a negative error code.
*/ */
int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk); int clk_get_by_name(struct udevice *dev, const char *name, struct clk *clk);
/**
* clk_release_all() - Disable (turn off)/Free an array of previously
* requested clocks.
*
* For each clock contained in the clock array, this function will check if
* clock has been previously requested and then will disable and free it.
*
* @clk: A clock struct array that was previously successfully
* requested by clk_request/get_by_*().
* @count Number of clock contained in the array
* @return zero on success, or -ve error code.
*/
int clk_release_all(struct clk *clk, int count);
#else #else
static inline int clk_get_by_index(struct udevice *dev, int index, static inline int clk_get_by_index(struct udevice *dev, int index,
struct clk *clk) struct clk *clk)
...@@ -110,6 +125,12 @@ static inline int clk_get_by_name(struct udevice *dev, const char *name, ...@@ -110,6 +125,12 @@ static inline int clk_get_by_name(struct udevice *dev, const char *name,
{ {
return -ENOSYS; return -ENOSYS;
} }
static inline int clk_release_all(struct clk *clk, int count)
{
return -ENOSYS;
}
#endif #endif
/** /**
...@@ -174,20 +195,6 @@ int clk_enable(struct clk *clk); ...@@ -174,20 +195,6 @@ int clk_enable(struct clk *clk);
*/ */
int clk_disable(struct clk *clk); int clk_disable(struct clk *clk);
/**
* clk_release_all() - Disable (turn off)/Free an array of previously
* requested clocks.
*
* For each clock contained in the clock array, this function will check if
* clock has been previously requested and then will disable and free it.
*
* @clk: A clock struct array that was previously successfully
* requested by clk_request/get_by_*().
* @count Number of clock contained in the array
* @return zero on success, or -ve error code.
*/
int clk_release_all(struct clk *clk, int count);
int soc_clk_dump(void); int soc_clk_dump(void);
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment