diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-10-10 07:49:34 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-10-10 07:49:34 +0000 |
commit | 88398a5e21b7b50c3352fd5bd2cbaa229852a646 (patch) | |
tree | f4445784f918a9f56eafbaa4ed4c626cffea36ce /os | |
parent | 660c9df44e117f84bc51795abbfb4189cb736c82 (diff) | |
download | ChibiOS-88398a5e21b7b50c3352fd5bd2cbaa229852a646.tar.gz ChibiOS-88398a5e21b7b50c3352fd5bd2cbaa229852a646.tar.bz2 ChibiOS-88398a5e21b7b50c3352fd5bd2cbaa229852a646.zip |
Integrated Liam's patch for Davicom 9161 PHY.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1207 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/io/platforms/AT91SAM7X/mac_lld.c | 6 | ||||
-rw-r--r-- | os/io/platforms/AT91SAM7X/mii_lld.c | 6 | ||||
-rw-r--r-- | os/io/platforms/AT91SAM7X/mii_lld.h | 22 |
3 files changed, 25 insertions, 9 deletions
diff --git a/os/io/platforms/AT91SAM7X/mac_lld.c b/os/io/platforms/AT91SAM7X/mac_lld.c index 47167fa80..223d54342 100644 --- a/os/io/platforms/AT91SAM7X/mac_lld.c +++ b/os/io/platforms/AT91SAM7X/mac_lld.c @@ -174,16 +174,14 @@ void mac_lld_init(void) { AT91C_EMAC_CLRSTAT;/* Initial NCR settings.*/
mac_lld_set_address(Ð1, default_mac);
-#if PHY_HARDWARE == PHY_MICREL_KS8721
/*
* PHY device identification.
*/
AT91C_BASE_EMAC->EMAC_NCR |= AT91C_EMAC_MPE;
- if ((miiGet(Ð1, MII_PHYSID1) != (MII_KS8721_ID >> 16)) ||
- ((miiGet(Ð1, MII_PHYSID2) & 0xFFF0) != (MII_KS8721_ID & 0xFFF0)))
+ if ((miiGet(Ð1, MII_PHYSID1) != (PHY_ID >> 16)) ||
+ ((miiGet(Ð1, MII_PHYSID2) & 0xFFF0) != (PHY_ID & 0xFFF0)))
chSysHalt();
AT91C_BASE_EMAC->EMAC_NCR &= ~AT91C_EMAC_MPE;
-#endif
/*
* Interrupt configuration. diff --git a/os/io/platforms/AT91SAM7X/mii_lld.c b/os/io/platforms/AT91SAM7X/mii_lld.c index 56fd87a51..518190d4e 100644 --- a/os/io/platforms/AT91SAM7X/mii_lld.c +++ b/os/io/platforms/AT91SAM7X/mii_lld.c @@ -25,8 +25,8 @@ */
#include <ch.h>
-#include <mac.h>
#include <mii.h>
+#include <mac.h>
/**
* @brief Low level MII driver initialization.
@@ -62,8 +62,12 @@ void mii_lld_reset(MACDriver *macp) { */
AT91C_BASE_PIOB->PIO_OER = PIOB_PHY_PD_MASK; // Becomes an output.
AT91C_BASE_PIOB->PIO_PPUDR = PIOB_PHY_PD_MASK; // Default pullup disabled.
+#if (PHY_HARDWARE == PHY_DAVICOM_9161)
+ AT91C_BASE_PIOB->PIO_CODR = PIOB_PHY_PD_MASK; // Output to low level.
+#else
AT91C_BASE_PIOB->PIO_SODR = PIOB_PHY_PD_MASK; // Output to high level.
#endif
+#endif // PIOB_PHY_PD_MASK
/*
* PHY reset by pulsing the NRST pin.
diff --git a/os/io/platforms/AT91SAM7X/mii_lld.h b/os/io/platforms/AT91SAM7X/mii_lld.h index f54ee0508..948999bb1 100644 --- a/os/io/platforms/AT91SAM7X/mii_lld.h +++ b/os/io/platforms/AT91SAM7X/mii_lld.h @@ -27,6 +27,9 @@ #ifndef _MII_LLD_H_
#define _MII_LLD_H_
+#include <mii.h>
+#include "board.h"
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -43,19 +46,30 @@ /*===========================================================================*/
#define PHY_MICREL_KS8721 0
-
-#if PHY_HARDWARE == PHY_MICREL_KS8721
-#define PHY_ADDRESS 1
-#endif
+#define PHY_DAVICOM_9161 1
/**
* @brief Pins latched by the PHY at reset. */
+#if (PHY_HARDWARE == PHY_MICREL_KS8721)
+
+#define PHY_ADDRESS 1
+#define PHY_ID MII_KS8721_ID
#define PHY_LATCHED_PINS (AT91C_PB4_ECRS | AT91C_PB5_ERX0 | \
AT91C_PB6_ERX1 | AT91C_PB7_ERXER | \
AT91C_PB13_ERX2 | AT91C_PB14_ERX3 | \
AT91C_PB15_ERXDV_ECRSDV | AT91C_PB16_ECOL | \
AT91C_PIO_PB26)
+#elif (PHY_HARDWARE == PHY_DAVICOM_9161)
+
+#define PHY_ADDRESS 0
+#define PHY_ID MII_DM9161_ID
+#define PHY_LATCHED_PINS (AT91C_PB4_ECRS | AT91C_PB5_ERX0 | \
+ AT91C_PB6_ERX1 | AT91C_PB7_ERXER | \
+ AT91C_PB13_ERX2 | AT91C_PB14_ERX3 | \
+ AT91C_PB15_ERXDV_ECRSDV | AT91C_PB16_ECOL | \
+ AT91C_PB17_ERXCK)
+#endif /* PHY_HARDWARE */
/*===========================================================================*/
/* Driver data structures and types. */
|