All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] cassini: Use local-mac-address prom property for
@ 2011-01-06 14:34 Richard Mortimer
  2011-01-06 19:51 ` David Miller
  2011-01-14 11:39 ` [PATCH v3] cassini: Use local-mac-address prom property for Cassini Richard Mortimer
  0 siblings, 2 replies; 7+ messages in thread
From: Richard Mortimer @ 2011-01-06 14:34 UTC (permalink / raw)
  To: sparclinux

From 603b3377a6857448006c886f10c607d07c102b64 Mon Sep 17 00:00:00 2001
From: Richard Mortimer <richm@oldelvet.org.uk>
Date: Thu, 6 Jan 2011 00:08:54 +0000
Subject: [PATCH] cassini: Use local-mac-address prom property for Cassini MAC address

Fallback on the local-mac-address prom property if the Cassini device
does not have an address programmed in the VPD ROM. This uses the same
technique as implemented by the sungem driver.

The problem was reported by Frans van Berckel using Debian kernel 2.6.34-7
on Sun Fire V440. udev was assigning a new eth<n> device name on each reboot
because the cassini driver was using a random MAC address.

Fix tested on 2.6.34-7 and 2.6.37 Sun Fire V440. Compile tested against
2.6.36 davem/sparc-2.6.git

Reported-by: Frans van Berckel <fberckel@xs4all.nl>
Tested-by: Frans van Berckel <fberckel@xs4all.nl>
Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Richard Mortimer <richm@oldelvet.org.uk>
---
 drivers/net/cassini.c |   16 ++++++++++++++++
 drivers/net/cassini.h |    3 +++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index d6b6d6a..e259c18 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -3203,6 +3203,10 @@ static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr,
 	int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */
 	int mac_off  = 0;
 
+#if defined(CONFIG_OF)
+	const unsigned char *addr;
+#endif
+
 	/* give us access to the PROM */
 	writel(BIM_LOCAL_DEV_PROM | BIM_LOCAL_DEV_PAD,
 	       cp->regs + REG_BIM_LOCAL_DEV_EN);
@@ -3350,6 +3354,14 @@ use_random_mac_addr:
 	if (found & VPD_FOUND_MAC)
 		goto done;
 
+#if defined(CONFIG_OF)
+	addr = of_get_property(cp->of_node, "local-mac-address", NULL);
+	if (addr != NULL) {
+		memcpy(dev_addr, addr, 6);
+		goto done;
+	}
+#endif
+
 	/* Sun MAC prefix then 3 random bytes. */
 	pr_info("MAC address not found in ROM VPD\n");
 	dev_addr[0] = 0x08;
@@ -5019,6 +5031,10 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 	cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE :
 	  cassini_debug;
 
+#if defined(CONFIG_OF)
+	cp->of_node = pci_device_to_OF_node(pdev);
+#endif
+
 	cp->link_transition = LINK_TRANSITION_UNKNOWN;
 	cp->link_transition_jiffies_valid = 0;
 
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h
index dbc4787..faf4746 100644
--- a/drivers/net/cassini.h
+++ b/drivers/net/cassini.h
@@ -2868,6 +2868,9 @@ struct cas {
 	dma_addr_t block_dvma, tx_tiny_dvma[N_TX_RINGS];
 	struct pci_dev *pdev;
 	struct net_device *dev;
+#if defined(CONFIG_OF)
+	struct device_node	*of_node;
+#endif
 
 	/* Firmware Info */
 	u16			fw_load_addr;
-- 
1.4.4.4




^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] cassini: Use local-mac-address prom property for
  2011-01-06 14:34 [PATCH v3] cassini: Use local-mac-address prom property for Richard Mortimer
@ 2011-01-06 19:51 ` David Miller
  2011-01-14 11:39 ` [PATCH v3] cassini: Use local-mac-address prom property for Cassini Richard Mortimer
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2011-01-06 19:51 UTC (permalink / raw)
  To: sparclinux

From: Richard Mortimer <richm@oldelvet.org.uk>
Date: Thu, 06 Jan 2011 14:34:15 +0000

>>From 603b3377a6857448006c886f10c607d07c102b64 Mon Sep 17 00:00:00 2001
> From: Richard Mortimer <richm@oldelvet.org.uk>
> Date: Thu, 6 Jan 2011 00:08:54 +0000
> Subject: [PATCH] cassini: Use local-mac-address prom property for Cassini MAC address
> 
> Fallback on the local-mac-address prom property if the Cassini device
> does not have an address programmed in the VPD ROM. This uses the same
> technique as implemented by the sungem driver.
> 
> The problem was reported by Frans van Berckel using Debian kernel 2.6.34-7
> on Sun Fire V440. udev was assigning a new eth<n> device name on each reboot
> because the cassini driver was using a random MAC address.
> 
> Fix tested on 2.6.34-7 and 2.6.37 Sun Fire V440. Compile tested against
> 2.6.36 davem/sparc-2.6.git
> 
> Reported-by: Frans van Berckel <fberckel@xs4all.nl>
> Tested-by: Frans van Berckel <fberckel@xs4all.nl>
> Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
> Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Richard Mortimer <richm@oldelvet.org.uk>

Applied, thanks a lot.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] cassini: Use local-mac-address prom property for Cassini
  2011-01-06 14:34 [PATCH v3] cassini: Use local-mac-address prom property for Richard Mortimer
  2011-01-06 19:51 ` David Miller
@ 2011-01-14 11:39 ` Richard Mortimer
  2011-01-14 20:40     ` [PATCH v3] cassini: Use local-mac-address prom property for David Miller
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Mortimer @ 2011-01-14 11:39 UTC (permalink / raw)
  To: sparclinux

All,

FYI Sinan Akman has reported that cassini does not compile for x86 any 
longer. Message included below.

Does anyone have suggestions as to the best way to resolve this?

Also are there any other lists that this should be forwarded to?

Regards

Richard


-------- Original Message --------
Subject: Re: [PATCH] cassini: Use local-mac-address prom property for 
Cassini MAC address
Date: Thu, 13 Jan 2011 20:28:54 -0500
From: Sinan Akman <sinan@writeme.com>
To: richm@oldelvet.org.uk

Richard, cassini  doesn't compile now for x86 after :

http://www.spinics.net/lists/sparclinux/msg07607.html

pci_device_to_OF_node is not defined for all archs so
perhaps you are better of leaving CONFIG_SPARC instead
of having CONFIG_OF.

Feel free to forward this to list (did this ever
appear in lmkl or only sparclinux ?).

If you have another patch on that and cc me I can
compile test for you on x86.

-- sinan


On 06/01/2011 19:51, David Miller wrote:
> From: Richard Mortimer<richm@oldelvet.org.uk>
> Date: Thu, 06 Jan 2011 14:34:15 +0000
>
>> > From 603b3377a6857448006c886f10c607d07c102b64 Mon Sep 17 00:00:00 2001
>> From: Richard Mortimer<richm@oldelvet.org.uk>
>> Date: Thu, 6 Jan 2011 00:08:54 +0000
>> Subject: [PATCH] cassini: Use local-mac-address prom property for Cassini MAC address
>>
>> Fallback on the local-mac-address prom property if the Cassini device
>> does not have an address programmed in the VPD ROM. This uses the same
>> technique as implemented by the sungem driver.
>>
>> The problem was reported by Frans van Berckel using Debian kernel 2.6.34-7
>> on Sun Fire V440. udev was assigning a new eth<n>  device name on each reboot
>> because the cassini driver was using a random MAC address.
>>
>> Fix tested on 2.6.34-7 and 2.6.37 Sun Fire V440. Compile tested against
>> 2.6.36 davem/sparc-2.6.git
>>
>> Reported-by: Frans van Berckel<fberckel@xs4all.nl>
>> Tested-by: Frans van Berckel<fberckel@xs4all.nl>
>> Reviewed-by: Julian Calaby<julian.calaby@gmail.com>
>> Reviewed-by: Sam Ravnborg<sam@ravnborg.org>
>> Signed-off-by: Richard Mortimer<richm@oldelvet.org.uk>
>
> Applied, thanks a lot.
> --
> To unsubscribe from this list: send the line "unsubscribe sparclinux" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] cassini: Use local-mac-address prom property for Cassini MAC address
  2011-01-14 11:39 ` [PATCH v3] cassini: Use local-mac-address prom property for Cassini Richard Mortimer
@ 2011-01-14 20:40     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-01-14 20:40 UTC (permalink / raw)
  To: richm; +Cc: sparclinux, fberckel, julian.calaby, sinan, linux-kernel

From: Richard Mortimer <richm@oldelvet.org.uk>
Date: Fri, 14 Jan 2011 11:39:28 +0000

> FYI Sinan Akman has reported that cassini does not compile for x86 any
> longer. Message included below.
> 
> Does anyone have suggestions as to the best way to resolve this?

I'll fix it like this:

--------------------
cassini: Fix build bustage on x86.

Unfortunately, not all CONFIG_OF platforms provide
pci_device_to_OF_node().

Change the test to CONFIG_SPARC for now to deal with
the build regressions.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/cassini.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7206ab2..3437613 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -3203,7 +3203,7 @@ static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr,
 	int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */
 	int mac_off  = 0;
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_SPARC)
 	const unsigned char *addr;
 #endif
 
@@ -3354,7 +3354,7 @@ use_random_mac_addr:
 	if (found & VPD_FOUND_MAC)
 		goto done;
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_SPARC)
 	addr = of_get_property(cp->of_node, "local-mac-address", NULL);
 	if (addr != NULL) {
 		memcpy(dev_addr, addr, 6);
@@ -5031,7 +5031,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 	cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE :
 	  cassini_debug;
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_SPARC)
 	cp->of_node = pci_device_to_OF_node(pdev);
 #endif
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] cassini: Use local-mac-address prom property for
@ 2011-01-14 20:40     ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2011-01-14 20:40 UTC (permalink / raw)
  To: richm; +Cc: sparclinux, fberckel, julian.calaby, sinan, linux-kernel

From: Richard Mortimer <richm@oldelvet.org.uk>
Date: Fri, 14 Jan 2011 11:39:28 +0000

> FYI Sinan Akman has reported that cassini does not compile for x86 any
> longer. Message included below.
> 
> Does anyone have suggestions as to the best way to resolve this?

I'll fix it like this:

--------------------
cassini: Fix build bustage on x86.

Unfortunately, not all CONFIG_OF platforms provide
pci_device_to_OF_node().

Change the test to CONFIG_SPARC for now to deal with
the build regressions.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/net/cassini.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 7206ab2..3437613 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -3203,7 +3203,7 @@ static int cas_get_vpd_info(struct cas *cp, unsigned char *dev_addr,
 	int phy_type = CAS_PHY_MII_MDIO0; /* default phy type */
 	int mac_off  = 0;
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_SPARC)
 	const unsigned char *addr;
 #endif
 
@@ -3354,7 +3354,7 @@ use_random_mac_addr:
 	if (found & VPD_FOUND_MAC)
 		goto done;
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_SPARC)
 	addr = of_get_property(cp->of_node, "local-mac-address", NULL);
 	if (addr != NULL) {
 		memcpy(dev_addr, addr, 6);
@@ -5031,7 +5031,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
 	cp->msg_enable = (cassini_debug < 0) ? CAS_DEF_MSG_ENABLE :
 	  cassini_debug;
 
-#if defined(CONFIG_OF)
+#if defined(CONFIG_SPARC)
 	cp->of_node = pci_device_to_OF_node(pdev);
 #endif
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] cassini: Use local-mac-address prom property for Cassini MAC address
  2011-01-14 20:40     ` [PATCH v3] cassini: Use local-mac-address prom property for David Miller
@ 2011-01-15  8:47       ` Richard Mortimer
  -1 siblings, 0 replies; 7+ messages in thread
From: Richard Mortimer @ 2011-01-15  8:47 UTC (permalink / raw)
  To: David Miller
  Cc: richm, sparclinux, fberckel, julian.calaby, sinan, linux-kernel

On Fri, 2011-01-14 at 12:40 -0800, David Miller wrote:
> From: Richard Mortimer <richm@oldelvet.org.uk>
> Date: Fri, 14 Jan 2011 11:39:28 +0000
> 
> > FYI Sinan Akman has reported that cassini does not compile for x86 any
> > longer. Message included below.
> > 
> > Does anyone have suggestions as to the best way to resolve this?
> 
> I'll fix it like this:
> 
Thank you.

Regards

Richard



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] cassini: Use local-mac-address prom property for
@ 2011-01-15  8:47       ` Richard Mortimer
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Mortimer @ 2011-01-15  8:47 UTC (permalink / raw)
  To: David Miller
  Cc: richm, sparclinux, fberckel, julian.calaby, sinan, linux-kernel

On Fri, 2011-01-14 at 12:40 -0800, David Miller wrote:
> From: Richard Mortimer <richm@oldelvet.org.uk>
> Date: Fri, 14 Jan 2011 11:39:28 +0000
> 
> > FYI Sinan Akman has reported that cassini does not compile for x86 any
> > longer. Message included below.
> > 
> > Does anyone have suggestions as to the best way to resolve this?
> 
> I'll fix it like this:
> 
Thank you.

Regards

Richard



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-01-15  8:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-06 14:34 [PATCH v3] cassini: Use local-mac-address prom property for Richard Mortimer
2011-01-06 19:51 ` David Miller
2011-01-14 11:39 ` [PATCH v3] cassini: Use local-mac-address prom property for Cassini Richard Mortimer
2011-01-14 20:40   ` [PATCH v3] cassini: Use local-mac-address prom property for Cassini MAC address David Miller
2011-01-14 20:40     ` [PATCH v3] cassini: Use local-mac-address prom property for David Miller
2011-01-15  8:47     ` [PATCH v3] cassini: Use local-mac-address prom property for Cassini MAC address Richard Mortimer
2011-01-15  8:47       ` [PATCH v3] cassini: Use local-mac-address prom property for Richard Mortimer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.