qdev: add clock input&output support to devices.

Add functions to easily handle clocks with devices.
Clock inputs and outputs should be used to handle clock propagation
between devices.
The API is very similar the GPIO API.

This is based on the original work of Frederic Konrad.

Signed-off-by: Damien Hedde <damien.hedde@greensocs.com>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200406135251.157596-4-damien.hedde@greensocs.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Damien Hedde 2020-04-06 15:52:45 +02:00 committed by Peter Maydell
parent b8d38bd525
commit 0e6934f264
6 changed files with 298 additions and 1 deletions

View file

@ -149,6 +149,17 @@ struct NamedGPIOList {
QLIST_ENTRY(NamedGPIOList) node;
};
typedef struct Clock Clock;
typedef struct NamedClockList NamedClockList;
struct NamedClockList {
char *name;
Clock *clock;
bool output;
bool alias;
QLIST_ENTRY(NamedClockList) node;
};
/**
* DeviceState:
* @realized: Indicates whether the device has been fully constructed.
@ -171,6 +182,7 @@ struct DeviceState {
bool allow_unplug_during_migration;
BusState *parent_bus;
QLIST_HEAD(, NamedGPIOList) gpios;
QLIST_HEAD(, NamedClockList) clocks;
QLIST_HEAD(, BusState) child_bus;
int num_child_bus;
int instance_id_alias;