From patchwork Mon Apr 11 16:58:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 1615857 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=Ip3XfDt6; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KcZvt4cRkz9sBy for ; Tue, 12 Apr 2022 03:04:25 +1000 (AEST) Received: from localhost ([::1]:57272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndxSg-0006ea-Ju for incoming@patchwork.ozlabs.org; Mon, 11 Apr 2022 13:04:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3SV5UYggKCnAkiVOchgVUccUZS.QcaeSai-RSjSZbcbUbi.cfU@flex--wuhaotsh.bounces.google.com>) id 1ndxNN-0007w9-Gg for qemu-devel@nongnu.org; Mon, 11 Apr 2022 12:58:53 -0400 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]:44639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3SV5UYggKCnAkiVOchgVUccUZS.QcaeSai-RSjSZbcbUbi.cfU@flex--wuhaotsh.bounces.google.com>) id 1ndxNL-0004f2-Tk for qemu-devel@nongnu.org; Mon, 11 Apr 2022 12:58:53 -0400 Received: by mail-pf1-x44a.google.com with SMTP id d5-20020a62f805000000b0050566b4f4c0so7773531pfh.11 for ; Mon, 11 Apr 2022 09:58:50 -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=PBwivsX+CNRca4Tf4iFbEeHQqaqr2duXLo8VWx6ckBY=; b=Ip3XfDt6LwMxzZzBkyRC+VfpMnCBEfTIE7zkhHQP1bgV9Dg0KHGiG7HL9rr+FTjwjm bDj+uFskAzIzjEfykZm//ewfSWTgrUtjajYxEprErKi4nXC9N9zVUDVLVIwREyMaOPAa mq/nZWmp0jTQGe0oykHb0ESymX+xiOhc0mF1mV2IFjGoxii+me9ftFAyKIC1BxrklSIH JKADiJ/e4DjshWaNErF90Dc4cPYF9KMAgwQ3XI0JkpHLkNTF3ZP7mVOyW1hh7a243XSC 52f3ojjGqeJ4SyecUJGjqtLTwMzzY9K/Ews3Cmjgh93+CRhCKWz6sykWWGMuhOEW9WKg bnYQ== 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=PBwivsX+CNRca4Tf4iFbEeHQqaqr2duXLo8VWx6ckBY=; b=YjK0+vGnpsVlzD+pH+9QDRwvLetM8drtkUbU3g5GrfZOtJGURdNm91z6IfT8sJSVGA ID0PcNFcli+Cq1qllXnPlgDIGaGD1WVl6pNvO4odsV1cjS7VpMvcarUEzVpZXeynXCqQ deoMYbgzMQg8g51Lqlr7L75ulJ44CSc6TsSEykg058GdA+RCpJlgYthbG7PQW/3kaRpm KY3T6Jdsl7+Hxh2PS+0JCVhlMyADZ4zBDfxpcOB4Aqg6t8pGAbOyX5rkirjpjcIDJ+Io O3tLKgc6PO9TtESIRo3mMIM2QhSEPa4fPYuz6ENqtpe6bNc+cUXZcRp+WKdxml4X6j+k i3GQ== X-Gm-Message-State: AOAM5335xNDTzvjU+TFfhibH/qOpnllJLBW97dIR+qECAy8cM7GrVsAk GGLKdXIU7QX66gA4dUKE+4JwHvdW1JQ8Fg== X-Google-Smtp-Source: ABdhPJwgJLqZDW0P9rFAKnoaaNw0ptnwuBI17vsoBCwpGSSETnnxJKqeDBnodrnyE6yRJWc+AC2E2HL1XQKPnQ== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:903:244a:b0:158:558c:2227 with SMTP id l10-20020a170903244a00b00158558c2227mr7843714pls.121.1649696329961; Mon, 11 Apr 2022 09:58:49 -0700 (PDT) Date: Mon, 11 Apr 2022 09:58:41 -0700 In-Reply-To: <20220411165842.3912945-1-wuhaotsh@google.com> Message-Id: <20220411165842.3912945-2-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220411165842.3912945-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v2 1/2] hw/misc: Add PWRON STRAP bit fields in GCR module From: Hao Wu To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, Uri.Trichter@nuvoton.com, Vishal.Soni@microsoft.com, titusr@google.com Received-SPF: pass client-ip=2607:f8b0:4864:20::44a; envelope-from=3SV5UYggKCnAkiVOchgVUccUZS.QcaeSai-RSjSZbcbUbi.cfU@flex--wuhaotsh.bounces.google.com; helo=mail-pf1-x44a.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, T_SCC_BODY_TEXT_LINE=-0.01, 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Similar to the Aspeed code in include/misc/aspeed_scu.h, we define the PWRON STRAP fields in their corresponding module for NPCM7XX. Signed-off-by: Hao Wu Reviewed-by: Patrick Venture --- include/hw/misc/npcm7xx_gcr.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/include/hw/misc/npcm7xx_gcr.h b/include/hw/misc/npcm7xx_gcr.h index 13109d9d32..9419e0a7d2 100644 --- a/include/hw/misc/npcm7xx_gcr.h +++ b/include/hw/misc/npcm7xx_gcr.h @@ -19,6 +19,36 @@ #include "exec/memory.h" #include "hw/sysbus.h" +/* + * NPCM7XX PWRON STRAP bit fields + * 12: SPI0 powered by VSBV3 at 1.8V + * 11: System flash attached to BMC + * 10: BSP alternative pins. + * 9:8: Flash UART command route enabled. + * 7: Security enabled. + * 6: HI-Z state control. + * 5: ECC disabled. + * 4: Reserved + * 3: JTAG2 enabled. + * 2:0: CPU and DRAM clock frequency. + */ +#define NPCM7XX_PWRON_STRAP_SPI0F18 BIT(12) +#define NPCM7XX_PWRON_STRAP_SFAB BIT(11) +#define NPCM7XX_PWRON_STRAP_BSPA BIT(10) +#define NPCM7XX_PWRON_STRAP_FUP(x) ((x) << 8) +#define FUP_NORM_UART2 3 +#define FUP_PROG_UART3 2 +#define FUP_PROG_UART2 1 +#define FUP_NORM_UART3 0 +#define NPCM7XX_PWRON_STRAP_SECEN BIT(7) +#define NPCM7XX_PWRON_STRAP_HIZ BIT(6) +#define NPCM7XX_PWRON_STRAP_ECC BIT(5) +#define NPCM7XX_PWRON_STRAP_RESERVE1 BIT(4) +#define NPCM7XX_PWRON_STRAP_J2EN BIT(3) +#define NPCM7XX_PWRON_STRAP_CKFRQ(x) (x) +#define CKFRQ_SKIPINIT 0x000 +#define CKFRQ_DEFAULT 0x111 + /* * Number of registers in our device state structure. Don't change this without * incrementing the version_id in the vmstate. From patchwork Mon Apr 11 16:58:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 1615855 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20210112 header.b=B39V3slg; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4KcZrG55QFz9sBy for ; Tue, 12 Apr 2022 03:01:18 +1000 (AEST) Received: from localhost ([::1]:49280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ndxPg-0000Qt-NV for incoming@patchwork.ozlabs.org; Mon, 11 Apr 2022 13:01:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3S15UYggKCnImkXQejiXWeeWbU.SecgUck-TUlUbdedWdk.ehW@flex--wuhaotsh.bounces.google.com>) id 1ndxNP-00083u-L9 for qemu-devel@nongnu.org; Mon, 11 Apr 2022 12:58:55 -0400 Received: from mail-pf1-x44a.google.com ([2607:f8b0:4864:20::44a]:56255) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3S15UYggKCnImkXQejiXWeeWbU.SecgUck-TUlUbdedWdk.ehW@flex--wuhaotsh.bounces.google.com>) id 1ndxNO-0004fO-6E for qemu-devel@nongnu.org; Mon, 11 Apr 2022 12:58:55 -0400 Received: by mail-pf1-x44a.google.com with SMTP id b6-20020a62a106000000b0050564d6fd75so8030259pff.22 for ; Mon, 11 Apr 2022 09:58:52 -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=qyMPJ6xtni4CPueSJJimY/QkTKyBJ5F14NdMy+cqp+8=; b=B39V3slg9wN+lxmY5FrWGrQGZLcqV593IP6SFzGYV5Vs7fk6HD/d1ZJgA6kPYDvSe1 j9t42kgpoo7NVjoDA2pp9rnvzkS9sXfA7Tw13XUdeiysloBf58Z2BaP/kSpUXu/4u12y 2vwD/SKQKpd/Bw1dvFYUtnuqPMrrX3GdXtjKDj4g5U1oOnw5p0HMw7oFZa3IrGR+TqN2 yBm8tJEwmrIYs21r1X/MGWI4haR6edjvjfDwgw8ASdVK+H8CLjtRNFUVs++dKwdB3mdQ WhUFAT3Kp6cEpjGJQEgWGSe4nP5qaF+m1Rw8alWrepEnT4wHMPOsNTURjK6P7z74dvlo C17w== 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=qyMPJ6xtni4CPueSJJimY/QkTKyBJ5F14NdMy+cqp+8=; b=MtB5dKNa6CYcpvhSBtof0EBBjSGOVLDQ2YUggqLpxtkpkMeSonIJRt5FNoVWnyYuzN cz+p98YqqaVVHCAeIV5Y4cHAvDT3iaMDEmVUKBt3cSk6HeExZiSZ0pI3rX7nrOgV+v4F RWECdZjIrifw9mgT7kOez3KhAzHy4yicKZ8SZPX2LBYE1HetLj1NirOxuE1yo4wXh5t+ 0e7q/wpYjRCY5ftz/+EPAh9TwAl5d4W5UjreY59ICY3a6dhW1AtWKKrmmyuZJlRYwPjc u+ullDSk2vy4Bmx1iLfH8zduNIt0M5iOaQ/Hwyi/3E9HyTef/HJ8DKpYWZoSdpNfALUA /9Pw== X-Gm-Message-State: AOAM5303Pga2Q/gApka5zikDSQ9DJF+r1hDMxXNWxZxlFy8sy4y/af7r VwP7PsjGQX0YAhcl1iS9/w4UA+nuxWeQrw== X-Google-Smtp-Source: ABdhPJxM8aRNZjubf8xCGz+LmcBpH3jZh+0LCNUiEO7fLXyBoZcce9pMkcleo7uncCSq8+smbJor01fCwPl8sA== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a17:902:ea4f:b0:158:5013:1403 with SMTP id r15-20020a170902ea4f00b0015850131403mr8850862plg.75.1649696331863; Mon, 11 Apr 2022 09:58:51 -0700 (PDT) Date: Mon, 11 Apr 2022 09:58:42 -0700 In-Reply-To: <20220411165842.3912945-1-wuhaotsh@google.com> Message-Id: <20220411165842.3912945-3-wuhaotsh@google.com> Mime-Version: 1.0 References: <20220411165842.3912945-1-wuhaotsh@google.com> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog Subject: [PATCH v2 2/2] hw/arm: Use bit fields for NPCM7XX PWRON STRAPs From: Hao Wu To: peter.maydell@linaro.org Cc: qemu-arm@nongnu.org, qemu-devel@nongnu.org, wuhaotsh@google.com, venture@google.com, Avi.Fishman@nuvoton.com, kfting@nuvoton.com, hskinnemoen@google.com, Uri.Trichter@nuvoton.com, Vishal.Soni@microsoft.com, titusr@google.com Received-SPF: pass client-ip=2607:f8b0:4864:20::44a; envelope-from=3S15UYggKCnImkXQejiXWeeWbU.SecgUck-TUlUbdedWdk.ehW@flex--wuhaotsh.bounces.google.com; helo=mail-pf1-x44a.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, T_SCC_BODY_TEXT_LINE=-0.01, UPPERCASE_50_75=0.008, USER_IN_DEF_DKIM_WL=-7.5 autolearn=no 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This patch uses the defined fields to describe PWRON STRAPs for better readability. Signed-off-by: Hao Wu Reviewed-by: Patrick Venture --- hw/arm/npcm7xx_boards.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 0678a56156..6bc6f5d2fe 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -30,11 +30,25 @@ #include "sysemu/sysemu.h" #include "sysemu/block-backend.h" -#define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 -#define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff -#define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff -#define KUDO_BMC_POWER_ON_STRAPS 0x00001fff -#define MORI_BMC_POWER_ON_STRAPS 0x00001fff +#define NPCM7XX_POWER_ON_STRAPS_DEFAULT ( \ + NPCM7XX_PWRON_STRAP_SPI0F18 | \ + NPCM7XX_PWRON_STRAP_SFAB | \ + NPCM7XX_PWRON_STRAP_BSPA | \ + NPCM7XX_PWRON_STRAP_FUP(FUP_NORM_UART2) | \ + NPCM7XX_PWRON_STRAP_SECEN | \ + NPCM7XX_PWRON_STRAP_HIZ | \ + NPCM7XX_PWRON_STRAP_ECC | \ + NPCM7XX_PWRON_STRAP_RESERVE1 | \ + NPCM7XX_PWRON_STRAP_J2EN | \ + NPCM7XX_PWRON_STRAP_CKFRQ(CKFRQ_DEFAULT)) + +#define NPCM750_EVB_POWER_ON_STRAPS ( \ + NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_J2EN) +#define QUANTA_GSJ_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT +#define QUANTA_GBS_POWER_ON_STRAPS ( \ + NPCM7XX_POWER_ON_STRAPS_DEFAULT & ~NPCM7XX_PWRON_STRAP_SFAB) +#define KUDO_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT +#define MORI_BMC_POWER_ON_STRAPS NPCM7XX_POWER_ON_STRAPS_DEFAULT static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin";