public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout
@ 2009-03-23  8:58 Nicolas Ferre
  2009-03-23  9:22 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Ferre @ 2009-03-23  8:58 UTC (permalink / raw)
  To: u-boot

The MACB IP used by AVR32 & AT91 have two different layout for USRIO
register. We have to differentiate this in the driver code.
No more cpu specific #ifdefs in driver: we manage a
configuration variable.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 drivers/net/macb.c |    6 ++----
 drivers/net/macb.h |    7 +++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 6de0a04..1023315 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -446,15 +446,13 @@ static int macb_init(struct eth_device *netdev, bd_t *bd)
 
 	/* choose RMII or MII mode. This depends on the board */
 #ifdef CONFIG_RMII
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
+#if defined(CONFIG_MACB_USRIO_CFG1)
 	macb_writel(macb, USRIO, MACB_BIT(RMII) | MACB_BIT(CLKEN));
 #else
 	macb_writel(macb, USRIO, 0);
 #endif
 #else
-#if defined(CONFIG_AT91CAP9) || defined(CONFIG_AT91SAM9260) || \
-    defined(CONFIG_AT91SAM9263) || defined(CONFIG_AT91SAM9G20)
+#if defined(CONFIG_MACB_USRIO_CFG1)
 	macb_writel(macb, USRIO, MACB_BIT(CLKEN));
 #else
 	macb_writel(macb, USRIO, MACB_BIT(MII));
diff --git a/drivers/net/macb.h b/drivers/net/macb.h
index f92a20c..349499c 100644
--- a/drivers/net/macb.h
+++ b/drivers/net/macb.h
@@ -212,6 +212,13 @@
 #define MACB_SOF_OFFSET				30
 #define MACB_SOF_SIZE				2
 
+/* MACB IP used by AVR32 & AT91 have two
+ * different layout for USRIO register. */
+#if !defined(CONFIG_AVR32)
+/* Use AT91 USRIO layout */
+#define CONFIG_MACB_USRIO_CFG1	1
+#endif
+
 /* Bitfields in USRIO */
 #define MACB_MII_OFFSET				0
 #define MACB_MII_SIZE				1
-- 
1.5.3.7

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

* [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout
  2009-03-23  8:58 [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout Nicolas Ferre
@ 2009-03-23  9:22 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-03-23  9:41   ` Haavard Skinnemoen
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-03-23  9:22 UTC (permalink / raw)
  To: u-boot

On 09:58 Mon 23 Mar     , Nicolas Ferre wrote:
> The MACB IP used by AVR32 & AT91 have two different layout for USRIO
> register. We have to differentiate this in the driver code.
> No more cpu specific #ifdefs in driver: we manage a
> configuration variable.
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Ack-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

Haavard is ok for you too?

Best Regards,
J.

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

* [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout
  2009-03-23  9:22 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-03-23  9:41   ` Haavard Skinnemoen
  2009-04-02 20:28     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 5+ messages in thread
From: Haavard Skinnemoen @ 2009-03-23  9:41 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 09:58 Mon 23 Mar     , Nicolas Ferre wrote:
> > The MACB IP used by AVR32 & AT91 have two different layout for USRIO
> > register. We have to differentiate this in the driver code.
> > No more cpu specific #ifdefs in driver: we manage a
> > configuration variable.
> >
> > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>  
> Ack-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> 
> Haavard is ok for you too?

Sure.

Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>

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

* [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout
  2009-03-23  9:41   ` Haavard Skinnemoen
@ 2009-04-02 20:28     ` Jean-Christophe PLAGNIOL-VILLARD
  2009-04-02 22:02       ` Ben Warren
  0 siblings, 1 reply; 5+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2009-04-02 20:28 UTC (permalink / raw)
  To: u-boot

On 10:41 Mon 23 Mar     , Haavard Skinnemoen wrote:
> Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 09:58 Mon 23 Mar     , Nicolas Ferre wrote:
> > > The MACB IP used by AVR32 & AT91 have two different layout for USRIO
> > > register. We have to differentiate this in the driver code.
> > > No more cpu specific #ifdefs in driver: we manage a
> > > configuration variable.
> > >
> > > Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>  
> > Ack-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > 
> > Haavard is ok for you too?
> 
> Sure.
> 
> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Ben is ok for you?

Best Regards,
J.

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

* [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout
  2009-04-02 20:28     ` Jean-Christophe PLAGNIOL-VILLARD
@ 2009-04-02 22:02       ` Ben Warren
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Warren @ 2009-04-02 22:02 UTC (permalink / raw)
  To: u-boot

Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 10:41 Mon 23 Mar     , Haavard Skinnemoen wrote:
>   
>> Jean-Christophe PLAGNIOL-VILLARD wrote:
>>     
>>> On 09:58 Mon 23 Mar     , Nicolas Ferre wrote:
>>>       
>>>> The MACB IP used by AVR32 & AT91 have two different layout for USRIO
>>>> register. We have to differentiate this in the driver code.
>>>> No more cpu specific #ifdefs in driver: we manage a
>>>> configuration variable.
>>>>
>>>> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>  
>>>>         
>>> Ack-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
>>>
>>> Haavard is ok for you too?
>>>       
>> Sure.
>>
>> Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
>>     
> Ben is ok for you?
>   
It's definitely an improvement, although I'm not fond of placing the 
conditional macro in the header file.  Overall OK, though.  I'll pick it up.

regards,
Ben

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

end of thread, other threads:[~2009-04-02 22:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-23  8:58 [U-Boot] [PATCH] Network AT91 AVR32: generic way of addressing USRIO register layout Nicolas Ferre
2009-03-23  9:22 ` Jean-Christophe PLAGNIOL-VILLARD
2009-03-23  9:41   ` Haavard Skinnemoen
2009-04-02 20:28     ` Jean-Christophe PLAGNIOL-VILLARD
2009-04-02 22:02       ` Ben Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox