aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubash Lakkimsetti2017-02-05 10:50:43 -0600
committerBuddy Liong2017-02-08 15:35:25 -0600
commit62ffd7da6834e9e16a077cee130d66ad8aac152b (patch)
tree4d7cc37991eb191ea60e101598078fe0084759f3
parent57de340118be0556e186bed07a552f9ac54b5bfd (diff)
downloadu-boot-62ffd7da6834e9e16a077cee130d66ad8aac152b.tar.gz
u-boot-62ffd7da6834e9e16a077cee130d66ad8aac152b.tar.xz
u-boot-62ffd7da6834e9e16a077cee130d66ad8aac152b.zip
EMIF FW: Configuring the EMIF firewall regions
EMIF FW configured for protecting these regions from L3 access from initiators which are not defined Change-Id: Ia2e92d21abdb2d824637480c0fac66fd39eeec61 Signed-off-by: Subash Lakkimsetti <x0091084@ti.com>
-rwxr-xr-x[-rw-r--r--]arch/arm/cpu/armv7/omap-common/emif-common.c120
1 files changed, 120 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/emif-common.c b/arch/arm/cpu/armv7/omap-common/emif-common.c
index b26984e26c..fd946b38c1 100644..100755
--- a/arch/arm/cpu/armv7/omap-common/emif-common.c
+++ b/arch/arm/cpu/armv7/omap-common/emif-common.c
@@ -18,6 +18,8 @@
18#include <asm/utils.h> 18#include <asm/utils.h>
19#include <linux/compiler.h> 19#include <linux/compiler.h>
20 20
21int emif_fw_config(void);
22
21static int emif1_enabled = -1, emif2_enabled = -1; 23static int emif1_enabled = -1, emif2_enabled = -1;
22 24
23void set_lpmode_selfrefresh(u32 base) 25void set_lpmode_selfrefresh(u32 base)
@@ -1486,6 +1488,8 @@ void sdram_init(void)
1486 if (!in_sdram) 1488 if (!in_sdram)
1487 if (0 != secure_emif_reserve()) 1489 if (0 != secure_emif_reserve())
1488 hang(); 1490 hang();
1491 /*EMIF FW configuration for Robust RVC */
1492 emif_fw_config();
1489 1493
1490 /* On HS devices, ensure static EMIF firewall APIs are locked */ 1494 /* On HS devices, ensure static EMIF firewall APIs are locked */
1491 if (0 != secure_emif_firewall_lock()) 1495 if (0 != secure_emif_firewall_lock())
@@ -1502,3 +1506,119 @@ void sdram_init(void)
1502 1506
1503 debug("<<sdram_init()\n"); 1507 debug("<<sdram_init()\n");
1504} 1508}
1509
1510
1511/* EMIF Firewall setup for Robust RVC
1512 *
1513 * IPU2/IVA ==> DOMAIN 1
1514 * DSP2_CFG/DSP2 MDMA ==> DOMAIN 2
1515 * VIP/VPE: DOMAIN 3
1516 * DSS ==> DOMAIN 4
1517 * Rest of the initiators ==> DOMAIN 0
1518 *
1519 *ConnID 4 bit Initiator
1520 *
1521 *0x0 Cortex-A15 MPU subsystem
1522 *0x1 DAP (P1500) module
1523 *0x2 DSP1 (CFG, EDMA, MDMA), DSP2 (EDMA) subsystems
1524 *0x3 IVAHD, DSP2 (CFG, MDMA)
1525 *0x4 EVE 1/2
1526 *0x6 IPU (IPU1 and IPU2); SDMA (System and Crypto)
1527 *0x7 EDMA
1528 *0x8 DSS (DSS1 and DSS2); MLB, MMU (MMU1 and MMU2), PCIE (PCIE1 and PCIE2)
1529 *0x9 VIP 1/2/3, VPE
1530 *0xA MMC (MMC1 and MMC2), GPU, SATA2, BB2D, GMAC
1531 *0xB USB 1/2/3/4, HW INSTR
1532 *0xC SATA
1533 *0xD EVE 1/2 HW INSTR
1534 *0xE to 0xF Reserved
1535 */
1536
1537int emif_fw_config(void)
1538{
1539#if defined(CONFIG_TI_SECURE_DEVICE)
1540
1541 uint32_t accessPerm, initiatorPerm;
1542
1543 // Region 0: (Entire DDR) Provide write access to entire DDR 1.5G region
1544 /*if (0 != secure_emif_firewall_setup(0, 0x3, 0x80000000, 0x60000000, 0xffffffff, 0xffffffff))
1545 printf("SDRAM Firewall: MPU_EMIF_FW Region 0 setting failed!\n");*/
1546
1547 /* Region 1: (IPU2 Code/Data reserved memory) Allow access to IPU2/IVA only
1548 * Address range for IPU2 CMA Pool 0x94000000 for size 0x05000000
1549 */
1550 accessPerm = L3_ALL_PERMISSIONS
1551 | L3_DOMAIN1_FUNCTIONAL
1552 | L3_DOMAIN1_DEBUG;
1553 initiatorPerm = FW_INITIATOR_IVA1
1554 |FW_INITIATOR_DMA_IPU;
1555
1556 if (0 != secure_emif_firewall_setup(1, 0x1, 0x94000000, 0x05000000,
1557 accessPerm, initiatorPerm))
1558 printf("SDRAM Firewall: EMIF_FW Region 1 setting failed!\n");
1559
1560 /* Region 2: (DSP2 Code/Data reserved memory) Allow access to DSP2 only
1561 * Address range for DSP2 CMA Pool 0x9f000000 for size 0x01000000
1562 */
1563
1564 accessPerm = L3_ALL_PERMISSIONS
1565 | L3_DOMAIN2_FUNCTIONAL
1566 | L3_DOMAIN2_DEBUG;
1567 initiatorPerm = FW_INITIATOR_IVA1
1568 | FW_INITIATOR_DSP
1569 | FW_INITIATOR_IVA1;
1570
1571 if (0 != secure_emif_firewall_setup(2, 0x1, 0x9f000000, 0x01000000,
1572 accessPerm, initiatorPerm))
1573 printf("SDRAM Firewall: EMIF_FW Region 2 setting failed!\n");
1574
1575 /* Region 3: (SR1 FRAME BUFFER MEM RVC pool1) Allow access to IPU2/DSP2, VIP/VPE & DSS Read only for EMIF FW
1576 * Address for RVC Pool1 0x84000000 for size 0x10000000
1577 */
1578
1579 accessPerm = L3_ALL_PERMISSIONS
1580 | L3_DOMAIN1_FUNCTIONAL
1581 | L3_DOMAIN1_DEBUG
1582 | L3_DOMAIN2_FUNCTIONAL
1583 | L3_DOMAIN2_DEBUG
1584 | L3_DOMAIN3_FUNCTIONAL
1585 | L3_DOMAIN3_DEBUG
1586 | L3_DOMAIN4_FUNCTIONAL
1587 | L3_DOMAIN4_DEBUG;
1588 initiatorPerm = FW_INITIATOR_IVA1
1589 | FW_INITIATOR_IVA1
1590 | FW_INITIATOR_DMA_IPU
1591 | FW_INITIATOR_DSS
1592 | FW_INITIATOR_VIP;
1593
1594 if (0 != secure_emif_firewall_setup(3, 0x1, 0x84000000, 0x10000000,
1595 accessPerm, initiatorPerm))
1596 printf("SDRAM Firewall: EMIF_FW Region 3 setting failed!\n");
1597
1598 /* Region 4: (MEM RVC pool2) Allow access to IPU2/DSP2, VIP/VPE & DSS Read only for EMIF FW
1599 * Address for RVC Pool2 0xA0000000 for size 0x02000000
1600 */
1601 accessPerm = L3_ALL_PERMISSIONS
1602 | L3_DOMAIN1_FUNCTIONAL
1603 | L3_DOMAIN1_DEBUG
1604 | L3_DOMAIN2_FUNCTIONAL
1605 | L3_DOMAIN2_DEBUG
1606 | L3_DOMAIN3_FUNCTIONAL
1607 | L3_DOMAIN3_DEBUG
1608 | L3_DOMAIN4_FUNCTIONAL
1609 | L3_DOMAIN4_DEBUG;
1610 initiatorPerm = FW_INITIATOR_IVA1
1611 | FW_INITIATOR_IVA1
1612 | FW_INITIATOR_DMA_IPU
1613 | FW_INITIATOR_DSS
1614 | FW_INITIATOR_VIP;
1615
1616 if (0 != secure_emif_firewall_setup(4, 0x1, 0xA0000000, 0x02000000,
1617 accessPerm, initiatorPerm))
1618 printf("SDRAM Firewall: EMIF_FW Region 4 setting failed!\n");
1619
1620#endif
1621
1622 return 0;
1623
1624}