mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-12 14:23:00 +00:00
135aa95002
The following changes are made to the clock API: * The concept of "clocks" and "peripheral clocks" are unified; each clock provider now implements a single set of clocks. This provides a simpler conceptual interface to clients, and better aligns with device tree clock bindings. * Clocks are now identified with a single "struct clk", rather than requiring clients to store the clock provider device and clock identity values separately. For simple clock consumers, this isolates clients from internal details of the clock API. * clk.h is split so it only contains the client/consumer API, whereas clk-uclass.h contains the provider API. This aligns with the recently added reset and mailbox APIs. * clk_ops .of_xlate(), .request(), and .free() are added so providers can customize these operations if needed. This also aligns with the recently added reset and mailbox APIs. * clk_disable() is added. * All users of the current clock APIs are updated. * Sandbox clock tests are updated to exercise clock lookup via DT, and clock enable/disable. * rkclk_get_clk() is removed and replaced with standard APIs. Buildman shows no clock-related errors for any board for which buildman can download a toolchain. test/py passes for sandbox (which invokes the dm clk test amongst others). Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Simon Glass <sjg@chromium.org>
111 lines
2.9 KiB
C
111 lines
2.9 KiB
C
/*
|
|
* Copyright (c) 2016, NVIDIA CORPORATION.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0
|
|
*/
|
|
|
|
#ifndef __SANDBOX_CLK_H
|
|
#define __SANDBOX_CLK_H
|
|
|
|
#include <common.h>
|
|
|
|
struct udevice;
|
|
|
|
/**
|
|
* enum sandbox_clk_id - Identity of clocks implemented by the sandbox clock
|
|
* provider.
|
|
*
|
|
* These IDs are within/relative-to the clock provider.
|
|
*/
|
|
enum sandbox_clk_id {
|
|
SANDBOX_CLK_ID_SPI,
|
|
SANDBOX_CLK_ID_I2C,
|
|
|
|
SANDBOX_CLK_ID_COUNT,
|
|
};
|
|
|
|
/**
|
|
* enum sandbox_clk_test_id - Identity of the clocks consumed by the sandbox
|
|
* clock test device.
|
|
*
|
|
* These are the IDs the clock consumer knows the clocks as.
|
|
*/
|
|
enum sandbox_clk_test_id {
|
|
SANDBOX_CLK_TEST_ID_FIXED,
|
|
SANDBOX_CLK_TEST_ID_SPI,
|
|
SANDBOX_CLK_TEST_ID_I2C,
|
|
|
|
SANDBOX_CLK_TEST_ID_COUNT,
|
|
};
|
|
|
|
/**
|
|
* sandbox_clk_query_rate - Query the current rate of a sandbox clock.
|
|
*
|
|
* @dev: The sandbox clock provider device.
|
|
* @id: The clock to query.
|
|
* @return: The rate of the clock.
|
|
*/
|
|
ulong sandbox_clk_query_rate(struct udevice *dev, int id);
|
|
/**
|
|
* sandbox_clk_query_enable - Query the enable state of a sandbox clock.
|
|
*
|
|
* @dev: The sandbox clock provider device.
|
|
* @id: The clock to query.
|
|
* @return: The rate of the clock.
|
|
*/
|
|
int sandbox_clk_query_enable(struct udevice *dev, int id);
|
|
|
|
/**
|
|
* sandbox_clk_test_get - Ask the sandbox clock test device to request its
|
|
* clocks.
|
|
*
|
|
* @dev: The sandbox clock test (client) devivce.
|
|
* @return: 0 if OK, or a negative error code.
|
|
*/
|
|
int sandbox_clk_test_get(struct udevice *dev);
|
|
/**
|
|
* sandbox_clk_test_get_rate - Ask the sandbox clock test device to query a
|
|
* clock's rate.
|
|
*
|
|
* @dev: The sandbox clock test (client) devivce.
|
|
* @id: The test device's clock ID to query.
|
|
* @return: The rate of the clock.
|
|
*/
|
|
ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
|
|
/**
|
|
* sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
|
|
* clock's rate.
|
|
*
|
|
* @dev: The sandbox clock test (client) devivce.
|
|
* @id: The test device's clock ID to configure.
|
|
* @return: The new rate of the clock.
|
|
*/
|
|
ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate);
|
|
/**
|
|
* sandbox_clk_test_enable - Ask the sandbox clock test device to enable a
|
|
* clock.
|
|
*
|
|
* @dev: The sandbox clock test (client) devivce.
|
|
* @id: The test device's clock ID to configure.
|
|
* @return: 0 if OK, or a negative error code.
|
|
*/
|
|
int sandbox_clk_test_enable(struct udevice *dev, int id);
|
|
/**
|
|
* sandbox_clk_test_disable - Ask the sandbox clock test device to disable a
|
|
* clock.
|
|
*
|
|
* @dev: The sandbox clock test (client) devivce.
|
|
* @id: The test device's clock ID to configure.
|
|
* @return: 0 if OK, or a negative error code.
|
|
*/
|
|
int sandbox_clk_test_disable(struct udevice *dev, int id);
|
|
/**
|
|
* sandbox_clk_test_free - Ask the sandbox clock test device to free its
|
|
* clocks.
|
|
*
|
|
* @dev: The sandbox clock test (client) devivce.
|
|
* @return: 0 if OK, or a negative error code.
|
|
*/
|
|
int sandbox_clk_test_free(struct udevice *dev);
|
|
|
|
#endif
|