From: Jia-Ju Bai Date: Thu, 9 Mar 2017 07:26:42 +0000 (+0000) Subject: Fix two mistakes in IP1000 driver X-Git-Url: http://zhaoyanbai.com/repos/README?a=commitdiff_plain;h=0d23d856eb5d5d7291fda232c09dafc61a1d17e7;p=minix.git Fix two mistakes in IP1000 driver Change-Id: Iafdfc7496c0ed45727f414c35350cf86b644413b --- diff --git a/minix/drivers/net/ip1000/ip1000.c b/minix/drivers/net/ip1000/ip1000.c index 2044c4b97..aa3be54dd 100644 --- a/minix/drivers/net/ip1000/ip1000.c +++ b/minix/drivers/net/ip1000/ip1000.c @@ -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); } }