mini6410板uboot的Movi.c
#include <common.h>
#ifdef CONFIG_MOVINAND
#if defined(CONFIG_SMDK6410) || defined(CONFIG_MINI6410)
#include <s3c6410.h>
#elif defined(CONFIG_SMDK6430)
#include <s3c6430.h>
#endif
#include <movi.h>
#include <asm/io.h>
uint movi_hc = 0;
void movi_set_capacity(void)
{
#if defined(CONFIG_S3C6400)
if (MOVI_HIGH_CAPACITY == 2)
#else
if (MOVI_HIGH_CAPACITY & 0x1)
#endif
movi_hc = 1;
}
int movi_set_ofs(uint last)
{
int changed = 0;
if (ofsinfo.last != last) {
ofsinfo.last = last – (eFUSE_SIZE / MOVI_BLKSIZE);
ofsinfo.bl1 = ofsinfo.last – MOVI_BL1_BLKCNT;
ofsinfo.env = ofsinfo.bl1 – MOVI_ENV_BLKCNT;
ofsinfo.bl2 = ofsinfo.bl1 – (MOVI_BL2_BLKCNT + MOVI_ENV_BLKCNT);
ofsinfo.zimage = ofsinfo.bl2 – MOVI_ZIMAGE_BLKCNT;
changed = 1;
}
return changed;
}
int movi_init(void)
{
hsmmc_set_gpio();
hsmmc_reset();
if (hsmmc_init()) {
printf(“\nCard Initialization failed.\n”);
return -1;
}
return 1;
}
void movi_write_env(ulong addr)
{
movi_write((uint)addr, ofsinfo.env, MOVI_ENV_BLKCNT);
}
void movi_read_env(ulong addr)
{
movi_read((uint)addr, ofsinfo.env, MOVI_ENV_BLKCNT);
}
void movi_bl2_copy(void)
{
#if defined(CONFIG_S3C6400)
CopyMovitoMem(MOVI_BL2_POS, MOVI_BL2_BLKCNT, (uint *)BL2_BASE, CONFIG_SYS_CLK_FREQ, MOVI_INIT_REQUIRED);
#else
writel(readl(HM_CONTROL4) | (0x3 << 16), HM_CONTROL4); /*9mA的时钟输出信号*/
CopyMovitoMem(HSMMC_CHANNEL, MOVI_BL2_POS, MOVI_BL2_BLKCNT, (uint *)BL2_BASE, MOVI_INIT_REQUIRED); /*实际调用0x0c004008位置的一段代码,参考S3c6410 IROM的说明,知道这段代码是内置的拷贝SD数据到内存的代码。第一个参数为通道号,mini6410的为0,第二个参数SD卡位置,这里为总大小-0.5k保留-0.5k签名-8k的BL1-256k的BL2-128k的扩展bl2(?因为BL2是BL1装载进内存的,而bl1是uboot的一部分,所以只要跟烧写SD卡的工具保持一个就可以了。而bl1是bl0装载的,所以位置和必须固定),第三个参数为拷贝大小,这里为256kB,第四个参数为内存位置,这里是0x57e00000,第五个参数是是否需要重新初始化SD,这里为不需要*/
#endif
}
#endif