From patchwork Wed May 9 09:54:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haojian Zhuang X-Patchwork-Id: 135242 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp5427091lji; Wed, 9 May 2018 02:55:23 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrh0nsy5uATSNALZ4HhJi6lTQ1i8oiEX40AtdzBQlEx86fnyw+fgX2p53E3T8h8MHKIsgaA X-Received: by 10.98.133.154 with SMTP id m26mr43069183pfk.247.1525859723467; Wed, 09 May 2018 02:55:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525859723; cv=none; d=google.com; s=arc-20160816; b=EkOK85scp+EgRVyFVJeK7qbQ9L4p04zzQIxL2m8vOK3QYNY/vvKUpeYU9Abb+tSN3h cktfYBkXnbijwo9fb4BJ+pesJdpON4+iDCSnhtLQIvvw7VEi3cnxytNQZmNXB8B6sdXl doRkGkdP4bYgNtRowZFMltTpykCC6c2Be3D/SoAcwZbIaZh41do2fnr9NpAqg+DKpy7d t4Es0YZgXwgQmIjF0XNjuzsLARZOY9r1Y2W0o4COx1k592aE/evhvxaQiXfwO9PPElVr dtaO5IzjEozBI2w5vJNuiLI3IE6QEYQ4+dIcUzBnAfhsUvBRlubhrIasBXCKj38qglDl v60w== 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=HcQ9AUjgMnOfMz1mP8NRJAG+VHpiYjCXsr0+z0KwJkQ=; b=acqNSljff31bV6yCaKNith8f8cZRjrQigAsMbOwvyu2QpJYhRbO4is88QUNc5WcZrR txSwYSXlFt6+zMcqUkWCxFstEcrJkPSCAn4ihNvs7NIMTc2ALwQu80lL65jsgel0aJ0K 4LcgbQGl3JEeqrTvqh5xI5s71Fk9jnpXaKe8pepZ7yLESgIi4kSWlp/frLfeO0ybOyzb 5YDygErHFf7QnfQ1oFaKD7Cqw3bYcWZfmLsKfDQybdXbnCdRmKXKXHLo9LTth36UM4Uo 1Ivp7mGqH4GEwu1qh2davZb+ZFCWDVNQ+18C+21s4SQsO6Z30LTdakeJBKCF9/2T0EkT lYxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=a9qyio7c; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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. [198.145.21.10]) by mx.google.com with ESMTPS id g15-v6si21330787pgu.112.2018.05.09.02.55.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 May 2018 02:55:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=a9qyio7c; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 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 1B1AD20945D87; Wed, 9 May 2018 02:55:23 -0700 (PDT) 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::242; helo=mail-pg0-x242.google.com; envelope-from=haojian.zhuang@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) (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 79044203B85B8 for ; Wed, 9 May 2018 02:55:21 -0700 (PDT) Received: by mail-pg0-x242.google.com with SMTP id a13-v6so22447809pgu.4 for ; Wed, 09 May 2018 02:55:21 -0700 (PDT) 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=dbY0NfGtfkBljvjtMfvF23F9ZO7VhqTv0js7eRmakPk=; b=a9qyio7c+3orkpPnrWfQT2v/03tm7f/+KA3ldZlYZCGZ5hGHTy6qSLfmr9Npozz8/p nVk5IK3McoTyQOYViMi0YOaJMXLYFacy2fUAXekkUq4nT3BZq3sF0lAqqzTqIGYlLcQi uElDMaEeueYf/KWNfxR6NC8QK7m9t1lY3PeHY= 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=dbY0NfGtfkBljvjtMfvF23F9ZO7VhqTv0js7eRmakPk=; b=Pgse+jx438GxREkTQZqObFFZBzAaUI85s/MnQeh7VjNTErcguDulkciFclnFR5FO0T yEfoellpSF3zFNMJ8UHWWdw2zx8ByhmnkkQ7VClNcnW1WxGiayYIkBxiJipPqS/P7P90 iJiYd/zkSXtmVFqMCD8nAZ+F32ibkGIABqASKN/djY2u3VpYhytCJS+RwRrWDC79EEHN 38EZjjPTtlLUNZF4UdiCLSEwAO1QHNqOp0yNUqvrQeQrzP7pSbUb57ahSjQ6QUUjOTgG 7wfde/OFzo7ytVlrnjM4g9h7HmjoU+IIW4WscwbhuMs4hYlPlPod2uUorZbAVB2SaTwN G82A== X-Gm-Message-State: ALQs6tBQ0gg0ENAz2ecV5xH8oSELDu60331L85xfp5T7SNkU+DOHJndT LKZVCnbJUdUwcBQRsgpXL+MweRnYWjw= X-Received: by 2002:a65:62c2:: with SMTP id m2-v6mr36011956pgv.164.1525859720766; Wed, 09 May 2018 02:55:20 -0700 (PDT) Received: from localhost.localdomain ([64.64.108.170]) by smtp.gmail.com with ESMTPSA id k1-v6sm17966139pgt.88.2018.05.09.02.55.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 09 May 2018 02:55:19 -0700 (PDT) From: Haojian Zhuang To: edk2-devel@lists.01.org Date: Wed, 9 May 2018 17:54:57 +0800 Message-Id: <1525859699-16888-5-git-send-email-haojian.zhuang@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525859699-16888-1-git-send-email-haojian.zhuang@linaro.org> References: <1525859699-16888-1-git-send-email-haojian.zhuang@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 4/6] Platform/Hisilicon/HiKey: add gpio platform driver X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haojian Zhuang , 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 HiKey platform. Cc: Leif Lindholm Cc: Ard Biesheuvel Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Haojian Zhuang --- .../Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c | 74 ++++++++++++++++++++++ .../Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.inf | 36 +++++++++++ 2 files changed, 110 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 000000000000..be535f8f1903 --- /dev/null +++ b/Platform/Hisilicon/HiKey/HiKeyGpioDxe/HiKeyGpioDxe.c @@ -0,0 +1,74 @@ +/** @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[] = { + // + // { base address, gpio index, gpio count } + // + { 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 = { + // + // { global gpio count, gpio controller counter, GPIO_CONTROLLER } + // + 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 000000000000..2791b9f44cad --- /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 = 0x0001001a + 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