From patchwork Wed Sep 20 11:14:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 9961303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 87EFC600C5 for ; Wed, 20 Sep 2017 11:19:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7A4C5290B7 for ; Wed, 20 Sep 2017 11:19:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EDF6290BB; Wed, 20 Sep 2017 11:19:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EA2E4290B7 for ; Wed, 20 Sep 2017 11:19:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=wAnFuKZ4OpqVZAs0SlG+XRb2A5ZIRnAysfuH4Op6fB8=; b=jXa0AhI9rf1uAtlh4OgoYl9kEF +8TER7rXWSD44qkQDoyeiermOFsGr/AaXthHIMm5LcYRo1S35dC6wdwfMm2b6AtcpEoLue9h/U2ZO XcUn3gmh9ecIQ6mHi57F3TRynuFHLT4VWaEcNl4NgHYP+nR9gvsegZ64f1K2Y5cqetN1s3ff032sk AAi9mPLH2146ozrViFFfyAU00R+R3rMVVJFk+iKiX7jcE3iPFeQNQF/DO0hXtpjr2S6mNqLyXTKtq mJKDbbig6dmyJni9uGBMFPJbaDR+ir6fhQjc6qtDk/LRwhCG+qQeGghdSKULlRy6pizm6i7/L/nga 7XGV67xQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dud1z-0003TB-6d; Wed, 20 Sep 2017 11:19:03 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ducza-0001Y2-ED for linux-arm-kernel@lists.infradead.org; Wed, 20 Sep 2017 11:16:41 +0000 Received: by mail-wm0-x242.google.com with SMTP id m127so2132108wmm.0 for ; Wed, 20 Sep 2017 04:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aoZqJe/zJsKqD6CDebjOGOq+Cjc7ASV8t1qCFib6cac=; b=s3+KtIu2W/1tt8ZCY4noZpgLx7eLclxZrZwAJO9oVj/3qpxHnETqpbOqbGsYTrZiSk Iu0fazp9VCX5H/XmXAu8Gr+P3tMgi4bs3O5JYv/9hxf7lN6M9ujSdSUSOnCjgqg2fina QBRtoU75TBmUJRwohj5z6YKi4vRuiwxyO1CyyIIcAyxljhHJF2L8Umny3zKPqdTqOVK7 R8j9ByT1FRxcSi/gzvPIS7uSk2N4so1hobPu+gojDBoXf2Qrmwi85nwDZymrKU+y1NAX Nmz7TRgDPtni0EK6uDl9u9614C5tjq/dmEbobveoe4E+KHr12a+4DViYwg5ydfsZsugw YOOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aoZqJe/zJsKqD6CDebjOGOq+Cjc7ASV8t1qCFib6cac=; b=YNeZMzctzf8oqIE04zNILrycu/0h3bCIdec63sKnjwscfmcuJFrPAgDLsm5AVsxkmd bLIRcYoDHCsKD3ZHzPsXOem9HsPPXRPsQTpayG6rMdgl+K6Nq6xPHGsfF4IWMm0IHZMg tuB3Nd5samt6nHl5VKnyOK9x17I9+F2ZZ/y/vHcJGuWaxIruU5On5iEuKO3/CpCNVVmc YRp8X5XrDc2z10a6c5Ntl8I+kUxAqAZIBytLBL1nWH8crDdGP8sjcYfmUhu0zYqrtdRF xD5Vonykq00NgBrZsT5JqK/KSCI/kBezg5ar/zxBuMg+Md7o3X1c0k5agIBTeQxrFAgV grDA== X-Gm-Message-State: AHPjjUjn269alkly2zqeY+fBFzy3zUHCxYTfXgdiRNQSGcvE531nLy/S 8YpU7c5sVSe2mBTzgOGexx8= X-Google-Smtp-Source: AOwi7QAKV3xyf91HFB7r9ib7XtlLLbOzoLuVQYI0e3+jVyY44iSsWc4BZqjtfAzvrSZmzk8pMTMSnw== X-Received: by 10.80.206.11 with SMTP id y11mr4398662edi.94.1505906172634; Wed, 20 Sep 2017 04:16:12 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::48e]) by smtp.gmail.com with ESMTPSA id s12sm884513edd.25.2017.09.20.04.16.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 04:16:12 -0700 (PDT) From: Jonas Gorski To: linux-mips@linux-mips.org, linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH V2 4/8] tty/bcm63xx_uart: allow naming clock in device tree Date: Wed, 20 Sep 2017 13:14:04 +0200 Message-Id: <20170920111408.29711-5-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170920111408.29711-1-jonas.gorski@gmail.com> References: <20170920111408.29711-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170920_041634_846110_77D32BA5 X-CRM114-Status: GOOD ( 10.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Florian Fainelli , Greg Kroah-Hartman , Kevin Cernekee , Russell King , Ralf Baechle , Rob Herring , bcm-kernel-feedback-list@broadcom.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Codify using a named clock for the refclk of the uart. This makes it easier if we might need to add a gating clock (like present on the BCM6345). Acked-by: Rob Herring Acked-by: Greg Kroah-Hartman Reviewed-by: Florian Fainelli Signed-off-by: Jonas Gorski --- Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt | 6 ++++++ drivers/tty/serial/bcm63xx_uart.c | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt index 5c52e5eef16d..8b2b0460259a 100644 --- a/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt +++ b/Documentation/devicetree/bindings/serial/brcm,bcm6345-uart.txt @@ -11,6 +11,11 @@ Required properties: - clocks: Clock driving the hardware; used to figure out the baud rate divisor. + +Optional properties: + +- clock-names: Should be "refclk". + Example: uart0: serial@14e00520 { @@ -19,6 +24,7 @@ Example: interrupt-parent = <&periph_intc>; interrupts = <2>; clocks = <&periph_clk>; + clock-names = "refclk"; }; clocks { diff --git a/drivers/tty/serial/bcm63xx_uart.c b/drivers/tty/serial/bcm63xx_uart.c index a2b9376ec861..f227eff28d3a 100644 --- a/drivers/tty/serial/bcm63xx_uart.c +++ b/drivers/tty/serial/bcm63xx_uart.c @@ -841,8 +841,10 @@ static int bcm_uart_probe(struct platform_device *pdev) if (!res_irq) return -ENODEV; - clk = pdev->dev.of_node ? of_clk_get(pdev->dev.of_node, 0) : - clk_get(&pdev->dev, "refclk"); + clk = clk_get(&pdev->dev, "refclk"); + if (IS_ERR(clk) && pdev->dev.of_node) + clk = of_clk_get(pdev->dev.of_node, 0); + if (IS_ERR(clk)) return -ENODEV;