* PHY update
@ 2010-04-09 7:11 Christophe Coutand
2010-05-12 10:21 ` John Dallaway
0 siblings, 1 reply; 8+ messages in thread
From: Christophe Coutand @ 2010-04-09 7:11 UTC (permalink / raw)
To: ecos-patches
[-- Attachment #1: Type: text/plain, Size: 370 bytes --]
Hi,
Attached are some new PHY support to HAL. Vitesse VSC8244 is part of a
port to Freescale 8572 evaluation board. Rest of the HAL for this
processor will follow.
Let me know if the patch is correctly generated. IP101A is submitted on
behalf of Edgar Grimberg @ Zylin.com and VSC864 is submitted on behalf
of Sachin Sushil Chaddha @ stmi.com
Christophe
[-- Attachment #2: phy.tar.gz --]
[-- Type: application/x-gzip, Size: 3410 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PHY update
2010-04-09 7:11 PHY update Christophe Coutand
@ 2010-05-12 10:21 ` John Dallaway
2010-05-12 10:44 ` Christophe Coutand
[not found] ` <D6050C555CC56940A7AF32652283027601116BF4@mail2.STMIRV01.COM>
0 siblings, 2 replies; 8+ messages in thread
From: John Dallaway @ 2010-05-12 10:21 UTC (permalink / raw)
To: Christophe Coutand, Edgar Grimberg, Sachin Sushil Chaddha; +Cc: ecos-patches
Hi Christophe, Edgar and Sachin Sushil Chaddha
Christophe Coutand wrote:
> Attached are some new PHY support to HAL. Vitesse VSC8244 is part of a
> port to Freescale 8572 evaluation board. Rest of the HAL for this
> processor will follow.
>
> Let me know if the patch is correctly generated. IP101A is submitted on
> behalf of Edgar Grimberg @ Zylin.com and VSC864 is submitted on behalf
> of Sachin Sushil Chaddha @ stmi.com
Thank you for your contributions.
We will need a copyright assignment to the FSF in place for Sachin
Sushil Chaddha before we can accept his part of the contribution. Could
you complete the assignment request form please? Details at:
http://ecos.sourceware.org/assign.html
John Dallaway
eCos maintainer
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: PHY update
2010-05-12 10:21 ` John Dallaway
@ 2010-05-12 10:44 ` Christophe Coutand
[not found] ` <D6050C555CC56940A7AF32652283027601116BF4@mail2.STMIRV01.COM>
1 sibling, 0 replies; 8+ messages in thread
From: Christophe Coutand @ 2010-05-12 10:44 UTC (permalink / raw)
To: John Dallaway, Sachin Sushil Chaddha; +Cc: ecos-patches
Hi John,
Sachin should have received the copyright assignment months ago. The FSF
does not seem to respond to Sachin's email so I have no idea what is the
status.
We will inform you when we manage to get in touch with the FSF.
Regards,
Christophe
-----Original Message-----
From: John Dallaway [mailto:john@dallaway.org.uk]
Sent: 12. mai 2010 12:22
To: Christophe Coutand; Edgar Grimberg; Sachin Sushil Chaddha
Cc: ecos-patches@ecos.sourceware.org
Subject: Re: PHY update
Hi Christophe, Edgar and Sachin Sushil Chaddha
Christophe Coutand wrote:
> Attached are some new PHY support to HAL. Vitesse VSC8244 is part of a
> port to Freescale 8572 evaluation board. Rest of the HAL for this
> processor will follow.
>
> Let me know if the patch is correctly generated. IP101A is submitted
on
> behalf of Edgar Grimberg @ Zylin.com and VSC864 is submitted on behalf
> of Sachin Sushil Chaddha @ stmi.com
Thank you for your contributions.
We will need a copyright assignment to the FSF in place for Sachin
Sushil Chaddha before we can accept his part of the contribution. Could
you complete the assignment request form please? Details at:
http://ecos.sourceware.org/assign.html
John Dallaway
eCos maintainer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PHY update
[not found] ` <D6050C555CC56940A7AF32652283027601116BF4@mail2.STMIRV01.COM>
@ 2010-06-08 11:02 ` John Dallaway
2010-06-08 12:14 ` Christophe Coutand
0 siblings, 1 reply; 8+ messages in thread
From: John Dallaway @ 2010-06-08 11:02 UTC (permalink / raw)
To: Sachin Sushil Chaddha, Christophe Coutand, Edgar Grimberg
Cc: ecos-patches, chadhas
Hi Sachin, Chrristophe and Edgar
Sachin Sushil Chaddha wrote:
> I have received my Copyright Assignment form, which is attached for your
> reference.
That's great. Thank you.
> Christophe Coutand wrote:
>
>> Attached are some new PHY support to HAL. Vitesse VSC8244 is part of a
>> port to Freescale 8572 evaluation board. Rest of the HAL for this
>> processor will follow.
>>
>> Let me know if the patch is correctly generated. IP101A is submitted on
>> behalf of Edgar Grimberg @ Zylin.com and VSC864 is submitted on behalf
>> of Sachin Sushil Chaddha @ stmi.com
Is there a reason why you have placed the PHY register definitions into
an external header file? Might they be required by other eCos packages?
If there _is_ a good reason, then we should add the standard copyright
banner to these header files and adhere to eCos file naming conventions.
Otherwise, I would suggest placing these definitions in the relevant .c
source files directly similar to the support for other PHY parts
(INLXT972.c and KSZ8041.c for example).
John Dallaway
eCos maintainer
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: PHY update
2010-06-08 11:02 ` John Dallaway
@ 2010-06-08 12:14 ` Christophe Coutand
2010-06-09 16:45 ` John Dallaway
0 siblings, 1 reply; 8+ messages in thread
From: Christophe Coutand @ 2010-06-08 12:14 UTC (permalink / raw)
To: John Dallaway, Sachin Sushil Chaddha, Edgar Grimberg
Cc: ecos-patches, chadhas
Hi John,
The reason for having external definitions was to keep all registers
definition in the same place. Some HW may have to configure special PHY
registers (to adjust clock delay etc..) to be able to work properly.
This work is left to the user since it is HW specific.
Currently no package rely on these header files. Let me know what you
prefer and I can submit a new patch.
Regards,
Christophe
-----Original Message-----
From: John Dallaway [mailto:john@dallaway.org.uk]
Sent: 8. juni 2010 13:02
To: Sachin Sushil Chaddha; Christophe Coutand; Edgar Grimberg
Cc: ecos-patches@ecos.sourceware.org; chadhas@ymail.com
Subject: Re: PHY update
Hi Sachin, Chrristophe and Edgar
Sachin Sushil Chaddha wrote:
> I have received my Copyright Assignment form, which is attached for
your
> reference.
That's great. Thank you.
> Christophe Coutand wrote:
>
>> Attached are some new PHY support to HAL. Vitesse VSC8244 is part of
a
>> port to Freescale 8572 evaluation board. Rest of the HAL for this
>> processor will follow.
>>
>> Let me know if the patch is correctly generated. IP101A is submitted
on
>> behalf of Edgar Grimberg @ Zylin.com and VSC864 is submitted on
behalf
>> of Sachin Sushil Chaddha @ stmi.com
Is there a reason why you have placed the PHY register definitions into
an external header file? Might they be required by other eCos packages?
If there _is_ a good reason, then we should add the standard copyright
banner to these header files and adhere to eCos file naming conventions.
Otherwise, I would suggest placing these definitions in the relevant .c
source files directly similar to the support for other PHY parts
(INLXT972.c and KSZ8041.c for example).
John Dallaway
eCos maintainer
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PHY update
2010-06-08 12:14 ` Christophe Coutand
@ 2010-06-09 16:45 ` John Dallaway
2010-06-10 17:42 ` Christophe Coutand
0 siblings, 1 reply; 8+ messages in thread
From: John Dallaway @ 2010-06-09 16:45 UTC (permalink / raw)
To: Christophe Coutand
Cc: Sachin Sushil Chaddha, Edgar Grimberg, ecos-patches, chadhas
Hi Christophe
Christophe Coutand wrote:
> John Dallaway wrote:
>
>> Is there a reason why you have placed the PHY register definitions
>> into an external header file? Might they be required by other eCos
>> packages?
>>
>> If there _is_ a good reason, then we should add the standard
>> copyright banner to these header files and adhere to eCos file naming
>> conventions. Otherwise, I would suggest placing these definitions in
>> the relevant .c source files directly similar to the support for
>> other PHY parts (INLXT972.c and KSZ8041.c for example).
>
> The reason for having external definitions was to keep all registers
> definition in the same place. Some HW may have to configure special PHY
> registers (to adjust clock delay etc..) to be able to work properly.
> This work is left to the user since it is HW specific.
>
> Currently no package rely on these header files. Let me know what you
> prefer and I can submit a new patch.
OK. I think we should put the header files into the src/ directory for
now and give them names IP101A.h, VSC8244.h and VSC8641.h (matching the
.c source file naming). If they are needed by other packages in the
future, we can easily relocate them to the include/ directory. Can you
also add the standard eCos license/copyright banner at the top of each
header file please?
Thank you
John Dallaway
eCos maintainer
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: PHY update
2010-06-09 16:45 ` John Dallaway
@ 2010-06-10 17:42 ` Christophe Coutand
2010-06-15 8:27 ` John Dallaway
0 siblings, 1 reply; 8+ messages in thread
From: Christophe Coutand @ 2010-06-10 17:42 UTC (permalink / raw)
To: John Dallaway
Cc: Sachin Sushil Chaddha, Edgar Grimberg, ecos-patches, chadhas
[-- Attachment #1: Type: text/plain, Size: 1729 bytes --]
Hi John,
Please find attached updated patch.
Regards,
Christophe
-----Original Message-----
From: John Dallaway [mailto:john@dallaway.org.uk]
Sent: 9. juni 2010 18:45
To: Christophe Coutand
Cc: Sachin Sushil Chaddha; Edgar Grimberg;
ecos-patches@ecos.sourceware.org; chadhas@ymail.com
Subject: Re: PHY update
Hi Christophe
Christophe Coutand wrote:
> John Dallaway wrote:
>
>> Is there a reason why you have placed the PHY register definitions
>> into an external header file? Might they be required by other eCos
>> packages?
>>
>> If there _is_ a good reason, then we should add the standard
>> copyright banner to these header files and adhere to eCos file naming
>> conventions. Otherwise, I would suggest placing these definitions in
>> the relevant .c source files directly similar to the support for
>> other PHY parts (INLXT972.c and KSZ8041.c for example).
>
> The reason for having external definitions was to keep all registers
> definition in the same place. Some HW may have to configure special
PHY
> registers (to adjust clock delay etc..) to be able to work properly.
> This work is left to the user since it is HW specific.
>
> Currently no package rely on these header files. Let me know what you
> prefer and I can submit a new patch.
OK. I think we should put the header files into the src/ directory for
now and give them names IP101A.h, VSC8244.h and VSC8641.h (matching the
.c source file naming). If they are needed by other packages in the
future, we can easily relocate them to the include/ directory. Can you
also add the standard eCos license/copyright banner at the top of each
header file please?
Thank you
John Dallaway
eCos maintainer
[-- Attachment #2: eth_phy --]
[-- Type: application/octet-stream, Size: 30279 bytes --]
diff -r ae816c83f082 packages/devs/eth/phy/current/src/IP101A.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/devs/eth/phy/current/src/IP101A.c Thu Jun 10 19:25:19 2010 +0200
@@ -0,0 +1,117 @@
+//==========================================================================
+//
+// phy/ip101a.c
+//
+// Ethernet PHY driver
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Edgar Grimberg
+// Contributors:
+// Date: 2009-11-01
+// Purpose:
+// Description: hardware driver for Ethernet PHY IC+ IP101A
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/devs_eth_phy.h>
+
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/drv_api.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_tables.h>
+
+#include <cyg/io/eth_phy.h>
+#include <cyg/io/eth_phy_dev.h>
+
+#include "IP101A.h"
+
+static bool ip101a_stat(eth_phy_access_t *f, int *state)
+{
+ unsigned short phy_state;
+ int tries;
+ int auto_completed = 1;
+
+ // Read negotiated state from the Quick Poll Detailed Status Register
+ if (_eth_phy_read(f, MII_STAT_REG, f->phy_addr, &phy_state))
+ {
+ if ((phy_state & IP101A_AUTO_COMPLETED) == 0)
+ {
+ auto_completed = 0;
+ eth_phy_printf("... waiting for auto-negotiation");
+ for (tries = 0; tries < CYGINT_DEVS_ETH_PHY_AUTO_NEGOTIATION_TIME; tries++)
+ {
+ if (_eth_phy_read(f, MII_STAT_REG, f->phy_addr, &phy_state))
+ {
+ if ((phy_state & IP101A_AUTO_COMPLETED) != 0)
+ {
+ auto_completed = 1;
+ break;
+ }
+ }
+ CYGACC_CALL_IF_DELAY_US(1000000); // 1 second
+ eth_phy_printf(".");
+ }
+ eth_phy_printf("\n");
+ }
+
+ if(auto_completed)
+ {
+ _eth_phy_read(f, MII_PHY_STAT_REG, f->phy_addr, &phy_state);
+
+ if(phy_state & IP101A_LINK_STATUS2)
+ *state |= ETH_PHY_STAT_LINK;
+ if(phy_state & IP101A_SPEED_100MB)
+ *state |= ETH_PHY_STAT_100MB;
+ if(phy_state & IP101A_DUPLEX_MODE)
+ *state |= ETH_PHY_STAT_FDX;
+ return true;
+ }
+
+ }
+ return false;
+}
+
+
+_eth_phy_dev("IC+ IP101A", 0x02430c54, ip101a_stat)
+
diff -r ae816c83f082 packages/devs/eth/phy/current/src/IP101A.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/devs/eth/phy/current/src/IP101A.h Thu Jun 10 19:25:33 2010 +0200
@@ -0,0 +1,92 @@
+#ifndef _PHY_IP101A_HEADER_
+#define _PHY_IP101A_HEADER_
+//==========================================================================
+//
+// phy/ip101a.h
+//
+// Ethernet PHY driver
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Edgar Grimberg
+// Contributors:
+// Date: 2009-11-01
+// Purpose:
+// Description: Hardware driver for Ethernet PHY IC+ IP101A
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#define MII_CTRL_REG 0x00
+#define MII_STAT_REG 0x01
+#define MII_PHY_ID1_REG 0x02
+#define MII_PHY_ID2_REG 0x03
+#define MII_AUTO_NEG_ADV_REG 0x04
+#define MII_AUTO_NEG_LPA_REG 0x05
+#define MII_AUTO_NEG_EXP_REG 0x06
+#define MII_PHY_CTRL_REG 0x10
+#define MII_PHY_IRQ_REG 0x11
+#define MII_PHY_STAT_REG 0x12
+#define MII_PHY_CTRL2_REG 0x1E
+
+#define MII_PHY_IRQ_INTR 0x8000
+#define MII_PHY_IRQ_ALL_MASK 0x0800
+#define MII_PHY_IRQ_SPEED_MASK 0x0400
+#define MII_PHY_IRQ_DUPLEX_MASK 0x0200
+#define MII_PHY_IRQ_LINK_MASK 0x0100
+#define MII_PHY_IRQ_ARBITER_MASK 0x0080
+#define MII_PHY_IRQ_ARBITER_CHANGE 0x0040
+#define MII_PHY_IRQ_SPEED_CHANGE 0x0004
+#define MII_PHY_IRQ_DUPLEX_CHANGE 0x0002
+#define MII_PHY_IRQ_LINK_CHANGE 0x0001
+
+#define IP101A_CTRL_DUPLEX 0x0100
+#define IP101A_CTRL_100MB 0x2000
+#define IP101A_CTRL_AUTO_NEG 0x1000
+#define IP101A_CTRL_AUTO_NEG_RST 0x0200
+
+#define IP101A_LINK_STATUS 0x0004
+#define IP101A_AUTO_COMPLETED 0x20
+
+#define IP101A_DUPLEX_MODE 0x2000
+#define IP101A_SPEED_100MB 0x4000
+#define IP101A_LINK_STATUS2 0x0400
+
+#endif // _PHY_IP101A_HEADER_
+
diff -r ae816c83f082 packages/devs/eth/phy/current/src/VSC8244.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/devs/eth/phy/current/src/VSC8244.c Thu Jun 10 19:26:00 2010 +0200
@@ -0,0 +1,122 @@
+//==========================================================================
+//
+// phy/VSC8244.c
+//
+// Ethernet PHY driver
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): ccoutand
+// Contributors:
+// Date: 2009-11-01
+// Purpose:
+// Description: Hardware driver for Ethernet PHY Vitesse VSC8244
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/devs_eth_phy.h>
+
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/drv_api.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_tables.h>
+
+#include <cyg/io/eth_phy.h>
+#include <cyg/io/eth_phy_dev.h>
+
+#include "VSC8244.h"
+
+static bool VSC8244_stat(eth_phy_access_t *f, int *state)
+{
+ unsigned short phy_state;
+ int tries;
+ int auto_completed = 1;
+ int link_up = 0;
+
+ // Read negotiated state from the Quick Poll Detailed Status Register
+ if (_eth_phy_read(f, VSC8244_MII_STAT_REG, f->phy_addr, &phy_state))
+ {
+
+ if ((phy_state & VSC8244_AUTO_COMPLETED) == 0)
+ {
+ auto_completed = 0;
+ eth_phy_printf("... waiting for auto-negotiation");
+ for (tries = 0; tries < CYGINT_DEVS_ETH_PHY_AUTO_NEGOTIATION_TIME; tries++)
+ {
+ if (_eth_phy_read(f, VSC8244_MII_STAT_REG, f->phy_addr, &phy_state))
+ {
+ if ((phy_state & VSC8244_AUTO_COMPLETED) != 0)
+ {
+ auto_completed = 1;
+ break;
+ }
+ }
+ CYGACC_CALL_IF_DELAY_US(1000000); // 1 second
+ eth_phy_printf(".");
+ }
+ eth_phy_printf("\n");
+ }
+
+ if(phy_state & VSC8244_MII_PHY_STAT_LINK_UP)
+ link_up = 1;
+
+ if(auto_completed)
+ {
+ _eth_phy_read(f, VSC8244_MII_PHY_STAT_REG, f->phy_addr, &phy_state);
+
+ if(link_up)
+ *state |= ETH_PHY_STAT_LINK;
+ if(phy_state & VSC8244_MII_PHY_STAT_1000MB )
+ *state |= ETH_PHY_STAT_1000MB;
+ if(phy_state & VSC8244_MII_PHY_STAT_100MB)
+ *state |= ETH_PHY_STAT_100MB;
+ if(phy_state & VSC8244_MII_PHY_STAT_DUPLEX_FULL)
+ *state |= ETH_PHY_STAT_FDX;
+ return true;
+ }
+
+ }
+ return false;
+}
+
+_eth_phy_dev("Vitesse VSC8244", 0x000FC6C2, VSC8244_stat)
diff -r ae816c83f082 packages/devs/eth/phy/current/src/VSC8244.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/devs/eth/phy/current/src/VSC8244.h Thu Jun 10 19:26:03 2010 +0200
@@ -0,0 +1,67 @@
+#ifndef _PHY_VSC8244_HEADER_
+#define _PHY_VSC8244_HEADER_
+//==========================================================================
+//
+// phy/VSC8244.h
+//
+// Ethernet PHY driver
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): ccoutand
+// Contributors:
+// Date: 2009-11-01
+// Purpose:
+// Description: Hardware driver for Ethernet PHY Vitesse VSC8244
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#define VSC8244_MII_PHY_STAT_DUPLEX_FULL 0x20
+#define VSC8244_MII_PHY_STAT_1000MB 0x10
+#define VSC8244_MII_PHY_STAT_100MB 0x08
+
+#define VSC8244_MII_PHY_STAT_LINK_UP 0x04
+
+#define VSC8244_MII_STAT_REG 0x01
+#define VSC8244_MII_PHY_STAT_REG 0x1C
+
+#define VSC8244_AUTO_COMPLETED 0x20
+
+#endif // _PHY_VSC8244_HEADER_
diff -r ae816c83f082 packages/devs/eth/phy/current/src/VSC8641.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/devs/eth/phy/current/src/VSC8641.c Thu Jun 10 19:26:10 2010 +0200
@@ -0,0 +1,123 @@
+//==========================================================================
+//
+// phy/VSC8641.c
+//
+// Ethernet PHY driver
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Sachin Sushil Chaddha
+// Contributors:
+// Date: 2009-11-01
+// Purpose:
+// Description: Hardware driver for Ethernet PHY Vitesse VSC8641
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/system.h>
+#include <pkgconf/devs_eth_phy.h>
+
+#include <cyg/infra/cyg_type.h>
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/drv_api.h>
+#include <cyg/hal/hal_if.h>
+#include <cyg/hal/hal_tables.h>
+
+#include <cyg/io/eth_phy.h>
+#include <cyg/io/eth_phy_dev.h>
+
+#include "VSC8641.h"
+
+static bool VSC8641_stat(eth_phy_access_t *f, int *state)
+{
+ unsigned short phy_state;
+ int tries;
+ int auto_completed = 1;
+ int link_up = 0;
+
+ // Read negotiated state from the Quick Poll Detailed Status Register
+ if (_eth_phy_read(f, VSC8641_MII_STAT_REG, f->phy_addr, &phy_state))
+ {
+
+ if ((phy_state & VSC8641_AUTO_COMPLETED) == 0)
+ {
+ auto_completed = 0;
+ eth_phy_printf("... waiting for auto-negotiation");
+ for (tries = 0; tries < CYGINT_DEVS_ETH_PHY_AUTO_NEGOTIATION_TIME; tries++)
+ {
+ if (_eth_phy_read(f, VSC8641_MII_STAT_REG, f->phy_addr, &phy_state))
+ {
+ if ((phy_state & VSC8641_AUTO_COMPLETED) != 0)
+ {
+ auto_completed = 1;
+ break;
+ }
+ }
+ CYGACC_CALL_IF_DELAY_US(1000000); // 1 second
+ eth_phy_printf(".");
+ }
+ eth_phy_printf("\n");
+ }
+
+ if(phy_state & VSC8641_MII_PHY_STAT_LINK_UP)
+ link_up = 1;
+
+ if(auto_completed)
+ {
+ _eth_phy_read(f, VSC8641_MII_PHY_STAT_REG, f->phy_addr, &phy_state);
+
+ if(link_up)
+ *state |= ETH_PHY_STAT_LINK;
+ if(phy_state & VSC8641_MII_PHY_STAT_1000MB )
+ *state |= ETH_PHY_STAT_1000MB;
+ if(phy_state & VSC8641_MII_PHY_STAT_100MB)
+ *state |= ETH_PHY_STAT_100MB;
+ if(phy_state & VSC8641_MII_PHY_STAT_DUPLEX_FULL)
+ *state |= ETH_PHY_STAT_FDX;
+ return true;
+ }
+
+ }
+ return false;
+}
+
+
+_eth_phy_dev("Vitesse VSC8641", 0x00070431, VSC8641_stat)
diff -r ae816c83f082 packages/devs/eth/phy/current/src/VSC8641.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/packages/devs/eth/phy/current/src/VSC8641.h Thu Jun 10 19:26:14 2010 +0200
@@ -0,0 +1,86 @@
+#ifndef _PHY_VSC8641_HEADER_
+#define _PHY_VSC8641_HEADER_
+//==========================================================================
+//
+// phy/VSC8641.h
+//
+// Ethernet PHY driver
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+// 2008, 2009 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): ccoutand
+// Contributors:
+// Date: 2009-11-01
+// Purpose:
+// Description: Hardware driver for Ethernet PHY Vitesse VSC8641
+//
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#define VSC8641_MII_MDE_CTRL_REG 0x00
+#define VSC8641_MII_STAT_REG 0x01
+#define VSC8641_MII_AUTO_NEG_ADV_REG 0x04
+#define VSC8641_MII_AUTO_NEG_NXT_REG 0x07
+#define VSC8641_MII_PHY_IRQ_MSK_REG 0x19
+
+#define VSC8641_MII_PHY_STAT_REG 0x1C
+#define VSC8641_MII_INT_STAT_REG 0x1A
+
+#define VSC8641_MII_PHY_EPA 0x1F
+#define VSC8641_MII_PHY_RGMII_SKEW 0x1C
+
+#define VSC8641_AUTO_COMPLETED 0x20
+
+#define VSC8641_CTRL_AUTO_NEG 0x1000
+#define VSC8641_CTRL_AUTO_NEG_RST 0x0200
+#define VSC8641_CTRL_1000MB 0x0040
+#define VSC8641_CTRL_100MB 0x2000
+#define VSC8641_CTRL_FULL_DUPLEX 0x0100
+
+#define VSC8641_IRQ_SPEED_CHANGE 0x4000
+#define VSC8641_IRQ_FDX_STATE_CHANGE 0x1000
+#define VSC8641_IRQ_LINK_CHANGE 0x2000
+
+#define VSC8641_MII_PHY_STAT_DUPLEX_FULL 0x20
+#define VSC8641_MII_PHY_STAT_1000MB 0x10
+#define VSC8641_MII_PHY_STAT_100MB 0x08
+
+#define VSC8641_MII_PHY_STAT_LINK_UP 0x04
+
+#endif // _PHY_VSC8641_HEADER_
diff -r ae816c83f082 packages/devs/eth/phy/current/ChangeLog
--- a/packages/devs/eth/phy/current/ChangeLog Tue May 11 16:26:19 2010 +0000
+++ b/packages/devs/eth/phy/current/ChangeLog Thu Jun 10 19:26:25 2010 +0200
@@ -1,3 +1,15 @@
+2010-06-10 Christophe Coutand <ccoutand@stmi.com>
+
+ * doc/eth_phy.sgml: Add Ethernet Giga bit Mode
+ * include/eth_phy_dev.h:
+ * cdl/phy_eth_drivers.cdl: Added new PHY support:
+ * src/IP101A.c
+ * src/IP101A.h
+ * src/VSC8244.c
+ * src/VSC8244.h
+ * src/VSC8641.c
+ * src/VSC8641.h
+
2008-12-30 John Dallaway <john@dallaway.org.uk>
* cdl/phy_eth_drivers.cdl: Reference per-package documentation.
diff -r ae816c83f082 packages/devs/eth/phy/current/include/eth_phy.h
--- a/packages/devs/eth/phy/current/include/eth_phy.h Tue May 11 16:26:19 2010 +0000
+++ b/packages/devs/eth/phy/current/include/eth_phy.h Thu Jun 10 19:27:06 2010 +0200
@@ -84,9 +84,11 @@
static eth_phy_access_t _l = {PHY_REG_LEVEL_ACCESS_TYPE, false, _init, _reset, \
{.reg_level_ops = {_put_reg, _get_reg}}}
-#define ETH_PHY_STAT_LINK 0x0001 // Link up/down
-#define ETH_PHY_STAT_100MB 0x0002 // Connection is 100Mb/10Mb
-#define ETH_PHY_STAT_FDX 0x0004 // Connection is full/half duplex
+#define ETH_PHY_STAT_LINK 0x0001 // Link up/down
+#define ETH_PHY_STAT_100MB 0x0002 // Connection is 100Mb/10Mb
+#define ETH_PHY_STAT_FDX 0x0004 // Connection is full/half duplex
+#define ETH_PHY_STAT_1000MB 0x0008 // Connection is 1Gb
+
externC bool _eth_phy_init(eth_phy_access_t *f);
externC void _eth_phy_reset(eth_phy_access_t *f);
diff -r ae816c83f082 packages/devs/eth/phy/current/doc/eth_phy.sgml
--- a/packages/devs/eth/phy/current/doc/eth_phy.sgml Tue May 11 16:26:19 2010 +0000
+++ b/packages/devs/eth/phy/current/doc/eth_phy.sgml Thu Jun 10 19:27:16 2010 +0200
@@ -157,9 +157,10 @@
provide data, etc.
The status bitmask contains these bits:
<programlisting>
-#define ETH_PHY_STAT_LINK 0x0001 // Link up/down
-#define ETH_PHY_STAT_100MB 0x0002 // Connection is 100Mb/10Mb
-#define ETH_PHY_STAT_FDX 0x0004 // Connection is full/half duplex
+#define ETH_PHY_STAT_LINK 0x0001 // Link up/down
+#define ETH_PHY_STAT_100MB 0x0002 // Connection is 100Mb/10Mb
+#define ETH_PHY_STAT_FDX 0x0004 // Connection is full/half duplex
+#define ETH_PHY_STAT_1000MB 0x0008 // Connection is 1Gb
</programlisting>
Note: the usage here is that if the bit is set, then the condition
exists. For example, if the
diff -r ae816c83f082 packages/devs/eth/phy/current/cdl/phy_eth_drivers.cdl
--- a/packages/devs/eth/phy/current/cdl/phy_eth_drivers.cdl Tue May 11 16:26:19 2010 +0000
+++ b/packages/devs/eth/phy/current/cdl/phy_eth_drivers.cdl Thu Jun 10 19:27:22 2010 +0200
@@ -168,4 +168,31 @@
Include support for the Micrel KSZ8041 PHY"
}
+ cdl_option CYGHWR_DEVS_ETH_PHY_IP101A {
+ display "IP101A"
+ flavor bool
+ default_value 0
+ compile -library=libextras.a IP101A.c
+ description "
+ Include support for IC+ IP101A"
+ }
+
+ cdl_option CYGHWR_DEVS_ETH_PHY_VSC8641 {
+ display "VSC8641"
+ flavor bool
+ default_value 0
+ compile -library=libextras.a VSC8641.c
+ description "
+ Include support for Vitesse VSC8641"
+ }
+
+ cdl_option CYGHWR_DEVS_ETH_PHY_VSC8244 {
+ display "VSC8244"
+ flavor bool
+ default_value 0
+ compile -library=libextras.a VSC8244.c
+ description "
+ Include support for Vitesse VSC8244"
+ }
+
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: PHY update
2010-06-10 17:42 ` Christophe Coutand
@ 2010-06-15 8:27 ` John Dallaway
0 siblings, 0 replies; 8+ messages in thread
From: John Dallaway @ 2010-06-15 8:27 UTC (permalink / raw)
To: Christophe Coutand, Sachin Sushil Chaddha, Edgar Grimberg
Cc: ecos-patches, chadhas
Christophe Coutand wrote:
> Please find attached updated patch.
Now checked in. Thank you (all) for your contributions.
John Dallaway
eCos maintainer
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-06-15 8:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-09 7:11 PHY update Christophe Coutand
2010-05-12 10:21 ` John Dallaway
2010-05-12 10:44 ` Christophe Coutand
[not found] ` <D6050C555CC56940A7AF32652283027601116BF4@mail2.STMIRV01.COM>
2010-06-08 11:02 ` John Dallaway
2010-06-08 12:14 ` Christophe Coutand
2010-06-09 16:45 ` John Dallaway
2010-06-10 17:42 ` Christophe Coutand
2010-06-15 8:27 ` John Dallaway
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 read-only IMAP folder(s) and NNTP newsgroup(s).