summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorEvan Lojewski <github@meklort.com>2019-03-11 20:50:12 -0600
committerEvan Lojewski <github@meklort.com>2019-03-11 20:50:12 -0600
commit493a19f78ec48c77eb509e2e1b3309e14903484f (patch)
tree41e78c5551d1a0746edc05f4b39ecd1377f26a07 /libs
parentadd347acb959af0971b5e0349413b6531c6c1a96 (diff)
downloadbcm5719-ortega-493a19f78ec48c77eb509e2e1b3309e14903484f.tar.gz
bcm5719-ortega-493a19f78ec48c77eb509e2e1b3309e14903484f.zip
Add initial stage2 code - mostly just a stub right now.
Diffstat (limited to 'libs')
-rw-r--r--libs/MII/include/MII.h5
-rw-r--r--libs/MII/mii.c11
2 files changed, 16 insertions, 0 deletions
diff --git a/libs/MII/include/MII.h b/libs/MII/include/MII.h
index 9588e01..bfca1e2 100644
--- a/libs/MII/include/MII.h
+++ b/libs/MII/include/MII.h
@@ -82,4 +82,9 @@ void MII_selectBlock(uint8_t phy, uint16_t block);
*/
uint16_t MII_getBlock(uint8_t phy);
+/**
+ * @fn void MII_reset(uint8_t phy);
+ */
+void MII_reset(uint8_t phy);
+
#endif /* MII_H */
diff --git a/libs/MII/mii.c b/libs/MII/mii.c
index 69ba6b1..4f33e30 100644
--- a/libs/MII/mii.c
+++ b/libs/MII/mii.c
@@ -125,3 +125,14 @@ uint16_t MII_getBlock(uint8_t phy)
// Write register 0x1f with the block.
return MII_readRegister(phy, (mii_reg_t)REG_MII_BLOCK_SELECT);
}
+
+void MII_reset(uint8_t phy)
+{
+ // Set MII_REG_CONTROL to RESET; wait until RESET bit clears.
+ MII_writeRegister(phy, (mii_reg_t)REG_MII_CONTROL, MII_CONTROL_RESET_MASK);
+
+ do
+ {
+ // Spin
+ } while((MII_readRegister(phy, (mii_reg_t)REG_MII_CONTROL) & MII_CONTROL_RESET_MASK) == MII_CONTROL_RESET_MASK);
+}
OpenPOWER on IntegriCloud