Uboot移植(smart210)

初步移植:在基本的基礎之上移植
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<

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-(CONFIGENVISINMMC)+=envmmc.oCOBJS (CONFIG_ENV_IS_IN_FAT) += env_fat.o
COBJS-(CONFIGENVISINNAND)+=envnand.oCOBJS (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 修改見筆記

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章