* @return: 0 if OK, or a negative error code.
*/
int sandbox_clk_test_disable_bulk(struct udevice *dev);
-/**
- * sandbox_clk_test_free - Ask the sandbox clock test device to free its
- * clocks.
- *
- * @dev: The sandbox clock test (client) device.
- * @return: 0 if OK, or a negative error code.
- */
-int sandbox_clk_test_free(struct udevice *dev);
/**
* sandbox_clk_test_release_bulk - Ask the sandbox clock test device to release
* all clocks in it's clock bulk struct.
return ops->request(clk);
}
-void clk_free(struct clk *clk)
-{
- const struct clk_ops *ops;
-
- debug("%s(clk=%p)\n", __func__, clk);
- if (!clk_valid(clk))
- return;
- ops = clk_dev_ops(clk->dev);
-
- if (ops->rfree)
- ops->rfree(clk);
- return;
-}
-
ulong clk_get_rate(struct clk *clk)
{
const struct clk_ops *ops;
return 0;
}
-static void sandbox_clk_free(struct clk *clk)
-{
- struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
-
- if (clk->id >= SANDBOX_CLK_ID_COUNT)
- return;
-
- priv->requested[clk->id] = false;
- return;
-}
-
static struct clk_ops sandbox_clk_ops = {
.round_rate = sandbox_clk_round_rate,
.get_rate = sandbox_clk_get_rate,
.enable = sandbox_clk_enable,
.disable = sandbox_clk_disable,
.request = sandbox_clk_request,
- .rfree = sandbox_clk_free,
};
static int sandbox_clk_probe(struct udevice *dev)
return clk_disable_bulk(&sbct->bulk);
}
-int sandbox_clk_test_free(struct udevice *dev)
-{
- struct sandbox_clk_test *sbct = dev_get_priv(dev);
- int i;
-
- devm_clk_put(dev, sbct->clkps[SANDBOX_CLK_TEST_ID_DEVM1]);
- for (i = 0; i < SANDBOX_CLK_TEST_NON_DEVM_COUNT; i++)
- clk_free(&sbct->clks[i]);
-
- return 0;
-}
-
int sandbox_clk_test_release_bulk(struct udevice *dev)
{
struct sandbox_clk_test *sbct = dev_get_priv(dev);
* struct clk_ops - The functions that a clock driver must implement.
* @of_xlate: Translate a client's device-tree (OF) clock specifier.
* @request: Request a translated clock.
- * @rfree: Free a previously requested clock.
* @round_rate: Adjust a rate to the exact rate a clock can provide.
* @get_rate: Get current clock rate.
* @set_rate: Set current clock rate.
int (*of_xlate)(struct clk *clock,
struct ofnode_phandle_args *args);
int (*request)(struct clk *clock);
- void (*rfree)(struct clk *clock);
ulong (*round_rate)(struct clk *clk, ulong rate);
ulong (*get_rate)(struct clk *clk);
ulong (*set_rate)(struct clk *clk, ulong rate);
*/
int request(struct clk *clock);
-/**
- * rfree() - Free a previously requested clock.
- * @clock: The clock to free.
- *
- * Free any resources allocated in request().
- */
-void rfree(struct clk *clock);
-
/**
* round_rate() - Adjust a rate to the exact rate a clock can provide.
* @clk: The clock to manipulate.
return clk_release_all(bulk->clks, bulk->count);
}
+static inline void clk_free(struct clk *clk)
+{
+}
+
#if CONFIG_IS_ENABLED(CLK)
/**
* clk_request() - Request a clock by provider-specific ID.
*/
int clk_request(struct udevice *dev, struct clk *clk);
-/**
- * clk_free() - Free a previously requested clock.
- * @clk: A clock struct that was previously successfully requested by
- * clk_request/get_by_*().
- *
- * Free resources allocated by clk_request() (or any clk_get_* function).
- */
-void clk_free(struct clk *clk);
-
/**
* clk_get_rate() - Get current clock rate.
* @clk: A clock struct that was previously successfully requested by
return -ENOSYS;
}
-static inline void clk_free(struct clk *clk)
-{
- return;
-}
-
static inline ulong clk_get_rate(struct clk *clk)
{
return -ENOSYS;
SANDBOX_CLK_ID_I2C));
ut_asserteq(1, sandbox_clk_query_requested(dev_clk,
SANDBOX_CLK_ID_UART2));
- ut_assertok(sandbox_clk_test_free(dev_test));
- ut_asserteq(0, sandbox_clk_query_requested(dev_clk,
- SANDBOX_CLK_ID_SPI));
- ut_asserteq(0, sandbox_clk_query_requested(dev_clk,
- SANDBOX_CLK_ID_I2C));
- ut_asserteq(0, sandbox_clk_query_requested(dev_clk,
- SANDBOX_CLK_ID_UART2));
ut_asserteq(1, sandbox_clk_query_requested(dev_clk,
SANDBOX_CLK_ID_UART1));
ut_assertok(device_remove(dev_test, DM_REMOVE_NORMAL));
- ut_asserteq(0, sandbox_clk_query_requested(dev_clk,
- SANDBOX_CLK_ID_UART1));
return 0;
}
DM_TEST(dm_test_clk, UT_TESTF_SCAN_FDT);