mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-03 04:26:45 +00:00
parent
394a495b55
commit
4d1e75ce3b
@ -15,8 +15,21 @@
|
|||||||
#include <lx_kit/env.h>
|
#include <lx_kit/env.h>
|
||||||
#include <lx_emul/clock.h>
|
#include <lx_emul/clock.h>
|
||||||
|
|
||||||
extern "C" int of_device_is_compatible(const struct device_node * node,
|
/*
|
||||||
const char * compat);
|
* CONFIG_OF is normally disabled on PC thus of_device_is_compatible() should
|
||||||
|
* be "static inline" not "extern" (see include/linux/of.h), thus enable this
|
||||||
|
* function only if not building for x86.
|
||||||
|
*/
|
||||||
|
extern "C" int of_device_is_compatible(const struct device_node * node, const char * compat);
|
||||||
|
static int _of_device_is_compatible(const struct device_node * node, const char * compat)
|
||||||
|
{
|
||||||
|
#if defined(__x86_64__) || defined(__i386__)
|
||||||
|
(void)node; (void)compat;
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
return of_device_is_compatible(node, compat);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
struct clk * lx_emul_clock_get(const struct device_node * node,
|
struct clk * lx_emul_clock_get(const struct device_node * node,
|
||||||
const char * name)
|
const char * name)
|
||||||
@ -26,7 +39,7 @@ struct clk * lx_emul_clock_get(const struct device_node * node,
|
|||||||
struct clk * ret = nullptr;
|
struct clk * ret = nullptr;
|
||||||
|
|
||||||
env().devices.for_each([&] (Device & d) {
|
env().devices.for_each([&] (Device & d) {
|
||||||
if (!of_device_is_compatible(node, d.compatible()))
|
if (!_of_device_is_compatible(node, d.compatible()))
|
||||||
return;
|
return;
|
||||||
ret = name ? d.clock(name) : d.clock(0U);
|
ret = name ? d.clock(name) : d.clock(0U);
|
||||||
if (!ret) warning("No clock ", name, " found for device ", d.name());
|
if (!ret) warning("No clock ", name, " found for device ", d.name());
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* \brief Replaces drivers/clk/clk-devres.c
|
||||||
|
* \author Christian Helmuth
|
||||||
|
* \date 2023-06-13
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2023 Genode Labs GmbH
|
||||||
|
*
|
||||||
|
* This file is distributed under the terms of the GNU General Public License
|
||||||
|
* version 2.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <linux/clk.h>
|
||||||
|
|
||||||
|
|
||||||
|
struct clk *devm_clk_get(struct device *dev, const char *id)
|
||||||
|
{
|
||||||
|
return clk_get(dev, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct clk *devm_clk_get_optional(struct device *dev,const char *id)
|
||||||
|
{
|
||||||
|
return devm_clk_get(dev, id);
|
||||||
|
}
|
@ -52,3 +52,8 @@ struct of_device_id;
|
|||||||
|
|
||||||
void of_clk_init(const struct of_device_id *matches) { }
|
void of_clk_init(const struct of_device_id *matches) { }
|
||||||
|
|
||||||
|
|
||||||
|
const char *__clk_get_name(const struct clk *clk)
|
||||||
|
{
|
||||||
|
return "unknown-clk";
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user