提交 c769ed5b 编写于 作者: M Marek Vasut 提交者: Yang Yingliang

net: ks8851-ml: Fix 16-bit IO operation

[ Upstream commit 58292104832fef6cb4a89f736012c0e0724c3442 ]

The Micrel KSZ8851-16MLLI datasheet DS00002357B page 12 states that
BE[3:0] signals are active high. This contradicts the measurements
of the behavior of the actual chip, where these signals behave as
active low. For example, to read the CIDER register, the bus must
expose 0xc0c0 during the address phase, which means BE[3:0]=4'b1100.
Signed-off-by: NMarek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 ef79922a
...@@ -485,7 +485,7 @@ static int msg_enable; ...@@ -485,7 +485,7 @@ static int msg_enable;
static u16 ks_rdreg16(struct ks_net *ks, int offset) static u16 ks_rdreg16(struct ks_net *ks, int offset)
{ {
ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
return ioread16(ks->hw_addr); return ioread16(ks->hw_addr);
} }
...@@ -500,7 +500,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset) ...@@ -500,7 +500,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset)
static void ks_wrreg16(struct ks_net *ks, int offset, u16 value) static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
{ {
ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02)); ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd); iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
iowrite16(value, ks->hw_addr); iowrite16(value, ks->hw_addr);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册