Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
okll00
rt-thread
提交
abe9da60
R
rt-thread
项目概览
okll00
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
5
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
abe9da60
编写于
9月 14, 2020
作者:
B
bigmagic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gmac address variable
上级
bfebcac4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
7 deletion
+34
-7
bsp/ls2kdev/drivers/net/synopGMAC.c
bsp/ls2kdev/drivers/net/synopGMAC.c
+34
-7
未找到文件。
bsp/ls2kdev/drivers/net/synopGMAC.c
浏览文件 @
abe9da60
...
...
@@ -19,7 +19,7 @@
#define RMII
#define
Gmac_base (0x9000000000000000 | 0x400400
00)
#define
PCI_BASE (0xFE000018
00)
#define Buffer_Size 2048
#define MAX_ADDR_LEN 6
#define NAMESIZE 16
...
...
@@ -29,7 +29,7 @@
#define DEFAULT_MAC_ADDRESS {0x00, 0x55, 0x7B, 0xB5, 0x7D, 0xF7}
u64
regbase
=
0x9000000000000000
|
0x4004000
0
;
u64
gmac_base
=
0
;
static
u32
GMAC_Power_down
;
extern
void
*
plat_alloc_consistent_dmaable_memory
(
synopGMACdevice
*
pcidev
,
u32
size
,
u32
*
addr
)
;
extern
s32
synopGMAC_check_phy_init
(
synopGMACPciNetworkAdapter
*
adapter
)
;
...
...
@@ -40,6 +40,32 @@ void eth_rx_irq(int irqno, void *param);
static
char
Rx_Buffer
[
Buffer_Size
];
static
char
Tx_Buffer
[
Buffer_Size
];
struct
pci_header
{
uint16_t
VendorID
;
uint16_t
DeviceID
;
uint16_t
Command
;
uint16_t
Status
;
uint32_t
RevisionID
:
8
;
uint32_t
ClassCode
:
24
;
uint8_t
CachelineSize
;
uint8_t
LatencyTimer
;
uint8_t
HeaderType
;
uint8_t
BIST
;
uint32_t
BaseAddressRegister
[
6
];
uint32_t
CardbusCISPointer
;
uint16_t
SubsystemVendorID
;
uint16_t
SubsystemID
;
uint32_t
ExpansionROMBaseAddress
;
uint32_t
CapabilitiesPointer
:
8
;
uint32_t
resv1
:
24
;
uint32_t
resv2
;
uint8_t
InterruptLine
;
uint8_t
InterruptPin
;
uint8_t
Min_Gnt
;
uint8_t
Max_Lat
;
};
struct
rt_eth_dev
{
struct
eth_device
parent
;
...
...
@@ -203,7 +229,6 @@ void synopGMAC_linux_cable_unplug_function(void *adaptr)
synopGMACdevice
*
gmacdev
=
adapter
->
synopGMACdev
;
struct
ethtool_cmd
cmd
;
//rt_kprintf("%s\n",__FUNCTION__);
if
(
!
mii_link_ok
(
&
adapter
->
mii
))
{
if
(
gmacdev
->
LinkState
)
...
...
@@ -287,7 +312,7 @@ static rt_err_t eth_init(rt_device_t device)
synopGMACdevice
*
gmacdev
=
(
synopGMACdevice
*
)
adapter
->
synopGMACdev
;
synopGMAC_reset
(
gmacdev
);
synopGMAC_attach
(
gmacdev
,
(
regbase
+
MACBASE
),
(
reg
base
+
DMABASE
),
DEFAULT_PHY_BASE
,
macaddr
);
synopGMAC_attach
(
gmacdev
,
(
gmac_base
+
MACBASE
),
(
gmac_
base
+
DMABASE
),
DEFAULT_PHY_BASE
,
macaddr
);
synopGMAC_read_version
(
gmacdev
);
...
...
@@ -889,7 +914,9 @@ void eth_rx_irq(int irqno, void *param)
int
rt_hw_eth_init
(
void
)
{
u64
base_addr
=
Gmac_base
;
struct
pci_header
*
p
=
(
struct
pci_header
*
)(
0x9000000000000000
|
PCI_BASE
);
gmac_base
=
(
0x9000000000000000
|
((
p
->
BaseAddressRegister
[
0
])
&
0xffffff00
));
struct
synopGMACNetworkAdapter
*
synopGMACadapter
;
static
u8
mac_addr0
[
6
]
=
DEFAULT_MAC_ADDRESS
;
int
index
;
...
...
@@ -918,7 +945,7 @@ int rt_hw_eth_init(void)
* Attach the device to MAC struct This will configure all the required base addresses
* such as Mac base, configuration base, phy base address(out of 32 possible phys)
* */
synopGMAC_attach
(
synopGMACadapter
->
synopGMACdev
,
(
regbase
+
MACBASE
),
reg
base
+
DMABASE
,
DEFAULT_PHY_BASE
,
mac_addr0
);
synopGMAC_attach
(
synopGMACadapter
->
synopGMACdev
,
(
gmac_base
+
MACBASE
),
gmac_
base
+
DMABASE
,
DEFAULT_PHY_BASE
,
mac_addr0
);
init_phy
(
synopGMACadapter
->
synopGMACdev
);
synopGMAC_reset
(
synopGMACadapter
->
synopGMACdev
);
...
...
@@ -932,7 +959,7 @@ int rt_hw_eth_init(void)
synopGMACadapter
->
mii
.
phy_id
=
synopGMACadapter
->
synopGMACdev
->
PhyBase
;
synopGMACadapter
->
mii
.
supports_gmii
=
mii_check_gmii_support
(
&
synopGMACadapter
->
mii
);
eth_dev
.
iobase
=
base_addr
;
eth_dev
.
iobase
=
gmac_base
;
eth_dev
.
name
=
"e0"
;
eth_dev
.
priv
=
synopGMACadapter
;
eth_dev
.
dev_addr
[
0
]
=
mac_addr0
[
0
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录