From patchwork Mon Apr 6 14:07:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 458386 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id B22831401E7 for ; Tue, 7 Apr 2015 00:08:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 95F684A047; Mon, 6 Apr 2015 16:08:03 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id V7-5t21xn4no; Mon, 6 Apr 2015 16:08:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DA7E74A03B; Mon, 6 Apr 2015 16:08:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 942D34A03B for ; Mon, 6 Apr 2015 16:07:59 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UTxJXqGtco3I for ; Mon, 6 Apr 2015 16:07:59 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by theia.denx.de (Postfix) with ESMTPS id 11CE94A039 for ; Mon, 6 Apr 2015 16:07:56 +0200 (CEST) Received: by pdbnk13 with SMTP id nk13so45705656pdb.0 for ; Mon, 06 Apr 2015 07:07:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=pW2x2rJgI/O8mp3yrriD3OIJYQSj2r42al9yBehs1Vk=; b=g2UwCvak2wFOIjoPICUOEBR2wu83IxbjRUpMfB6y6KDVv00PF1nEmDssNkh5AJSLWL kDrdoxxajMNu+deBEqsHBCW33qJlgfMhTIPoEfr9aHbDTqVjSvY7EIW71cJzK/NigeOx n4P6cJpECRWnXoio7EXTyrGSJ1zXM4arcltY/71wB8Bd/aMcBjPMnqUAS8v01Ic/prlm aiUBc1NwxjNp3SQ03y/74mZrxF+vAnj8lqQPy3/tR9SXcYOglxLNeqaChCuZBi00CdXo /kWhEk64qxjOV08TgVQgS28bROZUSv4g5lh2PQyrN4Iul6X5R6MRcjCIpca+MDq4ydVM pgzg== X-Gm-Message-State: ALoCoQkKCZNmDXhl3s0p8DxnU7v9HVw89CwbLMRPHQVJFQAuiC9MXTdN2OXr+K2yTtI464U3lzGS X-Received: by 10.70.53.40 with SMTP id y8mr27988008pdo.61.1428329274771; Mon, 06 Apr 2015 07:07:54 -0700 (PDT) Received: from tharvey.gw (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by mx.google.com with ESMTPSA id bo2sm4823088pbb.1.2015.04.06.07.07.53 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Apr 2015 07:07:54 -0700 (PDT) From: Tim Harvey To: Simon Glass Date: Mon, 6 Apr 2015 07:07:48 -0700 Message-Id: <1428329268-2558-1-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 1.9.1 Cc: u-boot@lists.denx.de Subject: [U-Boot] [PATCH] fdt: add new fdt_fixup_display function to configure display X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add 'fdt_fixup_display' function to fixup device-tree for a specific display. This is useful if a device-tree has configurations for multiple display timings for undetectable displays. Signed-off-by: Tim Harvey --- common/fdt_support.c | 31 +++++++++++++++++++++++++++++++ include/fdt_support.h | 1 + 2 files changed, 32 insertions(+) diff --git a/common/fdt_support.c b/common/fdt_support.c index 8266bca..60609e5 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1560,3 +1560,34 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, return 0; } + +/* + * Update native-mode in display-timings from display environment variable. + * The node to update are specified by path. + */ +int fdt_fixup_display(void *blob, const char *path, const char *display) +{ + int off, toff; + + if (!display || !path) + return -1; + + toff = fdt_path_offset(blob, path); + if (toff >= 0) + toff = fdt_subnode_offset(blob, toff, "display-timings"); + if (toff < 0) + return toff; + + for (off = fdt_first_subnode(blob, toff); + off >= 0; + off = fdt_next_subnode(blob, off)) { + uint32_t handle = fdt_get_phandle(blob, off); + debug("%s:0x%x\n", fdt_get_name(blob, off, NULL), + fdt32_to_cpu(handle)); + if (strcasecmp(fdt_get_name(blob, off, NULL), display) == 0) { + fdt_setprop_u32(blob, toff, "native-mode", handle); + break; + } + } + return toff; +} diff --git a/include/fdt_support.h b/include/fdt_support.h index ae5e8a3..98379d3 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -46,6 +46,7 @@ void fdt_fixup_ethernet(void *fdt); int fdt_find_and_setprop(void *fdt, const char *node, const char *prop, const void *val, int len, int create); void fdt_fixup_qe_firmware(void *fdt); +int fdt_fixup_display(void *blob, const char *path, const char *display); #if defined(CONFIG_HAS_FSL_DR_USB) || defined(CONFIG_HAS_FSL_MPH_USB) void fdt_fixup_dr_usb(void *blob, bd_t *bd);