Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
a384a33b
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a384a33b
编写于
1月 07, 2012
作者:
F
Francois Romieu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
via-rhine: RHINE_WAIT_FOR macro removal.
Signed-off-by:
N
Francois Romieu
<
romieu@fr.zoreil.com
>
上级
7ab87ff4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
50 addition
and
24 deletion
+50
-24
drivers/net/ethernet/via/via-rhine.c
drivers/net/ethernet/via/via-rhine.c
+50
-24
未找到文件。
drivers/net/ethernet/via/via-rhine.c
浏览文件 @
a384a33b
...
...
@@ -501,15 +501,31 @@ static int rhine_vlan_rx_add_vid(struct net_device *dev, unsigned short vid);
static
int
rhine_vlan_rx_kill_vid
(
struct
net_device
*
dev
,
unsigned
short
vid
);
static
void
rhine_restart_tx
(
struct
net_device
*
dev
);
#define RHINE_WAIT_FOR(condition) \
do { \
int i = 1024; \
while (!(condition) && --i) \
; \
if (debug > 1 && i < 512) \
pr_info("%4d cycles used @ %s:%d\n", \
1024 - i, __func__, __LINE__); \
} while (0)
static
void
rhine_wait_bit
(
struct
rhine_private
*
rp
,
u8
reg
,
u8
mask
,
bool
high
)
{
void
__iomem
*
ioaddr
=
rp
->
base
;
int
i
;
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
if
(
high
^
!!
(
ioread8
(
ioaddr
+
reg
)
&
mask
))
break
;
udelay
(
10
);
}
if
(
i
>
64
)
{
netdev_dbg
(
rp
->
dev
,
"%s bit wait (%02x/%02x) cycle "
"count: %04d
\n
"
,
high
?
"high"
:
"low"
,
reg
,
mask
,
i
);
}
}
static
void
rhine_wait_bit_high
(
struct
rhine_private
*
rp
,
u8
reg
,
u8
mask
)
{
rhine_wait_bit
(
rp
,
reg
,
mask
,
true
);
}
static
void
rhine_wait_bit_low
(
struct
rhine_private
*
rp
,
u8
reg
,
u8
mask
)
{
rhine_wait_bit
(
rp
,
reg
,
mask
,
false
);
}
static
u32
rhine_get_events
(
struct
rhine_private
*
rp
)
{
...
...
@@ -609,7 +625,7 @@ static void rhine_chip_reset(struct net_device *dev)
iowrite8
(
0x40
,
ioaddr
+
MiscCmd
);
/* Reset can take somewhat longer (rare) */
RHINE_WAIT_FOR
(
!
(
ioread8
(
ioaddr
+
ChipCmd1
)
&
Cmd1Reset
)
);
rhine_wait_bit_low
(
rp
,
ChipCmd1
,
Cmd1Reset
);
}
if
(
debug
>
1
)
...
...
@@ -641,9 +657,15 @@ static void __devinit rhine_reload_eeprom(long pioaddr, struct net_device *dev)
{
struct
rhine_private
*
rp
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
rp
->
base
;
int
i
;
outb
(
0x20
,
pioaddr
+
MACRegEEcsr
);
RHINE_WAIT_FOR
(
!
(
inb
(
pioaddr
+
MACRegEEcsr
)
&
0x20
));
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
if
(
!
(
inb
(
pioaddr
+
MACRegEEcsr
)
&
0x20
))
break
;
}
if
(
i
>
512
)
pr_info
(
"%4d cycles used @ %s:%d
\n
"
,
i
,
__func__
,
__LINE__
);
#ifdef USE_MMIO
/*
...
...
@@ -770,7 +792,7 @@ static int rhine_napipoll(struct napi_struct *napi, int budget)
u8
cmd
;
/* Avoid scavenging before Tx engine turned off */
RHINE_WAIT_FOR
(
!
(
ioread8
(
ioaddr
+
ChipCmd
)
&
CmdTxOn
)
);
rhine_wait_bit_low
(
rp
,
ChipCmd
,
CmdTxOn
);
cmd
=
ioread8
(
ioaddr
+
ChipCmd
);
if
((
cmd
&
CmdTxOn
)
&&
(
debug
>
2
))
{
netdev_warn
(
dev
,
"%s: Tx engine still on
\n
"
,
...
...
@@ -1444,23 +1466,27 @@ static void init_registers(struct net_device *dev)
}
/* Enable MII link status auto-polling (required for IntrLinkChange) */
static
void
rhine_enable_linkmon
(
void
__iomem
*
ioaddr
)
static
void
rhine_enable_linkmon
(
struct
rhine_private
*
rp
)
{
void
__iomem
*
ioaddr
=
rp
->
base
;
iowrite8
(
0
,
ioaddr
+
MIICmd
);
iowrite8
(
MII_BMSR
,
ioaddr
+
MIIRegAddr
);
iowrite8
(
0x80
,
ioaddr
+
MIICmd
);
RHINE_WAIT_FOR
((
ioread8
(
ioaddr
+
MIIRegAddr
)
&
0x20
)
);
rhine_wait_bit_high
(
rp
,
MIIRegAddr
,
0x20
);
iowrite8
(
MII_BMSR
|
0x40
,
ioaddr
+
MIIRegAddr
);
}
/* Disable MII link status auto-polling (required for MDIO access) */
static
void
rhine_disable_linkmon
(
void
__iomem
*
ioaddr
,
u32
quirks
)
static
void
rhine_disable_linkmon
(
struct
rhine_private
*
rp
)
{
void
__iomem
*
ioaddr
=
rp
->
base
;
iowrite8
(
0
,
ioaddr
+
MIICmd
);
if
(
quirks
&
rqRhineI
)
{
if
(
rp
->
quirks
&
rqRhineI
)
{
iowrite8
(
0x01
,
ioaddr
+
MIIRegAddr
);
// MII_BMSR
/* Can be called from ISR. Evil. */
...
...
@@ -1469,13 +1495,13 @@ static void rhine_disable_linkmon(void __iomem *ioaddr, u32 quirks)
/* 0x80 must be set immediately before turning it off */
iowrite8
(
0x80
,
ioaddr
+
MIICmd
);
RHINE_WAIT_FOR
(
ioread8
(
ioaddr
+
MIIRegAddr
)
&
0x20
);
rhine_wait_bit_high
(
rp
,
MIIRegAddr
,
0x20
);
/* Heh. Now clear 0x80 again. */
iowrite8
(
0
,
ioaddr
+
MIICmd
);
}
else
RHINE_WAIT_FOR
(
ioread8
(
ioaddr
+
MIIRegAddr
)
&
0x80
);
rhine_wait_bit_high
(
rp
,
MIIRegAddr
,
0x80
);
}
/* Read and write over the MII Management Data I/O (MDIO) interface. */
...
...
@@ -1486,16 +1512,16 @@ static int mdio_read(struct net_device *dev, int phy_id, int regnum)
void
__iomem
*
ioaddr
=
rp
->
base
;
int
result
;
rhine_disable_linkmon
(
ioaddr
,
rp
->
quirks
);
rhine_disable_linkmon
(
rp
);
/* rhine_disable_linkmon already cleared MIICmd */
iowrite8
(
phy_id
,
ioaddr
+
MIIPhyAddr
);
iowrite8
(
regnum
,
ioaddr
+
MIIRegAddr
);
iowrite8
(
0x40
,
ioaddr
+
MIICmd
);
/* Trigger read */
RHINE_WAIT_FOR
(
!
(
ioread8
(
ioaddr
+
MIICmd
)
&
0x40
)
);
rhine_wait_bit_low
(
rp
,
MIICmd
,
0x40
);
result
=
ioread16
(
ioaddr
+
MIIData
);
rhine_enable_linkmon
(
ioaddr
);
rhine_enable_linkmon
(
rp
);
return
result
;
}
...
...
@@ -1504,16 +1530,16 @@ static void mdio_write(struct net_device *dev, int phy_id, int regnum, int value
struct
rhine_private
*
rp
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
rp
->
base
;
rhine_disable_linkmon
(
ioaddr
,
rp
->
quirks
);
rhine_disable_linkmon
(
rp
);
/* rhine_disable_linkmon already cleared MIICmd */
iowrite8
(
phy_id
,
ioaddr
+
MIIPhyAddr
);
iowrite8
(
regnum
,
ioaddr
+
MIIRegAddr
);
iowrite16
(
value
,
ioaddr
+
MIIData
);
iowrite8
(
0x20
,
ioaddr
+
MIICmd
);
/* Trigger write */
RHINE_WAIT_FOR
(
!
(
ioread8
(
ioaddr
+
MIICmd
)
&
0x20
)
);
rhine_wait_bit_low
(
rp
,
MIICmd
,
0x20
);
rhine_enable_linkmon
(
ioaddr
);
rhine_enable_linkmon
(
rp
);
}
static
void
rhine_task_disable
(
struct
rhine_private
*
rp
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录