From patchwork Mon Feb 26 08:53:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 129618 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3377484lja; Mon, 26 Feb 2018 00:53:42 -0800 (PST) X-Google-Smtp-Source: AG47ELvZB1Cmh4oAyV3HfdfcqLuEAyeoHtHepX0304QbEmSW+IPNx7NkSx3tWsdotz9yw0NhmvkQ X-Received: by 10.99.167.66 with SMTP id w2mr694605pgo.357.1519635222255; Mon, 26 Feb 2018 00:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519635222; cv=none; d=google.com; s=arc-20160816; b=uTQZsSO5jTWrORRrfVprCRmt3ChMKhUODKuEFL82oL2oEBshIJMPf3Z9L0PPS/smoo yjB4xy2GzTtWmF4P6cudOulFZAqrJTQziJ0iVBYv34M6KKmvpYOdlQG87w2W7UR7HNWe v3mp2GgH8DQYphnwyQULB6oVZ8WBq4ujJDZ/OyBsxYAy6IKTpQ63Ba76VFF00s0bDsGq 22FAnVQ+SfkJDsAOoYuXy605/waSj5ow86I1JYB2Fp8O7P9ubUwTr0+arEVIWX4DgW3i eQvaFBAdDVrwfunuHxGlTRAF1ZJoSc6lBSXp9wOFrXNdmeOWTQg4+8DChAonOly7dkng S82w== 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:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=LpU7SWiEVUHdqhv6oE5oljC89kEEk5D55xyePuNUy7M=; b=INrJfUYeqCjc4WeGcgAe4DV4tnXUsXR/OZYNbyLP9ZEXDdeD/f1govWQLDRW7vwTL/ 5cbsaNDMXxURItL4YQLgla6Afcd4In6l9NXGWtl8xNLaf7f4eRkm0kiYpkG0SRn8Tx79 Wn77JqlerK7HfOk99bFuqMsTRmdjUaUjZCKUMdyFN9HsFqbuE/qUWidAIAL+eJeyldAU IauUpa/+YYhJe0NmdDdqGiJMDOdMTPmqbebWNgWNg6bnj0bj86X1ermqZzCDl2T2LcPL bHmZiW7TAfC+kejCgAsTVjHQ7fOqNuzHXUjKzn1vzc02Qb4ZoRYZEoNy9o7v7X23zAGP mMWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Rs/zzbZD; 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 l69si6465920pfk.180.2018.02.26.00.53.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Feb 2018 00:53:42 -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=Rs/zzbZD; 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 D277F209574F2; Mon, 26 Feb 2018 00:47:36 -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:c00::244; helo=mail-pf0-x244.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pf0-x244.google.com (mail-pf0-x244.google.com [IPv6:2607:f8b0:400e:c00::244]) (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 CB1D0209574DB for ; Mon, 26 Feb 2018 00:47:34 -0800 (PST) Received: by mail-pf0-x244.google.com with SMTP id z14so6241733pfe.10 for ; Mon, 26 Feb 2018 00:53:39 -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:in-reply-to:references; bh=8pU1T2GHtuzLsToyjDJluAjkJqTluexPgdTaN1ul4Wg=; b=Rs/zzbZD1EDJWQ3VbYz2dW2P5lU8qc7IchR4+hGp1mcskC8q7AmkOYUknt479T/wsf +juXdkrX80eGiCVzGyqb4DlW/dgOCPnKy+l5BxNob1dYOnrHHEJJpdHV3E3uOH7qlRvo 3eL4v4k/TGDcsYGMAjC+ouV14roKE9uQF60dM= 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:in-reply-to :references; bh=8pU1T2GHtuzLsToyjDJluAjkJqTluexPgdTaN1ul4Wg=; b=dvZ3DVVaIFGUlXG+UU+NyAzTPbnEYx6RxlayeO6saEiWVJ6Y6ax1H+Q37USL3SAGQn Vd4wTi31H6LnEMCFj91z3ffXOIi/1cr5If+T/B39NP/gomkS4J1Yt1dt3ya9h8iQ1+iE DvSOwHb1VnXg2l+M1uaPFdXPx1fObHsbgG//6oB4R5BTPcb+tBpRPKxJYuKFahOYnCTK UeBZfAW/APVRVkinPBgyTa25spuvua+tPL0yyLPYalRc/KcNpO104ND+VGV2qDJENH4Y p+2CBdeXlR12eenfccJoUZ4YwvcYfvp3vEOQw49e58r5oxzIcYmGhn0nBo1p/uVwNmRs 75XA== X-Gm-Message-State: APf1xPB/a0EWRjTOY50kKPhMPiIgXLz7ajrGAqyuQCkE6Nf8QLyBUwNz ozkA5C0P4PVCMniE37m23I/zF8B3X3E= X-Received: by 10.167.131.199 with SMTP id j7mr9688621pfn.99.1519635219439; Mon, 26 Feb 2018 00:53:39 -0800 (PST) Received: from localhost.localdomain ([64.64.108.97]) by smtp.gmail.com with ESMTPSA id k1sm18209819pfj.161.2018.02.26.00.53.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 00:53:38 -0800 (PST) From: Haojian Zhuang To: leif.lindholm@linaro.org, ard.biesheuvel@linaro.org, edk2-devel@lists.01.org, linaro-uefi@lists.linaro.org Date: Mon, 26 Feb 2018 16:53:18 +0800 Message-Id: <1519635199-22018-4-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519635199-22018-1-git-send-email-haojian.zhuang@linaro.org> References: <1519635199-22018-1-git-send-email-haojian.zhuang@linaro.org> Subject: [edk2] [platform][PATCH 3/4] Platform/Hisilicon/HiKey: 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: Haojian Zhuang MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Add gpio platform driver to enable GPIO in HiKey platform. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang --- .../Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c | 68 ++++++++++++++++++++++ .../Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf | 36 ++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c create mode 100644 Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf -- 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/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c new file mode 100644 index 0000000..543f65d --- /dev/null +++ b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c @@ -0,0 +1,68 @@ +/** @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[]= { + { 0xf8011000, 0, 8 }, // GPIO0 + { 0xf8012000, 8, 8 }, // GPIO1 + { 0xf8013000, 16, 8 }, // GPIO2 + { 0xf8014000, 24, 8 }, // GPIO3 + { 0xf7020000, 32, 8 }, // GPIO4 + { 0xf7021000, 40, 8 }, // GPIO5 + { 0xf7022000, 48, 8 }, // GPIO6 + { 0xf7023000, 56, 8 }, // GPIO7 + { 0xf7024000, 64, 8 }, // GPIO8 + { 0xf7025000, 72, 8 }, // GPIO9 + { 0xf7026000, 80, 8 }, // GPIO10 + { 0xf7027000, 88, 8 }, // GPIO11 + { 0xf7028000, 96, 8 }, // GPIO12 + { 0xf7029000, 104, 8 }, // GPIO13 + { 0xf702a000, 112, 8 }, // GPIO14 + { 0xf702b000, 120, 8 }, // GPIO15 + { 0xf702c000, 128, 8 }, // GPIO16 + { 0xf702d000, 136, 8 }, // GPIO17 + { 0xf702e000, 144, 8 }, // GPIO18 + { 0xf702f000, 152, 8 } // GPIO19 +}; + +PLATFORM_GPIO_CONTROLLER gPlatformGpioDevice = { + 160, 20, gGpioDevice +}; + +EFI_STATUS +EFIAPI +HiKeyGpioEntryPoint ( + 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; +} diff --git a/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf new file mode 100644 index 0000000..272ed1c --- /dev/null +++ b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf @@ -0,0 +1,36 @@ +# +# 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 = HiKeyGpio + FILE_GUID = b51a851c-7bf7-463f-b261-cfb158b7f699 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + ENTRY_POINT = HiKeyGpioEntryPoint + +[Sources.common] + HiKeyGpioDxe.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + DebugLib + UefiDriverEntryPoint + +[Protocols] + gPlatformGpioProtocolGuid + +[Depex] + TRUE