]> Zhao Yanbai Git Server - minix.git/commitdiff
Fix two mistakes in IP1000 driver 14/3414/1
authorJia-Ju Bai <baijiaju1990@163.com>
Thu, 9 Mar 2017 07:26:42 +0000 (07:26 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Thu, 9 Mar 2017 13:36:42 +0000 (14:36 +0100)
Change-Id: Iafdfc7496c0ed45727f414c35350cf86b644413b

minix/drivers/net/ip1000/ip1000.c

index 2044c4b9735d7cdb07d26d48adb65c18f8b46baa..aa3be54dd167b21abac98472dd7a87695bc5bdaf 100644 (file)
@@ -143,7 +143,7 @@ static void write_phy_reg(u32_t base, int phy_addr, int phy_reg, u16_t val) {
        polar = ndr_in8(base, REG_PHY_CTRL) & 0x28;
        for (i = 0; i < 7; i++) {
                for (j = 0; j < fieldlen[i]; j++) {
-                       data = (field[i] >> (field[j] - j - 1)) << 1;
+                       data = (field[i] >> (field[i] - j - 1)) << 1;
                        data = (0x02 & data) | (0x04 | polar);
                        ndr_out8(base, REG_PHY_CTRL, data);
                        micro_delay(10);
@@ -156,7 +156,7 @@ static void write_phy_reg(u32_t base, int phy_addr, int phy_reg, u16_t val) {
                micro_delay(10);
                field[7] |= ((ndr_in8(base, REG_PHY_CTRL) & 0x02) >> 1)
                                                << (fieldlen[7] - i -1);
-               ndr_out8(base, REG_PHY_CTRL, (data | 0x01));
+               ndr_out8(base, REG_PHY_CTRL, (polar | 0x01));
                micro_delay(10);
        }
 }