]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/ibl.git/blobdiff - src/device/c6457/c6457.c
Build: update setupenvLnx.sh to do error checking
[keystone-rtos/ibl.git] / src / device / c6457 / c6457.c
index 225ab7c0494848a683cc6b2c1a726bd4d3bce71f..df69c3d20f1072994bc9c94491792267d9cabf3f 100644 (file)
@@ -1,3 +1,40 @@
+/*
+ *
+ * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 
+ * 
+ * 
+ *  Redistribution and use in source and binary forms, with or without 
+ *  modification, are permitted provided that the following conditions 
+ *  are met:
+ *
+ *    Redistributions of source code must retain the above copyright 
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ *    Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the 
+ *    documentation and/or other materials provided with the   
+ *    distribution.
+ *
+ *    Neither the name of Texas Instruments Incorporated nor the names of
+ *    its contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+*/
+
+
+
 /************************************************************************************
  * FILE PURPOSE: C6457 Device Specific functions
  ************************************************************************************
@@ -17,6 +54,7 @@
 #include "emif31api.h"
 #include "pscapi.h"
 #include "gpio.h"
+#include "nandhwapi.h"
 #include <string.h>
 
 extern cregister unsigned int DNUM;
@@ -31,7 +69,7 @@ extern cregister unsigned int DNUM;
 bool address_is_local (Uint32 addr)
 {
     /* L2 */
-    if ((addr >= 0x00800000) && (addr < 0x00898000))
+    if ((addr >= 0x00800000) && (addr < 0x00a00000))
         return (TRUE);
 
     /* L1P */
@@ -57,32 +95,11 @@ bool address_is_local (Uint32 addr)
 Uint32 deviceLocalAddrToGlobal (Uint32 addr)
 {
 
-    if (address_is_local (addr))
-        addr = (1 << 28) | (DNUM << 24) | addr;
-
     return (addr);
 
 }
         
         
-/**
- * @brief Configure the PLLs
- *
- * @details
- *   Only the main PLL can be configured here. The DDR pll is enabled by default,
- *   and the network PLL is enabled through serdes configuration.
- *   the multiplier and dividers.
- */
-void devicePllConfig (void)
-{
-    if (ibl.pllConfig[ibl_MAIN_PLL].doEnable == TRUE)
-        hwPllSetPll (MAIN_PLL, 
-                     ibl.pllConfig[ibl_MAIN_PLL].prediv,
-                     ibl.pllConfig[ibl_MAIN_PLL].mult,
-                     ibl.pllConfig[ibl_MAIN_PLL].postdiv);
-
-}
-
 /**
  * @brief
  *   Enable the DDR
@@ -119,6 +136,17 @@ int32 devicePowerPeriph (int32 modNum)
         
 }
 
+unsigned int get_device_switch_setting()
+{
+       volatile unsigned int w;
+       unsigned int v;
+
+       w = *((uint32 *)0x02880820);
+       v = w & 0x200;
+       v = v >> 9;
+
+       return(v);
+}
 
 /**
  *  @brief  Enable the pass through version of the nand controller
@@ -126,7 +154,7 @@ int32 devicePowerPeriph (int32 modNum)
  *  @details  On the evm the nand controller is enabled by setting 
  *            gpio 14 high
  */
-#if 0
+#ifndef EXCLUDE_NAND_GPIO
 int32 deviceConfigureForNand(void)
 {
        hwGpioSetDirection(NAND_MODE_GPIO, GPIO_OUT);
@@ -158,6 +186,26 @@ void deviceLoadDefaultEthAddress (uint8 *maddr)
 }
 
 
+/**
+ *  @brief  Return the NAND interface call table. Only GPIO is supported on c6457
+ */
+
+#ifndef EXCLUDE_NAND_GPIO
+nandCtbl_t nandCtbl =  {
+
+    nandHwGpioDriverInit,
+    nandHwGpioDriverReadBytes,
+    nandHwGpioDriverReadPage,
+    nandHwGpioDriverClose
+
+};
+
+nandCtbl_t *deviceGetNandCtbl (int32 interface)
+{
+    return (&nandCtbl);
+}
+#endif
+