Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp499705imu; Wed, 9 Jan 2019 01:14:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN6NZhX+aQknVGEZwznEpdClbRPXXN89/AJ5mGy72X4govGlPcurVyXwNb6WTNEG6NxBInMK X-Received: by 2002:a63:5e43:: with SMTP id s64mr4659766pgb.101.1547025255111; Wed, 09 Jan 2019 01:14:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547025255; cv=none; d=google.com; s=arc-20160816; b=IwENmsYYuhY58q/z3aDXp0yhWAzr0DyX4QYfFk8GexyqHsoy9UjynNt1uZQTaR8JfP jLJmlAp7n7TaQTV506WKmWbr0LFGPTmXUiqM4EiPJs4eZibsybDM1OtcYcJ9fnhOdk9t mhAUijRg+bybbU9dfRoTJ7d7wv2Wh7cYp5rMjSYDr7arMl4Al8lzmInHoxTADqbboOze pIGSP8Kf1DvMWzJya0m3/BgUE5OiFZCf3rylHtpqOmvH5ONFB1JJAix2Fyx/TSvEzNSn jP70eFAoTyRwPvGUH4GzYF/wNq4Di6ncx2E1E6WV5UihxU7UXxlnpT18QS5ddiceuPhI 3CyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8ot+0O6B2BbAUmeHp7l9V33Ie/x+1Yqbqw8R1x1htvo=; b=Qp5hWJte3MgriyXIML4ZFNxxP1dAgTua8EGQVlBgfoOahalj0itWRueQU028DIgZff i5043F1Sygi90R2sLn6xKEdahhLCvqZp/jOcbCUz26rQA0lQjz5/P8Hipt1olt58vSEx OXCE8VDXysHUVZGd6gMWYTnqZGfMS1CxnXXRGE9vby7i7YyWrp1r+1ovZc8/C97uohYw QlzNYEbrvykBngOcaSm8kwfKt8dWx6qgzINrtwJbY8xn/qgkJUhDMkJCHbx25tLelVxr ac/Zech574q17D96GLQ5fkmOkEIYqhSymJW2HL3MxmjCHg93dlGtnfzUA8TgFoRMj1aL f/hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="L9Dn6Z/h"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10si24080061plm.1.2019.01.09.01.13.59; Wed, 09 Jan 2019 01:14:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="L9Dn6Z/h"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730224AbfAIJLi (ORCPT + 99 others); Wed, 9 Jan 2019 04:11:38 -0500 Received: from fllv0016.ext.ti.com ([198.47.19.142]:44782 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730200AbfAIJLe (ORCPT ); Wed, 9 Jan 2019 04:11:34 -0500 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x099BSxm126956; Wed, 9 Jan 2019 03:11:28 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1547025088; bh=8ot+0O6B2BbAUmeHp7l9V33Ie/x+1Yqbqw8R1x1htvo=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=L9Dn6Z/h4NN64Kaq/w8xTP+iqFBydxHFIw7rh0PQLcDdIeTYyOBMrtk1eQPtN6NpP 8l1ea3y0/0NAvKeQISMcl84RuWoZ9zzsIrvxualM+WT5YSiQmjo8qaRctk58vlHlkH vdfXC0iWFhdRyC4JpOAMXwsT3PyDsiOvvn+pTEOM= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x099BS53111657 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 9 Jan 2019 03:11:28 -0600 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1591.10; Wed, 9 Jan 2019 03:11:28 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1591.10 via Frontend Transport; Wed, 9 Jan 2019 03:11:28 -0600 Received: from a0132425.india.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id x099BFBR017497; Wed, 9 Jan 2019 03:11:25 -0600 From: Vignesh R To: Greg Kroah-Hartman , Rob Herring CC: Jiri Slaby , Vignesh R , Tony Lindgren , Lokesh Vutla , , , , Subject: [PATCH 3/3] serial: 8250_omap: Use clk_get_rate() to obtain fclk frequency Date: Wed, 9 Jan 2019 14:42:06 +0530 Message-ID: <20190109091206.25759-4-vigneshr@ti.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190109091206.25759-1-vigneshr@ti.com> References: <20190109091206.25759-1-vigneshr@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 8250_omap driver uses clock-frequency DT property to obtain functional clk frequency. This is not ideal as users need to calculate functional clk frequency offline and populate it in DT. Therefore add support to obtain functional clock frequency using clk APIs when clock-frequency DT property is not defined. Suggested-by: Lokesh Vutla Signed-off-by: Vignesh R --- drivers/tty/serial/8250/8250_omap.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c index a74126569785..0a8316632d75 100644 --- a/drivers/tty/serial/8250/8250_omap.c +++ b/drivers/tty/serial/8250/8250_omap.c @@ -12,6 +12,7 @@ #define SUPPORT_SYSRQ #endif +#include #include #include #include @@ -1203,7 +1204,18 @@ static int omap8250_probe(struct platform_device *pdev) } up.port.line = ret; - of_property_read_u32(np, "clock-frequency", &up.port.uartclk); + if (of_property_read_u32(np, "clock-frequency", &up.port.uartclk)) { + struct clk *clk; + + clk = devm_clk_get(&pdev->dev, NULL); + if (IS_ERR(clk)) { + if (PTR_ERR(clk) == -EPROBE_DEFER) + return -EPROBE_DEFER; + } else { + up.port.uartclk = clk_get_rate(clk); + } + } + priv->wakeirq = irq_of_parse_and_map(np, 1); id = of_match_device(of_match_ptr(omap8250_dt_ids), &pdev->dev); -- 2.20.1