mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-17 23:22:12 -06:00
omap-i2c: remove PROP_PTR
Since clocks are not QOM objects, replace PROP_PTR of clocks with setters methods. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Corey Minyard <cminyard@mvista.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
This commit is contained in:
parent
bab592a259
commit
0fd20c532f
4 changed files with 30 additions and 12 deletions
|
@ -4030,7 +4030,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
|
||||||
|
|
||||||
s->i2c[0] = qdev_create(NULL, "omap_i2c");
|
s->i2c[0] = qdev_create(NULL, "omap_i2c");
|
||||||
qdev_prop_set_uint8(s->i2c[0], "revision", 0x11);
|
qdev_prop_set_uint8(s->i2c[0], "revision", 0x11);
|
||||||
qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "mpuper_ck"));
|
omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "mpuper_ck"));
|
||||||
qdev_init_nofail(s->i2c[0]);
|
qdev_init_nofail(s->i2c[0]);
|
||||||
busdev = SYS_BUS_DEVICE(s->i2c[0]);
|
busdev = SYS_BUS_DEVICE(s->i2c[0]);
|
||||||
sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C));
|
sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C));
|
||||||
|
|
|
@ -2425,8 +2425,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
|
||||||
|
|
||||||
s->i2c[0] = qdev_create(NULL, "omap_i2c");
|
s->i2c[0] = qdev_create(NULL, "omap_i2c");
|
||||||
qdev_prop_set_uint8(s->i2c[0], "revision", 0x34);
|
qdev_prop_set_uint8(s->i2c[0], "revision", 0x34);
|
||||||
qdev_prop_set_ptr(s->i2c[0], "iclk", omap_findclk(s, "i2c1.iclk"));
|
omap_i2c_set_iclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.iclk"));
|
||||||
qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "i2c1.fclk"));
|
omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.fclk"));
|
||||||
qdev_init_nofail(s->i2c[0]);
|
qdev_init_nofail(s->i2c[0]);
|
||||||
busdev = SYS_BUS_DEVICE(s->i2c[0]);
|
busdev = SYS_BUS_DEVICE(s->i2c[0]);
|
||||||
sysbus_connect_irq(busdev, 0,
|
sysbus_connect_irq(busdev, 0,
|
||||||
|
@ -2437,8 +2437,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
|
||||||
|
|
||||||
s->i2c[1] = qdev_create(NULL, "omap_i2c");
|
s->i2c[1] = qdev_create(NULL, "omap_i2c");
|
||||||
qdev_prop_set_uint8(s->i2c[1], "revision", 0x34);
|
qdev_prop_set_uint8(s->i2c[1], "revision", 0x34);
|
||||||
qdev_prop_set_ptr(s->i2c[1], "iclk", omap_findclk(s, "i2c2.iclk"));
|
omap_i2c_set_iclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.iclk"));
|
||||||
qdev_prop_set_ptr(s->i2c[1], "fclk", omap_findclk(s, "i2c2.fclk"));
|
omap_i2c_set_fclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.fclk"));
|
||||||
qdev_init_nofail(s->i2c[1]);
|
qdev_init_nofail(s->i2c[1]);
|
||||||
busdev = SYS_BUS_DEVICE(s->i2c[1]);
|
busdev = SYS_BUS_DEVICE(s->i2c[1]);
|
||||||
sysbus_connect_irq(busdev, 0,
|
sysbus_connect_irq(busdev, 0,
|
||||||
|
|
|
@ -28,10 +28,7 @@
|
||||||
#include "qemu/error-report.h"
|
#include "qemu/error-report.h"
|
||||||
#include "qapi/error.h"
|
#include "qapi/error.h"
|
||||||
|
|
||||||
#define TYPE_OMAP_I2C "omap_i2c"
|
struct OMAPI2CState {
|
||||||
#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
|
|
||||||
|
|
||||||
typedef struct OMAPI2CState {
|
|
||||||
SysBusDevice parent_obj;
|
SysBusDevice parent_obj;
|
||||||
|
|
||||||
MemoryRegion iomem;
|
MemoryRegion iomem;
|
||||||
|
@ -56,7 +53,7 @@ typedef struct OMAPI2CState {
|
||||||
uint8_t divider;
|
uint8_t divider;
|
||||||
uint8_t times[2];
|
uint8_t times[2];
|
||||||
uint16_t test;
|
uint16_t test;
|
||||||
} OMAPI2CState;
|
};
|
||||||
|
|
||||||
#define OMAP2_INTR_REV 0x34
|
#define OMAP2_INTR_REV 0x34
|
||||||
#define OMAP2_GC_REV 0x34
|
#define OMAP2_GC_REV 0x34
|
||||||
|
@ -504,10 +501,18 @@ static void omap_i2c_realize(DeviceState *dev, Error **errp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk)
|
||||||
|
{
|
||||||
|
i2c->iclk = clk;
|
||||||
|
}
|
||||||
|
|
||||||
|
void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk)
|
||||||
|
{
|
||||||
|
i2c->fclk = clk;
|
||||||
|
}
|
||||||
|
|
||||||
static Property omap_i2c_properties[] = {
|
static Property omap_i2c_properties[] = {
|
||||||
DEFINE_PROP_UINT8("revision", OMAPI2CState, revision, 0),
|
DEFINE_PROP_UINT8("revision", OMAPI2CState, revision, 0),
|
||||||
DEFINE_PROP_PTR("iclk", OMAPI2CState, iclk),
|
|
||||||
DEFINE_PROP_PTR("fclk", OMAPI2CState, fclk),
|
|
||||||
DEFINE_PROP_END_OF_LIST(),
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,19 @@ typedef struct omap_intr_handler_s omap_intr_handler;
|
||||||
void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk);
|
void omap_intc_set_iclk(omap_intr_handler *intc, omap_clk clk);
|
||||||
void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk);
|
void omap_intc_set_fclk(omap_intr_handler *intc, omap_clk clk);
|
||||||
|
|
||||||
|
/* omap_i2c.c */
|
||||||
|
#define TYPE_OMAP_I2C "omap_i2c"
|
||||||
|
#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
|
||||||
|
|
||||||
|
typedef struct OMAPI2CState OMAPI2CState;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TODO: Ideally we should have a clock framework that
|
||||||
|
* let us wire these clocks up with QOM properties or links.
|
||||||
|
*/
|
||||||
|
void omap_i2c_set_iclk(OMAPI2CState *i2c, omap_clk clk);
|
||||||
|
void omap_i2c_set_fclk(OMAPI2CState *i2c, omap_clk clk);
|
||||||
|
|
||||||
/* OMAP2 l4 Interconnect */
|
/* OMAP2 l4 Interconnect */
|
||||||
struct omap_l4_s;
|
struct omap_l4_s;
|
||||||
struct omap_l4_region_s {
|
struct omap_l4_region_s {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue