qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Titus Rwantare <titusr@google.com>
To: Peter Delevoryas <peterdelevoryas@gmail.com>
Cc: clg@kaod.org, peter.maydell@linaro.org, andrew@aj.id.au,
	joel@jms.id.au,  cminyard@mvista.com, qemu-devel@nongnu.org,
	qemu-arm@nongnu.org,  zhdaniel@fb.com, pdel@fb.com
Subject: Re: [PATCH v2 09/13] hw/i2c/pmbus: Add read-only IC_DEVICE_ID support
Date: Wed, 29 Jun 2022 11:04:39 -0700	[thread overview]
Message-ID: <CAMvPwGqmU+bsDb1fHraiTzdg14An5QiKUazSweyzVvbwHeCM=g@mail.gmail.com> (raw)
In-Reply-To: <20220629033634.3850922-10-pdel@fb.com>

On Tue, 28 Jun 2022 at 20:36, Peter Delevoryas
<peterdelevoryas@gmail.com> wrote:
>
> Signed-off-by: Peter Delevoryas <pdel@fb.com>
> ---

> --- 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;
> +

I don't think it's a good idea to add this here because this sends 16
bytes for all PMBus devices. I have at least one device that formats
IC_DEVICE_ID differently that I've not got permission to upstream.
The spec leaves the size and format up to the manufacturer, so this is
best done in isl_pmbus_vr.c in isl_pmbus_vr_read_byte().
Look at the adm1272_read_byte() which is more interesting than
isl_pmbus_vr one as an example.


>      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..b12c46ab6d 100644
> --- a/hw/sensor/isl_pmbus_vr.c
> +++ b/hw/sensor/isl_pmbus_vr.c
> @@ -218,6 +218,28 @@ 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));
> +    }
> +}
> +

We tend to set default register values in exit_reset() calls. You can
do something like in raa228000_exit_reset()


> 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 */

You wouldn't be able to do this here either, since the size could be
anything for other devices.

Thanks for the new device. It helps me see where to expand on PMBus.


Titus


  parent reply	other threads:[~2022-06-29 18:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  3:36 [PATCH v2 00/13] hw/i2c/aspeed: Add new-registers DMA slave mode RX support Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 01/13] hw/i2c/aspeed: Fix R_I2CD_FUN_CTRL reference Peter Delevoryas
2022-06-29  8:31   ` Cédric Le Goater
2022-06-29  3:36 ` [PATCH v2 02/13] hw/i2c/aspeed: Fix DMA len write-enable bit handling Peter Delevoryas
2022-06-29  8:31   ` Cédric Le Goater
2022-06-29  3:36 ` [PATCH v2 03/13] hw/i2c/aspeed: Fix MASTER_EN missing error message Peter Delevoryas
2022-06-29  8:31   ` Cédric Le Goater
2022-06-29  3:36 ` [PATCH v2 04/13] hw/i2c: support multiple masters Peter Delevoryas
2022-06-29  8:35   ` Cédric Le Goater
2022-06-29  3:36 ` [PATCH v2 05/13] hw/i2c: add asynchronous send Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 06/13] hw/i2c/aspeed: add slave device in old register mode Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 07/13] hw/i2c/aspeed: Add new-registers DMA slave mode RX support Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 08/13] hw/i2c/pmbus: Reset out buf after switching pages Peter Delevoryas
2022-06-29  8:36   ` Cédric Le Goater
2022-06-29 18:05   ` Titus Rwantare
2022-06-29 18:28     ` Peter Delevoryas
2022-06-30  1:43       ` Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 09/13] hw/i2c/pmbus: Add read-only IC_DEVICE_ID support Peter Delevoryas
2022-06-29  8:40   ` Cédric Le Goater
2022-06-29 16:08     ` Peter Delevoryas
2022-06-29 18:04   ` Titus Rwantare [this message]
2022-06-29 18:26     ` Peter Delevoryas
2022-06-30 15:46       ` Patrick Venture
2022-07-01  6:20         ` Cédric Le Goater
2022-06-29  3:36 ` [PATCH v2 10/13] hw/misc/aspeed: Add PECI controller Peter Delevoryas
2022-06-29  9:20   ` Cédric Le Goater
2022-06-29 16:07     ` Peter Delevoryas
2022-06-29 16:44       ` Cédric Le Goater
2022-06-29  3:36 ` [PATCH v2 11/13] hw/misc/aspeed: Add fby35-sb-cpld Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 12/13] hw/misc/aspeed: Add intel-me Peter Delevoryas
2022-06-29  3:36 ` [PATCH v2 13/13] hw/arm/aspeed: Add oby35-cl machine 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='CAMvPwGqmU+bsDb1fHraiTzdg14An5QiKUazSweyzVvbwHeCM=g@mail.gmail.com' \
    --to=titusr@google.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=joel@jms.id.au \
    --cc=pdel@fb.com \
    --cc=peter.maydell@linaro.org \
    --cc=peterdelevoryas@gmail.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).