From nobody Thu Nov 14 18:09:37 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1708906338; cv=none; d=zohomail.com; s=zohoarc; b=dM4coP5jHBQv6Z5QNmtZZPGp/wxm/eYnFDSeKLvYwMpBszni61+yz1yyUw3J3Hvsk63zA//wVxtU9m1/IFpEjyw7gqbmp4sKrKvqD2yYwl55VTdkQVpbWAZpCWnBWTqnBiyUv3gSfpR9eTfYJI8rA1cnDKXmLNusK9udJZDmTfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1708906338; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Xkr/gnxxaICGpe6iHiYAh3AvCqlJB8T1ravIgTidKoY=; b=VYfAmzr3MLdT0Ve2K6LXUJ2rpP3JyrhVx7i++drK0bwJ0HfubFQEi6lb4ZIZ6h8bSP8nM98r+bJO3QIvM6WmrUE4zlGIPK4drjkra3/BMiYHERt3UqDI0lZNj7Twb7SEFfFAv3TWXYfLxtR2gvo5PMtgyYlpPTh3geSDrPhK8wg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1708906338575661.9620102433142; Sun, 25 Feb 2024 16:12:18 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1reOT2-0006n4-8O; Sun, 25 Feb 2024 19:03:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1reOSx-0006iT-FU; Sun, 25 Feb 2024 19:03:31 -0500 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1reOSu-0000QN-EI; Sun, 25 Feb 2024 19:03:31 -0500 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-608ceccb5f4so6893437b3.3; Sun, 25 Feb 2024 16:03:27 -0800 (PST) Received: from localhost.localdomain ([201.203.117.224]) by smtp.gmail.com with ESMTPSA id t18-20020a818312000000b00607bfa1913csm938171ywf.114.2024.02.25.16.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 16:03:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708905807; x=1709510607; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xkr/gnxxaICGpe6iHiYAh3AvCqlJB8T1ravIgTidKoY=; b=arHznQsQywhn+jjncR4R0hdYjX8yUG7EMOCI7NnKGqw328o4ZLFoBjijkcmJL2zuq0 OR5OKHWmlWXu4Ec2fzirXGrMFAaRKXWwT7opLdGOPmTxBH2YDJQl91cMMagFAFq/2EoK wZUgxNrtMVikjAsEKCUl7XL01u3uTDNR2eE1W3wieeSj5+Gamzqh842yACMyEgDpKusy j4USoIpYVJsUd6QzA6fC/jF7UlaBMnZm9fl8aEG+KFNZjlmHMAbcSNjDUjLxarGxcFb0 C+vNut76RtmbdgFcYuT2Zq93bIFsTCemykKTBnm4uBBgkbzdHDttaxUfOxs7xZAuG1oX VPSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708905807; x=1709510607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xkr/gnxxaICGpe6iHiYAh3AvCqlJB8T1ravIgTidKoY=; b=D1Ls2rxIYv7vztg668pif2tfwuWguJqHKc1veQxORHIbg5Rombbhd409PRsLWL0TQZ meJFByySKcqyeP4gxpWCYK1cu2E67/O6JlbXH5dmpr/P0gydULoJCDIAIjhOhQ34C+2c RsrR093yl1mX6ByC6/KmhwNJBbkuUH+RsR832aKRQlicj4iaproWT4IMtCB6IJR9RB8s svBNGcSePE4DCuAvxrY4d9+dGE8yyzXSp0xlQEVjUrAnCHyvNT9nRXvIkDmQW3eUVwzt kHE3hqKWHjJiNH0WuyRtVKoFzkg0Wpi7Q3X335moinLxPG22UM1DVbkECHRNnfqpEdD8 P56g== X-Gm-Message-State: AOJu0YxCD5G6YdQgTzVzylfD6CJe2ql+iqzOhlmcIeqetRD8vDVY2/nN j0LxLJjzhRzdfmDFAmuMbUqh86Rk9ptYRaEd0dcR9TLnd2NikUep4Zzkry9EzxY12Q== X-Google-Smtp-Source: AGHT+IHlsUl3W26nc1BmWA+UaaEi1VebaB83ILVTKlmNY6HazXKnTh9EKO4ykjwPeC/phjTz7VJZig== X-Received: by 2002:a81:b145:0:b0:607:899a:7fb8 with SMTP id p66-20020a81b145000000b00607899a7fb8mr4852677ywh.14.1708905806604; Sun, 25 Feb 2024 16:03:26 -0800 (PST) From: Sergey Kambalin X-Google-Original-From: Sergey Kambalin To: qemu-arm@nongnu.org Cc: qemu-devel@nongnu.org, Sergey Kambalin Subject: [PATCH v6 20/41] Add GENET register structs. Part 1 Date: Sun, 25 Feb 2024 18:02:38 -0600 Message-Id: <20240226000259.2752893-21-sergey.kambalin@auriga.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226000259.2752893-1-sergey.kambalin@auriga.com> References: <20240226000259.2752893-1-sergey.kambalin@auriga.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::112f; envelope-from=serg.oker@gmail.com; helo=mail-yw1-x112f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1708906339794100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Sergey Kambalin --- hw/net/bcm2838_genet.c | 37 ++++++++++++++++ include/hw/net/bcm2838_genet.h | 77 +++++++++++++++++++++++++++++++++- 2 files changed, 113 insertions(+), 1 deletion(-) diff --git a/hw/net/bcm2838_genet.c b/hw/net/bcm2838_genet.c index 4420486e00..0d98d1b30e 100644 --- a/hw/net/bcm2838_genet.c +++ b/hw/net/bcm2838_genet.c @@ -15,9 +15,46 @@ #include "hw/irq.h" #include "net/checksum.h" #include "sysemu/dma.h" +#include "hw/registerfields.h" #include "hw/net/bcm2838_genet.h" #include "trace.h" =20 +REG32(GENET_SYS_REV_CTRL, 0) +FIELD(GENET_SYS_REV_CTRL, GPHY_REV, 0, 16) +FIELD(GENET_SYS_REV_CTRL, MINOR_REV, 16, 4) +FIELD(GENET_SYS_REV_CTRL, RSVD_20_23, 20, 4) +FIELD(GENET_SYS_REV_CTRL, MAJOR_REV, 24, 4) +FIELD(GENET_SYS_REV_CTRL, RSVD_28_31, 28, 4) + +REG32(GENET_INTRL_0, 0) +FIELD(GENET_INTRL_0, SCB, 0, 1) +FIELD(GENET_INTRL_0, EPHY, 1, 1) +FIELD(GENET_INTRL_0, PHY_DET_R, 2, 1) +FIELD(GENET_INTRL_0, PHY_DET_F, 3, 1) +FIELD(GENET_INTRL_0, LINK_UP, 4, 1) +FIELD(GENET_INTRL_0, LINK_DOWN, 5, 1) +FIELD(GENET_INTRL_0, UMAC, 6, 1) +FIELD(GENET_INTRL_0, UMAC_TSV, 7, 1) +FIELD(GENET_INTRL_0, TBUF_UNDERRUN, 8, 1) +FIELD(GENET_INTRL_0, RBUF_OVERFLOW, 9, 1) +FIELD(GENET_INTRL_0, HFB_SM, 10, 1) +FIELD(GENET_INTRL_0, HFB_MM, 11, 1) +FIELD(GENET_INTRL_0, MPD_R, 12, 1) +FIELD(GENET_INTRL_0, RXDMA_MBDONE, 13, 1) +FIELD(GENET_INTRL_0, RXDMA_PDONE, 14, 1) +FIELD(GENET_INTRL_0, RXDMA_BDONE, 15, 1) +FIELD(GENET_INTRL_0, TXDMA_MBDONE, 16, 1) +FIELD(GENET_INTRL_0, TXDMA_PDONE, 17, 1) +FIELD(GENET_INTRL_0, TXDMA_BDONE, 18, 1) +FIELD(GENET_INTRL_0, RSVD_19_22, 19, 4) +FIELD(GENET_INTRL_0, MDIO_DONE, 23, 1) +FIELD(GENET_INTRL_0, MDIO_ERROR, 24, 1) +FIELD(GENET_INTRL_0, RSVD_25_31, 25, 4) + +REG32(GENET_INTRL_1, 0) +FIELD(GENET_INTRL_1, TX_INTRS, 0, 16) +FIELD(GENET_INTRL_1, RX_INTRS, 16, 16) + =20 static uint64_t bcm2838_genet_read(void *opaque, hwaddr offset, unsigned s= ize) { diff --git a/include/hw/net/bcm2838_genet.h b/include/hw/net/bcm2838_genet.h index d166a5c24c..f583818399 100644 --- a/include/hw/net/bcm2838_genet.h +++ b/include/hw/net/bcm2838_genet.h @@ -19,7 +19,82 @@ OBJECT_DECLARE_SIMPLE_TYPE(BCM2838GenetState, BCM2838_GE= NET) #define BCM2838_GENET_REV_MINOR 0 =20 typedef struct { - uint8_t stub_area[0x10000]; /* temporary stub */ + uint32_t rev_ctrl; + uint32_t port_ctrl; + uint32_t rbuf_flush_ctrl; + uint32_t tbuf_flush_ctrl; + uint32_t reserved_0x10[12]; +} BCM2838GenetRegsSys; + +typedef struct { + uint32_t reserved_0x0[16]; +} BCM2838GenetRegsGrBridge; + +typedef struct { + uint32_t pwr_mgmt; + uint32_t reserved_0x4[2]; + uint32_t rgmii_oob_ctrl; + uint32_t reserved_0x10[3]; + uint32_t gphy_ctrl; + uint32_t reserved_0x20[24]; +} BCM2838GenetRegsExt; + +typedef struct { + uint32_t stat; + uint32_t set; + uint32_t clear; + uint32_t mask_status; + uint32_t mask_set; + uint32_t mask_clear; + uint32_t reserved_0x18[10]; +} BCM2838GenetRegsIntrl0; + +typedef struct { + uint32_t stat; + uint32_t set; + uint32_t clear; + uint32_t mask_status; + uint32_t mask_set; + uint32_t mask_clear; + uint32_t reserved_0x18[10]; +} BCM2838GenetRegsIntrl1; + +typedef struct { + uint32_t ctrl; + uint32_t reserved_0x4[2]; + uint32_t status; + uint32_t reserved_0x10; + uint32_t chk_ctrl; + uint32_t reserved_0x18[31]; + uint32_t ovfl_cnt; + uint32_t err_cnt; + uint32_t energy_ctrl; + uint32_t reserved_0xA0[5]; + uint32_t size_ctrl; + uint32_t reserved_0xB8[18]; +} BCM2838GenetRegsRbuf; + +typedef struct { + uint32_t ctrl; + uint32_t reserved_0x4[2]; + uint32_t bp_mc; + uint32_t reserved_0x10; + uint32_t energy_ctrl; + uint32_t reserved_0x18[58]; +} BCM2838GenetRegsTbuf; + +typedef struct { + BCM2838GenetRegsSys sys; + BCM2838GenetRegsGrBridge gr_bridge; + BCM2838GenetRegsExt ext; + uint32_t reserved_0x100[64]; + BCM2838GenetRegsIntrl0 intrl0; + BCM2838GenetRegsIntrl1 intrl1; + uint32_t reserved_0x280[32]; + BCM2838GenetRegsRbuf rbuf; + uint32_t reserved_0x400[128]; + BCM2838GenetRegsTbuf tbuf; + uint32_t reserved_0x700[64]; } BCM2838GenetRegs; =20 struct BCM2838GenetState { --=20 2.34.1