On 7/6/25 1:29 PM, Magnus Damm wrote:
+++ work/drivers/net/sh_eth.c 2025-07-05 17:45:07.333754799 +0900
@@ -144,10 +144,10 @@ static int sh_eth_reset(struct sh_eth_in
{
#if defined(SH_ETH_TYPE_GETHER) || defined(SH_ETH_TYPE_RZ)
int ret = 0, i;
-
Does something like this ...
if (!device_is_compatible(dev, "..."))
... work instead of the ifdef ?
If yes, it might be even improved into dedicated function:
static bool device_is_rza2(struct udevice *dev)
{
if (!IS_ENABLED(CONFIG_RZA2))
return false;
else
return device_is_compatible(dev, "...");
}
That should be compile-time checked and then optimized out, and in case
of non-RZA2, this should be optimized out entirely.
+#if !defined(CONFIG_RZA2)
/* Start e-dmac transmitter and receiver */
sh_eth_write(port_info, EDSR_ENALL, EDSR);
-
[...]
@@ -722,8 +726,11 @@ static int sh_ether_probe(struct udevice
goto err_mdio_register;
priv->bus = mdiodev;
-
+#ifdef BASE_IO_ADDR
port_info->iobase = (void __iomem *)(uintptr_t)BASE_IO_ADDR;
+#else
+ port_info->iobase = (void __iomem *)pdata->iobase;
+#endif
Can the base address be pulled from DT?
[...]