本次移植是使u-boot支持网络,并能使用tftp功能,以及支持命令补全功能。
本次移植建立在上次版本上。
首先修改real210.h在最后增加下面的代码
/* * Ethernet Contoller driver 网络配置 */ #define CONFIG_DM9000 #define CONFIG_DRIVER_DM9000 1 #define CONFIG_DM9000_BASE (0x88000300) #define CONFIG_DM9000_USE_16BIT #define DM9000_IO CONFIG_DM9000_BASE #define DM9000_DATA (CONFIG_DM9000_BASE+0x4) #define DM9000_16BIT_DATA #define CONFIG_CMD_PING #define CONFIG_BOOTARGS "console=ttySAC2,115200 noinitrd root=/dev/mtdblock2 init=/linuxrc" #define CONFIG_ETHADDR 00:22:12:34:56:90 #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_IPADDR 192.168.1.20 #define CONFIG_SERVERIP 192.168.1.22 #define CONFIG_GATEWAYIP 192.168.1.1 /*auto complete command*/ #define CONFIG_CMDLINE_EDITING #define CONFIG_AUTO_COMPLETE /*实现命令补全功能*/ #define CONFIG_
然后修改板级文件real210.c,改成如下:
/* * Copyright (C) 2008-2009 Samsung Electronics * Minkyu Kang <mk7.kang@samsung.com> * Kyungmin Park <kyungmin.park@samsung.com> * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <common.h> #include <asm/io.h> #include <asm/arch/sromc.h> #include <asm/arch/gpio.h> #include <netdev.h> #include <s5pc110.h> #define DM9000_Tacs (0x0) // 0clk address set-up #define DM9000_Tcos (0x4) // 4clk chip selection set-up #define DM9000_Tacc (0xE) // 14clk access cycle #define DM9000_Tcoh (0x1) // 1clk chip selection hold #define DM9000_Tah (0x4) // 4clk address holding time #define DM9000_Tacp (0x6) // 6clk page mode access cycle #define DM9000_PMC (0x0) // normal(1data)page mode configuration #define CS8900_Tacs (0x0) // 0clk address set-up #define CS8900_Tcos (0x3) // 4clk chip selection set-up #define CS8900_Tacc (0x7) // 14clk access cycle #define CS8900_Tcoh (0x1) // 1clk chip selection hold #define CS8900_Tah (0x3) // 4clk address holding time #define CS8900_Tacp (0x6) // 6clk page mode access cycle #define CS8900_PMC (0x0) // normal(1data)page mode configuration DECLARE_GLOBAL_DATA_PTR; static void dm9000_pre_init(void) { unsigned int tmp; #if defined(DM9000_16BIT_DATA) SROM_BW_REG &= ~(0xf << 4); SROM_BW_REG |= (0<<7) | (0<<6) | (1<<5) | (1<<4); #else SROM_BW_REG &= ~(0xf << 20); SROM_BW_REG |= (0<<19) | (0<<18) | (0<<16); #endif #ifdef CONFIG_SMC911X SROM_BC1_REG = ((CS8900_Tacs<<28)+(CS8900_Tcos<<24)+(CS8900_Tacc<<16)+(CS8900_Tcoh<<12)+(CS8900_Tah<<8)+(CS8900_Tacp<<4)+(CS8900_PMC)); #endif #ifdef CONFIG_DRIVER_DM9000 SROM_BC1_REG = ((DM9000_Tacs<<28)|(DM9000_Tcos<<24)|(DM9000_Tacc<<16)|(DM9000_Tcoh<<12)|(DM9000_Tah<<8)|(DM9000_Tacp<<4)|(DM9000_PMC)); #endif tmp = MP01CON_REG; tmp &=~(0xf<<4); tmp |=(2<<4); MP01CON_REG = tmp; } int board_init(void) { #ifdef CONFIG_SMC911X smc9115_pre_init(); #endif #ifdef CONFIG_DRIVER_DM9000 dm9000_pre_init(); #endif gd->bd->bi_arch_number = MACH_TYPE_SMDKC100; gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; return 0; } int dram_init(void) { gd->ram_size = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE)*2; /*long unsigned int size1,size2; size1 = get_ram_size((long *)PHYS_SDRAM_1, PHYS_SDRAM_1_SIZE); size2 = get_ram_size((long *)PHYS_SDRAM_2, PHYS_SDRAM_2_SIZE); gd->ram_size = size1 + size2;*/ return 0; } void dram_init_banksize(void) { gd->bd->bi_dram[0].start = PHYS_SDRAM_1; gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE; gd->bd->bi_dram[1].start = PHYS_SDRAM_2; gd->bd->bi_dram[1].size = PHYS_SDRAM_2_SIZE; } #ifdef CONFIG_DISPLAY_BOARDINFO int checkboard(void) { printf("Board:\treal210\n"); return 0; } #endif int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_SMC911X rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); #endif #ifdef CONFIG_DM9000 rc = dm9000_initialize(bis); #endif return rc; }
主要就是这些了,make一下,试试。
成功的结果如下所示:
u-boot移植第四弹——2013.10u-boot增加dm9000的支持
原文:http://blog.csdn.net/wang_shuai_ww/article/details/19236169