Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-29 Thread Haavard Skinnemoen
Ben Warren wrote:
 Jean-Christophe PLAGNIOL-VILLARD wrote:
  make sense
  so I'll put a 10Mpbs phy personnaly instead or a 10/100 that can be put in a
  10 mode instead to avoid to manage it in the code

 I haven't shopped for PHYs in a while, but imagine it's probably hard to 
 find one that's 10Mb only, and if so it's probably more expensive than 
 10/100

Especially when the board really is _supposed_ to do 100Mbps just fine.

  No need to disable autonegotiation -- you still want to select between
  half an full duplex, for example. But you'll need to limit the
  available options to the ones that actually work.
  
  I do not mean the autoneg but to specify to the phy, if possible, to never
  accept the 100Mps instead of do it in the code

 That's basically why the advertise register is r/w, so you can limit 
 autonegotiation through software and don't have to allocate pins for 
 strapping.

Yeah, I thought the advertise register was the correct way of informing
the phy about what modes you support...

I suppose we could move the initialization of the advertise register to
board code, but that's going to be a lot uglier since the board code
would have to access the MACB hardware to drive the MDIO pins.

Perhaps some boards don't need any initialization at all, but then
again, isn't it safer to unconditionally write the correct value? And
when we're going to write the register _anyway_, we might as well allow
the board code to influence the value we're going to write.

The more I think of this, the more I'm convinced we should have allowed
that from the beginning. The current driver is making assumptions it
shouldn't be making.

  That said, I kind of like Ben's suggestion -- it's a more general
  solution to all sorts of board/phy/chip/whatever limitations.
 
  As for a better name, how about CONFIG_MACB_ADVERTISE?
  
  why not

 I like it too.  One of the common checkbox items, though: do any Atmel 
 chips have more than one MACB, in which case this should be 
 CONFIG_MACBx_ADVERTISE or something like that?

Yes, AT32AP7000 has two MACBs, so that's probably a good idea.

Better yet, make it CONFIG_MACB_ADVERTISE(macb) so that the board can
distinguish between various instances if it has to, and the driver
doesn't have to do a long sequence of #ifdefs to find the correct value.

Haavard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-28 Thread Jean-Christophe PLAGNIOL-VILLARD
  +
  +#ifdef CONFIG_MACB_FORCE10M
  + printf(%s: 100Mbps is not supported on this board - forcing 
  10Mbps.\n,
  +netdev-name);
  +
  + adv = ~ADVERTISE_100FULL;
  + adv = ~ADVERTISE_100HALF;
  + adv = ~ADVERTISE_100BASE4;
  +#endif
 not a fan
 could you be more specific about the problem?
 
  Best Regards,
  J.
 
 
 On the EVK1100 board, the CPU (UC3A0512) is connected to the PHY via an
 RMII bus. This requires the CPU clock to be at least 50 MHz.
 Unfortunately, the chip on current EVK1100 boards may be unable to run
 at more than 50 MHz, and with the oscillator on the board, the closest
 frequency we can generate is 48 MHz.
IMHO It's a HW design error to not use the MII
 
 This patch makes it possible to limit the macb to 10 MBit for this
 case. We are open for suggestions for other solutions.
I guest you may need to disable the phy auto config mode and force him to be
see as a 10Mbps phy evenif it's a 10/100

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-28 Thread Haavard Skinnemoen
Jean-Christophe PLAGNIOL-VILLARD wrote:
  On the EVK1100 board, the CPU (UC3A0512) is connected to the PHY via an
  RMII bus. This requires the CPU clock to be at least 50 MHz.
  Unfortunately, the chip on current EVK1100 boards may be unable to run
  at more than 50 MHz, and with the oscillator on the board, the closest
  frequency we can generate is 48 MHz.  
 IMHO It's a HW design error to not use the MII

Some people want to use the extra pins for other things...

Unfortunately, there are quite a few boards with early engineering
samples around, and they have various issues. The chips that are in
production are capable of running fast enough to support RMII.

  This patch makes it possible to limit the macb to 10 MBit for this
  case. We are open for suggestions for other solutions.  
 I guest you may need to disable the phy auto config mode and force him to be
 see as a 10Mbps phy evenif it's a 10/100

No need to disable autonegotiation -- you still want to select between
half an full duplex, for example. But you'll need to limit the
available options to the ones that actually work.

That said, I kind of like Ben's suggestion -- it's a more general
solution to all sorts of board/phy/chip/whatever limitations.

As for a better name, how about CONFIG_MACB_ADVERTISE?

Haavard
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-28 Thread Jean-Christophe PLAGNIOL-VILLARD
On 22:42 Wed 28 Jan , Haavard Skinnemoen wrote:
 Jean-Christophe PLAGNIOL-VILLARD wrote:
   On the EVK1100 board, the CPU (UC3A0512) is connected to the PHY via an
   RMII bus. This requires the CPU clock to be at least 50 MHz.
   Unfortunately, the chip on current EVK1100 boards may be unable to run
   at more than 50 MHz, and with the oscillator on the board, the closest
   frequency we can generate is 48 MHz.  
  IMHO It's a HW design error to not use the MII
 
 Some people want to use the extra pins for other things...
make sense
so I'll put a 10Mpbs phy personnaly instead or a 10/100 that can be put in a
10 mode instead to avoid to manage it in the code
 
 Unfortunately, there are quite a few boards with early engineering
 samples around, and they have various issues. The chips that are in
 production are capable of running fast enough to support RMII.
 
   This patch makes it possible to limit the macb to 10 MBit for this
   case. We are open for suggestions for other solutions.  
  I guest you may need to disable the phy auto config mode and force him to be
  see as a 10Mbps phy evenif it's a 10/100
 
 No need to disable autonegotiation -- you still want to select between
 half an full duplex, for example. But you'll need to limit the
 available options to the ones that actually work.
I do not mean the autoneg but to specify to the phy, if possible, to never
accept the 100Mps instead of do it in the code
 
 That said, I kind of like Ben's suggestion -- it's a more general
 solution to all sorts of board/phy/chip/whatever limitations.
 
 As for a better name, how about CONFIG_MACB_ADVERTISE?
why not

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-28 Thread Ben Warren
Jean-Christophe PLAGNIOL-VILLARD wrote:
 On 22:42 Wed 28 Jan , Haavard Skinnemoen wrote:
   
 Jean-Christophe PLAGNIOL-VILLARD wrote:
 
 On the EVK1100 board, the CPU (UC3A0512) is connected to the PHY via an
 RMII bus. This requires the CPU clock to be at least 50 MHz.
 Unfortunately, the chip on current EVK1100 boards may be unable to run
 at more than 50 MHz, and with the oscillator on the board, the closest
 frequency we can generate is 48 MHz.  
 
 IMHO It's a HW design error to not use the MII
   
 Some people want to use the extra pins for other things...
 
 make sense
 so I'll put a 10Mpbs phy personnaly instead or a 10/100 that can be put in a
 10 mode instead to avoid to manage it in the code
   
I haven't shopped for PHYs in a while, but imagine it's probably hard to 
find one that's 10Mb only, and if so it's probably more expensive than 
10/100
 Unfortunately, there are quite a few boards with early engineering
 samples around, and they have various issues. The chips that are in
 production are capable of running fast enough to support RMII.

 
 This patch makes it possible to limit the macb to 10 MBit for this
 case. We are open for suggestions for other solutions.  
 
 I guest you may need to disable the phy auto config mode and force him to be
 see as a 10Mbps phy evenif it's a 10/100
   
 No need to disable autonegotiation -- you still want to select between
 half an full duplex, for example. But you'll need to limit the
 available options to the ones that actually work.
 
 I do not mean the autoneg but to specify to the phy, if possible, to never
 accept the 100Mps instead of do it in the code
   
That's basically why the advertise register is r/w, so you can limit 
autonegotiation through software and don't have to allocate pins for 
strapping.
 That said, I kind of like Ben's suggestion -- it's a more general
 solution to all sorts of board/phy/chip/whatever limitations.

 As for a better name, how about CONFIG_MACB_ADVERTISE?
 
 why not
   
I like it too.  One of the common checkbox items, though: do any Atmel 
chips have more than one MACB, in which case this should be 
CONFIG_MACBx_ADVERTISE or something like that?
 Best Regards,
 J.
   
regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-28 Thread Jean-Christophe PLAGNIOL-VILLARD

 
 This patch makes it possible to limit the macb to 10 MBit for this
 case. We are open for suggestions for other solutions.  
 I guest you may need to disable the phy auto config mode and force him to 
 be
 see as a 10Mbps phy evenif it's a 10/100
   
 No need to disable autonegotiation -- you still want to select between
 half an full duplex, for example. But you'll need to limit the
 available options to the ones that actually work.
 
 I do not mean the autoneg but to specify to the phy, if possible, to never
 accept the 100Mps instead of do it in the code
   
 That's basically why the advertise register is r/w, so you can limit  
 autonegotiation through software and don't have to allocate pins for  
 strapping.
I've some phy/switch here that have on option to put them in 10M mode without
have to manage it after even via the adverstise

I've just guess maybe the one on the board could allow it too
 I like it too.  One of the common checkbox items, though: do any Atmel  
 chips have more than one MACB, in which case this should be  
 CONFIG_MACBx_ADVERTISE or something like that?
on at91 actually not

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-28 Thread Hans-Christian Egtvedt
On Wed, 28 Jan 2009 15:40:49 -0800
Ben Warren biggerbadder...@gmail.com wrote:

 Jean-Christophe PLAGNIOL-VILLARD wrote:
  On 22:42 Wed 28 Jan , Haavard Skinnemoen wrote:


snipp

  As for a better name, how about CONFIG_MACB_ADVERTISE?
  
  why not

 I like it too.  One of the common checkbox items, though: do any
 Atmel chips have more than one MACB, in which case this should be 
 CONFIG_MACBx_ADVERTISE or something like that?


Yes, AP7000 have two Ethernet MACs. And if I got this right you want to
make a generic config about it, so then I guess it should open up for
having more than one MAC.

-- 
Best regards,
Hans-Christian Egtvedt
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-27 Thread Ben Warren
Hi Gunnar,


Gunnar Rangøy wrote:
 On Fri, Jan 23, 2009 at 4:38 PM, Jean-Christophe PLAGNIOL-VILLARD
 plagn...@jcrosoft.com wrote:
   
 On 12:56 Fri 23 Jan , Gunnar Rangoy wrote:
 
 From: Olav Morken olav...@gmail.com

 For 100mbps operation, the ethernet controller requires a 25 MHz clock
 in MII mode, and a 50 MHz clock in RMII mode. If the clock is slower,
 disable 100 Mbps mode.

 Signed-off-by: Gunnar Rangoy gun...@rangoy.com
 Signed-off-by: Paul Driveklepp pauldrivekl...@gmail.com
 Signed-off-by: Olav Morken olav...@gmail.com
 ---
  drivers/net/macb.c |   12 +++-
  1 files changed, 11 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/macb.c b/drivers/net/macb.c
 index 08bebf7..d47a052 100644
 --- a/drivers/net/macb.c
 +++ b/drivers/net/macb.c
 @@ -297,7 +297,17 @@ static void macb_phy_reset(struct macb_device *macb)
   int i;
   u16 status, adv;

 - adv = ADVERTISE_CSMA | ADVERTISE_ALL;
 + adv = ADVERTISE_CSMA | ADVERTISE_ALL ;
   
 ??
 

 Oops... Will fix this.

   
 +
 +#ifdef CONFIG_MACB_FORCE10M
 + printf(%s: 100Mbps is not supported on this board - forcing 
 10Mbps.\n,
 +netdev-name);
 +
 + adv = ~ADVERTISE_100FULL;
 + adv = ~ADVERTISE_100HALF;
 + adv = ~ADVERTISE_100BASE4;
 +#endif
   
not a fan
could you be more specific about the problem?

 Best Regards,
 J.

 

 On the EVK1100 board, the CPU (UC3A0512) is connected to the PHY via an
 RMII bus. This requires the CPU clock to be at least 50 MHz.
 Unfortunately, the chip on current EVK1100 boards may be unable to run
 at more than 50 MHz, and with the oscillator on the board, the closest
 frequency we can generate is 48 MHz.

 This patch makes it possible to limit the macb to 10 MBit for this
 case. We are open for suggestions for other solutions.

   
How about using a PHY capability override CONFIG.  Something like this:

#if defined(CONFIG_MACB_PHY_CAPAB)-- insert better name here
adv = ADVERTISE_CSMA | CONFIG_MACB_PHY_CAPAB;
#else
adv = ADVERTISE_CSMA | ADVERTISE_ALL
#endif

Just an idea...

regards,
Ben

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-26 Thread Gunnar Rangøy
On Fri, Jan 23, 2009 at 4:38 PM, Jean-Christophe PLAGNIOL-VILLARD
plagn...@jcrosoft.com wrote:
 On 12:56 Fri 23 Jan , Gunnar Rangoy wrote:
 From: Olav Morken olav...@gmail.com

 For 100mbps operation, the ethernet controller requires a 25 MHz clock
 in MII mode, and a 50 MHz clock in RMII mode. If the clock is slower,
 disable 100 Mbps mode.

 Signed-off-by: Gunnar Rangoy gun...@rangoy.com
 Signed-off-by: Paul Driveklepp pauldrivekl...@gmail.com
 Signed-off-by: Olav Morken olav...@gmail.com
 ---
  drivers/net/macb.c |   12 +++-
  1 files changed, 11 insertions(+), 1 deletions(-)

 diff --git a/drivers/net/macb.c b/drivers/net/macb.c
 index 08bebf7..d47a052 100644
 --- a/drivers/net/macb.c
 +++ b/drivers/net/macb.c
 @@ -297,7 +297,17 @@ static void macb_phy_reset(struct macb_device *macb)
   int i;
   u16 status, adv;

 - adv = ADVERTISE_CSMA | ADVERTISE_ALL;
 + adv = ADVERTISE_CSMA | ADVERTISE_ALL ;
 ??

Oops... Will fix this.

 +
 +#ifdef CONFIG_MACB_FORCE10M
 + printf(%s: 100Mbps is not supported on this board - forcing 
 10Mbps.\n,
 +netdev-name);
 +
 + adv = ~ADVERTISE_100FULL;
 + adv = ~ADVERTISE_100HALF;
 + adv = ~ADVERTISE_100BASE4;
 +#endif
not a fan
could you be more specific about the problem?

 Best Regards,
 J.


On the EVK1100 board, the CPU (UC3A0512) is connected to the PHY via an
RMII bus. This requires the CPU clock to be at least 50 MHz.
Unfortunately, the chip on current EVK1100 boards may be unable to run
at more than 50 MHz, and with the oscillator on the board, the closest
frequency we can generate is 48 MHz.

This patch makes it possible to limit the macb to 10 MBit for this
case. We are open for suggestions for other solutions.

-- 
Gunnar Rangøy,
99360699
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-23 Thread Gunnar Rangoy
From: Olav Morken olav...@gmail.com

For 100mbps operation, the ethernet controller requires a 25 MHz clock
in MII mode, and a 50 MHz clock in RMII mode. If the clock is slower,
disable 100 Mbps mode.

Signed-off-by: Gunnar Rangoy gun...@rangoy.com
Signed-off-by: Paul Driveklepp pauldrivekl...@gmail.com
Signed-off-by: Olav Morken olav...@gmail.com
---
 drivers/net/macb.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 08bebf7..d47a052 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -297,7 +297,17 @@ static void macb_phy_reset(struct macb_device *macb)
int i;
u16 status, adv;
 
-   adv = ADVERTISE_CSMA | ADVERTISE_ALL;
+   adv = ADVERTISE_CSMA | ADVERTISE_ALL ;
+
+#ifdef CONFIG_MACB_FORCE10M
+   printf(%s: 100Mbps is not supported on this board - forcing 10Mbps.\n,
+  netdev-name);
+
+   adv = ~ADVERTISE_100FULL;
+   adv = ~ADVERTISE_100HALF;
+   adv = ~ADVERTISE_100BASE4;
+#endif
+
macb_mdio_write(macb, MII_ADVERTISE, adv);
printf(%s: Starting autonegotiation...\n, netdev-name);
macb_mdio_write(macb, MII_BMCR, (BMCR_ANENABLE
-- 
1.6.0.4

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 5/9] AVR32: macb - Disable 100mbps if clock is slow

2009-01-23 Thread Jean-Christophe PLAGNIOL-VILLARD
On 12:56 Fri 23 Jan , Gunnar Rangoy wrote:
 From: Olav Morken olav...@gmail.com
 
 For 100mbps operation, the ethernet controller requires a 25 MHz clock
 in MII mode, and a 50 MHz clock in RMII mode. If the clock is slower,
 disable 100 Mbps mode.
 
 Signed-off-by: Gunnar Rangoy gun...@rangoy.com
 Signed-off-by: Paul Driveklepp pauldrivekl...@gmail.com
 Signed-off-by: Olav Morken olav...@gmail.com
 ---
  drivers/net/macb.c |   12 +++-
  1 files changed, 11 insertions(+), 1 deletions(-)
 
 diff --git a/drivers/net/macb.c b/drivers/net/macb.c
 index 08bebf7..d47a052 100644
 --- a/drivers/net/macb.c
 +++ b/drivers/net/macb.c
 @@ -297,7 +297,17 @@ static void macb_phy_reset(struct macb_device *macb)
   int i;
   u16 status, adv;
  
 - adv = ADVERTISE_CSMA | ADVERTISE_ALL;
 + adv = ADVERTISE_CSMA | ADVERTISE_ALL ;
??
 +
 +#ifdef CONFIG_MACB_FORCE10M
 + printf(%s: 100Mbps is not supported on this board - forcing 10Mbps.\n,
 +netdev-name);
 +
 + adv = ~ADVERTISE_100FULL;
 + adv = ~ADVERTISE_100HALF;
 + adv = ~ADVERTISE_100BASE4;
 +#endif
not a fan
could you be more specific about the problem?

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot