Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OS
U-Boot.Mirror
提交
6644c195
U
U-Boot.Mirror
项目概览
OS
/
U-Boot.Mirror
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
U-Boot.Mirror
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6644c195
编写于
10月 27, 2010
作者:
D
Daniel Hellstrom
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
GRETH: made debug printouts use common debug() macro.
Signed-off-by:
N
Daniel Hellstrom
<
daniel@gaisler.com
>
上级
e3ce686c
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
25 addition
and
41 deletion
+25
-41
drivers/net/greth.c
drivers/net/greth.c
+25
-41
未找到文件。
drivers/net/greth.c
浏览文件 @
6644c195
...
...
@@ -24,6 +24,8 @@
* MA 02111-1307 USA
*/
/* #define DEBUG */
#include <common.h>
#include <command.h>
#include <net.h>
...
...
@@ -33,8 +35,6 @@
#include <ambapp.h>
#include <asm/leon.h>
/* #define DEBUG */
#include "greth.h"
/* Default to 3s timeout on autonegotiation */
...
...
@@ -142,9 +142,8 @@ int greth_init(struct eth_device *dev, bd_t * bis)
greth_priv
*
greth
=
dev
->
priv
;
greth_regs
*
regs
=
greth
->
regs
;
#ifdef DEBUG
printf
(
"greth_init
\n
"
);
#endif
debug
(
"greth_init
\n
"
);
if
(
!
greth
->
rxbd_base
)
{
...
...
@@ -199,9 +198,7 @@ int greth_init(struct eth_device *dev, bd_t * bis)
/* Enable Transmitter, GRETH will now scan descriptors for packets
* to transmitt */
#ifdef DEBUG
printf
(
"greth_init: enabling receiver
\n
"
);
#endif
debug
(
"greth_init: enabling receiver
\n
"
);
GRETH_REGORIN
(
&
regs
->
control
,
GRETH_RXEN
);
return
0
;
...
...
@@ -306,10 +303,8 @@ int greth_init_phy(greth_priv * dev, bd_t * bis)
}
auto_neg_done:
#ifdef DEBUG
printf
(
"%s GRETH Ethermac at [0x%x] irq %d. Running \
debug
(
"%s GRETH Ethermac at [0x%x] irq %d. Running \
%d Mbps %s duplex
\n
"
,
dev
->
gbit_mac
?
"10/100/1000"
:
"10/100"
,
(
unsigned
int
)(
regs
),
(
unsigned
int
)(
dev
->
irq
),
dev
->
gb
?
1000
:
(
dev
->
sp
?
100
:
10
),
dev
->
fd
?
"full"
:
"half"
);
#endif
/* Read out PHY info if extended registers are available */
if
(
tmp
&
1
)
{
tmp1
=
read_mii
(
2
,
regs
);
...
...
@@ -318,10 +313,8 @@ int greth_init_phy(greth_priv * dev, bd_t * bis)
tmp
=
tmp2
&
0xF
;
tmp2
=
(
tmp2
>>
4
)
&
0x3F
;
#ifdef DEBUG
printf
(
"PHY: Vendor %x Device %x Revision %d
\n
"
,
tmp1
,
debug
(
"PHY: Vendor %x Device %x Revision %d
\n
"
,
tmp1
,
tmp2
,
tmp
);
#endif
}
else
{
printf
(
"PHY info not available
\n
"
);
}
...
...
@@ -338,9 +331,9 @@ void greth_halt(struct eth_device *dev)
greth_priv
*
greth
;
greth_regs
*
regs
;
int
i
;
#ifdef DEBUG
printf
(
"greth_halt
\n
"
);
#endif
debug
(
"greth_halt
\n
"
);
if
(
!
dev
||
!
dev
->
priv
)
return
;
...
...
@@ -376,9 +369,9 @@ int greth_send(struct eth_device *dev, volatile void *eth_data, int data_length)
greth_bd
*
txbd
;
void
*
txbuf
;
unsigned
int
status
;
#ifdef DEBUG
printf
(
"greth_send
\n
"
);
#endif
debug
(
"greth_send
\n
"
);
/* send data, wait for data to be sent, then return */
if
(((
unsigned
int
)
eth_data
&
(
GRETH_BUF_ALIGN
-
1
))
&&
!
greth
->
gbit_mac
)
{
...
...
@@ -387,9 +380,6 @@ int greth_send(struct eth_device *dev, volatile void *eth_data, int data_length)
*/
if
(
!
greth
->
txbuf
)
{
greth
->
txbuf
=
malloc
(
GRETH_RXBUF_SIZE
);
#ifdef DEBUG
printf
(
"GRETH: allocated aligned tx-buf
\n
"
);
#endif
}
txbuf
=
greth
->
txbuf
;
...
...
@@ -455,9 +445,7 @@ int greth_recv(struct eth_device *dev)
unsigned
char
*
d
;
int
enable
=
0
;
int
i
;
#ifdef DEBUG
/* printf("greth_recv\n"); */
#endif
/* Receive One packet only, but clear as many error packets as there are
* available.
*/
...
...
@@ -474,10 +462,9 @@ int greth_recv(struct eth_device *dev)
if
(
status
&
GRETH_BD_EN
)
{
goto
done
;
}
#ifdef DEBUG
printf
(
"greth_recv: packet 0x%lx, 0x%lx, len: %d
\n
"
,
debug
(
"greth_recv: packet 0x%lx, 0x%lx, len: %d
\n
"
,
(
unsigned
int
)
rxbd
,
status
,
status
&
GRETH_BD_LEN
);
#endif
/* Check status for errors.
*/
...
...
@@ -512,12 +499,12 @@ int greth_recv(struct eth_device *dev)
/* Process the incoming packet. */
len
=
status
&
GRETH_BD_LEN
;
d
=
(
char
*
)
rxbd
->
addr
;
#ifdef DEBUG
printf
debug
(
"greth_recv: new packet, length: %d. data: %x %x %x %x %x %x %x %x
\n
"
,
len
,
d
[
0
],
d
[
1
],
d
[
2
],
d
[
3
],
d
[
4
],
d
[
5
],
d
[
6
],
d
[
7
]);
#endif
/* flush all data cache to make sure we're not reading old packet data */
sparc_dcache_flush_all
();
...
...
@@ -565,10 +552,9 @@ void greth_set_hwaddr(greth_priv * greth, unsigned char *mac)
greth
->
regs
->
esa_msb
=
(
mac
[
0
]
<<
8
)
|
mac
[
1
];
greth
->
regs
->
esa_lsb
=
(
mac
[
2
]
<<
24
)
|
(
mac
[
3
]
<<
16
)
|
(
mac
[
4
]
<<
8
)
|
mac
[
5
];
#ifdef DEBUG
printf
(
"GRETH: New MAC address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
debug
(
"GRETH: New MAC address: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
mac
[
0
],
mac
[
1
],
mac
[
2
],
mac
[
3
],
mac
[
4
],
mac
[
5
]);
#endif
}
int
greth_initialize
(
bd_t
*
bis
)
...
...
@@ -579,9 +565,9 @@ int greth_initialize(bd_t * bis)
int
i
;
char
*
addr_str
,
*
end
;
unsigned
char
addr
[
6
];
#ifdef DEBUG
printf
(
"Scanning for GRETH
\n
"
);
#endif
debug
(
"Scanning for GRETH
\n
"
);
/* Find Device & IRQ via AMBA Plug&Play information */
if
(
ambapp_apb_first
(
VENDOR_GAISLER
,
GAISLER_ETHMAC
,
&
apbdev
)
!=
1
)
{
return
-
1
;
/* GRETH not found */
...
...
@@ -594,9 +580,7 @@ int greth_initialize(bd_t * bis)
greth
->
regs
=
(
greth_regs
*
)
apbdev
.
address
;
greth
->
irq
=
apbdev
.
irq
;
#ifdef DEBUG
printf
(
"Found GRETH at 0x%lx, irq %d
\n
"
,
greth
->
regs
,
greth
->
irq
);
#endif
debug
(
"Found GRETH at 0x%lx, irq %d
\n
"
,
greth
->
regs
,
greth
->
irq
);
dev
->
priv
=
(
void
*
)
greth
;
dev
->
iobase
=
(
unsigned
int
)
greth
->
regs
;
dev
->
init
=
greth_init
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录