1. 安装韦东山的虚拟版的ubuntu 9, 里面交叉编译啥的都弄好了, 直接用, 然后把workstation共享目录打开, 指向uboot的压缩包所在目录.
2. 在虚拟机上, 打开ssh, 通过ssh, 进/mnt/hgfs/ 把uboot压缩包解压了.
3. 编辑Makefile, 在smdk2400下面增加两行, 注意要好tab键
smdk2400_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t smdk2400 NULL s3c24x0
tx2440_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t tx2440 NULL s3c24x0
修改交叉编译命令如红色部分:
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
4. 把board目录下的除smdk2140目录其他全删了, 然后把smdk2140改名成tx2440
进去tx2440, 修改一下smdk2140.c改成tx2440.c
然后用vi, 修改board_init, 增加时钟的有关注释, 如下:
/* S3C2440: Mpll,Upll = (2*m * Fin) / (p * 2^s)
* m = M (the value for divider M)+ 8, p = P (the value for divider P) + 2
*/
#define S3C2440_MPLL_400MHZ ((0x7f<<12)|(0x02<<4)|(0x01))
#define S3C2440_UPLL_48MHZ ((0x38<<12)|(0x02<<4)|(0x02))
#define S3C2440_CLKDIV 0x05 /* FCLK:HCLK:PCLK = 1:4:8 */
/* S3C2410: Mpll,Upll = (m * Fin) / (p * 2^s)
* m = M (the value for divider M)+ 8, p = P (the value for divider P) + 2
*/
#define S3C2410_MPLL_200MHZ ((0x5c<<12)|(0x04<<4)|(0x00))
#define S3C2410_UPLL_48MHZ ((0x28<<12)|(0x01<<4)|(0x02))
#define S3C2410_CLKDIV 0x03 /* FCLK:HCLK:PCLK = 1:2:4 */
int board_init (void)
{
S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
S3C24X0_GPIO * const gpio = S3C24X0_GetBase_GPIO();
/* set up the I/O ports */
gpio->GPACON = 0x007FFFFF;
gpio->GPBCON = 0x00044555;
gpio->GPBUP = 0x000007FF;
gpio->GPCCON = 0xAAAAAAAA;
gpio->GPCUP = 0x0000FFFF;
gpio->GPDCON = 0xAAAAAAAA;
gpio->GPDUP = 0x0000FFFF;
gpio->GPECON = 0xAAAAAAAA;
gpio->GPEUP = 0x0000FFFF;
gpio->GPFCON = 0x000055AA;
gpio->GPFUP = 0x000000FF;
gpio->GPGCON = 0xFF95FFBA;
gpio->GPGUP = 0x0000FFFF;
gpio->GPHCON = 0x002AFAAA;
gpio->GPHUP = 0x000007FF;
/*support both of S3C2410 and S3C2440*/
if ((gpio->GSTATUS1 == 0x32410000) || (gpio->GSTATUS1 == 0x32410002))
{
/*FCLK:HCLK:PCLK = 1:2:4*/
clk_power->CLKDIVN = S3C2410_CLKDIV;
/* change to asynchronous bus mod */
__asm__( 'mrc p15, 0, r1, c1, c0, 0/n' /* read ctrl register */
'orr r1, r1, #0xc0000000/n' /* Asynchronous */
'mcr p15, 0, r1, c1, c0, 0/n' /* write ctrl register */
:::'r1'
);
/* to reduce PLL lock time, adjust the LOCKTIME register */
clk_power->LOCKTIME = 0xFFFFFF;
/* configure MPLL */
clk_power->MPLLCON = S3C2410_MPLL_200MHZ;
/* some delay between MPLL and UPLL */
delay (4000);
/* configure UPLL */
clk_power->UPLLCON = S3C2410_UPLL_48MHZ;
/* some delay between MPLL and UPLL */
delay (8000);
/* arch number of SMDK2410-Board */
gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
}
else
{
/* FCLK:HCLK:PCLK = 1:4:8 */
clk_power->CLKDIVN = S3C2440_CLKDIV;
/* change to asynchronous bus mod */
__asm__( 'mrc p15, 0, r1, c1, c0, 0/n' /* read ctrl register */
'orr r1, r1, #0xc0000000/n' /* Asynchronous */
'mcr p15, 0, r1, c1, c0, 0/n' /* write ctrl register */
:::'r1'
);
/* to reduce PLL lock time, adjust the LOCKTIME register */
clk_power->LOCKTIME = 0xFFFFFF;
/* configure MPLL */
clk_power->MPLLCON = S3C2440_MPLL_400MHZ;
/* some delay between MPLL and UPLL */
delay (4000);
/* configure UPLL */
clk_power->UPLLCON = S3C2440_UPLL_48MHZ;
/* some delay between MPLL and UPLL */
delay (8000);
/* arch number of SMDK2440-Board */
gd->bd->bi_arch_number = MACH_TYPE_S3C2440;
}
/* adress of boot parameters */
gd->bd->bi_boot_params = 0x30000100;
icache_enable();
dcache_enable();
return 0;
}
接着修改这个board/tx2440/下面的Makefile
把原来的smdk2410.o改成下面:
COBJS := tx2440.o flash.o
5. 进include/configs/, 把其他的都删掉, 只把smdk2140.h改名为tx2440.h
6. 把cpu/arm920t/config.mk里面-msoft-float注释掉
PLATFORM_RELFLAGS += -fno-strict-aliasing -fno-common -ffixed-r8
# -msoft-float
7. 用make tx2440_config看看有否:
Configuring for tx2440 board...
8. 增加对sdram的支持, 确定board/tx2440/lowlevel_init.s内存映射如下:
#define B1_BWSCON (DW32)
#define B2_BWSCON (DW16)
#define B3_BWSCON (DW16 + WAIT + UBLB)
#define B4_BWSCON (DW16)
#define B5_BWSCON (DW16)
#define B6_BWSCON (DW32)
#define B7_BWSCON (DW32)
并修改REFCNT为0x4f4
#define REFCNT 0x4f4 /* period=15.6us, HCLK=60Mhz, (2048+1-15.6*60) */
9. 修改cpu/arm920t/s3c24X0/speed.c
增加一行:
DECLARE_GLOBAL_DATA_PTR;
增加红色的部分:
static ulong get_PLLCLK(int pllreg)
{
S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
ulong r, m, p, s;
if (pllreg == MPLL)
r = clk_power->MPLLCON;
else if (pllreg == UPLL)
r = clk_power->UPLLCON;
else
hang();
m = ((r & 0xFF000) >> 12) + 8;
p = ((r & 0x003F0) >> 4) + 2;
s = r & 0x3;
/* support both of S3C2410 and S3C2440 */
if (gd->bd->bi_arch_number == MACH_TYPE_SMDK2410)
return((CONFIG_SYS_CLK_FREQ * m) / (p << s));
else
return((CONFIG_SYS_CLK_FREQ * m * 2) / (p << s)); /* S3C2440 */
// return((CONFIG_SYS_CLK_FREQ * m) / (p << s));
}
/* return FCLK frequency */
ulong get_FCLK(void)
{
return(get_PLLCLK(MPLL));
}
同时增加下面的:
/* for s3c2440 */
#define S3C2440_CLKDIVN_PDIVN (1<<0)
#define S3C2440_CLKDIVN_HDIVN_MASK (3<<1)
#define S3C2440_CLKDIVN_HDIVN_1 (0<<1)
#define S3C2440_CLKDIVN_HDIVN_2 (1<<1)
#define S3C2440_CLKDIVN_HDIVN_4_8 (2<<1)
#define S3C2440_CLKDIVN_HDIVN_3_6 (3<<1)
#define S3C2440_CLKDIVN_UCLK (1<<3)
#define S3C2440_CAMDIVN_CAMCLK_MASK (0xf<<0)
#define S3C2440_CAMDIVN_CAMCLK_SEL (1<<4)
#define S3C2440_CAMDIVN_HCLK3_HALF (1<<8)
#define S3C2440_CAMDIVN_HCLK4_HALF (1<<9)
#define S3C2440_CAMDIVN_DVSEN (1<<12)
/* return HCLK frequency */
ulong get_HCLK(void)
{
S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
unsigned long clkdiv;
unsigned long camdiv;
int hdiv = 1;
/* support both of S3C2410 and S3C2440 */
if (gd->bd->bi_arch_number == MACH_TYPE_SMDK2410)
return((clk_power->CLKDIVN & 0x2) ? get_FCLK()/2 : get_FCLK());
else
{
clkdiv = clk_power->CLKDIVN;
camdiv = clk_power->CAMDIVN;
/* work out clock scalings */
switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) {
case S3C2440_CLKDIVN_HDIVN_1:
hdiv = 1;
break;
case S3C2440_CLKDIVN_HDIVN_2:
hdiv = 2;
break;
case S3C2440_CLKDIVN_HDIVN_4_8:
hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
break;
case S3C2440_CLKDIVN_HDIVN_3_6:
hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
break;
}
return get_FCLK() / hdiv;
}
}
/* return PCLK frequency */
ulong get_PCLK(void)
{
S3C24X0_CLOCK_POWER * const clk_power = S3C24X0_GetBase_CLOCK_POWER();
unsigned long clkdiv;
unsigned long camdiv;
int hdiv = 1;
/* support both of S3C2410 and S3C2440 */
if (gd->bd->bi_arch_number == MACH_TYPE_SMDK2410)
return((clk_power->CLKDIVN & 0x1) ? get_HCLK()/2 : get_HCLK());
else
{
clkdiv = clk_power->CLKDIVN;
camdiv = clk_power->CAMDIVN;
/* work out clock scalings */
switch (clkdiv & S3C2440_CLKDIVN_HDIVN_MASK) {
case S3C2440_CLKDIVN_HDIVN_1:
hdiv = 1;
break;
case S3C2440_CLKDIVN_HDIVN_2:
hdiv = 2;
break;
case S3C2440_CLKDIVN_HDIVN_4_8:
hdiv = (camdiv & S3C2440_CAMDIVN_HCLK4_HALF) ? 8 : 4;
break;
case S3C2440_CLKDIVN_HDIVN_3_6:
hdiv = (camdiv & S3C2440_CAMDIVN_HCLK3_HALF) ? 6 : 3;
break;
}
return get_FCLK() / hdiv / ((clkdiv & S3C2440_CLKDIVN_PDIVN)? 2:1);
}
}
上一篇:TQ2440触摸屏
下一篇:ALSA声卡_从零编写之数据传输(基于优龙FS2410开发板,UDA1341声卡)
推荐阅读最新更新时间:2024-11-11 12:49
设计资源 培训 开发板 精华推荐
- 51单片机心形流水灯
- AD9642-210EBZ,使用 AD9642BCPZ-210 的评估板,14 位,210 MSPS 模数转换器,用于设置和控制的 SPI 接口 外部
- LT8607IMSE 5V、2MHz 降压稳压器的典型应用电路
- DC1317A-C,使用 LT1952EGN-1 的演示板,Vin=18V 至 72V,Vout=12V at 10A 单开关同步正向控制器
- EVAL-ADM1067TQEB,评估 ADM1067ASU 电压监控器排序器的评估板
- 使用 ON Semiconductor 的 STK402-250 的参考设计
- LT3976EUDD 5V 降压转换器的典型应用电路
- SIP78L18AC 三端低电流正压稳压器典型应用
- DN05057/D,高效率,<30mW 空载 PFC 设计说明
- EVAL-AD5620EBZ,AD5620 评估板,单通道,12 位,串行输入,电压输出 DAC
- TI直播| 低功耗技术在 Wi-Fi 摄像头及 PIR 红外传感器设计中的应用
- 是德科技有奖问答活动之一,A4WP无线充电测试的示波器方案,答题闯关赢好礼!
- EEWORLD月度问答榜(第3期)
- EEWorld 芯积分兑换年度回馈来袭~多种赚积分捷径曝光+礼品兑换剧透
- 我是大侦探之:寻找遗落的TI电源拼图
- 好书共读 | 《控制之美(卷2)——最优化控制MPC与卡尔曼滤波器》
- EEWorld加磅双重礼 ELEXCON深圳国际电子展诚邀您参加
- TI 嵌入式处理器最新产品发布会 全程在线直播 4月16日精彩为您呈现!预报名、看直播、享好礼
- ST直播主题:高度灵活的、易用的、可定制化的协议栈--BlueNRG-LP 协议栈介绍