]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Add support for MII in eepro100 driver.
authorWolfgang Denk <wd@pollux.(none)>
Sun, 25 Sep 2005 22:39:59 +0000 (00:39 +0200)
committerWolfgang Denk <wd@pollux.(none)>
Sun, 25 Sep 2005 22:39:59 +0000 (00:39 +0200)
Patch by Gleb Natapov, 21 Mar 2005

CHANGELOG
drivers/eepro100.c

index fc4e521cebe71cd55832e586e4b97f7e7df74645..63f9e5dd11e2ff0f65f3ef10fc684808ada987bf 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
 Changes for U-Boot 1.1.4:
 ======================================================================
 
+* Add support for MII in eepro100 driver.
+  Patch by Gleb Natapov, 21 Mar 2005
+
 * Fixes to the Lubbock (PXA 25x) support:
   - Resolve the FIXME with respect to saving the u-boot environment.
   - Make the default load address land in real memory.
index 906159ee3c53390742040a99bfccbba4a3f62332..9db7bd80c2db1be7863329a2c137f8459e6e5eb2 100644 (file)
@@ -271,6 +271,47 @@ static inline void OUTL (struct eth_device *dev, int command, u_long addr)
        *(volatile u32 *) ((addr + dev->iobase)) = cpu_to_le32 (command);
 }
 
+#if defined (CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII)
+static inline int INL (struct eth_device *dev, u_long addr)
+{
+       return le32_to_cpu (*(volatile u32 *) (addr + dev->iobase));
+}
+
+int miiphy_read (unsigned char  addr,
+                unsigned char  reg,
+                unsigned short *value)
+{
+       int cmd = (2 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16);
+
+       struct eth_device *dev = eth_get_dev ();
+
+       OUTL (dev, cmd, SCBCtrlMDI);
+       
+       do {
+               cmd = INL (dev, SCBCtrlMDI);
+       } while (!(cmd & (1 << 28)));
+
+       *value = (unsigned short) (cmd & 0xffff);
+       
+       return 0;
+}
+
+int miiphy_write (unsigned char  addr,
+               unsigned char  reg,
+               unsigned short value)
+{
+       int cmd = (1 << 26) | ((addr & 0x1f) << 21) | ((reg & 0x1f) << 16);
+
+       struct eth_device *dev = eth_get_dev ();
+
+       OUTL (dev, cmd | value, SCBCtrlMDI);
+
+       while (!(INL (dev, SCBCtrlMDI) & (1 << 28)));
+
+       return 0;
+}
+#endif /* (CONFIG_MII) || (CONFIG_COMMANDS & CFG_CMD_MII) */
+
        /* Wait for the chip get the command.
         */
 static int wait_for_eepro100 (struct eth_device *dev)