@@ -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(),
};
@@ -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(),
};
@@ -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(),
};
@@ -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(),
};
@@ -66,7 +66,6 @@ struct FslIMX25State {
MemoryRegion rom[2];
MemoryRegion iram;
MemoryRegion iram_alias;
- uint32_t phy_num;
};
/**
@@ -74,7 +74,6 @@ struct FslIMX6State {
MemoryRegion caam;
MemoryRegion ocram;
MemoryRegion ocram_alias;
- uint32_t phy_num;
};
@@ -88,8 +88,6 @@ struct FslIMX6ULState {
MemoryRegion caam;
MemoryRegion ocram;
MemoryRegion ocram_alias;
-
- uint32_t phy_num[FSL_IMX6UL_NUM_ETHS];
};
enum FslIMX6ULMemoryMap {
@@ -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 {
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é <philmd@linaro.org> --- 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(-)