All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Delevoryas <pdel@fb.com>
Cc: <pdel@fb.com>, <zhdaniel@fb.com>, <clg@kaod.org>,
	<qemu-devel@nongnu.org>,  <qemu-arm@nongnu.org>,
	<komlodi@google.com>, <titusr@google.com>, <andrew@aj.id.au>,
	<joel@jms.id.au>
Subject: [PATCH 10/14] pmbus: Add read-only IC_DEVICE_ID support
Date: Mon, 27 Jun 2022 12:55:02 -0700	[thread overview]
Message-ID: <20220627195506.403715-11-pdel@fb.com> (raw)
In-Reply-To: <20220627195506.403715-1-pdel@fb.com>

Signed-off-by: Peter Delevoryas <pdel@fb.com>
---
 hw/i2c/pmbus_device.c            |  5 +++++
 hw/sensor/isl_pmbus_vr.c         | 30 ++++++++++++++++++++++++++++++
 include/hw/i2c/pmbus_device.h    |  1 +
 include/hw/sensor/isl_pmbus_vr.h |  1 +
 4 files changed, 37 insertions(+)

diff --git a/hw/i2c/pmbus_device.c b/hw/i2c/pmbus_device.c
index efddc36fd9..82131fff85 100644
--- a/hw/i2c/pmbus_device.c
+++ b/hw/i2c/pmbus_device.c
@@ -984,6 +984,11 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd)
         }
         break;
 
+    case PMBUS_IC_DEVICE_ID:
+        pmbus_send(pmdev, pmdev->pages[index].ic_device_id,
+                   sizeof(pmdev->pages[index].ic_device_id));
+        break;
+
     case PMBUS_CLEAR_FAULTS:              /* Send Byte */
     case PMBUS_PAGE_PLUS_WRITE:           /* Block Write-only */
     case PMBUS_STORE_DEFAULT_ALL:         /* Send Byte */
diff --git a/hw/sensor/isl_pmbus_vr.c b/hw/sensor/isl_pmbus_vr.c
index e11e028884..b0d2f49e9d 100644
--- a/hw/sensor/isl_pmbus_vr.c
+++ b/hw/sensor/isl_pmbus_vr.c
@@ -218,6 +218,27 @@ static void isl_pmbus_vr_class_init(ObjectClass *klass, void *data,
     k->device_num_pages = pages;
 }
 
+static void isl69259_init(Object *obj)
+{
+    static const uint8_t ic_device_id[] = {0x04, 0x00, 0x81, 0xD2, 0x49};
+    PMBusDevice *pmdev = PMBUS_DEVICE(obj);
+    int i;
+
+    raa22xx_init(obj);
+    for (i = 0; i < pmdev->num_pages; i++) {
+        memcpy(pmdev->pages[i].ic_device_id, ic_device_id, sizeof(ic_device_id));
+    }
+}
+
+static void isl69259_class_init(ObjectClass *klass, void *data)
+{
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
+    DeviceClass *dc = DEVICE_CLASS(klass);
+    dc->desc = "Renesas ISL69259 Digital Multiphase Voltage Regulator";
+    rc->phases.exit = isl_pmbus_vr_exit_reset;
+    isl_pmbus_vr_class_init(klass, data, 2);
+}
+
 static void isl69260_class_init(ObjectClass *klass, void *data)
 {
     ResettableClass *rc = RESETTABLE_CLASS(klass);
@@ -245,6 +266,14 @@ static void raa229004_class_init(ObjectClass *klass, void *data)
     isl_pmbus_vr_class_init(klass, data, 2);
 }
 
+static const TypeInfo isl69259_info = {
+    .name = TYPE_ISL69259,
+    .parent = TYPE_PMBUS_DEVICE,
+    .instance_size = sizeof(ISLState),
+    .instance_init = isl69259_init,
+    .class_init = isl69259_class_init,
+};
+
 static const TypeInfo isl69260_info = {
     .name = TYPE_ISL69260,
     .parent = TYPE_PMBUS_DEVICE,
@@ -271,6 +300,7 @@ static const TypeInfo raa228000_info = {
 
 static void isl_pmbus_vr_register_types(void)
 {
+    type_register_static(&isl69259_info);
     type_register_static(&isl69260_info);
     type_register_static(&raa228000_info);
     type_register_static(&raa229004_info);
diff --git a/include/hw/i2c/pmbus_device.h b/include/hw/i2c/pmbus_device.h
index 0f4d6b3fad..aed7809841 100644
--- a/include/hw/i2c/pmbus_device.h
+++ b/include/hw/i2c/pmbus_device.h
@@ -407,6 +407,7 @@ typedef struct PMBusPage {
     uint16_t mfr_max_temp_1;           /* R/W word */
     uint16_t mfr_max_temp_2;           /* R/W word */
     uint16_t mfr_max_temp_3;           /* R/W word */
+    uint8_t ic_device_id[16];          /* Read-Only block-read */
 } PMBusPage;
 
 /* State */
diff --git a/include/hw/sensor/isl_pmbus_vr.h b/include/hw/sensor/isl_pmbus_vr.h
index 3e47ff7e48..d501b3bc82 100644
--- a/include/hw/sensor/isl_pmbus_vr.h
+++ b/include/hw/sensor/isl_pmbus_vr.h
@@ -12,6 +12,7 @@
 #include "hw/i2c/pmbus_device.h"
 #include "qom/object.h"
 
+#define TYPE_ISL69259   "isl69259"
 #define TYPE_ISL69260   "isl69260"
 #define TYPE_RAA228000  "raa228000"
 #define TYPE_RAA229004  "raa229004"
-- 
2.30.2



  parent reply	other threads:[~2022-06-27 20:15 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-27 19:54 [PATCH 00/14] aspeed: Add I2C new register DMA slave mode support Peter Delevoryas
2022-06-27 19:54 ` [PATCH 01/14] hw/i2c: support multiple masters Peter Delevoryas
2022-06-27 19:54 ` [PATCH 02/14] hw/i2c: add asynchronous send Peter Delevoryas
2022-06-27 19:54 ` [PATCH 03/14] hw/i2c/aspeed: add slave device in old register mode Peter Delevoryas
2022-06-27 19:54 ` [PATCH 04/14] aspeed: i2c: Fix DMA len write-enable bit handling Peter Delevoryas
2022-06-28  7:01   ` Cédric Le Goater
2022-06-28  7:05     ` Peter Delevoryas
2022-06-27 19:54 ` [PATCH 05/14] aspeed: i2c: Fix R_I2CD_FUN_CTRL reference Peter Delevoryas
2022-06-28  7:01   ` Cédric Le Goater
2022-06-28  7:05     ` Peter Delevoryas
2022-06-27 19:54 ` [PATCH 07/14] aspeed: Add PECI controller Peter Delevoryas
2022-06-28  6:47   ` Cédric Le Goater
2022-06-28  6:58     ` Peter Delevoryas
2022-06-27 19:55 ` [PATCH 08/14] hw/misc: Add fby35-cpld Peter Delevoryas
2022-06-28  6:50   ` Cédric Le Goater
2022-06-28  7:00     ` Peter Delevoryas
2022-06-27 19:55 ` [PATCH 09/14] pmbus: Reset out buf after switching pages Peter Delevoryas
2022-06-28  6:51   ` Cédric Le Goater
2022-06-28  7:04     ` Peter Delevoryas
2022-06-27 19:55 ` Peter Delevoryas [this message]
2022-06-27 19:55 ` [PATCH 11/14] aspeed: Add oby35-cl machine Peter Delevoryas
2022-06-27 20:04 ` [PATCH 00/14] aspeed: Add I2C new register DMA slave mode support Peter Delevoryas
2022-06-27 22:27 ` [PATCH 12/14] hw/misc: Add intel-me Peter Delevoryas
2022-06-27 22:27   ` [PATCH 13/14] aspeed: Add intel-me on i2c6 instead of BMC Peter Delevoryas
2022-06-27 22:27   ` [PATCH 14/14] aspeed: Add I2C new register DMA slave mode support Peter Delevoryas
2022-06-28  7:02     ` Cédric Le Goater
2022-06-28  7:06       ` Peter Delevoryas
2022-06-28  6:58   ` [PATCH 12/14] hw/misc: Add intel-me Cédric Le Goater
2022-06-28  7:17     ` Peter Delevoryas
2022-06-28  7:05 ` [PATCH 00/14] aspeed: Add I2C new register DMA slave mode support Cédric Le Goater
2022-06-28  7:16   ` Peter Delevoryas

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=20220627195506.403715-11-pdel@fb.com \
    --to=pdel@fb.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=joel@jms.id.au \
    --cc=komlodi@google.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=titusr@google.com \
    --cc=zhdaniel@fb.com \
    /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.