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

2014-04-22 Thread Rob Herring
On Tue, Apr 22, 2014 at 10:28 AM, 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.
>
> Signed-off-by: Alexey Charkov 

For the binding:

Acked-by: Rob Herring 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-04-22 Thread Alexey Charkov
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.

Signed-off-by: Alexey Charkov 
---
 .../devicetree/bindings/net/via-rhine.txt  |  17 ++
 arch/arm/boot/dts/vt8500.dtsi  |   6 +
 arch/arm/boot/dts/wm8650.dtsi  |   6 +
 arch/arm/boot/dts/wm8850.dtsi  |   6 +
 drivers/net/ethernet/via/Kconfig   |   2 +-
 drivers/net/ethernet/via/via-rhine.c   | 307 +
 6 files changed, 229 insertions(+), 115 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
b/Documentation/devicetree/bindings/net/via-rhine.txt
new file mode 100644
index 000..334eca2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-rhine.txt
@@ -0,0 +1,17 @@
+* VIA Rhine 10/100 Network Controller
+
+Required properties:
+- compatible : Should be "via,vt8500-rhine" for integrated
+   Rhine controllers found in VIA VT8500, WonderMedia WM8950
+   and similar. These are listed as 1106:3106 rev. 0x84 on the
+   virtual PCI bus under vendor-provided kernels
+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+
+Examples:
+
+ethernet@d8004000 {
+   compatible = "via,vt8500-rhine";
+   reg = <0xd8004000 0x100>;
+   interrupts = <10>;
+};
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi
index 51d0e91..1929ad3 100644
--- a/arch/arm/boot/dts/vt8500.dtsi
+++ b/arch/arm/boot/dts/vt8500.dtsi
@@ -165,5 +165,11 @@
reg = <0xd810 0x1>;
interrupts = <48>;
};
+
+   ethernet@d8004000 {
+   compatible = "via,vt8500-rhine";
+   reg = <0xd8004000 0x100>;
+   interrupts = <10>;
+   };
};
 };
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index 7525982..b1c59a7 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -218,5 +218,11 @@
reg = <0xd810 0x1>;
interrupts = <48>;
};
+
+   ethernet@d8004000 {
+   compatible = "via,vt8500-rhine";
+   reg = <0xd8004000 0x100>;
+   interrupts = <10>;
+   };
};
 };
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi
index d98386d..8fbccfbe 100644
--- a/arch/arm/boot/dts/wm8850.dtsi
+++ b/arch/arm/boot/dts/wm8850.dtsi
@@ -298,5 +298,11 @@
bus-width = <4>;
sdon-inverted;
};
+
+   ethernet@d8004000 {
+   compatible = "via,vt8500-rhine";
+   reg = <0xd8004000 0x100>;
+   interrupts = <10>;
+};
};
 };
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index 8a049a2..f66ddae 100644
--- 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---
diff --git a/drivers/net/ethernet/via/via-rhine.c 
b/drivers/net/ethernet/via/via-rhine.c
index 20b83f1..4fa9201 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -94,6 +94,10 @@ static const int multicast_filter_limit = 32;
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -279,6 +283,15 @@ static DEFINE_PCI_DEVICE_TABLE(rhine_pci_tbl) = {
 };
 MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
 
+/* OpenFirmware identifiers for platform-bus devices
+ * The .data field is currently only used to store chip revision
+ * (for quirks etc.)
+ */
+static struct of_device_id rhine_of_tbl[] = {
+   { .compatible = "via,vt8500-rhine", .data = (void *)0x84 },
+   { } /* terminate list */
+};
+MODULE_DEVICE_TABLE(of, rhine_of_tbl);
 
 /* Offsets to the device registers. */
 enum register_offsets {
@@ -847,7 +860,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 (dev_is_pci(dev->dev.parent))
+   rhine_reload_eeprom(pioaddr, dev);
 }
 
 static const struct net_device_ops rhine_netdev_ops = {
@@ -868,125 +882,55 @@ static const struct net_device_ops rhine_netdev_ops = {
 #endif
 };
 
-static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id 
*ent)

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

2014-04-22 Thread Alexey Charkov
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.

Signed-off-by: Alexey Charkov alch...@gmail.com
---
 .../devicetree/bindings/net/via-rhine.txt  |  17 ++
 arch/arm/boot/dts/vt8500.dtsi  |   6 +
 arch/arm/boot/dts/wm8650.dtsi  |   6 +
 arch/arm/boot/dts/wm8850.dtsi  |   6 +
 drivers/net/ethernet/via/Kconfig   |   2 +-
 drivers/net/ethernet/via/via-rhine.c   | 307 +
 6 files changed, 229 insertions(+), 115 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
b/Documentation/devicetree/bindings/net/via-rhine.txt
new file mode 100644
index 000..334eca2
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-rhine.txt
@@ -0,0 +1,17 @@
+* VIA Rhine 10/100 Network Controller
+
+Required properties:
+- compatible : Should be via,vt8500-rhine for integrated
+   Rhine controllers found in VIA VT8500, WonderMedia WM8950
+   and similar. These are listed as 1106:3106 rev. 0x84 on the
+   virtual PCI bus under vendor-provided kernels
+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+
+Examples:
+
+ethernet@d8004000 {
+   compatible = via,vt8500-rhine;
+   reg = 0xd8004000 0x100;
+   interrupts = 10;
+};
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi
index 51d0e91..1929ad3 100644
--- a/arch/arm/boot/dts/vt8500.dtsi
+++ b/arch/arm/boot/dts/vt8500.dtsi
@@ -165,5 +165,11 @@
reg = 0xd810 0x1;
interrupts = 48;
};
+
+   ethernet@d8004000 {
+   compatible = via,vt8500-rhine;
+   reg = 0xd8004000 0x100;
+   interrupts = 10;
+   };
};
 };
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index 7525982..b1c59a7 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -218,5 +218,11 @@
reg = 0xd810 0x1;
interrupts = 48;
};
+
+   ethernet@d8004000 {
+   compatible = via,vt8500-rhine;
+   reg = 0xd8004000 0x100;
+   interrupts = 10;
+   };
};
 };
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi
index d98386d..8fbccfbe 100644
--- a/arch/arm/boot/dts/wm8850.dtsi
+++ b/arch/arm/boot/dts/wm8850.dtsi
@@ -298,5 +298,11 @@
bus-width = 4;
sdon-inverted;
};
+
+   ethernet@d8004000 {
+   compatible = via,vt8500-rhine;
+   reg = 0xd8004000 0x100;
+   interrupts = 10;
+};
};
 };
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index 8a049a2..f66ddae 100644
--- 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---
diff --git a/drivers/net/ethernet/via/via-rhine.c 
b/drivers/net/ethernet/via/via-rhine.c
index 20b83f1..4fa9201 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -94,6 +94,10 @@ static const int multicast_filter_limit = 32;
 #include linux/ioport.h
 #include linux/interrupt.h
 #include linux/pci.h
+#include linux/of_address.h
+#include linux/of_device.h
+#include linux/of_irq.h
+#include linux/platform_device.h
 #include linux/dma-mapping.h
 #include linux/netdevice.h
 #include linux/etherdevice.h
@@ -279,6 +283,15 @@ static DEFINE_PCI_DEVICE_TABLE(rhine_pci_tbl) = {
 };
 MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
 
+/* OpenFirmware identifiers for platform-bus devices
+ * The .data field is currently only used to store chip revision
+ * (for quirks etc.)
+ */
+static struct of_device_id rhine_of_tbl[] = {
+   { .compatible = via,vt8500-rhine, .data = (void *)0x84 },
+   { } /* terminate list */
+};
+MODULE_DEVICE_TABLE(of, rhine_of_tbl);
 
 /* Offsets to the device registers. */
 enum register_offsets {
@@ -847,7 +860,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 (dev_is_pci(dev-dev.parent))
+   rhine_reload_eeprom(pioaddr, dev);
 }
 
 static const struct net_device_ops rhine_netdev_ops = {
@@ -868,125 +882,55 @@ static 

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

2014-04-22 Thread Rob Herring
On Tue, Apr 22, 2014 at 10:28 AM, Alexey Charkov alch...@gmail.com 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.

 Signed-off-by: Alexey Charkov alch...@gmail.com

For the binding:

Acked-by: Rob Herring r...@kernel.org
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-31 Thread Ben Hutchings
On Tue, 2014-01-28 at 22:31 +0400, Alexey Charkov wrote:
> 2014/1/28 Ben Hutchings :
> > On Mon, 2014-01-27 at 19:34 +0400, Alexey Charkov wrote:
> >> 2014/1/27 Ben Hutchings :
> >> > 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.
> >>
> >> Frankly, I would like to avoid that if possible (as pointed out in the
> >> cover email), as I believe we would get a cleaner driver without
> >> #ifdef. This is also the way it was done in via-velocity, and it works
> >> just fine.
> >
> > OK, I'm surprised that all the PCI functions have dummy definitions.
> >
> >> > You should compile-test in configurations that have just one of those
> >> > dependencies enabled.
> >>
> >> This has been compile-tested and runtime-tested in OF-only
> >> configuration on WM8950, and Roger also tested it in PCI-only
> >> configuration, so it seems to work fine.
> > [...]
> >
> > Good, then I have no objection.
> 
> Thanks Ben! Would it be fine to add your Reviewed-by at the next
> iteration, once I fix indentation of function arguments and
> dev_is_pci()?

Sorry, I don't think I know enough to claim that I've reviewed the whole
thing properly.

Ben.

-- 
Ben Hutchings
It is easier to write an incorrect program than to understand a correct one.


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


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

2014-01-31 Thread Ben Hutchings
On Tue, 2014-01-28 at 22:31 +0400, Alexey Charkov wrote:
 2014/1/28 Ben Hutchings b...@decadent.org.uk:
  On Mon, 2014-01-27 at 19:34 +0400, Alexey Charkov wrote:
  2014/1/27 Ben Hutchings b...@decadent.org.uk:
   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.
 
  Frankly, I would like to avoid that if possible (as pointed out in the
  cover email), as I believe we would get a cleaner driver without
  #ifdef. This is also the way it was done in via-velocity, and it works
  just fine.
 
  OK, I'm surprised that all the PCI functions have dummy definitions.
 
   You should compile-test in configurations that have just one of those
   dependencies enabled.
 
  This has been compile-tested and runtime-tested in OF-only
  configuration on WM8950, and Roger also tested it in PCI-only
  configuration, so it seems to work fine.
  [...]
 
  Good, then I have no objection.
 
 Thanks Ben! Would it be fine to add your Reviewed-by at the next
 iteration, once I fix indentation of function arguments and
 dev_is_pci()?

Sorry, I don't think I know enough to claim that I've reviewed the whole
thing properly.

Ben.

-- 
Ben Hutchings
It is easier to write an incorrect program than to understand a correct one.


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


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

2014-01-29 Thread Rob Herring
On Tue, Jan 28, 2014 at 11:20 PM, Alexey Charkov  wrote:
> 2014/1/29 Tony Prisk :
>> On 29/01/14 07:27, Alexey Charkov wrote:
>>>
>>> 2014/1/27 Rob Herring :

 On Mon, Jan 27, 2014 at 5:51 AM, 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.
>
> Signed-off-by: Alexey Charkov 
> Signed-off-by: Roger Luethi 
> ---
>   .../devicetree/bindings/net/via-rhine.txt  |  18 ++
>   drivers/net/ethernet/via/Kconfig   |   2 +-
>   drivers/net/ethernet/via/via-rhine.c   | 293
> +
>   3 files changed, 200 insertions(+), 113 deletions(-)
>   create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt
>
> diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt
> b/Documentation/devicetree/bindings/net/via-rhine.txt
> new file mode 100644
> index 000..684dd3a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
> @@ -0,0 +1,18 @@
> +* VIA Rhine 10/100 Network Controller
> +
> +Required properties:
> +- compatible : Should be "via,rhine"

 This should be more specific rather than...

> +- reg : Address and length of the io space
> +- interrupts : Should contain the controller interrupt line
> +- rhine,revision : Rhine core revision, used to inform the
> +   driver of quirks and capabilities to expect from
> +   the device. Mimics the respective PCI attribute.

 having this property. The OF match table can then have the quirks set
 based on compatible strings.
>>>
>>> Sounds fair. Do you think something like the following would fly?
>>>
>>> Required properties:
>>> - compatible : Should be "via,rhine-soc-vt8500" for integrated Rhine
>>> cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
>>> possibly others. These are listed as 1106:3106 rev. 0x84 on the
>>> virtual PCI bus under vendor-provided kernels.
>>
>> Does it need a special name? I would have assumed they are using their own
>> IP for the VT6105 or VT6106S.
>> Then you can use it to add quirks later on if needed.
>
> The problem is that I have no reliable source for the exact name of
> the IP block. The lookup table within the driver says that rev. 0x83
> is VT6105_B0, and rev. 0x8A is VT6105L (and it doesn't contain any
> entry for 0x84, so our case gets treated as 0x83 currently).
>
> If we only differentiate them by the compatible string, I would be
> reluctant to call it vt6105 or vt6106 or whatever else without knowing
> for sure. Otherwise, if at some point we need to add any quirks
> specific to rev. 0x84, we wouldn't be able to do that without
> side-effects.

If you don't know the IP rev, then you should assume it is different
and you should certainly know which chip it is in. This is why the soc
name is typically in the compatible string. You can always have
multiple compatible strings. You want to have a unique compatible
string so you can add quirks later if needed.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-29 Thread Rob Herring
On Tue, Jan 28, 2014 at 12:27 PM, Alexey Charkov  wrote:
> 2014/1/27 Rob Herring :
>> On Mon, Jan 27, 2014 at 5:51 AM, 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.
>>>
>>> Signed-off-by: Alexey Charkov 
>>> Signed-off-by: Roger Luethi 
>>> ---
>>>  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
>>>  drivers/net/ethernet/via/Kconfig   |   2 +-
>>>  drivers/net/ethernet/via/via-rhine.c   | 293 
>>> +
>>>  3 files changed, 200 insertions(+), 113 deletions(-)
>>>  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt
>>>
>>> diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
>>> b/Documentation/devicetree/bindings/net/via-rhine.txt
>>> new file mode 100644
>>> index 000..684dd3a
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
>>> @@ -0,0 +1,18 @@
>>> +* VIA Rhine 10/100 Network Controller
>>> +
>>> +Required properties:
>>> +- compatible : Should be "via,rhine"
>>
>> This should be more specific rather than...
>>
>>> +- reg : Address and length of the io space
>>> +- interrupts : Should contain the controller interrupt line
>>> +- rhine,revision : Rhine core revision, used to inform the
>>> +   driver of quirks and capabilities to expect from
>>> +   the device. Mimics the respective PCI attribute.
>>
>> having this property. The OF match table can then have the quirks set
>> based on compatible strings.
>
> Sounds fair. Do you think something like the following would fly?
>
> Required properties:
> - compatible : Should be "via,rhine-soc-vt8500" for integrated Rhine
> cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
> possibly others. These are listed as 1106:3106 rev. 0x84 on the
> virtual PCI bus under vendor-provided kernels.

Yes, although the "soc" part seems a bit redundant. The usual pattern
is ,-. I would go with "via,vt8500-rhine".

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-29 Thread Rob Herring
On Tue, Jan 28, 2014 at 12:27 PM, Alexey Charkov alch...@gmail.com wrote:
 2014/1/27 Rob Herring robherri...@gmail.com:
 On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov alch...@gmail.com 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.

 Signed-off-by: Alexey Charkov alch...@gmail.com
 Signed-off-by: Roger Luethi r...@hellgate.ch
 ---
  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
  drivers/net/ethernet/via/Kconfig   |   2 +-
  drivers/net/ethernet/via/via-rhine.c   | 293 
 +
  3 files changed, 200 insertions(+), 113 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

 diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
 b/Documentation/devicetree/bindings/net/via-rhine.txt
 new file mode 100644
 index 000..684dd3a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
 @@ -0,0 +1,18 @@
 +* VIA Rhine 10/100 Network Controller
 +
 +Required properties:
 +- compatible : Should be via,rhine

 This should be more specific rather than...

 +- reg : Address and length of the io space
 +- interrupts : Should contain the controller interrupt line
 +- rhine,revision : Rhine core revision, used to inform the
 +   driver of quirks and capabilities to expect from
 +   the device. Mimics the respective PCI attribute.

 having this property. The OF match table can then have the quirks set
 based on compatible strings.

 Sounds fair. Do you think something like the following would fly?

 Required properties:
 - compatible : Should be via,rhine-soc-vt8500 for integrated Rhine
 cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
 possibly others. These are listed as 1106:3106 rev. 0x84 on the
 virtual PCI bus under vendor-provided kernels.

Yes, although the soc part seems a bit redundant. The usual pattern
is vendor,chip/soc-device. I would go with via,vt8500-rhine.

Rob
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-29 Thread Rob Herring
On Tue, Jan 28, 2014 at 11:20 PM, Alexey Charkov alch...@gmail.com wrote:
 2014/1/29 Tony Prisk li...@prisktech.co.nz:
 On 29/01/14 07:27, Alexey Charkov wrote:

 2014/1/27 Rob Herring robherri...@gmail.com:

 On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov alch...@gmail.com
 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.

 Signed-off-by: Alexey Charkov alch...@gmail.com
 Signed-off-by: Roger Luethi r...@hellgate.ch
 ---
   .../devicetree/bindings/net/via-rhine.txt  |  18 ++
   drivers/net/ethernet/via/Kconfig   |   2 +-
   drivers/net/ethernet/via/via-rhine.c   | 293
 +
   3 files changed, 200 insertions(+), 113 deletions(-)
   create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

 diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt
 b/Documentation/devicetree/bindings/net/via-rhine.txt
 new file mode 100644
 index 000..684dd3a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
 @@ -0,0 +1,18 @@
 +* VIA Rhine 10/100 Network Controller
 +
 +Required properties:
 +- compatible : Should be via,rhine

 This should be more specific rather than...

 +- reg : Address and length of the io space
 +- interrupts : Should contain the controller interrupt line
 +- rhine,revision : Rhine core revision, used to inform the
 +   driver of quirks and capabilities to expect from
 +   the device. Mimics the respective PCI attribute.

 having this property. The OF match table can then have the quirks set
 based on compatible strings.

 Sounds fair. Do you think something like the following would fly?

 Required properties:
 - compatible : Should be via,rhine-soc-vt8500 for integrated Rhine
 cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
 possibly others. These are listed as 1106:3106 rev. 0x84 on the
 virtual PCI bus under vendor-provided kernels.

 Does it need a special name? I would have assumed they are using their own
 IP for the VT6105 or VT6106S.
 Then you can use it to add quirks later on if needed.

 The problem is that I have no reliable source for the exact name of
 the IP block. The lookup table within the driver says that rev. 0x83
 is VT6105_B0, and rev. 0x8A is VT6105L (and it doesn't contain any
 entry for 0x84, so our case gets treated as 0x83 currently).

 If we only differentiate them by the compatible string, I would be
 reluctant to call it vt6105 or vt6106 or whatever else without knowing
 for sure. Otherwise, if at some point we need to add any quirks
 specific to rev. 0x84, we wouldn't be able to do that without
 side-effects.

If you don't know the IP rev, then you should assume it is different
and you should certainly know which chip it is in. This is why the soc
name is typically in the compatible string. You can always have
multiple compatible strings. You want to have a unique compatible
string so you can add quirks later if needed.

Rob
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Alexey Charkov
2014/1/29 Tony Prisk :
> On 29/01/14 07:27, Alexey Charkov wrote:
>>
>> 2014/1/27 Rob Herring :
>>>
>>> On Mon, Jan 27, 2014 at 5:51 AM, 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.

 Signed-off-by: Alexey Charkov 
 Signed-off-by: Roger Luethi 
 ---
   .../devicetree/bindings/net/via-rhine.txt  |  18 ++
   drivers/net/ethernet/via/Kconfig   |   2 +-
   drivers/net/ethernet/via/via-rhine.c   | 293
 +
   3 files changed, 200 insertions(+), 113 deletions(-)
   create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

 diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt
 b/Documentation/devicetree/bindings/net/via-rhine.txt
 new file mode 100644
 index 000..684dd3a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
 @@ -0,0 +1,18 @@
 +* VIA Rhine 10/100 Network Controller
 +
 +Required properties:
 +- compatible : Should be "via,rhine"
>>>
>>> This should be more specific rather than...
>>>
 +- reg : Address and length of the io space
 +- interrupts : Should contain the controller interrupt line
 +- rhine,revision : Rhine core revision, used to inform the
 +   driver of quirks and capabilities to expect from
 +   the device. Mimics the respective PCI attribute.
>>>
>>> having this property. The OF match table can then have the quirks set
>>> based on compatible strings.
>>
>> Sounds fair. Do you think something like the following would fly?
>>
>> Required properties:
>> - compatible : Should be "via,rhine-soc-vt8500" for integrated Rhine
>> cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
>> possibly others. These are listed as 1106:3106 rev. 0x84 on the
>> virtual PCI bus under vendor-provided kernels.
>
> Does it need a special name? I would have assumed they are using their own
> IP for the VT6105 or VT6106S.
> Then you can use it to add quirks later on if needed.

The problem is that I have no reliable source for the exact name of
the IP block. The lookup table within the driver says that rev. 0x83
is VT6105_B0, and rev. 0x8A is VT6105L (and it doesn't contain any
entry for 0x84, so our case gets treated as 0x83 currently).

If we only differentiate them by the compatible string, I would be
reluctant to call it vt6105 or vt6106 or whatever else without knowing
for sure. Otherwise, if at some point we need to add any quirks
specific to rev. 0x84, we wouldn't be able to do that without
side-effects.

Thoughts welcome :)

Thanks,
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Tony Prisk

On 29/01/14 07:27, Alexey Charkov wrote:

2014/1/27 Rob Herring :

On Mon, Jan 27, 2014 at 5:51 AM, 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.

Signed-off-by: Alexey Charkov 
Signed-off-by: Roger Luethi 
---
  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
  drivers/net/ethernet/via/Kconfig   |   2 +-
  drivers/net/ethernet/via/via-rhine.c   | 293 +
  3 files changed, 200 insertions(+), 113 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
b/Documentation/devicetree/bindings/net/via-rhine.txt
new file mode 100644
index 000..684dd3a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-rhine.txt
@@ -0,0 +1,18 @@
+* VIA Rhine 10/100 Network Controller
+
+Required properties:
+- compatible : Should be "via,rhine"

This should be more specific rather than...


+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+- rhine,revision : Rhine core revision, used to inform the
+   driver of quirks and capabilities to expect from
+   the device. Mimics the respective PCI attribute.

having this property. The OF match table can then have the quirks set
based on compatible strings.

Sounds fair. Do you think something like the following would fly?

Required properties:
- compatible : Should be "via,rhine-soc-vt8500" for integrated Rhine
cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
possibly others. These are listed as 1106:3106 rev. 0x84 on the
virtual PCI bus under vendor-provided kernels.
Does it need a special name? I would have assumed they are using their 
own IP for the VT6105 or VT6106S.

Then you can use it to add quirks later on if needed.

Regards
Tony Prisk
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Alexey Charkov
2014/1/28 Ben Hutchings :
> On Mon, 2014-01-27 at 19:34 +0400, Alexey Charkov wrote:
>> 2014/1/27 Ben Hutchings :
>> > 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.
>>
>> Frankly, I would like to avoid that if possible (as pointed out in the
>> cover email), as I believe we would get a cleaner driver without
>> #ifdef. This is also the way it was done in via-velocity, and it works
>> just fine.
>
> OK, I'm surprised that all the PCI functions have dummy definitions.
>
>> > You should compile-test in configurations that have just one of those
>> > dependencies enabled.
>>
>> This has been compile-tested and runtime-tested in OF-only
>> configuration on WM8950, and Roger also tested it in PCI-only
>> configuration, so it seems to work fine.
> [...]
>
> Good, then I have no objection.

Thanks Ben! Would it be fine to add your Reviewed-by at the next
iteration, once I fix indentation of function arguments and
dev_is_pci()?

Thanks,
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Alexey Charkov
2014/1/27 Rob Herring :
> On Mon, Jan 27, 2014 at 5:51 AM, 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.
>>
>> Signed-off-by: Alexey Charkov 
>> Signed-off-by: Roger Luethi 
>> ---
>>  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
>>  drivers/net/ethernet/via/Kconfig   |   2 +-
>>  drivers/net/ethernet/via/via-rhine.c   | 293 
>> +
>>  3 files changed, 200 insertions(+), 113 deletions(-)
>>  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt
>>
>> diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
>> b/Documentation/devicetree/bindings/net/via-rhine.txt
>> new file mode 100644
>> index 000..684dd3a
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
>> @@ -0,0 +1,18 @@
>> +* VIA Rhine 10/100 Network Controller
>> +
>> +Required properties:
>> +- compatible : Should be "via,rhine"
>
> This should be more specific rather than...
>
>> +- reg : Address and length of the io space
>> +- interrupts : Should contain the controller interrupt line
>> +- rhine,revision : Rhine core revision, used to inform the
>> +   driver of quirks and capabilities to expect from
>> +   the device. Mimics the respective PCI attribute.
>
> having this property. The OF match table can then have the quirks set
> based on compatible strings.

Sounds fair. Do you think something like the following would fly?

Required properties:
- compatible : Should be "via,rhine-soc-vt8500" for integrated Rhine
cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
possibly others. These are listed as 1106:3106 rev. 0x84 on the
virtual PCI bus under vendor-provided kernels.

Thanks,
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Alexey Charkov
2014/1/27 Rob Herring robherri...@gmail.com:
 On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov alch...@gmail.com 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.

 Signed-off-by: Alexey Charkov alch...@gmail.com
 Signed-off-by: Roger Luethi r...@hellgate.ch
 ---
  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
  drivers/net/ethernet/via/Kconfig   |   2 +-
  drivers/net/ethernet/via/via-rhine.c   | 293 
 +
  3 files changed, 200 insertions(+), 113 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

 diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
 b/Documentation/devicetree/bindings/net/via-rhine.txt
 new file mode 100644
 index 000..684dd3a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
 @@ -0,0 +1,18 @@
 +* VIA Rhine 10/100 Network Controller
 +
 +Required properties:
 +- compatible : Should be via,rhine

 This should be more specific rather than...

 +- reg : Address and length of the io space
 +- interrupts : Should contain the controller interrupt line
 +- rhine,revision : Rhine core revision, used to inform the
 +   driver of quirks and capabilities to expect from
 +   the device. Mimics the respective PCI attribute.

 having this property. The OF match table can then have the quirks set
 based on compatible strings.

Sounds fair. Do you think something like the following would fly?

Required properties:
- compatible : Should be via,rhine-soc-vt8500 for integrated Rhine
cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
possibly others. These are listed as 1106:3106 rev. 0x84 on the
virtual PCI bus under vendor-provided kernels.

Thanks,
Alexey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Alexey Charkov
2014/1/28 Ben Hutchings b...@decadent.org.uk:
 On Mon, 2014-01-27 at 19:34 +0400, Alexey Charkov wrote:
 2014/1/27 Ben Hutchings b...@decadent.org.uk:
  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.

 Frankly, I would like to avoid that if possible (as pointed out in the
 cover email), as I believe we would get a cleaner driver without
 #ifdef. This is also the way it was done in via-velocity, and it works
 just fine.

 OK, I'm surprised that all the PCI functions have dummy definitions.

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

 This has been compile-tested and runtime-tested in OF-only
 configuration on WM8950, and Roger also tested it in PCI-only
 configuration, so it seems to work fine.
 [...]

 Good, then I have no objection.

Thanks Ben! Would it be fine to add your Reviewed-by at the next
iteration, once I fix indentation of function arguments and
dev_is_pci()?

Thanks,
Alexey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Tony Prisk

On 29/01/14 07:27, Alexey Charkov wrote:

2014/1/27 Rob Herring robherri...@gmail.com:

On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov alch...@gmail.com 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.

Signed-off-by: Alexey Charkov alch...@gmail.com
Signed-off-by: Roger Luethi r...@hellgate.ch
---
  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
  drivers/net/ethernet/via/Kconfig   |   2 +-
  drivers/net/ethernet/via/via-rhine.c   | 293 +
  3 files changed, 200 insertions(+), 113 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
b/Documentation/devicetree/bindings/net/via-rhine.txt
new file mode 100644
index 000..684dd3a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-rhine.txt
@@ -0,0 +1,18 @@
+* VIA Rhine 10/100 Network Controller
+
+Required properties:
+- compatible : Should be via,rhine

This should be more specific rather than...


+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+- rhine,revision : Rhine core revision, used to inform the
+   driver of quirks and capabilities to expect from
+   the device. Mimics the respective PCI attribute.

having this property. The OF match table can then have the quirks set
based on compatible strings.

Sounds fair. Do you think something like the following would fly?

Required properties:
- compatible : Should be via,rhine-soc-vt8500 for integrated Rhine
cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
possibly others. These are listed as 1106:3106 rev. 0x84 on the
virtual PCI bus under vendor-provided kernels.
Does it need a special name? I would have assumed they are using their 
own IP for the VT6105 or VT6106S.

Then you can use it to add quirks later on if needed.

Regards
Tony Prisk
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-28 Thread Alexey Charkov
2014/1/29 Tony Prisk li...@prisktech.co.nz:
 On 29/01/14 07:27, Alexey Charkov wrote:

 2014/1/27 Rob Herring robherri...@gmail.com:

 On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov alch...@gmail.com
 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.

 Signed-off-by: Alexey Charkov alch...@gmail.com
 Signed-off-by: Roger Luethi r...@hellgate.ch
 ---
   .../devicetree/bindings/net/via-rhine.txt  |  18 ++
   drivers/net/ethernet/via/Kconfig   |   2 +-
   drivers/net/ethernet/via/via-rhine.c   | 293
 +
   3 files changed, 200 insertions(+), 113 deletions(-)
   create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

 diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt
 b/Documentation/devicetree/bindings/net/via-rhine.txt
 new file mode 100644
 index 000..684dd3a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
 @@ -0,0 +1,18 @@
 +* VIA Rhine 10/100 Network Controller
 +
 +Required properties:
 +- compatible : Should be via,rhine

 This should be more specific rather than...

 +- reg : Address and length of the io space
 +- interrupts : Should contain the controller interrupt line
 +- rhine,revision : Rhine core revision, used to inform the
 +   driver of quirks and capabilities to expect from
 +   the device. Mimics the respective PCI attribute.

 having this property. The OF match table can then have the quirks set
 based on compatible strings.

 Sounds fair. Do you think something like the following would fly?

 Required properties:
 - compatible : Should be via,rhine-soc-vt8500 for integrated Rhine
 cores found in SoC's such as VIA VT8500, WonderMedia WM8950 and
 possibly others. These are listed as 1106:3106 rev. 0x84 on the
 virtual PCI bus under vendor-provided kernels.

 Does it need a special name? I would have assumed they are using their own
 IP for the VT6105 or VT6106S.
 Then you can use it to add quirks later on if needed.

The problem is that I have no reliable source for the exact name of
the IP block. The lookup table within the driver says that rev. 0x83
is VT6105_B0, and rev. 0x8A is VT6105L (and it doesn't contain any
entry for 0x84, so our case gets treated as 0x83 currently).

If we only differentiate them by the compatible string, I would be
reluctant to call it vt6105 or vt6106 or whatever else without knowing
for sure. Otherwise, if at some point we need to add any quirks
specific to rev. 0x84, we wouldn't be able to do that without
side-effects.

Thoughts welcome :)

Thanks,
Alexey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-27 Thread Ben Hutchings
On Mon, 2014-01-27 at 19:34 +0400, Alexey Charkov wrote:
> 2014/1/27 Ben Hutchings :
> > 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.
> 
> Frankly, I would like to avoid that if possible (as pointed out in the
> cover email), as I believe we would get a cleaner driver without
> #ifdef. This is also the way it was done in via-velocity, and it works
> just fine.

OK, I'm surprised that all the PCI functions have dummy definitions.

> > You should compile-test in configurations that have just one of those
> > dependencies enabled.
> 
> This has been compile-tested and runtime-tested in OF-only
> configuration on WM8950, and Roger also tested it in PCI-only
> configuration, so it seems to work fine.
[...]

Good, then I have no objection.

Ben.

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


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


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

2014-01-27 Thread Rob Herring
On Mon, Jan 27, 2014 at 5:51 AM, 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.
>
> Signed-off-by: Alexey Charkov 
> Signed-off-by: Roger Luethi 
> ---
>  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
>  drivers/net/ethernet/via/Kconfig   |   2 +-
>  drivers/net/ethernet/via/via-rhine.c   | 293 
> +
>  3 files changed, 200 insertions(+), 113 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt
>
> diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
> b/Documentation/devicetree/bindings/net/via-rhine.txt
> new file mode 100644
> index 000..684dd3a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
> @@ -0,0 +1,18 @@
> +* VIA Rhine 10/100 Network Controller
> +
> +Required properties:
> +- compatible : Should be "via,rhine"

This should be more specific rather than...

> +- reg : Address and length of the io space
> +- interrupts : Should contain the controller interrupt line
> +- rhine,revision : Rhine core revision, used to inform the
> +   driver of quirks and capabilities to expect from
> +   the device. Mimics the respective PCI attribute.

having this property. The OF match table can then have the quirks set
based on compatible strings.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-27 Thread Alexey Charkov
2014/1/27 Ben Hutchings :
> 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.

Frankly, I would like to avoid that if possible (as pointed out in the
cover email), as I believe we would get a cleaner driver without
#ifdef. This is also the way it was done in via-velocity, and it works
just fine.

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

This has been compile-tested and runtime-tested in OF-only
configuration on WM8950, and Roger also tested it in PCI-only
configuration, so it seems to work fine.

> [...]
>> --- 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.

Oh, cool. Didn't realize it existed :) Will adjust, thanks.

I believe the #ifdef is not strictly required, though, as we include
the PCI header anyway (and the macro expands to just a simple test).
Any specific concerns why we should do that, apart from the +3.8%
module size increase?

Thanks,
Alexey
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-27 Thread Ben Hutchings
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.


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


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

2014-01-27 Thread Alexey Charkov
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.

Signed-off-by: Alexey Charkov 
Signed-off-by: Roger Luethi 
---
 .../devicetree/bindings/net/via-rhine.txt  |  18 ++
 drivers/net/ethernet/via/Kconfig   |   2 +-
 drivers/net/ethernet/via/via-rhine.c   | 293 +
 3 files changed, 200 insertions(+), 113 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
b/Documentation/devicetree/bindings/net/via-rhine.txt
new file mode 100644
index 000..684dd3a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-rhine.txt
@@ -0,0 +1,18 @@
+* VIA Rhine 10/100 Network Controller
+
+Required properties:
+- compatible : Should be "via,rhine"
+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+- rhine,revision : Rhine core revision, used to inform the
+   driver of quirks and capabilities to expect from
+   the device. Mimics the respective PCI attribute.
+
+Examples:
+
+ethernet@d8004000 {
+   compatible = "via,rhine";
+   reg = <0xd8004000 0x100>;
+   interrupts = <10>;
+   rhine,revision = <0x84>;
+};
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index 8a049a2..f66ddae 100644
--- 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---
diff --git a/drivers/net/ethernet/via/via-rhine.c 
b/drivers/net/ethernet/via/via-rhine.c
index 95c2e93..1c609c0 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -94,6 +94,10 @@ static const int multicast_filter_limit = 32;
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 #include 
 #include 
 #include 
@@ -279,6 +283,11 @@ static DEFINE_PCI_DEVICE_TABLE(rhine_pci_tbl) = {
 };
 MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
 
+static struct of_device_id rhine_of_tbl[] = {
+   { .compatible = "via,rhine" },
+   { } /* terminate list */
+};
+MODULE_DEVICE_TABLE(of, rhine_of_tbl);
 
 /* Offsets to the device registers. */
 enum register_offsets {
@@ -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);
 }
 
 static const struct net_device_ops rhine_netdev_ops = {
@@ -868,56 +878,13 @@ static const struct net_device_ops rhine_netdev_ops = {
 #endif
 };
 
-static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id 
*ent)
+static int rhine_init_one_common(struct device *hwdev, int revision,
+long pioaddr, void __iomem *ioaddr, int irq)
 {
struct net_device *dev;
struct rhine_private *rp;
-   struct device *hwdev = >dev;
-   int revision = pdev->revision;
-   int i, rc;
-   u32 quirks;
-   long pioaddr;
-   long memaddr;
-   void __iomem *ioaddr;
-   int io_size, phy_id;
+   int i, rc, phy_id;
const char *name;
-#ifdef USE_MMIO
-   int bar = 1;
-#else
-   int bar = 0;
-#endif
-
-/* when built into the kernel, we only print version if device is found */
-#ifndef MODULE
-   pr_info_once("%s\n", version);
-#endif
-
-   io_size = 256;
-   phy_id = 0;
-   quirks = 0;
-   name = "Rhine";
-   if (revision < VTunknown0) {
-   quirks = rqRhineI;
-   io_size = 128;
-   } else if (revision >= VT6102) {
-   quirks = rqWOL | rqForceReset;
-   if (revision < VT6105) {
-   name = "Rhine II";
-   quirks |= rqStatusWBRace;   /* Rhine-II exclusive */
-   } else {
-   phy_id = 1; /* Integrated PHY, phy_id fixed to 1 */
-   if (revision >= VT6105_B0)
-   quirks |= rq6patterns;
-   if (revision < VT6105M)
-   name = "Rhine III";
-   else
-   name = "Rhine III (Management Adapter)";
-   }
-   }
-
-   rc = pci_enable_device(pdev);
-   if (rc)
-   goto err_out;
 
/* this should always be supported */
rc = dma_set_mask(hwdev, DMA_BIT_MASK(32));
@@ -926,19 +893,6 @@ static int rhine_init_one(struct pci_dev *pdev, const 
struct pci_device_id *ent)
goto err_out;

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

2014-01-27 Thread Alexey Charkov
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.

Signed-off-by: Alexey Charkov alch...@gmail.com
Signed-off-by: Roger Luethi r...@hellgate.ch
---
 .../devicetree/bindings/net/via-rhine.txt  |  18 ++
 drivers/net/ethernet/via/Kconfig   |   2 +-
 drivers/net/ethernet/via/via-rhine.c   | 293 +
 3 files changed, 200 insertions(+), 113 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
b/Documentation/devicetree/bindings/net/via-rhine.txt
new file mode 100644
index 000..684dd3a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/via-rhine.txt
@@ -0,0 +1,18 @@
+* VIA Rhine 10/100 Network Controller
+
+Required properties:
+- compatible : Should be via,rhine
+- reg : Address and length of the io space
+- interrupts : Should contain the controller interrupt line
+- rhine,revision : Rhine core revision, used to inform the
+   driver of quirks and capabilities to expect from
+   the device. Mimics the respective PCI attribute.
+
+Examples:
+
+ethernet@d8004000 {
+   compatible = via,rhine;
+   reg = 0xd8004000 0x100;
+   interrupts = 10;
+   rhine,revision = 0x84;
+};
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index 8a049a2..f66ddae 100644
--- 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---
diff --git a/drivers/net/ethernet/via/via-rhine.c 
b/drivers/net/ethernet/via/via-rhine.c
index 95c2e93..1c609c0 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c
@@ -94,6 +94,10 @@ static const int multicast_filter_limit = 32;
 #include linux/ioport.h
 #include linux/interrupt.h
 #include linux/pci.h
+#include linux/of_address.h
+#include linux/of_device.h
+#include linux/of_irq.h
+#include linux/platform_device.h
 #include linux/dma-mapping.h
 #include linux/netdevice.h
 #include linux/etherdevice.h
@@ -279,6 +283,11 @@ static DEFINE_PCI_DEVICE_TABLE(rhine_pci_tbl) = {
 };
 MODULE_DEVICE_TABLE(pci, rhine_pci_tbl);
 
+static struct of_device_id rhine_of_tbl[] = {
+   { .compatible = via,rhine },
+   { } /* terminate list */
+};
+MODULE_DEVICE_TABLE(of, rhine_of_tbl);
 
 /* Offsets to the device registers. */
 enum register_offsets {
@@ -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);
 }
 
 static const struct net_device_ops rhine_netdev_ops = {
@@ -868,56 +878,13 @@ static const struct net_device_ops rhine_netdev_ops = {
 #endif
 };
 
-static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id 
*ent)
+static int rhine_init_one_common(struct device *hwdev, int revision,
+long pioaddr, void __iomem *ioaddr, int irq)
 {
struct net_device *dev;
struct rhine_private *rp;
-   struct device *hwdev = pdev-dev;
-   int revision = pdev-revision;
-   int i, rc;
-   u32 quirks;
-   long pioaddr;
-   long memaddr;
-   void __iomem *ioaddr;
-   int io_size, phy_id;
+   int i, rc, phy_id;
const char *name;
-#ifdef USE_MMIO
-   int bar = 1;
-#else
-   int bar = 0;
-#endif
-
-/* when built into the kernel, we only print version if device is found */
-#ifndef MODULE
-   pr_info_once(%s\n, version);
-#endif
-
-   io_size = 256;
-   phy_id = 0;
-   quirks = 0;
-   name = Rhine;
-   if (revision  VTunknown0) {
-   quirks = rqRhineI;
-   io_size = 128;
-   } else if (revision = VT6102) {
-   quirks = rqWOL | rqForceReset;
-   if (revision  VT6105) {
-   name = Rhine II;
-   quirks |= rqStatusWBRace;   /* Rhine-II exclusive */
-   } else {
-   phy_id = 1; /* Integrated PHY, phy_id fixed to 1 */
-   if (revision = VT6105_B0)
-   quirks |= rq6patterns;
-   if (revision  VT6105M)
-   name = Rhine III;
-   else
-   name = Rhine III (Management Adapter);
-   }
-   }
-
-   rc = pci_enable_device(pdev);
-   if (rc)
-   goto err_out;
 
/* this should always be supported */
rc = 

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

2014-01-27 Thread Alexey Charkov
2014/1/27 Ben Hutchings b...@decadent.org.uk:
 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.

Frankly, I would like to avoid that if possible (as pointed out in the
cover email), as I believe we would get a cleaner driver without
#ifdef. This is also the way it was done in via-velocity, and it works
just fine.

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

This has been compile-tested and runtime-tested in OF-only
configuration on WM8950, and Roger also tested it in PCI-only
configuration, so it seems to work fine.

 [...]
 --- 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.

Oh, cool. Didn't realize it existed :) Will adjust, thanks.

I believe the #ifdef is not strictly required, though, as we include
the PCI header anyway (and the macro expands to just a simple test).
Any specific concerns why we should do that, apart from the +3.8%
module size increase?

Thanks,
Alexey
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-27 Thread Rob Herring
On Mon, Jan 27, 2014 at 5:51 AM, Alexey Charkov alch...@gmail.com 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.

 Signed-off-by: Alexey Charkov alch...@gmail.com
 Signed-off-by: Roger Luethi r...@hellgate.ch
 ---
  .../devicetree/bindings/net/via-rhine.txt  |  18 ++
  drivers/net/ethernet/via/Kconfig   |   2 +-
  drivers/net/ethernet/via/via-rhine.c   | 293 
 +
  3 files changed, 200 insertions(+), 113 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/net/via-rhine.txt

 diff --git a/Documentation/devicetree/bindings/net/via-rhine.txt 
 b/Documentation/devicetree/bindings/net/via-rhine.txt
 new file mode 100644
 index 000..684dd3a
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/net/via-rhine.txt
 @@ -0,0 +1,18 @@
 +* VIA Rhine 10/100 Network Controller
 +
 +Required properties:
 +- compatible : Should be via,rhine

This should be more specific rather than...

 +- reg : Address and length of the io space
 +- interrupts : Should contain the controller interrupt line
 +- rhine,revision : Rhine core revision, used to inform the
 +   driver of quirks and capabilities to expect from
 +   the device. Mimics the respective PCI attribute.

having this property. The OF match table can then have the quirks set
based on compatible strings.

Rob
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


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

2014-01-27 Thread Ben Hutchings
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.


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


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

2014-01-27 Thread Ben Hutchings
On Mon, 2014-01-27 at 19:34 +0400, Alexey Charkov wrote:
 2014/1/27 Ben Hutchings b...@decadent.org.uk:
  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.
 
 Frankly, I would like to avoid that if possible (as pointed out in the
 cover email), as I believe we would get a cleaner driver without
 #ifdef. This is also the way it was done in via-velocity, and it works
 just fine.

OK, I'm surprised that all the PCI functions have dummy definitions.

  You should compile-test in configurations that have just one of those
  dependencies enabled.
 
 This has been compile-tested and runtime-tested in OF-only
 configuration on WM8950, and Roger also tested it in PCI-only
 configuration, so it seems to work fine.
[...]

Good, then I have no objection.

Ben.

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


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