From: Titus Rwantare <titusr@google.com>
To: Corey Minyard <minyard@acm.org>
Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, f4bug@amsat.org,
wuhaotsh@google.com, venture@google.com,
peter.maydell@linaro.org, Titus Rwantare <titusr@google.com>
Subject: [PATCH v3 1/9] hw/i2c: pmbus: add registers
Date: Tue, 1 Mar 2022 17:50:45 -0800 [thread overview]
Message-ID: <20220302015053.1984165-2-titusr@google.com> (raw)
In-Reply-To: <20220302015053.1984165-1-titusr@google.com>
- add the VOUT_MIN and STATUS_MFR registers
Signed-off-by: Titus Rwantare <titusr@google.com>
---
hw/i2c/pmbus_device.c | 24 ++++++++++++++++++++++++
include/hw/i2c/pmbus_device.h | 3 +++
2 files changed, 27 insertions(+)
diff --git a/hw/i2c/pmbus_device.c b/hw/i2c/pmbus_device.c
index 24f8f522d9..07a45c99f9 100644
--- a/hw/i2c/pmbus_device.c
+++ b/hw/i2c/pmbus_device.c
@@ -368,6 +368,14 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd)
}
break;
+ case PMBUS_VOUT_MIN: /* R/W word */
+ if (pmdev->pages[index].page_flags & PB_HAS_VOUT_RATING) {
+ pmbus_send16(pmdev, pmdev->pages[index].vout_min);
+ } else {
+ goto passthough;
+ }
+ break;
+
/* TODO: implement coefficients support */
case PMBUS_POUT_MAX: /* R/W word */
@@ -708,6 +716,10 @@ static uint8_t pmbus_receive_byte(SMBusDevice *smd)
pmbus_send8(pmdev, pmdev->pages[index].status_other);
break;
+ case PMBUS_STATUS_MFR_SPECIFIC: /* R/W byte */
+ pmbus_send8(pmdev, pmdev->pages[index].status_mfr_specific);
+ break;
+
case PMBUS_READ_EIN: /* Read-Only block 5 bytes */
if (pmdev->pages[index].page_flags & PB_HAS_EIN) {
pmbus_send(pmdev, pmdev->pages[index].read_ein, 5);
@@ -1149,6 +1161,14 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
}
break;
+ case PMBUS_VOUT_MIN: /* R/W word */
+ if (pmdev->pages[index].page_flags & PB_HAS_VOUT_RATING) {
+ pmdev->pages[index].vout_min = pmbus_receive16(pmdev);
+ } else {
+ goto passthrough;
+ }
+ break;
+
case PMBUS_POUT_MAX: /* R/W word */
if (pmdev->pages[index].page_flags & PB_HAS_VOUT) {
pmdev->pages[index].pout_max = pmbus_receive16(pmdev);
@@ -1482,6 +1502,10 @@ static int pmbus_write_data(SMBusDevice *smd, uint8_t *buf, uint8_t len)
pmdev->pages[index].status_other = pmbus_receive8(pmdev);
break;
+ case PMBUS_STATUS_MFR_SPECIFIC: /* R/W byte */
+ pmdev->pages[index].status_mfr_specific = pmbus_receive8(pmdev);
+ break;
+
case PMBUS_PAGE_PLUS_READ: /* Block Read-only */
case PMBUS_CAPABILITY: /* Read-Only byte */
case PMBUS_COEFFICIENTS: /* Read-only block 5 bytes */
diff --git a/include/hw/i2c/pmbus_device.h b/include/hw/i2c/pmbus_device.h
index 62bd38c83f..72c0483149 100644
--- a/include/hw/i2c/pmbus_device.h
+++ b/include/hw/i2c/pmbus_device.h
@@ -43,6 +43,7 @@ enum pmbus_registers {
PMBUS_VOUT_DROOP = 0x28, /* R/W word */
PMBUS_VOUT_SCALE_LOOP = 0x29, /* R/W word */
PMBUS_VOUT_SCALE_MONITOR = 0x2A, /* R/W word */
+ PMBUS_VOUT_MIN = 0x2B, /* R/W word */
PMBUS_COEFFICIENTS = 0x30, /* Read-only block 5 bytes */
PMBUS_POUT_MAX = 0x31, /* R/W word */
PMBUS_MAX_DUTY = 0x32, /* R/W word */
@@ -255,6 +256,7 @@ OBJECT_DECLARE_TYPE(PMBusDevice, PMBusDeviceClass,
#define PB_HAS_TEMP3 BIT_ULL(42)
#define PB_HAS_TEMP_RATING BIT_ULL(43)
#define PB_HAS_MFR_INFO BIT_ULL(50)
+#define PB_HAS_STATUS_MFR_SPECIFIC BIT_ULL(51)
struct PMBusDeviceClass {
SMBusDeviceClass parent_class;
@@ -295,6 +297,7 @@ typedef struct PMBusPage {
uint16_t vout_droop; /* R/W word */
uint16_t vout_scale_loop; /* R/W word */
uint16_t vout_scale_monitor; /* R/W word */
+ uint16_t vout_min; /* R/W word */
uint8_t coefficients[5]; /* Read-only block 5 bytes */
uint16_t pout_max; /* R/W word */
uint16_t max_duty; /* R/W word */
--
2.35.1.616.g0bdcbb4464-goog
next prev parent reply other threads:[~2022-03-02 1:51 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 1:50 [PATCH v3 0/9] This patch series contains updates to PMBus in QEMU along with some PMBus device models for Renesas regulators. I have also added myself to MAINTAINERS as this code is in use daily, where I am responsible for it Titus Rwantare
2022-03-02 1:50 ` Titus Rwantare [this message]
2022-03-05 0:19 ` [PATCH v3 1/9] hw/i2c: pmbus: add registers Philippe Mathieu-Daudé
2022-03-02 1:50 ` [PATCH v3 2/9] hw/i2c: pmbus: guard against out of range accesses Titus Rwantare
2022-03-05 0:08 ` Philippe Mathieu-Daudé
2022-03-07 19:30 ` Titus Rwantare
2022-03-02 1:50 ` [PATCH v3 3/9] hw/i2c: pmbus: add PEC unsupported warning Titus Rwantare
2022-03-05 0:01 ` Philippe Mathieu-Daudé
2022-03-07 19:31 ` Titus Rwantare
2022-03-02 1:50 ` [PATCH v3 4/9] hw/i2c: pmbus: refactor uint handling Titus Rwantare
2022-03-04 23:59 ` Philippe Mathieu-Daudé
2022-03-02 1:50 ` [PATCH v3 5/9] hw/i2c: pmbus: update MAINTAINERS Titus Rwantare
2022-03-04 23:52 ` Philippe Mathieu-Daudé
2022-03-02 1:50 ` [PATCH v3 6/9] hw/i2c: Added linear mode translation for pmbus devices Titus Rwantare
2022-03-04 23:53 ` Philippe Mathieu-Daudé
2022-03-02 1:50 ` [PATCH v3 7/9] hw/sensor: add Intersil ISL69260 device model Titus Rwantare
2022-03-05 0:17 ` Philippe Mathieu-Daudé
2022-03-02 1:50 ` [PATCH v3 8/9] hw/sensor: add Renesas raa229004 PMBus device Titus Rwantare
2022-03-04 23:54 ` Philippe Mathieu-Daudé
2022-03-02 1:50 ` [PATCH v3 9/9] hw/sensor: add Renesas raa228000 device Titus Rwantare
2022-03-04 23:58 ` Philippe Mathieu-Daudé
2022-03-04 21:43 ` [PATCH v3 0/9] This patch series contains updates to PMBus in QEMU along with some PMBus device models for Renesas regulators. I have also added myself to MAINTAINERS as this code is in use daily, where I am responsible for it Corey Minyard
2022-03-04 23:42 ` Titus Rwantare
2022-03-07 0:00 ` Philippe Mathieu-Daudé
2022-03-08 13:53 ` Corey Minyard
2022-03-08 18:08 ` Philippe Mathieu-Daudé
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=20220302015053.1984165-2-titusr@google.com \
--to=titusr@google.com \
--cc=f4bug@amsat.org \
--cc=minyard@acm.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=venture@google.com \
--cc=wuhaotsh@google.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.