From patchwork Thu Mar 8 13:29:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 131009 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp6480125lja; Thu, 8 Mar 2018 05:30:00 -0800 (PST) X-Google-Smtp-Source: AG47ELtDw7K4zs8Ib07XZ9ZL6c5TLopUWbL0DPrwEfSFhMrwu+ByqpXMPEGM7bW1WlO82K2oFQMS X-Received: by 10.98.20.22 with SMTP id 22mr26094256pfu.141.1520515800198; Thu, 08 Mar 2018 05:30:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520515800; cv=none; d=google.com; s=arc-20160816; b=mTLlrZw2R45xnAape0ZPpCE6+cVYVLQt9pb4aVm/ZdBOwXrCgOLAr3ZiY+nVzGlFYR vYlMBUEnADkO9QIEI6BVvQMolsV4BLGxVyBdwl60CiZgog5hWlGyHXf8rkudYBFFQN4X GfTheOSC4Ga/OguWHjkYtKVQzwDeAS4DVna0BmJj9mk4d1b4IahSaCAt32/PaO44XTUA 6B69IGo1SpOSIQgQl7hodstV9XwisiPAWuzHNUe7SlBAky5kISjdZPQ5NxE7y/lmQUxI t/L7GYTW/sHnVYgB2l01jp8TiU/gAgHfn1uk8359zVndOemuAyyAX/yg4H7njvjles4F Ph9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:date:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=pUjCRJN9bYAqn6BaVtmzU3TAHUnyUW+vO/fzHXsyQXs=; b=danKACPLgJ6lqIETlD7nulu3dJeQZNS1Ilyu2oWkPOdS0NXL3tC5jBqWdI3Ay/PncS 2VbW4uDrVXkZlKwNzOo0R7B9zGwm87e5DMaleSuqmX6mMyXrRPfgWpFaVxzwdNqZvTEq G7yo2guh9mTmkUyY82a/vVFwKs11HL34YsTthPJ41+vOviiC+rqOOOWYaMHntLfLD6k5 glgFL+TlZDtsnWaFFVfhcNdyITJBscRiR+ifDQ0GBBvI1bC4+AU5QkkVbFzD8dzW+5Ex PMHKYJbKkxRHcklOWT0s4dEMAlFIpuqVUSTG2gVmfw/9OqGRtZGjCuLLsjSm1rbWJ82n o1wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dgoG+D/N; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 31-v6si14737134plk.699.2018.03.08.05.29.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Mar 2018 05:30:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=dgoG+D/N; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 66DC422135D20; Thu, 8 Mar 2018 05:23:43 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c05::243; helo=mail-pg0-x243.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x243.google.com (mail-pg0-x243.google.com [IPv6:2607:f8b0:400e:c05::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E2A05209574F3 for ; Thu, 8 Mar 2018 05:23:41 -0800 (PST) Received: by mail-pg0-x243.google.com with SMTP id r26so2204380pgv.13 for ; Thu, 08 Mar 2018 05:29:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=8BnrUzwpSb560J7t6zdTuZEt/JjolKBa0fzmkwgz8qQ=; b=dgoG+D/Ns1dJpBFw8F3+pGMWqjpIGtHjF91Jjf2t9AwF1Q/3LihEpHbXlFjx2U95LA awneibBwvt4btHtlqz4R0XUwUSEyn7X77S+ZAUzNwfd+mx2EWwGVFuJGVF/m07kA2CeX cNb3N3O2e2w8tUuJhqrrtV1xiCzkk0NLYjZ30= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8BnrUzwpSb560J7t6zdTuZEt/JjolKBa0fzmkwgz8qQ=; b=ScZR7aosrxy5Y3zhIKnpBaxgaIf+2xb8QLBqrfWZuI1KsKk3+0RqL4ZdcXcvBxUKhY eH074JooloW+XI3l2vq+SmrnIrkzI93g82HSkukmcN1HAVHUx6m+4U96aLXg+t7y15Cb dMLBUg/87pCvaTFS7pPJUdR3DrNFfQzkoUjVSHMR4lbN32hBp5DloE4KDYJYO/VCKE1P f29EuJtq1GS6VidUwwNGP8ZANc1zjFY7TAbT0DCIn2vGRQpyEMJYUEuncu2MTTtndUnP 2RU6aRF6A7gYOjL56UZmIeZSzLktLgSgjpxB+fXG+c+8ofcfMaUtUNpxZyg9gbjVmgpE XLsA== X-Gm-Message-State: APf1xPDfG9b4GEo1FR4elyf0yFhV/AwaBAykSnLWmAp8ouWDxrqwWD4h ZTbozxJswiQyjkbKsQD1V3zLmDh10vk= X-Received: by 10.99.122.70 with SMTP id j6mr19762513pgn.17.1520515797221; Thu, 08 Mar 2018 05:29:57 -0800 (PST) Received: from localhost.localdomain ([64.64.108.52]) by smtp.gmail.com with ESMTPSA id r14sm37331402pfh.83.2018.03.08.05.29.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Mar 2018 05:29:56 -0800 (PST) From: Haojian Zhuang To: edk2-devel@lists.01.org Date: Thu, 8 Mar 2018 21:29:50 +0800 Message-Id: <1520515790-29527-1-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH v2 edk-platforms 1/4] Platform/Hisilicon/HiKey960: add gpio platform driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Leif Lindholm , Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add gpio platform driver to enable GPIO in HiKey960 platform. Cc: Leif Lindholm Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang --- Platform/Hisilicon/HiKey960/HiKey960.dsc | 1 + Platform/Hisilicon/HiKey960/HiKey960.fdf | 1 + Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf | 35 +++++++++ Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c | 77 ++++++++++++++++++++ 4 files changed, 114 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/Hisilicon/HiKey960/HiKey960.dsc b/Platform/Hisilicon/HiKey960/HiKey960.dsc index 36f43956ab40..3da1b8556321 100644 --- a/Platform/Hisilicon/HiKey960/HiKey960.dsc +++ b/Platform/Hisilicon/HiKey960/HiKey960.dsc @@ -179,6 +179,7 @@ [Components.common] # # GPIO # + Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf # diff --git a/Platform/Hisilicon/HiKey960/HiKey960.fdf b/Platform/Hisilicon/HiKey960/HiKey960.fdf index 655032a36c53..162dbaaf2646 100644 --- a/Platform/Hisilicon/HiKey960/HiKey960.fdf +++ b/Platform/Hisilicon/HiKey960/HiKey960.fdf @@ -120,6 +120,7 @@ [FV.FvMain] # # GPIO # + INF Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf INF ArmPlatformPkg/Drivers/PL061GpioDxe/PL061GpioDxe.inf # diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf new file mode 100644 index 000000000000..a16213f02520 --- /dev/null +++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.inf @@ -0,0 +1,35 @@ +# +# Copyright (c) 2018, Linaro. 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. +# + +[Defines] + INF_VERSION = 0x00010019 + BASE_NAME = HiKey960GpioDxe + FILE_GUID = 6aa12592-7e36-4aec-acf8-2ac2fd13815c + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = HiKey960GpioEntryPoint + +[Sources] + HiKey960GpioDxe.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + UefiDriverEntryPoint + +[Protocols] + gPlatformGpioProtocolGuid + +[Depex] + TRUE diff --git a/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c new file mode 100644 index 000000000000..986feceea564 --- /dev/null +++ b/Platform/Hisilicon/HiKey960/HiKey960GpioDxe/HiKey960GpioDxe.c @@ -0,0 +1,77 @@ +/** @file +* +* Copyright (c) 2018, Linaro. 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 + +#include + +GPIO_CONTROLLER gGpioDevice[]= { + { 0xe8a0b000, 0, 8 }, // GPIO0 + { 0xe8a0c000, 8, 8 }, // GPIO1 + { 0xe8a0d000, 16, 8 }, // GPIO2 + { 0xe8a0e000, 24, 8 }, // GPIO3 + { 0xe8a0f000, 32, 8 }, // GPIO4 + { 0xe8a10000, 40, 8 }, // GPIO5 + { 0xe8a11000, 48, 8 }, // GPIO6 + { 0xe8a12000, 56, 8 }, // GPIO7 + { 0xe8a13000, 64, 8 }, // GPIO8 + { 0xe8a14000, 72, 8 }, // GPIO9 + { 0xe8a15000, 80, 8 }, // GPIO10 + { 0xe8a16000, 88, 8 }, // GPIO11 + { 0xe8a17000, 96, 8 }, // GPIO12 + { 0xe8a18000, 104, 8 }, // GPIO13 + { 0xe8a19000, 112, 8 }, // GPIO14 + { 0xe8a1a000, 120, 8 }, // GPIO15 + { 0xe8a1b000, 128, 8 }, // GPIO16 + { 0xe8a1c000, 136, 8 }, // GPIO17 + { 0xff3b4000, 144, 8 }, // GPIO18 + { 0xff3b5000, 152, 8 }, // GPIO19 + { 0xe8a1f000, 160, 8 }, // GPIO20 + { 0xe8a20000, 168, 8 }, // GPIO21 + { 0xfff0b000, 176, 8 }, // GPIO22 + { 0xfff0c000, 184, 8 }, // GPIO23 + { 0xfff0d000, 192, 8 }, // GPIO24 + { 0xfff0e000, 200, 8 }, // GPIO25 + { 0xfff0f000, 208, 8 }, // GPIO26 + { 0xfff10000, 216, 8 }, // GPIO27 + { 0xfff1d000, 224, 8 }, // GPIO28 +}; + +PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = { + 232, 29, gGpioDevice +}; + +EFI_STATUS +EFIAPI +HiKey960GpioEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + + // Install the Embedded Platform GPIO Protocol onto a new handle + Handle = NULL; + Status = gBS->InstallMultipleProtocolInterfaces( + &Handle, + &gPlatformGpioProtocolGuid, &gPlatformGpioDevice, + NULL + ); + if (EFI_ERROR(Status)) { + Status = EFI_OUT_OF_RESOURCES; + } + + return Status; +}