From patchwork Tue May 12 04:24:16 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Zhao X-Patchwork-Id: 48331 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DFC5D21550 for ; Tue, 12 May 2015 04:29:01 +0000 (UTC) Received: by wgin8 with SMTP id n8sf44119064wgi.0 for ; Mon, 11 May 2015 21:29:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=nbZ0WyA8BdzMaSJvO8R9Pr7i9Ynu9PzastzPC/iEgAY=; b=RDJw9rrtWGWEblVDcvUbaszSLDsqhwWbJ4qee2JpAyQ7YFDf5Hv92r6mXpJeo4iSmI 2REeVBxgbRNhIEaxkkLJQEmqpiym/BfDfHN8qrT2JeXZPfgziPje7HrG0gP8xB02f9Go 5YZfebTvnVOedRr7gTnCz+1fktqC8z9qF/tXULDqYga8WZdVVyAqoHo+M5x5UI4FmeZ7 Pwsg5KAvXZZxSr6NkZ6RHxbtFlWnaFYTpTHlVHBqymPi797GpGI9xlw2+96sOewlD4XF s0ubJOQnXU4FWTudWbgwzx48QlabtL1WYNwL0A+Fpm4LZ9+SM5WXPgwKDiUJTTA7EhB+ zgfg== X-Gm-Message-State: ALoCoQnKuCwE6WEKA8+b+uMPuLvaF9F9fCuFQu12l47nEefk+NdmSt6zg3LoHwqP+CSAXk39JHVF X-Received: by 10.194.189.110 with SMTP id gh14mr2969108wjc.3.1431404941229; Mon, 11 May 2015 21:29:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.204 with SMTP id ba12ls750374lab.41.gmail; Mon, 11 May 2015 21:29:00 -0700 (PDT) X-Received: by 10.112.126.136 with SMTP id my8mr10413468lbb.18.1431404940880; Mon, 11 May 2015 21:29:00 -0700 (PDT) Received: from mail-la0-f54.google.com (mail-la0-f54.google.com. [209.85.215.54]) by mx.google.com with ESMTPS id xh7si9542625lac.132.2015.05.11.21.29.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 21:29:00 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) client-ip=209.85.215.54; Received: by layy10 with SMTP id y10so107889499lay.0 for ; Mon, 11 May 2015 21:29:00 -0700 (PDT) X-Received: by 10.152.36.161 with SMTP id r1mr10538324laj.88.1431404940753; Mon, 11 May 2015 21:29:00 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.108.230 with SMTP id hn6csp1856419lbb; Mon, 11 May 2015 21:29:00 -0700 (PDT) X-Received: by 10.55.41.170 with SMTP id p42mr29026212qkp.106.1431404939589; Mon, 11 May 2015 21:28:59 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n76si15040991qkh.98.2015.05.11.21.28.59 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 21:28:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:40803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys1oQ-0003aX-QJ for patch@linaro.org; Tue, 12 May 2015 00:28:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys1kg-000650-Kv for qemu-devel@nongnu.org; Tue, 12 May 2015 00:25:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ys1kc-00071v-LE for qemu-devel@nongnu.org; Tue, 12 May 2015 00:25:06 -0400 Received: from mail-pd0-f174.google.com ([209.85.192.174]:36291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys1kc-000716-Fv for qemu-devel@nongnu.org; Tue, 12 May 2015 00:25:02 -0400 Received: by pdea3 with SMTP id a3so168606942pde.3 for ; Mon, 11 May 2015 21:25:02 -0700 (PDT) X-Received: by 10.68.198.36 with SMTP id iz4mr24749352pbc.167.1431404702009; Mon, 11 May 2015 21:25:02 -0700 (PDT) Received: from localhost ([180.150.141.243]) by mx.google.com with ESMTPSA id p1sm14617317pdl.60.2015.05.11.21.25.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 May 2015 21:25:01 -0700 (PDT) From: shannon.zhao@linaro.org To: qemu-devel@nongnu.org, peter.maydell@linaro.org, imammedo@redhat.com, mst@redhat.com, pbonzini@redhat.com, wei@redhat.com, arnd@arndb.de, christoffer.dall@linaro.org Date: Tue, 12 May 2015 12:24:16 +0800 Message-Id: <1431404656-7180-8-git-send-email-shannon.zhao@linaro.org> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1431404656-7180-1-git-send-email-shannon.zhao@linaro.org> References: <1431404656-7180-1-git-send-email-shannon.zhao@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.192.174 Cc: hangaohuai@huawei.com, peter.huangpeng@huawei.com, zhaoshenglong@huawei.com Subject: [Qemu-devel] [PATCH 7/7] hw/arm/virt: Add gpio-keys node for Poweroff using DT X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: shannon.zhao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.54 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Shannon Zhao Add a gpio-keys node. This is used for Poweroff for the systems which use DT not ACPI. Signed-off-by: Shannon Zhao Signed-off-by: Shannon Zhao --- hw/arm/virt.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 354b020..a6f39c0 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -454,6 +454,7 @@ static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic) pl061_dev = sysbus_create_simple("pl061", base, pic[irq]); + uint32_t phandle = qemu_fdt_alloc_phandle(vbi->fdt); nodename = g_strdup_printf("/pl061@%" PRIx64, base); qemu_fdt_add_subnode(vbi->fdt, nodename); qemu_fdt_setprop_sized_cells(vbi->fdt, nodename, "reg", @@ -466,6 +467,20 @@ static void create_gpio(const VirtBoardInfo *vbi, qemu_irq *pic) GIC_FDT_IRQ_FLAGS_LEVEL_HI); qemu_fdt_setprop_cell(vbi->fdt, nodename, "clocks", vbi->clock_phandle); qemu_fdt_setprop_string(vbi->fdt, nodename, "clock-names", "apb_pclk"); + qemu_fdt_setprop_cell(vbi->fdt, nodename, "phandle", phandle); + + qemu_fdt_add_subnode(vbi->fdt, "/gpio-keys"); + qemu_fdt_setprop_string(vbi->fdt, "/gpio-keys", "compatible", "gpio-keys"); + qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys", "#size-cells", 0); + qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys", "#address-cells", 1); + qemu_fdt_setprop(vbi->fdt, "/gpio-keys", "autorepeat", NULL, 0); + + qemu_fdt_add_subnode(vbi->fdt, "/gpio-keys/poweroff"); + qemu_fdt_setprop_string(vbi->fdt, "/gpio-keys/poweroff", + "label", "GPIO Key Poweroff"); + qemu_fdt_setprop_cell(vbi->fdt, "/gpio-keys/poweroff", "linux,code", 116); + qemu_fdt_setprop_cells(vbi->fdt, "/gpio-keys/poweroff", + "gpios", phandle, 3, 0); /* connect powerdown request */ qemu_register_powerdown_notifier(&virt_system_powerdown_notifier);