|
|
@ -1,3 +1,4 @@ |
|
|
|
/* vim: set ts=4 sw=4 et fdm=marker: */ |
|
|
|
/* sysLib.c - system-dependent routines */ |
|
|
|
|
|
|
|
/*
|
|
|
@ -7,7 +8,6 @@ |
|
|
|
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
|
|
* |
|
|
|
*/ |
|
|
|
|
|
|
|
/* includes */ |
|
|
|
|
|
|
|
#include <vxWorks.h> |
|
|
@ -74,8 +74,7 @@ IMPORT void sysSerialConnectAll (void); |
|
|
|
#include "vxbM6845Vga.c" /* X100 VGA */ |
|
|
|
#endif |
|
|
|
|
|
|
|
typedef struct arm_smc_regs |
|
|
|
{ |
|
|
|
typedef struct arm_smc_regs { |
|
|
|
int a0; |
|
|
|
int a1; |
|
|
|
int a2; |
|
|
@ -99,8 +98,7 @@ LOCAL SPIN_LOCK_ISR_DECL (rebootLock, 0); |
|
|
|
|
|
|
|
/* Non-Boot CPU Start info. Managed by sysCpuEnable */ |
|
|
|
|
|
|
|
typedef struct sysMPCoreStartup_s |
|
|
|
{ |
|
|
|
typedef struct sysMPCoreStartup_s { |
|
|
|
UINT32 newPC; /* Address of 'C' based startup code */ |
|
|
|
UINT32 newSP; /* Stack pointer for startup */ |
|
|
|
UINT32 newArg; /* vxWorks kernel entry point */ |
|
|
@ -113,9 +111,10 @@ typedef struct sysMPCoreStartup_s |
|
|
|
} sysMPCoreStartup_t; |
|
|
|
|
|
|
|
extern sysMPCoreStartup_t sysMPCoreStartup[VX_SMP_NUM_CPUS]; |
|
|
|
|
|
|
|
extern unsigned int arm_mmu_ttbr; |
|
|
|
|
|
|
|
IMPORT void lfsDevRegister(void); |
|
|
|
|
|
|
|
IMPORT void sysInit(void); |
|
|
|
IMPORT void sysInit32(void); |
|
|
|
IMPORT void mmuCortexA8DacrSet(UINT32 dacrVal); |
|
|
@ -163,14 +162,11 @@ IMPORT VOIDFUNCPTR _func_armIntStackSplit; /* ptr to fn to split stack */ |
|
|
|
* critical, they could be reduced. |
|
|
|
*/ |
|
|
|
|
|
|
|
PHYS_MEM_DESC sysPhysMemDesc [] = |
|
|
|
{ |
|
|
|
PHYS_MEM_DESC sysPhysMemDesc[] = { |
|
|
|
|
|
|
|
{ |
|
|
|
LOCAL_MEM_LOCAL_ADRS, /* virtual address */ |
|
|
|
{ LOCAL_MEM_LOCAL_ADRS, /* virtual address */ |
|
|
|
LOCAL_MEM_LOCAL_ADRS, /* physical address */ |
|
|
|
LOCAL_MEM_SIZE, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_WRITEALLOCATE_MSK, |
|
|
|
LOCAL_MEM_SIZE, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_WRITEALLOCATE_MSK, |
|
|
|
#if defined(_WRS_CONFIG_SMP) /* needs to be shared */ |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RWX | MMU_ATTR_WRITEALLOCATE_SHARED |
|
|
|
#else |
|
|
@ -178,84 +174,45 @@ PHYS_MEM_DESC sysPhysMemDesc [] = |
|
|
|
#endif /* _WRS_CONFIG_SMP */ |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
PIN_DEMUX_BASE, /* pin MUX/DEMUX */ |
|
|
|
PIN_DEMUX_BASE, |
|
|
|
0x10000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
UART_0_BASE_ADR, /* UART */ |
|
|
|
UART_0_BASE_ADR, |
|
|
|
0x18000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
{ |
|
|
|
0x28207000, /* CAN*/ |
|
|
|
0x28207000, |
|
|
|
0x1000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
{ |
|
|
|
0x2820b000, /* GMAC*/ |
|
|
|
0x2820b000, |
|
|
|
0x00009000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
{ |
|
|
|
0x29900000, /* GIC */ |
|
|
|
0x29900000, |
|
|
|
0x100000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
FT_PCI_CONFIG_ADDR, /* PCI Memory address spcae */ |
|
|
|
FT_PCI_CONFIG_ADDR, |
|
|
|
0x10000000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
0x50000000, /* PCI io32Addr */ |
|
|
|
0x50000000, |
|
|
|
0x08000000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
|
|
|
|
{ |
|
|
|
0x58000000, /* PCI mem32Addr */ |
|
|
|
0x58000000, |
|
|
|
0x27000000, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
|
|
|
|
{ PIN_DEMUX_BASE, /* pin MUX/DEMUX */ |
|
|
|
PIN_DEMUX_BASE, 0x10000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
|
|
|
|
{ UART_0_BASE_ADR, /* UART */ |
|
|
|
UART_0_BASE_ADR, 0x18000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
{ 0x28207000, /* CAN*/ |
|
|
|
0x28207000, 0x1000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
{ 0x2820b000, /* GMAC*/ |
|
|
|
0x2820b000, 0x00009000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
{ 0x29900000, /* GIC */ |
|
|
|
0x29900000, 0x100000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
|
|
|
|
{ FT_PCI_CONFIG_ADDR, /* PCI Memory address spcae */ |
|
|
|
FT_PCI_CONFIG_ADDR, 0x10000000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
|
|
|
|
{ 0x50000000, /* PCI io32Addr */ |
|
|
|
0x50000000, 0x08000000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
|
|
|
|
{ 0x58000000, /* PCI mem32Addr */ |
|
|
|
0x58000000, 0x27000000, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
|
|
|
|
#ifdef DRV_FTQSPI |
|
|
|
{ /* Qspi BootRom */ |
|
|
|
SPI_FLASH_BASE_ADRS, |
|
|
|
SPI_FLASH_BASE_ADRS, |
|
|
|
SPI_BOOTROM_SIZE, |
|
|
|
SPI_FLASH_BASE_ADRS, SPI_FLASH_BASE_ADRS, SPI_BOOTROM_SIZE, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RO | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RO | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
|
|
|
|
{ /* Qspi Flash */ |
|
|
|
SPI_FLASH_BASE_ADRS + SPI_BOOTROM_SIZE, |
|
|
|
SPI_FLASH_BASE_ADRS + SPI_BOOTROM_SIZE, |
|
|
|
SPI_FLASH_SIZE - SPI_BOOTROM_SIZE, |
|
|
|
SPI_FLASH_BASE_ADRS + SPI_BOOTROM_SIZE, SPI_FLASH_BASE_ADRS + SPI_BOOTROM_SIZE, SPI_FLASH_SIZE - SPI_BOOTROM_SIZE, |
|
|
|
MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_DEVICE_SHARED_MSK, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED |
|
|
|
}, |
|
|
|
MMU_ATTR_VALID | MMU_ATTR_SUP_RW | MMU_ATTR_DEVICE_SHARED }, |
|
|
|
#endif |
|
|
|
|
|
|
|
}; |
|
|
@ -270,10 +227,8 @@ char * sysBootLine = BOOT_LINE_ADRS; /* address of boot line */ |
|
|
|
char *sysExcMsg = EXC_MSG_ADRS; /* catastrophic message area */ |
|
|
|
int sysProcNum; /* processor number of this CPU */ |
|
|
|
|
|
|
|
|
|
|
|
/* locals */ |
|
|
|
|
|
|
|
|
|
|
|
/* defines */ |
|
|
|
|
|
|
|
/* externals */ |
|
|
@ -288,11 +243,8 @@ char * sysPhysMemTop (void); |
|
|
|
|
|
|
|
/* included source files */ |
|
|
|
|
|
|
|
|
|
|
|
#include <mem/nullNvRam.c> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* |
|
|
|
* sysModel - return the model name of the CPU board |
|
|
@ -326,21 +278,15 @@ char * sysBspRev (void) |
|
|
|
{ |
|
|
|
return (BSP_VERSION BSP_REV); |
|
|
|
} |
|
|
|
extern VIRT_ADDR mmuPhysToVirt |
|
|
|
( |
|
|
|
PHYS_ADDR physAddr /* physical address to be translated */ |
|
|
|
extern VIRT_ADDR mmuPhysToVirt(PHYS_ADDR physAddr /* physical address to be translated */ |
|
|
|
); |
|
|
|
|
|
|
|
extern PHYS_ADDR mmuVirtToPhys |
|
|
|
( |
|
|
|
VIRT_ADDR virtAddr /* virtual address to be translated */ |
|
|
|
extern PHYS_ADDR mmuVirtToPhys(VIRT_ADDR virtAddr /* virtual address to be translated */ |
|
|
|
); |
|
|
|
#ifndef _WRS_CONFIG_ARM_LPAE |
|
|
|
extern void cacheCortexA9LibInstall (VIRT_ADDR (physToVirt)(PHYS_ADDR), |
|
|
|
PHYS_ADDR (virtToPhys)(VIRT_ADDR)); |
|
|
|
extern void cacheCortexA9LibInstall(VIRT_ADDR(physToVirt)(PHYS_ADDR), PHYS_ADDR(virtToPhys)(VIRT_ADDR)); |
|
|
|
#else |
|
|
|
extern void cacheCortexA15LibInstall (VIRT_ADDR (physToVirt)(PHYS_ADDR), |
|
|
|
PHYS_ADDR (virtToPhys)(VIRT_ADDR)); |
|
|
|
extern void cacheCortexA15LibInstall(VIRT_ADDR(physToVirt)(PHYS_ADDR), PHYS_ADDR(virtToPhys)(VIRT_ADDR)); |
|
|
|
#endif |
|
|
|
void writeq(int data, int addr) |
|
|
|
{ |
|
|
@ -362,7 +308,6 @@ void v8_outer_disable_l3cache(void) |
|
|
|
pstate = readq(0x3A200018 + i * 0x10000); |
|
|
|
} while ((pstate & 0xf) != (0x1 << 2)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void v8_outer_cache_flush_all(void) |
|
|
@ -403,9 +348,7 @@ void sysHwInit0 (void) |
|
|
|
* RETURNS: N/A |
|
|
|
*/ |
|
|
|
|
|
|
|
void sysMsDelay |
|
|
|
( |
|
|
|
UINT delay /* length of time in ms to delay */ |
|
|
|
void sysMsDelay(UINT delay /* length of time in ms to delay */ |
|
|
|
) |
|
|
|
{ |
|
|
|
sysUsDelay(1000 * delay); |
|
|
@ -427,7 +370,6 @@ void sysDelay (void) |
|
|
|
|
|
|
|
LOCAL UINT32 genTimerFreq = 0; |
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* |
|
|
|
* armGenGetSysCount - get system counter count |
|
|
@ -443,12 +385,10 @@ LOCAL UINT64 armGenGetSysCount (void) |
|
|
|
{ |
|
|
|
UINT64 count1; |
|
|
|
|
|
|
|
|
|
|
|
_WRS_ASM("ISB"); |
|
|
|
|
|
|
|
count1 = __inline__GetPhyTimerCnt(); |
|
|
|
|
|
|
|
|
|
|
|
return count1; |
|
|
|
} |
|
|
|
|
|
|
@ -468,11 +408,7 @@ LOCAL void armGenGetFreq (void) |
|
|
|
_WRS_ASM("MRC p15, 0, %0, c14, c0, 0" : "=r"(genTimerFreq)); |
|
|
|
} |
|
|
|
#else |
|
|
|
__asm volatile UINT32 __inline__GetCntFreq (void) |
|
|
|
{ |
|
|
|
! "r0" |
|
|
|
mrc p15, 0, r0, c14, c0, 0 |
|
|
|
} |
|
|
|
__asm volatile UINT32 __inline__GetCntFreq(void){ !"r0" mrc p15, 0, r0, c14, c0, 0 } |
|
|
|
|
|
|
|
LOCAL UINT32 armGenGetFreq(void) |
|
|
|
{ |
|
|
@ -503,10 +439,7 @@ LOCAL UINT32 armGenGetFreq (void) |
|
|
|
*\NOMANUAL |
|
|
|
*/ |
|
|
|
|
|
|
|
void sysUsDelay |
|
|
|
( |
|
|
|
int us |
|
|
|
) |
|
|
|
void sysUsDelay(int us) |
|
|
|
{ |
|
|
|
volatile UINT64 oldVal; |
|
|
|
volatile UINT64 newVal; |
|
|
@ -514,8 +447,7 @@ void sysUsDelay |
|
|
|
volatile UINT64 totalDelta; |
|
|
|
volatile UINT64 maxCount; |
|
|
|
|
|
|
|
if (us <= 0) |
|
|
|
{ |
|
|
|
if (us <= 0) { |
|
|
|
printf("usDelay, wrong parameter: %d us\n", us); |
|
|
|
return; |
|
|
|
} |
|
|
@ -524,19 +456,15 @@ void sysUsDelay |
|
|
|
maxCount = 0xffffffffffffffffull; |
|
|
|
|
|
|
|
oldVal = armGenGetSysCount(); |
|
|
|
while (incElapsed < totalDelta) |
|
|
|
{ |
|
|
|
while (incElapsed < totalDelta) { |
|
|
|
newVal = armGenGetSysCount(); |
|
|
|
|
|
|
|
if (newVal == oldVal) |
|
|
|
continue; |
|
|
|
|
|
|
|
if (newVal > oldVal) |
|
|
|
{ |
|
|
|
if (newVal > oldVal) { |
|
|
|
incElapsed += (newVal - oldVal); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
} else { |
|
|
|
incElapsed += ((maxCount - oldVal) + newVal); |
|
|
|
} |
|
|
|
|
|
|
@ -579,26 +507,64 @@ void sysHwInit (void) |
|
|
|
// writeq(readq(PIN_DEMUX_BASE+REG204)|CAN_TXD_0|CAN_RXD_0|CAN_TXD_1|CAN_RXD_1,
|
|
|
|
// PIN_DEMUX_BASE+REG204); /* pad pin DeMux. enable CAN */
|
|
|
|
|
|
|
|
/* pin_mux:
|
|
|
|
/*
|
|
|
|
* pin_mux (SPI0): |
|
|
|
* spi0_csn0_pad: spi0_csn0 gpio1_porta_5 |
|
|
|
* spi0_sck_pad: spi0_sck gpio1_porta_6 |
|
|
|
* spi0_so_pad: spi0_so gpio1_porta_7 |
|
|
|
* spi0_si_pad: spi0_si gpio1_portb_0 |
|
|
|
*/ |
|
|
|
unsigned int reg = readl(PIN_DEMUX_BASE + REG208); |
|
|
|
reg &= ~((0x3 << 16) | (0x3 << 12) | (0x3 << 8) | (0x3 << 4)); |
|
|
|
writel(reg, PIN_DEMUX_BASE + REG208); |
|
|
|
|
|
|
|
/*
|
|
|
|
* pin_mux (SPI1): |
|
|
|
* uart_2_rxd_pad: uart_2_rxd spi1_csn0 gpio0_portb_5 |
|
|
|
* uart_2_txd_pad: uart_2_txd spi1_sck hda_sdi1 |
|
|
|
* uart_3_rxd_pad: uart_3_rxd spi1_so hda_sdi2 |
|
|
|
* uart_3_txd_pad: uart_3_txd spi1_si hda_sdi3 |
|
|
|
*/ |
|
|
|
/* SM2130 1553B SPI1 */ |
|
|
|
unsigned int reg = readl(PIN_DEMUX_BASE + REG210); |
|
|
|
reg &= ~0x3; |
|
|
|
reg |= 0x1; /* spi1_csn0 */ |
|
|
|
/* SPI1 */ |
|
|
|
reg = readl(PIN_DEMUX_BASE + REG210); |
|
|
|
reg &= ~0xf; |
|
|
|
reg |= 0x9; /* spi1_csn0 */ |
|
|
|
writel(reg, PIN_DEMUX_BASE + REG210); |
|
|
|
|
|
|
|
reg = readl(PIN_DEMUX_BASE + REG214); |
|
|
|
reg &= ~((0x3 << 28) | (0x3 << 24) | (0x3 << 20)); |
|
|
|
reg |= (1 << 28) | (1 << 24) | (1 << 20); |
|
|
|
reg &= ~((0xf << 28) | (0xf << 24) | (0xf << 20)); |
|
|
|
reg |= (0x9 << 28) | (0x9 << 24) | (0x9 << 20); /* enable pullup */ |
|
|
|
writel(reg, PIN_DEMUX_BASE + REG214); |
|
|
|
|
|
|
|
/*
|
|
|
|
* GPIO1_B7: SM2130_MR |
|
|
|
* GPIO0_B6: SM2130_ACKIRQ |
|
|
|
* GPIO0_B7: SM2130_READY |
|
|
|
* |
|
|
|
* qspi_csn1_pad: qspi_csn1 gpio1_portb_7 |
|
|
|
* qspi_csn2_pad: spi_csn2 spi1_csn1 gpio0_portb_6 |
|
|
|
* qspi_csn3_pad: qspi_csn3 spi1_csn2 gpio0_portb_7 |
|
|
|
*/ |
|
|
|
reg = readl(PIN_DEMUX_BASE + REG214); |
|
|
|
reg &= ~((0x3 << 12) | (0x3 << 8) | (0x3 << 4)); |
|
|
|
reg |= (0x1 << 12) | (0x2 << 8) | (0x2 << 4); |
|
|
|
writel(reg, PIN_DEMUX_BASE + REG214); |
|
|
|
/*
|
|
|
|
* GPIO1_A4: SM2130_IRQ |
|
|
|
* |
|
|
|
* ext_lpc_lad_1_pad: ext_lpc_lad_1 gpio1_porta_4 |
|
|
|
*/ |
|
|
|
reg = readl(PIN_DEMUX_BASE + REG218); |
|
|
|
reg &= ~(0x3 << 8); |
|
|
|
reg |= (0x1 << 8); |
|
|
|
writel(reg, PIN_DEMUX_BASE + REG218); |
|
|
|
|
|
|
|
#ifdef DRV_X100DC |
|
|
|
ftX100DcDevicePciRegister(); |
|
|
|
#endif |
|
|
|
|
|
|
|
lfsDevRegister(); |
|
|
|
|
|
|
|
#ifdef INCLUDE_VXBUS |
|
|
|
hardWareInterFaceInit(); |
|
|
|
#endif /* INCLUDE_VXBUS */ |
|
|
@ -613,15 +579,12 @@ void sysHwInit (void) |
|
|
|
strncpy(sysBootLine, DEFAULT_BOOT_LINE, strlen(DEFAULT_BOOT_LINE) + 1); |
|
|
|
#endif /* FORCE_DEFAULT_BOOT_LINE */ |
|
|
|
|
|
|
|
|
|
|
|
#ifdef _WRS_CONFIG_SMP |
|
|
|
|
|
|
|
_vxb_delayRtn = (void (*)())sysDelay; |
|
|
|
_vxb_msDelayRtn = (void (*)(int))sysMsDelay; |
|
|
|
_vxb_usDelayRtn = (void (*)(int))sysUsDelay; |
|
|
|
armGenGetFreq(); |
|
|
|
#endif /*_WRS_CONFIG_SMP*/ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
@ -636,13 +599,11 @@ void sysHwInit (void) |
|
|
|
* |
|
|
|
* ERRNO |
|
|
|
*/ |
|
|
|
|
|
|
|
void sysHwInit2(void) |
|
|
|
{ |
|
|
|
static BOOL initialised = FALSE; |
|
|
|
|
|
|
|
if (initialised) |
|
|
|
{ |
|
|
|
if (initialised) { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
@ -654,18 +615,15 @@ void sysHwInit2 (void) |
|
|
|
sysSerialConnectAll(); |
|
|
|
#endif /* INCLUDE_SIO_UTILS */ |
|
|
|
|
|
|
|
taskSpawn("tDevConn", 11, 0, 10000, |
|
|
|
vxbDevConnect, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); |
|
|
|
taskSpawn("tDevConn", 11, 0, 10000, vxbDevConnect, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9); |
|
|
|
#endif /* INCLUDE_VXBUS */ |
|
|
|
|
|
|
|
|
|
|
|
initialised = TRUE; |
|
|
|
|
|
|
|
#if defined(INCLUDE_IPFTPS) |
|
|
|
ipcom_sysvar_set("ipftps.root", TFFS_FLASH_MOUNT_POINTOT, IPCOM_SYSVAR_FLAG_OVERWRITE); |
|
|
|
ipcom_sysvar_set("ipftps.dir", TFFS_FLASH_MOUNT_POINTOT, IPCOM_SYSVAR_FLAG_OVERWRITE); |
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
@ -695,11 +653,8 @@ char * sysPhysMemTop (void) |
|
|
|
{ |
|
|
|
static char *physTop = NULL; |
|
|
|
|
|
|
|
if (physTop == NULL) |
|
|
|
{ |
|
|
|
|
|
|
|
if (physTop == NULL) { |
|
|
|
physTop = (char *)(LOCAL_MEM_LOCAL_ADRS + LOCAL_MEM_SIZE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return physTop; |
|
|
@ -732,7 +687,6 @@ char * sysMemTop (void) |
|
|
|
return (memTop); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* |
|
|
|
* sysToMonitor - transfer control to the ROM monitor |
|
|
@ -748,12 +702,9 @@ char * sysMemTop (void) |
|
|
|
*/ |
|
|
|
/*Please refer to FT-1500A-4V1.5.pdf for GPIO general description.*/ |
|
|
|
|
|
|
|
STATUS sysToMonitor |
|
|
|
( |
|
|
|
int startType /* passed to ROM to tell it how to boot */ |
|
|
|
STATUS sysToMonitor(int startType /* passed to ROM to tell it how to boot */ |
|
|
|
) |
|
|
|
{ |
|
|
|
|
|
|
|
ARM_SMC_REGS input = { 0 }; |
|
|
|
ARM_SMC_REGS output = { 0 }; |
|
|
|
|
|
|
@ -765,8 +716,8 @@ STATUS sysToMonitor |
|
|
|
#endif /* _WRS_CONFIG_ARM_LPAE */ |
|
|
|
input.a0 = 0x84000009; |
|
|
|
armSmcCall(&input, &output); |
|
|
|
while(1) |
|
|
|
{} |
|
|
|
while (1) { |
|
|
|
} |
|
|
|
|
|
|
|
return OK; /* in case we ever continue from ROM monitor */ |
|
|
|
} |
|
|
@ -794,14 +745,8 @@ extern void arm_int_enable(); |
|
|
|
|
|
|
|
IMPORT void excVBARSet(UINT32 adr); |
|
|
|
|
|
|
|
LOCAL void sysCpuStart |
|
|
|
( |
|
|
|
void (*startFunc)(void), |
|
|
|
UINT32 cpuNum |
|
|
|
) |
|
|
|
LOCAL void sysCpuStart(void (*startFunc)(void), UINT32 cpuNum) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
/* sysMsDelay(cpuNum*100);*/ |
|
|
|
#ifdef INCLUDE_VFP |
|
|
|
vfpEnable(); |
|
|
@ -822,13 +767,9 @@ LOCAL void sysCpuStart |
|
|
|
if (cpuNum == VX_SMP_NUM_CPUS - 1) |
|
|
|
uartf("sysCpuStart(). cpu to start : %d done! \r\n", cpuNum); |
|
|
|
|
|
|
|
|
|
|
|
(*startFunc)(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* |
|
|
|
* sysCpuEnable - enable a multi core CPU |
|
|
@ -842,14 +783,8 @@ LOCAL void sysCpuStart |
|
|
|
* \NOMANUAL |
|
|
|
*/ |
|
|
|
|
|
|
|
STATUS sysCpuEnable |
|
|
|
( |
|
|
|
unsigned int cpuNum, |
|
|
|
void (*startFunc) (void), |
|
|
|
char *stackPtr |
|
|
|
) |
|
|
|
STATUS sysCpuEnable(unsigned int cpuNum, void (*startFunc)(void), char *stackPtr) |
|
|
|
{ |
|
|
|
|
|
|
|
static INT32 sysCpuEnableFirst = 1; |
|
|
|
|
|
|
|
/* Validate cpuNum */ |
|
|
@ -857,9 +792,7 @@ STATUS sysCpuEnable |
|
|
|
if (cpuNum < 1 || cpuNum >= VX_SMP_NUM_CPUS) |
|
|
|
return (ERROR); |
|
|
|
|
|
|
|
if (sysCpuEnableFirst == 1) |
|
|
|
{ |
|
|
|
|
|
|
|
if (sysCpuEnableFirst == 1) { |
|
|
|
/*
|
|
|
|
* IPIs cannot be connected in sysToMonitor, because interrupt handlers |
|
|
|
* cannot be installed in interrupt context. |
|
|
@ -872,8 +805,7 @@ STATUS sysCpuEnable |
|
|
|
* The INT_LVL_MPCORE_IPI08 is sent by core 0 to all the AP cores. |
|
|
|
*/ |
|
|
|
|
|
|
|
vxIpiConnect (INT_LVL_MPCORE_IPI08, (IPI_HANDLER_FUNC)(sysToMonitor), |
|
|
|
(void *)(APPCORE_REBOOT)); |
|
|
|
vxIpiConnect(INT_LVL_MPCORE_IPI08, (IPI_HANDLER_FUNC)(sysToMonitor), (void *)(APPCORE_REBOOT)); |
|
|
|
|
|
|
|
vxIpiEnable(INT_LVL_MPCORE_IPI08); |
|
|
|
|
|
|
@ -883,8 +815,7 @@ STATUS sysCpuEnable |
|
|
|
* to core0. |
|
|
|
*/ |
|
|
|
|
|
|
|
vxIpiConnect (INT_LVL_MPCORE_RESET, (IPI_HANDLER_FUNC)(sysToMonitor), |
|
|
|
(void *) &rebootVar); |
|
|
|
vxIpiConnect(INT_LVL_MPCORE_RESET, (IPI_HANDLER_FUNC)(sysToMonitor), (void *)&rebootVar); |
|
|
|
|
|
|
|
vxIpiEnable(INT_LVL_MPCORE_RESET); |
|
|
|
|
|
|
@ -907,8 +838,7 @@ STATUS sysCpuEnable |
|
|
|
|
|
|
|
/* Make sure data hits memory */ |
|
|
|
|
|
|
|
cacheFlush ((CACHE_TYPE)DATA_CACHE, (void *)sysMPCoreStartup, |
|
|
|
(size_t)(sizeof (sysMPCoreStartup))); |
|
|
|
cacheFlush((CACHE_TYPE)DATA_CACHE, (void *)sysMPCoreStartup, (size_t)(sizeof(sysMPCoreStartup))); |
|
|
|
|
|
|
|
cachePipeFlush(); |
|
|
|
#if 0 |
|
|
@ -939,15 +869,12 @@ STATUS sysCpuEnable |
|
|
|
if (vmTranslate(NULL, (VIRT_ADDR)sysCpuInit, &physAddr) == ERROR) |
|
|
|
return ERROR; |
|
|
|
|
|
|
|
|
|
|
|
input.a0 = 0x84000003; |
|
|
|
input.a1 = cpuNum; |
|
|
|
if(2 == input.a1) |
|
|
|
{ |
|
|
|
if (2 == input.a1) { |
|
|
|
input.a1 = 0x100; /* Core2's number is 0x100 */ |
|
|
|
} |
|
|
|
if(3 == input.a1) |
|
|
|
{ |
|
|
|
if (3 == input.a1) { |
|
|
|
input.a1 = 0x101; /* Core3's number is 0x101 */ |
|
|
|
} |
|
|
|
/*input.a2 = (UINT32)(physAddr >> 32);*/ |
|
|
@ -960,8 +887,6 @@ STATUS sysCpuEnable |
|
|
|
#endif |
|
|
|
|
|
|
|
/* wake up core from wfe using sev. */ |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
#endif |
|
|
|
|
|
|
@ -1021,15 +946,12 @@ int sysProcNumGet (void) |
|
|
|
* SEE ALSO: sysProcNumGet() |
|
|
|
*/ |
|
|
|
|
|
|
|
void sysProcNumSet |
|
|
|
( |
|
|
|
int procNum /* processor number */ |
|
|
|
void sysProcNumSet(int procNum /* processor number */ |
|
|
|
) |
|
|
|
{ |
|
|
|
sysProcNum = procNum; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#ifdef INCLUDE_SIO_UTILS |
|
|
|
/******************************************************************************
|
|
|
|
* |
|
|
@ -1052,18 +974,13 @@ void sysProcNumSet |
|
|
|
* \NOMANUAL |
|
|
|
*/ |
|
|
|
|
|
|
|
SIO_CHAN * bspSerialChanGet |
|
|
|
( |
|
|
|
int channel /* serial channel */ |
|
|
|
SIO_CHAN *bspSerialChanGet(int channel /* serial channel */ |
|
|
|
) |
|
|
|
{ |
|
|
|
return ((SIO_CHAN *)ERROR); |
|
|
|
} |
|
|
|
#endif /* INCLUDE_SIO_UTILS */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef DRV_PCIBUS_FT |
|
|
|
|
|
|
|
LOCAL UCHAR sysPciExIntRoute[4] = { 60, 61, 62, 63 }; |
|
|
@ -1077,9 +994,7 @@ LOCAL UCHAR sysPciExIntRoute[4] = {60, 61, 62, 63}; |
|
|
|
* RETURNS: OK or ERROR |
|
|
|
*/ |
|
|
|
|
|
|
|
STATUS sysPciExAutoconfigInclude |
|
|
|
( |
|
|
|
PCI_SYSTEM * pSys, /* PCI_SYSTEM structure pointer */ |
|
|
|
STATUS sysPciExAutoconfigInclude(PCI_SYSTEM *pSys, /* PCI_SYSTEM structure pointer */ |
|
|
|
PCI_LOC *pLoc, /* pointer to function in question */ |
|
|
|
UINT devVend /* deviceID/vendorID of device */ |
|
|
|
) |
|
|
@ -1101,16 +1016,13 @@ STATUS sysPciExAutoconfigInclude |
|
|
|
*/ |
|
|
|
UCHAR pci_int_log[32] = { 0 }; |
|
|
|
int pci_int_idx = 0; |
|
|
|
UCHAR sysPciExAutoconfigIntrAssign |
|
|
|
( |
|
|
|
PCI_SYSTEM * pSys, /* PCI_SYSTEM structure pointer */ |
|
|
|
UCHAR sysPciExAutoconfigIntrAssign(PCI_SYSTEM *pSys, /* PCI_SYSTEM structure pointer */ |
|
|
|
PCI_LOC *pLoc, /* pointer to function in question */ |
|
|
|
UCHAR pin /* contents of PCI int pin register */ |
|
|
|
) |
|
|
|
{ |
|
|
|
pci_int_log[pci_int_idx++] = pin; |
|
|
|
if(pci_int_idx == 32) |
|
|
|
{ |
|
|
|
if (pci_int_idx == 32) { |
|
|
|
pci_int_idx = 0; |
|
|
|
} |
|
|
|
|
|
|
@ -1119,16 +1031,11 @@ UCHAR sysPciExAutoconfigIntrAssign |
|
|
|
|
|
|
|
#endif /* DRV_PCIBUS_M85XX */ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* this is for multi cluster*/ |
|
|
|
#if defined(_WRS_CONFIG_SMP) |
|
|
|
UINT32 cpuIndexMap[4] = { 0, 1, 0x100, 0x101 }; |
|
|
|
|
|
|
|
UINT32 vxCpuIdGetByIndex |
|
|
|
( |
|
|
|
UINT32 idx |
|
|
|
) |
|
|
|
UINT32 vxCpuIdGetByIndex(UINT32 idx) |
|
|
|
{ |
|
|
|
if (idx >= VX_MAX_SMP_CPUS) |
|
|
|
return (UINT32)-1; |
|
|
@ -1163,10 +1070,7 @@ UCHAR sysPciInByte(ULONG address) |
|
|
|
*(volatile UINT *)address = data; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
extern int fioFormatV |
|
|
|
( |
|
|
|
FAST const char *fmt, /* format string */ |
|
|
|
extern int fioFormatV(FAST const char *fmt, /* format string */ |
|
|
|
va_list vaList, /* pointer to varargs list */ |
|
|
|
FUNCPTR outRoutine, /* handler for args as they're formatted */ |
|
|
|
int outarg /* argument to routine */ |
|
|
@ -1187,12 +1091,10 @@ static void charout(char cha) |
|
|
|
|
|
|
|
/* is the transmitter ready to accept a character? */ |
|
|
|
|
|
|
|
while ((reg_val32 & FLG_UTXFF) != 0x00) |
|
|
|
{ |
|
|
|
while ((reg_val32 & FLG_UTXFF) != 0x00) { |
|
|
|
reg_val32 = *(volatile UINT32 *)(uart_tx_fifo_addr + UARTFR); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
*(volatile UINT32 *)uart_tx_fifo_addr = cha; |
|
|
|
} |
|
|
|
|
|
|
@ -1209,9 +1111,7 @@ void stringout(char * str) |
|
|
|
} while ((reg_val32 & FLG_UTXFE) == 0); |
|
|
|
} |
|
|
|
|
|
|
|
static int bufferPut |
|
|
|
( |
|
|
|
char *inbuf, /* pointer to source buffer */ |
|
|
|
static int bufferPut(char *inbuf, /* pointer to source buffer */ |
|
|
|
int length, /* number of bytes to copy */ |
|
|
|
char **outptr /* pointer to destination buffer */ |
|
|
|
) |
|
|
@ -1226,12 +1126,13 @@ int uartf(const char * fmt, /* format string */ |
|
|
|
... /* optional arguments to format */ |
|
|
|
) |
|
|
|
{ |
|
|
|
char charArray[128] = {0,}; |
|
|
|
char charArray[128] = { |
|
|
|
0, |
|
|
|
}; |
|
|
|
char *buffer = charArray; |
|
|
|
va_list vaList; /* traverses argument list */ |
|
|
|
int nChars; |
|
|
|
|
|
|
|
|
|
|
|
va_start(vaList, fmt); |
|
|
|
nChars = fioFormatV(fmt, vaList, bufferPut, (int)&buffer); |
|
|
|
va_end(vaList); |
|
|
@ -1240,10 +1141,8 @@ int uartf(const char * fmt, /* format string */ |
|
|
|
|
|
|
|
stringout(charArray); |
|
|
|
return (nChars); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*******************************************************************************
|
|
|
|
* |
|
|
|
* sysSdhcClkFreqGet - get sdhc freq |
|
|
@ -1255,7 +1154,6 @@ int uartf(const char * fmt, /* format string */ |
|
|
|
|
|
|
|
LOCAL UINT32 sysSdhcClkFreqGet(void) |
|
|
|
{ |
|
|
|
|
|
|
|
return 600000000; |
|
|
|
} |
|
|
|
|
|
|
@ -1282,4 +1180,3 @@ LOCAL void sysGmacAddrSet (UINT8* macAddr) |
|
|
|
addr += 2; |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|