Esempio n. 1
0
//------------------------------------------------------------------------------
//
//  Function:  OEMPlatformInit
//
//  This function provide platform initialization functions. It is called
//  from boot loader after OEMDebugInit is called.  Note that boot loader
//  BootloaderMain is called from  s/init.s code which is run after reset.
//
BOOL 
OEMPlatformInit(
    )
{
    OMAP_GPTIMER_REGS *pTimerRegs;
    UINT32 CpuRevision, version;
    HANDLE hTwl,hGPIO;
    static UCHAR allocationPool[512];
    static const PAD_INFO ebootPinMux[] = {
            DSS_PADS
            GPIO_PADS
			USBOTG_PADS
            END_OF_PAD_ARRAY
    };
    static const PAD_INFO ebootPinMux_37XX[] = {
            DSS_PADS_37XX
            GPIO_PADS_37XX
	     	USBOTG_PADS
            END_OF_PAD_ARRAY
    };
    
    OALLocalAllocInit(allocationPool,sizeof(allocationPool));

    // Get processor and companion chip versions
	g_CPUFamily = CPU_FAMILY_OMAP35XX;
    CpuRevision = Get_CPUVersion();
    version = CPU_REVISION(CpuRevision);
    g_CPUFamily = CPU_FAMILY(CpuRevision);

	// Set GPTIMER1 regs pointer
	pTimerRegs = OALPAtoUA(OMAP_GPTIMER1_REGS_PA);

    if(g_CPUFamily == CPU_FAMILY_DM37XX)
    {
        ConfigurePadArray(ebootPinMux_37XX);
    }
    else
    {
        ConfigurePadArray(ebootPinMux);
    }
    //OALLogSetZones( 
    //           (1<<OAL_LOG_VERBOSE)  |
    //           (1<<OAL_LOG_INFO)     |
    //           (1<<OAL_LOG_ERROR)    |
    //           (1<<OAL_LOG_WARN)     |
    //           (1<<OAL_LOG_FUNC)     |
    //           (1<<OAL_LOG_IO)     |
    //           0);

    OALLog(
        L"\r\nTexas Instruments Windows CE EBOOT for OMAP35xx/37xx, "
        L"Built %S at %S\r\n", __DATE__, __TIME__
        );
    OALLog(
        L"EBOOT Version %d.%d, BSP " BSP_VERSION_STRING L"\r\n", 
        EBOOT_VERSION_MAJOR, EBOOT_VERSION_MINOR        
        );

    // Soft reset GPTIMER1
    OUTREG32(&pTimerRegs->TIOCP, SYSCONFIG_SOFTRESET);
    // While until done
    while ((INREG32(&pTimerRegs->TISTAT) & GPTIMER_TISTAT_RESETDONE) == 0);
    // Enable posted mode
    OUTREG32(&pTimerRegs->TSICR, GPTIMER_TSICR_POSTED);
    // Start timer
    OUTREG32(&pTimerRegs->TCLR, GPTIMER_TCLR_AR|GPTIMER_TCLR_ST);
    
	// Enable device clocks used by the bootloader
    EnableDeviceClocks(OMAP_DEVICE_GPIO1,TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO2,TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO3,TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO4,TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO5,TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO6,TRUE);

    // configure i2c devices
    OALI2CInit(OMAP_DEVICE_I2C1);
    OALI2CInit(OMAP_DEVICE_I2C2);
    OALI2CInit(OMAP_DEVICE_I2C3);

    GPIOInit();
    // Note that T2 accesses must occur after I2C initialization
    hTwl = TWLOpen();
    hGPIO = GPIOOpen(); 
    
    
    // Clear Reset on ethernet controller        
    GPIOSetBit(hGPIO,LAN9115_RESET_GPIO);            
    GPIOSetMode(hGPIO, LAN9115_RESET_GPIO,GPIO_DIR_OUTPUT);

	//rst usb hub
	GPIOClrBit(hGPIO,13);            
    GPIOSetMode(hGPIO, 13,GPIO_DIR_OUTPUT);
	OALStall(10000);
	GPIOSetBit(hGPIO,13);
	OALStall(1000);
	GPIOClrBit(hGPIO,13);  

    

    OALLog(L"\r\nTI OMAP%x Version 0x%08x (%s)\r\n", CPU_ID(CpuRevision), CPU_REVISION(CpuRevision),        
        version == CPU_FAMILY_35XX_REVISION_ES_1_0 ? L"ES1.0" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_0 ? L"ES2.0" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_1 ? L"ES2.1" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_0_CRC ? L"ES2.0, ID determined using CRC" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_1_CRC ? L"ES2.1, ID determined using CRC" :
        version == CPU_FAMILY_35XX_REVISION_ES_3_0 ? L"ES3.0" :
        version == CPU_FAMILY_35XX_REVISION_ES_3_1 ? L"ES3.1" : 
        version == CPU_FAMILY_37XX_REVISION_ES_1_0? L"ES1.0" :
        version == CPU_FAMILY_37XX_REVISION_ES_1_1? L"ES1.1" :
        version == CPU_FAMILY_37XX_REVISION_ES_1_2? L"ES1.2" :
        L"Unknown" );  
    /* Initialize Device Prefix */
    if(g_CPUFamily == CPU_FAMILY_DM37XX)
    {
        gDevice_prefix = BSP_DEVICE_37xx_PREFIX;
    }
    else if (g_CPUFamily == CPU_FAMILY_OMAP35XX)
    {
        gDevice_prefix = BSP_DEVICE_35xx_PREFIX;
    }
    else
    {
        OALLog(L"INFO: UnKnown CPU family:%d....\r\n", g_CPUFamily);
        gDevice_prefix = BSP_DEVICE_35xx_PREFIX;
    }

    version = TWLReadIDCode(hTwl);

    OALLog(L"TPS659XX Version 0x%02x (%s)\r\n", version,
        version == 0x00 ? L"ES1.0" : 
        version == 0x10 ? L"ES1.1" : 
        version == 0x20 ? L"ES1.2" : 
        version == 0x30 ? L"ES1.3" : L"Unknown" );
		
    g_ecctype = (UCHAR)dwEbootECCtype;

    // Done
    return TRUE;
}
Esempio n. 2
0
//------------------------------------------------------------------------------
//
//  Function:  OEMPlatformInit
//
//  This function provide platform initialization functions. It is called
//  from boot loader after OEMDebugInit is called.  Note that boot loader
//  BootloaderMain is called from  s/init.s code which is run after reset.
//
BOOL OEMPlatformInit()
{
    OMAP_GPTIMER_REGS *pTimerRegs;
    UINT32 CpuRevision, version;
    HANDLE hTwl,hGPIO;
    static UCHAR allocationPool[512];
    
    /*static const PAD_INFO ebootPinMux[] = {
            DSS_PADS
            GPIO_PADS
			USBOTG_PADS
            END_OF_PAD_ARRAY
    };*/
    static const PAD_INFO ebootPinMux_37XX[] = 
    {
            DSS_PADS_37XX
            GPIO_PADS_37XX
	     	USBOTG_PADS
	     	MCSPI1_PADS                     //Addition to MCSPI1 functional, Ray 13-09-24
            I2C3_PADS                       //Addition to MCSPI1 functional, Ray 13-10-21
            END_OF_PAD_ARRAY
    };
    
    OALLocalAllocInit(allocationPool, sizeof(allocationPool));

    // Get processor and companion chip versions
	g_CPUFamily = CPU_FAMILY_OMAP35XX;
    CpuRevision = Get_CPUVersion();
    version = CPU_REVISION(CpuRevision);
    g_CPUFamily = CPU_FAMILY(CpuRevision);

	// Set GPTIMER1 regs pointer
	pTimerRegs = OALPAtoUA(OMAP_GPTIMER1_REGS_PA);

    //if(g_CPUFamily == CPU_FAMILY_DM37XX)
    //{
	ConfigurePadArray(ebootPinMux_37XX);
    //}
    //else
    //{
    //    ConfigurePadArray(ebootPinMux);
    //}

    OALLog(L"ZEBEX Windows CE EBOOT for Z-2170 plus - Ray Testing"		//Ray 13-07-31 
	//OALLog(L"ZEBEX Windows CE EBOOT for Z-2170 plus - Brain"		
        L"\r\nBuilt %S at %S\r\n", __DATE__, __TIME__ );
    /*OALLog(
        L"EBOOT Version %d.%d, BSP " BSP_VERSION_STRING L"\r\n", 
        EBOOT_VERSION_MAJOR, EBOOT_VERSION_MINOR        
        );*/

    // Soft reset GPTIMER1
    OUTREG32(&pTimerRegs->TIOCP, SYSCONFIG_SOFTRESET);
    // While until done
    while ((INREG32(&pTimerRegs->TISTAT) & GPTIMER_TISTAT_RESETDONE) == 0)
    	;
 
    // Enable posted mode
    OUTREG32(&pTimerRegs->TSICR, GPTIMER_TSICR_POSTED);
    // Start timer
    OUTREG32(&pTimerRegs->TCLR, GPTIMER_TCLR_AR|GPTIMER_TCLR_ST);
    
	// Enable device clocks used by the bootloader
    EnableDeviceClocks(OMAP_DEVICE_GPIO1, TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO2, TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO3, TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO4, TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO5, TRUE);
    EnableDeviceClocks(OMAP_DEVICE_GPIO6, TRUE);

    // configure i2c devices
    OALI2CInit(OMAP_DEVICE_I2C1);
    OALI2CInit(OMAP_DEVICE_I2C2);
    OALI2CInit(OMAP_DEVICE_I2C3);

    GPIOInit();
    // Note that T2 accesses must occur after I2C initialization
    hTwl = TWLOpen();
    hGPIO = GPIOOpen(); 
    
    
    // Clear Reset on ethernet controller        
    //GPIOSetBit(hGPIO,LAN9115_RESET_GPIO);            
    //GPIOSetMode(hGPIO, LAN9115_RESET_GPIO,GPIO_DIR_OUTPUT);
	// test GPIO 
	GPIOClrBit(hGPIO, 136); 	// VIBRATOR
	GPIOSetMode(hGPIO, 136, GPIO_DIR_OUTPUT);
    GPIOClrBit(hGPIO, 16); 		// WLAN_EN
	GPIOSetMode(hGPIO, 16, GPIO_DIR_OUTPUT);
	GPIOClrBit(hGPIO, 15); 		// BT_EN
	GPIOSetMode(hGPIO, 15, GPIO_DIR_OUTPUT);
	GPIOSetBit(hGPIO, 61); 		// BACKLIGHT_EN, Ray
	GPIOSetMode(hGPIO, 61, GPIO_DIR_OUTPUT);

	//Initialization Side key GPIO, Ray 13-08-12
	GPIOSetMode(hGPIO, 114, GPIO_DIR_INPUT);     // SIDE_KEY1(KEY_2_4)
	GPIOSetMode(hGPIO, 115, GPIO_DIR_INPUT);     // SIDE_KEY3(KEY_1_4)

	//Initialization the "MC serial port interface (SPI1)" buses, Ray 13-09-24
    GPIOSetMode(hGPIO, SPI_CS0_PIN, GPIO_DIR_OUTPUT);
    GPIOSetMode(hGPIO, SPI_CLK_PIN, GPIO_DIR_OUTPUT);
    GPIOSetMode(hGPIO, SPI_DOUT_PIN, GPIO_DIR_OUTPUT);
    GPIOSetMode(hGPIO, SPI_DIN_PIN, GPIO_DIR_INPUT);

    //Initialization the "I-suqare-c (i2c3)" buses, Ray 13-10-07
    /*GPIOSetMode(hGPIO, I2C3_SCL_GPIO, INPUT_ENABLED);
    GPIOSetMode(hGPIO, I2C3_SDA_GPIO, INPUT_ENABLED);*/

    /*GPIOSetBit(hGPIO, I2C3_SCL_GPIO); 
    GPIOSetMode(hGPIO, I2C3_SCL_GPIO, GPIO_DIR_OUTPUT);
    GPIOSetBit(hGPIO, I2C3_SDA_GPIO); 
    GPIOSetMode(hGPIO, I2C3_SDA_GPIO, GPIO_DIR_OUTPUT);*/
    

   
	//SPI LCM setup
	/*XX
	GPIOSetBit(hGPIO,184); // PCM_EN serial clock 
	GPIOSetMode(hGPIO, 184, GPIO_PULLUP_ENABLE);
	//GPIOSetMode(hGPIO, 184, GPIO_DIR_OUTPUT);

	GPIOSetBit(hGPIO,185); // PCM_EN serial data
	GPIOSetMode(hGPIO, 185, GPIO_PULLUP_ENABLE);
	//GPIOSetMode(hGPIO, 185, GPIO_DIR_OUTPUT);*/


     OALLog(L"\r\nTI OMAP%x Version 0x%08x (%s)\r\n", CPU_ID(CpuRevision), CPU_REVISION(CpuRevision),        
        version == CPU_FAMILY_35XX_REVISION_ES_1_0 ? L"ES1.0" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_0 ? L"ES2.0" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_1 ? L"ES2.1" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_0_CRC ? L"ES2.0, ID determined using CRC" :
        version == CPU_FAMILY_35XX_REVISION_ES_2_1_CRC ? L"ES2.1, ID determined using CRC" :
        version == CPU_FAMILY_35XX_REVISION_ES_3_0 ? L"ES3.0" :
        version == CPU_FAMILY_35XX_REVISION_ES_3_1 ? L"ES3.1" : 
        version == CPU_FAMILY_37XX_REVISION_ES_1_0? L"ES1.0" :
        version == CPU_FAMILY_37XX_REVISION_ES_1_1? L"ES1.1" :
        version == CPU_FAMILY_37XX_REVISION_ES_1_2? L"ES1.2" :
        L"Unknown" );  

    /* Initialize Device Prefix */
    if(g_CPUFamily == CPU_FAMILY_DM37XX)
    {
        gDevice_prefix = BSP_DEVICE_37xx_PREFIX;
    }
    else if (g_CPUFamily == CPU_FAMILY_OMAP35XX)
    {
        gDevice_prefix = BSP_DEVICE_35xx_PREFIX;
    }
    else
    {
        OALLog(L"INFO: UnKnown CPU family:%d....\r\n", g_CPUFamily);
        gDevice_prefix = BSP_DEVICE_35xx_PREFIX;
    }

    version = TWLReadIDCode(hTwl);

    OALLog(L"TPS659XX Version 0x%02x (%s)\r\n", version,
        version == 0x00 ? L"ES1.0" : 
        version == 0x10 ? L"ES1.1" : 
        version == 0x20 ? L"ES1.2" : 
        version == 0x30 ? L"ES1.3" : L"Unknown" );
		
    g_ecctype = (UCHAR)dwEbootECCtype;

    // Done
    return TRUE;
}