From patchwork Wed Aug 2 09:34:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonas Gorski X-Patchwork-Id: 9876455 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 E60D460360 for ; Wed, 2 Aug 2017 09:40:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D8707287A6 for ; Wed, 2 Aug 2017 09:40:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB6CA287A9; Wed, 2 Aug 2017 09:40:55 +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=-1.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE 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 B0968287B2 for ; Wed, 2 Aug 2017 09:40:54 +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=Gff4di7cqDilPGFtuiekyE5nBWdKITsiuHPTEicXHSc=; b=cyizZeihZgMWBC9GYnTW3LfmYH ZciCM5w6dxO4L5nQ213H0ZbbgiV4MJFnhPGnCkjjRjxb9Mkz51Y5WPS9PwhNQi8hBZsEKyGF+2U+j oCYc6DaFOlA5/dtDw6obN0Tco46YzwaCi7F9idK0Q0kNIJo+KiPFbB4tu4F2ZlbyB6BlizbKyfodZ 1tHgUkDfuzCEq4YZMV91uPNMh5Ksy084PEcQv9dCWHgnjtegNEMTNEU6x78WaLfuwvk3rDFAnCou+ AppADd8uZdGpduaRADY+Ez4cKSFy/LMW1LHamcCnEzBGmIhDyxeIMW3qHYmSZBW5XH+zc09801yWN HFWxZKcQ==; 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 1dcq8C-00037z-7K; Wed, 02 Aug 2017 09:39:56 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dcq3y-0000Lv-GX for linux-arm-kernel@lists.infradead.org; Wed, 02 Aug 2017 09:35:52 +0000 Received: by mail-wm0-x244.google.com with SMTP id x64so6440058wmg.1 for ; Wed, 02 Aug 2017 02:35:14 -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=aRyFCoe117iGY9GNtxAzGRAcuRM5BCQSJyw4QdiD1ms=; b=jp+LcrgercB3195ZS9x6yb7nh426BHgbNyiI/uFVdmTaIoT/+d48UwS4c+vppmpaRc b1AOWTOOkEM1r6EaoVkysAHIeUZxstK/Y4fu44Gttu9lfbwBnBiaPQ1YA75wyw7VZnI1 xjXpNQPSFxdw1VDkaNkZ8fvogfF6Fwykvx1nyKB89LAREtRQcblLoVYGhDKy9kRNlwhZ U8rnJq/zjAxt4ogc+4dCfOI0AsumZi1PGWM1ExJ6enqcgdYrKYRQaH3U7Hzd7BL+k0zn zsESnZ92X0G4Fd8kTAMEWVgQowN57uPJSlKhrMCP6JYB0qAoJmhk7VqOPCly71cORlOC r8fQ== 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=aRyFCoe117iGY9GNtxAzGRAcuRM5BCQSJyw4QdiD1ms=; b=DJHbQaATtAqSWxrt922NyevtwH3Qk16okOyLwAE5mKYqE9wgLneb3EKL/LfrhV9sw9 rYxJWpv96GCkx8jHvN6egJrIsZi15N5ytVTBKr3vPT+oEAtsrz8lCHHA0hF1vWO2+Ng4 SWFORe5qKcTLeAwrfTFldIYetHjDP00Ko6J9KU47oD11FNBeDkPM7LBTHa3Cc2ioItjd UWGGlWgCEhozYjTsFDErSxFlv4UjYbmv/3KQa8c1YUhEuL8mgKCm4hoAoqvtXc5iFvhX u1x6RC+2OcPw/D978hmSF4U1G1f27m9HEkQfFRBlC0Vwb3AtZZA0M96K64tXZ9rvED68 aoSQ== X-Gm-Message-State: AIVw112ogw3rKkfJKzNOO4Z+c63yDqj43dYxWJfCicrTwpcpDYTDgUAQ ghmS83GHF9qoog== X-Received: by 10.28.105.210 with SMTP id z79mr3436259wmh.33.1501666512655; Wed, 02 Aug 2017 02:35:12 -0700 (PDT) Received: from localhost.localdomain ([2001:470:9e39::48e]) by smtp.gmail.com with ESMTPSA id 91sm32058876wrg.83.2017.08.02.02.35.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2017 02:35: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, netdev@vger.kernel.org Subject: [PATCH 4/8] tty/bcm63xx_uart: allow naming clock in device tree Date: Wed, 2 Aug 2017 11:34:25 +0200 Message-Id: <20170802093429.12572-5-jonas.gorski@gmail.com> X-Mailer: git-send-email 2.13.2 In-Reply-To: <20170802093429.12572-1-jonas.gorski@gmail.com> References: <20170802093429.12572-1-jonas.gorski@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170802_023535_130520_FF79DC41 X-CRM114-Status: GOOD ( 10.93 ) 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, Jiri Slaby , "David S. Miller" 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). Signed-off-by: Jonas Gorski Acked-by: Rob Herring Acked-by: Greg Kroah-Hartman --- 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;