]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.c
ArmPlatformPkg: PL061 - drop pointless initialize function
[mirror_edk2.git] / ArmPlatformPkg / Drivers / PL061GpioDxe / PL061Gpio.c
index ff05662b885d71611adafe7aeeaa97eec6faf872..45897ca753a9052382bf8f9d817caa2c060e2e2c 100644 (file)
@@ -1,11 +1,12 @@
 /** @file\r
 *\r
 *  Copyright (c) 2011, ARM Limited. All rights reserved.\r
+*  Copyright (c) 2016, Linaro Limited. All rights reserved.\r
 *\r
 *  This program and the accompanying materials\r
-*  are licensed and made available under the terms and conditions of the BSD License\r
-*  which accompanies this distribution.  The full text of the license may be found at\r
-*  http://opensource.org/licenses/bsd-license.php\r
+*  are licensed and made available under the terms and conditions of the BSD\r
+*  License which accompanies this distribution.  The full text of the license\r
+*  may be found at http://opensource.org/licenses/bsd-license.php\r
 *\r
 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
@@ -27,7 +28,6 @@
 #include <Protocol/EmbeddedGpio.h>\r
 #include <Drivers/PL061Gpio.h>\r
 \r
-BOOLEAN     mPL061Initialized = FALSE;\r
 \r
 /**\r
   Function implementations\r
@@ -57,33 +57,6 @@ PL061Identify (
   return EFI_SUCCESS;\r
 }\r
 \r
-EFI_STATUS\r
-PL061Initialize (\r
-  VOID\r
-  )\r
-{\r
-  EFI_STATUS  Status;\r
-\r
-  // Check if the PL061 GPIO module exists on board\r
-  Status = PL061Identify();\r
-  if (EFI_ERROR (Status)) {\r
-    Status = EFI_DEVICE_ERROR;\r
-    goto EXIT;\r
-  }\r
-\r
-  // Do other hardware initialisation things here as required\r
-\r
-  // Disable Interrupts\r
-  //if (MmioRead8 (PL061_GPIO_IE_REG) != 0) {\r
-  //   // Ensure interrupts are disabled\r
-  //}\r
-\r
-  mPL061Initialized = TRUE;\r
-\r
-  EXIT:\r
-  return Status;\r
-}\r
-\r
 /**\r
 \r
 Routine Description:\r
@@ -109,30 +82,19 @@ Get (
   OUT UINTN             *Value\r
   )\r
 {\r
-  EFI_STATUS    Status = EFI_SUCCESS;\r
-\r
   if (    (Value == NULL)\r
       ||  (Gpio > LAST_GPIO_PIN))\r
   {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  // Initialize the hardware if not already done\r
-  if (!mPL061Initialized) {\r
-    Status = PL061Initialize();\r
-    if (EFI_ERROR(Status)) {\r
-      goto EXIT;\r
-    }\r
-  }\r
-\r
   if (MmioRead8 (PL061_GPIO_DATA_REG) & GPIO_PIN_MASK_HIGH_8BIT(Gpio)) {\r
     *Value = 1;\r
   } else {\r
     *Value = 0;\r
   }\r
 \r
-  EXIT:\r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
@@ -169,14 +131,6 @@ Set (
     goto EXIT;\r
   }\r
 \r
-  // Initialize the hardware if not already done\r
-  if (!mPL061Initialized) {\r
-    Status = PL061Initialize();\r
-    if (EFI_ERROR(Status)) {\r
-      goto EXIT;\r
-    }\r
-  }\r
-\r
   switch (Mode)\r
   {\r
     case GPIO_MODE_INPUT:\r
@@ -233,22 +187,12 @@ GetMode (
   OUT EMBEDDED_GPIO_MODE  *Mode\r
   )\r
 {\r
-  EFI_STATUS Status;\r
-\r
   // Check for errors\r
   if (    (Mode == NULL)\r
       ||  (Gpio > LAST_GPIO_PIN)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
-  // Initialize the hardware if not already done\r
-  if (!mPL061Initialized) {\r
-    Status = PL061Initialize();\r
-    if (EFI_ERROR(Status)) {\r
-      return Status;\r
-    }\r
-  }\r
-\r
   // Check if it is input or output\r
   if (MmioRead8 (PL061_GPIO_DIR_REG) & GPIO_PIN_MASK_HIGH_8BIT(Gpio)) {\r
     // Pin set to output\r
@@ -329,6 +273,11 @@ PL061InstallProtocol (
   //\r
   ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEmbeddedGpioProtocolGuid);\r
 \r
+  Status = PL061Identify();\r
+  if (EFI_ERROR(Status)) {\r
+    return EFI_DEVICE_ERROR;\r
+  }\r
+\r
   // Install the Embedded GPIO Protocol onto a new handle\r
   Handle = NULL;\r
   Status = gBS->InstallMultipleProtocolInterfaces(\r