All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>
Subject: [PATCH v4 33/37] omap-i2c: remove PROP_PTR
Date: Wed, 20 Nov 2019 19:24:38 +0400	[thread overview]
Message-ID: <20191120152442.26657-34-marcandre.lureau@redhat.com> (raw)
In-Reply-To: <20191120152442.26657-1-marcandre.lureau@redhat.com>

Since clocks are not QOM objects, replace PROP_PTR of clocks with
setters methods.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 hw/arm/omap1.c        |  2 +-
 hw/arm/omap2.c        |  8 ++++----
 hw/i2c/omap_i2c.c     | 19 ++++++++++++-------
 include/hw/arm/omap.h | 13 +++++++++++++
 4 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
index 1afd1d3d7f..807e5f70d1 100644
--- a/hw/arm/omap1.c
+++ b/hw/arm/omap1.c
@@ -4030,7 +4030,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *dram,
 
     s->i2c[0] = qdev_create(NULL, "omap_i2c");
     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]);
     busdev = SYS_BUS_DEVICE(s->i2c[0]);
     sysbus_connect_irq(busdev, 0, qdev_get_gpio_in(s->ih[1], OMAP_INT_I2C));
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
index 1d7cc435ef..171e2d0472 100644
--- a/hw/arm/omap2.c
+++ b/hw/arm/omap2.c
@@ -2425,8 +2425,8 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sdram,
 
     s->i2c[0] = qdev_create(NULL, "omap_i2c");
     qdev_prop_set_uint8(s->i2c[0], "revision", 0x34);
-    qdev_prop_set_ptr(s->i2c[0], "iclk", omap_findclk(s, "i2c1.iclk"));
-    qdev_prop_set_ptr(s->i2c[0], "fclk", omap_findclk(s, "i2c1.fclk"));
+    omap_i2c_set_iclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.iclk"));
+    omap_i2c_set_fclk(OMAP_I2C(s->i2c[0]), omap_findclk(s, "i2c1.fclk"));
     qdev_init_nofail(s->i2c[0]);
     busdev = SYS_BUS_DEVICE(s->i2c[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");
     qdev_prop_set_uint8(s->i2c[1], "revision", 0x34);
-    qdev_prop_set_ptr(s->i2c[1], "iclk", omap_findclk(s, "i2c2.iclk"));
-    qdev_prop_set_ptr(s->i2c[1], "fclk", omap_findclk(s, "i2c2.fclk"));
+    omap_i2c_set_iclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.iclk"));
+    omap_i2c_set_fclk(OMAP_I2C(s->i2c[1]), omap_findclk(s, "i2c2.fclk"));
     qdev_init_nofail(s->i2c[1]);
     busdev = SYS_BUS_DEVICE(s->i2c[1]);
     sysbus_connect_irq(busdev, 0,
diff --git a/hw/i2c/omap_i2c.c b/hw/i2c/omap_i2c.c
index 3ba965a58f..3ccbd5cc2c 100644
--- a/hw/i2c/omap_i2c.c
+++ b/hw/i2c/omap_i2c.c
@@ -28,10 +28,7 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 
-#define TYPE_OMAP_I2C "omap_i2c"
-#define OMAP_I2C(obj) OBJECT_CHECK(OMAPI2CState, (obj), TYPE_OMAP_I2C)
-
-typedef struct OMAPI2CState {
+struct OMAPI2CState {
     SysBusDevice parent_obj;
 
     MemoryRegion iomem;
@@ -56,7 +53,7 @@ typedef struct OMAPI2CState {
     uint8_t divider;
     uint8_t times[2];
     uint16_t test;
-} OMAPI2CState;
+};
 
 #define OMAP2_INTR_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[] = {
     DEFINE_PROP_UINT8("revision", OMAPI2CState, revision, 0),
-    DEFINE_PROP_PTR("iclk", OMAPI2CState, iclk),
-    DEFINE_PROP_PTR("fclk", OMAPI2CState, fclk),
     DEFINE_PROP_END_OF_LIST(),
 };
 
diff --git a/include/hw/arm/omap.h b/include/hw/arm/omap.h
index bcecf19f89..39a295ba20 100644
--- a/include/hw/arm/omap.h
+++ b/include/hw/arm/omap.h
@@ -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_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 */
 struct omap_l4_s;
 struct omap_l4_region_s {
-- 
2.24.0



  parent reply	other threads:[~2019-11-20 15:51 UTC|newest]

Thread overview: 107+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-20 15:24 [PATCH v4 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 01/37] qdev: remove unused qdev_prop_int64 Marc-André Lureau
2019-12-02  5:22   ` Markus Armbruster
2019-12-02 10:29     ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 02/37] sysbus: remove unused sysbus_try_create* Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 03/37] sysbus: remove outdated comment Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 04/37] chardev: generate an internal id when none given Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 05/37] serial-pci-multi: factor out multi_serial_get_port_count() Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 06/37] serial: initial qom-ification Marc-André Lureau
2019-11-20 16:40   ` Philippe Mathieu-Daudé
2019-11-20 16:45     ` Marc-André Lureau
2019-11-21 13:39   ` Peter Maydell
2019-11-20 15:24 ` [PATCH v4 07/37] serial: register vmsd with DeviceClass Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 08/37] serial: add "chardev" property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 09/37] serial: add "baudbase" property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 10/37] serial: realize the serial device Marc-André Lureau
2019-11-20 16:12   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 11/37] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 12/37] serial: start making SerialMM a sysbus device Marc-André Lureau
2019-11-21 13:47   ` Peter Maydell
2019-11-21 18:15     ` Marc-André Lureau
2019-11-21 18:24       ` Peter Maydell
2019-11-21 18:51         ` Marc-André Lureau
2019-11-22 10:10           ` Peter Maydell
2019-11-22 12:02             ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 13/37] serial-mm: add "regshift" property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 14/37] serial-mm: add endianness property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 15/37] serial-mm: use sysbus facilities Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 16/37] serial: make SerialIO a sysbus device Marc-André Lureau
2019-11-20 16:18   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 17/37] mips: inline serial_init() Marc-André Lureau
2019-11-20 16:17   ` Philippe Mathieu-Daudé
2019-11-25 10:12   ` Aleksandar Markovic
2019-11-25 10:15     ` Marc-André Lureau
2019-11-25 13:33       ` Aleksandar Markovic
2019-11-25 19:13         ` Marc-André Lureau
2019-11-27 12:22   ` Aleksandar Markovic
2019-11-20 15:24 ` [PATCH v4 18/37] mips: baudbase is 115200 by default Marc-André Lureau
2019-11-21 13:39   ` Peter Maydell
2019-11-25 10:07   ` Aleksandar Markovic
2019-11-25 10:12     ` Marc-André Lureau
2019-11-25 11:26       ` Philippe Mathieu-Daudé
2019-11-25 12:22         ` Aleksandar Markovic
2019-11-25 12:54         ` Philippe Mathieu-Daudé
2019-11-25 13:03           ` Philippe Mathieu-Daudé
2019-11-27 12:07             ` Marc-André Lureau
2019-11-27 12:20               ` Aleksandar Markovic
2019-11-20 15:24 ` [PATCH v4 19/37] mips: use sysbus_add_io() Marc-André Lureau
2019-11-21 13:40   ` Peter Maydell
2019-11-27 12:28   ` Aleksandar Markovic
2019-12-15  5:40   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 20/37] mips: use sysbus_mmio_get_region() instead of internal fields Marc-André Lureau
2019-11-21 13:48   ` Peter Maydell
2019-11-27 12:23   ` Aleksandar Markovic
2019-12-15  5:39   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 21/37] sm501: make SerialMM a child, export chardev property Marc-André Lureau
2019-11-21 14:00   ` Peter Maydell
2019-11-25 19:47     ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 22/37] vmmouse: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 23/37] lance: " Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 24/37] etraxfs: remove PROP_PTR usage Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 25/37] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2019-11-20 22:58   ` Laurent Vivier
2019-11-20 15:24 ` [PATCH v4 26/37] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 27/37] leon3: use qdev gpio facilities for the PIL Marc-André Lureau
2019-11-21 13:51   ` Peter Maydell
2019-12-15  6:10     ` Philippe Mathieu-Daudé
2019-12-19 12:44       ` Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 28/37] qdev: use g_strcmp0() instead of open-coding it Marc-André Lureau
2019-11-20 16:25   ` Philippe Mathieu-Daudé
2019-11-20 17:10     ` Eduardo Habkost
2019-11-20 15:24 ` [PATCH v4 29/37] RFC: mips/cps: fix setting saar property Marc-André Lureau
2019-12-15  5:56   ` Philippe Mathieu-Daudé
2019-12-16 19:36     ` [EXTERNAL]Re: " Aleksandar Markovic
2019-12-19 13:04       ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 30/37] cris: improve passing PIC interrupt vector to the CPU Marc-André Lureau
2019-11-20 16:32   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 31/37] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2019-11-21 22:43   ` Corey Minyard
2019-11-29  9:06     ` Marc-André Lureau
2019-11-29 14:39       ` Corey Minyard
2019-11-22 11:07   ` Philippe Mathieu-Daudé
2019-11-22 11:12     ` Marc-André Lureau
2019-11-22 11:15       ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 32/37] omap-intc: " Marc-André Lureau
2019-12-15  5:42   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` Marc-André Lureau [this message]
2019-12-15  5:43   ` [PATCH v4 33/37] omap-i2c: " Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 34/37] omap-gpio: " Marc-André Lureau
2019-12-15  5:44   ` Philippe Mathieu-Daudé
2019-11-20 15:24 ` [PATCH v4 35/37] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 36/37] qdev: remove QDEV_PROP_PTR Marc-André Lureau
2019-11-20 15:24 ` [PATCH v4 37/37] qdev/qom: remove some TODO limitations now that PROP_PTR is gone Marc-André Lureau
2019-12-01 10:19 ` [PATCH v4 00/37] Clean-ups: qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2019-12-01 12:15   ` [PATCH v6 " Aleksandar Markovic
2019-12-01 15:35     ` Marc-André Lureau
2019-12-01 19:05       ` Aleksandar Markovic
2019-12-01 19:28         ` Aleksandar Markovic
2019-12-01 17:18   ` [PATCH v4 " Peter Maydell
2019-12-01 17:27     ` Marc-André Lureau
2019-12-01 18:10       ` Peter Maydell
2019-12-02 11:17         ` Marc-André Lureau
2019-12-12 20:17           ` Dr. David Alan Gilbert
2019-12-13 16:34             ` Marc-André Lureau
2019-12-11 12:01   ` Marc-André Lureau
2019-12-15  6:11     ` Philippe Mathieu-Daudé
2019-12-19 13:53     ` Marc-André Lureau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191120152442.26657-34-marcandre.lureau@redhat.com \
    --to=marcandre.lureau@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.