From patchwork Fri Jan 3 10:10:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 3431121 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id F2DF69F295 for ; Fri, 3 Jan 2014 11:02:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 65B632012B for ; Fri, 3 Jan 2014 11:02:30 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 08F5520127 for ; Fri, 3 Jan 2014 11:02:29 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vz1lm-0008RE-RK; Fri, 03 Jan 2014 10:14:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vz1l0-0003Q0-20; Fri, 03 Jan 2014 10:13:34 +0000 Received: from mail-ea0-f174.google.com ([209.85.215.174]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vz1jf-0003Ch-MF for linux-arm-kernel@lists.infradead.org; Fri, 03 Jan 2014 10:12:12 +0000 Received: by mail-ea0-f174.google.com with SMTP id b10so6629736eae.19 for ; Fri, 03 Jan 2014 02:11:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:in-reply-to:references:content-type; bh=Vzsif5ttPoAx3/sdfwVmcry+PKEKkGCw8+Jm77sXFCs=; b=Iu2xZVXL8ah77yvEJ0TwrEQXRFfFiaeKJcOBQ6kSEZ/NqZM3kIQmRad0RFbVUmjya4 wpOITYX9us8dfSkvkP6bXEJbiXUM6QXi17rtJVzKsZ6yu/h2akNuCU6VIrKNsCSWOylB K+Bp/uu9DbJPw70LoRU2wb6M9RdQY4hGFNcTAsJaT2f9cz3Lh95cnpJZ1fSnA6HaT5OV xaSZCB/2V6r3CFUHLiBGxOdIC/nYx9pbXCwg8EVMx2j5hI+nsHKKz12E1uXhFMwdNnfb DYaJwmI9fvub/O9Qs1B/HJsHP2RBscV76j+ofsnS6UbgW3GgtMV3tetS1+zcu2G16ViC d6aA== X-Gm-Message-State: ALoCoQk4DTNZpmt67pAfhNjrs/ZwVqtw9MKRWuvicym2jHD/EPvll/0r0LrQYdgmj5zuMY/9UoPD X-Received: by 10.14.110.134 with SMTP id u6mr1426822eeg.87.1388743909907; Fri, 03 Jan 2014 02:11:49 -0800 (PST) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPSA id g47sm143601837eeo.19.2014.01.03.02.11.48 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Fri, 03 Jan 2014 02:11:48 -0800 (PST) From: Michal Simek To: Michal Simek , u-boot@lists.denx.de, Joe Hershberger , linux-arm-kernel@lists.infradead.org, Albert Aribaud , Tom Rini Subject: [PATCH v1 13/24] serial: zynq: Add OF initialization support Date: Fri, 3 Jan 2014 11:10:58 +0100 Message-Id: X-Mailer: git-send-email 1.8.2.3 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140103_051211_900112_7C4F1CF0 X-CRM114-Status: GOOD ( 14.46 ) X-Spam-Score: -1.9 (-) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add console selection from DTB which is enough to have OF driven solution. Signed-off-by: Michal Simek --- Changes in v1: None drivers/serial/serial_zynq.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) -- 1.8.2.3 diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 9b24af2..3f7fcfa 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -6,12 +6,15 @@ */ #include +#include #include #include #include #include #include +DECLARE_GLOBAL_DATA_PTR; + #define ZYNQ_UART_SR_TXFULL 0x00000010 /* TX FIFO full */ #define ZYNQ_UART_SR_RXEMPTY 0x00000002 /* RX FIFO empty */ @@ -191,6 +194,30 @@ DECLARE_PSSERIAL_FUNCTIONS(1); struct serial_device uart_zynq_serial1_device = INIT_PSSERIAL_STRUCTURE(1, "ttyPS1"); +#ifdef CONFIG_OF_CONTROL +__weak struct serial_device *default_serial_console(void) +{ + const void *blob = gd->fdt_blob; + int node; + unsigned int base_addr; + + node = fdt_path_offset(blob, "serial0"); + if (node < 0) + return NULL; + + base_addr = fdtdec_get_addr(blob, node, "reg"); + if (base_addr == FDT_ADDR_T_NONE) + return NULL; + + if (base_addr == ZYNQ_SERIAL_BASEADDR0) + return &uart_zynq_serial0_device; + + if (base_addr == ZYNQ_SERIAL_BASEADDR1) + return &uart_zynq_serial1_device; + + return NULL; +} +#else __weak struct serial_device *default_serial_console(void) { #ifdef CONFIG_ZYNQ_SERIAL_BASEADDR0 @@ -203,6 +230,7 @@ __weak struct serial_device *default_serial_console(void) #endif return NULL; } +#endif void zynq_serial_initalize(void) {