From: Jamie Iles <jamie@jamieiles.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>,
David Miller <davem@davemloft.net>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Andrew Victor <linux@maxim.org.za>,
Peter Korsgaard <jacmet@sunsite.dk>
Subject: Re: [PATCHv2 0/9] macb: add support for Cadence GEM
Date: Tue, 22 Mar 2011 17:55:23 +0000 [thread overview]
Message-ID: <20110322175523.GE10058@pulham.picochip.com> (raw)
In-Reply-To: <20110322163917.GD10058@pulham.picochip.com>
Hi Jean-Christophe,
On Tue, Mar 22, 2011 at 04:39:17PM +0000, Jamie Iles wrote:
> Hi Jean-Christophe,
>
> On Tue, Mar 22, 2011 at 05:18:11PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 11:18 Mon 21 Mar , Jamie Iles wrote:
> > > I have an existing tree for this at
> > >
> > > git://github.com/jamieiles/linux-2.6-ji.git macb-gem
> > >
> > > based off of 2.6.38 (with your ACK's now added) and I'd be happy with
> > > either route.
> > but we must detect the gem via the version register and ditto for macb for
> > avr32 and at91
> >
> > so please rebase it over my patch
> >
> > and you get my sob too
>
> Would you mind respinning your patch without the changes to the clk
> stuff? Otherwise we're changing it from compile time to version based,
> only to completely remove it in subsequent patches.
Actually, this patch doesn't work anyway as the version register is
being read before the clks are enabled so the device isn't accessible
(and the registers haven't yet been ioremap()'d).
> Also, can you confirm that the module ID's that you are using to
> differentiate between AT91 and AVR32 won't clash with MACB uses in
> other, non-at91/avr32 chips, or that it doesn't matter?
If this does work, then it would be nice if we made the else path of the
RMII AT91 tests also test for avr32 too so we aren't driving the USRIO
pins on platforms that aren't at91 but also aren't avr32. So something
the patch below instead.
Jamie
8<---
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 79ccb54..55b81f5 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -22,7 +22,6 @@
#include <linux/phy.h>
#include <mach/board.h>
-#include <mach/cpu.h>
#include "macb.h"
@@ -1169,6 +1168,7 @@ static int __init macb_probe(struct platform_device *pdev)
err = -ENOMEM;
goto err_out_disable_clocks;
}
+ bp->version = macb_readl(bp, VERSION);
dev->irq = platform_get_irq(pdev, 0);
err = request_irq(dev->irq, macb_interrupt, IRQF_SAMPLE_RANDOM,
@@ -1201,18 +1201,18 @@ static int __init macb_probe(struct platform_device *pdev)
macb_get_hwaddr(bp);
pdata = pdev->dev.platform_data;
- if (pdata && pdata->is_rmii)
-#if defined(CONFIG_ARCH_AT91)
- macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) );
-#else
- macb_writel(bp, USRIO, 0);
-#endif
- else
-#if defined(CONFIG_ARCH_AT91)
- macb_writel(bp, USRIO, MACB_BIT(CLKEN));
-#else
- macb_writel(bp, USRIO, MACB_BIT(MII));
-#endif
+ if (pdata && pdata->is_rmii) {
+ if (macb_is_at91(bp))
+ macb_writel(bp, USRIO,
+ (MACB_BIT(RMII) | MACB_BIT(CLKEN)));
+ else if (macb_is_avr32(bp))
+ macb_writel(bp, USRIO, 0);
+ } else {
+ if (macb_is_at91(bp))
+ macb_writel(bp, USRIO, MACB_BIT(CLKEN));
+ else if (macb_is_avr32(bp))
+ macb_writel(bp, USRIO, MACB_BIT(MII));
+ }
bp->tx_pending = DEF_TX_RING_PENDING;
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index d3212f6..56a4fcb 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -59,6 +59,7 @@
#define MACB_TPQ 0x00bc
#define MACB_USRIO 0x00c0
#define MACB_WOL 0x00c4
+#define MACB_VERSION 0x00fc
/* Bitfields in NCR */
#define MACB_LB_OFFSET 0
@@ -389,6 +390,14 @@ struct macb {
unsigned int link;
unsigned int speed;
unsigned int duplex;
+
+ uint32_t version;
};
+#define MACB_VERSION_MASK 0xffff0000
+#define macb_is_at91(bp) \
+ (((bp)->version & MACB_VERSION_MASK) == 0x06010000)
+#define macb_is_avr32(bp) \
+ (((bp)->version & MACB_VERSION_MASK) == 0x00010000)
+
#endif /* _MACB_H */
next prev parent reply other threads:[~2011-03-22 17:55 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-15 10:14 [PATCHv2 0/9] macb: add support for Cadence GEM Jamie Iles
2011-03-15 10:14 ` [PATCHv2 1/9] at91: provide macb clks with "pclk" and "hclk" name Jamie Iles
2011-03-15 12:35 ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-15 12:44 ` Jamie Iles
2011-03-16 6:53 ` avictor.za
2011-03-16 8:38 ` Russell King - ARM Linux
2011-03-17 9:22 ` Andrew Victor
2011-03-17 10:00 ` Russell King - ARM Linux
2011-03-17 10:09 ` Jamie Iles
2011-03-15 10:14 ` [PATCHv2 2/9] macb: remove conditional clk handling Jamie Iles
2011-03-15 10:14 ` [PATCHv2 3/9] macb: unify at91 and avr32 platform data Jamie Iles
2011-03-15 11:14 ` Peter Korsgaard
2011-03-15 11:34 ` Jamie Iles
2011-03-15 12:36 ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-17 8:43 ` avictor.za
2011-03-17 8:48 ` Peter Korsgaard
2011-03-17 8:58 ` Russell King - ARM Linux
2011-03-17 9:22 ` Peter Korsgaard
2011-03-17 9:34 ` Jamie Iles
2011-03-17 21:51 ` Jamie Iles
2011-03-18 15:41 ` Russell King - ARM Linux
2011-03-18 15:48 ` Jamie Iles
2011-03-18 15:54 ` Russell King - ARM Linux
2011-03-19 15:49 ` Nicolas Ferre
2011-04-23 5:48 ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-15 10:14 ` [PATCHv2 4/9] macb: convert printk to netdev_ and friends Jamie Iles
2011-03-15 12:36 ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-15 10:14 ` [PATCHv2 5/9] macb: initial support for Cadence GEM Jamie Iles
2011-03-15 10:14 ` [PATCHv2 6/9] macb: support higher rate GEM MDIO clock divisors Jamie Iles
2011-03-15 10:14 ` [PATCHv2 7/9] macb: support statistics for GEM devices Jamie Iles
2011-03-15 10:14 ` [PATCHv2 8/9] macb: support DMA bus widths > 32 bits Jamie Iles
2011-03-15 10:14 ` [PATCHv2 9/9] macb: allow GEM to have configurable receive buffer size Jamie Iles
2011-03-16 20:17 ` [PATCHv2 0/9] macb: add support for Cadence GEM David Miller
2011-03-21 6:38 ` Nicolas Ferre
2011-03-21 11:18 ` Jamie Iles
2011-03-22 16:18 ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-22 16:39 ` Jamie Iles
2011-03-22 17:55 ` Jamie Iles [this message]
2011-03-24 16:25 ` Jean-Christophe PLAGNIOL-VILLARD
2011-03-31 9:40 ` Jamie Iles
2011-04-05 10:28 ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-05 10:49 ` Jamie Iles
2011-04-05 11:21 ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-05 11:47 ` Jamie Iles
2011-04-05 11:57 ` Jean-Christophe PLAGNIOL-VILLARD
2011-04-05 11:12 ` Peter Korsgaard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110322175523.GE10058@pulham.picochip.com \
--to=jamie@jamieiles.com \
--cc=davem@davemloft.net \
--cc=jacmet@sunsite.dk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=linux@maxim.org.za \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@atmel.com \
--cc=plagnioj@jcrosoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).