public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH edk2-platforms 0/2] Silicon/SynQuacer: update Device Tree
@ 2018-08-03  6:41 Sumit Garg
  2018-08-03  6:41 ` [PATCH edk2-platforms 1/2] Silicon/SynQuacer: add optional OP-TEE DT node Sumit Garg
  2018-08-03  6:41 ` [PATCH edk2-platforms 2/2] Silicon/SynQuacer: Add status property in PCIe & SDHC DT nodes Sumit Garg
  0 siblings, 2 replies; 3+ messages in thread
From: Sumit Garg @ 2018-08-03  6:41 UTC (permalink / raw)
  To: edk2-devel

Following are DT updates:
- Add optional OP-TEE DT node
- Add status property in PCIe & SDHC DT nodes

Sumit Garg (2):
  Silicon/SynQuacer: add optional OP-TEE DT node
  Silicon/SynQuacer: Add status property in PCIe & SDHC DT nodes

 Platform/Socionext/DeveloperBox/DeveloperBox.dsc   |  1 +
 .../Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi  | 11 +++++++++
 .../SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c  | 26 ++++++++++++----------
 .../SynQuacerDtbLoaderLib.inf                      |  2 ++
 4 files changed, 28 insertions(+), 12 deletions(-)

-- 
2.7.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH edk2-platforms 1/2] Silicon/SynQuacer: add optional OP-TEE DT node
  2018-08-03  6:41 [PATCH edk2-platforms 0/2] Silicon/SynQuacer: update Device Tree Sumit Garg
@ 2018-08-03  6:41 ` Sumit Garg
  2018-08-03  6:41 ` [PATCH edk2-platforms 2/2] Silicon/SynQuacer: Add status property in PCIe & SDHC DT nodes Sumit Garg
  1 sibling, 0 replies; 3+ messages in thread
From: Sumit Garg @ 2018-08-03  6:41 UTC (permalink / raw)
  To: edk2-devel

OP-TEE is optional on Developerbox controlled via SCP firmware. To check
if we need to enable OP-TEE DT node, we use "IsOpteePresent" OpteeLib api.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 Platform/Socionext/DeveloperBox/DeveloperBox.dsc   |  1 +
 .../Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi  |  8 +++++++
 .../SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c  | 28 ++++++++++++++++++++++
 .../SynQuacerDtbLoaderLib.inf                      |  2 ++
 4 files changed, 39 insertions(+)

diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
index fc498eb65217..4ff5df978e8e 100644
--- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
+++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
@@ -76,6 +76,7 @@ [LibraryClasses.common]
   ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatformStackLib.inf
   ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf
   ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/ArmGenericTimerPhyCounterLib.inf
+  OpteeLib|ArmPkg/Library/OpteeLib/OpteeLib.inf
 
   BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
   BmpSupportLib|MdeModulePkg/Library/BaseBmpSupportLib/BaseBmpSupportLib.inf
diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
index 37d642e4b237..d6a5f013e58c 100644
--- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
+++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
@@ -574,6 +574,14 @@
         #address-cells = <1>;
         #size-cells = <0>;
     };
+
+    firmware {
+        optee {
+            compatible = "linaro,optee-tz";
+            method = "smc";
+            status = "disabled";
+        };
+    };
 };
 
 #include "SynQuacerCaches.dtsi"
diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
index 897d06743708..77db30c204fe 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
@@ -19,6 +19,7 @@
 #include <Library/DebugLib.h>
 #include <Library/DxeServicesLib.h>
 #include <Library/MemoryAllocationLib.h>
+#include <Library/OpteeLib.h>
 #include <Platform/VarStore.h>
 
 // add enough space for three instances of 'status = "disabled"'
@@ -47,6 +48,29 @@ DisableDtNode (
   }
 }
 
+STATIC
+VOID
+EnableDtNode (
+  IN  VOID                        *Dtb,
+  IN  CONST CHAR8                 *NodePath
+  )
+{
+  INT32                           Node;
+  INT32                           Rc;
+
+  Node = fdt_path_offset (Dtb, NodePath);
+  if (Node < 0) {
+    DEBUG ((DEBUG_ERROR, "%a: failed to locate DT path '%a': %a\n",
+      __FUNCTION__, NodePath, fdt_strerror (Node)));
+    return;
+  }
+  Rc = fdt_setprop_string (Dtb, Node, "status", "okay");
+  if (Rc < 0) {
+    DEBUG ((DEBUG_ERROR, "%a: failed to set status to 'disabled' on '%a': %a\n",
+      __FUNCTION__, NodePath, fdt_strerror (Rc)));
+  }
+}
+
 /**
   Return a pool allocated copy of the DTB image that is appropriate for
   booting the current platform via DT.
@@ -107,6 +131,10 @@ DtPlatformLoadDtb (
     DisableDtNode (CopyDtb, "/sdhci@52300000");
   }
 
+  if (IsOpteePresent()) {
+    EnableDtNode (CopyDtb, "/firmware/optee");
+  }
+
   *Dtb = CopyDtb;
   *DtbSize = CopyDtbSize;
 
diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf
index 548d62fd5c0a..fd21f7c376ce 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.inf
@@ -24,6 +24,7 @@ [Sources]
   SynQuacerDtbLoaderLib.c
 
 [Packages]
+  ArmPkg/ArmPkg.dec
   MdePkg/MdePkg.dec
   EmbeddedPkg/EmbeddedPkg.dec
   Silicon/Socionext/SynQuacer/SynQuacer.dec
@@ -34,6 +35,7 @@ [LibraryClasses]
   DxeServicesLib
   FdtLib
   MemoryAllocationLib
+  OpteeLib
 
 [Pcd]
   gSynQuacerTokenSpaceGuid.PcdPcieEnableMask
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH edk2-platforms 2/2] Silicon/SynQuacer: Add status property in PCIe & SDHC DT nodes
  2018-08-03  6:41 [PATCH edk2-platforms 0/2] Silicon/SynQuacer: update Device Tree Sumit Garg
  2018-08-03  6:41 ` [PATCH edk2-platforms 1/2] Silicon/SynQuacer: add optional OP-TEE DT node Sumit Garg
@ 2018-08-03  6:41 ` Sumit Garg
  1 sibling, 0 replies; 3+ messages in thread
From: Sumit Garg @ 2018-08-03  6:41 UTC (permalink / raw)
  To: edk2-devel

Add status = "disabled" property by default for PCIe and SDHC DT nodes.
If required, update them at runtime with status = "okay". Using this
method we don't need extra DTB_PADDING.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
 .../Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi  |  3 ++
 .../SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c  | 40 ++++------------------
 2 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
index d6a5f013e58c..003e21bd6f85 100644
--- a/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
+++ b/Silicon/Socionext/SynQuacer/DeviceTree/SynQuacer.dtsi
@@ -473,6 +473,7 @@
 
         msi-map = <0x000 &its 0x0 0x7f00>;
         dma-coherent;
+        status = "disabled";
     };
 
     pcie1: pcie@70000000 {
@@ -492,6 +493,7 @@
 
         msi-map = <0x0 &its 0x10000 0x7f00>;
         dma-coherent;
+        status = "disabled";
     };
 
     gpio: gpio@51000000 {
@@ -537,6 +539,7 @@
         clocks = <&clk_alw_c_0 &clk_alw_b_0>;
         clock-names = "core", "iface";
         dma-coherent;
+        status = "disabled";
     };
 
     clk_alw_1_8: spi_ihclk {
diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
index 77db30c204fe..96090c20502c 100644
--- a/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
+++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerDtbLoaderLib/SynQuacerDtbLoaderLib.c
@@ -22,32 +22,6 @@
 #include <Library/OpteeLib.h>
 #include <Platform/VarStore.h>
 
-// add enough space for three instances of 'status = "disabled"'
-#define DTB_PADDING               64
-
-STATIC
-VOID
-DisableDtNode (
-  IN  VOID                        *Dtb,
-  IN  CONST CHAR8                 *NodePath
-  )
-{
-  INT32                           Node;
-  INT32                           Rc;
-
-  Node = fdt_path_offset (Dtb, NodePath);
-  if (Node < 0) {
-    DEBUG ((DEBUG_ERROR, "%a: failed to locate DT path '%a': %a\n",
-      __FUNCTION__, NodePath, fdt_strerror (Node)));
-    return;
-  }
-  Rc = fdt_setprop_string (Dtb, Node, "status", "disabled");
-  if (Rc < 0) {
-    DEBUG ((DEBUG_ERROR, "%a: failed to set status to 'disabled' on '%a': %a\n",
-      __FUNCTION__, NodePath, fdt_strerror (Rc)));
-  }
-}
-
 STATIC
 VOID
 EnableDtNode (
@@ -105,7 +79,7 @@ DtPlatformLoadDtb (
     return EFI_NOT_FOUND;
   }
 
-  CopyDtbSize = OrigDtbSize + DTB_PADDING;
+  CopyDtbSize = OrigDtbSize;
   CopyDtb = AllocatePool (CopyDtbSize);
   if (CopyDtb == NULL) {
     return EFI_OUT_OF_RESOURCES;
@@ -118,17 +92,17 @@ DtPlatformLoadDtb (
     return EFI_NOT_FOUND;
   }
 
-  if (!(PcdGet8 (PcdPcieEnableMask) & BIT0)) {
-    DisableDtNode (CopyDtb, "/pcie@60000000");
+  if (PcdGet8 (PcdPcieEnableMask) & BIT0) {
+    EnableDtNode (CopyDtb, "/pcie@60000000");
   }
-  if (!(PcdGet8 (PcdPcieEnableMask) & BIT1)) {
-    DisableDtNode (CopyDtb, "/pcie@70000000");
+  if (PcdGet8 (PcdPcieEnableMask) & BIT1) {
+    EnableDtNode (CopyDtb, "/pcie@70000000");
   }
 
   SettingsVal = PcdGet64 (PcdPlatformSettings);
   Settings = (SYNQUACER_PLATFORM_VARSTORE_DATA *)&SettingsVal;
-  if (Settings->EnableEmmc == EMMC_DISABLED) {
-    DisableDtNode (CopyDtb, "/sdhci@52300000");
+  if (Settings->EnableEmmc == EMMC_ENABLED) {
+    EnableDtNode (CopyDtb, "/sdhci@52300000");
   }
 
   if (IsOpteePresent()) {
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-08-03  6:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-03  6:41 [PATCH edk2-platforms 0/2] Silicon/SynQuacer: update Device Tree Sumit Garg
2018-08-03  6:41 ` [PATCH edk2-platforms 1/2] Silicon/SynQuacer: add optional OP-TEE DT node Sumit Garg
2018-08-03  6:41 ` [PATCH edk2-platforms 2/2] Silicon/SynQuacer: Add status property in PCIe & SDHC DT nodes Sumit Garg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox