diff options
author | Haojian Zhuang <haojian.zhuang@linaro.org> | 2017-06-12 15:47:45 +0800 |
---|---|---|
committer | Haojian Zhuang <haojian.zhuang@linaro.org> | 2017-06-12 15:47:45 +0800 |
commit | d143cfafd73d8f84d1f1d24c5481e6a7d5152634 (patch) | |
tree | 28e821286bcf030ad930561fb229a1dd51048f34 /Platforms/Hisilicon | |
parent | 34fd3f6b97b81cdab684d27667e0a34f9e1a5e37 (diff) | |
download | device_linaro_bootloader_OpenPlatformPkg-d143cfafd73d8f84d1f1d24c5481e6a7d5152634.tar.gz device_linaro_bootloader_OpenPlatformPkg-d143cfafd73d8f84d1f1d24c5481e6a7d5152634.tar.bz2 device_linaro_bootloader_OpenPlatformPkg-d143cfafd73d8f84d1f1d24c5481e6a7d5152634.zip |
Platforms/HiKey: enable gpio keyboard
When GPIO24 is in LOW LEVEL, send out 'f' key that is the hotkey
of AndroidFastbootApp.
Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Diffstat (limited to 'Platforms/Hisilicon')
-rw-r--r-- | Platforms/Hisilicon/HiKey/HiKey.dsc | 9 | ||||
-rw-r--r-- | Platforms/Hisilicon/HiKey/HiKey.fdf | 9 | ||||
-rw-r--r-- | Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c | 40 | ||||
-rw-r--r-- | Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf | 2 |
4 files changed, 56 insertions, 4 deletions
diff --git a/Platforms/Hisilicon/HiKey/HiKey.dsc b/Platforms/Hisilicon/HiKey/HiKey.dsc index e44ede6..1cf24eb 100644 --- a/Platforms/Hisilicon/HiKey/HiKey.dsc +++ b/Platforms/Hisilicon/HiKey/HiKey.dsc @@ -410,8 +410,6 @@ MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
-
#
# GPIO
#
@@ -419,6 +417,13 @@ OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
#
+ # GPIO Keyboard
+ #
+ OpenPlatformPkg/Drivers/Keyboard/GpioKeyboardDxe/GpioKeyboardDxe.inf
+
+ OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
+
+ #
# MMC/SD
#
EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
diff --git a/Platforms/Hisilicon/HiKey/HiKey.fdf b/Platforms/Hisilicon/HiKey/HiKey.fdf index a02fd0c..bd80c79 100644 --- a/Platforms/Hisilicon/HiKey/HiKey.fdf +++ b/Platforms/Hisilicon/HiKey/HiKey.fdf @@ -114,8 +114,6 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
- INF OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
-
#
# GPIO
#
@@ -123,6 +121,13 @@ READ_LOCK_STATUS = TRUE INF OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf
#
+ # GPIO Keyboard
+ #
+ INF OpenPlatformPkg/Drivers/Keyboard/GpioKeyboardDxe/GpioKeyboardDxe.inf
+
+ INF OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf
+
+ #
# Multimedia Card Interface
#
INF EmbeddedPkg/Universal/MmcDxe/MmcDxe.inf
diff --git a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c index 32bf5c7..174dfca 100644 --- a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c +++ b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.c @@ -26,6 +26,7 @@ #include <Protocol/Abootimg.h> #include <Protocol/BlockIo.h> +#include <Protocol/PlatformGpioKeyboard.h> #include <Hi6220.h> #include <libfdt.h> @@ -38,6 +39,8 @@ #define RANDOM_MAX 0x7FFFFFFFFFFFFFFF #define RANDOM_MAGIC 0x9A4DBEAF +#define DETECT_J15_FASTBOOT 24 // GPIO3_0 + typedef struct { UINT64 Magic; UINT64 Data; @@ -107,6 +110,10 @@ HiKeyInitPeripherals ( UartInit (); MtcmosInit (); + /* Set DETECT_J15_FASTBOOT (GPIO24) pin as GPIO function */ + MmioWrite32 (0xf7010950, 0); /* configure GPIO24 as nopull */ + MmioWrite32 (0xf7010140, 0); /* configure GPIO24 as GPIO */ + return EFI_SUCCESS; } @@ -237,6 +244,28 @@ ABOOTIMG_PROTOCOL mAbootimg = { EFI_STATUS EFIAPI +GpioKeyboardRegister ( + IN OUT GPIO_KBD_KEY *GpioKey + ) +{ + if (GpioKey == NULL) { + return EFI_INVALID_PARAMETER; + } + GpioKey->Signature = GPIO_KBD_KEY_NEXT_SIGNATURE; + GpioKey->Pin = DETECT_J15_FASTBOOT; + GpioKey->Value = 0; + GpioKey->Key.ScanCode = SCAN_NULL; + GpioKey->Key.UnicodeChar = L'f'; + InitializeListHead (&GpioKey->Next); + return EFI_SUCCESS; +} + +PLATFORM_GPIO_KBD_PROTOCOL mGpioKeyboard = { + GpioKeyboardRegister +}; + +EFI_STATUS +EFIAPI HiKeyEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable @@ -255,5 +284,16 @@ HiKeyEntryPoint ( EFI_NATIVE_INTERFACE, &mAbootimg ); + if (EFI_ERROR (Status)) { + return Status; + } + + Status = gBS->InstallProtocolInterface ( + &ImageHandle, + &gPlatformGpioKeyboardProtocolGuid, + EFI_NATIVE_INTERFACE, + &mGpioKeyboard + ); +DEBUG ((DEBUG_ERROR, "#%a, %d, Status:%r\n", __func__, __LINE__, Status)); return Status; } diff --git a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf index 3d55282..dcc2b9e 100644 --- a/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf +++ b/Platforms/Hisilicon/HiKey/HiKeyDxe/HiKeyDxe.inf @@ -28,6 +28,7 @@ EmbeddedPkg/EmbeddedPkg.dec MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec + OpenPlatformPkg/Drivers/Keyboard/GpioKeyboardDxe/GpioKeyboardDxe.dec OpenPlatformPkg/Platforms/Hisilicon/HiKey/HiKey.dec [LibraryClasses] @@ -50,6 +51,7 @@ [Protocols] gAbootimgProtocolGuid gEfiBlockIoProtocolGuid + gPlatformGpioKeyboardProtocolGuid [Guids] gEfiEndOfDxeEventGroupGuid |