#if 0 #define CONFIG_AMD_LV400 1 /* uncomment this if you have a LV400 flash */ #endif #define CONFIG_AMD_LV800 1 /* uncomment this if you have a LV800 flash */ #define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ #ifdef CONFIG_AMD_LV800 #define PHYS_FLASH_SIZE 0x00200000 /* 1MB */ #define CFG_MAX_FLASH_SECT (19) /* max number of sectors on one chip */ #define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x1F0000) /* addr of environment */ #endif
任务:移植nand- flash驱动,让 u-boot 可以操作读写 nand flash。
(1)由于s3c2410 和s3c2440,nand flash控制器有区别,所以修改代码,让u-boot可以操作读写nand flash。由于代码较长,补贴出来,提供链接:http://download.csdn.net/user/u012851076
usb_ohci.o nand_flash.o
(3)在 include/s3c24x0.h 中定义 S3C2440_NAND 结构体:168 行
/* NAND FLASH (see S3C2440 manual chapter 6,) */ typedef struct { S3C24X0_REG32 NFCONF; S3C24X0_REG32 NFCONT; S3C24X0_REG32 NFCMD; S3C24X0_REG32 NFADDR; S3C24X0_REG32 NFDATA; S3C24X0_REG32 NFMECCD0; S3C24X0_REG32 NFMECCD1; S3C24X0_REG32 NFSECCD; S3C24X0_REG32 NFSTAT; S3C24X0_REG32 NFESTAT0; S3C24X0_REG32 NFESTAT1; S3C24X0_REG32 NFMECC0; S3C24X0_REG32 NFMECC1; S3C24X0_REG32 NFSECC; S3C24X0_REG32 NFSBLK; S3C24X0_REG32 NFEBLK; } /*__attribute__((__packed__))*/ S3C2440_NAND;
static inline S3C2440_NAND * const S3C2440_GetBase_NAND(void) { return (S3C2440_NAND * const)S3C2410_NAND_BASE; }
//#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_IS_IN_NAND 1 #define CFG_ENV_OFFSET 0x40000 #define CFG_ENV_SIZE 0xc000/* 64M NAND FLASH Total Size of Environment Sector */ /*----------------------------------------------------------------------- * NAND flash settings */ #define CFG_NAND_BASE 0 #define CFG_MAX_NAND_DEVICE 1 #define NAND_MAX_CHIPS 1
(6)修改配置文件 include/configs/dong2440.h,增加 NAND 命令,81 行
#define CONFIG_COMMANDS (CONFIG_CMD_DFL |CFG_CMD_CACHE | CFG_CMD_NAND | /*CFG_CMD_EEPROM |*/ /*CFG_CMD_I2C |*/ /*CFG_CMD_USB |*/ CFG_CMD_REGINFO | CFG_CMD_DATE | CFG_CMD_ELF)
make
没有错误生成u-boot.bin
4.支持DM9000网卡
(1)增加网卡的 DM9000 的配置,include/configs/dong2440.h 的 56 行和 96 行
/* * Hardware drivers */ #define CONFIG_DRIVER_DM9000 1 //去掉了原来 CS8900 的配置 #define CONFIG_DM9000_BASE 0x20000300 #define DM9000_IO CONFIG_DM9000_BASE #define DM9000_DATA (CONFIG_DM9000_BASE + 4) #define CONFIG_DM9000_USE_16BIT #define CONFIG_ETHADDR 10:23:45:67:89:AB #define CONFIG_NETMASK 255.255.255.0 #define CONFIG_IPADDR 192.168.1.6 #define CONFIG_SERVERIP 192.168.1.101
(2)driver/Makefile 里修改:30 行
COBJS = dm9000x.o
(3)支持网卡获取MAC地址:
修改 drivers/dm9000x.c 303 行 将 for (i = 0; i < 6; i++) ((u16 *) bd->bi_enetaddr)[i] = read_srom_word(i); 改为: //start char *tmp = getenv("ethaddr"); char *end; for (i = 0; i < 6; i++) { bd->bi_enetaddr[i] = tmp ? simple_strtoul(tmp, &end, 16) : 0; if(tmp) tmp = (*end) ? end+1 : end; } //end
331 行 #if 0 i = 0; while (!(phy_read(1) & 0x20)) { /* autonegation complete bit */ udelay(1000); i++; if (i == 10000) { printf("could not establish link\n"); return 0; } } /* see what we‘ve got */ lnk = phy_read(17) >> 12; printf("operating at "); switch (lnk) { case 1: printf("10M half duplex "); break; case 2: printf("10M full duplex "); break; case 4: printf("100M half duplex "); break; case 8: printf("100M full duplex "); break; default: 22 printf("unknown: %d ", lnk); break; } printf("mode\n"); #endif
基于TQ2440的u-boot 1.1.6移植(二)(支持nor flash nand flash ),布布扣,bubuko.com
基于TQ2440的u-boot 1.1.6移植(二)(支持nor flash nand flash )
原文:http://blog.csdn.net/hanglinux/article/details/20123087