From nobody Wed Apr 16 11:56:18 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail header.i=@wdc.com; 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=fail(p=none dis=none) header.from=wdc.com ARC-Seal: i=1; a=rsa-sha256; t=1599762143; cv=none; d=zohomail.com; s=zohoarc; b=ebp/glOtQRBxJ+xeudvBSUlpmQya5ijlGLZJ2cBuPh8c5doagyDgdAq+vD3mflK9OV0iiYfEmyp8iKaXqL6bgVUuLW/OCfpaQ7hURLVWV0+l4WUvOePXsl5NySITQq2sy2n8DYKwlToEDaIGztw98eU8C4oQkArCaa4UHcenPfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599762143; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ZJK1QZyovJHHadr6GAe2lRepkfwXzDmHlA/+K3QVObU=; b=iztp9fCOSRUoWSHWvNWTPKPAjpkiuD8YP5hoyZA3l1ZNZXnBNal5SVOHVoLKq5a8lQTvvrSjSGnq7uCNVsXM9F1d/59yPlk8JO0/nSyUcm7IZabN+A2rgoorOA7X5LLjjUKKOfwrVIsLS1QohbTGMUSVKoGVjno/tUUsxqXY9Jw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail header.i=@wdc.com; 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=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1599762143865199.97904859780795; Thu, 10 Sep 2020 11:22:23 -0700 (PDT) Received: from localhost ([::1]:55024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGRDC-00065X-FX for importer@patchew.org; Thu, 10 Sep 2020 14:22:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57250) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGRBd-0004Be-CW for qemu-devel@nongnu.org; Thu, 10 Sep 2020 14:20:45 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:28245) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGRBb-0002iJ-5Q for qemu-devel@nongnu.org; Thu, 10 Sep 2020 14:20:44 -0400 Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 11 Sep 2020 02:20:18 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Sep 2020 11:07:35 -0700 Received: from fwvkpc2.ad.shared (HELO risc6-mainframe.hgst.com) ([10.86.59.152]) by uls-op-cesaip01.wdc.com with ESMTP; 10 Sep 2020 11:20:18 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1599762042; x=1631298042; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X+EkLTge760E+RaPCXwiMO6C6k1oJWh6jTaQjwKLj7g=; b=n4G/bSZrYsd3Y/A7lJk1yVo7EykEgm15LpFx+ctVBlEmFmbTqgRGFrwl bVkDg2X+KJqfK7DmbJWoLeyfkO53jHHt9V+4o/o3I0/FdHZ88EfI3Axcy XcduLpbrubqU/FyLWv9uqaWejEGVxu3YS5xkDn6oEosWip1gAI9NardOM rBkOgn3yeU4fuMAYIFhtyXSDqy+rU1CTQOwCuaxBbDw+RW2r+vUH40yJw JK7ABZoRqtEqXpPP72h/seOmai4r8QB/7c9NDINGS6GT8mltvZaXXqq6/ izZYtI4fFEEw8K58bGOYDb/Uc0+AbsLgOdLwI8dU4VsDo2iD8bLXD427G g==; IronPort-SDR: /duqkYYr9twEa3AjHGR1sv+IdAg16zyju0M1WtpHEE+X4EkgOhPrkR3nFzPib9TLA7WxSPE3xB WyRjba/U/L5HvuDlcNW4Sx22jKL5IlDgq/KntTuBdrSyUW0k2yzKQ0Vn1bjz7OM0RpNhjYTkX6 BdM65mDgvVrc3+f11BqZ71Y+qK3zgb1yzNjNIGvsI/qL7W/HWWrQm/qmZqM7JH+pK+kFvW9vdY 23IQ5vsVGDLQITGo5RSX05ihA9HV01dltyDrRm9RVYe2kpOqY6IF95oM830qhXEVg6cBnZhVsW 8ow= X-IronPort-AV: E=Sophos;i="5.76,413,1592841600"; d="scan'208";a="146979231" IronPort-SDR: OAygfP0Eyx339KpVQKiaLMGea58xaNDfYVNw5/6OCTseZ88KbZTCgD+DCoGxyu05fcCEfgBDpg YXHW5jBU8hXw== IronPort-SDR: VqDL/9PMDiUi/0HXZv6BcVzuDw6DFmZVkkm7Im9LnaAA+quezsPYOOO+DkZEmStkD9X/iUFSt9 LJk8flnGNLhg== WDCIronportException: Internal From: Alistair Francis To: peter.maydell@linaro.org, qemu-devel@nongnu.org Subject: [PULL 13/30] hw/net: cadence_gem: Add a new 'phy-addr' property Date: Thu, 10 Sep 2020 11:09:21 -0700 Message-Id: <20200910180938.584205-14-alistair.francis@wdc.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200910180938.584205-1-alistair.francis@wdc.com> References: <20200910180938.584205-1-alistair.francis@wdc.com> 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=216.71.154.42; envelope-from=prvs=515d47f05=alistair.francis@wdc.com; helo=esa4.hgst.iphmx.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/10 14:20:04 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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_MED=-2.3, 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: "Edgar E . Iglesias" , alistair23@gmail.com, Bin Meng , Alistair Francis , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Bin Meng At present the PHY address of the PHY connected to GEM is hard-coded to either 23 (BOARD_PHY_ADDRESS) or 0. This might not be the case for all boards. Add a new 'phy-addr' property so that board can specify the PHY address for each GEM instance. Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Edgar E. Iglesias Reviewed-by: Alistair Francis Message-Id: <1598924352-89526-12-git-send-email-bmeng.cn@gmail.com> Signed-off-by: Alistair Francis --- include/hw/net/cadence_gem.h | 2 ++ hw/net/cadence_gem.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/hw/net/cadence_gem.h b/include/hw/net/cadence_gem.h index 54e646ff79..01c6189a24 100644 --- a/include/hw/net/cadence_gem.h +++ b/include/hw/net/cadence_gem.h @@ -73,6 +73,8 @@ typedef struct CadenceGEMState { /* Mask of register bits which are write 1 to clear */ uint32_t regs_w1c[CADENCE_GEM_MAXREG]; =20 + /* PHY address */ + uint8_t phy_addr; /* PHY registers backing store */ uint16_t phy_regs[32]; =20 diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c index a93b5c07ce..d80096bbe8 100644 --- a/hw/net/cadence_gem.c +++ b/hw/net/cadence_gem.c @@ -1446,7 +1446,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset,= unsigned size) uint32_t phy_addr, reg_num; =20 phy_addr =3D (retval & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR= _SHFT; - if (phy_addr =3D=3D BOARD_PHY_ADDRESS || phy_addr =3D=3D 0) { + if (phy_addr =3D=3D s->phy_addr || phy_addr =3D=3D 0) { reg_num =3D (retval & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_RE= G_SHIFT; retval &=3D 0xFFFF0000; retval |=3D gem_phy_read(s, reg_num); @@ -1569,7 +1569,7 @@ static void gem_write(void *opaque, hwaddr offset, ui= nt64_t val, uint32_t phy_addr, reg_num; =20 phy_addr =3D (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SH= FT; - if (phy_addr =3D=3D BOARD_PHY_ADDRESS || phy_addr =3D=3D 0) { + if (phy_addr =3D=3D s->phy_addr || phy_addr =3D=3D 0) { reg_num =3D (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_S= HIFT; gem_phy_write(s, reg_num, val); } @@ -1682,6 +1682,7 @@ static Property gem_properties[] =3D { DEFINE_NIC_PROPERTIES(CadenceGEMState, conf), DEFINE_PROP_UINT32("revision", CadenceGEMState, revision, GEM_MODID_VALUE), + DEFINE_PROP_UINT8("phy-addr", CadenceGEMState, phy_addr, BOARD_PHY_ADD= RESS), DEFINE_PROP_UINT8("num-priority-queues", CadenceGEMState, num_priority_queues, 1), DEFINE_PROP_UINT8("num-type1-screeners", CadenceGEMState, --=20 2.28.0