3380
- 收藏
- 点赞
- 分享
- 举报
Hi3516DV300【四】
Hi3516DV300uboot有线网口调试
1 uboot下修改PHY芯片的PHYADDR和添加PHY_ID支持
1). 修改PHYADDR
cd Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/uboot/u-boot-2016.11
vi include/configs/hi3516dv300.h
软件上的PHYADDR配置要根据每个人板子上的PHY芯片手册查询;
/*-----------------------------------------------------------------------
* HIETH driver
-----------------------------------------------------------------------*/
/* default is hieth-switch-fabric */
#ifdef CONFIG_NET_HISFV300
#define HISFV_RESET_PHY_BY_CRG
#define HISFV_MII_MODE 0
#define HISFV_RMII_MODE 1
#define HIETH_MII_RMII_MODE_U HISFV_RMII_MODE
#define HIETH_MII_RMII_MODE_D HISFV_RMII_MODE
#if 1 // add by wei
#define HISFV_PHY_U 0
#define HISFV_PHY_D 1
// add by wei end
#else
#define HISFV_PHY_U 1
#define HISFV_PHY_D 2
#endif
#endif /* CONFIG_NET_HISFV300 */
2). 添加PHYID
vi ./drivers/net/hisfv300/mii-drv.c
添加PHY的新宏PHY_ID_KSZ8081_SM, 这个PHYID每个人要根据自己板子上的PHY芯片手册查询;
#define PHY_ID_KSZ8081_SM 0x00221561 // add by wei for my phy
if ((phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081 || (phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081_SM) { // add by wei
#define PHY_ID_KSZ8051 0x00221550
#define PHY_ID_KSZ8081 0x00221560
#define PHY_ID_KSZ8081_SM 0x00221561 // add by wei for my phy
#define PHY_ID_MASK 0xFFFFFFF0
...
//added by wzh 2009-4-15
bool phy_detected(const char *devname, unsigned char phyaddr)
{
printf("phy_detected devname=%s phyadd=%x[wei]\n", devname, phyaddr);
u32 phy_id = 0;
u16 id1 = 0, id2 = 0;
if (miiphy_read(devname, phyaddr, MII_PHYSID1, &id1)) {
printf("%s,%d:PHY_PHYIDR1 read failed!\n", __func__, __LINE__);
return false;
}
if (miiphy_read(devname, phyaddr, MII_PHYSID2, &id2)) {
printf("%s,%d:PHY_PHYIDR2 read failed!\n", __func__, __LINE__);
return false;
}
phy_id = (id1 & 0xffff) << 16;
phy_id |= (id2 & 0xffff);
printf("phy_id = 0x%x[wei]\n", phy_id);
/* If the phy_id is all Fs, there is no device there */
if (0xffffffff == phy_id || 0 == phy_id
|| phy_id == 0xFFFF || phy_id == 0xFFFF0000)
{
return false;
}
/* run this at RMII mode */
if (HIETH_MII_RMII_MODE_U == 1)
{
/* PHY-KSZ8051RNL */
if ((phy_id & PHY_ID_MASK) == PHY_ID_KSZ8051) {
unsigned short reg = 0;
if (miiphy_read(devname, phyaddr, 0x1F, ®)) {
printf("PHY 0x1F read failed\n");
return false;
}
reg |= BIT(7); /* set phy RMII 50MHz clk;*/
if (miiphy_write(devname, phyaddr, 0x1F, reg)) {
printf("PHY 0x1F write failed\n");
return false;
}
if (miiphy_read(devname, phyaddr, 0x16, ®)) {
printf("PHY 0x16 read failed\n");
return false;
}
reg |= BIT(1); /* set phy RMII override; */
if (miiphy_write(devname, phyaddr, 0x16, reg)) {
printf("PHY 0x16 write failed\n");
return false;
}
}
/* PHY-KSZ8081 */
if ((phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081
|| (phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081_SM) { // add by wei
printf("PHY_ID_KSZ8081[wei]\n");
unsigned short val = 0;
if (miiphy_read(devname, phyaddr, 0x1F, &val) != 0) {
printf("PHY 0x1F read failed\n");
return false;
};
val |= BIT(7); /* set phy RMII 50MHz clk; */
if (miiphy_write(devname, phyaddr, 0x1F, val) != 0) {
printf("PHY 0x1F write failed\n");
return false;
}
printf("set phy RMII 50MHz clk[wei]\n");
}
}
return true;
}
3). 时钟配置
这个uboot里配置是RMII模式,无需修改;定义在hi3516dv300.h中
2 uboot有线网口测试
hisilicon # setenv serverip 192.168.1.74
hisilicon # setenv ethaddr FE:FC:AC:98:E8:01
hisilicon # setenv ipaddr 192.168.1.75
hisilicon # setenv netmask 255.255.255.0
hisilicon # setenv gatewayip 192.168.1.1
hisilicon # ping 192.168.1.74
Hisilicon ETH net controler
phy_id = 0x221561[wei]
eth0 : phy status change : LINK=UP : DUPLEX=FULL : SPEED=100M
Using eth0 device
host 192.168.1.74 is alive
hisilicon #
hisilicon # printenv
arch=arm
baudrate=115200
board=hi3516dv300
board_name=hi3516dv300
bootargs=mem=512M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 rw mtdparts=hi_sfc:1M(boot),5M(kernel),26M(rootfs)
bootcmd=sf probe 0;sf read 0x82000000 0x100000 0x500000;bootm 0x82000000
bootdelay=2
cpu=armv7
ethact=eth0
ethaddr=FE:FC:AC:98:E8:01
gatewayip=192.168.1.1
ipaddr=192.168.1.75
netmask=255.255.255.0
serverip=192.168.1.74
soc=hi3516dv300
stderr=serial
stdin=serial
stdout=serial
vendor=hisilicon
verify=n
Environment size: 540/262140 bytes
1 uboot下修改PHY芯片的PHYADDR和添加PHY_ID支持
1). 修改PHYADDR
cd Hi3516CV500_SDK_V2.0.1.1/osdrv/opensource/uboot/u-boot-2016.11
vi include/configs/hi3516dv300.h
软件上的PHYADDR配置要根据每个人板子上的PHY芯片手册查询;
/*-----------------------------------------------------------------------
* HIETH driver
-----------------------------------------------------------------------*/
/* default is hieth-switch-fabric */
#ifdef CONFIG_NET_HISFV300
#define HISFV_RESET_PHY_BY_CRG
#define HISFV_MII_MODE 0
#define HISFV_RMII_MODE 1
#define HIETH_MII_RMII_MODE_U HISFV_RMII_MODE
#define HIETH_MII_RMII_MODE_D HISFV_RMII_MODE
#if 1 // add by wei
#define HISFV_PHY_U 0
#define HISFV_PHY_D 1
// add by wei end
#else
#define HISFV_PHY_U 1
#define HISFV_PHY_D 2
#endif
#endif /* CONFIG_NET_HISFV300 */
2). 添加PHYID
vi ./drivers/net/hisfv300/mii-drv.c
添加PHY的新宏PHY_ID_KSZ8081_SM, 这个PHYID每个人要根据自己板子上的PHY芯片手册查询;
#define PHY_ID_KSZ8081_SM 0x00221561 // add by wei for my phy
if ((phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081 || (phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081_SM) { // add by wei
#define PHY_ID_KSZ8051 0x00221550
#define PHY_ID_KSZ8081 0x00221560
#define PHY_ID_KSZ8081_SM 0x00221561 // add by wei for my phy
#define PHY_ID_MASK 0xFFFFFFF0
...
//added by wzh 2009-4-15
bool phy_detected(const char *devname, unsigned char phyaddr)
{
printf("phy_detected devname=%s phyadd=%x[wei]\n", devname, phyaddr);
u32 phy_id = 0;
u16 id1 = 0, id2 = 0;
if (miiphy_read(devname, phyaddr, MII_PHYSID1, &id1)) {
printf("%s,%d:PHY_PHYIDR1 read failed!\n", __func__, __LINE__);
return false;
}
if (miiphy_read(devname, phyaddr, MII_PHYSID2, &id2)) {
printf("%s,%d:PHY_PHYIDR2 read failed!\n", __func__, __LINE__);
return false;
}
phy_id = (id1 & 0xffff) << 16;
phy_id |= (id2 & 0xffff);
printf("phy_id = 0x%x[wei]\n", phy_id);
/* If the phy_id is all Fs, there is no device there */
if (0xffffffff == phy_id || 0 == phy_id
|| phy_id == 0xFFFF || phy_id == 0xFFFF0000)
{
return false;
}
/* run this at RMII mode */
if (HIETH_MII_RMII_MODE_U == 1)
{
/* PHY-KSZ8051RNL */
if ((phy_id & PHY_ID_MASK) == PHY_ID_KSZ8051) {
unsigned short reg = 0;
if (miiphy_read(devname, phyaddr, 0x1F, ®)) {
printf("PHY 0x1F read failed\n");
return false;
}
reg |= BIT(7); /* set phy RMII 50MHz clk;*/
if (miiphy_write(devname, phyaddr, 0x1F, reg)) {
printf("PHY 0x1F write failed\n");
return false;
}
if (miiphy_read(devname, phyaddr, 0x16, ®)) {
printf("PHY 0x16 read failed\n");
return false;
}
reg |= BIT(1); /* set phy RMII override; */
if (miiphy_write(devname, phyaddr, 0x16, reg)) {
printf("PHY 0x16 write failed\n");
return false;
}
}
/* PHY-KSZ8081 */
if ((phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081
|| (phy_id & PHY_ID_MASK) == PHY_ID_KSZ8081_SM) { // add by wei
printf("PHY_ID_KSZ8081[wei]\n");
unsigned short val = 0;
if (miiphy_read(devname, phyaddr, 0x1F, &val) != 0) {
printf("PHY 0x1F read failed\n");
return false;
};
val |= BIT(7); /* set phy RMII 50MHz clk; */
if (miiphy_write(devname, phyaddr, 0x1F, val) != 0) {
printf("PHY 0x1F write failed\n");
return false;
}
printf("set phy RMII 50MHz clk[wei]\n");
}
}
return true;
}
3). 时钟配置
这个uboot里配置是RMII模式,无需修改;定义在hi3516dv300.h中
2 uboot有线网口测试
hisilicon # setenv serverip 192.168.1.74
hisilicon # setenv ethaddr FE:FC:AC:98:E8:01
hisilicon # setenv ipaddr 192.168.1.75
hisilicon # setenv netmask 255.255.255.0
hisilicon # setenv gatewayip 192.168.1.1
hisilicon # ping 192.168.1.74
Hisilicon ETH net controler
phy_id = 0x221561[wei]
eth0 : phy status change : LINK=UP : DUPLEX=FULL : SPEED=100M
Using eth0 device
host 192.168.1.74 is alive
hisilicon #
hisilicon # printenv
arch=arm
baudrate=115200
board=hi3516dv300
board_name=hi3516dv300
bootargs=mem=512M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 rw mtdparts=hi_sfc:1M(boot),5M(kernel),26M(rootfs)
bootcmd=sf probe 0;sf read 0x82000000 0x100000 0x500000;bootm 0x82000000
bootdelay=2
cpu=armv7
ethact=eth0
ethaddr=FE:FC:AC:98:E8:01
gatewayip=192.168.1.1
ipaddr=192.168.1.75
netmask=255.255.255.0
serverip=192.168.1.74
soc=hi3516dv300
stderr=serial
stdin=serial
stdout=serial
vendor=hisilicon
verify=n
Environment size: 540/262140 bytes
我来回答
回答0个
时间排序
认可量排序
暂无数据
或将文件直接拖到这里
悬赏:
E币
网盘
* 网盘链接:
* 提取码:
悬赏:
E币
Markdown 语法
- 加粗**内容**
- 斜体*内容*
- 删除线~~内容~~
- 引用> 引用内容
- 代码`代码`
- 代码块```编程语言↵代码```
- 链接[链接标题](url)
- 无序列表- 内容
- 有序列表1. 内容
- 缩进内容
- 图片![alt](url)
相关问答
-
2019-10-16 14:59:34
-
2019-11-25 20:18:36
-
2020-10-30 14:11:30
-
2019-10-16 10:50:21
-
2020-08-05 16:48:26
-
2020-08-08 22:18:33
-
2020-08-15 21:14:41
-
2024-04-19 21:04:38
-
2019-12-30 22:22:45
-
2020-08-19 17:17:03
-
2019-05-08 09:35:42
-
2021-12-09 17:19:51
-
2020-09-10 17:52:03
-
2019-06-03 11:16:42
-
2020-06-11 16:40:05
-
2019-09-11 10:01:33
-
2021-11-11 09:41:24
-
2021-11-20 11:48:05
-
2019-05-17 12:36:10
无更多相似问答 去提问
点击登录
-- 积分
-- E币
提问
—
收益
—
被采纳
—
我要提问
切换马甲
上一页
下一页
悬赏问答
-
5RK3588的DPHY0接lt6911uxe转HDMI抓帧分辨率不对
-
20求rv1106板子的sdk包或者开发板资料
-
10ss928烧录uboot失败
-
10求助,3588调试imx586和ov50c40时,按照瑞芯微的单摄8k配置好设备树后,驱动配置的8k分辨率的,但是只能抓到4k的图,且颜色偏粉
-
50帮忙解决个交叉编译的问题
-
20帮忙交叉编译个源码
-
5Hi3516CV610 如何使用SD卡升级固件
-
5cat /dev/logmpp 报错 <3>[ vi] [func]:vi_send_frame_node [line]:99 [info]:vi pic queue is full!
-
50如何获取vpss chn的图像修改后发送至vo
-
5FPGA通过Bt1120传YUV422数据过来,vi接收不到数据——3516dv500
举报反馈
举报类型
- 内容涉黄/赌/毒
- 内容侵权/抄袭
- 政治相关
- 涉嫌广告
- 侮辱谩骂
- 其他
详细说明
提醒
你的问题还没有最佳答案,是否结题,结题后将扣除20%的悬赏金
取消
确认
提醒
你的问题还没有最佳答案,是否结题,结题后将根据回答情况扣除相应悬赏金(1回答=1E币)
取消
确认