mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
omap-gpio: remove PROP_PTR
Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. Move/adapt the existing TODO comment about a clock framework. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
0fd20c532f
commit
ba2aba8370
4 changed files with 52 additions and 38 deletions
|
@ -40,10 +40,6 @@ struct omap_gpio_s {
|
|||
uint16_t pins;
|
||||
};
|
||||
|
||||
#define TYPE_OMAP1_GPIO "omap-gpio"
|
||||
#define OMAP1_GPIO(obj) \
|
||||
OBJECT_CHECK(struct omap_gpif_s, (obj), TYPE_OMAP1_GPIO)
|
||||
|
||||
struct omap_gpif_s {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
|
@ -212,10 +208,6 @@ struct omap2_gpio_s {
|
|||
uint8_t delay;
|
||||
};
|
||||
|
||||
#define TYPE_OMAP2_GPIO "omap2-gpio"
|
||||
#define OMAP2_GPIO(obj) \
|
||||
OBJECT_CHECK(struct omap2_gpif_s, (obj), TYPE_OMAP2_GPIO)
|
||||
|
||||
struct omap2_gpif_s {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
|
@ -747,21 +739,13 @@ static void omap2_gpio_realize(DeviceState *dev, Error **errp)
|
|||
}
|
||||
}
|
||||
|
||||
/* Using qdev pointer properties for the clocks is not ideal.
|
||||
* qdev should support a generic means of defining a 'port' with
|
||||
* an arbitrary interface for connecting two devices. Then we
|
||||
* could reframe the omap clock API in terms of clock ports,
|
||||
* and get some type safety. For now the best qdev provides is
|
||||
* passing an arbitrary pointer.
|
||||
* (It's not possible to pass in the string which is the clock
|
||||
* name, because this device does not have the necessary information
|
||||
* (ie the struct omap_mpu_state_s*) to do the clockname to pointer
|
||||
* translation.)
|
||||
*/
|
||||
void omap_gpio_set_clk(omap_gpif *gpio, omap_clk clk)
|
||||
{
|
||||
gpio->clk = clk;
|
||||
}
|
||||
|
||||
static Property omap_gpio_properties[] = {
|
||||
DEFINE_PROP_INT32("mpu_model", struct omap_gpif_s, mpu_model, 0),
|
||||
DEFINE_PROP_PTR("clk", struct omap_gpif_s, clk),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
@ -784,15 +768,19 @@ static const TypeInfo omap_gpio_info = {
|
|||
.class_init = omap_gpio_class_init,
|
||||
};
|
||||
|
||||
void omap2_gpio_set_iclk(omap2_gpif *gpio, omap_clk clk)
|
||||
{
|
||||
gpio->iclk = clk;
|
||||
}
|
||||
|
||||
void omap2_gpio_set_fclk(omap2_gpif *gpio, uint8_t i, omap_clk clk)
|
||||
{
|
||||
assert(i <= 5);
|
||||
gpio->fclk[i] = clk;
|
||||
}
|
||||
|
||||
static Property omap2_gpio_properties[] = {
|
||||
DEFINE_PROP_INT32("mpu_model", struct omap2_gpif_s, mpu_model, 0),
|
||||
DEFINE_PROP_PTR("iclk", struct omap2_gpif_s, iclk),
|
||||
DEFINE_PROP_PTR("fclk0", struct omap2_gpif_s, fclk[0]),
|
||||
DEFINE_PROP_PTR("fclk1", struct omap2_gpif_s, fclk[1]),
|
||||
DEFINE_PROP_PTR("fclk2", struct omap2_gpif_s, fclk[2]),
|
||||
DEFINE_PROP_PTR("fclk3", struct omap2_gpif_s, fclk[3]),
|
||||
DEFINE_PROP_PTR("fclk4", struct omap2_gpif_s, fclk[4]),
|
||||
DEFINE_PROP_PTR("fclk5", struct omap2_gpif_s, fclk[5]),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue