From patchwork Sat Feb 28 05:06:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 444848 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 F00EF14008F for ; Mon, 2 Mar 2015 07:46:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 38074AB7E3; Sun, 1 Mar 2015 21:38:48 +0100 (CET) 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 GCycN2dsY2lU; Sun, 1 Mar 2015 21:38:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2650CA765E; Sun, 1 Mar 2015 21:38:20 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 501314B61E for ; Sat, 28 Feb 2015 06:32:40 +0100 (CET) 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 lThd3Gdz3sQw for ; Sat, 28 Feb 2015 06:32:40 +0100 (CET) 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-pa0-f73.google.com (mail-pa0-f73.google.com [209.85.220.73]) by theia.denx.de (Postfix) with ESMTPS id C04E84B61D for ; Sat, 28 Feb 2015 06:32:39 +0100 (CET) Received: by pablf10 with SMTP id lf10so7253158pab.0 for ; Fri, 27 Feb 2015 21:32:38 -0800 (PST) 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:in-reply-to :references; bh=bkSa2wBDX9WhlvJFj7G/ycuc1ZsfClGz1YPsyDHJtSE=; b=UFdPmvZh5CbfW4fgf3VJM9JB5nPnacMS9ZD0LKuQOoQYqEm8b2yWpI2yBb6d6Nw78g SGQrdCS47g6T22mJsMCOvQjyfIrNV2ccxopnkp5IuKZLq1EXtTF5yJByAyREEsInbXho is7Bz5zvcT16rKaQPlveMTziGD8Y9VUT3B9dahDDAkRTbmLTXWW11QxnY4F+j6TLOsN5 BEOJjik39WY0gXetb2kzQAoMaK/4A3TJqbgAo7WSlkS2sqgoInWVH6JOqhm0SOVndfsb UiLawOw0Tdn2r2/jNCUU1++XWHSH2i9mRfyH1MdWkSUmxuuoVpSOF6flj+BR22wDaDRM GLaA== X-Gm-Message-State: ALoCoQk2u7Yc737MVm1sR4Nku4buDyzK8qPzuEbnGPx4reamGdY+E3MXtSn8VsoFwFKK7epSNoSJ X-Received: by 10.68.241.163 with SMTP id wj3mr16266960pbc.8.1425100053850; Fri, 27 Feb 2015 21:07:33 -0800 (PST) Received: from corpmail-nozzle1-1.hot.corp.google.com ([100.108.1.104]) by gmr-mx.google.com with ESMTPS id l42si241698yhq.1.2015.02.27.21.07.33 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Feb 2015 21:07:33 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-1.hot.corp.google.com with ESMTP id zaxDOXQI.2; Fri, 27 Feb 2015 21:07:33 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 5790C22092A; Fri, 27 Feb 2015 22:07:33 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Fri, 27 Feb 2015 22:06:43 -0700 Message-Id: <1425100013-4796-20-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1425100013-4796-1-git-send-email-sjg@chromium.org> References: <1425100013-4796-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH 19/29] dm: serial: Don't support CONFIG_CONS_INDEX with device tree 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" This feature should be deprecated for new boards, and significantly adds to SPL code size. Drop it. Instead, we can use stdout-path in the /chosen node. Signed-off-by: Simon Glass --- drivers/serial/serial-uclass.c | 69 ++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 32 deletions(-) diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 13ba606..6531841 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -32,49 +32,54 @@ static const unsigned long baudrate_table[] = CONFIG_SYS_BAUDRATE_TABLE; static void serial_find_console_or_panic(void) { struct udevice *dev; - -#ifdef CONFIG_OF_CONTROL int node; - /* Check for a chosen console */ - node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path"); - if (node < 0) - node = fdt_path_offset(gd->fdt_blob, "console"); - if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, &dev)) { - gd->cur_serial_dev = dev; - return; - } - - /* - * If the console is not marked to be bound before relocation, bind - * it anyway. - */ - if (node > 0 && - !lists_bind_fdt(gd->dm_root, gd->fdt_blob, node, &dev)) { - if (!device_probe(dev)) { + if (OF_CONTROL) { + /* Check for a chosen console */ + node = fdtdec_get_chosen_node(gd->fdt_blob, "stdout-path"); + if (node < 0) + node = fdt_path_offset(gd->fdt_blob, "console"); + if (!uclass_get_device_by_of_offset(UCLASS_SERIAL, node, + &dev)) { gd->cur_serial_dev = dev; return; } - } -#endif - /* - * Try to use CONFIG_CONS_INDEX if available (it is numbered from 1!). - * - * Failing that, get the device with sequence number 0, or in extremis - * just the first serial device we can find. But we insist on having - * a console (even if it is silent). - */ + + /* + * If the console is not marked to be bound before relocation, + * bind it anyway. + */ + if (node > 0 && + !lists_bind_fdt(gd->dm_root, gd->fdt_blob, node, &dev)) { + if (!device_probe(dev)) { + gd->cur_serial_dev = dev; + return; + } + } + } else { + /* + * Try to use CONFIG_CONS_INDEX if available (it is numbered + * from 1!). + * + * Failing that, get the device with sequence number 0, or in + * extremis just the first serial device we can find. But we + * insist on having a console (even if it is silent). + */ #ifdef CONFIG_CONS_INDEX #define INDEX (CONFIG_CONS_INDEX - 1) #else #define INDEX 0 #endif - if (uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) && - uclass_get_device(UCLASS_SERIAL, INDEX, &dev) && - (uclass_first_device(UCLASS_SERIAL, &dev) || !dev)) - panic_str("No serial driver found"); + if (!uclass_get_device_by_seq(UCLASS_SERIAL, INDEX, &dev) || + !uclass_get_device(UCLASS_SERIAL, INDEX, &dev) || + (!uclass_first_device(UCLASS_SERIAL, &dev) || dev)) { + gd->cur_serial_dev = dev; + return; + } #undef INDEX - gd->cur_serial_dev = dev; + } + + panic_str("No serial driver found"); } /* Called prior to relocation */