From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30915C2B9F4 for ; Mon, 28 Jun 2021 04:35:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6EE6619AD for ; Mon, 28 Jun 2021 04:35:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6EE6619AD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:52276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxizI-0001Zn-OG for qemu-devel@archiver.kernel.org; Mon, 28 Jun 2021 00:35:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxixP-0008LT-Nj; Mon, 28 Jun 2021 00:33:17 -0400 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]:46499) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxixM-0004Iu-9O; Mon, 28 Jun 2021 00:33:15 -0400 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id AA3F33200645; Mon, 28 Jun 2021 00:33:07 -0400 (EDT) Received: from imap43 ([10.202.2.93]) by compute2.internal (MEProxy); Mon, 28 Jun 2021 00:33:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h= mime-version:message-id:in-reply-to:references:date:from:to:cc :subject:content-type; s=fm3; bh=vRXBHPbfYTlmgvRozwLM16bg6nHo6wz 51TXIjdwDpNU=; b=GoNfAeRhwv6I1+O/+R+/Oc6YtBCZ3KIIkIG/MGXHOkGPlnO 1w8VZWjtl18sDyDvGc0tyEJFgFd/e842/JFK3uPL+YXF6uSlAbTigxIOTREqTp8V jKyhgoI6KeS31cGd9EUkVkGT0PkXlRxMfIa5nQSSsOPb0qSj4gUvVwCJh7TMM8K9 5g29mda4e9h+fKt8mV43jUF77/6e9pJI8RQKwlg/G7O/IBCT44VaymAVpcDSVXZz fW3t66jKm82FjTKbTipY0YFz8MRK5WiTFRYviAVCYxzoA0LhLHv5sUWIfW7pIzwv CFgVqaawOFsZOtTQuv0bEeimfr+vmT0Ot1YAeGQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=vRXBHP bfYTlmgvRozwLM16bg6nHo6wz51TXIjdwDpNU=; b=KbA6U6tPA/ngEFFqUiPeFE tV065M26LtTxnOYNAridJJS5bZE0YkYEjlx0U912iAoOS4mdhqbsOWj3PYv4swFR 6QrDjwv0ev5D/oX4mt1+82Qs1dKFSrnoPykSPksTUjD6ftQA9vkyn8WU7sWoyF1I X+xDZExQEduVx9/TwfHiRsPeQDy0mpJSwWmR7HoOGy3M2B3KblajUX4jeQbKCe21 X8bIMcrgmsnaq5NxwgarrMp93l+aPUH2xCg010s2xsIbQqcrr3P9s+b5iZcrBKwt Z/pE/xJtdkIQA5dB26pU89LrqT2kjGegiJyY3ZmNztYaQtt8olMupfa/MAYobbMw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeehfedgkedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdetnhgu rhgvficulfgvfhhfvghrhidfuceorghnughrvgifsegrjhdrihgurdgruheqnecuggftrf grthhtvghrnhephefhfeekgfekudevheffheeihedujeefjeevjeefudfgfeeutdeuvdeh hfevueffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh eprghnughrvgifsegrjhdrihgurdgruh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id B9DA6AC0073; Mon, 28 Jun 2021 00:33:06 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-530-gd0c265785f-fm-20210616.002-gd0c26578 Mime-Version: 1.0 Message-Id: In-Reply-To: <20210625050643.161042-1-joel@jms.id.au> References: <20210625050643.161042-1-joel@jms.id.au> Date: Mon, 28 Jun 2021 14:02:45 +0930 From: "Andrew Jeffery" To: "Joel Stanley" , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , "Peter Maydell" Subject: Re: [PATCH] arm/aspeed: rainier: Add i2c eeproms and muxes Content-Type: text/plain Received-SPF: pass client-ip=64.147.123.21; envelope-from=andrew@aj.id.au; helo=wout5-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@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, Cameron Esfahani via Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Fri, 25 Jun 2021, at 14:36, 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 > --- > 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)); The EEPROMs described in the Rainier devicetree are Atmel AT2x devices and not SMBus EEPROMs. The SMBus EEPROM model uses SMBus block reads and writes which are not what the AT2x driver issues. If you try to read or write data under Linux from the EEPROMs in this patch you just get corrupt results. So as far as I can see the patch needs to be reworked. Andrew