From: Kevin Wolf <kwolf@redhat.com>
To: Hao Wu <wuhaotsh@google.com>
Cc: peter.maydell@linaro.org, thuth@redhat.com,
qemu-block@nongnu.org, venture@google.com,
bin.meng@windriver.com, richard.henderson@linaro.org,
qemu-devel@nongnu.org, hskinnemoen@google.com,
kfting@nuvoton.com, qemu-arm@nongnu.org, Avi.Fishman@nuvoton.com,
armbru@redhat.com, f4bug@amsat.org
Subject: Re: [PATCH v4 6/7] hw/nvram: Update at24c EEPROM init function in NPCM7xx boards
Date: Mon, 15 Nov 2021 14:19:15 +0100 [thread overview]
Message-ID: <YZJeU5fCxR07hmJQ@redhat.com> (raw)
In-Reply-To: <20211103220133.1422879-4-wuhaotsh@google.com>
Am 03.11.2021 um 23:01 hat Hao Wu geschrieben:
> We made 3 changes to the at24c_eeprom_init function in
> npcm7xx_boards.c:
>
> 1. We allow the function to take a I2CBus* as parameter. This allows
> us to attach an EEPROM device behind an I2C mux which is not
> possible with the old method.
>
> 2. We make at24c EEPROMs are backed by drives so that we can
> specify the content of the EEPROMs.
>
> 3. Instead of using i2c address as unit number, This patch assigns
> unique unit numbers for each eeproms in each board. This avoids
> conflict in providing multiple eeprom contents with the same address.
> In the old method if we specify two drives with the same unit number,
> the following error will occur: `Device with id 'none85' exists`.
>
> Signed-off-by: Hao Wu <wuhaotsh@google.com>
> ---
> hw/arm/npcm7xx_boards.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
> index dec7d16ae5..9121e081fa 100644
> --- a/hw/arm/npcm7xx_boards.c
> +++ b/hw/arm/npcm7xx_boards.c
> @@ -126,13 +126,17 @@ static I2CBus *npcm7xx_i2c_get_bus(NPCM7xxState *soc, uint32_t num)
> return I2C_BUS(qdev_get_child_bus(DEVICE(&soc->smbus[num]), "i2c-bus"));
> }
>
> -static void at24c_eeprom_init(NPCM7xxState *soc, int bus, uint8_t addr,
> - uint32_t rsize)
> +static void at24c_eeprom_init(I2CBus *i2c_bus, int bus, uint8_t addr,
> + uint32_t rsize, int unit_number)
> {
> - I2CBus *i2c_bus = npcm7xx_i2c_get_bus(soc, bus);
> I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", addr);
> DeviceState *dev = DEVICE(i2c_dev);
> + DriveInfo *dinfo;
>
> + dinfo = drive_get(IF_OTHER, bus, unit_number);
> + if (dinfo) {
> + qdev_prop_set_drive(dev, "drive", blk_by_legacy_dinfo(dinfo));
> + }
I may be missing the history of this series, but why do we have to use a
legacy DriveInfo here instead of adding a drive property to the board to
make this configurable with -blockdev?
Adding even more devices that can only be configured with -drive feels
like a step backwards to me.
Kevin
next prev parent reply other threads:[~2021-11-15 13:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 22:01 [PATCH v4 3/7] hw/adc: Fix CONV bit in NPCM7XX ADC CON register Hao Wu
2021-11-03 22:01 ` [PATCH v4 4/7] hw/adc: Make adci[*] R/W in NPCM7XX ADC Hao Wu
2021-11-03 22:01 ` [PATCH v4 5/7] blockdev: Add a new IF type IF_OTHER Hao Wu
2021-11-06 6:47 ` Markus Armbruster
2021-11-03 22:01 ` [PATCH v4 6/7] hw/nvram: Update at24c EEPROM init function in NPCM7xx boards Hao Wu
2021-11-06 6:53 ` Markus Armbruster
2021-11-15 13:19 ` Kevin Wolf [this message]
2021-11-15 15:28 ` On configuring onboard block devices with -blockdev (was: [PATCH v4 6/7] hw/nvram: Update at24c EEPROM init function in NPCM7xx boards) Markus Armbruster
2021-11-03 22:01 ` [PATCH v4 7/7] hw/arm: quanta-gbs-bmc add i2c devices Hao Wu
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=YZJeU5fCxR07hmJQ@redhat.com \
--to=kwolf@redhat.com \
--cc=Avi.Fishman@nuvoton.com \
--cc=armbru@redhat.com \
--cc=bin.meng@windriver.com \
--cc=f4bug@amsat.org \
--cc=hskinnemoen@google.com \
--cc=kfting@nuvoton.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
--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 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).