Hi all
I develop on dm8168 Soc, and i want to init pcie ep in u-boot which is loaded from nand flash.
I see the pcie init process in u-boot dvrrdk 4.0
board/ti/ti8168 pcie.c
arch/arm/cpu/arm_cortexa8/ti81xx/pcie.c
my Ques is
1. what do fun install_exceptions() do?
2. in fun wait_for_host() wait for __raw_readl(bootflag),
is this Rc write the bootflag ep wait for?
bootflag:
#define TI816X_BOOTFLAG_ADDR 0x4043FFFC
fun:
int pcie_init(void)
{
int bar_enable_mask = 0;
#ifndef TI81XX_NO_PIN_GPMC
unsigned long long bar_size[6] = {0};
#endif
trig = 1;
get_pcie_wdt_base_reload(&wdt_base, &wdt_reload);
wdt_set_reload(wdt_base, wdt_reload);
bootflag = (unsigned int) get_bootflag_addr();
__raw_writel(0, bootflag);
pcie_hw_setup();
pcie_pll_setup();
pcie_enable_module();
app_retry_enable();
DEBUGF("app_retry_enable() done\n");
set_basic_config();
DEBUGF("set basic config() done\n");
write_pcie_lcfg_reg_bits(STATUS_COMMAND,
CFG_REG_CMD_STATUS_MEM_SPACE_ENB,
CFG_REG_CMD_STATUS_MEM_SPACE);
enable_dbi_cs2();
set_ti81xx_device_id();
#ifdef CONFIG_TI81XX_PCIE_32
#ifdef TI81XX_NO_PIN_GPMC
set_size_config_32(&bar_enable_mask);
#else
get_size_boot_mode_pin_32(&bar_enable_mask, bar_size);
set_size_pin_32(bar_size);
#endif
#endif
#ifdef CONFIG_TI81XX_PCIE_64
#ifdef TI81XX_NO_PIN_GPMC
set_size_config_64(&bar_enable_mask);
#else
get_size_boot_mode_pin_64(&bar_enable_mask, bar_size);
set_size_pin_64(bar_size);
#endif
#endif
DEBUGF("set_bar_size() done\n");
disable_dbi_cs2();
DEBUGF("disable_dbi_cs2() done\n");
#ifdef CONFIG_TI81XX_PCIE_32
set_bar_config_32(&bar_enable_mask);
#endif
#ifdef CONFIG_TI81XX_PCIE_64
set_bar_config_64(&bar_enable_mask);
#endif
DEBUGF("set_bar_config() done\n");
config_appl_regs();
DEBUGF("config_appl_regs() done\n");
if (get_ti81xx_device_id() == TI8148_DEVICEID) {
config_force_x1(); /* Not for TI816X */
DEBUGF("config_force_x1() done\n");
}
pcie_enable_link();
install_exceptions();
wait_for_host();
return 0;
}
void install_exceptions(void)
{
/* Install the exception vectors and hook them */
asm ("mcr p15, 0, %0, c7, c5, 0" : : "r" (0));
__raw_writel(0x40300000, 0x4031d030);
__raw_writel(0xE3A00312, 0x40300000);
__raw_writel(0xE3800706, 0x40300004);
__raw_writel(0xE38000A0, 0x40300008);
__raw_writel(0xE3A01002, 0x4030000C);
__raw_writel(0xE5801000, 0x40300010);
}
void wait_for_host(void)
{
unsigned int debug0;
while (1) {
if (__raw_readl(bootflag) != 0) {
DEBUGF("data tranfer happened\n");
break;
}
DEBUGF("waiting for data transfer\t");
debug0 = __raw_readl(0x51001728);
#ifdef DEBUG_LTSSM
DEBUGF("\tD0: %#x\tD1 %#x\n", debug0, __raw_readl(0x5100172C));
#endif
__asm__("dmb");
}
__raw_writel(0, bootflag);
printf("\t---> boot command received, proceed to auto boot...\n");
}
best regards
xavier