qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 20/21] fsl-imx7: Add fec[12]-phy-connected properties
Date: Thu, 20 Apr 2023 11:04:55 +0100	[thread overview]
Message-ID: <20230420100456.944969-21-peter.maydell@linaro.org> (raw)
In-Reply-To: <20230420100456.944969-1-peter.maydell@linaro.org>

From: Guenter Roeck <linux@roeck-us.net>

Add fec[12]-phy-connected properties and use it to set phy-connected
and phy-consumer properties for imx_fec.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Message-id: 20230315145248.1639364-5-linux@roeck-us.net
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 include/hw/arm/fsl-imx7.h |  1 +
 hw/arm/fsl-imx7.c         | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
index 355bd8ea838..54ea2f0890a 100644
--- a/include/hw/arm/fsl-imx7.h
+++ b/include/hw/arm/fsl-imx7.h
@@ -82,6 +82,7 @@ struct FslIMX7State {
     ChipideaState      usb[FSL_IMX7_NUM_USBS];
     DesignwarePCIEHost pcie;
     uint32_t           phy_num[FSL_IMX7_NUM_ETHS];
+    bool               phy_connected[FSL_IMX7_NUM_ETHS];
 };
 
 enum FslIMX7MemoryMap {
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
index afc74807990..9e41d4b6772 100644
--- a/hw/arm/fsl-imx7.c
+++ b/hw/arm/fsl-imx7.c
@@ -395,7 +395,23 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
 
     /*
      * Ethernet
+     *
+     * We must use two loops since phy_connected affects the other interface
+     * and we have to set all properties before calling sysbus_realize().
      */
+    for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) {
+        object_property_set_bool(OBJECT(&s->eth[i]), "phy-connected",
+                                 s->phy_connected[i], &error_abort);
+        /*
+         * If the MDIO bus on this controller is not connected, assume the
+         * other controller provides support for it.
+         */
+        if (!s->phy_connected[i]) {
+            object_property_set_link(OBJECT(&s->eth[1 - i]), "phy-consumer",
+                                     OBJECT(&s->eth[i]), &error_abort);
+        }
+    }
+
     for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) {
         static const hwaddr FSL_IMX7_ENETn_ADDR[FSL_IMX7_NUM_ETHS] = {
             FSL_IMX7_ENET1_ADDR,
@@ -601,6 +617,10 @@ 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_BOOL("fec1-phy-connected", FslIMX7State, phy_connected[0],
+                     true),
+    DEFINE_PROP_BOOL("fec2-phy-connected", FslIMX7State, phy_connected[1],
+                     true),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.34.1



  parent reply	other threads:[~2023-04-20 10:06 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 10:04 [PULL 00/21] target-arm queue Peter Maydell
2023-04-20 10:04 ` [PULL 01/21] hw/arm: Fix some typos in comments (most found by codespell) Peter Maydell
2023-04-20 10:04 ` [PULL 02/21] exynos: Fix out-of-bounds access in exynos4210_gcomp_find debug printf Peter Maydell
2023-04-20 10:04 ` [PULL 03/21] hw/watchdog: Allwinner WDT emulation for system reset Peter Maydell
2023-04-20 10:04 ` [PULL 04/21] hw/arm: Add WDT to Allwinner-A10 and Cubieboard Peter Maydell
2023-04-20 10:04 ` [PULL 05/21] hw/arm: Add WDT to Allwinner-H3 and Orangepi-PC Peter Maydell
2023-04-20 10:04 ` [PULL 06/21] tests/avocado: Add reboot tests to Cubieboard Peter Maydell
2023-04-20 10:04 ` [PULL 07/21] hw/timer/imx_epit: don't shadow variable Peter Maydell
2023-04-20 10:04 ` [PULL 08/21] hw/timer/imx_epit: fix limit check Peter Maydell
2023-04-20 10:04 ` [PULL 09/21] target/arm: Remove KVM AArch32 CPU definitions Peter Maydell
2023-04-20 10:04 ` [PULL 10/21] hw/arm/virt: Restrict Cortex-A7 check to TCG Peter Maydell
2023-04-20 10:04 ` [PULL 11/21] target/arm: Initialize debug capabilities only once Peter Maydell
2023-04-20 10:04 ` [PULL 12/21] target/arm: Pass ARMMMUFaultInfo to merge_syn_data_abort() Peter Maydell
2023-04-20 10:04 ` [PULL 13/21] target/arm: Don't set ISV when reporting stage 1 faults in ESR_EL2 Peter Maydell
2023-04-20 10:04 ` [PULL 14/21] target/arm: Implement FEAT_PAN3 Peter Maydell
2023-04-20 10:04 ` [PULL 15/21] docs/devel/kconfig.rst: Fix incorrect markup Peter Maydell
2023-04-20 10:04 ` [PULL 16/21] target/arm: Report pauth information to gdb as 'pauth_v2' Peter Maydell
2023-04-20 10:04 ` [PULL 17/21] hw/net/imx_fec: Support two Ethernet interfaces connected to single MDIO bus Peter Maydell
2023-04-20 10:04 ` [PULL 18/21] fsl-imx6ul: Add fec[12]-phy-connected properties Peter Maydell
2023-04-20 10:04 ` [PULL 19/21] arm/mcimx6ul-evk: Set fec1-phy-connected property to false Peter Maydell
2023-04-20 10:04 ` Peter Maydell [this message]
2023-04-20 10:04 ` [PULL 21/21] arm/mcimx7d-sabre: Set fec2-phy-connected " Peter Maydell
2023-04-21 10:49 ` [PULL 00/21] target-arm queue Richard Henderson
2023-04-21 11:54   ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230420100456.944969-21-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).