Received: by 2002:a19:ca1d:0:0:0:0:0 with SMTP id a29csp1299857lfg; Fri, 25 Jun 2021 01:36:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlDsSxLkG0pp51vXmw/XlHXQtYfw7h0d1pac4DEizBKYVjTnukRuFz6yw4fCV1oNquGsx8 X-Received: by 2002:a25:8543:: with SMTP id f3mr10291676ybn.80.1624610196198; Fri, 25 Jun 2021 01:36:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624610196; cv=none; d=google.com; s=arc-20160816; b=OH3nmPvNVD4ldLuczoUJoKxf0N5MWwIH0LXIBmdEnxCCAN2OYXWMj8m1zeX2fy51Fe x5imdESNIdb3DK/ZwR0bll8JV43CtqLQBw3DXq/NFFigHMsZBQ6ixu8j3TGz9HIqu41m gzsHSk80kBn+Hf9tASs2mHRUTgtEPpQJWd2A6D7uS/bO1ScycoyEwS1w14BxoPon4h/N A6apR3KjG7Y3JDIkFlhnOc8pOgkmAHkDjepnTtNgHMGiXQ2N2T2Fy6s49Qyz0iaTP9us xh2MLf1c6zhLcQW3AsGULrp+fzZYDVsOgz2FIoNPln91AgIeox/4ZUJhlxKUPgq1EWXy 3o0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:to:subject; bh=wfubtvJRH4i4dHm6mpDNKZfT4ykV0+AkfP2lm7uQQAA=; b=fW5+2kOjNBFR0MXUJltiKNFp/TwxUWHLxODEd9JM+vDT+PJQzqngeZoBf0XDumnd2F /leC4hNe/yJ4OHZRhg8Nkh6FIxiHT1nQcNLXcf26+8LcUdEet/eZR2TS3NlFpfSPb845 h4VNyTOZLrLzzJp6Mx76MX9ARvp94qhAGxEzEZyy0U5126w4QzH28TPPmkBx4xsAJJ2m Q/BYGKZTG985OdL8cp7YZc1KF6GzOw2lGVWYZFitDZ19Wj2WWavHtubaftuizhr3MAOM 2gQQCr+KyDfKMoREBN/RKKk1MHSyNC22eYOmRse+iuYyN7I89R1YzObiekcJS+cLUuRr 6UgA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z126si4711910ybf.431.2021.06.25.01.36.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 25 Jun 2021 01:36:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org" Received: from localhost ([::1]:48272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwhKF-0001EK-Ez for alex.bennee@linaro.org; Fri, 25 Jun 2021 04:36:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46826) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwhK6-0001Aj-Hx; Fri, 25 Jun 2021 04:36:26 -0400 Received: from smtpout1.mo529.mail-out.ovh.net ([178.32.125.2]:60889) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwhK3-0006Rc-Kp; Fri, 25 Jun 2021 04:36:26 -0400 Received: from mxplan5.mail.ovh.net (unknown [10.108.16.210]) by mo529.mail-out.ovh.net (Postfix) with ESMTPS id F2EEEB087E27; Fri, 25 Jun 2021 10:36:11 +0200 (CEST) Received: from kaod.org (37.59.142.100) by DAG4EX1.mxp5.local (172.16.2.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.10; Fri, 25 Jun 2021 10:36:10 +0200 Authentication-Results: garm.ovh; auth=pass (GARM-100R003e1ad01ad-dec2-4dbb-b288-210b8e091b7b, DBCB69B7246CE000B0FCA0F5B8457C792B3268C0) smtp.auth=clg@kaod.org X-OVh-ClientIp: 92.184.105.220 Subject: Re: [PATCH] arm/aspeed: rainier: Add i2c eeproms and muxes To: Joel Stanley , Peter Maydell , Andrew Jeffery References: <20210625050643.161042-1-joel@jms.id.au> From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Message-ID: Date: Fri, 25 Jun 2021 10:36:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210625050643.161042-1-joel@jms.id.au> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [37.59.142.100] X-ClientProxiedBy: DAG9EX2.mxp5.local (172.16.2.82) To DAG4EX1.mxp5.local (172.16.2.31) X-Ovh-Tracer-GUID: e26e4cf5-5f9e-4b7f-b488-9b1bf85803e7 X-Ovh-Tracer-Id: 10771202935205497638 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrfeegjedgtddvucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffgggjggtgfhisehtkeertddtfeejnecuhfhrohhmpeevrogurhhitggpnfgvpgfiohgrthgvrhcuoegtlhhgsehkrghougdrohhrgheqnecuggftrfgrthhtvghrnhepjeekudeuudevleegudeugeekleffveeludejteffiedvledvgfekueefudehheefnecukfhppedtrddtrddtrddtpdefjedrheelrddugedvrddutddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhpqdhouhhtpdhhvghlohepmhigphhlrghnhedrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpegtlhhgsehkrghougdrohhrghdprhgtphhtthhopehjohgvlhesjhhmshdrihgurdgruh Received-SPF: pass client-ip=178.32.125.2; envelope-from=clg@kaod.org; helo=smtpout1.mo529.mail-out.ovh.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-arm@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Patrick Venture , qemu-arm@nongnu.org, qemu-devel@nongnu.org Errors-To: qemu-arm-bounces+alex.bennee=linaro.org@nongnu.org Sender: "Qemu-arm" X-TUID: uPB4OtUkefOX On 6/25/21 7:06 AM, Joel Stanley wrote: > These are the devices documented by the Rainier device tree. With this > we can see the guest discovering the multiplexers and probing the eeprom > devices: > > i2c i2c-2: Added multiplexed i2c bus 16 > i2c i2c-2: Added multiplexed i2c bus 17 > i2c i2c-2: Added multiplexed i2c bus 18 > i2c i2c-2: Added multiplexed i2c bus 19 > i2c-mux-gpio i2cmux: 4 port mux on 1e78a180.i2c-bus adapter > at24 20-0050: 8192 byte 24c64 EEPROM, writable, 1 bytes/write > i2c i2c-4: Added multiplexed i2c bus 20 > at24 21-0051: 8192 byte 24c64 EEPROM, writable, 1 bytes/write > i2c i2c-4: Added multiplexed i2c bus 21 > at24 22-0052: 8192 byte 24c64 EEPROM, writable, 1 bytes/write > > Signed-off-by: Joel Stanley Reviewed-by: Cédric Le Goater Thanks, C. > --- > hw/arm/aspeed.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > > diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c > index 1301e8fdffb2..7ed22294c6eb 100644 > --- a/hw/arm/aspeed.c > +++ b/hw/arm/aspeed.c > @@ -677,6 +677,10 @@ static void g220a_bmc_i2c_init(AspeedMachineState *bmc) > static void rainier_bmc_i2c_init(AspeedMachineState *bmc) > { > AspeedSoCState *soc = &bmc->soc; > + I2CSlave *i2c_mux; > + > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 0), 0x51, > + g_malloc0(32 * 1024)); > > /* The rainier expects a TMP275 but a TMP105 is compatible */ > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), TYPE_TMP105, > @@ -685,11 +689,25 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) > 0x49); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), TYPE_TMP105, > 0x4a); > + i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 4), > + "pca9546", 0x70); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 2), 0x52, > + g_malloc0(64 * 1024)); > > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), TYPE_TMP105, > 0x48); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), TYPE_TMP105, > 0x49); > + i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 5), > + "pca9546", 0x70); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, > + g_malloc0(64 * 1024)); > > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), TYPE_TMP105, > 0x48); > @@ -697,6 +715,16 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) > 0x4a); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), TYPE_TMP105, > 0x4b); > + i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 6), > + "pca9546", 0x70); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 2), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 3), 0x51, > + g_malloc0(64 * 1024)); > > /* Bus 7: TODO dps310@76 */ > /* Bus 7: TODO max31785@52 */ > @@ -704,11 +732,19 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) > /* Bus 7: TODO si7021-a20@20 */ > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 7), TYPE_TMP105, > 0x48); > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 7), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 7), 0x51, > + g_malloc0(64 * 1024)); > > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), TYPE_TMP105, > 0x48); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), TYPE_TMP105, > 0x4a); > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 8), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 8), 0x51, > + g_malloc0(64 * 1024)); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 8), "pca9552", 0x61); > /* Bus 8: ucd90320@11 */ > /* Bus 8: ucd90320@b */ > @@ -716,14 +752,34 @@ static void rainier_bmc_i2c_init(AspeedMachineState *bmc) > > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4c); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 9), "tmp423", 0x4d); > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 9), 0x50, > + g_malloc0(128 * 1024)); > > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0x4c); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 10), "tmp423", 0x4d); > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 10), 0x50, > + g_malloc0(128 * 1024)); > > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_TMP105, > 0x48); > i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), TYPE_TMP105, > 0x49); > + i2c_mux = i2c_slave_create_simple(aspeed_i2c_get_bus(&soc->i2c, 11), > + "pca9546", 0x70); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 0), 0x50, > + g_malloc0(64 * 1024)); > + smbus_eeprom_init_one(pca954x_i2c_get_bus(i2c_mux, 1), 0x51, > + g_malloc0(64 * 1024)); > + > + > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 13), 0x50, > + g_malloc0(64 * 1024)); > + > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 14), 0x50, > + g_malloc0(64 * 1024)); > + > + smbus_eeprom_init_one(aspeed_i2c_get_bus(&soc->i2c, 15), 0x50, > + g_malloc0(64 * 1024)); > } > > static bool aspeed_get_mmio_exec(Object *obj, Error **errp) >