#include <asm/clk.h>
struct sandbox_clk_priv {
+ bool probed;
ulong rate[SANDBOX_CLK_ID_COUNT];
bool enabled[SANDBOX_CLK_ID_COUNT];
bool requested[SANDBOX_CLK_ID_COUNT];
{
struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
+ if (!priv->probed)
+ return -ENODEV;
+
if (clk->id >= SANDBOX_CLK_ID_COUNT)
return -EINVAL;
struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
ulong old_rate;
+ if (!priv->probed)
+ return -ENODEV;
+
if (clk->id >= SANDBOX_CLK_ID_COUNT)
return -EINVAL;
{
struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
+ if (!priv->probed)
+ return -ENODEV;
+
if (clk->id >= SANDBOX_CLK_ID_COUNT)
return -EINVAL;
{
struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
+ if (!priv->probed)
+ return -ENODEV;
+
if (clk->id >= SANDBOX_CLK_ID_COUNT)
return -EINVAL;
.free = sandbox_clk_free,
};
+static int sandbox_clk_probe(struct udevice *dev)
+{
+ struct sandbox_clk_priv *priv = dev_get_priv(dev);
+
+ priv->probed = true;
+ return 0;
+}
+
static const struct udevice_id sandbox_clk_ids[] = {
{ .compatible = "sandbox,clk" },
{ }
.id = UCLASS_CLK,
.of_match = sandbox_clk_ids,
.ops = &sandbox_clk_ops,
+ .probe = sandbox_clk_probe,
.priv_auto_alloc_size = sizeof(struct sandbox_clk_priv),
};
SANDBOX_CLK_TEST_ID_SPI));
ut_asserteq(0, sandbox_clk_test_get_rate(dev_test,
SANDBOX_CLK_TEST_ID_I2C));
- ut_asserteq(0, sandbox_clk_test_get_rate(dev_test,
- SANDBOX_CLK_TEST_ID_DEVM1));
+ ut_asserteq(321, sandbox_clk_test_get_rate(dev_test,
+ SANDBOX_CLK_TEST_ID_DEVM1));
ut_asserteq(0, sandbox_clk_test_get_rate(dev_test,
SANDBOX_CLK_TEST_ID_DEVM2));