summaryrefslogtreecommitdiff
path: root/HisiPkg/HiKeyPkg
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@gmail.com>2015-09-28 20:51:28 +0800
committerHaojian Zhuang <haojian.zhuang@gmail.com>2015-09-28 20:51:28 +0800
commit44cba3f687d7ed91dc5c131faf0cde4f7972b8a8 (patch)
tree3e490d081a33501b7a3eac6c9d062d0c9b3a766b /HisiPkg/HiKeyPkg
parentd9e5d638463b553e07ec8a71f234c06aa9fb2a40 (diff)
HiKeyPkg: reset i2c2 controller
Since i2c controller is in reset mode after system reset, i2c controller can't work well in linux kernel. So release it from reset mode in UEFI. Signed-off-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Diffstat (limited to 'HisiPkg/HiKeyPkg')
-rw-r--r--HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.c1
-rw-r--r--HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.inf1
-rw-r--r--HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxeInternal.h5
-rw-r--r--HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InitPeripherals.c34
4 files changed, 41 insertions, 0 deletions
diff --git a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.c b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.c
index 400efc47d..157baf4a8 100644
--- a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.c
+++ b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.c
@@ -175,6 +175,7 @@ HiKeyEntryPoint (
HiKeyInitSerialNo ();
HiKeyInitBootDevice ();
+ HiKeyInitPeripherals ();
// Try to install the Flat Device Tree (FDT). This function actually installs the
// UEFI Driver Binding Protocol.
diff --git a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.inf b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.inf
index d614a1b00..895bac682 100644
--- a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.inf
+++ b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxe.inf
@@ -22,6 +22,7 @@
[Sources.common]
HiKeyDxe.c
+ InitPeripherals.c
InstallFdt.c
InstallBootMenu.c
diff --git a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxeInternal.h b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxeInternal.h
index 26344ccad..82ff92d59 100644
--- a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxeInternal.h
+++ b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/HiKeyDxeInternal.h
@@ -34,4 +34,9 @@ HiKeyBootMenuInstall (
IN VOID
);
+EFI_STATUS
+HiKeyInitPeripherals (
+ IN VOID
+ );
+
#endif // __HIKEY_DXE_INTERNAL_H__
diff --git a/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InitPeripherals.c b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InitPeripherals.c
new file mode 100644
index 000000000..c905dc6c6
--- /dev/null
+++ b/HisiPkg/HiKeyPkg/Drivers/HiKeyDxe/InitPeripherals.c
@@ -0,0 +1,34 @@
+/** @file
+*
+* Copyright (c) 2015, Linaro Ltd. All rights reserved.
+* Copyright (c) 2015, Hisilicon Ltd. All rights reserved.
+*
+* This program and the accompanying materials
+* are licensed and made available under the terms and conditions of the BSD License
+* which accompanies this distribution. The full text of the license may be found at
+* http://opensource.org/licenses/bsd-license.php
+*
+* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*
+**/
+
+#include <Library/IoLib.h>
+
+#include "Hi6220RegsPeri.h"
+
+VOID
+EFIAPI
+HiKeyInitPeripherals (
+ IN VOID
+ )
+{
+ UINT32 Data;
+
+ /* make I2C2 out of reset */
+ MmioWrite32 (SC_PERIPH_RSTDIS3, PERIPH_RST3_I2C2);
+
+ do {
+ Data = MmioRead32 (SC_PERIPH_RSTSTAT3);
+ } while (Data & PERIPH_RST3_I2C2);
+}