FL2440移植u-boot2011.09

u-boot version:2011.09-rc1

/home/lucas/u-boot-2011.09-rc1

OS:debian 7.1

cross-compilation chain:arm-linux-4.3.2

致谢:部分内容参考http://my.csdn.net/crazyman2010的博文,感谢分享。

第一步:u-boot初步编译

【目的】验证开发平台可以正确编译u-boot,初步建立文件目录。

1.建立目标板相关文件

(1)建立板级文件夹

board/samsung下建立fl440目录,并将相似的板级文件夹smdk2410下全部文件拷贝过去。重命名fl2440下的smdk2410.c为fl2440.c;修改Makefile中的目标COBJS中的smdk2410.ofl2440.o

(2)建立芯片级文件夹

直接使用cpu/arm920t的芯片文件夹即可,无需修改。

2.初步编译u-boot生成.bin文件

(1)建立配置文件

拷贝includ/configs/smdk2410.h,重命名为fl2440.h

(2)建立编译规则

在根目录的Makefile中找到ARM架构smdk2410编译规则

smdk2410_config : unconfig
  @$(MKCONFIG) $(@:_config=) arm arm920t
smdk2410 samsung s3c24x0

仿写fl2440编译规则

fl2440+config : unconfig
  @$(MKCONFIG) $(@:_config=) arm arm920t
fl2440 samsung s3c24x0

另外需要指定交叉编译:

CROSS_COMPILE ?= arm-linux-

(3)编译u-boot

make clean

make fl2440_config

make

【注】根目录下生成u-boot.bin和u-boot(即u-boot.axf,添加axf缀即可)。若编译工具为3.3.2等不支持软浮点型,需要把arm920t/config.mk中的#-msoft-float注释掉。

【特别说明】DNW下载的程序是从指定位置运行,而u-boot默认地址为0。FL2440的DRAM地址空间是0x30000000-0x34000000,共64M。所以需要修改

(1)修改DNW配置,设置下载地址为0x32000000;

(2)修改include/configs/fl2440.h:#define
CONFIG_SYS_TEXT_BASE    0x32000000

第二步:修改相关配置,在SDRAM中调试

【注】因为实在SDRAM中调试,需要跳过cpu的初始化,所以应在include/configs/fl2440.h中添加#define 
CONFIG_SKIP_LOWLEVEL_INIT 1

1.修改include/configs/fl2440.h

删除:

#define CONFIG_S3C2410         
/*specifically a SAMSUNG S3C2410 SoC */

#define CONFIG_SMDK2410         /* on
aSAMSUNG SMDK2410 Board */
添加:
#define CONFIG_S3C2440 

【注】将NAND配置先注释起来,不然会有很多错误:/*#define CONFIG_CMD_NAND*/
更改内存范围:

#defineCONFIG_SYS_MEMTEST_END        
0x33F00000
修改为:

#defineCONFIG_SYS_MEMTEST_END        
0x34000000
2.修改时钟

(1)修改arch/arm/cpu/arm920t/start.S

在line163处增加屏蔽中断代码:

# if defined(CONFIG_S3C2440)
       
ldr     r1,=0x7fff /*S3C2440使用15位,所以是111 1111 1111 1111*/

        ldr    
r0,=INTSUBMSK
       
str     r1, [r0]
# endif

删除:

ldr     r0, =CLKDIVN
mov    
r1, #3
str     r1, [r0]

添加:

# if defined(CONFIG_S3C2440)
       
ldr     r0,=CLKDIVN

        mov     r1,
#5
        str    
r1, [r0]
#endif

(2)修改board/samsung/fl2440/fl2440.c

删除:

#define FCLK_SPEED 1

#ifFCLK_SPEED==0             
/* Fout = 203MHz, Fin = 12MHz for Audio */
#define M_MDIV  0xC3

#define M_PDIV  0x4
#define M_SDIV  0x1

#elifFCLK_SPEED==1           
/* Fout = 202.8MHz */
#define M_MDIV  0xA1
#define
M_PDIV  0x3
#define M_SDIV  0x1
#endif
#define
USB_CLOCK 1
#if USB_CLOCK==0
#define
U_M_MDIV        0xA1
#define
U_M_PDIV        0x3
#define
U_M_SDIV        0x1
#elif USB_CLOCK==1

#define U_M_MDIV        0x48

#define U_M_PDIV        0x3

#define U_M_SDIV        0x2

#endif

添加:(晶振12M,CPU405M,USB48M)

#define M_MDIV 0x7f
#define M_PDIV 0x2
#define M_SDIV 0x1

#define U_M_MDIV 0x38
#define U_M_PDIV 0x2
#define U_M_SDIV
0x2

修改 board_init 函数中:
gd->bd->bi_arch_number =
MACH_TYPE_SMDK2410;
改为:
gd->bd->bi_arch_number =
MACH_TYPE_S3C2440;

3.再次编译u-boot,串口有输出


第三步:配置Nand Flash(K9F1G08U0A 128MB 8BIT)

1.删除对Nor Flash支持

(1)修改include/configs/fl2440.h

删除:

#define CONFIG_SYS_FLASH_CFI
#define CONFIG_FLASH_CFI_DRIVER

#define CONFIG_FLASH_CFI_LEGACY
#define
CONFIG_SYS_FLASH_LEGACY_512Kx16
#define
CONFIG_FLASH_SHOW_PROGRESS      45
#define
CONFIG_SYS_MAX_FLASH_BANKS      1
#define
CONFIG_SYS_FLASH_BANKS_LIST     { CONFIG_SYS_FLASH_BASE }

#define CONFIG_SYS_MAX_FLASH_SECT       (19)

#define
CONFIG_ENV_ADDR                
(CONFIG_SYS_FLASH_BASE + 0x070000)
#define CONFIG_ENV_IS_IN_FLASH

添加:

#define CONFIG_SYS_NO_FLASH 1
#define CONFIG_ENV_IS_NOWHERE  
1

(2)修改include/config_cmd_default.h

删除:

#define CONFIG_CMD_IMI
#define CONFIG_CMD_IMLS

(3)修改 board/samsung/fl2440/fl2440.c

修改board_flash_get_legacy函数附近代码:

#if !defined(CONFIG_SYS_NO_FLASH)
ulong board_flash_get_legacy(ulong
base, int banknum, flash_info_t *info)
{

        info->portwidth =
FLASH_CFI_16BIT;
       
info->chipwidth = FLASH_CFI_BY16;

        info->interface =
FLASH_CFI_X16;
        return 1;

}
#endif

2.添加Nand Flash支持

(1)修改include/configs/fl2440.h

取消CONFIG_CMD_NAND的注释。

(2)添加Nand驱动文件

拷贝drivers/mtd/nand/s3c2410_nand.c,并更名s3c2440_nand.c,并修改:

删除:

#define
S3C2410_NFCONF_EN         
(1<<15)
#define S3C2410_NFCONF_512BYTE    
(1<<14)
#define
S3C2410_NFCONF_4STEP       (1<<13)

#define S3C2410_NFCONF_INITECC     (1<<12)

#define S3C2410_NFCONF_nFCE       
(1<<11)
#define S3C2410_NFCONF_TACLS(x)   
((x)<<8)
#define S3C2410_NFCONF_TWRPH0(x)  
((x)<<4)
#define S3C2410_NFCONF_TWRPH1(x)  
((x)<<0)
#define S3C2410_ADDR_NALE 4
#define
S3C2410_ADDR_NCLE 8

添加:

#define S3C2440_ADDR_NALE 0xc
#define S3C2440_ADDR_NCLE 0x8

替换所有的2410为2440::g/2410/s//2440/g

修改boart_nand_init函数:

删除:

#else
        tacls = 4;

        twrph0 = 8;

        twrph1 = 8;
#endif

  cfg = S3C2440_NFCONF_EN;
  cfg |=
S3C2440_NFCONF_TACLS(tacls - 1);
  cfg |=
S3C2440_NFCONF_TWRPH0(twrph0 - 1);
  cfg |=
S3C2440_NFCONF_TWRPH1(twrph1 - 1);
writel(cfg,
&nand_reg->nfconf);

添加:

#else
/*
HCLK is 100MHZ
FL2440‘NAND FLASH IS K9F1G08U0A

time_acls=tacls*HCLK=10ns
time_we=HCLK*(twrph0+1)=15ns

time_wh=HCLK*(twrph1+1)=10ns
*/

        tacls = 1;//10ns

        twrph0 = 1;//20ns

        twrph1 = 0;
#endif

        u_int32_t cnt;

        cfg =tacls<<12 |
twrph0<<8 | twrph1<<4;//for nfconf

        cfg &= ~(1<<0);//bus
width:8bit
        writel(cfg,
&nand_reg->nfconf);
        cnt
= 1<<6|1<<5|1<<0;//for nfcont

       
writel(cnt,&nand_reg->nfcont);

修改s3c2440_hwcontrol函数:

struct nand_chip *chip = mtd->priv;  

        struct s3c2440_nand *nand =
s3c2440_get_base_nand();  

        debugX(1, "hwcontrol(): 0x%02x
0x%02x\n", cmd, ctrl);  
   //if (ctrl &
NAND_CTRL_CHANGE) { 
        ulong
IO_ADDR_W = (ulong)nand;  

               
if (ctrl & NAND_CLE)  

                       
IO_ADDR_W |= S3C2440_ADDR_NCLE;  

               
if (ctrl & NAND_ALE)  

                      
IO_ADDR_W |= S3C2440_ADDR_NALE;  

               
//chip->IO_ADDR_W=(void*)IO_ADDR_W;  

               
if(ctrl & NAND_NCE){  

                       
writel(readl(&nand->nfcont) &
~(1<<1),&nand->nfcont);  

                
}else{  

                       
writel(readl(&nand->nfcont) |
(1<<1),&nand->nfcont);  

                
}  
        //}  

        if (cmd !=
NAND_CMD_NONE)  

               
writeb(cmd,(void*)IO_ADDR_W);

3.重新编译u-boot,有Nand信息输出

第三步:添加网卡支持(DM9000)

1.删除原网卡CS8900支持

修改include/configs/fl2440.h

/*#define
CONFIG_CS8900*/              
/* we have a CS8900 on-board */  
/*#define
CONFIG_CS8900_BASE    0x19000300 */  
/*#define
CONFIG_CS8900_BUS16*/ /* the Linux driver does accesses as shorts */  

#define CONFIG_DRIVER_DM9000 1  
#define CONFIG_DM9000_BASE
0x20000300  
#define DM9000_IO CONFIG_DM9000_BASE  

#define DM9000_DATA (CONFIG_DM9000_BASE+4) /* the cmd pin is
addr2*/  
#define CONFIG_ETHADDR a8:00:3E:26:0A:5B  

#define CONFIG_NETMASK 255.255.255.0  
#define CONFIG_IPADDR
192.168.1.11  
#define CONFIG_SERVERIP 192.168.1.234  

#define CONFIG_NET_MULTI  
/* 
#define
CONFIG_NETMASK         
255.255.255.0 
#define
CONFIG_IPADDR          
10.0.0.110 
#define
CONFIG_SERVERIP         10.0.0.1 

*/

【注】DM9000接到NGCS4,基址为0x20000000,网卡基址0x20000300。

2.添加DM9000支持

(1)修改board/samsung/fl2440/fl2440.c中的board_eth_init函数

#ifdef CONFIG_CMD_NET  
int board_eth_init(bd_t
*bis)  
{  

        return
dm9000_initialize(bis);  
}  
#endif

(2)修改drivers/net/dm9000x.c

删除:

i = 0;  
while (!(dm9000_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
= dm9000_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:  

        printf("unknown: %d ",
lnk);  
       
break;  
}  
printf("mode\n");

删除函数 dm9000_halt 中的内容:

static void dm9000_halt(struct eth_device *netdev)  

{  
#if 0  

        DM9000_DBG("%s\n",
__func__);  
        /* RESET
devie */  
       
dm9000_phy_write(0, 0x8000);    /* PHY RESET */  

        DM9000_iow(DM9000_GPR,
0x01);   /* Power-Down PHY */  

        DM9000_iow(DM9000_IMR,
0x80);   /* Disable all interrupt */  

        DM9000_iow(DM9000_RCR,
0x00);   /* Disable RX */  
#endif  

}

3.重新编译u-boot,可以启动网卡了

时间: 2024-07-30 13:47:10

FL2440移植u-boot2011.09的相关文章

FL2440移植Linux2.6.33.7内核

kernel version:2.6.33.7 /linux-2.6.33.7 OS:CentOS 6.4 cross-compilation chain:arm-linux-4.3.2 /usr/local/arm/4.3.2/bin 第一步:修改配置 (1)选择合适的内核代码,作为硬件参考目标平台 arch/arm/mach-s3c2440 内核版本支持s3c2440,所以不需要作修改. (2)修改顶层Makefile 设置体系架构:line193:ARCH?=$(SUBARCH)改为ARC

FL2440移植LINUX-3.4.2 (六)--驱动移植LCD

移植:1.编译2.解决错误    2.1头文件不对:去掉或更改    2.2宏不对:改名,使用新宏    2.3 函数没有了:改名使用新函数 一:移植LCD驱动: 修改内核配置: │   Location:                                                                                                                             │    │     -> Device D

FL2440移植linux内核常用命令(command)

Host Ubuntu系统:sudo ifconfig eth0 192.168.1.2 打补丁(补丁和内核在同一目录下/home/chris/temp):cd /home/chris/temp/linux-3.0patch -p1 < ../linux-3.0-s3c2440.patch 开发板u-boot: setenv bootargs 'root=/dev/nfs rw nfsroot=192.168.1.2:/home/chris/nfs_work ip=192.168.1.1 con

FL2440移植LINUX-3.4.2 -- 内核自带的触摸屏驱动移植

修改两个文件/arch/arm/mach-s3c2440/mach-smdk2440.c 和 linux-3.0-s3c2440/drivers/input/touchscreen/s3c2410_ts.c 1 /arch/arm/mach-s3c2440/mach-smdk2440.c 2 3 +#include <plat/ts.h> /*Add by guowenxue to support Touch screen, 2011.09.06*/ 4 5 +/*Touch Screen d

FL2440移植LINUX-3.4.2(四)-- 添加支持YAFFS文件系统

1.修改 MTD 驱动源码以支持 yaffs 文件系统 在/drivers/mtd/nand/s3c2410.c的846行修改chip->ecc.mode        = NAND_ECC_SOFT;为chip->ecc.mode        = NAND_ECC_NONE;    /* by zhutao */ 2.获得yaffs方法1):(这个版本的yaffs2没有成功)官网http://www.yaffs.net/download-yaffs-using-git 获得命令:git c

移植u-boot.2016.09 ——(六、制作补丁、打补丁)

制作补丁: 制作补丁: diff -urN u-boot-2016.09 u-boot-2016.09_mini2440 > u-boot-2016.09_patch 打补丁 patch -p1 <../u-boot-2016.09_patch 原文地址:https://www.cnblogs.com/liuyuchun/p/9176665.html

FL2440移植LINUX-3.4.2(五)-- 添加DM9000的支持

1.参考mini2440拷贝:linux-3.4.2\arch\arm\mach-s3c24xx\mach-mini2440.c里的/* DM9000AEP 10/100 ethernet controller */ 1 /* DM9000AEP 10/100 ethernet controller */ 2 3 static struct resource mini2440_dm9k_resource[] = { 4 [0] = { 5 .start = MACH_MINI2440_DM9K_

Linux内核3.0移植并基于Initramfs根文件系统启动

Linux内核移植与启动 Target borad:FL2440 Bootloader:U-boot-2010.09 交叉编译器:buildroot-2012.08 1.linux内核基础知识 首先,磨刀不误砍柴工.在动手进行linux内核移植之前,我们有必要对linux内核进行一定的了解. 1.1 Linux内核启动过程概述 一个嵌入式Linux系统从软件角度看可以分为四个部分:  引导加载程序(Bootloader),Linux内核,文件系统,应用程序. 其中Bootloader是系统启动或

便是徐荒所带的

自己没趣走开了便是赵青衫以及http://weibo.com/2015.09.16/p/1001603887253242939273http://weibo.com/2015.09.16/p/1001603887253247120848http://weibo.com/2015.09.16/p/1001603887253247133649http://weibo.com/2015.09.16/p/1001603887253247133651http://weibo.com/2015.09.16/