From: Guenter Roeck <linux@roeck-us.net>
To: Jean-Christophe Dubois <jcd@tribudubois.net>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
Peter Maydell <peter.maydell@linaro.org>,
Jason Wang <jasowang@redhat.com>,
qemu-arm@nongnu.org, qemu-devel@nongnu.org,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH 2/5] fsl-imx6ul: Add fec[12]-phy-connected properties
Date: Wed, 15 Mar 2023 07:52:45 -0700 [thread overview]
Message-ID: <20230315145248.1639364-3-linux@roeck-us.net> (raw)
In-Reply-To: <20230315145248.1639364-1-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>
---
hw/arm/fsl-imx6ul.c | 20 ++++++++++++++++++++
include/hw/arm/fsl-imx6ul.h | 1 +
2 files changed, 21 insertions(+)
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
index d88d6cc1c5..2189dcbb72 100644
--- a/hw/arm/fsl-imx6ul.c
+++ b/hw/arm/fsl-imx6ul.c
@@ -407,7 +407,23 @@ static void fsl_imx6ul_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_IMX6UL_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_IMX6UL_NUM_ETHS; i++) {
static const hwaddr FSL_IMX6UL_ENETn_ADDR[FSL_IMX6UL_NUM_ETHS] = {
FSL_IMX6UL_ENET1_ADDR,
@@ -620,6 +636,10 @@ 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_BOOL("fec1-phy-connected", FslIMX6ULState, phy_connected[0],
+ true),
+ DEFINE_PROP_BOOL("fec2-phy-connected", FslIMX6ULState, phy_connected[1],
+ true),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
index 1952cb984d..9ee15ae38d 100644
--- a/include/hw/arm/fsl-imx6ul.h
+++ b/include/hw/arm/fsl-imx6ul.h
@@ -89,6 +89,7 @@ struct FslIMX6ULState {
MemoryRegion ocram_alias;
uint32_t phy_num[FSL_IMX6UL_NUM_ETHS];
+ bool phy_connected[FSL_IMX6UL_NUM_ETHS];
};
enum FslIMX6ULMemoryMap {
--
2.39.2
next prev parent reply other threads:[~2023-03-15 14:54 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-15 14:52 [PATCH 0/5] Support both Ethernet interfaces on i.MX6UL and i.MX7 Guenter Roeck
2023-03-15 14:52 ` [PATCH 1/5] hw/net/imx_fec: Support two Ethernet interfaces connected to single MDIO bus Guenter Roeck
2023-03-30 16:31 ` Peter Maydell
2023-03-30 17:15 ` Guenter Roeck
2023-03-15 14:52 ` Guenter Roeck [this message]
2023-03-15 14:52 ` [PATCH 3/5] arm/mcimx6ul-evk: Set fec1-phy-connected property to false Guenter Roeck
2023-03-15 14:52 ` [PATCH 4/5] fsl-imx7: Add fec[12]-phy-connected properties Guenter Roeck
2023-03-15 14:52 ` [PATCH 5/5] arm/mcimx7d-sabre: Set fec2-phy-connected property to false Guenter Roeck
2023-04-18 12:10 ` [PATCH 0/5] Support both Ethernet interfaces on i.MX6UL and i.MX7 Peter Maydell
2023-04-18 14:42 ` Guenter Roeck
2023-04-18 14:46 ` Peter Maydell
2023-04-18 15:18 ` Guenter Roeck
2023-04-18 15:32 ` Peter Maydell
2023-04-18 16:55 ` Guenter Roeck
2023-04-20 9:48 ` 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=20230315145248.1639364-3-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=andrew.smirnov@gmail.com \
--cc=jasowang@redhat.com \
--cc=jcd@tribudubois.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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).