From nobody Sat Nov 23 22:25:05 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=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1730847343; cv=none; d=zohomail.com; s=zohoarc; b=SKus7m31dI1O5GE1SkK7yf5cgPjEwiKFOJ2menaEKAHBLe3Tgf8B4IpUBWuNJpql092Ek7ScrNmt/fn+nBtpchiWhJ+gh4DbToxtDf4G1ihOnjMwkKjLWDTQJ2PZgTpNaK6+/RPQSdVEKzMGFUPgD18gUoiU1v79/jgZlM/J0Ac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1730847343; h=Content-Type: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=eNVUy4JgphlrUnvvw1fKIDJ/0JALMaFzf/fcxiUPpvE=; b=K/uKDFv5WyL0OA4ZFic0DeWuDyfqebKBnXiYxsdZnBRuWq3UdTXW0BzWacAs6LavB8uRt9ZeqOXOGPI+7YHTwXTiP2UrCLbOAUMSlZcZwMooD86WCEQyUr5lh73y235hkqkJgzkG24WeQQmP/WUuJWDb97ggeCzjvJRymqcuytk= 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 1730847343708642.9374963440666; Tue, 5 Nov 2024 14:55:43 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t8SMd-0007zv-Nk; Tue, 05 Nov 2024 17:49:31 -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 1t8SMS-00076h-Jt for qemu-devel@nongnu.org; Tue, 05 Nov 2024 17:49:20 -0500 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t8SMR-0004Nf-2O for qemu-devel@nongnu.org; Tue, 05 Nov 2024 17:49:20 -0500 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-37d5689eea8so3512574f8f.1 for ; Tue, 05 Nov 2024 14:49:18 -0800 (PST) Received: from localhost.localdomain ([89.101.134.25]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381c113e89csm17544092f8f.74.2024.11.05.14.49.15 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 05 Nov 2024 14:49:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1730846957; x=1731451757; 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=eNVUy4JgphlrUnvvw1fKIDJ/0JALMaFzf/fcxiUPpvE=; b=vB9CFDACv3KAJbPfRF12S/3m6j1Vv3TB36857KQh7RBTZEJftfYu6H8fP2pLl/WEov W2Q+lO8amjWxYxMMDZfpDfTg3B83yUXdJUPAMJoKRzDwQEPidApS+N6nbxSqJsV9Ll+f 3yQR97TggCPDMfqPuXS8C0GzYoWDcxMKv7M6/9X2YSsKQ4ZGJxRqgdcF4f8pXSviiVEX jbQGMhBMG8xBFz4G3axTvmdAyN6X2emy8YfROYvn7kf54vGbjkku4vvpavDDZ9CVdGf2 dBKAnIVWfNy1nKKDmHdKM2PG1E7t1qRTd0Diaz2QVCgkyf7U6BKoFc/lWgHL/ZgL9LS4 9ITw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730846957; x=1731451757; 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=eNVUy4JgphlrUnvvw1fKIDJ/0JALMaFzf/fcxiUPpvE=; b=UxgzD9DCrvXYlJPWf5qJ35l4HvxLAemp+7dHH5/hllxk3r+nKto4wzN0CLL9jNNCwl VoBA3hx6TwI1z/soLznMpvuJqsBRGsEuiVJcBzpTGn761ejidpCvVkZWFzfAXj95bT1K 3W2hRRx6ZTOrOx2Y1475kN/by09gjTzUjifqGReuDw/ngR13ms7GjJF9bv1YSNcHMbOo 8uLDzmtq8BFOMAGO2TnynGzxEt6SG9xxZLnUWgpFURNWpBiPYFdrnpWxVuJwXxHvReXe sovIXP3cDecEiGNIzyh9Yca6cP5Bf/jUg4wJkI3m9mWM6gfuVkjL6ic7lGkNqDTXR1H+ 5Qkg== X-Gm-Message-State: AOJu0YwnAN9V5mXHOwKeSPj4VAUNUbc/Ih76LpbBQT/rTOos1br8SEjI FQctYrY+F0qA7FlBIAz23fMWCJUY1zN5Mtrl6SF/pOkPtJmxXrHZ7GWyWjQK6A9dNpX5DxNexA7 gRFC7Vw== X-Google-Smtp-Source: AGHT+IFX/i8Y2/aITtVswh6KioWeOJyX64NZgkefgOuURl2kJ+Ef6o1R9eeeIrbDNNqdJ6KDX6e58g== X-Received: by 2002:adf:face:0:b0:37d:481e:fd3 with SMTP id ffacd0b85a97d-38061162b6emr23714906f8f.26.1730846957330; Tue, 05 Nov 2024 14:49:17 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Bernhard Beschow , Akihiko Odaki , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PULL 20/29] hw/net/fsl_etsec/miim: Reuse MII constants Date: Tue, 5 Nov 2024 22:47:18 +0000 Message-ID: <20241105224727.53059-21-philmd@linaro.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241105224727.53059-1-philmd@linaro.org> References: <20241105224727.53059-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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=2a00:1450:4864:20::42b; envelope-from=philmd@linaro.org; helo=mail-wr1-x42b.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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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.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 @linaro.org) X-ZM-MESSAGEID: 1730847344693116600 From: Bernhard Beschow Instead of defining redundant constants and using magic numbers reuse the existing MII constants. Signed-off-by: Bernhard Beschow cc: Akihiko Odaki Reviewed-by: Akihiko Odaki Message-ID: <20241103133412.73536-16-shentey@gmail.com> Signed-off-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/fsl_etsec/miim.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/hw/net/fsl_etsec/miim.c b/hw/net/fsl_etsec/miim.c index b48d2cb57bd..4e9169907a9 100644 --- a/hw/net/fsl_etsec/miim.c +++ b/hw/net/fsl_etsec/miim.c @@ -29,13 +29,6 @@ =20 /* #define DEBUG_MIIM */ =20 -#define MIIM_CONTROL 0 -#define MIIM_STATUS 1 -#define MIIM_PHY_ID_1 2 -#define MIIM_PHY_ID_2 3 -#define MIIM_T2_STATUS 10 -#define MIIM_EXT_STATUS 15 - static void miim_read_cycle(eTSEC *etsec) { uint8_t phy; @@ -47,14 +40,14 @@ static void miim_read_cycle(eTSEC *etsec) addr =3D etsec->regs[MIIMADD].value & 0x1F; =20 switch (addr) { - case MIIM_CONTROL: + case MII_BMCR: value =3D etsec->phy_control; break; - case MIIM_STATUS: + case MII_BMSR: value =3D etsec->phy_status; break; - case MIIM_T2_STATUS: - value =3D 0x1800; /* Local and remote receivers OK */ + case MII_STAT1000: + value =3D MII_STAT1000_LOK | MII_STAT1000_ROK; break; default: value =3D 0x0; @@ -84,8 +77,8 @@ static void miim_write_cycle(eTSEC *etsec) #endif =20 switch (addr) { - case MIIM_CONTROL: - etsec->phy_control =3D value & ~(0x8100); + case MII_BMCR: + etsec->phy_control =3D value & ~(MII_BMCR_RESET | MII_BMCR_FD); break; default: break; --=20 2.45.2