【smart210-SDK】u-boot移植 支持DM9000

想要代码的直接走起:

https://github.com/fanglinn/smart210-SDK

支持u-boot-2014.04, linux-3.10.79,已经jffs2/yaffs2文件系统,并有详细的手册说明。

 

直接贴过程:

vim board/samsung/smart210/smart210.c

#if 0
static void smc9115_pre_init(void)
{
	u32 smc_bw_conf, smc_bc_conf;

	struct s5pc100_gpio *const gpio =
		(struct s5pc100_gpio *)samsung_get_base_gpio();

	/* gpio configuration GPK0CON */
	s5p_gpio_cfg_pin(&gpio->k0, CONFIG_ENV_SROM_BANK, GPIO_FUNC(2));

	/* Ethernet needs bus width of 16 bits */
	smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK);
	smc_bc_conf = SMC_BC_TACS(0x0) | SMC_BC_TCOS(0x4) | SMC_BC_TACC(0xe)
			| SMC_BC_TCOH(0x1) | SMC_BC_TAH(0x4)
			| SMC_BC_TACP(0x6) | SMC_BC_PMC(0x0);

	/* Select and configure the SROMC bank */
	s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
}
#endif

/* add by shl  */
static void dm9000_pre_init(void)
{
	u32 smc_bw_conf, smc_bc_conf;
	
	/* Ethernet needs bus width of 16 bits */
	smc_bw_conf = SMC_DATA16_WIDTH(CONFIG_ENV_SROM_BANK)
		| SMC_BYTE_ADDR_MODE(CONFIG_ENV_SROM_BANK);
	smc_bc_conf = SMC_BC_TACS(0) | SMC_BC_TCOS(1) | SMC_BC_TACC(2)
		| SMC_BC_TCOH(1) | SMC_BC_TAH(0) | SMC_BC_TACP(0) | SMC_BC_PMC(0);

	/* Select and configure the SROMC bank */
	s5p_config_sromc(CONFIG_ENV_SROM_BANK, smc_bw_conf, smc_bc_conf);
}

int board_init(void)
{
	/* masked by shl */
	//smc9115_pre_init();
 	dm9000_pre_init();
	gd->bd->bi_arch_number = MACH_TYPE_SMDKC100;
	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;

	return 0;
}

int board_eth_init(bd_t *bis)
{
	int rc = 0;
#ifdef CONFIG_SMC911X
	rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
    /*add by shl*/
#elif defined(CONFIG_DRIVER_DM9000)
	rc = dm9000_initialize(bis);
#endif	
	return rc;
}

vim include/configs/smart210.h

#if 0
#define CONFIG_SMC911X         1       /* we have a SMC9115 on-board   */
#define CONFIG_SMC911X_16_BIT  1       /* SMC911X_16_BIT Mode          */
#define CONFIG_SMC911X_BASE    0x98800300      /* SMC911X Drive Base   */
#endif

#define CONFIG_ENV_SROM_BANK   1       /* Select SROM Bank-1 for Ethernet*/
#define CONFIG_DRIVER_DM9000
#define CONFIG_DM9000_NO_SROM
#define CONFIG_DM9000_BASE              0x88000000
#define DM9000_IO                               (CONFIG_DM9000_BASE)
#define DM9000_DATA                             (CONFIG_DM9000_BASE + 0x4)
#define CONFIG_CMD_PING
#define CONFIG_IPADDR                   192.168.1.120
#define CONFIG_SERVERIP                 192.168.1.101
#define CONFIG_ETHADDR                  1A:2A:3A:4A:5A:6A
#endif /* CONFIG_CMD_NET */

编译后:

U-Boot 2014.04 (Feb 19 2019 - 20:03:56) for SMART210

CPU:    S5PC110@1000MHz
Board:  SMDKC100
DRAM:  512 MiB
WARNING: Caches not enabled
NAND:  1024 MiB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   dm9000
Hit any key to stop autoboot:  0
Unknown command 'onenand' - try 'help'
Wrong Image Format for bootm command
ERROR: can't get kernel image!
smart210 #
smart210 # ping 192.168.1.102
dm9000 i/o: 0x88000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 1a:2a:3a:4a:5a:6a
operating at 100M full duplex mode
Using dm9000 device
ping failed; host 192.168.1.102 is not alive
smart210 #

smart210 # ping 192.168.1.104
dm9000 i/o: 0x88000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 1a:2a:3a:4a:5a:6a
operating at 100M full duplex mode
Using dm9000 device
host 192.168.1.104 is alive
smart210 #

 

你可能感兴趣的:(smart210)