PDK-6955:Board: Updated ospi flash programmer for am64x evm
authorM V Pratap Reddy <x0257344@ti.com>
Fri, 27 Nov 2020 04:07:44 +0000 (09:37 +0530)
committerSivaraj R <sivaraj@ti.com>
Fri, 27 Nov 2020 06:28:10 +0000 (00:28 -0600)
 - OSPI flash programmer validated with CCS/JTAG.
 - Currently set to JTAG support by default. Need to enable dynamic
   switching between UART and JTAG based on boot settings
 - UART Baudrate is reduced to 115200 due to issues at higher baud rate.

packages/ti/board/utils/uniflash/target/build/uart_make.mk
packages/ti/board/utils/uniflash/target/include/flash_programmer.h
packages/ti/board/utils/uniflash/target/soc/k3/linker_am64x.cmd [new file with mode: 0644]
packages/ti/board/utils/uniflash/target/soc/k3/soc.c
packages/ti/board/utils/uniflash/target/soc/k3/soc_k3.h
packages/ti/board/utils/uniflash/target/src/ospi/ospi.c

index aa217466883b0043db964613f48684dda0046046..32dcf814d508cdfb678d01e21cb25ddc39d50a56 100755 (executable)
@@ -124,12 +124,13 @@ ifeq ($(BOARD), $(filter $(BOARD), j721e_evm j7200_evm))
 SRCS_COMMON += ospi.c emmc.c hyperflash.c
 EXTERNAL_LNKCMD_FILE_LOCAL = $(UNIFLASH_BASE_DIR)/soc/k3/linker_j7.cmd
 endif
+
 ifeq ($(BOARD), $(filter $(BOARD), j721e_evm))
 SRCS_COMMON += qspi.c
 endif
 ifeq ($(BOARD), $(filter $(BOARD), am65xx_evm am65xx_idk am64x_evm))
 SRCS_COMMON += ospi.c emmc.c
-EXTERNAL_LNKCMD_FILE_LOCAL = $(UNIFLASH_BASE_DIR)/soc/k3/linker.cmd
+EXTERNAL_LNKCMD_FILE_LOCAL = $(UNIFLASH_BASE_DIR)/soc/k3/linker_am64x.cmd
 endif
 
 ifeq ($(BOARD), $(filter $(BOARD), tpr12_evm))
index e847a372699b0d04f5d5168813a5b3f1011ce2c6..0ee8e681b8dc1cde7be212ddbac5395e31f84941 100755 (executable)
@@ -85,7 +85,7 @@ extern "C" {
 #define EMMC_FLASH
 #endif
 
-#if defined(am65xx_evm) || defined(am65xx_idk) || defined(am64x_evm)
+#if defined(am65xx_evm) || defined(am65xx_idk)
 #define MAX_BAUDRATE_SUPPORTED                 (0xEU)
 #define MAX_BAUDRATE_SUPPORTED_LINUX   (0xBU)
 
@@ -93,6 +93,14 @@ extern "C" {
 #define EMMC_FLASH
 #endif
 
+#if defined(am64x_evm)
+#define MAX_BAUDRATE_SUPPORTED          (0x0U)
+#define MAX_BAUDRATE_SUPPORTED_LINUX    (0x0U)
+
+#define OSPI_FLASH
+#define EMMC_FLASH
+#endif
+
 #if defined(tpr12_evm)
 #define QSPI_FLASH
 #define MAX_BAUDRATE_SUPPORTED                 (0x0U)
diff --git a/packages/ti/board/utils/uniflash/target/soc/k3/linker_am64x.cmd b/packages/ti/board/utils/uniflash/target/soc/k3/linker_am64x.cmd
new file mode 100644 (file)
index 0000000..5d41e5c
--- /dev/null
@@ -0,0 +1,96 @@
+/*----------------------------------------------------------------------------*/
+/* File: linker.cmd                                                           */
+/* Description:                                                                      */
+/*    Link command file for Maxwell SBL                                       */
+/*                                                                            */
+/*    Platform: R5 Cores on AM65xx                                            */
+/* (c) Texas Instruments 2018, All rights reserved.                           */
+/*----------------------------------------------------------------------------*/
+--retain="*(.bootCode)"
+--retain="*(.startupCode)"
+--retain="*(.startupData)"
+--retain="*(.intvecs)"
+--retain="*(.intc_text)"
+--retain="*(.rstvectors)"
+--retain="*(.irqStack)"
+--retain="*(.fiqStack)"
+--retain="*(.abortStack)"
+--retain="*(.undStack)"
+--retain="*(.svcStack)"
+--fill_value=0
+--stack_size=0x2000
+--heap_size=0x2000
+--entry_point=_resetvectors            /* SBL entry in SBL_init.asm    */
+
+-stack  0x2000                              /* SOFTWARE STACK SIZE           */
+-heap   0x2000                              /* HEAP AREA SIZE                */
+
+/* Stack Sizes for various modes */
+__IRQ_STACK_SIZE = 0x1000;
+__FIQ_STACK_SIZE = 0x1000;
+__ABORT_STACK_SIZE = 0x800;
+__UND_STACK_SIZE = 0x800;
+__SVC_STACK_SIZE = 0x2000;
+
+/*----------------------------------------------------------------------------*/
+/* Memory Map                                                                 */
+MEMORY
+{
+    /*  Reset Vectors base address(RESET_VECTORS) should be 64 bytes aligned  */
+    RESET_VECTORS (X)                          : origin=0x70000000 length=0x100
+    /* MCU0 memory used for SBL. Available to app for dynamic use ~160KB */
+    /* RBL uses 0x41C58000 and beyond. SBL, at load cannot cross this */
+    OCMRAM_SBL    (RWIX)   : origin=0x70000100 length=0x3E000-0x100
+
+    /* Used by SBL at runtime to load SYSFW. Available to app for dynamic use */
+    OCMRAM_SBL_SYSFW (RWIX)   : origin=0x7003E000 length=0x40000
+
+}  /* end of MEMORY */
+
+/*----------------------------------------------------------------------------*/
+/* Section Configuration                                                      */
+
+SECTIONS
+{
+/* 'intvecs' and 'intc_text' sections shall be placed within                  */
+/* a range of +\- 16 MB                                                       */
+    .rstvectors           : {} palign(8)                            > RESET_VECTORS
+    .bootCode                : {} palign(8)                                    > OCMRAM_SBL
+    .startupCode             : {} palign(8)                                    > OCMRAM_SBL
+    .startupData             : {} palign(8)                                    > OCMRAM_SBL, type = NOINIT
+    .sbl_profile_info     : {} palign(8)                            > RESET_VECTORS  (HIGH)
+    .text                : {} palign(8)                            > OCMRAM_SBL
+    .const               : {} palign(8)                            > OCMRAM_SBL
+    .cinit                : {} palign(8)                            > OCMRAM_SBL
+    .pinit                : {} palign(8)                            > OCMRAM_SBL
+    .boardcfg_data       : {} palign(128)                          > OCMRAM_SBL
+
+    .data                 : {} palign(128)                          > OCMRAM_SBL
+    .bss                 : {} align(4)                             > OCMRAM_SBL
+    .sysmem              : {}                                      > OCMRAM_SBL
+
+       .stack                    : {} align(4)                             > OCMRAM_SBL  (HIGH)
+       .irqStack                 : {. = . + __IRQ_STACK_SIZE;} align(4)    > OCMRAM_SBL  (HIGH)
+                            RUN_START(__IRQ_STACK_START)
+                            RUN_END(__IRQ_STACK_END)
+    .fiqStack                    : {. = . + __FIQ_STACK_SIZE;} align(4)    > OCMRAM_SBL  (HIGH)
+                            RUN_START(__FIQ_STACK_START)
+                            RUN_END(__FIQ_STACK_END)
+    .abortStack              : {. = . + __ABORT_STACK_SIZE;} align(4)  > OCMRAM_SBL  (HIGH)
+                            RUN_START(__ABORT_STACK_START)
+                            RUN_END(__ABORT_STACK_END)
+    .undStack                    : {. = . + __UND_STACK_SIZE;} align(4)    > OCMRAM_SBL  (HIGH)
+                            RUN_START(__UND_STACK_START)
+                            RUN_END(__UND_STACK_END)
+    .svcStac              : {. = . + __SVC_STACK_SIZE;} align(4)    > OCMRAM_SBL  (HIGH)
+                            RUN_START(__SVC_STACK_START)
+                            RUN_END(__SVC_STACK_END)
+    .firmware             : {} palign(8)                            > OCMRAM_SBL_SYSFW
+
+}  /* end of SECTIONS */
+
+/*----------------------------------------------------------------------------*/
+/* Misc linker settings                                                       */
+
+
+/*-------------------------------- END ---------------------------------------*/
index 176ab9cf32e1ab71fda23776434b2e617801a27f..ce9f2eab6c68da52c3cba8a013fbec049b7cbf8d 100755 (executable)
 /*                            Global Variables                                */
 /* ========================================================================== */
 
+#if defined(am64x_evm)
+uint32_t uart_baseAddr = CSL_UART0_BASE;
+#else
 uint32_t uart_baseAddr = CSL_MCU_UART0_BASE;
+#endif
 uint8_t uart_inst = BOARD_UART_INSTANCE;
 
 /* ========================================================================== */
@@ -52,9 +56,14 @@ uint8_t uart_inst = BOARD_UART_INSTANCE;
 void _resetvectors (void);
 int8_t UFP_openUartHandle(void);
 
+#if defined(am64x_evm)
+static int32_t UFP_isNoBootEnabled(void)
+{
+    return (TRUE);
+}
+#else
 static int32_t UFP_isNoBootEnabled(void)
 {
-#if !defined(am64x_evm) // AM64x_TODO: Need update this for am64x evm
     uint32_t mainDevStat;
     uint32_t wkupDevStat;
 
@@ -66,10 +75,10 @@ static int32_t UFP_isNoBootEnabled(void)
     {
         return (TRUE);
     }
-#endif
 
     return (FALSE);
 }
+#endif
 
 static void UFP_asmAtcmEn(void)
 {
index 1d550f8b4fefbab6fe20afb46ace4141b79d9b94..2ed3bf9b352c7d8059ae12528f7c228035f79f48 100755 (executable)
@@ -99,6 +99,8 @@ extern "C" {
 #define UFP_WKUP_DEVSTAT_NOBOOT_CFG     (0x38U)
 #define UFP_MAIN_DEVSTAT_NOBOOT_MASK    (0xEFU)
 #define UFP_WKUP_DEVSTAT_NOBOOT_MASK    (0xF8U)
+#elif defined(SOC_AM64X)
+#define UFP_MAIN_DEVSTAT_NOBOOT_MASK    (0xEFU)
 #else
 #define UFP_MAIN_DEVSTAT_NOBOOT_CFG    (0)
 #define UFP_WKUP_DEVSTAT_NOBOOT_CFG    (0)
index e93b3dfff913a34a77309c14b4bdf91da3e6e6d9..58dc19a23b88a9328e1ac1d3a95ddadeedf3eb88 100755 (executable)
@@ -382,7 +382,7 @@ static int8_t UFP_ospiInit(void)
     ospiUdmaInit(&ospi_cfg);
 #endif
 
-#if defined(SOC_J7200)
+#if defined(SOC_J7200) || defined(SOC_AM64X)
     ospi_cfg.dacEnable  = false;
 #endif
     ospi_cfg.phyEnable  = false;