summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahesh Radhakrishnan2019-06-28 15:56:39 -0500
committerMahesh Radhakrishnan2019-06-28 15:56:39 -0500
commit988576398ae1488c706eebdd71aeff5959604f77 (patch)
tree13adcb4605dd850c0a236ab212d58636cd6e7e10
parent667b0eb2334ce59492b5b39d1cf124f7871b5f9c (diff)
parent3e430031565b9d81ee6d77ac96014856604f6c6b (diff)
downloadpruss-lld-988576398ae1488c706eebdd71aeff5959604f77.tar.gz
pruss-lld-988576398ae1488c706eebdd71aeff5959604f77.tar.xz
pruss-lld-988576398ae1488c706eebdd71aeff5959604f77.zip
Merge pull request #63 in PROCESSOR-SDK/pruss-lld from PRSDK-4321 to masterDEV.PRUSS_LLD.01.00.00.14A
* commit '3e430031565b9d81ee6d77ac96014856604f6c6b': PRSDK-4321: Correction for J7 SoC object count PRSDK-4321: Updated AM335x object initialization to align with new PRU instance Max count PRSDK-4321: Updated PRU instance support for AM335x PRSDK-4321: Added PRUICSS instace 3 support for AM65xx
-rw-r--r--pruicss.h11
-rw-r--r--soc/am335x/pruicss_soc.c4
-rw-r--r--soc/am65xx/pruicss_soc.c4
-rw-r--r--soc/j721e/pruicss_soc.c8
-rw-r--r--soc/pruicss_soc.h87
-rw-r--r--src/pruicss_drv.c64
-rw-r--r--src/pruicss_intc.c10
7 files changed, 111 insertions, 77 deletions
diff --git a/pruicss.h b/pruicss.h
index 44fef2d..8c80500 100644
--- a/pruicss.h
+++ b/pruicss.h
@@ -82,6 +82,7 @@ extern "C" {
82 82
83#include <stdint.h> 83#include <stdint.h>
84#include <stddef.h> 84#include <stddef.h>
85#include <ti/drv/pruss/soc/pruicss_soc.h>
85 86
86#define PRUICSS_NUM_PRU_HOSTS (10U) 87#define PRUICSS_NUM_PRU_HOSTS (10U)
87#define PRUICSS_NUM_PRU_CHANNELS (10U) 88#define PRUICSS_NUM_PRU_CHANNELS (10U)
@@ -103,15 +104,7 @@ extern "C" {
103 104
104/**< Invalid Intc Mux number, intc Mux not used if assigned PRUSS_INVALID_INTC_MUX_NUM */ 105/**< Invalid Intc Mux number, intc Mux not used if assigned PRUSS_INVALID_INTC_MUX_NUM */
105#define PRUSS_INVALID_INTC_MUX_NUM ((uint32_t)0xffff) 106#define PRUSS_INVALID_INTC_MUX_NUM ((uint32_t)0xffff)
106/*! 107
107 * @brief PRUICSS Instance IDs
108 */
109typedef enum PRUICSS_MaxInstances_s
110{
111 PRUICCSS_INSTANCE_ONE=1,
112 PRUICCSS_INSTANCE_TWO=2,
113 PRUICCSS_INSTANCE_MAX=3
114}PRUICSS_MaxInstances;
115/** \brief Interrupt handler */ 108/** \brief Interrupt handler */
116typedef void (*PRUICSSDRV_IRQ_HANDLER)(void* buf); 109typedef void (*PRUICSSDRV_IRQ_HANDLER)(void* buf);
117typedef struct PRUICSS_Config_s *PRUICSS_Handle; 110typedef struct PRUICSS_Config_s *PRUICSS_Handle;
diff --git a/soc/am335x/pruicss_soc.c b/soc/am335x/pruicss_soc.c
index b7cb374..baee0fb 100644
--- a/soc/am335x/pruicss_soc.c
+++ b/soc/am335x/pruicss_soc.c
@@ -86,11 +86,7 @@ PRUICSS_Config pruss_config[PRUICCSS_INSTANCE_MAX] = {
86 &prussInitCfg 86 &prussInitCfg
87 }, 87 },
88 88
89 {NULL, NULL},
90
91 {NULL, NULL} 89 {NULL, NULL}
92
93
94}; 90};
95 91
96 92
diff --git a/soc/am65xx/pruicss_soc.c b/soc/am65xx/pruicss_soc.c
index 71f3997..6a3207d 100644
--- a/soc/am65xx/pruicss_soc.c
+++ b/soc/am65xx/pruicss_soc.c
@@ -138,10 +138,10 @@ PRUICSS_HwAttrs prussInitCfg[3] =
138}; 138};
139 139
140/* PRUICSS objects */ 140/* PRUICSS objects */
141PRUICSS_V1_Object prussObjects[PRUICCSS_INSTANCE_MAX]; 141PRUICSS_V1_Object prussObjects[PRUICCSS_INSTANCE_MAX-1];
142 142
143/* PRUICSS configuration structure */ 143/* PRUICSS configuration structure */
144PRUICSS_Config pruss_config[PRUICCSS_INSTANCE_MAX] = { 144PRUICSS_Config pruss_config[PRUICCSS_INSTANCE_MAX-1] = {
145 { 145 {
146 &prussObjects[0], 146 &prussObjects[0],
147 &prussInitCfg[0] 147 &prussInitCfg[0]
diff --git a/soc/j721e/pruicss_soc.c b/soc/j721e/pruicss_soc.c
index 5ab799e..fb357bd 100644
--- a/soc/j721e/pruicss_soc.c
+++ b/soc/j721e/pruicss_soc.c
@@ -111,10 +111,10 @@ PRUICSS_HwAttrs prussInitCfg[PRUICCSS_INSTANCE_TWO] =
111}; 111};
112 112
113/* PRUICSS objects */ 113/* PRUICSS objects */
114PRUICSS_V1_Object prussObjects[PRUICCSS_INSTANCE_MAX]; 114PRUICSS_V1_Object prussObjects[PRUICCSS_INSTANCE_MAX-1];
115 115
116/* PRUICSS configuration structure */ 116/* PRUICSS configuration structure */
117PRUICSS_Config pruss_config[PRUICCSS_INSTANCE_MAX] = { 117PRUICSS_Config pruss_config[PRUICCSS_INSTANCE_MAX-1] = {
118 { 118 {
119 &prussObjects[0], 119 &prussObjects[0],
120 &prussInitCfg[0] 120 &prussInitCfg[0]
@@ -122,10 +122,6 @@ PRUICSS_Config pruss_config[PRUICCSS_INSTANCE_MAX] = {
122 { 122 {
123 &prussObjects[1], 123 &prussObjects[1],
124 &prussInitCfg[1] 124 &prussInitCfg[1]
125 },
126 {
127 &prussObjects[2],
128 &prussInitCfg[2]
129 } 125 }
130}; 126};
131 127
diff --git a/soc/pruicss_soc.h b/soc/pruicss_soc.h
new file mode 100644
index 0000000..de4da8e
--- /dev/null
+++ b/soc/pruicss_soc.h
@@ -0,0 +1,87 @@
1/*
2 * Copyright (c) 2019, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33/** ============================================================================
34 * @file pruicss_soc.h
35 *
36 * @brief pruicss soc specific data structures
37 *
38 * ============================================================================
39 */
40
41#ifndef _PRUICSS_SOC_H_
42#define _PRUICSS_SOC_H_
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
48#include <stdint.h>
49#include <stddef.h>
50
51#if defined(SOC_AM335x)
52/*!
53 * @brief PRUICSS Instance IDs
54 */
55typedef enum PRUICSS_MaxInstances_s
56{
57 PRUICCSS_INSTANCE_ONE=1,
58 PRUICCSS_INSTANCE_MAX=2
59}PRUICSS_MaxInstances;
60#elif defined(SOC_AM65XX)
61/*!
62 * @brief PRUICSS Instance IDs
63 */
64typedef enum PRUICSS_MaxInstances_s
65{
66 PRUICCSS_INSTANCE_ONE=1,
67 PRUICCSS_INSTANCE_TWO=2,
68 PRUICCSS_INSTANCE_THREE=3,
69 PRUICCSS_INSTANCE_MAX=4
70}PRUICSS_MaxInstances;
71#else
72/*!
73 * @brief PRUICSS Instance IDs
74 */
75typedef enum PRUICSS_MaxInstances_s
76{
77 PRUICCSS_INSTANCE_ONE=1,
78 PRUICCSS_INSTANCE_TWO=2,
79 PRUICCSS_INSTANCE_MAX=3
80}PRUICSS_MaxInstances;
81#endif
82
83#ifdef __cplusplus
84}
85#endif
86
87#endif /* _PRUICSS_SOC_H_ */
diff --git a/src/pruicss_drv.c b/src/pruicss_drv.c
index ceeba87..7a079b9 100644
--- a/src/pruicss_drv.c
+++ b/src/pruicss_drv.c
@@ -70,7 +70,7 @@ static uintptr_t pruicss_get_ctrl_addr (PRUICSS_HwAttrs const *hwAttrs,
70{ 70{
71 uintptr_t baseaddr = 0; 71 uintptr_t baseaddr = 0;
72 72
73 if ((instance >= PRUICCSS_INSTANCE_ONE) && (instance <= PRUICCSS_INSTANCE_MAX)) 73 if ((instance >= PRUICCSS_INSTANCE_ONE) && (instance < PRUICCSS_INSTANCE_MAX))
74 { 74 {
75 switch (pruNum) { 75 switch (pruNum) {
76 case PRUICCSS_PRU0: baseaddr = hwAttrs->prussPru0CtrlRegBase; 76 case PRUICCSS_PRU0: baseaddr = hwAttrs->prussPru0CtrlRegBase;
@@ -476,11 +476,8 @@ int32_t PRUICSS_pruSendEvent(PRUICSS_Handle handle,uint32_t eventnum)
476 object = (PRUICSS_V1_Object *)handle->object; 476 object = (PRUICSS_V1_Object *)handle->object;
477 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 477 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
478 478
479 if(object->instance == PRUICCSS_INSTANCE_ONE) 479 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
480 { 480 (object->instance < PRUICCSS_INSTANCE_MAX))
481 baseaddr = hwAttrs->prussIntcRegBase;
482 }
483 else if(object->instance == PRUICCSS_INSTANCE_TWO)
484 { 481 {
485 baseaddr = hwAttrs->prussIntcRegBase; 482 baseaddr = hwAttrs->prussIntcRegBase;
486 } 483 }
@@ -526,11 +523,8 @@ int32_t PRUICSS_pruClearEvent(PRUICSS_Handle handle,uint32_t eventnum)
526 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 523 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
527 524
528 baseaddr = hwAttrs->baseAddr; 525 baseaddr = hwAttrs->baseAddr;
529 if(object->instance == PRUICCSS_INSTANCE_ONE) 526 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
530 { 527 (object->instance < PRUICCSS_INSTANCE_MAX))
531 baseaddr = hwAttrs->prussIntcRegBase;
532 }
533 else if(object->instance == PRUICCSS_INSTANCE_TWO)
534 { 528 {
535 baseaddr = hwAttrs->prussIntcRegBase; 529 baseaddr = hwAttrs->prussIntcRegBase;
536 } 530 }
@@ -639,7 +633,9 @@ int32_t PRUICSS_mapPruMem(PRUICSS_Handle handle,uint32_t pru_ram_id, void **addr
639 object = (PRUICSS_V1_Object *)handle->object; 633 object = (PRUICSS_V1_Object *)handle->object;
640 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 634 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
641 635
642 if(object->instance == PRUICCSS_INSTANCE_ONE) { 636 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
637 (object->instance < PRUICCSS_INSTANCE_MAX))
638 {
643 switch (per_id) 639 switch (per_id)
644 { 640 {
645 case PRUICSS_CFG: 641 case PRUICSS_CFG:
@@ -666,34 +662,6 @@ int32_t PRUICSS_mapPruMem(PRUICSS_Handle handle,uint32_t pru_ram_id, void **addr
666 break; 662 break;
667 } 663 }
668 } 664 }
669 else if(object->instance == PRUICCSS_INSTANCE_TWO)
670 {
671 switch (per_id)
672 {
673 case PRUICSS_CFG:
674 *address = (void*)(hwAttrs->prussCfgRegBase);
675 break;
676 case PRUICSS_UART:
677 *address = (void*)(hwAttrs->prussUartRegBase);
678 break;
679 case PRUICSS_IEP:
680 *address = (void*)(hwAttrs->prussIepRegBase);
681 break;
682 case PRUICSS_ECAP:
683 *address = (void*)(hwAttrs->prussEcapRegBase);
684 break;
685 case PRUICSS_MII_RT:
686 *address = (void*)( hwAttrs->prussMiiRtCfgRegBase);
687 break;
688 case PRUICSS_MDIO:
689 *address = (void*)(hwAttrs->prussMiiMdioRegBase);
690 break;
691 default:
692 *address = 0;
693 ret_val = PRUICSS_RETURN_FAILURE;
694 break;
695 }
696 }
697 else 665 else
698 { 666 {
699 ret_val = PRUICSS_RETURN_FAILURE; 667 ret_val = PRUICSS_RETURN_FAILURE;
@@ -710,14 +678,12 @@ void PRUICSS_enableOCPMasterAccess(PRUICSS_Handle handle )
710 object = (PRUICSS_V1_Object *)handle->object; 678 object = (PRUICSS_V1_Object *)handle->object;
711 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 679 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
712 680
713 if(object->instance == PRUICCSS_INSTANCE_ONE) 681 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
714 { 682 (object->instance < PRUICCSS_INSTANCE_MAX))
715 baseaddr = hwAttrs->prussCfgRegBase;
716 }
717 if(object->instance == PRUICCSS_INSTANCE_TWO)
718 { 683 {
719 baseaddr = hwAttrs->prussCfgRegBase; 684 baseaddr = hwAttrs->prussCfgRegBase;
720 } 685 }
686
721 HW_WR_FIELD32((baseaddr + CSL_ICSSCFG_SYSCFG),CSL_ICSSCFG_SYSCFG_STANDBY_INIT, 0); 687 HW_WR_FIELD32((baseaddr + CSL_ICSSCFG_SYSCFG),CSL_ICSSCFG_SYSCFG_STANDBY_INIT, 0);
722} 688}
723 689
@@ -823,14 +789,12 @@ void PRUICSS_pinMuxConfig(PRUICSS_Handle handle, uint64_t regVal)
823 object = (PRUICSS_V1_Object *)handle->object; 789 object = (PRUICSS_V1_Object *)handle->object;
824 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 790 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
825 791
826 if(object->instance == PRUICCSS_INSTANCE_ONE) 792 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
827 { 793 (object->instance < PRUICCSS_INSTANCE_MAX))
828 baseaddr = hwAttrs->prussCfgRegBase;
829 }
830 if(object->instance == PRUICCSS_INSTANCE_TWO)
831 { 794 {
832 baseaddr = hwAttrs->prussCfgRegBase; 795 baseaddr = hwAttrs->prussCfgRegBase;
833 } 796 }
797
834 HW_WR_FIELD32((baseaddr + CSL_ICSSCFG_PIN_MX),CSL_ICSSCFG_PIN_MX_PIN_MUX_SEL, regVal); 798 HW_WR_FIELD32((baseaddr + CSL_ICSSCFG_PIN_MX),CSL_ICSSCFG_PIN_MX_PIN_MUX_SEL, regVal);
835} 799}
836 800
diff --git a/src/pruicss_intc.c b/src/pruicss_intc.c
index d681dd4..cc43410 100644
--- a/src/pruicss_intc.c
+++ b/src/pruicss_intc.c
@@ -137,11 +137,8 @@ int32_t PRUICSS_pruIntcInit(PRUICSS_Handle handle, const PRUICSS_IntcInitData *
137 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 137 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
138 baseaddr = hwAttrs->baseAddr; 138 baseaddr = hwAttrs->baseAddr;
139 139
140 if(object->instance == PRUICCSS_INSTANCE_ONE) 140 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
141 { 141 (object->instance < PRUICCSS_INSTANCE_MAX))
142 baseaddr = hwAttrs->prussIntcRegBase;
143 }
144 else if(object->instance == PRUICCSS_INSTANCE_TWO )
145 { 142 {
146 baseaddr = hwAttrs->prussIntcRegBase; 143 baseaddr = hwAttrs->prussIntcRegBase;
147 } 144 }
@@ -508,7 +505,8 @@ int32_t PRUICSS_pruIntcClear(PRUICSS_Handle handle)
508 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs; 505 hwAttrs = (PRUICSS_HwAttrs const *)handle->hwAttrs;
509 506
510 /* verify the instance */ 507 /* verify the instance */
511 if ((object->instance == PRUICCSS_INSTANCE_ONE) || (object->instance == PRUICCSS_INSTANCE_TWO)) 508 if ((object->instance >= PRUICCSS_INSTANCE_ONE) &&
509 (object->instance < PRUICCSS_INSTANCE_MAX))
512 { 510 {
513 baseaddr = hwAttrs->prussIntcRegBase; 511 baseaddr = hwAttrs->prussIntcRegBase;
514 } 512 }