Re: [PATCH 3/3] net: via-rhine: add OF bus binding

From: Ben Hutchings
Date: Mon Jan 27 2014 - 09:57:52 EST


On Mon, 2014-01-27 at 15:51 +0400, Alexey Charkov wrote:
> This should make the driver usable with VIA/WonderMedia ARM-based
> Systems-on-Chip integrated Rhine III adapters. Note that these
> are always in MMIO mode, and don't have any known EEPROM.
[...]
> --- a/drivers/net/ethernet/via/Kconfig
> +++ b/drivers/net/ethernet/via/Kconfig
> @@ -19,7 +19,7 @@ if NET_VENDOR_VIA
>
> config VIA_RHINE
> tristate "VIA Rhine support"
> - depends on PCI
> + depends on (PCI || USE_OF)
> select CRC32
> select MII
> ---help---

This seems like the right thing to do, but it means you need to add
#ifdef CONFIG_PCI and #ifdef CONFIG_USE_OF around the driver structures
and related functions.

You should compile-test in configurations that have just one of those
dependencies enabled.

[...]
> --- a/drivers/net/ethernet/via/via-rhine.c
> +++ b/drivers/net/ethernet/via/via-rhine.c
[...]
> @@ -847,7 +856,8 @@ static void rhine_hw_init(struct net_device *dev, long pioaddr)
> msleep(5);
>
> /* Reload EEPROM controlled bytes cleared by soft reset */
> - rhine_reload_eeprom(pioaddr, dev);
> + if (!strncmp(dev->dev.parent->bus->name, "pci", 3))
> + rhine_reload_eeprom(pioaddr, dev);
[...]

Ew. I think you should use dev_is_pci(), although you might also need
to guard that with #ifdef CONFIG_PCI.

Ben.

--
Ben Hutchings
If at first you don't succeed, you're doing about average.

Attachment: signature.asc
Description: This is a digitally signed message part