From patchwork Fri Feb 3 14:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 650069 Delivered-To: patch@linaro.org Received: by 2002:a17:522:d8c:b0:4be:c3dc:14d8 with SMTP id d12csp862795pva; Fri, 3 Feb 2023 06:56:40 -0800 (PST) X-Google-Smtp-Source: AK7set+6b9heKoxEsDdqjuNpukW6GHKRIiz2HgO1cQ92f1Rd5LsOvw+73mggeT6IXpx1Yn4rrUWQ X-Received: by 2002:a05:622a:1206:b0:3b8:2844:b7e1 with SMTP id y6-20020a05622a120600b003b82844b7e1mr19612259qtx.46.1675436200084; Fri, 03 Feb 2023 06:56:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675436200; cv=none; d=google.com; s=arc-20160816; b=bCFN4+LtHSEAGsWqh724N0S0UE/Hldx5HaUe5Ivy9BLTCmIqyOeDVVDd2qbaFnWMNf yt0Q+Ct5Wt4faJdiNGjcvoBjs4b3bwNRdDz97uanb0rL1S1eI0esi+jbgnEyorcnS55E BqTpYeoA+yT3Gzma1dCUfDKfpDSsR4+KSHV5cg4SFvemVdWbLL2rkMhSuZkQgopJ79XC xFXAjPNoY8E0ILmkVBkEWazikv91umOQdAHxWdYcq/Ojrw5LII4q9noDt7Jt2C9uiGp6 OFPBSX80T3bwVO5g22ftfi0WC3DisKhiKh1RPeK92uyjs6asnDIgNahxLlDTkZdqNaiH 0WkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=f2kBLJKaVnGetSSqtxpfAhCXISkwd1yaz8QImmDemGM=; b=e1dgJzT82tfHZOF7NaHE67DauegPa6TpZkpPopXbnc/niaPHPBdavY48f5pcgnW3xl Ykbyo06acleenfbjjonV1hGWTrsS3t4P4fQT/Bpy5TlQN9w6omfyPqcHFwUg0/hYI0iC ps4bxLro0IXMeYv5yAoYYoB3hEmp6Jkpbth3nmdY2EcG41T3Hbd0BJykj431RE5GAbHu TscrHXQBVb/twM2C6paB2dbO3a9ru1+dzbKWj3RFp4rSeAE6ywJdUHMj6Y3F/yXlKqS8 GUSsdAJJA6cOwosEFxcVvwdKrycAC3qdgvkR6wRvern5p11ACRqIw0TUUsGtFTO5wCWL QqBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KpY9LpkQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g17-20020ac842d1000000b003afebda923dsi1982390qtm.126.2023.02.03.06.56.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Feb 2023 06:56:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KpY9LpkQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pNxUG-0002jD-Lu; Fri, 03 Feb 2023 09:56:25 -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 1pNxUF-0002ap-A0 for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:23 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pNxUC-0005v2-Bf for qemu-devel@nongnu.org; Fri, 03 Feb 2023 09:56:23 -0500 Received: by mail-wm1-x336.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so2571888wms.0 for ; Fri, 03 Feb 2023 06:56:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; 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=f2kBLJKaVnGetSSqtxpfAhCXISkwd1yaz8QImmDemGM=; b=KpY9LpkQkdmGdSECIUV03ptdpIF11O/6yKWpyzgdtyfnGMbcnM3z5Vxqexi6R4/TgB e+e+JhjV8ztHekJdrXiHPRztONz0hemLJEvBGr60OSxZjiIYXELaR+3NRO2AOfmM49tK pR6kFvrNO31fokNf4r9Iue3yONWo8OFso/G3agt4FuH7CDLaEZa0GwNiLxd0XP1SubTp 2oJU8HsL0L5OPvmKc/AM144hHOWjozKQurWbIc6O5c8BSftV9J7VIa5qvAXvrincUfQK QIOc/L86kAc0Q8cqxbk7dlgn4EoTRjsvKznly6tebyrditFVyuOtoTP0rNOd03Xlw4xU sGUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=f2kBLJKaVnGetSSqtxpfAhCXISkwd1yaz8QImmDemGM=; b=3y6DlRizZHIUKiA/A0yzS8bcdi2++5KnNyrnsJKW/YVOEJEepDF8TbRpsQ3UA224kU OdwsH8/Arg6GDoQM8x32S5aHpdU7McH+wAQFP7VEgqYSz++n9eBYm7gCARbvgYVP1sE5 +BF9qvYgCzN+8XAqnlOPWBKRS4yE0tkcwq3LwXBc0QcXQRzw4fRTbN+ciZJfE42hSSzF Sd3iahmVSFJloKsoY4lT2fKaGwZx0jAyeNcujxRjx35Vllde+WjsPaLNHVMM7ncENrbL KsCnvA/o4UtcgNTMfexKVWZGi+5X2c8XQspZmBfzPJ9odihABUyjNnf501mXKv6zOj0o J3kQ== X-Gm-Message-State: AO0yUKWPv8F9mgea/tf9NfJQ7gOM+tMriMKaXEy6uBMlgVnlyMNKUH1o lOiD+9z76YfjzCyNSBzsQ6MminFojjLbrsPS X-Received: by 2002:a05:600c:1d13:b0:3dc:5abb:2f50 with SMTP id l19-20020a05600c1d1300b003dc5abb2f50mr9505073wms.19.1675436179316; Fri, 03 Feb 2023 06:56:19 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id t6-20020a05600c198600b003dc492e4430sm3022855wmq.28.2023.02.03.06.56.18 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 06:56:18 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Markus Armbruster , qemu-arm@nongnu.org, qemu-ppc@nongnu.org, Eduardo Habkost , =?utf-8?q?Phili?= =?utf-8?q?ppe_Mathieu-Daud=C3=A9?= , Peter Maydell , Jean-Christophe Dubois , Andrey Smirnov Subject: [PATCH v2 08/15] hw/arm/fsl-imx: Alias 'phy-num' QOM property in SoC object Date: Fri, 3 Feb 2023 15:55:29 +0100 Message-Id: <20230203145536.17585-9-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20230203145536.17585-1-philmd@linaro.org> References: <20230203145536.17585-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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=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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org No need to use intermediate 'fec-phy-num' properties in the SoC object. Alias the properties, so when the machines set the value on the SoC, it is propagated to the network device object. Signed-off-by: Philippe Mathieu-Daudé --- hw/arm/fsl-imx25.c | 3 +-- hw/arm/fsl-imx6.c | 3 +-- hw/arm/fsl-imx6ul.c | 8 ++++---- hw/arm/fsl-imx7.c | 12 ++++++------ include/hw/arm/fsl-imx25.h | 1 - include/hw/arm/fsl-imx6.h | 1 - include/hw/arm/fsl-imx6ul.h | 2 -- include/hw/arm/fsl-imx7.h | 1 - 8 files changed, 12 insertions(+), 19 deletions(-) diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c index 24c4374590..eff58e1f7a 100644 --- a/hw/arm/fsl-imx25.c +++ b/hw/arm/fsl-imx25.c @@ -55,6 +55,7 @@ static void fsl_imx25_init(Object *obj) } object_initialize_child(obj, "fec", &s->fec, TYPE_IMX_FEC); + object_property_add_alias(obj, "fec-phy-num", OBJECT(&s->fec), "phy-num"); object_initialize_child(obj, "rngc", &s->rngc, TYPE_IMX_RNGC); @@ -169,7 +170,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) epit_table[i].irq)); } - object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &err); qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]); if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) { @@ -315,7 +315,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp) } static Property fsl_imx25_properties[] = { - DEFINE_PROP_UINT32("fec-phy-num", FslIMX25State, phy_num, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c index 00dafe3f62..4f870c928c 100644 --- a/hw/arm/fsl-imx6.c +++ b/hw/arm/fsl-imx6.c @@ -100,6 +100,7 @@ static void fsl_imx6_init(Object *obj) object_initialize_child(obj, "eth", &s->eth, TYPE_IMX_ENET); + object_property_add_alias(obj, "fec-phy-num", OBJECT(&s->eth), "phy-num"); } static void fsl_imx6_realize(DeviceState *dev, Error **errp) @@ -377,7 +378,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) spi_table[i].irq)); } - object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &err); qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]); if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) { return; @@ -451,7 +451,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp) } static Property fsl_imx6_properties[] = { - DEFINE_PROP_UINT32("fec-phy-num", FslIMX6State, phy_num, 0), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c index d88d6cc1c5..8b3939e8c5 100644 --- a/hw/arm/fsl-imx6ul.c +++ b/hw/arm/fsl-imx6ul.c @@ -120,8 +120,12 @@ static void fsl_imx6ul_init(Object *obj) * Ethernet */ for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) { + g_autofree gchar *propname = g_strdup_printf("fec%d-phy-num", i + 1); snprintf(name, NAME_SIZE, "eth%d", i); object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET); + qdev_prop_set_uint32(DEVICE(&s->eth[i]), "phy-num", i); + object_property_add_alias(obj, propname, + OBJECT(&s->eth[i]), "phy-num"); } /* USB */ @@ -424,8 +428,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) FSL_IMX6UL_ENET2_TIMER_IRQ, }; - object_property_set_uint(OBJECT(&s->eth[i]), "phy-num", - s->phy_num[i], &error_abort); object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", FSL_IMX6UL_ETH_NUM_TX_RINGS, &error_abort); qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); @@ -618,8 +620,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp) } static Property fsl_imx6ul_properties[] = { - DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0), - DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c index afc7480799..df035c9314 100644 --- a/hw/arm/fsl-imx7.c +++ b/hw/arm/fsl-imx7.c @@ -102,8 +102,12 @@ static void fsl_imx7_init(Object *obj) * Ethernet */ for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) { - snprintf(name, NAME_SIZE, "eth%d", i); - object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET); + g_autofree gchar *propname = g_strdup_printf("fec%d-phy-num", i + 1); + snprintf(name, NAME_SIZE, "eth%d", i); + object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET); + qdev_prop_set_uint32(DEVICE(&s->eth[i]), "phy-num", i); + object_property_add_alias(obj, propname, + OBJECT(&s->eth[i]), "phy-num"); } /* @@ -402,8 +406,6 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) FSL_IMX7_ENET2_ADDR, }; - object_property_set_uint(OBJECT(&s->eth[i]), "phy-num", - s->phy_num[i], &error_abort); object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num", FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort); qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]); @@ -599,8 +601,6 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp) } static Property fsl_imx7_properties[] = { - DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0), - DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1), DEFINE_PROP_END_OF_LIST(), }; diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h index 1b1086e945..e377f8e79a 100644 --- a/include/hw/arm/fsl-imx25.h +++ b/include/hw/arm/fsl-imx25.h @@ -66,7 +66,6 @@ struct FslIMX25State { MemoryRegion rom[2]; MemoryRegion iram; MemoryRegion iram_alias; - uint32_t phy_num; }; /** diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h index 83291457cf..f7d1a94640 100644 --- a/include/hw/arm/fsl-imx6.h +++ b/include/hw/arm/fsl-imx6.h @@ -74,7 +74,6 @@ struct FslIMX6State { MemoryRegion caam; MemoryRegion ocram; MemoryRegion ocram_alias; - uint32_t phy_num; }; diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h index 7812e516a5..5217eeb8ff 100644 --- a/include/hw/arm/fsl-imx6ul.h +++ b/include/hw/arm/fsl-imx6ul.h @@ -88,8 +88,6 @@ struct FslIMX6ULState { MemoryRegion caam; MemoryRegion ocram; MemoryRegion ocram_alias; - - uint32_t phy_num[FSL_IMX6UL_NUM_ETHS]; }; enum FslIMX6ULMemoryMap { diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h index 4e5e071864..16c68a4937 100644 --- a/include/hw/arm/fsl-imx7.h +++ b/include/hw/arm/fsl-imx7.h @@ -82,7 +82,6 @@ struct FslIMX7State { IMX7GPRState gpr; ChipideaState usb[FSL_IMX7_NUM_USBS]; DesignwarePCIEHost pcie; - uint32_t phy_num[FSL_IMX7_NUM_ETHS]; }; enum FslIMX7MemoryMap {