From patchwork Wed Nov 3 22:01:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 12601755 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B5F5C433EF for ; Wed, 3 Nov 2021 22:10:54 +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 D63B061101 for ; Wed, 3 Nov 2021 22:10:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D63B061101 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:44392 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1miOT6-000100-S7 for qemu-devel@archiver.kernel.org; Wed, 03 Nov 2021 18:10:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3yQaDYQgKCvQsqdWkpodckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--wuhaotsh.bounces.google.com>) id 1miOKT-0003F6-J4 for qemu-devel@nongnu.org; Wed, 03 Nov 2021 18:01:58 -0400 Received: from mail-pf1-x449.google.com ([2607:f8b0:4864:20::449]:36807) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3yQaDYQgKCvQsqdWkpodckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--wuhaotsh.bounces.google.com>) id 1miOKO-0002c7-LK for qemu-devel@nongnu.org; Wed, 03 Nov 2021 18:01:57 -0400 Received: by mail-pf1-x449.google.com with SMTP id c207-20020a621cd8000000b0048060050cfeso2145649pfc.3 for ; Wed, 03 Nov 2021 15:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=zKsthWD6aLJepNequIRsE8wsdkCHtKgMHCSXi5pgrhc=; b=LdKZ6V9HSdXlROBBmA/fypBCta8ug4XXGnUmkBApf2ExIWyZcJDcEBZjmrLnHHiuic 9Dz/rp4xR/kgBEiUD9UdaB7uI4TljLwlkNseSVXUbBdpjdZZrJ5qtLWnRpk9VsOYn/A5 napPDpH/wgOhqEZdtUmIM/V72DvmElO5A/3X/XLJ2kuNPwzv1/zEWan1zxXdcD6FDRG1 fNNvlXW1PTbmoAK7GVkX4XPoSqHIp7MBKWeu9l/mkZLQoM//HD47ECh499q0jxkPpd4t pMYM1qBsal1IcQuVjAgKLgv1oxrcif41nWVwiWVUQVd7x/KUwVEye9MaEocfYggRBrw2 G9IQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=zKsthWD6aLJepNequIRsE8wsdkCHtKgMHCSXi5pgrhc=; b=thvdMnj0L/FmGVedcAUMFNz2qlKENwCTH/O0BdFdxlLR8mCH2ykJ15XAohb7aI+b9w ou+14IwbYH6nQLgsfWLNfx/xCIg3MQFqWde5d7Rl4+4peJm04GIYLY7blcVbMxsvHJ5P v1Youxkr5z86mE+TWgL3BDSggl66XAK/CRY//RHDDdRVNlbizQe0pagBlP4/hbqudoUk Y+kkEYy0F396EXTS+nqdp0rgUd6xn2w09QVZo4xR355WtW/xXYXfP7C5mwg/XUou9pHd +mpgxMJwWURVUCSwmW0nCpwHRVujRlBUPw4FTZaS622CIndHV/B/jCD8MGqb2EE+yYMd jZkQ== X-Gm-Message-State: AOAM530g19WN64JNyfSVRs+vAj+o6Q8QGa/7ux4t++mDfDLGyP36ofJR HGqoEHLt466T6c1aaR8eWYV3TQHOkNS9xw== X-Google-Smtp-Source: ABdhPJw7o3c1yLN1sC5c9BSpKwnQ5XLGbing+MBEiGbq0wkKpqz9S+xnrJpqlZu6cebjO9B1f2LIs8wmpHn35A== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:90b:2487:: with SMTP id nt7mr17397144pjb.75.1635976905864; Wed, 03 Nov 2021 15:01:45 -0700 (PDT) Date: Wed, 3 Nov 2021 15:01:33 -0700 In-Reply-To: <20211103220133.1422879-1-wuhaotsh@google.com> Message-Id: <20211103220133.1422879-5-wuhaotsh@google.com> Mime-Version: 1.0 References: <20211103220133.1422879-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.33.1.1089.g2158813163f-goog Subject: [PATCH v4 7/7] hw/arm: quanta-gbs-bmc add i2c devices From: Hao Wu To: peter.maydell@linaro.org Cc: richard.henderson@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, f4bug@amsat.org, bin.meng@windriver.com, qemu-block@nongnu.org, armbru@redhat.com, thuth@redhat.com Received-SPF: pass client-ip=2607:f8b0:4864:20::449; envelope-from=3yQaDYQgKCvQsqdWkpodckkcha.Ykimaiq-Zarahjkjcjq.knc@flex--wuhaotsh.bounces.google.com; helo=mail-pf1-x449.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Patrick Venture Adds supported i2c devices to the quanta-gbc-bmc board. Signed-off-by: Patrick Venture Reviewed-by: Hao Wu --- hw/arm/npcm7xx_boards.c | 82 ++++++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 33 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 9121e081fa..7fb1b3dbc2 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -276,10 +276,12 @@ static void quanta_gsj_fan_init(NPCM7xxMachine *machine, NPCM7xxState *soc) static void quanta_gbs_i2c_init(NPCM7xxState *soc) { + I2CSlave *i2c_mux; + + /* i2c-0: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 0), TYPE_PCA9546, 0x71); + /* - * i2c-0: - * pca9546@71 - * * i2c-1: * pca9535@24 * pca9535@20 @@ -288,46 +290,60 @@ static void quanta_gbs_i2c_init(NPCM7xxState *soc) * pca9535@23 * pca9535@25 * pca9535@26 - * - * i2c-2: - * sbtsi@4c - * - * i2c-5: - * atmel,24c64@50 mb_fru - * pca9546@71 - * - channel 0: max31725@54 - * - channel 1: max31725@55 - * - channel 2: max31725@5d - * atmel,24c64@51 fan_fru - * - channel 3: atmel,24c64@52 hsbp_fru - * + */ + + /* i2c-2: sbtsi@4c */ + + /* i2c-5: */ + /* mb_fru */ + at24c_eeprom_init(npcm7xx_i2c_get_bus(soc, 5), 5, 0x50, 8192, 0); + i2c_mux = i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 5), + TYPE_PCA9546, 0x71); + /* max31725 is tmp105 compatible. */ + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 0), "tmp105", 0x54); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 1), "tmp105", 0x55); + i2c_slave_create_simple(pca954x_i2c_get_bus(i2c_mux, 2), "tmp105", 0x5d); + /* fan_fru */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 2), 5, 0x51, 8192, 1); + /* hsbp_fru */ + at24c_eeprom_init(pca954x_i2c_get_bus(i2c_mux, 3), 5, 0x52, 8192, 2); + + /* * i2c-6: * pca9545@73 * * i2c-7: * pca9545@72 - * - * i2c-8: - * adi,adm1272@10 - * - * i2c-9: - * pca9546@71 - * - channel 0: isil,isl68137@60 - * - channel 1: isil,isl68137@61 - * - channel 2: isil,isl68137@63 - * - channel 3: isil,isl68137@45 - * + */ + + /* i2c-8: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 8), "adm1272", 0x10); + + /* i2c-9: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 9), TYPE_PCA9546, 0x71); + /* + * - channel 0: isil,isl68137@60 + * - channel 1: isil,isl68137@61 + * - channel 2: isil,isl68137@63 + * - channel 3: isil,isl68137@45 + */ + + /* * i2c-10: * pca9545@71 * * i2c-11: * pca9545@76 - * - * i2c-12: - * maxim,max34451@4e - * isil,isl68137@5d - * isil,isl68137@5e - * + */ + + /* i2c-12: */ + i2c_slave_create_simple(npcm7xx_i2c_get_bus(soc, 12), "max34451", 0x4e); + /* + * isil,isl68137@5d + * isil,isl68137@5e + */ + + /* * i2c-14: * pca9545@70 */