首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

PowerPC平台 u-boot 移植-2

PowerPC平台 u-boot 移植-2

5.修改网卡驱动,支持phy ar8033
(1)根据单板修改phy地址
P1010BOARD.h:
#define TSEC1_PHY_ADDR        1
#define TSEC2_PHY_ADDR        6/*0->6*/
#define TSEC3_PHY_ADDR        4/*2->4*/
增加宏
Miiphyutil.c (...\u-boot\common)    42:
#define MII_DEBUG
编译烧写,调试log如下:
Net:   miiphy_register: added 'eTSEC1', read=0x3ff618d8, write=0x3ff61884
eTSEC1: No support for PHY id ffffffff; assuming generic
miiphy_register: added 'eTSEC2', read=0x3ff618d8, write=0x3ff61884
eTSEC2: No support for PHY id 4dd074; assuming generic
miiphy_register: added 'eTSEC3', read=0x3ff618d8, write=0x3ff61884
eTSEC3: No support for PHY id 4dd074; assuming generic
eTSEC1, eTSEC2, eTSEC3
Hit any key to stop autoboot:  0
=>
u-boot不支持单板的phy,分析phy启动增加phy ar8033支持
(2)分析phy驱动
start.S
    bl    board_init_r
        puts ("Net:   ");
        eth_initialize (bd);
            miiphy_init();
            board_eth_init
                tsec_eth_init(bis, tsec_info, num);
                    tsec_initialize(bis, &tsecs[i]);
                        eth_register(dev);
                        miiphy_register(dev->name, tsec_miiphy_read, tsec_miiphy_write);
                                debug ("miiphy_register: added '%s', read=0x%08lx, write=0x%08lx\n",
                                new_dev->name, new_dev->read, new_dev->write);
                        init_phy(dev);
                            get_phy_info(dev);
                                /* loop through all the known PHY types, and find one that */
                                /* matches the ID we read from the PHY. */
                                for (i = 0; phy_info[i]; i++) {
                                    if (phy_info[i]->id == (phy_ID >> phy_info[i]->shift)) {
                                        theInfo = phy_info[i];
                                        break;
                                    }
                                }
Tsec.c (.....\u-boot-2010.12\drivers\net)    57620    2015/5/18
phy_info数组没有支持ar8033,增加phy支持:
add:
struct phy_info phy_info_AR8033 =  {
        0x4dd074,
        "AR8033",
        0,
        (struct phy_cmd[]) { /* config */
                {PHY_BMCR, PHY_BMCR_RESET, NULL},
                {PHY_BMCR, PHY_BMCR_AUTON|PHY_BMCR_RST_NEG, NULL},
                {0x1d, 0x05, NULL},
                {0x1e, 0x3D47, NULL},
                {miim_end,}
        },
        (struct phy_cmd[]) { /* startup */
                {PHY_BMSR, miim_read, NULL},
                {PHY_BMSR, miim_read, &mii_parse_sr},
                {PHY_BMSR, miim_read, &mii_parse_link},
                {miim_end,}
        },
        (struct phy_cmd[]) { /* shutdown */
                {miim_end,}
        }
};
static struct phy_info *phy_info[] = {
2060 add:
    &phy_info_AR8033,
重新编译,烧写调试:
U-Boot 2010.12 (May 23 2015 - 16:06:42)

CPU:   P1010, Version: 1.0, (0x80f10010)
Core:  E500, Version: 5.1, (0x80212151)
Clock Configuration:
       CPU0:800  MHz,
       CCB:400  MHz,
       DDR:200  MHz (400 MT/s data rate) (Synchronous), IFC:100  MHz
L1:    D-cache 32 kB enabled
       I-cache 32 kB enabled
Board: P1010RDB
I2C:   ready
SPI:   ready
DRAM:  Configuring DDR for 667 MT/s data rate
DDR: 1 GiB (DDR3, 32-bit, CL=5, ECC off)
FLASH: 32 MiB
L2:    256 KB enabled
NAND:  NAND device: Manufacturer ID: 0x53, Chip ID: 0x53 (Unknown NAND 16MiB 3,3V 16-bit)
NAND bus width 8 instead 16 bit
No NAND device found!!!
0 MiB
PCIe1: Root Complex of mini PCIe Slot, no link, regs @ 0xffe0a000
PCIe1: Bus 00 - 00
PCIe2: Root Complex of PCIe Slot, no link, regs @ 0xffe09000
PCIe2: Bus 01 - 01
In:    serial
Out:   serial
Err:   serial
Net:   miiphy_register: added 'eTSEC1', read=0x3ff618d0, write=0x3ff6187c
eTSEC1: No support for PHY id ffffffff; assuming generic
miiphy_register: added 'eTSEC2', read=0x3ff618d0, write=0x3ff6187c
eTSEC2: PHY is AR8033 (4dd074)
miiphy_register: added 'eTSEC3', read=0x3ff618d0, write=0x3ff6187c
eTSEC3: PHY is AR8033 (4dd074)
eTSEC1, eTSEC2, eTSEC3
Hit any key to stop autoboot:  0
=>
6.测试如下:
=> setenv ethaddr 00:04:9f:ef:01:01
=> setenv eth1addr 00:04:9f:ef:01:02
=> setenv eth2addr 00:04:9f:ef:01:03
=>
=> setenv ipaddr 192.168.2.21
=> setenv serverip 192.168.2.242
=> setenv netmask 255.255.255.0
=> setenv ethact eTSEC2
=> ping $serverip
Speed: 100, full duplex
Using eTSEC2 device
host 192.168.2.242 is alive
=> saveenv
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
. done
Erased 1 sectors
Writing to Flash... 9....8....7....6....5....4....3....2....1....9....8....7....6....5....4....3....2....1....done
Protected 1 sectors
=>setenv ethact eTSEC3
=> ping $serverip
=>setenv ethact eTSEC2
=>ping $serverip
=>setenv ethact eTSEC1
=>ping $serverip
测试eTSEC2 eTSEC3都能ping通
下面测试tftp更新重新,均正常。
=> tftp 0x1000000 u-boot.bin
Speed: 1000, full duplex
Using eTSEC1 device
TFTP from server 192.168.2.242; our IP address is 192.168.2.21
Filename 'u-boot.bin'.
Load address: 0x1000000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
Speed: 100, full duplex
Using eTSEC2 device
TFTP from server 192.168.2.242; our IP address is 192.168.2.21
Filename 'u-boot.bin'.
Load address: 0x1000000
Loading: ####################################
done
Bytes transferred = 524288 (80000 hex)
=> protect off all  
Un-Protect Flash Bank # 1
=> erase 0xeff80000 0xefffffff

.... done
Erased 4 sectors
=> cp.b 0x1000000 0xeff80000 0x80000
Copy to Flash... 9....8....7....6....5....4....3....2....1....done
=>
返回列表