初步移植:在基本的基础之上移植
1.#define IS_SAMSUNG_TYPE(type, id) \
static inline int cpu_is_##type(void) \
{ \
return s5p_cpu_id == id ? 1 : 0; \
}
IS_SAMSUNG_TYPE(s5pc100, 0xc100)
IS_SAMSUNG_TYPE(s5pc110, 0xc110)
转换成下面的:
#define IS_SAMSUNG_TYPE(s5pc100, 0xc100) \
static inline int cpu_is_s5pc100(void) \
{ \
return s5p_cpu_id == 0xc100 ? 1 : 0; \
}
2.更改文件arch/arm/include/asm/arch-s5pc1XX/cpu.h
arch\arm\cpu\armv7\s5p-common\cpu_info.c
static inline int cpu_is_s5pc110(void) \
{
return 1 ;
}
这个比较除暴,,,下面调用了这个宏怎么办?
最后推翻上面的改动部分,全错 直接在那个函数cpu_info.c里面添加
int print_cpuinfo(void)
{
char buf[32];
/*printf("CPU:\t%s%X@%sMHz\n",
s5p_get_cpu_name(), s5p_cpu_id,
strmhz(buf, get_arm_clk()));*/
//printf("\nCPU: S5PV210@%ldMHz(%s)\n", get_ARMCLK()/1000000, ((result_set == 1) ? "OK" : "FAIL"));
printf("\nCPU: S5PV210@%sMHz(OK!)\n", strmhz(buf, get_arm_clk()));
return 0;
}
2.修改S5PV210@400MHz(OK!)中的400的问题,去跟中函数,最后会到
cpu.h中
samsung_get_base_clock
return S5PC110_CLOCK_BASE;
在cpu.h中照这个宏定义,找aPLL计算公式也是对的
#define APLL_LOCKTIME_VAL 0x2cf
#define CLK_DIV0_MASK 0x7fffffff
#define APLL_MDIV 0x7d
#define APLL_PDIV 0x3
#define APLL_SDIV 0x1
#define APLL_LOCKTIME_VAL 0x2cf
#define AFC_ON 0x00000000
#define AFC_OFF 0x10000010
#define EPLL_MDIV 0x60
#define EPLL_PDIV 0x6
#define EPLL_SDIV 0x2
#define VPLL_MDIV 0x6c
#define VPLL_PDIV 0x6
#define VPLL_SDIV 0x3
/* CLK_DIV0 */
#define APLL_RATIO 0
#define A2M_RATIO 4
#define HCLK_MSYS_RATIO 8
#define PCLK_MSYS_RATIO 12
#define HCLK_DSYS_RATIO 16
#define PCLK_DSYS_RATIO 20
#define HCLK_PSYS_RATIO 24
#define PCLK_PSYS_RATIO 28
#define set_pll(mdiv, pdiv, sdiv) (1<<31 | mdiv<<16 | pdiv<<8 | sdiv)
#define APLL_VAL set_pll(APLL_MDIV,APLL_PDIV,APLL_SDIV)
#define MPLL_VAL set_pll(MPLL_MDIV,MPLL_PDIV,MPLL_SDIV)
#define EPLL_VAL set_pll(EPLL_MDIV,EPLL_PDIV,EPLL_SDIV)
#define VPLL_VAL set_pll(VPLL_MDIV,VPLL_PDIV,VPLL_SDIV)
#define CLK_DIV0_VAL ((0<<APLL_RATIO)|(4<<A2M_RATIO)|(4<<HCLK_MSYS_RATIO)|(1<<PCLK_MSYS_RATIO)\
|(3<<HCLK_DSYS_RATIO)|(1<<PCLK_DSYS_RATIO)|(4<<HCLK_PSYS_RATIO)|(1<<PCLK_PSYS_RATIO))
#define CLK_DIV1_VAL ((1<<16)|(1<<12)|(1<<8)|(1<<4))
#define CLK_DIV2_VAL (1<<0)
/****for x210zhu****************/
#define CONFIG_NR_DRAM_BANKS 2
CONFIG_SYS_SDRAM_BASE 0x30000000
#define PHYS_SDRAM_1 CONFIG_SYS_SDRAM_BASE /* OneDRAM Bank #0 */
#define PHYS_SDRAM_1_SIZE (256 << 20) /* 80 MB in Bank #0 */
#define PHYS_SDRAM_2 0x40000000 /* mDDR DMC1 Bank #1 */
#define PHYS_SDRAM_2_SIZE (256 << 20) /* 256 MB in Bank #1 */
//#define PHYS_SDRAM_3 0x50000000 /* mDDR DMC2 Bank #2 */
//#define PHYS_SDRAM_3_SIZE (128 << 20)
/****board_init_f***/机器码问题
#ifdef CONFIG_MACH_TYPE
gd->bd->bi_arch_number = CONFIG_MACH_TYPE; /* board id for Linux */
#endif
后面又重新定义了,(这是新版本中的一点)
int board_init(void)
{
/* Set Initial global variables */
s5pc110_gpio = (struct s5pc110_gpio *)S5PC110_GPIO_BASE;
gd->bd->bi_arch_number = MACH_TYPE_GONI;
gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
return 0;
}
可见文件集中::::
#define MACH_TYPE_TNETV107X 2418
#define MACH_TYPE_SMDKV210 2456/****/
#define MACH_TYPE_OMAP_ZOOM3 2464
#define MACH_TYPE_OMAP_3630SDP 2465
在上诉文件中,改即可
gd->bd->bi_arch_number = MACH_TYPE_SMDKV210;
MMC 卡的编号问题一定注意
CONFIG_SYS_MMC_ENV_DEV = 0代表(内部)flash =1代表sd
int saveenv(void)
{
ALLOC_CACHE_ALIGN_BUFFER(env_t, env_new, 1);
ssize_t len;
char *res;
struct mmc *mmc = find_mmc_device(CONFIG_SYS_MMC_ENV_DEV);
u32 offset;
int ret, copy = 0;
if (init_mmc_for_env(mmc))
return 1;
/********************************/
/***s5p_goni.h中添加代码即可*修改相应的MAKE file*/
#define CONFIG_ENV_SIZE CFG_ENV_SIZE /* 256 KiB, 0x40000 */
#define CONFIG_ENV_IS_IN_MMC 1
#define CONFIG_SYS_MMC_ENV_DEV 0
/***include/common 中的MAke file
注释掉COBJS-$(CONFIG_ENV_IS_IN_MMC) += env_mmc.o
COBJS-$(CONFIG_ENV_IS_IN_FAT) += env_fat.o
COBJS-$(CONFIG_ENV_IS_IN_NAND) += env_nand.o
COBJS-$(CONFIG_ENV_IS_IN_NVRAM) += env_nvram.o
#COBJS-$(CONFIG_ENV_IS_IN_ONENAND) += env_onenand.o
COBJS-$(CONFIG_ENV_IS_IN_SPI_FLASH) += env_sf.o
还有其他的MAkefile 修改见笔记
Uboot移植(smart210)
最新推荐文章于 2019-11-02 00:11:49 发布