From patchwork Wed Apr 7 04:10:28 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 49567 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D3AF4B7D20 for ; Wed, 7 Apr 2010 14:30:31 +1000 (EST) Received: from localhost ([127.0.0.1]:39442 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzMmQ-0002dA-KR for incoming@patchwork.ozlabs.org; Wed, 07 Apr 2010 00:22:18 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NzMb5-00005G-NP for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:35 -0400 Received: from [140.186.70.92] (port=34751 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NzMb4-0008VW-2J for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NzMb1-0001op-Re for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:33 -0400 Received: from mail-pw0-f45.google.com ([209.85.160.45]:55195) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NzMb1-0001kv-Mw for qemu-devel@nongnu.org; Wed, 07 Apr 2010 00:10:31 -0400 Received: by mail-pw0-f45.google.com with SMTP id 6so554258pwi.4 for ; Tue, 06 Apr 2010 21:10:31 -0700 (PDT) Received: by 10.141.125.8 with SMTP id c8mr6137609rvn.180.1270613431058; Tue, 06 Apr 2010 21:10:31 -0700 (PDT) Received: from angua (S01060002b3d79728.cg.shawcable.net [70.72.87.49]) by mx.google.com with ESMTPS id 22sm1066399pzk.13.2010.04.06.21.10.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 06 Apr 2010 21:10:30 -0700 (PDT) Received: from [127.0.1.1] (localhost [127.0.0.1]) by angua (Postfix) with ESMTP id 9AC771121; Tue, 6 Apr 2010 22:10:28 -0600 (MDT) From: Grant Likely To: qemu-devel@nongnu.org, devicetree-discuss@lists.ozlabs.org, jeremy.kerr@canonical.com Date: Tue, 06 Apr 2010 22:10:28 -0600 Message-ID: <20100407041028.20274.67952.stgit@angua> In-Reply-To: <20100407040129.20274.44284.stgit@angua> References: <20100407040129.20274.44284.stgit@angua> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) Cc: Subject: [Qemu-devel] [RFC PATCH 6/7] devicetree: Add fdt_populate hook to pl011 device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Grant Likely --- hw/pl011.c | 29 +++++++++++++++++++++++++---- 1 files changed, 25 insertions(+), 4 deletions(-) diff --git a/hw/pl011.c b/hw/pl011.c index 81de91e..efc06d2 100644 --- a/hw/pl011.c +++ b/hw/pl011.c @@ -286,6 +286,27 @@ static int pl011_load(QEMUFile *f, void *opaque, int version_id) return 0; } +#ifdef CONFIG_FDT +#include +static int pl011_fdt_populate(SysBusDevice *dev, void *fdt, int offset) +{ + pl011_state *s = FROM_SYSBUS(pl011_state, dev); + int rc; + + rc = fdt_setprop_string(fdt, offset, "compatible", "arm,amba-device"); + if (rc < 0) + return rc; + + rc = fdt_setprop(fdt, offset, "arm,amba-deviceid", s->id, sizeof(s->id)); + if (rc < 0) + return rc; + + return 0; +} +#else +#define pl011_fdt_populate NULL +#endif + static int pl011_init(SysBusDevice *dev, const unsigned char *id) { int iomemtype; @@ -322,10 +343,10 @@ static int pl011_init_luminary(SysBusDevice *dev) static void pl011_register_devices(void) { - sysbus_register_dev("pl011", sizeof(pl011_state), - pl011_init_arm); - sysbus_register_dev("pl011_luminary", sizeof(pl011_state), - pl011_init_luminary); + sysbus_register_dev_fdt("pl011", sizeof(pl011_state), + pl011_init_arm, pl011_fdt_populate); + sysbus_register_dev_fdt("pl011_luminary", sizeof(pl011_state), + pl011_init_luminary, pl011_fdt_populate); } device_init(pl011_register_devices)